summaryrefslogtreecommitdiff
path: root/plugins/thefuck
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/thefuck')
-rw-r--r--plugins/thefuck/README.md6
-rw-r--r--plugins/thefuck/thefuck.plugin.zsh7
2 files changed, 10 insertions, 3 deletions
diff --git a/plugins/thefuck/README.md b/plugins/thefuck/README.md
index a9b7550d7..84f7255ce 100644
--- a/plugins/thefuck/README.md
+++ b/plugins/thefuck/README.md
@@ -2,8 +2,12 @@
[The Fuck](https://github.com/nvbn/thefuck) plugin — magnificent app which corrects your previous console command.
+To use it, add thefuck to the plugins array of your zshrc file:
+
+plugins=(... thefuck)
+
## Usage
Press `ESC` twice to correct previous console command.
## Notes
-`Esc`-`Esc` key binding conflicts with [sudo](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/sudo) plugin.
+`Esc`-`Esc` key binding conflicts with [sudo](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/sudo) plugin.
diff --git a/plugins/thefuck/thefuck.plugin.zsh b/plugins/thefuck/thefuck.plugin.zsh
index ac88e67de..2ab4eb6e2 100644
--- a/plugins/thefuck/thefuck.plugin.zsh
+++ b/plugins/thefuck/thefuck.plugin.zsh
@@ -5,7 +5,8 @@ if [[ -z $commands[thefuck] ]]; then
fi
# Register alias
-eval "$(thefuck --alias)"
+[[ ! -a $ZSH_CACHE_DIR/thefuck ]] && thefuck --alias > $ZSH_CACHE_DIR/thefuck
+source $ZSH_CACHE_DIR/thefuck
fuck-command-line() {
local FUCK="$(THEFUCK_REQUIRE_CONFIRMATION=0 thefuck $(fc -ln -1 | tail -n 1) 2> /dev/null)"
@@ -15,4 +16,6 @@ fuck-command-line() {
}
zle -N fuck-command-line
# Defined shortcut keys: [Esc] [Esc]
-bindkey "\e\e" fuck-command-line
+bindkey -M emacs '\e\e' fuck-command-line
+bindkey -M vicmd '\e\e' fuck-command-line
+bindkey -M viins '\e\e' fuck-command-line