LoginSignup
5
0

More than 3 years have passed since last update.

zshで前のディレクトリに簡単に戻る方法

Posted at

ターミナルで cd して「あ〜前のディレクトリに戻りたい〜」ってことよくあるじゃないですか。

cd -1 とかでも戻れますが、もっとブラウザの戻るみたいな感じでライトに戻りたいじゃないですか。

それを可能にするのがこういう設定です。

.zshrc
zle -N dir_forward
zle -N dir_back
bindkey '[1;6C' dir_forward # 私の環境ではCtrl-Shift-Left
bindkey '[1;6D' dir_back    # 私の環境ではCtrl-Shift-Left

zsh_back_dir.gif

これでブラウザみたいな感じでディレクトリを行き来することができます :tada:

5
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
0