From 735b2ed90b9fb2d18c41d78d7aec21e0eae92b57 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Mon, 28 Oct 2024 17:50:01 +0100 Subject: [PATCH] add nvim-navic for code context instead of nvim-treesitter-context --- lua/kickstart/plugins/lspconfig.lua | 17 +++++++++++++++++ lua/kickstart/plugins/treesitter.lua | 1 - lua/options.lua | 3 +++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/lspconfig.lua b/lua/kickstart/plugins/lspconfig.lua index c8c0a31..c02ff82 100644 --- a/lua/kickstart/plugins/lspconfig.lua +++ b/lua/kickstart/plugins/lspconfig.lua @@ -28,6 +28,9 @@ return { -- Allows extra capabilities provided by nvim-cmp 'hrsh7th/cmp-nvim-lsp', + + -- Code context using LSP info + 'SmiteshP/nvim-navic', }, config = function() -- Brief aside: **What is LSP?** @@ -206,6 +209,20 @@ return { }, } + -- Setup code context via nvim-navic + require('nvim-navic').setup { + lsp = { + auto_attach = true, + preference = { + 'svelte', + 'intelephense', + 'ts_ls', + 'tailwindcss', + }, + }, + highlight = true, + } + -- Ensure the servers and tools above are installed -- To check the current status of installed tools and/or manually install -- other tools, you can run diff --git a/lua/kickstart/plugins/treesitter.lua b/lua/kickstart/plugins/treesitter.lua index 73e88c0..9db60f6 100644 --- a/lua/kickstart/plugins/treesitter.lua +++ b/lua/kickstart/plugins/treesitter.lua @@ -2,7 +2,6 @@ return { { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', dependencies = { - 'nvim-treesitter/nvim-treesitter-context', 'nvim-treesitter/nvim-treesitter-textobjects', }, build = ':TSUpdate', diff --git a/lua/options.lua b/lua/options.lua index a43fa62..2dd38a9 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -96,6 +96,9 @@ vim.opt.guicursor = 'n-v-i-c:block-Cursor' vim.o.laststatus = 3 vim.api.nvim_set_hl(0, 'WinSeparator', { bg = nil }) +-- Set winbar to nvim-navic for code context +vim.o.winbar = "%{%v:lua.require'nvim-navic'.get_location()%}" + vim.api.nvim_create_autocmd('UIEnter', { group = vim.api.nvim_create_augroup('SetGUISettings', { clear = true }), callback = function()