1
0
Fork 0

fix fzf history search

This commit is contained in:
Massaki Archambault 2018-11-22 12:27:37 -05:00
parent d2731d955c
commit 600b3c203a
5 changed files with 59 additions and 38 deletions

View File

@ -72,7 +72,6 @@ for_window [class="^Pulseeffects$"] floating enable
for_window [class="Remmina" title="Remmina Remote Desktop Client"] floating enable
for_window [class="feh" title="pinned screenshot"] floating enable sticky enable
for_window [class="TeamViewer"] floating enable
for_window [class="Thunar"] floating enable
# https://github.com/ValveSoftware/steam-for-linux/issues/1040
for_window [class="^Steam$" title="^Friends$"] floating enable

View File

@ -1,41 +1,13 @@
# make word splitting behave like bash
# Make word splitting behave like bash
setopt SH_WORD_SPLIT
# History
HISTSIZE=100000
SAVEHIST=100000
setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
# gpg-agent
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye >/dev/null
# Color for hostname
function get_hostname_color () {
local col
for hash_func in md5sum sha1sum sha256sum; do
col="$(printf "%03d" "$((16#$(hostname | $hash_func | head -c2)))")"
if [[ $col -ne 0 ]] \
&& [[ $col -lt 16 || $col -gt 21 ]] \
&& [[ $col -lt 232 || $col -gt 243 ]]; then
# we found a color that isn't too dark
echo $col>>~/test.log
break
else
# default color
col="002"
fi
done
printf "$col"
}
case "$HOST" in
"devbox")
ZSH_THEME_HOSTNAME_COLOR="002"
;;
"pallet")
ZSH_THEME_HOSTNAME_COLOR="004"
;;
"pewter")
ZSH_THEME_HOSTNAME_COLOR="005"
;;
*)
ZSH_THEME_HOSTNAME_COLOR="$(get_hostname_color)"
;;
esac
export ZSH_THEME_HOSTNAME_COLOR
unset -f get_hostname_color

View File

@ -0,0 +1,15 @@
# Remove duplicate when using Ctrl+R
# https://github.com/junegunn/fzf/issues/626
__fzf_history__() (
local line
shopt -u nocaseglob nocasematch
line=$(
HISTTIMEFORMAT= history | tac | sort --key=2.1 -bus | sort -n |
FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} $FZF_DEFAULT_OPTS --tac -n2..,.. --tiebreak=index --bind=ctrl-r:toggle-sort $FZF_CTRL_R_OPTS +m" $(__fzfcmd) |
command grep '^ *[0-9]') &&
if [[ $- =~ H ]]; then
sed 's/^ *\([0-9]*\)\** .*/!\1/' <<< "$line"
else
sed 's/^ *\([0-9]*\)\** *//' <<< "$line"
fi
)

View File

@ -1,2 +1,37 @@
motd
# Color for hostname
function get_hostname_color () {
local col
for hash_func in md5sum sha1sum sha256sum; do
col="$(printf "%03d" "$((16#$(hostname | $hash_func | head -c2)))")"
if [[ $col -ne 0 ]] \
&& [[ $col -lt 16 || $col -gt 21 ]] \
&& [[ $col -lt 232 || $col -gt 243 ]]; then
# we found a color that isn't too dark
echo $col>>~/test.log
break
else
# default color
col="002"
fi
done
printf "$col"
}
case "$HOST" in
"devbox")
ZSH_THEME_HOSTNAME_COLOR="002"
;;
"pallet")
ZSH_THEME_HOSTNAME_COLOR="004"
;;
"pewter")
ZSH_THEME_HOSTNAME_COLOR="005"
;;
*)
ZSH_THEME_HOSTNAME_COLOR="$(get_hostname_color)"
;;
esac
unset -f get_hostname_color
# print motd
ZSH_THEME_HOSTNAME_COLOR="$ZSH_THEME_HOSTNAME_COLOR" motd

View File

@ -73,7 +73,7 @@ if dein#load_state(pluginpath)
call dein#add('tpope/vim-surround')
call dein#add('jiangmiao/auto-pairs')
call dein#add('tpope/vim-endwise')
call dein#add('chrisbra/unicode.vim')
"call dein#add('chrisbra/unicode.vim')
call dein#add('ctrlpvim/ctrlp.vim')
call dein#add('easymotion/vim-easymotion')