colemak.plugin.zsh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # ctrl-j newline
  2. bindkey '^n' accept-line
  3. bindkey -a '^n' accept-line
  4. # another rotation to match qwerty
  5. bindkey -a 'n' down-line-or-history
  6. bindkey -a 'e' up-line-or-history
  7. bindkey -a 'i' vi-forward-char
  8. # make qwerty
  9. bindkey -a 'k' vi-repeat-search
  10. bindkey -a 'K' vi-rev-repeat-search
  11. bindkey -a 'u' vi-insert
  12. bindkey -a 'U' vi-insert-bol
  13. bindkey -a 'l' vi-undo-change
  14. bindkey -a 'N' vi-join
  15. # spare
  16. bindkey -a 'j' vi-forward-word-end
  17. bindkey -a 'J' vi-forward-blank-word-end
  18. # Handle $0 according to the standard:
  19. # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
  20. 0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
  21. 0="${${(M)0:#/*}:-$PWD/$0}"
  22. # New less versions will read this file directly
  23. export LESSKEYIN="${0:h:A}/colemak-less"
  24. # Only run lesskey if less version is older than v582
  25. less_ver=$(less --version | awk '{print $2;exit}')
  26. autoload -Uz is-at-least
  27. if ! is-at-least 582 $less_ver; then
  28. # Old less versions will read this transformed file
  29. export LESSKEY="${0:h:A}/.less"
  30. lesskey -o "$LESSKEY" "$LESSKEYIN" 2>/dev/null
  31. fi
  32. unset less_ver