NVIM: Use Lspsaga for breadcrumbs

- Disable statusline breadcrumbs coming from nvim-navic
- Use Lspsaga for Hover, Goto References, Peek Definition
- Enable Lspsaga Symbol Outline panel
- util.lua: Use same icons on Breadcrumbs and Navic Code navigation
- Code related shortcuts made for uniform, removed some
This commit is contained in:
Pratik Tripathy
2024-03-25 22:20:11 +05:30
parent ea30b2722f
commit b7be385529
7 changed files with 150 additions and 63 deletions

View File

@@ -261,29 +261,39 @@ return {
end,
},
-- Lsp Breadcrumbs for lualine
-- LspSaga
{
"SmiteshP/nvim-navic",
lazy = true,
init = function()
vim.g.navic_silence = true
require("config.util").on_lsp_attach(function(client, buffer)
if client.supports_method("textDocument/documentSymbol") then
require("nvim-navic").attach(client, buffer)
end
end)
end,
opts = function()
return {
separator = " ",
highlight = true,
depth_limit = 5,
icons = require("config.util").icons.kinds,
lazy_update_context = true,
}
"nvimdev/lspsaga.nvim",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-tree/nvim-web-devicons",
},
config = function()
require("lspsaga").setup({
ui = {
kind = require("config.util").icons.kind_lspsaga,
},
symbol_in_winbar = {
enable = true,
hide_keyword = true,
},
lightbulb = {
enable = false,
sign = false,
virtual_text = false,
},
outline = { auto_preview = false },
})
vim.keymap.set("n", "K", "<cmd>Lspsaga hover_doc<cr>", { desc = "Hover Documentation" })
vim.keymap.set("n", "<leader>cR", "<cmd>Lspsaga finder<cr>", { desc = "Code: Goto References" })
vim.keymap.set("n", "<leader>co", "<cmd>Lspsaga outline<cr>", { desc = "Code: Toggle Symbol Outline" })
vim.keymap.set("n", "<leader>cd", "<cmd>Lspsaga peek_definition<cr>", { desc = "Code: Peek definition: Function" })
vim.keymap.set("n", "<leader>cD", "<cmd>Lspsaga peek_type_definition<cr>", { desc = "Code: Peek definition: Class" })
end,
},
-- Search and jump around symbols in the buffer
{
"SmiteshP/nvim-navbuddy",
dependencies = {
@@ -295,6 +305,60 @@ return {
icons = require("config.util").icons.kinds,
},
keys = {
-- Default Mappings on the popup
-- ["<esc>"] = actions.close(), -- Close and cursor to original location
-- ["q"] = actions.close(),
--
-- ["j"] = actions.next_sibling(), -- down
-- ["k"] = actions.previous_sibling(), -- up
--
-- ["h"] = actions.parent(), -- Move to left panel
-- ["l"] = actions.children(), -- Move to right panel
-- ["0"] = actions.root(), -- Move to first panel
--
-- ["v"] = actions.visual_name(), -- Visual selection of name
-- ["V"] = actions.visual_scope(), -- Visual selection of scope
--
-- ["y"] = actions.yank_name(), -- Yank the name to system clipboard "+
-- ["Y"] = actions.yank_scope(), -- Yank the scope to system clipboard "+
--
-- ["i"] = actions.insert_name(), -- Insert at start of name
-- ["I"] = actions.insert_scope(), -- Insert at start of scope
--
-- ["a"] = actions.append_name(), -- Insert at end of name
-- ["A"] = actions.append_scope(), -- Insert at end of scope
--
-- ["r"] = actions.rename(), -- Rename currently focused symbol
--
-- ["d"] = actions.delete(), -- Delete scope
--
-- ["f"] = actions.fold_create(), -- Create fold of current scope
-- ["F"] = actions.fold_delete(), -- Delete fold of current scope
--
-- ["c"] = actions.comment(), -- Comment out current scope
--
-- ["<enter>"] = actions.select(), -- Goto selected symbol
-- ["o"] = actions.select(),
--
-- ["J"] = actions.move_down(), -- Move focused node down
-- ["K"] = actions.move_up(), -- Move focused node up
--
-- ["s"] = actions.toggle_preview(), -- Show preview of current node
--
-- ["<C-v>"] = actions.vsplit(), -- Open selected node in a vertical split
-- ["<C-s>"] = actions.hsplit(), -- Open selected node in a horizontal split
--
-- ["t"] = actions.telescope({ -- Fuzzy finder at current level.
-- layout_config = { -- All options that can be
-- height = 0.60, -- passed to telescope.nvim's
-- width = 0.60, -- default can be passed here.
-- prompt_position = "top",
-- preview_width = 0.50,
-- },
-- layout_strategy = "horizontal",
-- }),
--
-- ["g?"] = actions.help(), -- Open mappings help window
{
"<leader>v",
function()