My user config prefs
at main 876 lines 34 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 perlnavigator = { 457 cmd = { 'perlnavigator' }, 458 settings = { 459 perlnavigator = { 460 perlPath = 'perl', 461 enableWarnings = true, 462 perltidyProfile = '', 463 perlcriticProfile = '', 464 perlcriticEnabled = true, 465 }, 466 }, 467 }, 468 raku_navigator = { 469 cmd = { 'node', '/home/jas/repos/github.com/bscan/RakuNavigator/server/out/server.js', '--stdio' }, 470 settings = { 471 raku_navigator = { 472 enableWarnings = true, 473 }, 474 }, 475 }, 476 ruff = {}, 477 yamlls = {}, 478 } 479 480 -- Ensure the servers and tools above are installed 481 -- 482 -- To check the current status of installed tools and/or manually install 483 -- other tools, you can run 484 -- :Mason 485 -- 486 -- You can press `g?` for help in this menu. 487 -- 488 -- `mason` had to be setup earlier: to configure its options see the 489 -- `dependencies` table for `nvim-lspconfig` above. 490 -- 491 -- You can add other tools here that you want Mason to install 492 -- for you, so that they are available from within Neovim. 493 local ensure_installed = vim.tbl_keys(servers or {}) 494 vim.list_extend(ensure_installed, { 495 'ansible-lint', 496 'black', 497 'isort', 498 'jq', 499 'markdownlint-cli2', 500 'shellcheck', 501 'shfmt', 502 'stylua', -- Used to format Lua code 503 'yamlfmt', 504 }) 505 require('mason-tool-installer').setup { ensure_installed = ensure_installed } 506 507 require('mason-lspconfig').setup { 508 ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) 509 automatic_installation = false, 510 handlers = { 511 function(server_name) 512 local server = servers[server_name] or {} 513 -- This handles overriding only values explicitly passed 514 -- by the server configuration above. Useful when disabling 515 -- certain features of an LSP (for example, turning off formatting for ts_ls) 516 server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) 517 require('lspconfig')[server_name].setup(server) 518 end, 519 }, 520 } 521 end, 522 }, 523 524 { -- markview 525 'OXY2DEV/markview.nvim', 526 lazy = false, 527 }, 528 529 { -- Autoformat 530 'stevearc/conform.nvim', 531 event = { 'BufWritePre' }, 532 cmd = { 'ConformInfo' }, 533 keys = { 534 { 535 '<leader>f', 536 function() 537 require('conform').format { async = true, lsp_format = 'fallback' } 538 end, 539 mode = '', 540 desc = '[F]ormat buffer', 541 }, 542 }, 543 opts = { 544 notify_on_error = false, 545 format_on_save = function(bufnr) 546 -- Disable "format_on_save lsp_fallback" for languages that don't 547 -- have a well standardized coding style. You can add additional 548 -- languages here or re-enable it for the disabled ones. 549 local disable_filetypes = { c = true, cpp = true } 550 local lsp_format_opt 551 if disable_filetypes[vim.bo[bufnr].filetype] then 552 lsp_format_opt = 'never' 553 else 554 lsp_format_opt = 'fallback' 555 end 556 return { 557 timeout_ms = 500, 558 lsp_format = lsp_format_opt, 559 } 560 end, 561 formatters_by_ft = { 562 ansible = { 'ansible-lint' }, 563 bash = { 'shellcheck', 'shfmt' }, 564 docker = { 'dockerfmt' }, 565 json = { 'jq' }, 566 just = { 'just' }, 567 lua = { 'stylua' }, 568 markdown = { 'markdownlint-cli2' }, 569 nginx = { 'nginxfmt' }, 570 python = { 'isort', 'black' }, 571 yaml = { 'yamlfmt' }, 572 }, 573 }, 574 }, 575 576 { -- Autocompletion 577 'hrsh7th/nvim-cmp', 578 event = 'InsertEnter', 579 dependencies = { 580 -- Snippet Engine & its associated nvim-cmp source 581 { 582 'L3MON4D3/LuaSnip', 583 build = (function() 584 -- Build Step is needed for regex support in snippets. 585 -- This step is not supported in many windows environments. 586 -- Remove the below condition to re-enable on windows. 587 if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then 588 return 589 end 590 return 'make install_jsregexp' 591 end)(), 592 dependencies = { 593 -- `friendly-snippets` contains a variety of premade snippets. 594 -- See the README about individual language/framework/plugin snippets: 595 -- https://github.com/rafamadriz/friendly-snippets 596 -- { 597 -- 'rafamadriz/friendly-snippets', 598 -- config = function() 599 -- require('luasnip.loaders.from_vscode').lazy_load() 600 -- end, 601 -- }, 602 }, 603 }, 604 'saadparwaiz1/cmp_luasnip', 605 606 -- Adds other completion capabilities. 607 -- nvim-cmp does not ship with all sources by default. They are split 608 -- into multiple repos for maintenance purposes. 609 'hrsh7th/cmp-nvim-lsp', 610 'hrsh7th/cmp-path', 611 'hrsh7th/cmp-nvim-lsp-signature-help', 612 }, 613 config = function() 614 -- See `:help cmp` 615 local cmp = require 'cmp' 616 local luasnip = require 'luasnip' 617 luasnip.config.setup {} 618 619 cmp.setup { 620 snippet = { 621 expand = function(args) 622 luasnip.lsp_expand(args.body) 623 end, 624 }, 625 completion = { completeopt = 'menu,menuone,noinsert' }, 626 627 -- For an understanding of why these mappings were 628 -- chosen, you will need to read `:help ins-completion` 629 -- 630 -- No, but seriously. Please read `:help ins-completion`, it is really good! 631 mapping = cmp.mapping.preset.insert { 632 -- Select the [n]ext item 633 ['<C-n>'] = cmp.mapping.select_next_item(), 634 -- Select the [p]revious item 635 ['<C-p>'] = cmp.mapping.select_prev_item(), 636 637 -- Scroll the documentation window [b]ack / [f]orward 638 ['<C-b>'] = cmp.mapping.scroll_docs(-4), 639 ['<C-f>'] = cmp.mapping.scroll_docs(4), 640 641 -- Accept ([y]es) the completion. 642 -- This will auto-import if your LSP supports it. 643 -- This will expand snippets if the LSP sent a snippet. 644 ['<C-y>'] = cmp.mapping.confirm { select = true }, 645 646 -- If you prefer more traditional completion keymaps, 647 -- you can uncomment the following lines 648 --['<CR>'] = cmp.mapping.confirm { select = true }, 649 --['<Tab>'] = cmp.mapping.select_next_item(), 650 --['<S-Tab>'] = cmp.mapping.select_prev_item(), 651 652 -- Manually trigger a completion from nvim-cmp. 653 -- Generally you don't need this, because nvim-cmp will display 654 -- completions whenever it has completion options available. 655 ['<C-Space>'] = cmp.mapping.complete {}, 656 657 -- Think of <c-l> as moving to the right of your snippet expansion. 658 -- So if you have a snippet that's like: 659 -- function $name($args) 660 -- $body 661 -- end 662 -- 663 -- <c-l> will move you to the right of each of the expansion locations. 664 -- <c-h> is similar, except moving you backwards. 665 ['<C-l>'] = cmp.mapping(function() 666 if luasnip.expand_or_locally_jumpable() then 667 luasnip.expand_or_jump() 668 end 669 end, { 'i', 's' }), 670 ['<C-h>'] = cmp.mapping(function() 671 if luasnip.locally_jumpable(-1) then 672 luasnip.jump(-1) 673 end 674 end, { 'i', 's' }), 675 676 -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: 677 -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps 678 }, 679 sources = { 680 { 681 name = 'lazydev', 682 -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it 683 group_index = 0, 684 }, 685 { name = 'nvim_lsp' }, 686 { name = 'luasnip' }, 687 { name = 'path' }, 688 { name = 'nvim_lsp_signature_help' }, 689 }, 690 } 691 end, 692 }, 693 694 --{ -- everforest theme 695 --'sainnhe/everforest', 696 --lazy = false, 697 --priority = 1000, 698 --config = function() 699 --vim.g.everforest_enable_italic = true 700 --vim.cmd.colorscheme 'everforest' 701 --end, 702 --}, 703 704 --{ -- Horizon theme 705 --'akinsho/horizon.nvim', 706 --version = '*', 707 --config = function() 708 --vim.cmd.colorscheme 'horizon' 709 --end, 710 --}, 711 712 { -- Catppuccin theme 713 'catppuccin/nvim', 714 name = 'catppuccin', 715 priority = 1000, 716 config = function() 717 vim.cmd 'colorscheme catppuccin' 718 require('catppuccin').setup { 719 flavor = 'mocha', 720 } 721 end, 722 }, 723 724 { --NERDCommenter 725 'preservim/nerdcommenter', 726 }, 727 728 { --Gemini file syntax highlighting 729 'https://tildegit.org/sloum/gemini-vim-syntax', 730 }, 731 732 { --nushell syntax highlighting 733 'elkasztano/nushell-syntax-vim', 734 }, 735 736 { -- Highlight todo, notes, etc in comments 737 'folke/todo-comments.nvim', 738 event = 'VimEnter', 739 dependencies = { 'nvim-lua/plenary.nvim' }, 740 opts = { signs = false }, 741 }, 742 743 { -- Collection of various small independent plugins/modules 744 'echasnovski/mini.nvim', 745 config = function() 746 -- Better Around/Inside textobjects 747 -- 748 -- Examples: 749 -- - va) - [V]isually select [A]round [)]paren 750 -- - yinq - [Y]ank [I]nside [N]ext [Q]uote 751 -- - ci' - [C]hange [I]nside [']quote 752 require('mini.ai').setup { n_lines = 500 } 753 754 -- Add/delete/replace surroundings (brackets, quotes, etc.) 755 -- 756 -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren 757 -- - sd' - [S]urround [D]elete [']quotes 758 -- - sr)' - [S]urround [R]eplace [)] ['] 759 require('mini.surround').setup() 760 761 -- Simple and easy statusline. 762 -- You could remove this setup call if you don't like it, 763 -- and try some other statusline plugin 764 local statusline = require 'mini.statusline' 765 -- set use_icons to true if you have a Nerd Font 766 statusline.setup { use_icons = vim.g.have_nerd_font } 767 768 -- You can configure sections in the statusline by overriding their 769 -- default behavior. For example, here we set the section for 770 -- cursor location to LINE:COLUMN 771 ---@diagnostic disable-next-line: duplicate-set-field 772 statusline.section_location = function() 773 return '%2l:%-2v' 774 end 775 776 -- ... and there is more! 777 -- Check out: https://github.com/echasnovski/mini.nvim 778 end, 779 }, 780 781 { -- Highlight, edit, and navigate code 782 'nvim-treesitter/nvim-treesitter', 783 build = ':TSUpdate', 784 main = 'nvim-treesitter.configs', -- Sets main module to use for opts 785 -- [[ Configure Treesitter ]] See `:help nvim-treesitter` 786 opts = { 787 ensure_installed = { 788 'bash', 789 'c', 790 'diff', 791 'html', 792 'json', 793 'lua', 794 'luadoc', 795 'markdown', 796 'markdown_inline', 797 'nu', 798 'python', 799 'regex', 800 'vim', 801 'vimdoc', 802 'yaml', 803 }, 804 -- Autoinstall languages that are not installed 805 auto_install = true, 806 highlight = { 807 enable = true, 808 -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. 809 -- If you are experiencing weird indenting issues, add the language to 810 -- the list of additional_vim_regex_highlighting and disabled languages for indent. 811 additional_vim_regex_highlighting = { 'ruby' }, 812 }, 813 indent = { enable = true, disable = { 'ruby' } }, 814 }, 815 816 { --telescope-media-files 817 'nvim-telescope/telescope-media-files.nvim', 818 }, 819 -- There are additional nvim-treesitter modules that you can use to interact 820 -- with nvim-treesitter. You should go explore a few and see what interests you: 821 -- 822 -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` 823 -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context 824 -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects 825 }, 826 827 -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the 828 -- init.lua. If you want these files, they are in the repository, so you can just download them and 829 -- place them in the correct locations. 830 831 -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart 832 -- 833 -- Here are some example plugins that I've included in the Kickstart repository. 834 -- Uncomment any of the lines below to enable them (you will need to restart nvim). 835 -- 836 -- require 'kickstart.plugins.debug', 837 -- require 'kickstart.plugins.indent_line', 838 -- require 'kickstart.plugins.lint', 839 -- require 'kickstart.plugins.autopairs', 840 -- require 'kickstart.plugins.neo-tree', 841 -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps 842 843 -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` 844 -- This is the easiest way to modularize your config. 845 -- 846 -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. 847 -- { import = 'custom.plugins' }, 848 -- 849 -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` 850 -- Or use telescope! 851 -- In normal mode type `<space>sh` then write `lazy.nvim-plugin` 852 -- you can continue same window with `<space>sr` which resumes last telescope search 853}, { 854 ui = { 855 -- If you are using a Nerd Font: set icons to an empty table which will use the 856 -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table 857 icons = vim.g.have_nerd_font and {} or { 858 cmd = '', 859 config = '🛠', 860 event = '📅', 861 ft = '📂', 862 init = '', 863 keys = '🗝', 864 plugin = '🔌', 865 runtime = '💻', 866 require = '🌙', 867 source = '📄', 868 start = '🚀', 869 task = '📌', 870 lazy = '💤 ', 871 }, 872 }, 873}) 874 875-- The line beneath this is called `modeline`. See `:help modeline` 876-- vim: ts=2 sts=2 sw=2 et