zle.zsh 525 B

123456789101112131415161718192021222324
  1. #
  2. # Zle config
  3. #
  4. # autoescape specials chars with urls
  5. autoload -U url-quote-magic
  6. zle -N self-insert url-quote-magic
  7. # insert sudo at beggining of current command
  8. insert-sudo-prefix () {
  9. local prefix
  10. prefix='sudo'
  11. if [ "${BUFFER:0:${#prefix}}" != "$prefix" ]; then
  12. BUFFER="$prefix $BUFFER"
  13. CURSOR=$(($CURSOR + $#prefix + 1))
  14. fi
  15. }
  16. zle -N insert-sudo-prefix
  17. bindkey "^b" insert-sudo-prefix
  18. # make home and end keys work with tmux
  19. bindkey "^[[H" beginning-of-line
  20. bindkey "^[[F" end-of-line