diff --git a/.vim/nvim.lua b/.vim/nvim.lua index 1c3d772..42deba4 100644 --- a/.vim/nvim.lua +++ b/.vim/nvim.lua @@ -40,6 +40,26 @@ require'compe'.setup { }; } +signature_cfg = { + hint_enable = true, + hint_prefix = "% ", + handler_opts = { + border = "none" + }, +} + +require'lsp_signature'.on_attach(signature_cfg) + +saga_cfg = { + code_action_prompt = { + enable = false, + sign = false, + virtual_text = false, + }, +} +require'lspsaga'.init_lsp_saga(saga_cfg) + + local t = function(str) return vim.api.nvim_replace_termcodes(str, true, true, true) end diff --git a/.vimrc b/.vimrc index 60404bc..f160c86 100644 --- a/.vimrc +++ b/.vimrc @@ -207,11 +207,17 @@ Plug 'nvim-lua/plenary.nvim' Plug 'nvim-telescope/telescope.nvim' Plug 'kyazdani42/nvim-web-devicons' " for file icons -Plug 'kyazdani42/nvim-tree.lua' +"Plug 'kyazdani42/nvim-tree.lua' + +Plug 'ray-x/lsp_signature.nvim' +Plug 'glepnir/lspsaga.nvim' " Plugins that do specific things "Plug 'Shougo/vimproc.vim' "Plug 'Shougo/vimfiler.vim' +Plug 'Shougo/defx.nvim', { 'do': ':UpdateRemotePlugins' } +Plug 'kristijanhusak/defx-icons' + Plug 'Shougo/unite.vim' " TODO: Look into Coqtail, same author Plug 'whonore/coquille', {'branch': 'pathogen-bundle', 'for': 'coq'} @@ -279,13 +285,17 @@ luafile $HOME/.vim/nvim.lua nnoremap gd lua vim.lsp.buf.definition() nnoremap gi lua vim.lsp.buf.implementation() nnoremap gy lua vim.lsp.buf.type_definition() -nnoremap K lua vim.lsp.buf.hover() +"nnoremap K lua vim.lsp.buf.hover() +nnoremap K lua require('lspsaga.hover').render_hover_doc() nnoremap gK lua vim.lsp.buf.signature_help() nnoremap gr lua vim.lsp.buf.references() +nnoremap gR lua require('lspsaga.rename').rename() nnoremap g0 lua vim.lsp.buf.document_symbol() nnoremap gW lua vim.lsp.buf.workspace_symbol() "nnoremap gd lua vim.lsp.buf.declaration() -nnoremap ga lua vim.lsp.buf.code_action() +"nnoremap ga lua vim.lsp.buf.code_action() +nnoremap ga lua require('lspsaga.codeaction').code_action() +vnoremap ga :lua require('lspsaga.codeaction').range_code_action() nnoremap ge lua vim.lsp.diagnostic.show_line_diagnostics({show_header = false, focusable = false}) " Set updatetime for CursorHold @@ -456,6 +466,8 @@ let g:nvim_tree_add_trailing = 1 let g:nvim_tree_side = 'right' let g:nvim_tree_width = 40 let g:nvim_tree_quit_on_open = 1 +let g:nvim_tree_disable_window_picker = 1 +let g:nvim_tree_root_folder_modifier = ':p:.' " * Tagbar plugin settings let g:tagbar_width = 40 @@ -786,6 +798,75 @@ function InstallEverything() endfunction command CocReinstall :CocInstall coc-json coc-pyright coc-rust-analyzer coc-snippets coc-svelte coc-tsserver coc-ultisnips + + +autocmd FileType defx call s:defx_my_settings() +function! s:defx_my_settings() abort + " Define mappings + nnoremap + \ line('.') == 1 ? defx#do_action('cd', ['..']) : defx#do_action('open') + nnoremap c + \ defx#do_action('copy') + nnoremap m + \ defx#do_action('move') + nnoremap p + \ defx#do_action('paste') + nnoremap l + \ defx#do_action('open') + nnoremap E + \ defx#do_action('open', 'vsplit') + nnoremap P + \ defx#do_action('preview') + nnoremap o + \ defx#do_action('open_tree', 'toggle') + nnoremap K + \ defx#do_action('new_directory') + nnoremap N + \ defx#do_action('new_file') + nnoremap M + \ defx#do_action('new_multiple_files') + nnoremap C + \ defx#do_action('toggle_columns', + \ 'mark:indent:icon:filename:type:size:time') + nnoremap S + \ defx#do_action('toggle_sort', 'time') + nnoremap d + \ defx#do_action('remove') + nnoremap r + \ defx#do_action('rename') + nnoremap ! + \ defx#do_action('execute_command') + nnoremap x + \ defx#do_action('execute_system') + nnoremap yy + \ defx#do_action('yank_path') + nnoremap . + \ defx#do_action('toggle_ignored_files') + nnoremap ; + \ defx#do_action('repeat') + nnoremap h + \ defx#do_action('cd', ['..']) + nnoremap ~ + \ defx#do_action('cd') + nnoremap q + \ defx#do_action('quit') + nnoremap + \ defx#do_action('toggle_select') . 'j' + nnoremap * + \ defx#do_action('toggle_select_all') + nnoremap j + \ line('.') == line('$') ? 'gg' : 'j' + nnoremap k + \ line('.') == 1 ? 'G' : 'k' + nnoremap + \ defx#do_action('redraw') + nnoremap + \ defx#do_action('print') + nnoremap cd + \ defx#do_action('change_vim_cwd') +endfunction + + " ** KEY REMAPPINGS ** " " I used to use tabs, but then I took an arrow to the knee. @@ -799,7 +880,8 @@ command CocReinstall :CocInstall coc-json coc-pyright coc-rust-analyzer coc-snip "nmap gt :NERDTreeToggle "nmap gt :VimFilerExplorer -winwidth=40 -toggle -direction=rightbelow -parent -status -force-hide "nmap gt :VimFiler -status -auto-cd -parent -force-quit -nnoremap gt :NvimTreeToggle +nmap gt :Defx -columns=icons:indent:filename:type +""nnoremap gt :NvimTreeToggle " The same for the TagList, useful for large C files. "nmap gb :TlistToggle nmap gb :TagbarToggle