From 8890a4b604456b6930f70a2263984ad1da4ab55d Mon Sep 17 00:00:00 2001 From: druckdev Date: Wed, 14 Jul 2021 14:35:20 +0200 Subject: [PATCH] zsh:keys: Remove fzf-hist functionality Go back to a simpler approach, that the `fzf-history-widget` is only called on and ^K in normal mode and & scroll through the history normally. The reason behind this change is that there were still some edge cases in which the widget was wrongfully called when normal scrolling was intended. This change also makes it now possible that I can use commands in the 'surrounding' of a past command by first navigating to it with the fzf-widget and then just using & . --- .config/zsh/zshrc.d/60-keys.zsh | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/.config/zsh/zshrc.d/60-keys.zsh b/.config/zsh/zshrc.d/60-keys.zsh index 22be046..b74ac02 100644 --- a/.config/zsh/zshrc.d/60-keys.zsh +++ b/.config/zsh/zshrc.d/60-keys.zsh @@ -116,47 +116,16 @@ function cmd-on-enter { CMD_ON_ENTER=ls fi zle accept-line - - # See fzf-hist below - FZF_HIST_WENT_UP= } zle -N cmd-on-enter bindkey "^M" cmd-on-enter ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(cmd-on-enter) -# "Scroll" through history if buffer was empty but use it as query for fzf over -# command line history if not (similar to substring-search but with fzf) -function fzf-hist-up { - if [[ -z "$BUFFER" || "$FZF_HIST_WENT_UP" -eq 1 ]]; then - zle up-line-or-history - FZF_HIST_WENT_UP=1 - else - # Will take BUFFER as query - fzf-history-widget - fi -} -function fzf-hist-down { - zle down-line-or-history - [[ -n "$BUFFER" ]] || FZF_HIST_WENT_UP= -} -zle -N fzf-hist-up -zle -N fzf-hist-down - ## History -# Up -bindkey '^[[A' fzf-hist-up -bindkey "$terminfo[kcuu1]" fzf-hist-up # Ctrl-Up bindkey '^[[1;5A' fzf-history-widget -# Down -bindkey '^[[B' fzf-hist-down -bindkey "$terminfo[kcud1]" fzf-hist-down -# Ctrl-K -bindkey '^K' fzf-hist-up # Ctrl-K in normal mode bindkey -M vicmd '^K' fzf-history-widget -# Ctrl-J -bindkey '^J' fzf-hist-down # Fuzzy finder bindings: # ^T fzf-file-widget