diff --git a/home/.config/nvim/conf.d/03-keybinds.vim b/home/.config/nvim/conf.d/03-keybinds.vim index 21ef361..df2242b 100644 --- a/home/.config/nvim/conf.d/03-keybinds.vim +++ b/home/.config/nvim/conf.d/03-keybinds.vim @@ -10,17 +10,6 @@ nmap MarkdownPreview nmap MarkdownPreviewStop nmap MarkdownPreviewToggle -" FZF -nmap :Files -nmap :Rg -" Ripgrep command customization -command! -bang -nargs=* Rg - \ call fzf#vim#grep( - \ 'rg --column --hidden --line-number --no-heading --color=always --smart-case '.shellescape(), 1, - \ 0 ? fzf#vim#with_preview('up:60%') - \ : fzf#vim#with_preview('right:50%:hidden', '?'), - \ 0) - set splitbelow set splitright diff --git a/home/.config/nvim/conf.d/06-misc.vim b/home/.config/nvim/conf.d/06-misc.vim index 6c65664..fdb712a 100644 --- a/home/.config/nvim/conf.d/06-misc.vim +++ b/home/.config/nvim/conf.d/06-misc.vim @@ -6,7 +6,7 @@ let pyxversion=3 let g:suda_smart_edit = 1 " Remap exit terminal mode to esc -tnoremap +au TermOpen * tnoremap " Use system clipboard set clipboard=unnamedplus diff --git a/home/.config/nvim/conf.d/08-fzf.vim b/home/.config/nvim/conf.d/08-fzf.vim new file mode 100644 index 0000000..bc093c6 --- /dev/null +++ b/home/.config/nvim/conf.d/08-fzf.vim @@ -0,0 +1,45 @@ +" FZF in floating window + +autocmd! FileType fzf +autocmd FileType fzf call SetFZFoptions() +function SetFZFoptions() + set noshowmode noruler nonumber norelativenumber + tunmap +endfunction + +set winblend=20 + +hi NormalFloat guibg=None +if exists('g:fzf_colors.bg') + call remove(g:fzf_colors, 'bg') +endif + +if stridx($FZF_DEFAULT_OPTS, '--border') == -1 + let $FZF_DEFAULT_OPTS .= ' --border' +endif + +function! FloatingFZF() + let width = float2nr(&columns * 0.8) + let height = float2nr(&lines * 0.6) + let opts = { 'relative': 'editor', + \ 'row': (&lines - height) / 2, + \ 'col': (&columns - width) / 2, + \ 'width': width, + \ 'height': height } + + call nvim_open_win(nvim_create_buf(v:false, v:true), v:true, opts) +endfunction + +let g:fzf_layout = { 'window': 'call FloatingFZF()' } + +" Keybinds +nmap :Files +nmap :Rg + +" Ripgrep command customization +command! -bang -nargs=* Rg + \ call fzf#vim#grep( + \ 'rg --column --hidden --line-number --no-heading --color=always --smart-case '.shellescape(), 1, + \ 0 ? fzf#vim#with_preview('up:60%') + \ : fzf#vim#with_preview('right:50%:hidden', '?'), + \ 0)