2020-01-07 17:47:06 +02:00
|
|
|
" FZF in floating window
|
|
|
|
|
|
|
|
autocmd! FileType fzf
|
|
|
|
autocmd FileType fzf call SetFZFoptions()
|
|
|
|
function SetFZFoptions()
|
|
|
|
set noshowmode noruler nonumber norelativenumber
|
|
|
|
tunmap <buffer> <Esc>
|
|
|
|
endfunction
|
|
|
|
|
2020-01-18 22:24:58 +02:00
|
|
|
let g:fzf_layout = { 'window': 'call FloatingFZF()' }
|
2020-01-07 17:47:06 +02:00
|
|
|
function! FloatingFZF()
|
2020-01-18 22:24:58 +02:00
|
|
|
let buf = nvim_create_buf(v:false, v:true)
|
|
|
|
call setbufvar(buf, '&signcolumn', 'no')
|
|
|
|
|
2020-01-19 15:24:03 +02:00
|
|
|
let width = float2nr(&columns * 0.8)
|
|
|
|
let height = float2nr(&lines * 0.6)
|
|
|
|
let horizontal = 1
|
2020-01-18 22:24:58 +02:00
|
|
|
let vertical = 1
|
|
|
|
|
|
|
|
let opts = {
|
|
|
|
\ 'relative': 'editor',
|
2020-01-19 15:24:03 +02:00
|
|
|
\ 'row': (&lines - height) / 2,
|
|
|
|
\ 'col': (&columns - width) / 2,
|
2020-01-07 17:47:06 +02:00
|
|
|
\ 'width': width,
|
2020-01-18 22:24:58 +02:00
|
|
|
\ 'height': height,
|
|
|
|
\ 'style': 'minimal'
|
|
|
|
\ }
|
2020-01-07 17:47:06 +02:00
|
|
|
|
2020-01-18 22:24:58 +02:00
|
|
|
call nvim_open_win(buf, v:true, opts)
|
2020-01-07 17:47:06 +02:00
|
|
|
endfunction
|
|
|
|
|
2020-01-18 22:24:58 +02:00
|
|
|
" Looks
|
2020-01-19 15:24:03 +02:00
|
|
|
"let $FZF_DEFAULT_OPTS=' --color=dark --color=fg:15,bg:-1,hl:1,fg+:#ffffff,bg+:0,hl+:1 --color=info:0,prompt:0,pointer:12,marker:4,spinner:11,header:-1 --layout=reverse --margin=1,4'
|
2020-01-07 17:47:06 +02:00
|
|
|
|
2020-12-04 10:41:08 +02:00
|
|
|
" ripgrep custom settings
|
|
|
|
command! -bang -nargs=* Rg
|
|
|
|
\ call fzf#vim#grep('rg --column --line-number --no-heading --color=always --smart-case '
|
|
|
|
\ . (len(<q-args>) > 0 ? <q-args> : '""'), 0,
|
|
|
|
\ fzf#vim#with_preview({'options': ['--delimiter=:', '--nth=2..', '--layout=reverse', '--info=inline']}), <bang>0)
|
|
|
|
|
2020-01-07 17:47:06 +02:00
|
|
|
" Keybinds
|
|
|
|
nmap <C-f> :Files<CR>
|
|
|
|
nmap <C-g> :Rg<CR>
|