diff --git a/README.md b/README.md index 582ccf5..88993eb 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,11 @@ This is just a dump of my NVim config. ## Enabling LSP -In NeoVim, invoke `:call loadlsp#loadlspall()`, then reload the current open -files with `:e` and LSP functionality will be enabled for the currently open -files. +In NeoVim, ~~invoke `:call loadlsp#loadlspall()`, then reload the current open +files with `:e`~~ use the "l" (backslash and l) shortcut and LSP +functionality will be enabled for the currently open file. If you have more +than one buffer open, you may have to reopen them (with :e) for lsp plugins to +take effect. `loadlsp#loadlspall()` is a custom function that can be found [here](https://git.seodisparate.com/stephenseo/MyNeoVimConfig/src/branch/main/pack/packages/start/loadlsp/autoload/loadlsp.vim). diff --git a/init.lua b/init.lua index bf6eb95..1cb5c0e 100644 --- a/init.lua +++ b/init.lua @@ -62,7 +62,7 @@ vim.api.nvim_command('autocmd InsertEnter * match ForbiddenWhitespace /\\t\\|\\s vim.api.nvim_command('hi! CustomRedHighlight ctermbg=red guibg=red') vim.api.nvim_command('match CustomRedHighlight /TODO/') - +-- On i, open zenity textbox for gui text input vim.cmd( [[ " CJK input @@ -75,11 +75,13 @@ endfunction nmap i :call CJKInput() ]]) ---vim.cmd('nmap q :echo "I accidentally hit q, I don\'t use macros"') ---vim.cmd('vmap q :echo "I accidentally hit q, I don\'t use macros"') +-- Disable q +vim.cmd('nmap q :echo "I accidentally hit q, I don\'t use macros"') +vim.cmd('vmap q :echo "I accidentally hit q, I don\'t use macros"') -vim.cmd('nmap q :lua vim.g.quickcomment_togglecommentline()') -vim.cmd('vmap q :luado vim.g.quickcomment_togglecommentline(linenr)') +-- Set q to comment selected line(s) +vim.cmd('nmap q :lua vim.g.quickcomment_togglecommentline()') +vim.cmd('vmap q :luado vim.g.quickcomment_togglecommentline(linenr)') vim.g.quickcomment_whitespaceprefix = 1 @@ -95,7 +97,14 @@ require'nvim-treesitter.configs'.setup { }, } +-- Setup folding based on treesitter vim.g.foldmethod_treesitter_fn = function () vim.opt.foldmethod = "expr" vim.opt.foldexpr = "nvim_treesitter#foldexpr()" end + +-- f to treesitter-fold +vim.cmd('nmap f :lua vim.g.foldmethod_treesitter_fn()') + +-- l to load lsp +vim.cmd('nmap l :call loadlsp#loadlspall() :e :echo "Loaded lsp plugins"') diff --git a/pack/packages/start/loadlsp/autoload/loadlsp.vim b/pack/packages/start/loadlsp/autoload/loadlsp.vim index 7a7a6ef..754b9ab 100644 --- a/pack/packages/start/loadlsp/autoload/loadlsp.vim +++ b/pack/packages/start/loadlsp/autoload/loadlsp.vim @@ -133,10 +133,11 @@ lspconfig.jedi_language_server.setup{ } -- apply available fix -vim.api.nvim_set_keymap("n", "", "lua vim.lsp.buf.code_action()", {noremap = true}) +vim.api.nvim_set_keymap("n", "", "lua vim.lsp.buf.code_action()", {noremap = true}) -- goto next warning/error --vim.api.nvim_set_keymap("n", "", "lua vim.lsp.diagnostic.goto_next()", {noremap = true}) vim.api.nvim_set_keymap("n", "", "lua vim.diagnostic.goto_next()", {noremap = true}) +vim.api.nvim_set_keymap("n", "", "lua vim.diagnostic.goto_prev()", {noremap = true}) EOF