diff --git a/Installer/os_nvim_init.vim b/Installer/os_nvim_init.vim index 71d835c..dab42f2 100644 --- a/Installer/os_nvim_init.vim +++ b/Installer/os_nvim_init.vim @@ -16,6 +16,10 @@ call plug#begin(stdpath('config') . '/plugged') Plug 'junegunn/fzf' Plug 'junegunn/fzf.vim' + " FZF for LSP + Plug 'gfanto/fzf-lsp.nvim' + Plug 'nvim-lua/plenary.nvim' + " odin for syntax highlighting Plug 'https://github.com/Tetralux/odin.vim' Plug 'https://github.com/sainnhe/gruvbox-material' @@ -126,7 +130,7 @@ lua < jump to next compilation error", " jump to prev compilation error", " change working directory to current file", - " <\\s> split buffer vertically", + " <\\s> split buffer vertically", "", " Abolish (Text Substitution in Normal Mode)", " --------------------------------------------------", @@ -135,14 +139,14 @@ lua < vim command history", - " <\\f> find files", - " <\\g> search for text (via ripgrep)", - " <\\tt> search for tag (global)", - " <\\tb> search for tag (buffer)", - " <\\cc> search for commit (global)", - " <\\cb> search for commit (buffer)", - " <\\b> search for buffer", + " <\\h> vim command history", + " <\\f> find files", + " <\\g> search for text (via ripgrep)", + " <\\tt> search for tag (global)", + " <\\tb> search for tag (buffer)", + " <\\cc> search for commit (global)", + " <\\cb> search for commit (buffer)", + " <\\b> search for buffer", "", " Autocompletion (nvim-cmp in Normal Mode)", " --------------------------------------------------", @@ -278,16 +282,42 @@ augroup persistent_settings au bufenter * :set formatoptions=q1j augroup end +" FZF +" ============================================================================== +" Empty value to disable preview window altogether +let g:fzf_preview_window = [] + +" Prefix all commands with Fzf for discoverability +let g:fzf_command_prefix = 'Fzf' + +" - down / up / left / right +let g:fzf_layout = { 'down': '40%' } + +" Add "FzfCustomRG" command which reinitializes +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 FzfCustomRG call RipgrepFzf(, 0) + +" Augment the "FzfCustomFiles" command +command! -bang -nargs=? -complete=dir FzfCustomFiles + \ call fzf#vim#files(, {'options': ['--layout=reverse', '--info=inline', '--preview', 'cat {}']}, 0) + " General Key Bindings " ============================================================================== " Telescope Bindings -nnoremap h FzfHistory -nnoremap f FzfFiles -nnoremap g FzfRg -nnoremap tt FzfTags -nnoremap tb FzfBTags -nnoremap cc FzfCommits -nnoremap cb FzfBCommits +nnoremap h FzfHistory +nnoremap f FzfCustomFiles +nnoremap g FzfCustomRG +nnoremap tt FzfTags +nnoremap tb FzfBTags +nnoremap cc FzfCommits +nnoremap cb FzfBCommits nnoremap b FzfBuffers " Map Ctrl+HJKL to navigate buffer window @@ -316,17 +346,6 @@ nnoremap s :vs nnoremap :cn nnoremap :cp -" FZF -" ============================================================================== -" Empty value to disable preview window altogether -let g:fzf_preview_window = [] - -" Prefix all commands with Fzf for discoverability -let g:fzf_command_prefix = 'Fzf' - -" - down / up / left / right -let g:fzf_layout = { 'down': '40%' } - " Clang Format " ============================================================================== map :py3file ~/clang-format.py diff --git a/win_install.bat b/win_install.bat index 1d530e4..ec1f66f 100644 --- a/win_install.bat +++ b/win_install.bat @@ -855,7 +855,7 @@ call win_helpers.bat :MakeFileHardLink "!bin_dir!\fzf.exe" "!fzf_exe!" || exit / REM Terminal REM Use FD for FZF to make it ultra fast echo set FZF_DEFAULT_OPTS=--multi --layout=reverse>> "!tmp_terminal_script!" -echo set FZF_DEFAULT_COMMAND=fd --unrestricted>> "!tmp_terminal_script!" +echo set FZF_DEFAULT_COMMAND=fd --type f --strip-cwd-prefix --hidden --follow --exclude .git --exclude .cache --exclude .vs>> "!tmp_terminal_script!" REM jpegview REM ----------------------------------------------------------------------------