thefuck.plugin.zsh 476 B

1234567891011121314151617
  1. if [[ -z $commands[thefuck] ]]; then
  2. echo 'thefuck is not installed, you should "pip install thefuck" first'
  3. return -1
  4. fi
  5. # Register alias
  6. eval "$(thefuck --alias)"
  7. fuck-command-line() {
  8. local FUCK="$(THEFUCK_REQUIRE_CONFIRMATION=0 thefuck $(fc -ln -1 | tail -n 1) 2> /dev/null)"
  9. [[ -z $FUCK ]] && echo -n -e "\a" && return
  10. BUFFER=$FUCK
  11. zle end-of-line
  12. }
  13. zle -N fuck-command-line
  14. # Defined shortcut keys: [Esc] [Esc]
  15. bindkey "\e\e" fuck-command-line