key-bindings.zsh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html
  2. # http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Builtins
  3. # http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Standard-Widgets
  4. bindkey -e # Use emacs key bindings
  5. bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark
  6. bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls
  7. bindkey -s '\e.' '..\n' # [Esc-.] - run command: .. (up directory)
  8. bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line.
  9. bindkey '^[[5~' up-line-or-history # [PageUp] - Up a line of history
  10. bindkey '^[[6~' down-line-or-history # [PageDown] - Down a line of history
  11. bindkey '^[[A' up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward
  12. bindkey '^[[B' down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward
  13. bindkey '^[[H' beginning-of-line # [Home] - Go to beginning of line
  14. bindkey '^[[1~' beginning-of-line # [Home] - Go to beginning of line
  15. bindkey '^[OH' beginning-of-line # [Home] - Go to beginning of line
  16. bindkey '^[[F' end-of-line # [End] - Go to end of line
  17. bindkey '^[[4~' end-of-line # [End] - Go to end of line
  18. bindkey '^[OF' end-of-line # [End] - Go to end of line
  19. bindkey ' ' magic-space # [Space] - do history expansion
  20. bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word
  21. bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word
  22. bindkey '^[[Z' reverse-menu-complete # [TODO] - Perform menu completion, like menu-complete, except that if a menu completion is already in progress, move to the previous completion rather than the next.
  23. # Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
  24. bindkey '^?' backward-delete-char # [Delete] - delete backward
  25. bindkey '^[[3~' delete-char # [fn-Delete] - delete forward
  26. bindkey '^[3;5~' delete-char # [TODO] - delete forward
  27. bindkey '\e[3~' delete-char # [TODO] - delete forward
  28. # consider emacs keybindings:
  29. #bindkey -e ## emacs key bindings
  30. #
  31. #bindkey '^[[A' up-line-or-search
  32. #bindkey '^[[B' down-line-or-search
  33. #bindkey '^[^[[C' emacs-forward-word
  34. #bindkey '^[^[[D' emacs-backward-word
  35. #
  36. #bindkey -s '^X^Z' '%-^M'
  37. #bindkey '^[e' expand-cmd-path
  38. #bindkey '^[^I' reverse-menu-complete
  39. #bindkey '^X^N' accept-and-infer-next-history
  40. #bindkey '^W' kill-region
  41. #bindkey '^I' complete-word
  42. ## Fix weird sequence that rxvt produces
  43. #bindkey -s '^[[Z' '\t'
  44. #