thefuck.plugin.zsh 474 Bytes
Newer Older
1
2
3
4
5
if [[ -z $commands[thefuck] ]]; then
    echo 'thefuck is not installed, you should "pip install thefuck" first'
    return -1
fi

6
7
# Register alias
eval "$(thefuck-alias)"
8

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
13
14
15
16
17
    BUFFER=$FUCK
    zle end-of-line
}
zle -N fuck-command-line
# Defined shortcut keys: [Esc] [Esc]
bindkey "\e\e" fuck-command-line