Skip to content

Instantly share code, notes, and snippets.

@kergoth
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kergoth/ab858d8bfd37a4770592 to your computer and use it in GitHub Desktop.
Save kergoth/ab858d8bfd37a4770592 to your computer and use it in GitHub Desktop.
slash-backward-word() {
local WORDCHARS="${WORDCHARS:s@/@}"
zle backward-word
}
zle -N slash-backward-word
slash-forward-word() {
local WORDCHARS="${WORDCHARS:s@/@}"
zle forward-word
}
zle -N slash-forward-word
slash-backward-kill-word() {
local WORDCHARS="${WORDCHARS:s@/@}"
zle backward-kill-word
}
zle -N slash-backward-kill-word
# Default navigation/deletion for the entire path, not components
WORDCHARS="${WORDCHARS:s@/@}/"
# alt-shift-left navigates between path components
bindkey '^[[1;10D' slash-backward-word
# alt-shift-right navigates between path components
bindkey '^[[1;10C' slash-forward-word
# alt-backspace deletes one path component
bindkey '\e^?' slash-backward-kill-word
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment