Răsfoiți Sursa

Install FZF to try again

FZF was initially tested, but abandoned because there were no binaries
for ARM machines, and it means reliance on yet another non-vimscript
plugin. Unfortunately, the search results are the best, so here we go
again.
Weiyi Lou 10 ani în urmă
părinte
comite
f07245016a

+ 2 - 0
vim/plugins.vim

@@ -53,6 +53,8 @@ Plug 'vim-scripts/argtextobj.vim'
 
 " File Browser {{{
 Plug 'ctrlpvim/ctrlp.vim'
+Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' }
+Plug 'junegunn/fzf.vim'
 Plug 'tpope/vim-vinegar'
 " }}}
 

+ 0 - 19
vim/settings/ctrlp.vim

@@ -1,19 +0,0 @@
-let g:ctrlp_map = '<Leader>p'
-
-" Use `ag` as fallback if available.
-if executable('ag')
-  let s:fallback = 'ag %s -l --nocolor -g ""'
-else
-  let s:fallback = 'find %s -type f'
-endif
-
-let g:ctrlp_user_command = [
-  \ '.git',
-  \ 'cd %s && git ls-files . -co --exclude-standard',
-  \ s:fallback
-\]
-
-let g:ctrlp_extensions = ['funky']
-
-" Function definition jumping with CtrlP's Funky plugin.
-nnoremap <silent> <Leader>f :CtrlPFunky<CR>

+ 28 - 0
vim/settings/filebrowser.vim

@@ -9,3 +9,31 @@ let g:netrw_use_errorwindow = 0
 " Use tree-style browsing by default
 " 0 = normal, 1 = details, 2 = ls, 3 = tree
 let g:netrw_liststyle = 3
+
+
+" CtrlP - Fuzzy Finder in Vimscript
+
+"let g:ctrlp_map = '<Leader>p'
+
+" Use `ag` as fallback if available.
+if executable('ag')
+  let s:fallback = 'ag %s -l --nocolor -g ""'
+else
+  let s:fallback = 'find %s -type f'
+endif
+
+let g:ctrlp_user_command = [
+  \ '.git',
+  \ 'cd %s && git ls-files . -co --exclude-standard',
+  \ s:fallback
+\]
+
+let g:ctrlp_extensions = ['funky']
+
+" Function definition jumping with CtrlP's Funky plugin.
+map <silent> <Leader>f :CtrlPFunky<CR>
+
+
+" FZF - Fuzzy Finder in Go/Ruby
+
+map <silent> <Leader>p :FZF<CR>

+ 8 - 7
vim/settings/version_control.vim

@@ -11,10 +11,11 @@ if has("autocmd")
 endif
 
 " Git commands with Fugitive
-nnoremap <silent> <Leader>gc :Gcommit -v<CR>
-nnoremap <silent> <Leader>gl :Glog<CR><CR>
-nnoremap <silent> <Leader>gap :Git add -p<CR>
-nnoremap <silent> <Leader>gs :Gstatus<CR>
-nnoremap <silent> <Leader>gd :Gdiff<CR>
-nnoremap <silent> <Leader>gb :Gblame<CR>
-nnoremap <silent> <Leader>grbc :Git rebase --continue<CR>
+nmap <silent> <Leader>gc :Gcommit -v<CR>
+"nmap <silent> <Leader>gl :Glog<CR><CR>
+nmap <silent> <Leader>gl :BCommits<CR>
+nmap <silent> <Leader>gap :Git add -p<CR>
+nmap <silent> <Leader>gs :Gstatus<CR>
+nmap <silent> <Leader>gd :Gdiff<CR>
+nmap <silent> <Leader>gb :Gblame<CR>
+nmap <silent> <Leader>grbc :Git rebase --continue<CR>

+ 14 - 0
zsh/custom/fzf.zsh

@@ -0,0 +1,14 @@
+# Fuzzy Finder in Go/Ruby
+
+if [[ -x $(which ag 2> /dev/null) ]]; then
+  # Setting ag as the default source for fzf
+  export FZF_DEFAULT_COMMAND='ag -l -g ""'
+else
+  # Otherwise at least use `git ls-tree` if available.
+  export FZF_DEFAULT_COMMAND='
+  (git ls-tree -r --name-only HEAD ||
+    find * -name ".*" -prune -o -type f -print -o -type l -print) 2> /dev/null'
+fi
+
+# To apply the command to CTRL-T as well (paste selection into command line)
+export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"

+ 2 - 0
zsh/zshrc

@@ -86,3 +86,5 @@ source $ZSH/oh-my-zsh.sh
 # Example aliases
 # alias zshconfig="mate ~/.zshrc"
 # alias ohmyzsh="mate ~/.oh-my-zsh"
+
+[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh