my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
737 B

3 years ago
  1. if [[ -z $commands[thefuck] ]]; then
  2. echo 'thefuck is not installed, you should "pip install thefuck" or "brew install thefuck" first.'
  3. echo 'See https://github.com/nvbn/thefuck#installation'
  4. return 1
  5. fi
  6. # Register alias
  7. [[ ! -a $ZSH_CACHE_DIR/thefuck ]] && thefuck --alias > $ZSH_CACHE_DIR/thefuck
  8. source $ZSH_CACHE_DIR/thefuck
  9. fuck-command-line() {
  10. local FUCK="$(THEFUCK_REQUIRE_CONFIRMATION=0 thefuck $(fc -ln -1 | tail -n 1) 2> /dev/null)"
  11. [[ -z $FUCK ]] && echo -n -e "\a" && return
  12. BUFFER=$FUCK
  13. zle end-of-line
  14. }
  15. zle -N fuck-command-line
  16. # Defined shortcut keys: [Esc] [Esc]
  17. bindkey -M emacs '\e\e' fuck-command-line
  18. bindkey -M vicmd '\e\e' fuck-command-line
  19. bindkey -M viins '\e\e' fuck-command-line