1
0
Fork 0

better preview for fzf and drop ctlp for fzf

This commit is contained in:
Massaki Archambault 2019-03-21 19:54:59 -04:00
parent 687584cfaa
commit 96b981778a
2 changed files with 18 additions and 28 deletions

View File

@ -1,10 +1,23 @@
# show file preview on CTRL+T
export FZF_DEFAULT_OPTS="--height 90% --preview '([[ -d {} ]] && lsd --color always --icon always --tree --depth 3 {} || highlight -O ansi -l {} || (file {} | grep -q text && cat {} || od -A x -t xz -v {})) 2>/dev/null | head -200'"
export FZF_DEFAULT_OPTS="--height 90%"
export FZF_CTRL_T_OPTS="--preview '([[ -d {} ]] && lsd --color always --icon always --tree --depth 3 {} || highlight -O ansi -l {} || (file {} | grep -q text && cat {} || od -A x -t xz -v {})) 2>/dev/null | head -200'"
export FZF_ALT_C_OPTS="$FZF_CTRL_T_OPTS"
# Use tmux pane if available
export FZF_TMUX=1
export FZF_TMUX_HEIGHT=90%
# attach some extra options to path and dir completion
eval "_$(declare -f _fzf_path_completion)"
_fzf_path_completion() {
FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS" __fzf_path_completion $@
}
eval "_$(declare -f _fzf_dir_completion)"
_fzf_dir_completion() {
FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS" __fzf_dir_completion $@
}
# Remove duplicate when using Ctrl+R
# https://github.com/junegunn/fzf/issues/626
__fzf_history__() (

View File

@ -74,7 +74,8 @@ if dein#load_state(pluginpath)
call dein#add('jiangmiao/auto-pairs')
call dein#add('tpope/vim-endwise')
"call dein#add('chrisbra/unicode.vim')
call dein#add('ctrlpvim/ctrlp.vim')
"call dein#add('ctrlpvim/ctrlp.vim')
call dein#add('junegunn/fzf.vim')
call dein#add('easymotion/vim-easymotion')
call dein#add('tpope/vim-obsession')
@ -129,21 +130,8 @@ highlight ALEWarning ctermfg=Blue ctermbg=None cterm=underline
" nerdtree
map <C-n> :NERDTreeToggle<CR>
" ctrlp
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_show_hidden = 1
" From lightline help
let g:ctrlp_status_func = {
\ 'main': 'CtrlPStatusFunc_1',
\ 'prog': 'CtrlPStatusFunc_2',
\ }
function! CtrlPStatusFunc_1(focus, byfname, regex, prev, item, next, marked)
return lightline#statusline(0)
endfunction
function! CtrlPStatusFunc_2(str)
return lightline#statusline(0)
endfunction
" fzf
map <C-p> :FZF<CR>
" easymotion
map <Leader> <Plug>(easymotion-prefix)
@ -197,7 +185,6 @@ let g:lightline = {
\ },
\ 'component_function': {
\ 'filename': 'LightlineFilename',
\ 'ctrlpmark': 'CtrlPMark',
\ },
\ }
@ -219,16 +206,6 @@ function! LightlineFilename()
return filename . modified
endfunction
function! CtrlPMark()
if expand('%:t') =~ 'ControlP' && has_key(g:lightline, 'ctrlp_item')
call lightline#link('iR'[g:lightline.ctrlp_regex])
return lightline#concatenate([g:lightline.ctrlp_prev, g:lightline.ctrlp_item
\ , g:lightline.ctrlp_next], 0)
else
return ''
endif
endfunction
function! LightlineLinterWarnings() abort
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error