diff options
author | Chris <[email protected]> | 2020-04-27 01:44:22 -0400 |
---|---|---|
committer | Chris <[email protected]> | 2020-04-27 01:44:22 -0400 |
commit | ed9e2c2da67293ff72b47fdac2eecf49ac533f41 (patch) | |
tree | 3eae099ac7c38246e3258e11b9b48fa3b66dcbd2 | |
parent | b98a4a0f6dbf0e4c1340653708dec2b91953e4e0 (diff) |
FZF
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | general/settings.vim | 1 | ||||
-rw-r--r-- | init.vim | 1 | ||||
-rw-r--r-- | plug-config/coc.vim | 10 | ||||
-rw-r--r-- | plug-config/fzf.vim | 70 | ||||
-rw-r--r-- | vim-plug/plugins.vim | 4 |
6 files changed, 85 insertions, 5 deletions
@@ -66,3 +66,7 @@ let g:node_host_prog = expand("~/.nvm/versions/node/v12.16.1/bin/node") " <- exa - ranger - ueberzug +- ripgrep +- silver_searcher +- fd +- universal-ctags diff --git a/general/settings.vim b/general/settings.vim index 3d11d259..ae86008f 100644 --- a/general/settings.vim +++ b/general/settings.vim @@ -15,6 +15,7 @@ set splitbelow " Horizontal splits will automatically b set splitright " Vertical splits will automatically be to the right set t_Co=256 " Support 256 colors set conceallevel=0 " So that I can see `` in markdown files +set foldcolumn=2 " Folding abilities set tabstop=2 " Insert 2 spaces for a tab set shiftwidth=2 " Change the number of space characters inserted for indentation set smarttab " Makes tabbing smarter will realize you have 2 vs 4 @@ -7,3 +7,4 @@ source $HOME/.config/nvim/themes/onedark.vim source $HOME/.config/nvim/themes/airline.vim source $HOME/.config/nvim/plug-config/coc.vim source $HOME/.config/nvim/plug-config/rnvimr.vim +source $HOME/.config/nvim/plug-config/fzf.vim diff --git a/plug-config/coc.vim b/plug-config/coc.vim index 74999202..7f61bbe7 100644 --- a/plug-config/coc.vim +++ b/plug-config/coc.vim @@ -124,17 +124,17 @@ let g:coc_explorer_global_presets = { \ 'floatingLeftside': { \ 'position': 'floating', \ 'floating-position': 'left-center', -\ 'floating-width': 50, +\ 'floating-width': 30, \ }, \ 'floatingRightside': { \ 'position': 'floating', -\ 'floating-position': 'left-center', -\ 'floating-width': 50, +\ 'floating-position': 'right-center', +\ 'floating-width': 30, \ }, \ 'simplify': { \ 'file.child.template': '[selection | clip | 1] [indent][icon | 1] [filename omitCenter 1]' \ } \ } -nmap <space>e :CocCommand explorer<CR> -nmap <space>f :CocCommand explorer --preset floating<CR> +nmap <silent> <space>e :CocCommand explorer<CR> +nmap <space>f :CocCommand explorer --preset floatingRightside<CR> autocmd BufEnter * if (winnr("$") == 1 && &filetype == 'coc-explorer') | q | endif diff --git a/plug-config/fzf.vim b/plug-config/fzf.vim new file mode 100644 index 00000000..f25f49a7 --- /dev/null +++ b/plug-config/fzf.vim @@ -0,0 +1,70 @@ +" This is the default extra key bindings +let g:fzf_action = { + \ 'ctrl-t': 'tab split', + \ 'ctrl-x': 'split', + \ 'ctrl-v': 'vsplit' } + +" Enable per-command history. +" CTRL-N and CTRL-P will be automatically bound to next-history and +" previous-history instead of down and up. If you don't like the change, +" explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS. +let g:fzf_history_dir = '~/.local/share/fzf-history' + +map <C-f> :Files<CR> +map <leader>b :Buffers<CR> +nnoremap <leader>g :Rg<CR> +nnoremap <leader>t :Tags<CR> +nnoremap <leader>m :Marks<CR> + + +let g:fzf_tags_command = 'ctags -R' +" Border color +let g:fzf_layout = {'up':'~90%', 'window': { 'width': 0.8, 'height': 0.8,'yoffset':0.5,'xoffset': 0.5, 'highlight': 'Todo', 'border': 'sharp' } } + +let $FZF_DEFAULT_OPTS = '--layout=reverse --info=inline' +let $FZF_DEFAULT_COMMAND="rg --files --hidden" + + +" Customize fzf colors to match your color scheme +let g:fzf_colors = +\ { 'fg': ['fg', 'Normal'], + \ 'bg': ['bg', 'Normal'], + \ 'hl': ['fg', 'Comment'], + \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], + \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], + \ 'hl+': ['fg', 'Statement'], + \ 'info': ['fg', 'PreProc'], + \ 'border': ['fg', 'Ignore'], + \ 'prompt': ['fg', 'Conditional'], + \ 'pointer': ['fg', 'Exception'], + \ 'marker': ['fg', 'Keyword'], + \ 'spinner': ['fg', 'Label'], + \ 'header': ['fg', 'Comment'] } + +"Get Files +command! -bang -nargs=? -complete=dir Files + \ call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), <bang>0) + + +" Get text in files with Rg +command! -bang -nargs=* Rg + \ call fzf#vim#grep( + \ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(<q-args>), 1, + \ fzf#vim#with_preview(), <bang>0) + +" Ripgrep advanced +function! RipgrepFzf(query, fullscreen) + let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true' + let initial_command = printf(command_fmt, shellescape(a:query)) + let reload_command = printf(command_fmt, '{q}') + let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]} + call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen) +endfunction + +command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0) + +" Git grep +command! -bang -nargs=* GGrep + \ call fzf#vim#grep( + \ 'git grep --line-number '.shellescape(<q-args>), 0, + \ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0) diff --git a/vim-plug/plugins.vim b/vim-plug/plugins.vim index d03b7fb4..73b24680 100644 --- a/vim-plug/plugins.vim +++ b/vim-plug/plugins.vim @@ -22,6 +22,10 @@ call plug#begin('~/.config/nvim/autoload/plugged') Plug 'vim-airline/vim-airline-themes' " Ranger Plug 'kevinhwang91/rnvimr', {'do': 'make sync'} + " FZF + Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } + Plug 'junegunn/fzf.vim' + Plug 'airblade/vim-rooter' |