···11+return { -- Autocompletion
22+ 'saghen/blink.cmp',
33+ event = 'VimEnter',
44+ version = '1.*',
55+ dependencies = {
66+ -- Snippet Engine
77+ {
88+ 'L3MON4D3/LuaSnip',
99+ version = '2.*',
1010+ build = (function()
1111+ -- Build Step is needed for regex support in snippets.
1212+ -- This step is not supported in many windows environments.
1313+ -- Remove the below condition to re-enable on windows.
1414+ if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
1515+ return
1616+ end
1717+ return 'make install_jsregexp'
1818+ end)(),
1919+ dependencies = {
2020+ -- `friendly-snippets` contains a variety of premade snippets.
2121+ -- See the README about individual language/framework/plugin snippets:
2222+ -- https://github.com/rafamadriz/friendly-snippets
2323+ -- {
2424+ -- 'rafamadriz/friendly-snippets',
2525+ -- config = function()
2626+ -- require('luasnip.loaders.from_vscode').lazy_load()
2727+ -- end,
2828+ -- },
2929+ },
3030+ opts = {},
3131+ },
3232+ 'folke/lazydev.nvim',
3333+ },
3434+ --- @module 'blink.cmp'
3535+ --- @type blink.cmp.Config
3636+ opts = {
3737+ keymap = {
3838+ -- 'default' (recommended) for mappings similar to built-in completions
3939+ -- <c-y> to accept ([y]es) the completion.
4040+ -- This will auto-import if your LSP supports it.
4141+ -- This will expand snippets if the LSP sent a snippet.
4242+ -- 'super-tab' for tab to accept
4343+ -- 'enter' for enter to accept
4444+ -- 'none' for no mappings
4545+ --
4646+ -- For an understanding of why the 'default' preset is recommended,
4747+ -- you will need to read `:help ins-completion`
4848+ --
4949+ -- No, but seriously. Please read `:help ins-completion`, it is really good!
5050+ --
5151+ -- All presets have the following mappings:
5252+ -- <tab>/<s-tab>: move to right/left of your snippet expansion
5353+ -- <c-space>: Open menu or open docs if already open
5454+ -- <c-n>/<c-p> or <up>/<down>: Select next/previous item
5555+ -- <c-e>: Hide menu
5656+ -- <c-k>: Toggle signature help
5757+ --
5858+ -- See :h blink-cmp-config-keymap for defining your own keymap
5959+ preset = 'default',
6060+6161+ -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
6262+ -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
6363+ },
6464+6565+ appearance = {
6666+ -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
6767+ -- Adjusts spacing to ensure icons are aligned
6868+ nerd_font_variant = 'mono',
6969+ },
7070+7171+ completion = {
7272+ -- By default, you may press `<c-space>` to show the documentation.
7373+ -- Optionally, set `auto_show = true` to show the documentation after a delay.
7474+ documentation = { auto_show = false, auto_show_delay_ms = 500 },
7575+ },
7676+7777+ sources = {
7878+ default = { 'lsp', 'path', 'snippets', 'lazydev' },
7979+ providers = {
8080+ lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
8181+ },
8282+ },
8383+8484+ snippets = { preset = 'luasnip' },
8585+8686+ -- Blink.cmp includes an optional, recommended rust fuzzy matcher,
8787+ -- which automatically downloads a prebuilt binary when enabled.
8888+ --
8989+ -- By default, we use the Lua implementation instead, but you may enable
9090+ -- the rust implementation via `'prefer_rust_with_warning'`
9191+ --
9292+ -- See :h blink-cmp-config-fuzzy for more information
9393+ fuzzy = { implementation = 'lua' },
9494+9595+ -- Shows a signature help window while you type arguments for a function
9696+ signature = { enabled = true },
9797+ },
9898+}
···11+return {
22+ -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
33+ -- used for completion, annotations and signatures of Neovim apis
44+ 'folke/lazydev.nvim',
55+ cond = function()
66+ if os.getenv("WICKED_VIM_MODE") == "OBSIDIAN" then
77+ return false
88+ end
99+ if os.getenv("WICKED_VIM_MODE") == nil then
1010+ return true
1111+ end
1212+ end,
1313+ ft = 'lua',
1414+ opts = {
1515+ library = {
1616+ -- Load luvit types when the `vim.uv` word is found
1717+ { path = '${3rd}/luv/library', words = { 'vim%.uv' } },
1818+ },
1919+ },
2020+}
2121+
···11+return {
22+ -- Main LSP Configuration
33+ 'neovim/nvim-lspconfig',
44+ dependencies = {
55+ -- Automatically install LSPs and related tools to stdpath for Neovim
66+ -- Mason must be loaded before its dependents so we need to set it up here.
77+ -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
88+ { 'mason-org/mason.nvim', opts = {} },
99+ 'mason-org/mason-lspconfig.nvim',
1010+ 'WhoIsSethDaniel/mason-tool-installer.nvim',
1111+1212+ -- Useful status updates for LSP.
1313+ { 'j-hui/fidget.nvim', opts = {} },
1414+1515+ -- Allows extra capabilities provided by blink.cmp
1616+ 'saghen/blink.cmp',
1717+ },
1818+ config = function()
1919+ -- This function gets run when an LSP attaches to a particular buffer.
2020+ -- That is to say, every time a new file is opened that is associated with
2121+ -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
2222+ -- function will be executed to configure the current buffer
2323+ vim.api.nvim_create_autocmd('LspAttach', {
2424+ group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
2525+ callback = function(event)
2626+ -- NOTE: Remember that Lua is a real programming language, and as such it is possible
2727+ -- to define small helper and utility functions so you don't have to repeat yourself.
2828+ --
2929+ -- In this case, we create a function that lets us more easily define mappings specific
3030+ -- for LSP related items. It sets the mode, buffer and description for us each time.
3131+ local map = function(keys, func, desc, mode)
3232+ mode = mode or 'n'
3333+ vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
3434+ end
3535+3636+ -- Rename the variable under your cursor.
3737+ -- Most Language Servers support renaming across files, etc.
3838+ map('grn', vim.lsp.buf.rename, '[R]e[n]ame')
3939+4040+ -- Execute a code action, usually your cursor needs to be on top of an error
4141+ -- or a suggestion from your LSP for this to activate.
4242+ map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
4343+4444+ -- Find references for the word under your cursor.
4545+ map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
4646+4747+ -- Jump to the implementation of the word under your cursor.
4848+ -- Useful when your language has ways of declaring types without an actual implementation.
4949+ map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
5050+5151+ -- Jump to the definition of the word under your cursor.
5252+ -- This is where a variable was first declared, or where a function is defined, etc.
5353+ -- To jump back, press <C-t>.
5454+ map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
5555+5656+ -- WARN: This is not Goto Definition, this is Goto Declaration.
5757+ -- For example, in C this would take you to the header.
5858+ map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
5959+6060+ -- Fuzzy find all the symbols in your current document.
6161+ -- Symbols are things like variables, functions, types, etc.
6262+ map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
6363+6464+ -- Fuzzy find all the symbols in your current workspace.
6565+ -- Similar to document symbols, except searches over your entire project.
6666+ map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols')
6767+6868+ -- Jump to the type of the word under your cursor.
6969+ -- Useful when you're not sure what type a variable is and you want to see
7070+ -- the definition of its *type*, not where it was *defined*.
7171+ map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
7272+7373+ -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
7474+ ---@param client vim.lsp.Client
7575+ ---@param method vim.lsp.protocol.Method
7676+ ---@param bufnr? integer some lsp support methods only in specific files
7777+ ---@return boolean
7878+ local function client_supports_method(client, method, bufnr)
7979+ if vim.fn.has 'nvim-0.11' == 1 then
8080+ return client:supports_method(method, bufnr)
8181+ else
8282+ return client.supports_method(method, { bufnr = bufnr })
8383+ end
8484+ end
8585+8686+ -- The following two autocommands are used to highlight references of the
8787+ -- word under your cursor when your cursor rests there for a little while.
8888+ -- See `:help CursorHold` for information about when this is executed
8989+ --
9090+ -- When you move your cursor, the highlights will be cleared (the second autocommand).
9191+ local client = vim.lsp.get_client_by_id(event.data.client_id)
9292+ if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
9393+ local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
9494+ vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
9595+ buffer = event.buf,
9696+ group = highlight_augroup,
9797+ callback = vim.lsp.buf.document_highlight,
9898+ })
9999+100100+ vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
101101+ buffer = event.buf,
102102+ group = highlight_augroup,
103103+ callback = vim.lsp.buf.clear_references,
104104+ })
105105+106106+ vim.api.nvim_create_autocmd('LspDetach', {
107107+ group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
108108+ callback = function(event2)
109109+ vim.lsp.buf.clear_references()
110110+ vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
111111+ end,
112112+ })
113113+ end
114114+115115+ -- The following code creates a keymap to toggle inlay hints in your
116116+ -- code, if the language server you are using supports them
117117+ --
118118+ -- This may be unwanted, since they displace some of your code
119119+ if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
120120+ map('<leader>th', function()
121121+ vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
122122+ end, '[T]oggle Inlay [H]ints')
123123+ end
124124+ end,
125125+ })
126126+127127+ -- Diagnostic Config
128128+ -- See :help vim.diagnostic.Opts
129129+ vim.diagnostic.config {
130130+ severity_sort = true,
131131+ float = { border = 'rounded', source = 'if_many' },
132132+ underline = { severity = vim.diagnostic.severity.ERROR },
133133+ signs = vim.g.have_nerd_font and {
134134+ text = {
135135+ [vim.diagnostic.severity.ERROR] = ' ',
136136+ [vim.diagnostic.severity.WARN] = ' ',
137137+ [vim.diagnostic.severity.INFO] = ' ',
138138+ [vim.diagnostic.severity.HINT] = ' ',
139139+ },
140140+ } or {},
141141+ virtual_text = {
142142+ source = 'if_many',
143143+ spacing = 2,
144144+ format = function(diagnostic)
145145+ local diagnostic_message = {
146146+ [vim.diagnostic.severity.ERROR] = diagnostic.message,
147147+ [vim.diagnostic.severity.WARN] = diagnostic.message,
148148+ [vim.diagnostic.severity.INFO] = diagnostic.message,
149149+ [vim.diagnostic.severity.HINT] = diagnostic.message,
150150+ }
151151+ return diagnostic_message[diagnostic.severity]
152152+ end,
153153+ },
154154+ }
155155+156156+ -- LSP servers and clients are able to communicate to each other what features they support.
157157+ -- By default, Neovim doesn't support everything that is in the LSP specification.
158158+ -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
159159+ -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
160160+ local capabilities = require('blink.cmp').get_lsp_capabilities()
161161+162162+ -- Enable the following language servers
163163+ -- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
164164+ --
165165+ -- Add any additional override configuration in the following tables. Available keys are:
166166+ -- - cmd (table): Override the default command used to start the server
167167+ -- - filetypes (table): Override the default list of associated filetypes for the server
168168+ -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
169169+ -- - settings (table): Override the default settings passed when initializing the server.
170170+ -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
171171+ local servers = {
172172+ -- clangd = {},
173173+ -- gopls = {},
174174+ -- pyright = {},
175175+ -- rust_analyzer = {},
176176+ -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
177177+ --
178178+ -- Some languages (like typescript) have entire language plugins that can be useful:
179179+ -- https://github.com/pmizio/typescript-tools.nvim
180180+ --
181181+ -- But for many setups, the LSP (`ts_ls`) will work just fine
182182+ -- ts_ls = {},
183183+ --
184184+185185+ lua_ls = {
186186+ -- cmd = { ... },
187187+ -- filetypes = { ... },
188188+ -- capabilities = {},
189189+ settings = {
190190+ Lua = {
191191+ completion = {
192192+ callSnippet = 'Replace',
193193+ },
194194+ -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
195195+ -- diagnostics = { disable = { 'missing-fields' } },
196196+ },
197197+ },
198198+ },
199199+ }
200200+201201+ -- Ensure the servers and tools above are installed
202202+ --
203203+ -- To check the current status of installed tools and/or manually install
204204+ -- other tools, you can run
205205+ -- :Mason
206206+ --
207207+ -- You can press `g?` for help in this menu.
208208+ --
209209+ -- `mason` had to be setup earlier: to configure its options see the
210210+ -- `dependencies` table for `nvim-lspconfig` above.
211211+ --
212212+ -- You can add other tools here that you want Mason to install
213213+ -- for you, so that they are available from within Neovim.
214214+ local ensure_installed = vim.tbl_keys(servers or {})
215215+ vim.list_extend(ensure_installed, {
216216+ 'stylua', -- Used to format Lua code
217217+ })
218218+ require('mason-tool-installer').setup { ensure_installed = ensure_installed }
219219+220220+ require('mason-lspconfig').setup {
221221+ ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
222222+ automatic_installation = false,
223223+ handlers = {
224224+ function(server_name)
225225+ local server = servers[server_name] or {}
226226+ -- This handles overriding only values explicitly passed
227227+ -- by the server configuration above. Useful when disabling
228228+ -- certain features of an LSP (for example, turning off formatting for ts_ls)
229229+ server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
230230+ require('lspconfig')[server_name].setup(server)
231231+ end,
232232+ },
233233+ }
234234+ end,
235235+}
···11+return {
22+ 'nvim-treesitter/nvim-treesitter',
33+ build = ":TSUpdate",
44+ config = function()
55+ require'nvim-treesitter.configs'.setup {
66+ indent = { enable = true },
77+ -- A list of parser names, or "all"
88+ ensure_installed = { "vimdoc", "javascript", "typescript", "c", "lua", "rust" },
99+1010+ -- Install parsers synchronously (only applied to `ensure_installed`)
1111+ sync_install = false,
1212+1313+ -- Automatically install missing parsers when entering buffer
1414+ -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
1515+ auto_install = true,
1616+1717+ highlight = {
1818+ --- `false` will disable the whole extension
1919+ enable = true,
2020+2121+ -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
2222+ -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
2323+ -- Using this option may slow down your editor, and you may see some duplicate highlights.
2424+ -- Instead of true it can also be a list of languages
2525+ additional_vim_regex_highlighting = { "markdown" }
2626+ },
2727+ }
2828+ end
2929+}