Move fzf-history-search to utilities
Also rename to .fzf-history-search to avoid it turning up in normal command completion as an option.
This commit is contained in:
parent
2d56207f1e
commit
766ac3c5bf
@ -148,3 +148,22 @@ fi
|
|||||||
ls-iommu() {
|
ls-iommu() {
|
||||||
$HOME/.config/zsh/ls-iommu.sh | sort -n
|
$HOME/.config/zsh/ls-iommu.sh | sort -n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Fuzzy history search with fzf
|
||||||
|
function .fzf-history-search() {
|
||||||
|
local selected
|
||||||
|
selected=$(
|
||||||
|
cat $HISTFILE | # get entire history
|
||||||
|
sed 's/ *[0-9]* *//' | # remove cruft
|
||||||
|
awk '!seen[$0]++' | # remove duplicates
|
||||||
|
fzf --layout=reverse --tac --cycle --info=hidden \
|
||||||
|
--border=rounded --height=50%
|
||||||
|
)
|
||||||
|
if [[ -n "$selected" ]]; then
|
||||||
|
BUFFER="$selected"
|
||||||
|
zle end-of-line
|
||||||
|
fi
|
||||||
|
zle reset-prompt
|
||||||
|
}
|
||||||
|
zle -N .fzf-history-search
|
||||||
|
bindkey '^R' .fzf-history-search
|
||||||
|
19
zshrc
19
zshrc
@ -143,25 +143,6 @@ if [[ `uname` = Linux ]]; then
|
|||||||
[[ -n ${key[End]} ]] && bindkey "${key[End]}" end-of-line
|
[[ -n ${key[End]} ]] && bindkey "${key[End]}" end-of-line
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Fuzzy history search with fzf
|
|
||||||
function fzf-history-search() {
|
|
||||||
local selected
|
|
||||||
selected=$(
|
|
||||||
cat $HISTFILE | # get entire history
|
|
||||||
sed 's/ *[0-9]* *//' | # remove cruft
|
|
||||||
awk '!seen[$0]++' | # remove duplicates
|
|
||||||
fzf --layout=reverse --tac --cycle --info=hidden \
|
|
||||||
--border=rounded --height=50%
|
|
||||||
)
|
|
||||||
if [[ -n "$selected" ]]; then
|
|
||||||
BUFFER="$selected"
|
|
||||||
zle end-of-line
|
|
||||||
fi
|
|
||||||
zle reset-prompt
|
|
||||||
}
|
|
||||||
zle -N fzf-history-search
|
|
||||||
bindkey '^R' fzf-history-search
|
|
||||||
|
|
||||||
# Enable changing cursor shape based on vi mode
|
# Enable changing cursor shape based on vi mode
|
||||||
if [ "$ITERM_PROFILE" != "" ] && [ "$TMUX" = "" ]; then
|
if [ "$ITERM_PROFILE" != "" ] && [ "$TMUX" = "" ]; then
|
||||||
# iTerm2 cursor shape escape sequences outside tmux
|
# iTerm2 cursor shape escape sequences outside tmux
|
||||||
|
Loading…
x
Reference in New Issue
Block a user