diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 70ed578..e5a356e 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -369,8 +369,8 @@ nnoremap :NERDTreeVCS nnoremap E :NERDTreeFind " Call leaderf with (necessary to enable leaderf lazyloading) -nnoremap f :LeaderfFile -nnoremap F :LeaderfBuffer +nnoremap F :LeaderfFile +nnoremap f :LeaderfBuffer function! SearchWiki() let l:curpath=getcwd() diff --git a/.config/shell/rc.d/base-aliases.sh b/.config/shell/rc.d/base-aliases.sh index f3b7617..970cd4a 100644 --- a/.config/shell/rc.d/base-aliases.sh +++ b/.config/shell/rc.d/base-aliases.sh @@ -11,8 +11,6 @@ fi alias zhtop="history | awk '{a[\$2]++} END{for(i in a){printf \"%5d\t%s\n\",a[i],i}}' | sort -rn | head" # Display timestamped recent command history alias zh="fc -l -d -D" -# Display fuzzy-searchable history -alias zhfind="history | tac | fzf -l 20" # Display your current ip address alias myip="curl -s icanhazip.com" diff --git a/.config/shell/rc.d/fuzzy-finding.sh b/.config/shell/rc.d/fuzzy-finding.sh new file mode 100644 index 0000000..e8fbebd --- /dev/null +++ b/.config/shell/rc.d/fuzzy-finding.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +# check for existence of fuzzy finders. If found, substitute fzf with it. +# order is skim > fzy > fzf > nothing +if type sk >/dev/null 2>&1; then + alias fzf=sk +elif type fzy >/dev/null 2>&1; then + echo "[WARNING]: fzy found as fuzzy finder - install skim to use full script functionality" + alias fzf=fzy +elif type fzf >/dev/null 2>&1; then + echo "[WARNING]: fzf found as fuzzy finder - install skim to use full script functionality" + alias fzf=fzf +else + echo "[WARNING]: No fuzzy finder found - install skim to enable functionality" +fi + +# check for existence of greplikes. If found, substitute fzf with it. +# order is skim > fzy > fzf > nothing +if type rg >/dev/null 2>&1; then + alias rg=rg +elif type ag >/dev/null 2>&1; then + alias rg=ag +elif type ack >/dev/null 2>&1; then + alias rg=ack +else + echo "[WARNING]: No grep-like found - install ripgrep/the silver surfer (ag)/ack to enable functionality" +fi + +# set up fuzzy file and directory search +# TODO still uses rifle (from ranger fm) - decide whether to keep it or not +alias f="fzf -c 'find . -type f' --preview='head -$LINES {}' | xargs rifle" +alias F="fzf -c 'find ~ -type f' --preview='head -$LINES {}' | xargs rifle" + +alias d="fzf -c 'find . -type d' --preview='ls --color='always' {}' | cd" +alias D="fzf -c 'find ~ -type d' --preview='ls --color='always' {}' --color=dark --ansi | cd" + +# Display fuzzy-searchable history +alias zhfind="history | fzf --tac --height 20" diff --git a/.config/shell/rc.d/fzy-to-fzf.sh b/.config/shell/rc.d/fzy-to-fzf.sh deleted file mode 100644 index 055996e..0000000 --- a/.config/shell/rc.d/fzy-to-fzf.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -# check for existence of fzy. If found, substitute fzf with it. -type fzy >/dev/null 2>&1 && alias fzf=fzy