at main 33 kB view raw
1-- [[ Configure and install plugins ]] 2-- 3-- To check the current status of your plugins, run 4-- :Lazy 5-- 6-- You can press `?` in this menu for help. Use `:q` to close the window 7-- 8-- To update plugins you can run 9-- :Lazy update 10-- 11-- NOTE: Here is where you install your plugins. 12require('lazy').setup({ 13 -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 14 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically 15 16 -- See `:help gitsigns` to understand what the configuration keys do 17 { -- Adds git related signs to the gutter, as well as utilities for managing changes 18 'lewis6991/gitsigns.nvim', 19 opts = { 20 signs = { 21 add = { text = '+' }, 22 change = { text = '~' }, 23 delete = { text = '_' }, 24 topdelete = { text = '' }, 25 changedelete = { text = '~' }, 26 }, 27 }, 28 }, 29 30 { -- Useful plugin to show you pending keybinds. 31 'folke/which-key.nvim', 32 event = 'VimEnter', -- Sets the loading event to 'VimEnter' 33 opts = { 34 -- delay between pressing a key and opening which-key (milliseconds) 35 -- this setting is independent of vim.opt.timeoutlen 36 delay = 0, 37 icons = { 38 -- set icon mappings to true if you have a Nerd Font 39 mappings = vim.g.have_nerd_font, 40 -- If you are using a Nerd Font: set icons.keys to an empty table which will use the 41 -- default which-key.nvim defined Nerd Font icons, otherwise define a string table 42 keys = vim.g.have_nerd_font and {} or { 43 Up = '<Up> ', 44 Down = '<Down> ', 45 Left = '<Left> ', 46 Right = '<Right> ', 47 C = '<C-…> ', 48 M = '<M-…> ', 49 D = '<D-…> ', 50 S = '<S-…> ', 51 CR = '<CR> ', 52 Esc = '<Esc> ', 53 ScrollWheelDown = '<ScrollWheelDown> ', 54 ScrollWheelUp = '<ScrollWheelUp> ', 55 NL = '<NL> ', 56 BS = '<BS> ', 57 Space = '<Space> ', 58 Tab = '<Tab> ', 59 F1 = '<F1>', 60 F2 = '<F2>', 61 F3 = '<F3>', 62 F4 = '<F4>', 63 F5 = '<F5>', 64 F6 = '<F6>', 65 F7 = '<F7>', 66 F8 = '<F8>', 67 F9 = '<F9>', 68 F10 = '<F10>', 69 F11 = '<F11>', 70 F12 = '<F12>', 71 }, 72 }, 73 74 -- Document existing key chains 75 spec = { 76 { '<leader>c', group = '[C]ode', mode = { 'n', 'x' } }, 77 { '<leader>d', group = '[D]ocument' }, 78 { '<leader>r', group = '[R]ename' }, 79 { '<leader>s', group = '[S]earch' }, 80 { '<leader>w', group = '[W]orkspace' }, 81 { '<leader>t', group = '[T]oggle' }, 82 { '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } }, 83 }, 84 }, 85 }, 86 87 -- NOTE: Plugins can specify dependencies. 88 -- 89 -- The dependencies are proper plugin specifications as well - anything 90 -- you do for a plugin at the top level, you can do for a dependency. 91 -- 92 -- Use the `dependencies` key to specify the dependencies of a particular plugin 93 94 { -- Fuzzy Finder (files, lsp, etc) 95 'nvim-telescope/telescope.nvim', 96 event = 'VimEnter', 97 branch = '0.1.x', 98 dependencies = { 99 'nvim-lua/plenary.nvim', 100 { -- If encountering errors, see telescope-fzf-native README for installation instructions 101 'nvim-telescope/telescope-fzf-native.nvim', 102 103 -- `build` is used to run some command when the plugin is installed/updated. 104 -- This is only run then, not every time Neovim starts up. 105 build = 'make', 106 107 -- `cond` is a condition used to determine whether this plugin should be 108 -- installed and loaded. 109 cond = function() 110 return vim.fn.executable 'make' == 1 111 end, 112 }, 113 { 'nvim-telescope/telescope-ui-select.nvim' }, 114 115 { -- NvimTree 116 'nvim-tree/nvim-tree.lua', 117 version = '*', 118 lazy = false, 119 dependencies = { 120 'nvim-tree/nvim-web-devicons', 121 }, 122 config = function() 123 require('nvim-tree').setup {} 124 end, 125 }, 126 127 -- Useful for getting pretty icons, but requires a Nerd Font. 128 { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, 129 }, 130 config = function() 131 -- Telescope is a fuzzy finder that comes with a lot of different things that 132 -- it can fuzzy find! It's more than just a "file finder", it can search 133 -- many different aspects of Neovim, your workspace, LSP, and more! 134 -- 135 -- The easiest way to use Telescope, is to start by doing something like: 136 -- :Telescope help_tags 137 -- 138 -- After running this command, a window will open up and you're able to 139 -- type in the prompt window. You'll see a list of `help_tags` options and 140 -- a corresponding preview of the help. 141 -- 142 -- Two important keymaps to use while in Telescope are: 143 -- - Insert mode: <c-/> 144 -- - Normal mode: ? 145 -- 146 -- This opens a window that shows you all of the keymaps for the current 147 -- Telescope picker. This is really useful to discover what Telescope can 148 -- do as well as how to actually do it! 149 150 -- [[ Configure Telescope ]] 151 -- See `:help telescope` and `:help telescope.setup()` 152 require('telescope').setup { 153 -- You can put your default mappings / updates / etc. in here 154 -- All the info you're looking for is in `:help telescope.setup()` 155 -- 156 -- defaults = { 157 -- mappings = { 158 -- i = { ['<c-enter>'] = 'to_fuzzy_refine' }, 159 -- }, 160 -- }, 161 -- pickers = {} 162 extensions = { 163 ['ui-select'] = { 164 require('telescope.themes').get_dropdown(), 165 }, 166 media_files = { 167 -- filetypes whitelist 168 -- defaults to {"png", "jpg", "mp4", "webm", "pdf"} 169 filetypes = { 'png', 'jpg', 'jpeg', 'webp', 'mp4', 'webm', 'pdf', 'ico', 'svg' }, 170 -- find command (defaults to `fd`) 171 find_cmd = 'rg', 172 }, 173 }, 174 } 175 176 -- Enable Telescope extensions if they are installed 177 pcall(require('telescope').load_extension, 'fzf') 178 pcall(require('telescope').load_extension, 'ui-select') 179 pcall(require('telescope').load_extension, 'media_files') 180 181 -- See `:help telescope.builtin` 182 local builtin = require 'telescope.builtin' 183 vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) 184 vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) 185 vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' }) 186 vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) 187 vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) 188 vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) 189 vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) 190 vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' }) 191 vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) 192 vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' }) 193 194 -- Slightly advanced example of overriding default behavior and theme 195 vim.keymap.set('n', '<leader>/', function() 196 -- You can pass additional configuration to Telescope to change the theme, layout, etc. 197 builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { 198 winblend = 10, 199 previewer = false, 200 }) 201 end, { desc = '[/] Fuzzily search in current buffer' }) 202 203 -- It's also possible to pass additional configuration options. 204 -- See `:help telescope.builtin.live_grep()` for information about particular keys 205 vim.keymap.set('n', '<leader>s/', function() 206 builtin.live_grep { 207 grep_open_files = true, 208 prompt_title = 'Live Grep in Open Files', 209 } 210 end, { desc = '[S]earch [/] in Open Files' }) 211 212 -- Shortcut for searching your Neovim configuration files 213 vim.keymap.set('n', '<leader>sn', function() 214 builtin.find_files { cwd = vim.fn.stdpath 'config' } 215 end, { desc = '[S]earch [N]eovim files' }) 216 end, 217 }, 218 219 -- LSP Plugins 220 { 221 -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins 222 -- used for completion, annotations and signatures of Neovim apis 223 'folke/lazydev.nvim', 224 ft = 'lua', 225 opts = { 226 library = { 227 -- Load luvit types when the `vim.uv` word is found 228 { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, 229 }, 230 }, 231 }, 232 233 { 234 -- Main LSP Configuration 235 'neovim/nvim-lspconfig', 236 dependencies = { 237 -- Automatically install LSPs and related tools to stdpath for Neovim 238 -- Mason must be loaded before its dependents so we need to set it up here. 239 -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` 240 { 'williamboman/mason.nvim', opts = {} }, 241 'williamboman/mason-lspconfig.nvim', 242 'WhoIsSethDaniel/mason-tool-installer.nvim', 243 244 -- Useful status updates for LSP. 245 { 'j-hui/fidget.nvim', opts = {} }, 246 247 -- Allows extra capabilities provided by nvim-cmp 248 'hrsh7th/cmp-nvim-lsp', 249 }, 250 config = function() 251 -- Brief aside: **What is LSP?** 252 -- 253 -- LSP is an initialism you've probably heard, but might not understand what it is. 254 -- 255 -- LSP stands for Language Server Protocol. It's a protocol that helps editors 256 -- and language tooling communicate in a standardized fashion. 257 -- 258 -- In general, you have a "server" which is some tool built to understand a particular 259 -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers 260 -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone 261 -- processes that communicate with some "client" - in this case, Neovim! 262 -- 263 -- LSP provides Neovim with features like: 264 -- - Go to definition 265 -- - Find references 266 -- - Autocompletion 267 -- - Symbol Search 268 -- - and more! 269 -- 270 -- Thus, Language Servers are external tools that must be installed separately from 271 -- Neovim. This is where `mason` and related plugins come into play. 272 -- 273 -- If you're wondering about lsp vs treesitter, you can check out the wonderfully 274 -- and elegantly composed help section, `:help lsp-vs-treesitter` 275 276 -- This function gets run when an LSP attaches to a particular buffer. 277 -- That is to say, every time a new file is opened that is associated with 278 -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this 279 -- function will be executed to configure the current buffer 280 vim.api.nvim_create_autocmd('LspAttach', { 281 group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), 282 callback = function(event) 283 -- NOTE: Remember that Lua is a real programming language, and as such it is possible 284 -- to define small helper and utility functions so you don't have to repeat yourself. 285 -- 286 -- In this case, we create a function that lets us more easily define mappings specific 287 -- for LSP related items. It sets the mode, buffer and description for us each time. 288 local map = function(keys, func, desc, mode) 289 mode = mode or 'n' 290 vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) 291 end 292 293 -- Jump to the definition of the word under your cursor. 294 -- This is where a variable was first declared, or where a function is defined, etc. 295 -- To jump back, press <C-t>. 296 map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') 297 298 -- Find references for the word under your cursor. 299 map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') 300 301 -- Jump to the implementation of the word under your cursor. 302 -- Useful when your language has ways of declaring types without an actual implementation. 303 map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') 304 305 -- Jump to the type of the word under your cursor. 306 -- Useful when you're not sure what type a variable is and you want to see 307 -- the definition of its *type*, not where it was *defined*. 308 map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') 309 310 -- Fuzzy find all the symbols in your current document. 311 -- Symbols are things like variables, functions, types, etc. 312 map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') 313 314 -- Fuzzy find all the symbols in your current workspace. 315 -- Similar to document symbols, except searches over your entire project. 316 map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') 317 318 -- Rename the variable under your cursor. 319 -- Most Language Servers support renaming across files, etc. 320 map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame') 321 322 -- Execute a code action, usually your cursor needs to be on top of an error 323 -- or a suggestion from your LSP for this to activate. 324 map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' }) 325 326 -- WARN: This is not Goto Definition, this is Goto Declaration. 327 -- For example, in C this would take you to the header. 328 map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') 329 330 -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) 331 ---@param client vim.lsp.Client 332 ---@param method vim.lsp.protocol.Method 333 ---@param bufnr? integer some lsp support methods only in specific files 334 ---@return boolean 335 local function client_supports_method(client, method, bufnr) 336 if vim.fn.has 'nvim-0.11' == 1 then 337 return client:supports_method(method, bufnr) 338 else 339 return client.supports_method(method, { bufnr = bufnr }) 340 end 341 end 342 343 -- The following two autocommands are used to highlight references of the 344 -- word under your cursor when your cursor rests there for a little while. 345 -- See `:help CursorHold` for information about when this is executed 346 -- 347 -- When you move your cursor, the highlights will be cleared (the second autocommand). 348 local client = vim.lsp.get_client_by_id(event.data.client_id) 349 if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then 350 local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) 351 vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { 352 buffer = event.buf, 353 group = highlight_augroup, 354 callback = vim.lsp.buf.document_highlight, 355 }) 356 357 vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { 358 buffer = event.buf, 359 group = highlight_augroup, 360 callback = vim.lsp.buf.clear_references, 361 }) 362 363 vim.api.nvim_create_autocmd('LspDetach', { 364 group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), 365 callback = function(event2) 366 vim.lsp.buf.clear_references() 367 vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } 368 end, 369 }) 370 end 371 372 -- The following code creates a keymap to toggle inlay hints in your 373 -- code, if the language server you are using supports them 374 -- 375 -- This may be unwanted, since they displace some of your code 376 if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then 377 map('<leader>th', function() 378 vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) 379 end, '[T]oggle Inlay [H]ints') 380 end 381 end, 382 }) 383 384 -- Diagnostic Config 385 -- See :help vim.diagnostic.Opts 386 vim.diagnostic.config { 387 severity_sort = true, 388 float = { border = 'rounded', source = 'if_many' }, 389 underline = { severity = vim.diagnostic.severity.ERROR }, 390 signs = vim.g.have_nerd_font and { 391 text = { 392 [vim.diagnostic.severity.ERROR] = '󰅚 ', 393 [vim.diagnostic.severity.WARN] = '󰀪 ', 394 [vim.diagnostic.severity.INFO] = '󰋽 ', 395 [vim.diagnostic.severity.HINT] = '󰌶 ', 396 }, 397 } or {}, 398 virtual_text = { 399 source = 'if_many', 400 spacing = 2, 401 format = function(diagnostic) 402 local diagnostic_message = { 403 [vim.diagnostic.severity.ERROR] = diagnostic.message, 404 [vim.diagnostic.severity.WARN] = diagnostic.message, 405 [vim.diagnostic.severity.INFO] = diagnostic.message, 406 [vim.diagnostic.severity.HINT] = diagnostic.message, 407 } 408 return diagnostic_message[diagnostic.severity] 409 end, 410 }, 411 } 412 413 -- LSP servers and clients are able to communicate to each other what features they support. 414 -- By default, Neovim doesn't support everything that is in the LSP specification. 415 -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. 416 -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers. 417 local capabilities = vim.lsp.protocol.make_client_capabilities() 418 capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) 419 420 -- Enable the following language servers 421 -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. 422 -- 423 -- Add any additional override configuration in the following tables. Available keys are: 424 -- - cmd (table): Override the default command used to start the server 425 -- - filetypes (table): Override the default list of associated filetypes for the server 426 -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. 427 -- - settings (table): Override the default settings passed when initializing the server. 428 -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ 429 local servers = { 430 ansiblels = {}, 431 awk_ls = {}, 432 bashls = {}, 433 css_variables = {}, 434 cssls = {}, 435 cssmodules_ls = {}, 436 docker_compose_language_service = {}, 437 dockerls = {}, 438 html = {}, 439 jsonls = {}, 440 lua_ls = { 441 -- cmd = { ... }, 442 -- filetypes = { ... }, 443 -- capabilities = {}, 444 settings = { 445 Lua = { 446 completion = { 447 callSnippet = 'Replace', 448 }, 449 -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings 450 -- diagnostics = { disable = { 'missing-fields' } }, 451 }, 452 }, 453 }, 454 marksman = {}, 455 mypy = {}, 456 ruff = {}, 457 yamlls = {}, 458 } 459 460 -- Ensure the servers and tools above are installed 461 -- 462 -- To check the current status of installed tools and/or manually install 463 -- other tools, you can run 464 -- :Mason 465 -- 466 -- You can press `g?` for help in this menu. 467 -- 468 -- `mason` had to be setup earlier: to configure its options see the 469 -- `dependencies` table for `nvim-lspconfig` above. 470 -- 471 -- You can add other tools here that you want Mason to install 472 -- for you, so that they are available from within Neovim. 473 local ensure_installed = vim.tbl_keys(servers or {}) 474 vim.list_extend(ensure_installed, { 475 'ansible-lint', 476 'black', 477 'isort', 478 'jq', 479 'markdownlint-cli2', 480 'shellcheck', 481 'shfmt', 482 'stylua', -- Used to format Lua code 483 'yamlfmt', 484 }) 485 require('mason-tool-installer').setup { ensure_installed = ensure_installed } 486 487 require('mason-lspconfig').setup { 488 ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) 489 automatic_installation = false, 490 handlers = { 491 function(server_name) 492 local server = servers[server_name] or {} 493 -- This handles overriding only values explicitly passed 494 -- by the server configuration above. Useful when disabling 495 -- certain features of an LSP (for example, turning off formatting for ts_ls) 496 server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) 497 require('lspconfig')[server_name].setup(server) 498 end, 499 }, 500 } 501 end, 502 }, 503 504 { -- markview 505 'OXY2DEV/markview.nvim', 506 lazy = false, 507 }, 508 509 { -- Autoformat 510 'stevearc/conform.nvim', 511 event = { 'BufWritePre' }, 512 cmd = { 'ConformInfo' }, 513 keys = { 514 { 515 '<leader>f', 516 function() 517 require('conform').format { async = true, lsp_format = 'fallback' } 518 end, 519 mode = '', 520 desc = '[F]ormat buffer', 521 }, 522 }, 523 opts = { 524 notify_on_error = false, 525 format_on_save = function(bufnr) 526 -- Disable "format_on_save lsp_fallback" for languages that don't 527 -- have a well standardized coding style. You can add additional 528 -- languages here or re-enable it for the disabled ones. 529 local disable_filetypes = { c = true, cpp = true } 530 local lsp_format_opt 531 if disable_filetypes[vim.bo[bufnr].filetype] then 532 lsp_format_opt = 'never' 533 else 534 lsp_format_opt = 'fallback' 535 end 536 return { 537 timeout_ms = 500, 538 lsp_format = lsp_format_opt, 539 } 540 end, 541 formatters_by_ft = { 542 ansible = { 'ansible-lint' }, 543 bash = { 'shellcheck', 'shfmt' }, 544 docker = { 'dockerfmt' }, 545 json = { 'jq' }, 546 just = { 'just' }, 547 lua = { 'stylua' }, 548 markdown = { 'markdownlint-cli2' }, 549 nginx = { 'nginxfmt' }, 550 python = { 'isort', 'black' }, 551 yaml = { 'yamlfmt' }, 552 }, 553 }, 554 }, 555 556 { -- Autocompletion 557 'hrsh7th/nvim-cmp', 558 event = 'InsertEnter', 559 dependencies = { 560 -- Snippet Engine & its associated nvim-cmp source 561 { 562 'L3MON4D3/LuaSnip', 563 build = (function() 564 -- Build Step is needed for regex support in snippets. 565 -- This step is not supported in many windows environments. 566 -- Remove the below condition to re-enable on windows. 567 if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then 568 return 569 end 570 return 'make install_jsregexp' 571 end)(), 572 dependencies = { 573 -- `friendly-snippets` contains a variety of premade snippets. 574 -- See the README about individual language/framework/plugin snippets: 575 -- https://github.com/rafamadriz/friendly-snippets 576 -- { 577 -- 'rafamadriz/friendly-snippets', 578 -- config = function() 579 -- require('luasnip.loaders.from_vscode').lazy_load() 580 -- end, 581 -- }, 582 }, 583 }, 584 'saadparwaiz1/cmp_luasnip', 585 586 -- Adds other completion capabilities. 587 -- nvim-cmp does not ship with all sources by default. They are split 588 -- into multiple repos for maintenance purposes. 589 'hrsh7th/cmp-nvim-lsp', 590 'hrsh7th/cmp-path', 591 'hrsh7th/cmp-nvim-lsp-signature-help', 592 }, 593 config = function() 594 -- See `:help cmp` 595 local cmp = require 'cmp' 596 local luasnip = require 'luasnip' 597 luasnip.config.setup {} 598 599 cmp.setup { 600 snippet = { 601 expand = function(args) 602 luasnip.lsp_expand(args.body) 603 end, 604 }, 605 completion = { completeopt = 'menu,menuone,noinsert' }, 606 607 -- For an understanding of why these mappings were 608 -- chosen, you will need to read `:help ins-completion` 609 -- 610 -- No, but seriously. Please read `:help ins-completion`, it is really good! 611 mapping = cmp.mapping.preset.insert { 612 -- Select the [n]ext item 613 ['<C-n>'] = cmp.mapping.select_next_item(), 614 -- Select the [p]revious item 615 ['<C-p>'] = cmp.mapping.select_prev_item(), 616 617 -- Scroll the documentation window [b]ack / [f]orward 618 ['<C-b>'] = cmp.mapping.scroll_docs(-4), 619 ['<C-f>'] = cmp.mapping.scroll_docs(4), 620 621 -- Accept ([y]es) the completion. 622 -- This will auto-import if your LSP supports it. 623 -- This will expand snippets if the LSP sent a snippet. 624 ['<C-y>'] = cmp.mapping.confirm { select = true }, 625 626 -- If you prefer more traditional completion keymaps, 627 -- you can uncomment the following lines 628 --['<CR>'] = cmp.mapping.confirm { select = true }, 629 --['<Tab>'] = cmp.mapping.select_next_item(), 630 --['<S-Tab>'] = cmp.mapping.select_prev_item(), 631 632 -- Manually trigger a completion from nvim-cmp. 633 -- Generally you don't need this, because nvim-cmp will display 634 -- completions whenever it has completion options available. 635 ['<C-Space>'] = cmp.mapping.complete {}, 636 637 -- Think of <c-l> as moving to the right of your snippet expansion. 638 -- So if you have a snippet that's like: 639 -- function $name($args) 640 -- $body 641 -- end 642 -- 643 -- <c-l> will move you to the right of each of the expansion locations. 644 -- <c-h> is similar, except moving you backwards. 645 ['<C-l>'] = cmp.mapping(function() 646 if luasnip.expand_or_locally_jumpable() then 647 luasnip.expand_or_jump() 648 end 649 end, { 'i', 's' }), 650 ['<C-h>'] = cmp.mapping(function() 651 if luasnip.locally_jumpable(-1) then 652 luasnip.jump(-1) 653 end 654 end, { 'i', 's' }), 655 656 -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: 657 -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps 658 }, 659 sources = { 660 { 661 name = 'lazydev', 662 -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it 663 group_index = 0, 664 }, 665 { name = 'nvim_lsp' }, 666 { name = 'luasnip' }, 667 { name = 'path' }, 668 { name = 'nvim_lsp_signature_help' }, 669 }, 670 } 671 end, 672 }, 673 674 { -- everforest theme 675 'sainnhe/everforest', 676 lazy = false, 677 priority = 1000, 678 config = function() 679 vim.g.everforest_enable_italic = true 680 vim.cmd.colorscheme 'everforest' 681 end, 682 }, 683 684 --{ -- Catppuccin theme 685 --'catppuccin/nvim', 686 --name = 'catppuccin', 687 --priority = 1000, 688 --config = function() 689 --vim.cmd 'colorscheme catppuccin' 690 --require('catppuccin').setup { 691 --flavor = 'mocha', 692 --} 693 --end, 694 --}, 695 696 { --NERDCommenter 697 'preservim/nerdcommenter', 698 }, 699 700 { --Gemini file syntax highlighting 701 'https://tildegit.org/sloum/gemini-vim-syntax', 702 }, 703 704 { --nushell syntax highlighting 705 'elkasztano/nushell-syntax-vim', 706 }, 707 708 { -- Highlight todo, notes, etc in comments 709 'folke/todo-comments.nvim', 710 event = 'VimEnter', 711 dependencies = { 'nvim-lua/plenary.nvim' }, 712 opts = { signs = false }, 713 }, 714 715 { -- Collection of various small independent plugins/modules 716 'echasnovski/mini.nvim', 717 config = function() 718 -- Better Around/Inside textobjects 719 -- 720 -- Examples: 721 -- - va) - [V]isually select [A]round [)]paren 722 -- - yinq - [Y]ank [I]nside [N]ext [Q]uote 723 -- - ci' - [C]hange [I]nside [']quote 724 require('mini.ai').setup { n_lines = 500 } 725 726 -- Add/delete/replace surroundings (brackets, quotes, etc.) 727 -- 728 -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren 729 -- - sd' - [S]urround [D]elete [']quotes 730 -- - sr)' - [S]urround [R]eplace [)] ['] 731 require('mini.surround').setup() 732 733 -- Simple and easy statusline. 734 -- You could remove this setup call if you don't like it, 735 -- and try some other statusline plugin 736 local statusline = require 'mini.statusline' 737 -- set use_icons to true if you have a Nerd Font 738 statusline.setup { use_icons = vim.g.have_nerd_font } 739 740 -- You can configure sections in the statusline by overriding their 741 -- default behavior. For example, here we set the section for 742 -- cursor location to LINE:COLUMN 743 ---@diagnostic disable-next-line: duplicate-set-field 744 statusline.section_location = function() 745 return '%2l:%-2v' 746 end 747 748 -- ... and there is more! 749 -- Check out: https://github.com/echasnovski/mini.nvim 750 end, 751 }, 752 753 { -- Highlight, edit, and navigate code 754 'nvim-treesitter/nvim-treesitter', 755 build = ':TSUpdate', 756 main = 'nvim-treesitter.configs', -- Sets main module to use for opts 757 -- [[ Configure Treesitter ]] See `:help nvim-treesitter` 758 opts = { 759 ensure_installed = { 760 'bash', 761 'c', 762 'diff', 763 'html', 764 'json', 765 'lua', 766 'luadoc', 767 'markdown', 768 'markdown_inline', 769 'nu', 770 'python', 771 'regex', 772 'vim', 773 'vimdoc', 774 'yaml', 775 }, 776 -- Autoinstall languages that are not installed 777 auto_install = true, 778 highlight = { 779 enable = true, 780 -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. 781 -- If you are experiencing weird indenting issues, add the language to 782 -- the list of additional_vim_regex_highlighting and disabled languages for indent. 783 additional_vim_regex_highlighting = { 'ruby' }, 784 }, 785 indent = { enable = true, disable = { 'ruby' } }, 786 }, 787 788 { --telescope-media-files 789 'nvim-telescope/telescope-media-files.nvim', 790 }, 791 -- There are additional nvim-treesitter modules that you can use to interact 792 -- with nvim-treesitter. You should go explore a few and see what interests you: 793 -- 794 -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` 795 -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context 796 -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects 797 }, 798 799 -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the 800 -- init.lua. If you want these files, they are in the repository, so you can just download them and 801 -- place them in the correct locations. 802 803 -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart 804 -- 805 -- Here are some example plugins that I've included in the Kickstart repository. 806 -- Uncomment any of the lines below to enable them (you will need to restart nvim). 807 -- 808 -- require 'kickstart.plugins.debug', 809 -- require 'kickstart.plugins.indent_line', 810 -- require 'kickstart.plugins.lint', 811 -- require 'kickstart.plugins.autopairs', 812 -- require 'kickstart.plugins.neo-tree', 813 -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps 814 815 -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` 816 -- This is the easiest way to modularize your config. 817 -- 818 -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. 819 -- { import = 'custom.plugins' }, 820 -- 821 -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` 822 -- Or use telescope! 823 -- In normal mode type `<space>sh` then write `lazy.nvim-plugin` 824 -- you can continue same window with `<space>sr` which resumes last telescope search 825}, { 826 ui = { 827 -- If you are using a Nerd Font: set icons to an empty table which will use the 828 -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table 829 icons = vim.g.have_nerd_font and {} or { 830 cmd = '', 831 config = '🛠', 832 event = '📅', 833 ft = '📂', 834 init = '', 835 keys = '🗝', 836 plugin = '🔌', 837 runtime = '💻', 838 require = '🌙', 839 source = '📄', 840 start = '🚀', 841 task = '📌', 842 lazy = '💤 ', 843 }, 844 }, 845}) 846 847-- The line beneath this is called `modeline`. See `:help modeline` 848-- vim: ts=2 sts=2 sw=2 et