Last active
December 19, 2017 11:28
-
-
Save yuryshulaev/518d46f0dc0bfe83dfcb to your computer and use it in GitHub Desktop.
.zshrc with parent directory traversal shortcuts (Ctrl+Up — pushd .., Ctrl+Down — popd)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd_parent_dir() { | |
[[ $(dirs | cut -f 1 -d ' ') != $(readlink -f `pwd`/..) ]] && pushd -q .. | |
zle reset-prompt | |
# print -Pn "\e]0;%~\a" # Tab title | |
} | |
cd_back() { | |
[[ $(dirs -v | wc -l) -ne 1 ]] && popd -q | |
zle reset-prompt | |
# print -Pn "\e]0;%~\a" # Tab title | |
} | |
bindkey '^[[1;5D' emacs-backward-word | |
bindkey '^[[1;5C' emacs-forward-word | |
zle -N cd_parent_dir | |
bindkey "^[[1;5A" cd_parent_dir | |
zle -N cd_back | |
bindkey "^[[1;5B" cd_back |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment