Created
January 16, 2020 02:37
-
-
Save utdemir/3eddb8bafdc0b5b2a2e5a7efdc380724 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fzf-history-uniq() { | |
selected=$( | |
history 0 \ | |
| awk '{ | |
match($0, /^ *([0-9]+) *(.*)$/, r); | |
num=r[1]; cmd=r[2]; | |
if(s[cmd]=="") { print cmd; s[cmd]=1; } }' \ | |
| fzf --tac ) | |
BUFFER="$selected" | |
zle end-of-line | |
} | |
zle -N fzf-history-uniq | |
bindkey '^E' fzf-history-uniq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment