zshを使う

ずーーっとbashだったけれど、別に信仰があるわけじゃないので、いいかげんzsh使ってみる

参考リンクだけまとめる(自分が書かなくても他の人がいっぱい書いているからこれでいいや)

zshを使ってみる - Qiita

.zshrcの設定例(設定内容の説明コメント付き) - Qiita

最強のシェル zsh - Qiita

トラブル

zshにしたらpyenvが使えなくなった

zshにしたらpyenvが使えなくなった

djangoでも以下のようなエラーが出て焦る

[~/git/django-tutorial/tutorial/mysite] $python manage.py runserver                                                              (git)-[master]
  File "manage.py", line 14
    ) from exc
         ^
SyntaxError: invalid syntax
[~/git/django-tutorial/tutorial/mysite] $

~/.bashrcの中身を~/.zshrcにコピーするのを忘れていた

[~/git] $which pyenv                                                                                                             (git)-[master]
pyenv not found
[~/git] $sudo find / -name pyenv                                                                                                 (git)-[master]
[sudo] password for ludwig125:
/home/ludwig125/.pyenv/libexec/pyenv
/home/ludwig125/.pyenv/bin/pyenv
[~/git] $                                                                                                                        (git)-[master]
[~/git] $                                                                                                                        (git)-[master]
[~/git] $                                                                                                                        (git)-[master]
[~/git] $                                                                                                                        (git)-[master]
[~/git] $                                                                                                                        (git)-[master]
[~/git] $                                                                                                                        (git)-[master]
[~/git] $export PYENV_ROOT="$HOME/.pyenv"                                                                                        (git)-[master]
[~/git] $export PATH="$PYENV_ROOT/bin:$PATH"                                                                                     (git)-[master]
[~/git] $eval "$(pyenv init -)"                                                                                                  (git)-[master]
[~/git] $pyenv                                                                                                                   (git)-[master]
pyenv 1.1.5-8-g7b9d1a4
Usage: pyenv <command> [<args>]

Some useful pyenv commands are:
   commands    List all available pyenv commands
   local       Set or show the local application-specific Python version
   global      Set or show the global Python version
   shell       Set or show the shell-specific Python version
   install     Install a Python version using python-build
   uninstall   Uninstall a specific Python version
   rehash      Rehash pyenv shims (run this after installing executables)
   version     Show the current Python version and its origin
   versions    List all Python versions available to pyenv
   which       Display the full path to an executable
   whence      List all Python versions that contain the given executable

See `pyenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/pyenv/pyenv#readme
[~/git] $which pyenv                                                                                                             (git)-[master]
pyenv () {
        local command
        command="$1" 
        if [ "$#" -gt 0 ]
        then
                shift
        fi
        case "$command" in
                (rehash|shell) eval "$(pyenv "sh-$command" "$@")" ;;
                (*) command pyenv "$command" "$@" ;;
        esac
}
[~/git] $ 

ということでこれを~/.zshrcにコピーする

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"