Closed alopatindev closed 3 years ago
Have you tried :FzfLua lines
?
Closing this for now, feel free to open this if you need more help.
Thanks, that helped. Wish we had composable providers (+ outputs deduplication), so any of them could be easily combined together.
If anyone interested — I was able to get behavior close enough to what I was looking for. The solution is based on tabs
, lines
and grep
providers. Additionally I made files search based on git_files
and files
.
Both use tab drop
, which switches to existing tab, if the file is already open. Items from currently opened tabs have different color.
Limitations: no proper deduplication and can't switch to new unsaved tabs.
It's here. Usage:
let g:rg_opts = '
\ --line-number --no-column --no-heading --fixed-strings --smart-case --no-ignore --hidden --follow --color always
\ --glob "*.{c,C,cfg,conf,config,cpp,css,cxx,ebuild,go,h,hpp,hs,html,ini,j2,jade,java,js,lua,md,markdown,nvim,php,pl,py,rb,rs,scala,sh,sql,styl,vim}"
\ --glob "{Dockerfile,.gitignore,README,INSTALL,Makefile,Gemfile}"
\ --glob "!{.git,build,node_modules,vendor,target}/*" '
let g:fd_opts = '--type f --follow --exclude .git --exclude build --exclude node_modules --exclude vendor --exclude target'
nnoremap <F3> :lua relevant_files()<cr>
imap <F3> <esc>:lua relevant_files()<cr>
vmap <F3> <esc>:lua relevant_files()<cr>
nnoremap <F4> :lua relevant_grep()<cr>
imap <F4> <esc>:lua relevant_grep()<cr>
vmap <F4> <esc>:lua relevant_grep()<cr>
lua << EOF
require('fzf-lua-ext')
require('fzf-lua').setup {
winopts = {
border = 'none',
fullscreen = true,
preview = {
border = 'noborder',
wrap = 'wrap',
scrollbar = false,
layout = 'vertical',
title = false,
vertical = 'up:50%',
}
},
grep = {
rg_opts = vim.g.rg_opts,
prompt = '> ',
},
files = {
fd_opts = vim.g.fd_opts,
},
}
EOF
Looks great! Good job deciphering the internal code, I didn’t have API in mind when I designed this so the documentation isn’t really there.
Thanks for this awesome plugin!
I'd like to have some kind of universal search: basically
live_grep
that shows matching results from currently open tabs as priority.Any suggestion how to achieve this behavior? Thanks.