diff --git a/lazy-lock.json b/lazy-lock.json index 4d3bbf0..e4aeb3a 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -20,6 +20,7 @@ "jaq-nvim": { "branch": "master", "commit": "236296aae555657487d1bb4d066cbde9d79d8cd4" }, "lazy.nvim": { "branch": "main", "commit": "9b208696e139a404d159963b975a5b90af38439b" }, "live-server": { "branch": "main", "commit": "ecd7c1418823b65dd2bca710587c80afe42c973e" }, + "lspsaga.nvim": { "branch": "main", "commit": "ac134041da57f7592a46775f235ed84880bc0b27" }, "lualine.nvim": { "branch": "master", "commit": "a52f078026b27694d2290e34efa61a6e4a690621" }, "lunar.nvim": { "branch": "master", "commit": "29eedf78c430ad9acebdcba814d77619edbe2bac" }, "markdown-preview.nvim": { "branch": "master", "commit": "9becceee5740b7db6914da87358a183ad11b2049" }, diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 573640c..c8762cb 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -482,4 +482,16 @@ return { require("user.indent-o-matic") end, }, + -- Lsp Saga + { + "glepnir/lspsaga.nvim", + event = "BufRead", + config = function() + require("lspsaga").setup({}) + end, + dependencies = { { "kyazdani42/nvim-web-devicons" } }, + init = function() + require("user.lspsaga_config") + end, + }, } diff --git a/lua/user/impatient.lua b/lua/user/impatient.lua index 81c2356..b43ccdd 100644 --- a/lua/user/impatient.lua +++ b/lua/user/impatient.lua @@ -1,6 +1,6 @@ local status_ok, impatient = pcall(require, "impatient") if not status_ok then - return + return end impatient.enable_profile() diff --git a/lua/user/lspsaga_config.lua b/lua/user/lspsaga_config.lua new file mode 100644 index 0000000..db33683 --- /dev/null +++ b/lua/user/lspsaga_config.lua @@ -0,0 +1,68 @@ +local keymap = vim.keymap.set +-- Lsp finder find the symbol definition implement reference +-- if there is no implement it will hide +-- when you use action in finder like open vsplit then you can +-- use to jump back +keymap("n", "gh", "Lspsaga lsp_finder") + +-- Code action +keymap({ "n", "v" }, "ca", "Lspsaga code_action") + +-- Rename +keymap("n", "gr", "Lspsaga rename") + +-- Rename word in whole project +keymap("n", "gr", "Lspsaga rename ++project") + +-- Peek Definition +-- you can edit the definition file in this float window +-- also support open/vsplit/etc operation check definition_action_keys +-- support tagstack C-t jump back +keymap("n", "gd", "Lspsaga peek_definition") + +-- Go to Definition +keymap("n", "gd", "Lspsaga goto_definition") + +-- Show line diagnostics you can pass argument ++unfocus to make +-- show_line_diagnostics float window unfocus +keymap("n", "sl", "Lspsaga show_line_diagnostics") + +-- Show cursor diagnostic +-- also like show_line_diagnostics support pass ++unfocus +keymap("n", "sc", "Lspsaga show_cursor_diagnostics") + +-- Show buffer diagnostic +keymap("n", "sb", "Lspsaga show_buf_diagnostics") + +-- Diagnostic jump can use `` to jump back +keymap("n", "[e", "Lspsaga diagnostic_jump_prev") +keymap("n", "]e", "Lspsaga diagnostic_jump_next") + +-- Diagnostic jump with filter like Only jump to error +keymap("n", "[E", function() + require("lspsaga.diagnostic"):goto_prev({ severity = vim.diagnostic.severity.ERROR }) +end) +keymap("n", "]E", function() + require("lspsaga.diagnostic"):goto_next({ severity = vim.diagnostic.severity.ERROR }) +end) + +-- Toggle Outline +keymap("n", "o", "Lspsaga outline") + +-- Hover Doc +-- if there has no hover will have a notify no information available +-- to disable it just Lspsaga hover_doc ++quiet +-- press twice it will jump into hover window +keymap("n", "K", "Lspsaga hover_doc") +-- if you want keep hover window in right top you can use ++keep arg +-- notice if you use hover with ++keep you press this keymap it will +-- close the hover window .if you want jump to hover window must use +-- wincmd command w +keymap("n", "K", "Lspsaga hover_doc ++keep") + +-- Callhierarchy +keymap("n", "ci", "Lspsaga incoming_calls") +keymap("n", "co", "Lspsaga outgoing_calls") + +-- Float terminal +keymap({ "n", "t" }, "", "Lspsaga term_toggle")