Merge branch '33-implement-a-fuzzyfind-grep-variant-on-the-shell-and-in-vim' into 'master'
Resolve "Implement a fuzzyfind & grep variant on the shell and in vim" Closes #33 See merge request marty-oehme/dotfiles!10
This commit is contained in:
commit
262889ec88
4 changed files with 40 additions and 8 deletions
|
@ -369,8 +369,8 @@ nnoremap <leader><C-e> :NERDTreeVCS<CR>
|
|||
nnoremap <leader>E :NERDTreeFind<CR>
|
||||
|
||||
" Call leaderf with <leader-f> (necessary to enable leaderf lazyloading)
|
||||
nnoremap <leader>f :LeaderfFile<cr>
|
||||
nnoremap <leader>F :LeaderfBuffer<cr>
|
||||
nnoremap <leader>F :LeaderfFile<cr>
|
||||
nnoremap <leader>f :LeaderfBuffer<cr>
|
||||
|
||||
function! SearchWiki()
|
||||
let l:curpath=getcwd()
|
||||
|
|
|
@ -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"
|
||||
|
|
38
.config/shell/rc.d/fuzzy-finding.sh
Normal file
38
.config/shell/rc.d/fuzzy-finding.sh
Normal file
|
@ -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"
|
|
@ -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
|
Loading…
Reference in a new issue