From b2bf4a8217122b9ce092cdc94370292cfb392fd8 Mon Sep 17 00:00:00 2001 From: doylet Date: Sun, 24 Mar 2024 17:55:46 +1100 Subject: [PATCH] Add better LSP FZF integration and harpoon --- Internal/os_nvim_init.vim | 56 +++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/Internal/os_nvim_init.vim b/Internal/os_nvim_init.vim index ac8658c..f7ba159 100644 --- a/Internal/os_nvim_init.vim +++ b/Internal/os_nvim_init.vim @@ -13,11 +13,12 @@ call plug#begin(stdpath('config') . '/plugged') " FZF Plug 'junegunn/fzf' - Plug 'junegunn/fzf.vim' + Plug 'ibhagwan/fzf-lua', {'branch': 'main'} + Plug 'nvim-tree/nvim-web-devicons' - " FZF for LSP - Plug 'gfanto/fzf-lsp.nvim' + " Harpoon Plug 'nvim-lua/plenary.nvim' + Plug 'ThePrimeagen/harpoon', {'branch': 'harpoon2'} " odin for syntax highlighting Plug 'https://github.com/Tetralux/odin.vim' @@ -44,6 +45,25 @@ lua <', '(leap-forward-to)') vim.keymap.set({'n', 'x', 'o'}, '', '(leap-backward-to)') + require('fzf-lua').setup{ + winopts = { + height=0.95, + width=0.95 + } + } + + -- Harpoon ======================================================================================= + local harpoon = require('harpoon') + harpoon:setup() + vim.keymap.set("n", "", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) + vim.keymap.set("n", "", function() harpoon:list():append() end) + vim.keymap.set("n", "", function() harpoon:list():select(1) end) + vim.keymap.set("n", "", function() harpoon:list():select(2) end) + vim.keymap.set("n", "", function() harpoon:list():select(3) end) + vim.keymap.set("n", "", function() harpoon:list():select(4) end) + vim.keymap.set("n", "", function() harpoon:list():prev() end) + vim.keymap.set("n", "", function() harpoon:list():next() end) + -- LSP Setup ===================================================================================== local devenver_root = vim.fn.getenv('devenver_root') local lsp_zero = require('lsp-zero') @@ -247,31 +267,15 @@ nnoremap RemedyBGStopDebugging nnoremap RemedyBGAddBreakpointAtFile nnoremap RemedyBGRunToCursor -" 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%' } - -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 ============================================================================= " FZF Bindings -nnoremap h FzfHistory -nnoremap f FzfCustomFiles -nnoremap g FzfRg -nnoremap t :FzfWorkspaceSymbols -nnoremap cc FzfCommits -nnoremap cb FzfBCommits -nnoremap b FzfBuffers +nnoremap h FzfLua oldfiles +nnoremap f FzfLua files +nnoremap r FzfLua live_grep +nnoremap R FzfLua grep_cword +nnoremap t FzfLua lsp_live_workspace_symbols +nnoremap T FzfLua lsp_finder +nnoremap b FzfLua buffers " Map Ctrl+HJKL to navigate buffer window nmap :wincmd h