Skip to content

Commit

Permalink
improve fzf (liuchengxu#282)
Browse files Browse the repository at this point in the history
* improve fzf and fix ctrl arrows conflix in tmux

* improve fzf

* improve fzf

* improve fzf
  • Loading branch information
pittcat authored and Alvin committed Jan 31, 2019
1 parent 1ce9817 commit ebd287f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
28 changes: 28 additions & 0 deletions core/autoload/spacevim/plug/fzf.vim
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,34 @@ function! s:align_lists(lists)
return a:lists
endfunction

command! -bang -nargs=* Ag
\ call fzf#vim#ag(<q-args>,
\ <bang>0 ? fzf#vim#with_preview('up:80%')
\ : fzf#vim#with_preview('right:80%:hidden', '?'),
\ <bang>0)

command! -bang -nargs=* Rg
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always '.shellescape(<q-args>), 1,
\ <bang>0 ? fzf#vim#with_preview('up:70%')
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
\ <bang>0)

" Likewise, Files command with preview window
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)
" }

function! spacevim#plug#fzf#Session()
call fzf#run({
\ 'source': 'ls -1 ~/.vim/session',
\ 'sink': 'SLoad',
\ 'options': '+m --prompt="Sessions> "',
\ 'down': '40%'
\})
endfunction


" ------------------------------------------------------------------
" Configuration Files
" ------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion layers/+tools/fzf/config.vim
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ else
xmap <Leader>? <plug>(fzf-maps-x)
omap <Leader>? <plug>(fzf-maps-o)
nnoremap <Leader>ag :Ag<CR>
nnoremap <Leader>ag :Ag!<CR>
nnoremap <Leader>bb :Buffers<CR>
nnoremap <Leader>b? :Buffers<CR>
nnoremap <Leader>w? :Windows<CR>
nnoremap <Leader>f? :Files<CR>
nnoremap <Leader>ff :Files ~<CR>
nnoremap <silent> <Leader>sf :call spacevim#plug#fzf#Session()<CR>
nnoremap <leader>rg :Rg!<cr>
" }
endif

0 comments on commit ebd287f

Please sign in to comment.