From 1d9be640f2bd9130d39422e04bd870219b34403a Mon Sep 17 00:00:00 2001 From: Elijah Manor Date: Mon, 21 Nov 2022 06:47:24 -0600 Subject: [PATCH 001/480] Add optional packer plugins hook (#20) * Add optional packer plugins hook * Provide help in README and simplify module * Fix spelling and tweak verbiage about after/plugin --- README.md | 31 +++++++++++++++++++++++++++++++ init.lua | 4 ++++ 2 files changed, 35 insertions(+) diff --git a/README.md b/README.md index 61b559a1ed1..e5f80752d2c 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,37 @@ This repo is meant to be used as a starting point for a user's own configuration * Start Neovim (`nvim`) and run `:PackerInstall` - ignore any error message about missing plugins, `:PackerInstall` will fix that shortly * Restart Neovim +### Configuration + +You could directly modify the `init.lua` file with your personal customizations. This option is the most straightforward, but if you update your config from this repo, you may need to reapply your changes. + +An alternative approach is to create a separate `custom.plugins` module to register your own plugins. In addition, you can handle further customizations in the `/after/plugin/` directory (see `:help load-plugins`). See the following examples for more information. Leveraging this technique should make upgrading to a newer version of this repo easier. + +#### Example `plugins.lua` + +The following is an example of a `plugins.lua` module (located at `$HOME/.config/nvim/lua/custom/plugins.lua`) where you can register your own plugins. + +```lua +return function(use) + use({ + "folke/which-key.nvim", + config = function() + require("which-key").setup({}) + end + }) +end +``` + +#### Example `defaults.lua` + +For further customizations, you can add a file in the `/after/plugin/` folder (see `:help load-plugins`) to include your own options, keymaps, autogroups, and more. The following is an example `defaults.lua` file (located at `$HOME/.config/nvim/after/plugin/defaults.lua`). + +```lua +vim.opt.relativenumber = true + +vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) +``` + ### Contribution Pull-requests are welcome. The goal of this repo is not to create a Neovim configuration framework, but to offer a starting template that shows, by example, available features in Neovim. Some things that will not be included: diff --git a/init.lua b/init.lua index 5ed766c4725..88c3857b669 100644 --- a/init.lua +++ b/init.lua @@ -57,6 +57,10 @@ require('packer').startup(function(use) -- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 } + -- Add custom plugins to packer from /nvim/lua/custom/plugins.lua + local has_plugins, plugins = pcall(require, "custom.plugins") + if has_plugins then plugins(use) end + if is_bootstrap then require('packer').sync() end From f190533484d3bd86ed8fc3047258dad45fc8acca Mon Sep 17 00:00:00 2001 From: Fabio <81859+fgrehm@users.noreply.github.com> Date: Fri, 25 Nov 2022 15:16:27 -0300 Subject: [PATCH 002/480] Update the amount of SLOC in README (#35) Looks like the project has grown a tad bit :sweat --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e5f80752d2c..e3a1b879de0 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A starting point for Neovim that is: -* Small (~325 lines) +* Small (~370 lines) * Single-file * Documented * Modular From 5b09b91360ef4d6fbfd6333075a2000a3127afef Mon Sep 17 00:00:00 2001 From: Carlo Teubner <435950+c4rlo@users.noreply.github.com> Date: Fri, 25 Nov 2022 18:18:01 +0000 Subject: [PATCH 003/480] Enable parameter text objects (#36) This seems like a natural addition. In classic Vim, I used to use https://github.com/b4winckler/vim-angry for this. --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 88c3857b669..6800ace3356 100644 --- a/init.lua +++ b/init.lua @@ -235,6 +235,8 @@ require('nvim-treesitter.configs').setup { lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim keymaps = { -- You can use the capture groups defined in textobjects.scm + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', ['af'] = '@function.outer', ['if'] = '@function.inner', ['ac'] = '@class.outer', From fd4c846259a3a017be20ddb36590b8b05aabcaa2 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Fri, 25 Nov 2022 13:23:30 -0500 Subject: [PATCH 004/480] add more explicit note about latest versions of nvim --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e3a1b879de0..931348dd362 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A starting point for Neovim that is: * Documented * Modular -Kickstart.nvim targets *only* the Neovim releases tagged ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly). +Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions. This repo is meant to be used as a starting point for a user's own configuration; remove the things you don't use and add what you miss. This configuration serves as the reference configuration for the [lspconfig wiki](https://github.com/neovim/nvim-lspconfig/wiki). From 66f7f68e7d72451cc669ff7a34e57433ab549969 Mon Sep 17 00:00:00 2001 From: Maximiliano Greco Date: Wed, 7 Dec 2022 03:11:15 +0100 Subject: [PATCH 005/480] enh(treesitter): add help into ensure_installed (#39) closes https://github.com/nvim-lua/kickstart.nvim/issues/38 --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 6800ace3356..651a2126087 100644 --- a/init.lua +++ b/init.lua @@ -216,7 +216,7 @@ vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { de -- See `:help nvim-treesitter` require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help' }, highlight = { enable = true }, indent = { enable = true }, From fefc270fd69b0a1b8e26ec0172edd802e8c99569 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Tue, 6 Dec 2022 21:18:43 -0500 Subject: [PATCH 006/480] fixup: add gitignore and style --- .gitignore | 2 ++ init.lua | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 712f217ff5b..d699e1d68cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ tags test.sh +.luarc.json +nvim diff --git a/init.lua b/init.lua index 651a2126087..b9c89ad3b63 100644 --- a/init.lua +++ b/init.lua @@ -58,8 +58,10 @@ require('packer').startup(function(use) use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 } -- Add custom plugins to packer from /nvim/lua/custom/plugins.lua - local has_plugins, plugins = pcall(require, "custom.plugins") - if has_plugins then plugins(use) end + local has_plugins, plugins = pcall(require, 'custom.plugins') + if has_plugins then + plugins(use) + end if is_bootstrap then require('packer').sync() From 1785f104fc7230e7f10e51301148c91cc7f94019 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Tue, 13 Dec 2022 11:21:34 -0500 Subject: [PATCH 007/480] small changes to default mappings (#41) --- init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index b9c89ad3b63..d35ebf7c20e 100644 --- a/init.lua +++ b/init.lua @@ -304,8 +304,9 @@ local on_attach = function(_, bufnr) nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') - nmap('gi', vim.lsp.buf.implementation, '[G]oto [I]mplementation') nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation') + nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') @@ -315,7 +316,6 @@ local on_attach = function(_, bufnr) -- Lesser used LSP functionality nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') nmap('wl', function() @@ -355,7 +355,7 @@ for _, lsp in ipairs(servers) do } end --- Turn on status information +-- Turn on lsp status information require('fidget').setup() -- Example custom configuration for lua From 7edb475a18b51a44b4541d41caf32298cb61a466 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Sat, 17 Dec 2022 21:40:20 -0500 Subject: [PATCH 008/480] Closes #46 --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index d35ebf7c20e..52a0b98c7cb 100644 --- a/init.lua +++ b/init.lua @@ -57,7 +57,7 @@ require('packer').startup(function(use) -- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 } - -- Add custom plugins to packer from /nvim/lua/custom/plugins.lua + -- Add custom plugins to packer from ~/.config/nvim/lua/custom/plugins.lua local has_plugins, plugins = pcall(require, 'custom.plugins') if has_plugins then plugins(use) From f77b8e95139e95e683701a134682ac561d0bfd34 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Mon, 19 Dec 2022 17:56:21 -0500 Subject: [PATCH 009/480] note: tell people to remove languages they arent going to use --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 931348dd362..c7e8b2cb6d2 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ This repo is meant to be used as a starting point for a user's own configuration * Start Neovim (`nvim`) and run `:PackerInstall` - ignore any error message about missing plugins, `:PackerInstall` will fix that shortly * Restart Neovim +If there are languages that you don't want to use, remove their configuration and notes from your `init.lua` after copy and pasting (for example, in the mason configuration). + ### Configuration You could directly modify the `init.lua` file with your personal customizations. This option is the most straightforward, but if you update your config from this repo, you may need to reapply your changes. From ad2dbe52d00364bf7ed73263ffcb953245f68e3b Mon Sep 17 00:00:00 2001 From: Debashis Biswas <37234687+debashisbiswas@users.noreply.github.com> Date: Mon, 19 Dec 2022 15:57:28 -0700 Subject: [PATCH 010/480] Fix error on Windows when space in install path (#64) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 52a0b98c7cb..961eb784311 100644 --- a/init.lua +++ b/init.lua @@ -3,7 +3,7 @@ local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nv local is_bootstrap = false if vim.fn.empty(vim.fn.glob(install_path)) > 0 then is_bootstrap = true - vim.fn.execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path) + vim.fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) vim.cmd [[packadd packer.nvim]] end From 17157fbaab6787bb4c83a004fb9ab63635095dc9 Mon Sep 17 00:00:00 2001 From: Nicolas Gryman Date: Tue, 20 Dec 2022 00:01:33 +0100 Subject: [PATCH 011/480] fix: don't check third party for Lua LSP (#57) * fix: don't check third party for Lua LSP Co-authored-by: Sean <44933921+seantwie03@users.noreply.github.com> Co-authored-by: TJ DeVries Co-authored-by: Sean <44933921+seantwie03@users.noreply.github.com> --- init.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 961eb784311..167114cabbe 100644 --- a/init.lua +++ b/init.lua @@ -379,7 +379,10 @@ require('lspconfig').sumneko_lua.setup { diagnostics = { globals = { 'vim' }, }, - workspace = { library = vim.api.nvim_get_runtime_file('', true) }, + workspace = { + library = vim.api.nvim_get_runtime_file('', true), + checkThirdParty = false, + }, -- Do not send telemetry data containing a randomized but unique identifier telemetry = { enable = false }, }, From c11dc53b8c49231b41834dec941f7f590ee65db7 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Mon, 19 Dec 2022 21:29:52 -0500 Subject: [PATCH 012/480] Update issue templates (#72) --- .github/ISSUE_TEMPLATE/bug_report.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000000..6999d51e856 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,26 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. ... + +**Desktop (please complete the following information):** +- OS: +- Terminal: + +** Neovim Version ** + - Output of running `:version` from inside of neovim: + +``` +``` From c990eca221bea99cb7025ea8846a0c52ca3b6829 Mon Sep 17 00:00:00 2001 From: Matthias Debernardini <32387851+matthiasdebernardini@users.noreply.github.com> Date: Tue, 20 Dec 2022 19:27:01 +0100 Subject: [PATCH 013/480] Update intstructions for existing nvim setups (#65) * Update intstructions for existing nvim setups If you already had a nvim setup, then this makes it so that the kickstarter can work without a problem. Having that file exist and loaded with plugins gives the script many issues. Also better to have it be a shell command rather than have the script delete a bunch of files on your computer. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index c7e8b2cb6d2..f7a6b764056 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ This repo is meant to be used as a starting point for a user's own configuration * Start Neovim (`nvim`) and run `:PackerInstall` - ignore any error message about missing plugins, `:PackerInstall` will fix that shortly * Restart Neovim + If there are languages that you don't want to use, remove their configuration and notes from your `init.lua` after copy and pasting (for example, in the mason configuration). ### Configuration @@ -60,3 +61,9 @@ Pull-requests are welcome. The goal of this repo is not to create a Neovim confi * Lazy-loading. Kickstart.nvim should start within 40 ms on modern hardware. Please profile and contribute to upstream plugins to optimize startup time instead. Each PR, especially those which increase the line count, should have a description as to why the PR is necessary. + +### FAQ + + * What should I do if I already have a pre-existing neovim configuration? + * You should back it up, then delete all files associated with it. This includes your existing init.lua and the neovim files in .local which can be deleted with `rm -rf ~/.local/share/nvim/` + From d44acfbc1f502b416ebabb51b1345ab0927e94ef Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Tue, 20 Dec 2022 16:03:05 -0500 Subject: [PATCH 014/480] remove python indent: closes #78 --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 167114cabbe..fb7c0972fc5 100644 --- a/init.lua +++ b/init.lua @@ -3,7 +3,7 @@ local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nv local is_bootstrap = false if vim.fn.empty(vim.fn.glob(install_path)) > 0 then is_bootstrap = true - vim.fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) + vim.fn.system { 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path } vim.cmd [[packadd packer.nvim]] end @@ -221,7 +221,7 @@ require('nvim-treesitter.configs').setup { ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help' }, highlight = { enable = true }, - indent = { enable = true }, + indent = { enable = true, disable = { 'python' } }, incremental_selection = { enable = true, keymaps = { From 515c2cb8eb99a8cd5c0cfdd90fb7510f6ea0d8e7 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Tue, 20 Dec 2022 22:12:39 -0500 Subject: [PATCH 015/480] move server config to easy to extend style (#71) Move servers to new configuration style. I will probably cover this in a new shorter video, or maybe in combination with something else. This should hopefully remove getting so many people making issues about LSPs that they don't want to. I can update documentation if what is happening is not clear. --- .gitignore | 1 + README.md | 5 +-- init.lua | 96 +++++++++++++++++++++++++----------------------------- 3 files changed, 48 insertions(+), 54 deletions(-) diff --git a/.gitignore b/.gitignore index d699e1d68cc..1b83131b514 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ tags test.sh .luarc.json nvim +plugin/packer_compiled.lua diff --git a/README.md b/README.md index f7a6b764056..b4240858ad1 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ A starting point for Neovim that is: Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions. -This repo is meant to be used as a starting point for a user's own configuration; remove the things you don't use and add what you miss. This configuration serves as the reference configuration for the [lspconfig wiki](https://github.com/neovim/nvim-lspconfig/wiki). +This repo is meant to be used as a starting point for a user's own configuration; remove the things you don't use and add what you miss. Please refrain from leaving comments about enabling / disabling particular languages out of the box. ### Installation @@ -65,5 +65,6 @@ Each PR, especially those which increase the line count, should have a descripti ### FAQ * What should I do if I already have a pre-existing neovim configuration? - * You should back it up, then delete all files associated with it. This includes your existing init.lua and the neovim files in .local which can be deleted with `rm -rf ~/.local/share/nvim/` + * You should back it up, then delete all files associated with it. + * This includes your existing init.lua and the neovim files in `.local` which can be deleted with `rm -rf ~/.local/share/nvim/` diff --git a/init.lua b/init.lua index fb7c0972fc5..636d86afb06 100644 --- a/init.lua +++ b/init.lua @@ -20,6 +20,9 @@ require('packer').startup(function(use) -- Useful status updates for LSP 'j-hui/fidget.nvim', + + -- Additional lua configuration, makes nvim stuff amazing + 'folke/neodev.nvim', }, } @@ -324,71 +327,60 @@ local on_attach = function(_, bufnr) -- Create a command `:Format` local to the LSP buffer vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) - if vim.lsp.buf.format then - vim.lsp.buf.format() - elseif vim.lsp.buf.formatting then - vim.lsp.buf.formatting() - end + vim.lsp.buf.format() end, { desc = 'Format current buffer with LSP' }) end --- Setup mason so it can manage external tooling -require('mason').setup() - -- Enable the following language servers --- Feel free to add/remove any LSPs that you want here. They will automatically be installed -local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'gopls' } - --- Ensure the servers above are installed -require('mason-lspconfig').setup { - ensure_installed = servers, +-- Feel free to add/remove any LSPs that you want here. They will automatically be installed. +-- +-- Add any additional override configuration in the following tables. They will be passed to +-- the `settings` field of the server config. You must look up that documentation yourself. +local servers = { + -- clangd = {}, + -- gopls = {}, + -- pyright = {}, + -- rust_analyzer = {}, + -- tsserver = {}, + + sumneko_lua = { + Lua = { + workspace = { checkThirdParty = false }, + telemetry = { enable = false }, + }, + }, } --- nvim-cmp supports additional completion capabilities +-- Setup neovim lua configuration +require('neodev').setup() +-- +-- nvim-cmp supports additional completion capabilities, so broadcast that to servers local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) -for _, lsp in ipairs(servers) do - require('lspconfig')[lsp].setup { - on_attach = on_attach, - capabilities = capabilities, - } -end +-- Setup mason so it can manage external tooling +require('mason').setup() --- Turn on lsp status information -require('fidget').setup() +-- Ensure the servers above are installed +local mason_lspconfig = require 'mason-lspconfig' --- Example custom configuration for lua --- --- Make runtime files discoverable to the server -local runtime_path = vim.split(package.path, ';') -table.insert(runtime_path, 'lua/?.lua') -table.insert(runtime_path, 'lua/?/init.lua') - -require('lspconfig').sumneko_lua.setup { - on_attach = on_attach, - capabilities = capabilities, - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT) - version = 'LuaJIT', - -- Setup your lua path - path = runtime_path, - }, - diagnostics = { - globals = { 'vim' }, - }, - workspace = { - library = vim.api.nvim_get_runtime_file('', true), - checkThirdParty = false, - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { enable = false }, - }, - }, +mason_lspconfig.setup { + ensure_installed = vim.tbl_keys(servers), +} + +mason_lspconfig.setup_handlers { + function(server_name) + require('lspconfig')[server_name].setup { + capabilities = capabilities, + on_attach = on_attach, + settings = servers[server_name], + } + end, } +-- Turn on lsp status information +require('fidget').setup() + -- nvim-cmp setup local cmp = require 'cmp' local luasnip = require 'luasnip' From 1d9a1d5f242e9bdc6091243b238182c1e367855f Mon Sep 17 00:00:00 2001 From: kazenix Date: Thu, 22 Dec 2022 04:45:20 -0800 Subject: [PATCH 016/480] Adding cmake documentation to README.md (#85) --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index b4240858ad1..e29f426a0bb 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,20 @@ This repo is meant to be used as a starting point for a user's own configuration If there are languages that you don't want to use, remove their configuration and notes from your `init.lua` after copy and pasting (for example, in the mason configuration). +### Windows Installation + +Installation may require installing build tools, and updating the run command for `telescope-fzf-native` + +See `telescope-fzf-native` documention for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) + +This requires: + +- Install CMake, and the Microsoft C++ Build Tools on Windows + +```lua +use {'nvim-telescope/telescope-fzf-native.nvim', run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } +``` + ### Configuration You could directly modify the `init.lua` file with your personal customizations. This option is the most straightforward, but if you update your config from this repo, you may need to reapply your changes. From 34bed0190e55bb73100c736b5d480caa0cacc0d5 Mon Sep 17 00:00:00 2001 From: amalgame21 <93383215+amalgame21@users.noreply.github.com> Date: Wed, 28 Dec 2022 06:33:44 +0000 Subject: [PATCH 017/480] Prevent multiple language servers from being spawned after every file save of init.lua (#96) * Prevent multiple language servers from being spawned Prevent multiple language servers from being spawned after every save of init.lua, which eventually leads to high RAM usage and system freeze. * Supress error messages add `silent!` in case of error message when nvim-lspconfig is not installed --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 636d86afb06..c8f18d59792 100644 --- a/init.lua +++ b/init.lua @@ -87,7 +87,7 @@ end -- Automatically source and re-compile packer whenever you save this init.lua local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true }) vim.api.nvim_create_autocmd('BufWritePost', { - command = 'source | PackerCompile', + command = 'source | silent! LspStop | silent! LspStart | PackerCompile', group = packer_group, pattern = vim.fn.expand '$MYVIMRC', }) From bd0f940d24c8296f0342bd9ae841546d29afa35b Mon Sep 17 00:00:00 2001 From: willsmanic <57890520+nesper8@users.noreply.github.com> Date: Mon, 2 Jan 2023 07:48:13 +0530 Subject: [PATCH 018/480] added vim to tree-sitter's ensured installed list (#110) please refer to https://github.com/nvim-treesitter/nvim-treesitter/issues/3092 --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index c8f18d59792..ac291dad17a 100644 --- a/init.lua +++ b/init.lua @@ -221,7 +221,7 @@ vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { de -- See `:help nvim-treesitter` require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help', 'vim' }, highlight = { enable = true }, indent = { enable = true, disable = { 'python' } }, From 605c5a05ea7c2501aced960d4d99d164a9fc2cda Mon Sep 17 00:00:00 2001 From: Sean <44933921+seantwie03@users.noreply.github.com> Date: Wed, 11 Jan 2023 15:49:00 -0600 Subject: [PATCH 019/480] Add windows init lua location (#121) * feat: add init.lua location fir Windows * feat: more specific number of lines --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e29f426a0bb..4cc00b1b817 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A starting point for Neovim that is: -* Small (~370 lines) +* Small (<500 lines) * Single-file * Documented * Modular @@ -14,7 +14,7 @@ This repo is meant to be used as a starting point for a user's own configuration ### Installation * Backup your previous configuration -* Copy and paste the kickstart.nvim `init.lua` into `$HOME/.config/nvim/init.lua` +* Copy and paste the kickstart.nvim `init.lua` into `$HOME/.config/nvim/init.lua` (Linux) or `~/AppData/Local/nvim/init.lua` (Windows) * Start Neovim (`nvim`) and run `:PackerInstall` - ignore any error message about missing plugins, `:PackerInstall` will fix that shortly * Restart Neovim From 27a6fc5caaf7c6e1dfcfa80d734847a1ed705cf8 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Fri, 17 Feb 2023 16:31:57 -0500 Subject: [PATCH 020/480] feat: move to lazy.nvim package manager and add first plugins (#178) Closes #175 Closes #177 Closes #173 Closes #169 Closes #161 Closes #144 Closes #138 Fixes #136 Closes #137 Closes #131 Closes #117 Closes #130 Closes #115 Closes #86 Closes #105 Closes #70 Fixes #176 Fixes #174 Fixes #160 Fixes #158 --- .gitignore | 2 +- Dockerfile | 34 --- README.md | 114 +++++++--- doc/kickstart.txt | 24 +++ doc/tags | 3 + init.lua | 306 ++++++++++++++++----------- lua/custom/plugins/init.lua | 5 + lua/kickstart/plugins/autoformat.lua | 74 +++++++ lua/kickstart/plugins/debug.lua | 85 ++++++++ 9 files changed, 457 insertions(+), 190 deletions(-) delete mode 100644 Dockerfile create mode 100644 doc/kickstart.txt create mode 100644 doc/tags create mode 100644 lua/custom/plugins/init.lua create mode 100644 lua/kickstart/plugins/autoformat.lua create mode 100644 lua/kickstart/plugins/debug.lua diff --git a/.gitignore b/.gitignore index 1b83131b514..ea93edad490 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ tags test.sh .luarc.json nvim -plugin/packer_compiled.lua +lazy-lock.json diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 5c303b48bfe..00000000000 --- a/Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -# Build neovim separately in the first stage -FROM alpine:latest AS base - -RUN apk --no-cache add \ - autoconf \ - automake \ - build-base \ - cmake \ - ninja \ - coreutils \ - curl \ - gettext-tiny-dev \ - git \ - libtool \ - pkgconf \ - unzip - -# Build neovim (and use it as an example codebase -RUN git clone https://github.com/neovim/neovim.git - -ARG VERSION=master -RUN cd neovim && git checkout ${VERSION} && make CMAKE_BUILD_TYPE=RelWithDebInfo install - -# To support kickstart.nvim -RUN apk --no-cache add \ - fd \ - ctags \ - ripgrep \ - git - -# Copy the kickstart.nvim init.lua -COPY ./init.lua /root/.config/nvim/init.lua - -WORKDIR /neovim diff --git a/README.md b/README.md index 4cc00b1b817..32f58dfb6b7 100644 --- a/README.md +++ b/README.md @@ -1,64 +1,91 @@ +# kickstart.nvim + ### Introduction A starting point for Neovim that is: -* Small (<500 lines) -* Single-file +* Small +* Single-file (with examples of moving to multi-file) * Documented * Modular -Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions. +This repo is meant to be used as by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss. -This repo is meant to be used as a starting point for a user's own configuration; remove the things you don't use and add what you miss. Please refrain from leaving comments about enabling / disabling particular languages out of the box. +Distribution Alternatives: +- [LazyVim](https://www.lazyvim.org/): A delightful distribution maintained by @folke (the author of lazy.nvim, the package manager used here) ### Installation +Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions. + * Backup your previous configuration -* Copy and paste the kickstart.nvim `init.lua` into `$HOME/.config/nvim/init.lua` (Linux) or `~/AppData/Local/nvim/init.lua` (Windows) -* Start Neovim (`nvim`) and run `:PackerInstall` - ignore any error message about missing plugins, `:PackerInstall` will fix that shortly +* (Recommended) Fork this repo (so that you have your own copy that you can modify). +* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `~/AppData/Local/nvim/` (Windows) + * If you don't want to include it as a git repo, you can just clone it and then move the files to this location +* Start Neovim (`nvim`) and allow `lazy.nvim` to complete installation. * Restart Neovim +* **You're ready to go!** +Additional system requirements: +- Make sure to review the readmes of the plugins if you are experiencing errors. In particular: + - [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. +- See as well [Windows Installation](#Windows-Installation) -If there are languages that you don't want to use, remove their configuration and notes from your `init.lua` after copy and pasting (for example, in the mason configuration). +### Configuration And Extension -### Windows Installation - -Installation may require installing build tools, and updating the run command for `telescope-fzf-native` +* Inside of your fork, feel free to modify any file you like! It's your fork! +* Then there are two primary configuration options available: + * Include the `lua/kickstart/plugins/*` files in your configuration. + * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` + * NOTE: To enable this, you need to uncomment `{ import = 'custom.plugins' }` in your `init.lua` -See `telescope-fzf-native` documention for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) +You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration -This requires: +#### Example: Adding an autopairs plugin -- Install CMake, and the Microsoft C++ Build Tools on Windows +In the file: `lua/custom/plugins/autopairs.lua`, add: ```lua -use {'nvim-telescope/telescope-fzf-native.nvim', run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } +-- File: lua/custom/plugins/autopairs.lua + +return { + "windwp/nvim-autopairs", + config = function() + require("nvim-autopairs").setup {} + end, +} ``` -### Configuration -You could directly modify the `init.lua` file with your personal customizations. This option is the most straightforward, but if you update your config from this repo, you may need to reapply your changes. +This will automatically install `nvim-autopairs` and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim). -An alternative approach is to create a separate `custom.plugins` module to register your own plugins. In addition, you can handle further customizations in the `/after/plugin/` directory (see `:help load-plugins`). See the following examples for more information. Leveraging this technique should make upgrading to a newer version of this repo easier. +#### Example: Adding a file tree plugin -#### Example `plugins.lua` - -The following is an example of a `plugins.lua` module (located at `$HOME/.config/nvim/lua/custom/plugins.lua`) where you can register your own plugins. +In the file: `lua/custom/plugins/filetree.lua`, add: ```lua -return function(use) - use({ - "folke/which-key.nvim", - config = function() - require("which-key").setup({}) - end - }) -end +return { + "nvim-neo-tree/neo-tree.nvim", + version = "*", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + }, + config = function () + -- Unless you are still migrating, remove the deprecated commands from v1.x + vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) + + require('neo-tree').setup {} + end, +} ``` -#### Example `defaults.lua` +This will install the tree plugin and add the command `:NeoTree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information. + +#### Example: Adding a file to change default options -For further customizations, you can add a file in the `/after/plugin/` folder (see `:help load-plugins`) to include your own options, keymaps, autogroups, and more. The following is an example `defaults.lua` file (located at `$HOME/.config/nvim/after/plugin/defaults.lua`). +To change default options, you can add a file in the `/after/plugin/` folder (see `:help load-plugins`) to include your own options, keymaps, autogroups, and more. The following is an example `defaults.lua` file (located at `$HOME/.config/nvim/after/plugin/defaults.lua`). ```lua vim.opt.relativenumber = true @@ -72,13 +99,32 @@ Pull-requests are welcome. The goal of this repo is not to create a Neovim confi * Custom language server configuration (null-ls templates) * Theming beyond a default colorscheme necessary for LSP highlight groups -* Lazy-loading. Kickstart.nvim should start within 40 ms on modern hardware. Please profile and contribute to upstream plugins to optimize startup time instead. Each PR, especially those which increase the line count, should have a description as to why the PR is necessary. ### FAQ - * What should I do if I already have a pre-existing neovim configuration? - * You should back it up, then delete all files associated with it. - * This includes your existing init.lua and the neovim files in `.local` which can be deleted with `rm -rf ~/.local/share/nvim/` +* What should I do if I already have a pre-existing neovim configuration? + * You should back it up, then delete all files associated with it. + * This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` + * You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide) +* What if I want to "uninstall" this configuration: + * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information +* Are there any cool videos about this plugin? + * Current iteration of kickstart (coming soon) + * Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). + +### Windows Installation + +Installation may require installing build tools, and updating the run command for `telescope-fzf-native` + +See `telescope-fzf-native` documention for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) + +This requires: + +- Install CMake, and the Microsoft C++ Build Tools on Windows + +```lua +use {'nvim-telescope/telescope-fzf-native.nvim', run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } +``` diff --git a/doc/kickstart.txt b/doc/kickstart.txt new file mode 100644 index 00000000000..cb87ac3f1de --- /dev/null +++ b/doc/kickstart.txt @@ -0,0 +1,24 @@ +================================================================================ +INTRODUCTION *kickstart.nvim* + +Kickstart.nvim is a project to help you get started on your neovim journey. + + *kickstart-is-not* +It is not: +- Complete framework for every plugin under the sun +- Place to add every plugin that could ever be useful + + *kickstart-is* +It is: +- Somewhere that has a good start for the most common "IDE" type features: + - autocompletion + - goto-definition + - find references + - fuzzy finding + - and hinting at what more can be done :) +- A place to _kickstart_ your journey. + - You should fork this project and use/modify it so that it matches your + style and preferences. If you don't want to do that, there are probably + other projects that would fit much better for you (and that's great!)! + + vim:tw=78:ts=8:ft=help:norl: diff --git a/doc/tags b/doc/tags new file mode 100644 index 00000000000..687ae7721d9 --- /dev/null +++ b/doc/tags @@ -0,0 +1,3 @@ +kickstart-is kickstart.txt /*kickstart-is* +kickstart-is-not kickstart.txt /*kickstart-is-not* +kickstart.nvim kickstart.txt /*kickstart.nvim* diff --git a/init.lua b/init.lua index ac291dad17a..13db1393a0a 100644 --- a/init.lua +++ b/init.lua @@ -1,96 +1,193 @@ --- Install packer -local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim' -local is_bootstrap = false -if vim.fn.empty(vim.fn.glob(install_path)) > 0 then - is_bootstrap = true - vim.fn.system { 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path } - vim.cmd [[packadd packer.nvim]] +--[[ + +===================================================================== +==================== READ THIS BEFORE CONTINUING ==================== +===================================================================== + +Kickstart.nvim is *not* a distribution. + +Kickstart.nvim is a template for your own configuration. + The goal is that you can read every line of code, top-to-bottom, and understand + what your configuration is doing. + + Once you've done that, you should start exploring, configuring and tinkering to + explore Neovim! + + If you don't know anything about Lua, I recommend taking some time to read through + a guide. One possible example: + - https://learnxinyminutes.com/docs/lua/ + + And then you can explore or search through `:help lua-guide` + + +Kickstart Guide: + +I have left several `:help X` comments throughout the init.lua +You should run that command and read that help section for more information. + +In addition, I have some `NOTE:` items throughout the file. +These are for you, the reader to help understand what is happening. Feel free to delete +them once you know what you're doing, but they should serve as a guide for when you +are first encountering a few different constructs in your nvim config. + +I hope you enjoy your Neovim journey, +- TJ + +P.S. You can delete this when you're done too. It's your config now :) +--]] + +-- Set as the leader key +-- See `:help mapleader` +-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +-- Install package manager +-- https://github.com/folke/lazy.nvim +-- `:help lazy.nvim.txt` for more info +local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' +if not vim.loop.fs_stat(lazypath) then + vim.fn.system { + 'git', + 'clone', + '--filter=blob:none', + 'https://github.com/folke/lazy.nvim.git', + '--branch=stable', -- latest stable release + lazypath, + } end +vim.opt.rtp:prepend(lazypath) -require('packer').startup(function(use) - -- Package manager - use 'wbthomason/packer.nvim' +-- NOTE: Here is where you install your plugins. +-- You can configure plugins using the `config` key. +-- +-- You can also configure plugins after the setup call, +-- as they will be available in your neovim runtime. +require('lazy').setup({ + -- NOTE: First, some plugins that don't require any configuration - use { -- LSP Configuration & Plugins + -- Git related plugins + 'tpope/vim-fugitive', + 'tpope/vim-rhubarb', + + -- Detect tabstop and shiftwidth automatically + 'tpope/vim-sleuth', + + -- NOTE: This is where your plugins related to LSP can be installed. + -- The configuration is done below. Search for lspconfig to find it below. + { -- LSP Configuration & Plugins 'neovim/nvim-lspconfig', - requires = { + dependencies = { -- Automatically install LSPs to stdpath for neovim 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim', -- Useful status updates for LSP - 'j-hui/fidget.nvim', + -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` + { 'j-hui/fidget.nvim', opts = {} }, - -- Additional lua configuration, makes nvim stuff amazing + -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', }, - } + }, - use { -- Autocompletion + { -- Autocompletion 'hrsh7th/nvim-cmp', - requires = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, - } + dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, + }, - use { -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - run = function() - pcall(require('nvim-treesitter.install').update { with_sync = true }) + -- Useful plugin to show you pending keybinds. + { 'folke/which-key.nvim', opts = {} }, + { -- Adds git releated signs to the gutter, as well as utilities for managing changes + 'lewis6991/gitsigns.nvim', + opts = { + -- See `:help gitsigns.txt` + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + }, + }, + + { -- Theme inspired by Atom + 'navarasu/onedark.nvim', + priority = 1000, + config = function() + vim.cmd.colorscheme 'onedark' end, - } + }, - use { -- Additional text objects via treesitter - 'nvim-treesitter/nvim-treesitter-textobjects', - after = 'nvim-treesitter', - } + { -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = false, + theme = 'onedark', + component_separators = '|', + section_separators = '', + }, + }, + }, - -- Git related plugins - use 'tpope/vim-fugitive' - use 'tpope/vim-rhubarb' - use 'lewis6991/gitsigns.nvim' + { -- Add indentation guides even on blank lines + 'lukas-reineke/indent-blankline.nvim', + -- Enable `lukas-reineke/indent-blankline.nvim` + -- See `:help indent_blankline.txt` + opts = { + char = '┊', + show_trailing_blankline_indent = false, + }, + }, - use 'navarasu/onedark.nvim' -- Theme inspired by Atom - use 'nvim-lualine/lualine.nvim' -- Fancier statusline - use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines - use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines - use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically + -- "gc" to comment visual regions/lines + { 'numToStr/Comment.nvim', opts = {} }, -- Fuzzy Finder (files, lsp, etc) - use { 'nvim-telescope/telescope.nvim', branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } } - - -- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available - use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 } + { 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } }, + + -- Fuzzy Finder Algorithm which requires local dependencies to be built. + -- Only load if `make` is available. Make sure you have the system + -- requirements installed. + { + 'nvim-telescope/telescope-fzf-native.nvim', + -- NOTE: If you are having trouble with this installation, + -- refer to the README for telescope-fzf-native for more instructions. + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, - -- Add custom plugins to packer from ~/.config/nvim/lua/custom/plugins.lua - local has_plugins, plugins = pcall(require, 'custom.plugins') - if has_plugins then - plugins(use) - end + { -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + }, + config = function() + pcall(require('nvim-treesitter.install').update { with_sync = true }) + end, + }, - if is_bootstrap then - require('packer').sync() - end -end) + -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart + -- These are some example plugins that I've included in the kickstart repository. + -- Uncomment any of the lines below to enable them. + -- require 'kickstart.plugins.autoformat', + -- require 'kickstart.plugins.debug', --- When we are bootstrapping a configuration, it doesn't --- make sense to execute the rest of the init.lua. --- --- You'll need to restart nvim, and then it will work. -if is_bootstrap then - print '==================================' - print ' Plugins are being installed' - print ' Wait until Packer completes,' - print ' then restart nvim' - print '==================================' - return -end - --- Automatically source and re-compile packer whenever you save this init.lua -local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true }) -vim.api.nvim_create_autocmd('BufWritePost', { - command = 'source | silent! LspStop | silent! LspStart | PackerCompile', - group = packer_group, - pattern = vim.fn.expand '$MYVIMRC', -}) + -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua` + -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping + -- up-to-date with whatever is in the kickstart repo. + -- + -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins + -- + -- An additional note is that if you only copied in the `init.lua`, you can just comment this line + -- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`. + { import = 'custom.plugins' }, +}, {}) -- [[ Setting options ]] -- See `:help vim.o` @@ -114,23 +211,21 @@ vim.o.undofile = true vim.o.ignorecase = true vim.o.smartcase = true --- Decrease update time -vim.o.updatetime = 250 +-- Keep signcolumn on by default vim.wo.signcolumn = 'yes' --- Set colorscheme -vim.o.termguicolors = true -vim.cmd [[colorscheme onedark]] +-- Decrease update time +vim.o.updatetime = 250 +vim.o.timeout = true +vim.o.timeoutlen = 300 -- Set completeopt to have a better completion experience vim.o.completeopt = 'menuone,noselect' +-- NOTE: You should make sure your terminal supports this +vim.o.termguicolors = true + -- [[ Basic Keymaps ]] --- Set as the leader key --- See `:help mapleader` --- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' -- Keymaps for better default experience -- See `:help vim.keymap.set()` @@ -151,39 +246,6 @@ vim.api.nvim_create_autocmd('TextYankPost', { pattern = '*', }) --- Set lualine as statusline --- See `:help lualine.txt` -require('lualine').setup { - options = { - icons_enabled = false, - theme = 'onedark', - component_separators = '|', - section_separators = '', - }, -} - --- Enable Comment.nvim -require('Comment').setup() - --- Enable `lukas-reineke/indent-blankline.nvim` --- See `:help indent_blankline.txt` -require('indent_blankline').setup { - char = '┊', - show_trailing_blankline_indent = false, -} - --- Gitsigns --- See `:help gitsigns.txt` -require('gitsigns').setup { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, -} - -- [[ Configure Telescope ]] -- See `:help telescope` and `:help telescope.setup()` require('telescope').setup { @@ -209,7 +271,7 @@ vim.keymap.set('n', '/', function() winblend = 10, previewer = false, }) -end, { desc = '[/] Fuzzily search in current buffer]' }) +end, { desc = '[/] Fuzzily search in current buffer' }) vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) @@ -221,7 +283,10 @@ vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { de -- See `:help nvim-treesitter` require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help', 'vim' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'help', 'vim' }, + + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) + auto_install = false, highlight = { enable = true }, indent = { enable = true, disable = { 'python' } }, @@ -231,7 +296,7 @@ require('nvim-treesitter.configs').setup { init_selection = '', node_incremental = '', scope_incremental = '', - node_decremental = '', + node_decremental = '', }, }, textobjects = { @@ -343,7 +408,7 @@ local servers = { -- rust_analyzer = {}, -- tsserver = {}, - sumneko_lua = { + lua_ls = { Lua = { workspace = { checkThirdParty = false }, telemetry = { enable = false }, @@ -353,7 +418,7 @@ local servers = { -- Setup neovim lua configuration require('neodev').setup() --- + -- nvim-cmp supports additional completion capabilities, so broadcast that to servers local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) @@ -378,13 +443,12 @@ mason_lspconfig.setup_handlers { end, } --- Turn on lsp status information -require('fidget').setup() - -- nvim-cmp setup local cmp = require 'cmp' local luasnip = require 'luasnip' +luasnip.config.setup {} + cmp.setup { snippet = { expand = function(args) @@ -394,7 +458,7 @@ cmp.setup { mapping = cmp.mapping.preset.insert { [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), + [''] = cmp.mapping.complete {}, [''] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true, diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua new file mode 100644 index 00000000000..be0eb9d8d7a --- /dev/null +++ b/lua/custom/plugins/init.lua @@ -0,0 +1,5 @@ +-- You can add your own plugins here or in other files in this directory! +-- I promise not to create any merge conflicts in this directory :) +-- +-- See the kickstart.nvim README for more information +return {} diff --git a/lua/kickstart/plugins/autoformat.lua b/lua/kickstart/plugins/autoformat.lua new file mode 100644 index 00000000000..bc56b15b027 --- /dev/null +++ b/lua/kickstart/plugins/autoformat.lua @@ -0,0 +1,74 @@ +-- autoformat.lua +-- +-- Use your language server to automatically format your code on save. +-- Adds additional commands as well to manage the behavior + +return { + 'neovim/nvim-lspconfig', + config = function() + -- Switch for controlling whether you want autoformatting. + -- Use :KickstartFormatToggle to toggle autoformatting on or off + local format_is_enabled = true + vim.api.nvim_create_user_command('KickstartFormatToggle', function() + format_is_enabled = not format_is_enabled + print('Setting autoformatting to: ' .. tostring(format_is_enabled)) + end, {}) + + -- Create an augroup that is used for managing our formatting autocmds. + -- We need one augroup per client to make sure that multiple clients + -- can attach to the same buffer without interfering with each other. + local _augroups = {} + local get_augroup = function(client) + if not _augroups[client.id] then + local group_name = 'kickstart-lsp-format-' .. client.name + local id = vim.api.nvim_create_augroup(group_name, { clear = true }) + _augroups[client.id] = id + end + + return _augroups[client.id] + end + + -- Whenever an LSP attaches to a buffer, we will run this function. + -- + -- See `:help LspAttach` for more information about this autocmd event. + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }), + -- This is where we attach the autoformatting for reasonable clients + callback = function(args) + local client_id = args.data.client_id + local client = vim.lsp.get_client_by_id(client_id) + local bufnr = args.buf + + -- Only attach to clients that support document formatting + if not client.server_capabilities.documentFormattingProvider then + return + end + + -- Tsserver usually works poorly. Sorry you work with bad languages + -- You can remove this line if you know what you're doing :) + if client.name == 'tsserver' then + return + end + + -- Create an autocmd that will run *before* we save the buffer. + -- Run the formatting command for the LSP that has just attached. + vim.api.nvim_create_autocmd('BufWritePre', { + group = get_augroup(client), + buffer = bufnr, + callback = function() + if not format_is_enabled then + return + end + + vim.lsp.buf.format { + async = false, + filter = function(c) + return c.id == client.id + end, + } + end, + }) + end, + }) + end, +} diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua new file mode 100644 index 00000000000..0b68c43b94b --- /dev/null +++ b/lua/kickstart/plugins/debug.lua @@ -0,0 +1,85 @@ +-- debug.lua +-- +-- Shows how to use the DAP plugin to debug your code. +-- +-- Primarily focused on configuring the debugger for Go, but can +-- be extended to other languages as well. That's why it's called +-- kickstart.nvim and not kitchen-sink.nvim ;) + +return { + -- NOTE: Yes, you can install new plugins here! + 'mfussenegger/nvim-dap', + + -- NOTE: And you can specify dependencies as well + dependencies = { + -- Creates a beautiful debugger UI + 'rcarriga/nvim-dap-ui', + + -- Installs the debug adapters for you + 'williamboman/mason.nvim', + 'jay-babu/mason-nvim-dap.nvim', + + -- Add your own debuggers here + 'leoluz/nvim-dap-go', + }, + + config = function() + local dap = require 'dap' + local dapui = require 'dapui' + + require('mason-nvim-dap').setup { + -- Makes a best effort to setup the various debuggers with + -- reasonable debug configurations + automatic_setup = true, + + -- You'll need to check that you have the required things installed + -- online, please don't ask me how to install them :) + ensure_installed = { + -- Update this to ensure that you have the debuggers for the langs you want + 'delve', + }, + } + + -- You can provide additional configuration to the handlers, + -- see mason-nvim-dap README for more information + require('mason-nvim-dap').setup_handlers() + + -- Basic debugging keymaps, feel free to change to your liking! + vim.keymap.set('n', '', dap.continue) + vim.keymap.set('n', '', dap.step_into) + vim.keymap.set('n', '', dap.step_over) + vim.keymap.set('n', '', dap.step_out) + vim.keymap.set('n', 'b', dap.toggle_breakpoint) + vim.keymap.set('n', 'B', function() + dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') + end) + + -- Dap UI setup + -- For more information, see |:help nvim-dap-ui| + dapui.setup { + -- Set icons to characters that are more likely to work in every terminal. + -- Feel free to remove or use ones that you like more! :) + -- Don't feel like these are good choices. + icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, + controls = { + icons = { + pause = '⏸', + play = '▶', + step_into = '⏎', + step_over = '⏭', + step_out = '⏮', + step_back = 'b', + run_last = '▶▶', + terminate = '⏹', + }, + }, + } + + dap.listeners.after.event_initialized['dapui_config'] = dapui.open + dap.listeners.before.event_terminated['dapui_config'] = dapui.close + dap.listeners.before.event_exited['dapui_config'] = dapui.close + + -- Install golang specific config + require('dap-go').setup() + end, +} From 4b92837a7dfdc461d89a7b0c29f6f4d4179c0ea6 Mon Sep 17 00:00:00 2001 From: Tudor <59114560+tudorjnu@users.noreply.github.com> Date: Fri, 17 Feb 2023 21:37:36 +0000 Subject: [PATCH 021/480] feat: Add clipboard sync by default (#166) --- init.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/init.lua b/init.lua index 13db1393a0a..aeca6d28a4d 100644 --- a/init.lua +++ b/init.lua @@ -201,6 +201,11 @@ vim.wo.number = true -- Enable mouse mode vim.o.mouse = 'a' +-- Sync clipboard between OS and Neovim. +-- Remove this option if you want your OS clipboard to remain independent. +-- See `:help 'clipboard'` +vim.o.clipboard = 'unnamedplus' + -- Enable break indent vim.o.breakindent = true From d088cacfd71ce3c84878cc0891d9e52b4693b702 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 19 Feb 2023 21:32:15 +0100 Subject: [PATCH 022/480] docs: change telescope fzf native to lazy syntax (#185) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 32f58dfb6b7..75c24d84225 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,6 @@ This requires: - Install CMake, and the Microsoft C++ Build Tools on Windows ```lua -use {'nvim-telescope/telescope-fzf-native.nvim', run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } +{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } ``` From 5bf5972244333ae97599ea7d927a2987cffc5018 Mon Sep 17 00:00:00 2001 From: Luiz Antonio Calliari Filho Date: Sun, 26 Feb 2023 23:03:34 -0300 Subject: [PATCH 023/480] Adding [+c and ]+c to move to diffs and leader+ph to show a pop up with the preview diff value. --- init.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/init.lua b/init.lua index aeca6d28a4d..427af75e002 100644 --- a/init.lua +++ b/init.lua @@ -109,6 +109,19 @@ require('lazy').setup({ topdelete = { text = '‾' }, changedelete = { text = '~' }, }, + on_attach = function(bufnr) + local function map(mode, lhs, rhs, opts) + opts = vim.tbl_extend('force', {noremap = true, silent = true}, opts or {}) + vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts) + end + + -- Navigation + map('n', ']c', "&diff ? ']c' : 'Gitsigns next_hunk'", {expr=true}) + map('n', '[c', "&diff ? '[c' : 'Gitsigns prev_hunk'", {expr=true}) + + -- Actions + map('n', 'ph', 'Gitsigns preview_hunk') + end }, }, From 152167d85314d671515b6979e1cea573eb1f04af Mon Sep 17 00:00:00 2001 From: Lucian Boaca Date: Mon, 27 Feb 2023 21:36:59 +0000 Subject: [PATCH 024/480] Update instructions for neo-tree set up (#200) For me, setting this variable in the config function didn't work. Putting it outside the return block did the trick. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 75c24d84225..ce72ebbfe64 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,9 @@ This will automatically install `nvim-autopairs` and enable it on startup. For m In the file: `lua/custom/plugins/filetree.lua`, add: ```lua +-- Unless you are still migrating, remove the deprecated commands from v1.x +vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) + return { "nvim-neo-tree/neo-tree.nvim", version = "*", @@ -73,9 +76,6 @@ return { "MunifTanjim/nui.nvim", }, config = function () - -- Unless you are still migrating, remove the deprecated commands from v1.x - vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) - require('neo-tree').setup {} end, } From 281043387ff6f81543a1e7036cc19f18dbdb16df Mon Sep 17 00:00:00 2001 From: Philipp Szechenyi <45265588+szechp@users.noreply.github.com> Date: Mon, 27 Feb 2023 22:37:28 +0100 Subject: [PATCH 025/480] added descriptions to Diagnostic keymaps (#191) * Update init.lua * Update init.lua --- init.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index aeca6d28a4d..72890326d47 100644 --- a/init.lua +++ b/init.lua @@ -351,10 +351,10 @@ require('nvim-treesitter.configs').setup { } -- Diagnostic keymaps -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next) -vim.keymap.set('n', 'e', vim.diagnostic.open_float) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist) +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" }) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" }) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) -- LSP settings. -- This function gets run when an LSP connects to a particular buffer. From cfcd67366cc49262fb0925a507455a3c999e2abd Mon Sep 17 00:00:00 2001 From: Luiz Antonio Calliari Filho Date: Mon, 6 Mar 2023 23:26:20 -0300 Subject: [PATCH 026/480] Feat: Simplifying code --- init.lua | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/init.lua b/init.lua index 427af75e002..9ce29c65796 100644 --- a/init.lua +++ b/init.lua @@ -110,17 +110,9 @@ require('lazy').setup({ changedelete = { text = '~' }, }, on_attach = function(bufnr) - local function map(mode, lhs, rhs, opts) - opts = vim.tbl_extend('force', {noremap = true, silent = true}, opts or {}) - vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts) - end - - -- Navigation - map('n', ']c', "&diff ? ']c' : 'Gitsigns next_hunk'", {expr=true}) - map('n', '[c', "&diff ? '[c' : 'Gitsigns prev_hunk'", {expr=true}) - - -- Actions - map('n', 'ph', 'Gitsigns preview_hunk') + vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to [P]revious [H]unk' }) + vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to [N]ext [H]unk' }) + vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) end }, }, From 00d2b84cb8b7bebb14029fbffbf4cf2814839a94 Mon Sep 17 00:00:00 2001 From: Luiz Antonio Calliari Filho Date: Sun, 12 Mar 2023 20:45:26 -0300 Subject: [PATCH 027/480] FIX: Updating command description. --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index e3ddbd29fd8..b4a7881df4d 100644 --- a/init.lua +++ b/init.lua @@ -110,8 +110,8 @@ require('lazy').setup({ changedelete = { text = '~' }, }, on_attach = function(bufnr) - vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to [P]revious [H]unk' }) - vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to [N]ext [H]unk' }) + vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to Previous Hunk' }) + vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to Next Hunk' }) vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) end }, From e8fb9c567f96e6504de2a91de374bb8249148140 Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Fri, 7 Apr 2023 13:11:33 -0400 Subject: [PATCH 028/480] help treesitter module has been renamed to vimdoc in master (#248) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 72890326d47..1296085e900 100644 --- a/init.lua +++ b/init.lua @@ -288,7 +288,7 @@ vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { de -- See `:help nvim-treesitter` require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'help', 'vim' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, From f8a30bd6e05a36ed8b198f8551370841d96bd432 Mon Sep 17 00:00:00 2001 From: Sebastian Lyng Johansen Date: Wed, 12 Apr 2023 19:42:40 +0200 Subject: [PATCH 029/480] fix: use :TSInstall on build with nvim-treesitter (#261) --- init.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 1296085e900..56975a6765f 100644 --- a/init.lua +++ b/init.lua @@ -167,9 +167,7 @@ require('lazy').setup({ dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects', }, - config = function() - pcall(require('nvim-treesitter.install').update { with_sync = true }) - end, + build = ":TSUpdate", }, -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart From 44a0cee0f3307e96bcdde32da58c3b376fa9618e Mon Sep 17 00:00:00 2001 From: Kai Windle Date: Wed, 12 Apr 2023 18:43:08 +0100 Subject: [PATCH 030/480] mason nvim dap 2.0 removed setup_handlers() (#258) --- lua/kickstart/plugins/debug.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 0b68c43b94b..000bcb8fc47 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -9,7 +9,6 @@ return { -- NOTE: Yes, you can install new plugins here! 'mfussenegger/nvim-dap', - -- NOTE: And you can specify dependencies as well dependencies = { -- Creates a beautiful debugger UI @@ -22,7 +21,6 @@ return { -- Add your own debuggers here 'leoluz/nvim-dap-go', }, - config = function() local dap = require 'dap' local dapui = require 'dapui' @@ -32,6 +30,10 @@ return { -- reasonable debug configurations automatic_setup = true, + -- You can provide additional configuration to the handlers, + -- see mason-nvim-dap README for more information + handlers = {}, + -- You'll need to check that you have the required things installed -- online, please don't ask me how to install them :) ensure_installed = { @@ -40,10 +42,6 @@ return { }, } - -- You can provide additional configuration to the handlers, - -- see mason-nvim-dap README for more information - require('mason-nvim-dap').setup_handlers() - -- Basic debugging keymaps, feel free to change to your liking! vim.keymap.set('n', '', dap.continue) vim.keymap.set('n', '', dap.step_into) From e334e01641256d374285064b74c05415650d26e2 Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Thu, 13 Apr 2023 15:22:59 +0200 Subject: [PATCH 031/480] minor modifications on the issue template (#244) * use real markdown headers for section titles * add a newline after the initial comment for readability * make hint indications comments --- .github/ISSUE_TEMPLATE/bug_report.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 6999d51e856..2ad4d31ddb0 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -8,19 +8,21 @@ assignees: '' --- -**Describe the bug** -A clear and concise description of what the bug is. -**To Reproduce** -Steps to reproduce the behavior: +## Describe the bug + + +## To Reproduce + 1. ... -**Desktop (please complete the following information):** +## Desktop + - OS: - Terminal: -** Neovim Version ** - - Output of running `:version` from inside of neovim: +## Neovim Version + ``` ``` From 7a4eedc31d3766495590d65643bb67ff44e24fbf Mon Sep 17 00:00:00 2001 From: Jon Earnshaw <1021321+jpearnshaw@users.noreply.github.com> Date: Thu, 13 Apr 2023 14:28:44 +0100 Subject: [PATCH 032/480] Correct command for neo-tree (#216) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ce72ebbfe64..f6c0ac57808 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ return { } ``` -This will install the tree plugin and add the command `:NeoTree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information. +This will install the tree plugin and add the command `:Neotree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information. #### Example: Adding a file to change default options From 9669171879d957fe031aed3195df9d2dac52afa8 Mon Sep 17 00:00:00 2001 From: KudoLayton Date: Thu, 13 Apr 2023 22:34:06 +0900 Subject: [PATCH 033/480] fix: move the Mason setup time forward from before (#210) This commit fix the Mason [#1045](https://github.com/williamboman/mason.nvim/issues/1045) issue. Quickly set up Mason to avoid DAP-related startup error messages. --- init.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 56975a6765f..1cfa228b68e 100644 --- a/init.lua +++ b/init.lua @@ -79,7 +79,7 @@ require('lazy').setup({ 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs to stdpath for neovim - 'williamboman/mason.nvim', + { 'williamboman/mason.nvim', config = true }, 'williamboman/mason-lspconfig.nvim', -- Useful status updates for LSP @@ -426,9 +426,6 @@ require('neodev').setup() local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) --- Setup mason so it can manage external tooling -require('mason').setup() - -- Ensure the servers above are installed local mason_lspconfig = require 'mason-lspconfig' From cc2da3590bd39327019e95f2a20354a2549e2dba Mon Sep 17 00:00:00 2001 From: Tsanko Tsanev Date: Thu, 13 Apr 2023 16:34:27 +0300 Subject: [PATCH 034/480] Fix typo "documention" into "documentation" (#209) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f6c0ac57808..21fcab3de3f 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ Each PR, especially those which increase the line count, should have a descripti Installation may require installing build tools, and updating the run command for `telescope-fzf-native` -See `telescope-fzf-native` documention for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) +See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) This requires: From 0baeca41be017414b02f264bd065f123e667b785 Mon Sep 17 00:00:00 2001 From: SamPosh Date: Mon, 24 Apr 2023 16:40:07 +0530 Subject: [PATCH 035/480] Dapui.toggle is added --- lua/kickstart/plugins/debug.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 000bcb8fc47..14f422faeaf 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -72,7 +72,9 @@ return { }, }, } - + -- toggle to see last session result. Without this ,you can't see session output in case of unhandled exception. + vim.keymap.set("n", "", dapui.toggle) + dap.listeners.after.event_initialized['dapui_config'] = dapui.open dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close From ccfe9e6d67577e2dbad742d8b240207b43a9e768 Mon Sep 17 00:00:00 2001 From: liepieshov Date: Mon, 24 Apr 2023 17:57:47 +0100 Subject: [PATCH 036/480] setup a standard binding for searching git files using telescope --- init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/init.lua b/init.lua index 1cfa228b68e..22d90cd4b37 100644 --- a/init.lua +++ b/init.lua @@ -276,6 +276,7 @@ vim.keymap.set('n', '/', function() }) end, { desc = '[/] Fuzzily search in current buffer' }) +vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) From 8683e082fb5966d2bdaa7b3d28457b6ba2b61619 Mon Sep 17 00:00:00 2001 From: nPHYN1T3 <38122105+nPHYN1T3@users.noreply.github.com> Date: Mon, 24 Apr 2023 15:21:53 -0600 Subject: [PATCH 037/480] Update README.md --- README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 21fcab3de3f..52a62fc9549 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,27 @@ A starting point for Neovim that is: This repo is meant to be used as by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss. +Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions. + Distribution Alternatives: - [LazyVim](https://www.lazyvim.org/): A delightful distribution maintained by @folke (the author of lazy.nvim, the package manager used here) ### Installation -Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions. +* Backup your previous configuration (if any exists) + +### Archive Installation +* On the home/landing page for the project find the blue "<> CODE" button click it and select Local > Download ZIP. +* Extract the archive to: + ~/.config/nvim (Linux) + ??? (MacOS) + ??? (Windows) +* Ensure your extraction method did not extract with a parent folder. For example in ~/.config/nvim you should have init.lua not another folder called kickstart.nvim. +* Run nvim and allow the kickstart process to download files and set up the basics. + +### GIT Clone Installation + -* Backup your previous configuration * (Recommended) Fork this repo (so that you have your own copy that you can modify). * Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `~/AppData/Local/nvim/` (Windows) * If you don't want to include it as a git repo, you can just clone it and then move the files to this location From b919120223007db63d0289b809313e13a88e267c Mon Sep 17 00:00:00 2001 From: nPHYN1T3 <38122105+nPHYN1T3@users.noreply.github.com> Date: Mon, 24 Apr 2023 15:28:27 -0600 Subject: [PATCH 038/480] Update README.md --- README.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 52a62fc9549..29df719bba6 100644 --- a/README.md +++ b/README.md @@ -23,21 +23,25 @@ Distribution Alternatives: ### Archive Installation * On the home/landing page for the project find the blue "<> CODE" button click it and select Local > Download ZIP. * Extract the archive to: - ~/.config/nvim (Linux) - ??? (MacOS) - ??? (Windows) + `~/.config/nvim` (Linux) + `~/.config/nvim` (MacOS) + `~/AppData/Local/nvim/` (Windows) * Ensure your extraction method did not extract with a parent folder. For example in ~/.config/nvim you should have init.lua not another folder called kickstart.nvim. -* Run nvim and allow the kickstart process to download files and set up the basics. ### GIT Clone Installation +* From a terminal cd/dir to: + `~/.config/nvim` (Linux) + `~/.config/nvim` (MacOS) + `~/AppData/Local/nvim/` (Windows) +* run: git clone https://github.com/nvim-lua/kickstart.nvim.git OR: gh repo clone nvim-lua/kickstart.nvim + +* Run neovim (from terminal or shortcut) and allow the kickstart process to download files and set up the basics. +* Once the setup is complete restart Neovim. +* **You're ready to go!** - -* (Recommended) Fork this repo (so that you have your own copy that you can modify). +* (Recommended/Optional) Fork this repo (so that you have your own copy that you can modify). * Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `~/AppData/Local/nvim/` (Windows) * If you don't want to include it as a git repo, you can just clone it and then move the files to this location -* Start Neovim (`nvim`) and allow `lazy.nvim` to complete installation. -* Restart Neovim -* **You're ready to go!** Additional system requirements: - Make sure to review the readmes of the plugins if you are experiencing errors. In particular: From db3342aebb4b948a2ea6145783cb3b7490ea9aa9 Mon Sep 17 00:00:00 2001 From: nPHYN1T3 <38122105+nPHYN1T3@users.noreply.github.com> Date: Mon, 24 Apr 2023 15:29:58 -0600 Subject: [PATCH 039/480] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 29df719bba6..dd4f70c9aa2 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ Each PR, especially those which increase the line count, should have a descripti * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information * Are there any cool videos about this plugin? * Current iteration of kickstart (coming soon) - * Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). + * Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). Note the install via init.lua no longer works. ### Windows Installation From 85a9dee2b0cf084634a1536215ed136e16973087 Mon Sep 17 00:00:00 2001 From: nPHYN1T3 <38122105+nPHYN1T3@users.noreply.github.com> Date: Tue, 25 Apr 2023 10:21:31 -0600 Subject: [PATCH 040/480] Should fix the win paths I fear adding bits like "Your paths may differ, these are just for reference." but the core behind the kickstart is getting "noobs" past big hurdles fast. This however means things need to be super spoon fed or basic things like not understanding relative paths and such might end up right where things started...ambiguous to some user instructions because they don't understand they need to know certain things because this is supposed to help them bypass knowing that for now...and the snake eats its tail. :) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dd4f70c9aa2..81a9e0aa46a 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Distribution Alternatives: * Extract the archive to: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) - `~/AppData/Local/nvim/` (Windows) + `C:\User\YourName\AppData\Local\nvim\` (Windows) * Ensure your extraction method did not extract with a parent folder. For example in ~/.config/nvim you should have init.lua not another folder called kickstart.nvim. ### GIT Clone Installation @@ -40,7 +40,7 @@ Distribution Alternatives: * **You're ready to go!** * (Recommended/Optional) Fork this repo (so that you have your own copy that you can modify). -* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `~/AppData/Local/nvim/` (Windows) +* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `C:\User\YourName\AppData\Local\nvim\` (Windows) * If you don't want to include it as a git repo, you can just clone it and then move the files to this location Additional system requirements: From 2e682fec889e2462ab75652b203bf1c2d8ba92b9 Mon Sep 17 00:00:00 2001 From: nPHYN1T3 <38122105+nPHYN1T3@users.noreply.github.com> Date: Tue, 25 Apr 2023 10:43:15 -0600 Subject: [PATCH 041/480] Fixed Windows style path for home --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 81a9e0aa46a..0b617b13b4b 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Distribution Alternatives: * Extract the archive to: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) - `C:\User\YourName\AppData\Local\nvim\` (Windows) + `%userprofile%\User\YourName\AppData\Local\nvim\` (Windows) * Ensure your extraction method did not extract with a parent folder. For example in ~/.config/nvim you should have init.lua not another folder called kickstart.nvim. ### GIT Clone Installation @@ -40,7 +40,7 @@ Distribution Alternatives: * **You're ready to go!** * (Recommended/Optional) Fork this repo (so that you have your own copy that you can modify). -* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `C:\User\YourName\AppData\Local\nvim\` (Windows) +* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `%userprofile%\User\YourName\AppData\Local\nvim\` (Windows) * If you don't want to include it as a git repo, you can just clone it and then move the files to this location Additional system requirements: From 2604dc361459e435366e8c87a7f0eb3d950c749c Mon Sep 17 00:00:00 2001 From: nPHYN1T3 <38122105+nPHYN1T3@users.noreply.github.com> Date: Tue, 25 Apr 2023 13:14:17 -0600 Subject: [PATCH 042/480] Hmmm Tested on a win10VM for location and such because I remembered %appdata% should be a thing but it's the wrong location and the win MSI creates nvim-data rather than just nvim. Then I noticed my previous changes weren't all saved...so here I go again heh. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0b617b13b4b..96d3a0fd2c1 100644 --- a/README.md +++ b/README.md @@ -25,14 +25,14 @@ Distribution Alternatives: * Extract the archive to: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) - `%userprofile%\User\YourName\AppData\Local\nvim\` (Windows) + `%userprofile%\User\YourName\AppData\Local\nvim-data\` (Windows) * Ensure your extraction method did not extract with a parent folder. For example in ~/.config/nvim you should have init.lua not another folder called kickstart.nvim. ### GIT Clone Installation * From a terminal cd/dir to: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) - `~/AppData/Local/nvim/` (Windows) + `%userprofile%\AppData\Local\nvim-data\` (Windows) * run: git clone https://github.com/nvim-lua/kickstart.nvim.git OR: gh repo clone nvim-lua/kickstart.nvim * Run neovim (from terminal or shortcut) and allow the kickstart process to download files and set up the basics. @@ -40,7 +40,7 @@ Distribution Alternatives: * **You're ready to go!** * (Recommended/Optional) Fork this repo (so that you have your own copy that you can modify). -* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `%userprofile%\User\YourName\AppData\Local\nvim\` (Windows) +* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `%userprofile%\AppData\Local\nvim-data\` (Windows) * If you don't want to include it as a git repo, you can just clone it and then move the files to this location Additional system requirements: From 8ab46ae676ccbc219402273d678f25707b983422 Mon Sep 17 00:00:00 2001 From: nPHYN1T3 <38122105+nPHYN1T3@users.noreply.github.com> Date: Tue, 25 Apr 2023 13:15:10 -0600 Subject: [PATCH 043/480] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 96d3a0fd2c1..0b878ebec33 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Distribution Alternatives: * Extract the archive to: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) - `%userprofile%\User\YourName\AppData\Local\nvim-data\` (Windows) + `%userprofile%\AppData\Local\nvim-data\` (Windows) * Ensure your extraction method did not extract with a parent folder. For example in ~/.config/nvim you should have init.lua not another folder called kickstart.nvim. ### GIT Clone Installation From 2430a6953a9923cfa11b2cfe3ccf9c97d365957e Mon Sep 17 00:00:00 2001 From: nPHYN1T3 <38122105+nPHYN1T3@users.noreply.github.com> Date: Tue, 25 Apr 2023 13:21:31 -0600 Subject: [PATCH 044/480] ARG! My browser should not be caching yet github seems to fight some changes. I'm also still unable to see why the formatting (line height) differs between the Archive Install section and the Git Clone Install section. Hopefully this will at least save the correct changes to the Win stuff. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0b878ebec33..02df1b89cd5 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,8 @@ Distribution Alternatives: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) `%userprofile%\AppData\Local\nvim-data\` (Windows) -* run: git clone https://github.com/nvim-lua/kickstart.nvim.git OR: gh repo clone nvim-lua/kickstart.nvim +* run: git clone https://github.com/nvim-lua/kickstart.nvim.git OR: gh repo clone nvim-lua/kickstart.nvim * Run neovim (from terminal or shortcut) and allow the kickstart process to download files and set up the basics. * Once the setup is complete restart Neovim. * **You're ready to go!** From 490d29257340b507cbcfed3bf183c7a24039a819 Mon Sep 17 00:00:00 2001 From: Keiwan Jamaly <33158209+keiwanjamaly@users.noreply.github.com> Date: Wed, 26 Apr 2023 17:37:48 +0200 Subject: [PATCH 045/480] Added disconnect emoji for nvim-dap-ui --- lua/kickstart/plugins/debug.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 14f422faeaf..deeda564a22 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -69,6 +69,7 @@ return { step_back = 'b', run_last = '▶▶', terminate = '⏹', + disconnect = "⏏", }, }, } From 28d16ba1bcc73e9b8655fb77908869666b5b88fc Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Wed, 26 Apr 2023 12:24:52 -0400 Subject: [PATCH 046/480] Update README.md Tiny wording changes I requested from https://github.com/nvim-lua/kickstart.nvim/pull/283 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 02df1b89cd5..ad3d7db7dd7 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ Each PR, especially those which increase the line count, should have a descripti * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information * Are there any cool videos about this plugin? * Current iteration of kickstart (coming soon) - * Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). Note the install via init.lua no longer works. + * Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). Note the install via init.lua no longer works as specified. Please follow the install instructions in this file instead as they're up to date. ### Windows Installation From 7a8c3a95ad943900861056925ca866792f6c9bd4 Mon Sep 17 00:00:00 2001 From: Sumanth Lingappa <42572246+sumanth-lingappa@users.noreply.github.com> Date: Wed, 26 Apr 2023 23:49:32 +0530 Subject: [PATCH 047/480] corrected git clone command --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ad3d7db7dd7..ef119d21052 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Distribution Alternatives: `~/.config/nvim` (MacOS) `%userprofile%\AppData\Local\nvim-data\` (Windows) -* run: git clone https://github.com/nvim-lua/kickstart.nvim.git OR: gh repo clone nvim-lua/kickstart.nvim +* run: `git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim` OR: gh repo clone nvim-lua/kickstart.nvim * Run neovim (from terminal or shortcut) and allow the kickstart process to download files and set up the basics. * Once the setup is complete restart Neovim. * **You're ready to go!** From 7232a44566b4f4ff65f2b45517acd1dfc726dc31 Mon Sep 17 00:00:00 2001 From: Victor Wallsten <94681407+victorwallsten@users.noreply.github.com> Date: Thu, 27 Apr 2023 09:33:10 +0200 Subject: [PATCH 048/480] Add , mappings to nvim-cmp setup --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 22d90cd4b37..7fd9c54fcd6 100644 --- a/init.lua +++ b/init.lua @@ -457,6 +457,8 @@ cmp.setup { end, }, mapping = cmp.mapping.preset.insert { + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete {}, From fc9acf49da8dbd66df50075ae9c7d3221bf43724 Mon Sep 17 00:00:00 2001 From: SamPosh Date: Tue, 2 May 2023 16:01:46 +0530 Subject: [PATCH 049/480] Added friendly snippet support --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 7fd9c54fcd6..2d377d2885b 100644 --- a/init.lua +++ b/init.lua @@ -93,7 +93,7 @@ require('lazy').setup({ { -- Autocompletion 'hrsh7th/nvim-cmp', - dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, + dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip',"rafamadriz/friendly-snippets", }, }, -- Useful plugin to show you pending keybinds. @@ -447,7 +447,7 @@ mason_lspconfig.setup_handlers { -- nvim-cmp setup local cmp = require 'cmp' local luasnip = require 'luasnip' - +require("luasnip.loaders.from_vscode").lazy_load() luasnip.config.setup {} cmp.setup { From 162f73558adb0f7454c4b1352275b84f79e3057d Mon Sep 17 00:00:00 2001 From: Gaurav Bhatnagar <11798509+mech-a@users.noreply.github.com> Date: Sun, 7 May 2023 16:28:13 -0700 Subject: [PATCH 050/480] change luasnip tab jumping to locally jumpable --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 7fd9c54fcd6..f4d8d0f4938 100644 --- a/init.lua +++ b/init.lua @@ -469,7 +469,7 @@ cmp.setup { [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then + elseif luasnip.expand_or_locally_jumpable() then luasnip.expand_or_jump() else fallback() From 5bb0b87621fb752938cd599aacd1710ddfe18c36 Mon Sep 17 00:00:00 2001 From: Gaurav Bhatnagar <11798509+mech-a@users.noreply.github.com> Date: Sun, 7 May 2023 16:38:44 -0700 Subject: [PATCH 051/480] add local jumping to shift tab --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index f4d8d0f4938..1496d240eac 100644 --- a/init.lua +++ b/init.lua @@ -478,7 +478,7 @@ cmp.setup { [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() - elseif luasnip.jumpable(-1) then + elseif luasnip.locally_jumpable(-1) then luasnip.jump(-1) else fallback() From 416bd14be9e95bbdba716239440e2a29fbb3f9cd Mon Sep 17 00:00:00 2001 From: dec Date: Mon, 8 May 2023 11:02:37 +0100 Subject: [PATCH 052/480] Udated tree sitter to use latest release branch --- init.lua | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index 7fd9c54fcd6..f9c860793f4 100644 --- a/init.lua +++ b/init.lua @@ -35,7 +35,6 @@ I hope you enjoy your Neovim journey, P.S. You can delete this when you're done too. It's your config now :) --]] - -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) @@ -75,7 +74,8 @@ require('lazy').setup({ -- NOTE: This is where your plugins related to LSP can be installed. -- The configuration is done below. Search for lspconfig to find it below. - { -- LSP Configuration & Plugins + { + -- LSP Configuration & Plugins 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs to stdpath for neovim @@ -84,21 +84,23 @@ require('lazy').setup({ -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, + { 'j-hui/fidget.nvim', opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', }, }, - { -- Autocompletion + { + -- Autocompletion 'hrsh7th/nvim-cmp', dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, }, -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, - { -- Adds git releated signs to the gutter, as well as utilities for managing changes + { 'folke/which-key.nvim', opts = {} }, + { + -- Adds git releated signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', opts = { -- See `:help gitsigns.txt` @@ -112,7 +114,8 @@ require('lazy').setup({ }, }, - { -- Theme inspired by Atom + { + -- Theme inspired by Atom 'navarasu/onedark.nvim', priority = 1000, config = function() @@ -120,7 +123,8 @@ require('lazy').setup({ end, }, - { -- Set lualine as statusline + { + -- Set lualine as statusline 'nvim-lualine/lualine.nvim', -- See `:help lualine.txt` opts = { @@ -133,7 +137,8 @@ require('lazy').setup({ }, }, - { -- Add indentation guides even on blank lines + { + -- Add indentation guides even on blank lines 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` -- See `:help indent_blankline.txt` @@ -144,10 +149,10 @@ require('lazy').setup({ }, -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, + { 'numToStr/Comment.nvim', opts = {} }, -- Fuzzy Finder (files, lsp, etc) - { 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } }, + { 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } }, -- Fuzzy Finder Algorithm which requires local dependencies to be built. -- Only load if `make` is available. Make sure you have the system @@ -162,7 +167,8 @@ require('lazy').setup({ end, }, - { -- Highlight, edit, and navigate code + { + -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects', From a0b1f96c2c073bc16e4db40ef9ad4785a2fef166 Mon Sep 17 00:00:00 2001 From: Gaurav Bhatnagar Date: Tue, 16 May 2023 12:38:56 -0700 Subject: [PATCH 053/480] refact: stylua --- init.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index 71e1ae5ae08..c77ff26cf8f 100644 --- a/init.lua +++ b/init.lua @@ -84,7 +84,7 @@ require('lazy').setup({ -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, + { 'j-hui/fidget.nvim', opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', @@ -94,11 +94,11 @@ require('lazy').setup({ { -- Autocompletion 'hrsh7th/nvim-cmp', - dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip',"rafamadriz/friendly-snippets", }, + dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'rafamadriz/friendly-snippets' }, }, -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, + { 'folke/which-key.nvim', opts = {} }, { -- Adds git releated signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', @@ -115,7 +115,7 @@ require('lazy').setup({ vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to Previous Hunk' }) vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to Next Hunk' }) vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) - end + end, }, }, @@ -154,10 +154,10 @@ require('lazy').setup({ }, -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, + { 'numToStr/Comment.nvim', opts = {} }, -- Fuzzy Finder (files, lsp, etc) - { 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } }, + { 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } }, -- Fuzzy Finder Algorithm which requires local dependencies to be built. -- Only load if `make` is available. Make sure you have the system @@ -178,7 +178,7 @@ require('lazy').setup({ dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects', }, - build = ":TSUpdate", + build = ':TSUpdate', }, -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart @@ -361,10 +361,10 @@ require('nvim-treesitter.configs').setup { } -- Diagnostic keymaps -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" }) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" }) -vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) -- LSP settings. -- This function gets run when an LSP connects to a particular buffer. @@ -458,7 +458,7 @@ mason_lspconfig.setup_handlers { -- nvim-cmp setup local cmp = require 'cmp' local luasnip = require 'luasnip' -require("luasnip.loaders.from_vscode").lazy_load() +require('luasnip.loaders.from_vscode').lazy_load() luasnip.config.setup {} cmp.setup { From 07152cbc4d34be58dc2816b857eb816a7d5d07a6 Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Sun, 21 May 2023 22:13:02 -0400 Subject: [PATCH 054/480] Update README.md Fix for #314 - there's no -data at the end of the nvim dir. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ef119d21052..9bab48d4136 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Distribution Alternatives: * From a terminal cd/dir to: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) - `%userprofile%\AppData\Local\nvim-data\` (Windows) + `%userprofile%\AppData\Local\nvim\` (Windows) * run: `git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim` OR: gh repo clone nvim-lua/kickstart.nvim * Run neovim (from terminal or shortcut) and allow the kickstart process to download files and set up the basics. From 8b312d9495a5e6bdb6a1fa785680fa1c841fddfb Mon Sep 17 00:00:00 2001 From: Gaurav Bhatnagar Date: Sun, 21 May 2023 23:46:09 -0700 Subject: [PATCH 055/480] refact: add cmp comments, other --- init.lua | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index c77ff26cf8f..bc60ef85984 100644 --- a/init.lua +++ b/init.lua @@ -94,7 +94,17 @@ require('lazy').setup({ { -- Autocompletion 'hrsh7th/nvim-cmp', - dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'rafamadriz/friendly-snippets' }, + dependencies = { + -- Snippet Engine & its associated nvim-cmp source + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', + + -- Adds LSP completion capabilities + 'hrsh7th/cmp-nvim-lsp', + + -- Adds a number of user-friendly snippets + 'rafamadriz/friendly-snippets', + }, }, -- Useful plugin to show you pending keybinds. @@ -366,7 +376,7 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnos vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) --- LSP settings. +-- [[ Configure LSP ]] -- This function gets run when an LSP connects to a particular buffer. local on_attach = function(_, bufnr) -- NOTE: Remember that lua is a real programming language, and as such it is possible @@ -455,7 +465,8 @@ mason_lspconfig.setup_handlers { end, } --- nvim-cmp setup +-- [[ Configure nvim-cmp ]] +-- See `:help cmp` local cmp = require 'cmp' local luasnip = require 'luasnip' require('luasnip.loaders.from_vscode').lazy_load() From 383d90f67ccae174883dd95c01700e00c86342d7 Mon Sep 17 00:00:00 2001 From: Gaurav Bhatnagar Date: Mon, 22 May 2023 11:29:42 -0700 Subject: [PATCH 056/480] refact: remove after/ reference in readme, other clean-up items --- README.md | 42 +++++++++++++++++++++--------------------- init.lua | 8 +++----- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 9bab48d4136..265c2be30d4 100644 --- a/README.md +++ b/README.md @@ -28,15 +28,15 @@ Distribution Alternatives: `%userprofile%\AppData\Local\nvim-data\` (Windows) * Ensure your extraction method did not extract with a parent folder. For example in ~/.config/nvim you should have init.lua not another folder called kickstart.nvim. -### GIT Clone Installation +### Git Clone Installation * From a terminal cd/dir to: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) `%userprofile%\AppData\Local\nvim\` (Windows) -* run: `git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim` OR: gh repo clone nvim-lua/kickstart.nvim -* Run neovim (from terminal or shortcut) and allow the kickstart process to download files and set up the basics. -* Once the setup is complete restart Neovim. +* run: `git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim` OR: `gh repo clone nvim-lua/kickstart.nvim` +* Run Neovim (from terminal or shortcut) and allow lazy.nvim to download files and set up the basics. +* Once the setup is complete, restart Neovim. * **You're ready to go!** * (Recommended/Optional) Fork this repo (so that you have your own copy that you can modify). @@ -46,17 +46,18 @@ Distribution Alternatives: Additional system requirements: - Make sure to review the readmes of the plugins if you are experiencing errors. In particular: - [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. -- See as well [Windows Installation](#Windows-Installation) +- See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native` ### Configuration And Extension -* Inside of your fork, feel free to modify any file you like! It's your fork! -* Then there are two primary configuration options available: - * Include the `lua/kickstart/plugins/*` files in your configuration. +* Inside of your copy, feel free to modify any file you like! It's your copy! +* Feel free to change any of the default options in `init.lua` to better suit your needs. +* For adding plugins, there are 3 primary options: * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` - * NOTE: To enable this, you need to uncomment `{ import = 'custom.plugins' }` in your `init.lua` + * Modify `init.lua` with additional plugins. + * Include the `lua/kickstart/plugins/*` files in your configuration. -You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration +You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration. #### Example: Adding an autopairs plugin @@ -67,14 +68,23 @@ In the file: `lua/custom/plugins/autopairs.lua`, add: return { "windwp/nvim-autopairs", + -- Optional dependency + dependencies = { 'hrsh7th/nvim-cmp' }, config = function() require("nvim-autopairs").setup {} + -- If you want to automatically add `(` after selecting a function or method + local cmp_autopairs = require('nvim-autopairs.completion.cmp') + local cmp = require('cmp') + cmp.event:on( + 'confirm_done', + cmp_autopairs.on_confirm_done() + ) end, } ``` -This will automatically install `nvim-autopairs` and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim). +This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs) and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim). #### Example: Adding a file tree plugin @@ -100,16 +110,6 @@ return { This will install the tree plugin and add the command `:Neotree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information. -#### Example: Adding a file to change default options - -To change default options, you can add a file in the `/after/plugin/` folder (see `:help load-plugins`) to include your own options, keymaps, autogroups, and more. The following is an example `defaults.lua` file (located at `$HOME/.config/nvim/after/plugin/defaults.lua`). - -```lua -vim.opt.relativenumber = true - -vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) -``` - ### Contribution Pull-requests are welcome. The goal of this repo is not to create a Neovim configuration framework, but to offer a starting template that shows, by example, available features in Neovim. Some things that will not be included: diff --git a/init.lua b/init.lua index c77ff26cf8f..4719912effe 100644 --- a/init.lua +++ b/init.lua @@ -7,8 +7,8 @@ Kickstart.nvim is *not* a distribution. Kickstart.nvim is a template for your own configuration. - The goal is that you can read every line of code, top-to-bottom, and understand - what your configuration is doing. + The goal is that you can read every line of code, top-to-bottom, understand + what your configuration is doing, and modify it to suit your needs. Once you've done that, you should start exploring, configuring and tinkering to explore Neovim! @@ -192,14 +192,12 @@ require('lazy').setup({ -- up-to-date with whatever is in the kickstart repo. -- -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- - -- An additional note is that if you only copied in the `init.lua`, you can just comment this line - -- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`. { import = 'custom.plugins' }, }, {}) -- [[ Setting options ]] -- See `:help vim.o` +-- NOTE: You can change these options as you wish! -- Set highlight on search vim.o.hlsearch = false From ba1654b72f83d2a28cb6626142047cadf675de2b Mon Sep 17 00:00:00 2001 From: Luiz Antonio Calliari Filho Date: Thu, 25 May 2023 22:09:34 -0300 Subject: [PATCH 057/480] FIX: Conflict with vimdiff keybinding --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index fb0252cc654..ca2da6e161e 100644 --- a/init.lua +++ b/init.lua @@ -122,8 +122,8 @@ require('lazy').setup({ changedelete = { text = '~' }, }, on_attach = function(bufnr) - vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to Previous Hunk' }) - vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to Next Hunk' }) + vim.keymap.set('n', 'gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' }) + vim.keymap.set('n', 'gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' }) vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) end, }, From 9a4146b444907ad556e46b9640c8e0b32ae86b1d Mon Sep 17 00:00:00 2001 From: Pavel 'PK' Kaminsky Date: Mon, 29 May 2023 23:35:45 +0300 Subject: [PATCH 058/480] fix(docs): update windows path to a correct folder --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 265c2be30d4..e4a841ec044 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Distribution Alternatives: * **You're ready to go!** * (Recommended/Optional) Fork this repo (so that you have your own copy that you can modify). -* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `%userprofile%\AppData\Local\nvim-data\` (Windows) +* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `%userprofile%\AppData\Local\nvim\` (Windows) * If you don't want to include it as a git repo, you can just clone it and then move the files to this location Additional system requirements: From 02061d97596806bfa3bbab6ba68e7e2fd7bde4d5 Mon Sep 17 00:00:00 2001 From: Pavel 'PK' Kaminsky Date: Tue, 30 May 2023 11:04:01 +0300 Subject: [PATCH 059/480] Update README.md fix(docs): whoops missed another instance of `nvim-data` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e4a841ec044..64f386c6c07 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Distribution Alternatives: * Extract the archive to: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) - `%userprofile%\AppData\Local\nvim-data\` (Windows) + `%userprofile%\AppData\Local\nvim\` (Windows) * Ensure your extraction method did not extract with a parent folder. For example in ~/.config/nvim you should have init.lua not another folder called kickstart.nvim. ### Git Clone Installation From 0f71a735a577a4061c42f53aa70e79e0c0fcd7d2 Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Sat, 3 Jun 2023 10:11:10 -0400 Subject: [PATCH 060/480] Refactor theme and status line into their own file --- init.lua | 29 ++++++---------------------- lua/kickstart/plugins/autoformat.lua | 14 +++----------- lua/kickstart/plugins/statusline.lua | 14 ++++++++++++++ lua/kickstart/plugins/theme.lua | 10 ++++++++++ 4 files changed, 33 insertions(+), 34 deletions(-) create mode 100644 lua/kickstart/plugins/statusline.lua create mode 100644 lua/kickstart/plugins/theme.lua diff --git a/init.lua b/init.lua index ca2da6e161e..5e9e5679c90 100644 --- a/init.lua +++ b/init.lua @@ -122,35 +122,18 @@ require('lazy').setup({ changedelete = { text = '~' }, }, on_attach = function(bufnr) - vim.keymap.set('n', 'gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' }) - vim.keymap.set('n', 'gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' }) + vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to Previous Hunk' }) + vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to Next Hunk' }) vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) end, }, }, - { - -- Theme inspired by Atom - 'navarasu/onedark.nvim', - priority = 1000, - config = function() - vim.cmd.colorscheme 'onedark' - end, - }, + -- Theme related configs go here + require 'kickstart.plugins.theme', - { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - -- See `:help lualine.txt` - opts = { - options = { - icons_enabled = false, - theme = 'onedark', - component_separators = '|', - section_separators = '', - }, - }, - }, + -- Status line related configs go here + require 'kickstart.plugins.statusline', { -- Add indentation guides even on blank lines diff --git a/lua/kickstart/plugins/autoformat.lua b/lua/kickstart/plugins/autoformat.lua index bc56b15b027..855f350f319 100644 --- a/lua/kickstart/plugins/autoformat.lua +++ b/lua/kickstart/plugins/autoformat.lua @@ -5,6 +5,7 @@ return { 'neovim/nvim-lspconfig', + config = function() -- Switch for controlling whether you want autoformatting. -- Use :KickstartFormatToggle to toggle autoformatting on or off @@ -28,11 +29,9 @@ return { return _augroups[client.id] end - -- Whenever an LSP attaches to a buffer, we will run this function. - -- - -- See `:help LspAttach` for more information about this autocmd event. vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }), + -- This is where we attach the autoformatting for reasonable clients callback = function(args) local client_id = args.data.client_id @@ -50,8 +49,6 @@ return { return end - -- Create an autocmd that will run *before* we save the buffer. - -- Run the formatting command for the LSP that has just attached. vim.api.nvim_create_autocmd('BufWritePre', { group = get_augroup(client), buffer = bufnr, @@ -60,12 +57,7 @@ return { return end - vim.lsp.buf.format { - async = false, - filter = function(c) - return c.id == client.id - end, - } + vim.lsp.buf.format { async = false } end, }) end, diff --git a/lua/kickstart/plugins/statusline.lua b/lua/kickstart/plugins/statusline.lua new file mode 100644 index 00000000000..f54393fa37d --- /dev/null +++ b/lua/kickstart/plugins/statusline.lua @@ -0,0 +1,14 @@ +return { + -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = false, + theme = 'tokyonight', + component_separators = '|', + section_separators = '', + }, + }, +} + diff --git a/lua/kickstart/plugins/theme.lua b/lua/kickstart/plugins/theme.lua new file mode 100644 index 00000000000..794aa4d2637 --- /dev/null +++ b/lua/kickstart/plugins/theme.lua @@ -0,0 +1,10 @@ +return { + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + opts = {}, + config = function() + vim.cmd.colorscheme 'tokyonight-storm' + end, +} + From 6600e0f93cfb409e1bc9061a23b5c6eaba810285 Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Sun, 4 Jun 2023 16:10:59 +0000 Subject: [PATCH 061/480] Revert "Refactor theme and status line into their own file" This reverts commit 0f71a735a577a4061c42f53aa70e79e0c0fcd7d2. --- init.lua | 29 ++++++++++++++++++++++------ lua/kickstart/plugins/autoformat.lua | 14 +++++++++++--- lua/kickstart/plugins/statusline.lua | 14 -------------- lua/kickstart/plugins/theme.lua | 10 ---------- 4 files changed, 34 insertions(+), 33 deletions(-) delete mode 100644 lua/kickstart/plugins/statusline.lua delete mode 100644 lua/kickstart/plugins/theme.lua diff --git a/init.lua b/init.lua index 5e9e5679c90..ca2da6e161e 100644 --- a/init.lua +++ b/init.lua @@ -122,18 +122,35 @@ require('lazy').setup({ changedelete = { text = '~' }, }, on_attach = function(bufnr) - vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to Previous Hunk' }) - vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to Next Hunk' }) + vim.keymap.set('n', 'gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' }) + vim.keymap.set('n', 'gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' }) vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) end, }, }, - -- Theme related configs go here - require 'kickstart.plugins.theme', + { + -- Theme inspired by Atom + 'navarasu/onedark.nvim', + priority = 1000, + config = function() + vim.cmd.colorscheme 'onedark' + end, + }, - -- Status line related configs go here - require 'kickstart.plugins.statusline', + { + -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = false, + theme = 'onedark', + component_separators = '|', + section_separators = '', + }, + }, + }, { -- Add indentation guides even on blank lines diff --git a/lua/kickstart/plugins/autoformat.lua b/lua/kickstart/plugins/autoformat.lua index 855f350f319..bc56b15b027 100644 --- a/lua/kickstart/plugins/autoformat.lua +++ b/lua/kickstart/plugins/autoformat.lua @@ -5,7 +5,6 @@ return { 'neovim/nvim-lspconfig', - config = function() -- Switch for controlling whether you want autoformatting. -- Use :KickstartFormatToggle to toggle autoformatting on or off @@ -29,9 +28,11 @@ return { return _augroups[client.id] end + -- Whenever an LSP attaches to a buffer, we will run this function. + -- + -- See `:help LspAttach` for more information about this autocmd event. vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }), - -- This is where we attach the autoformatting for reasonable clients callback = function(args) local client_id = args.data.client_id @@ -49,6 +50,8 @@ return { return end + -- Create an autocmd that will run *before* we save the buffer. + -- Run the formatting command for the LSP that has just attached. vim.api.nvim_create_autocmd('BufWritePre', { group = get_augroup(client), buffer = bufnr, @@ -57,7 +60,12 @@ return { return end - vim.lsp.buf.format { async = false } + vim.lsp.buf.format { + async = false, + filter = function(c) + return c.id == client.id + end, + } end, }) end, diff --git a/lua/kickstart/plugins/statusline.lua b/lua/kickstart/plugins/statusline.lua deleted file mode 100644 index f54393fa37d..00000000000 --- a/lua/kickstart/plugins/statusline.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - -- See `:help lualine.txt` - opts = { - options = { - icons_enabled = false, - theme = 'tokyonight', - component_separators = '|', - section_separators = '', - }, - }, -} - diff --git a/lua/kickstart/plugins/theme.lua b/lua/kickstart/plugins/theme.lua deleted file mode 100644 index 794aa4d2637..00000000000 --- a/lua/kickstart/plugins/theme.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - "folke/tokyonight.nvim", - lazy = false, - priority = 1000, - opts = {}, - config = function() - vim.cmd.colorscheme 'tokyonight-storm' - end, -} - From 227e6c89e9ba18ebdd9fb8dfd952d7aac7a24b9c Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Wed, 7 Jun 2023 20:41:30 -0400 Subject: [PATCH 062/480] Fixes #336 - Enabale treesitter indent for Python Tested in my local configuratoin. Indenting works great. --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 5e9e5679c90..200bfe7ce21 100644 --- a/init.lua +++ b/init.lua @@ -295,7 +295,7 @@ require('nvim-treesitter.configs').setup { auto_install = false, highlight = { enable = true }, - indent = { enable = true, disable = { 'python' } }, + indent = { enable = true }, incremental_selection = { enable = true, keymaps = { From f8c20d648b9e8515a259fd071ae66da48881b35c Mon Sep 17 00:00:00 2001 From: Gavin Date: Wed, 14 Jun 2023 17:21:15 -0400 Subject: [PATCH 063/480] Add legacy tag to fidget to avoid deprecation warning --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 57c9af42b47..c62174516e5 100644 --- a/init.lua +++ b/init.lua @@ -84,7 +84,7 @@ require('lazy').setup({ -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, + { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', From 0910d9a2c4a464ad69c141661568265a8c7fe13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20Jos=C3=A9=20Solano?= Date: Fri, 16 Jun 2023 21:12:11 -0700 Subject: [PATCH 064/480] Use call_parentheses --- .stylua.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stylua.toml b/.stylua.toml index 5d12dbdfb00..139e9397d90 100644 --- a/.stylua.toml +++ b/.stylua.toml @@ -3,4 +3,4 @@ line_endings = "Unix" indent_type = "Spaces" indent_width = 2 quote_style = "AutoPreferSingle" -no_call_parentheses = true +call_parentheses = "None" From 4158f4b4af5e09a1efd6a4b0f63062488498d7ed Mon Sep 17 00:00:00 2001 From: Juan Giordana Date: Sun, 18 Jun 2023 00:10:49 -0300 Subject: [PATCH 065/480] Add descriptions for debugging keybindings. Add descriptions for debugging key bindings. Improve formatting by changing double quotes to single quotes in order to keep compatibility with the rest of the kickstart.nvim project. --- lua/kickstart/plugins/debug.lua | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index deeda564a22..7fc783fabd4 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -43,14 +43,14 @@ return { } -- Basic debugging keymaps, feel free to change to your liking! - vim.keymap.set('n', '', dap.continue) - vim.keymap.set('n', '', dap.step_into) - vim.keymap.set('n', '', dap.step_over) - vim.keymap.set('n', '', dap.step_out) - vim.keymap.set('n', 'b', dap.toggle_breakpoint) + vim.keymap.set('n', '', dap.continue, { desc = 'Debug: Start/Continue' }) + vim.keymap.set('n', '', dap.step_into, { desc = 'Debug: Step Into' }) + vim.keymap.set('n', '', dap.step_over, { desc = 'Debug: Step Over' }) + vim.keymap.set('n', '', dap.step_out, { desc = 'Debug: Step Out' }) + vim.keymap.set('n', 'b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) vim.keymap.set('n', 'B', function() dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') - end) + end, { desc = 'Debug: Set Breakpoint' }) -- Dap UI setup -- For more information, see |:help nvim-dap-ui| @@ -69,13 +69,14 @@ return { step_back = 'b', run_last = '▶▶', terminate = '⏹', - disconnect = "⏏", + disconnect = '⏏', }, }, } - -- toggle to see last session result. Without this ,you can't see session output in case of unhandled exception. - vim.keymap.set("n", "", dapui.toggle) - + + -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. + vim.keymap.set('n', '', dapui.toggle, { desc = 'Debug: See last session result.' }) + dap.listeners.after.event_initialized['dapui_config'] = dapui.open dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close From 1c1ffa430be087f0b5c02fe4670d2daade1b6dba Mon Sep 17 00:00:00 2001 From: ilian Date: Sun, 18 Jun 2023 16:20:34 +0200 Subject: [PATCH 066/480] Fix typo in ignorecase comment In order to perform a case-sensitive search with ignorecase, the pattern should contain `\C` instead of `/C`. --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index c62174516e5..fd36919c23e 100644 --- a/init.lua +++ b/init.lua @@ -229,7 +229,7 @@ vim.o.breakindent = true -- Save undo history vim.o.undofile = true --- Case insensitive searching UNLESS /C or capital in search +-- Case-insensitive searching UNLESS \C or capital in search vim.o.ignorecase = true vim.o.smartcase = true From b69c204fbdb54475ae4078066910f3170b7710ba Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Sat, 1 Jul 2023 12:34:20 -0400 Subject: [PATCH 067/480] Make init.lua copy-paste friendly --- init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index fd36919c23e..f8d9383f7ad 100644 --- a/init.lua +++ b/init.lua @@ -197,12 +197,13 @@ require('lazy').setup({ -- require 'kickstart.plugins.autoformat', -- require 'kickstart.plugins.debug', - -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua` + -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping -- up-to-date with whatever is in the kickstart repo. + -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - { import = 'custom.plugins' }, + -- { import = 'custom.plugins' }, }, {}) -- [[ Setting options ]] From a7e8f163089bb1120568862132750db6c6ef1811 Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Sat, 1 Jul 2023 11:21:10 -0400 Subject: [PATCH 068/480] =?UTF-8?q?docs:=20Update=20README.md=20?= =?UTF-8?q?=F0=9F=93=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 64f386c6c07..99914cf1fbe 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # kickstart.nvim +https://github.com/kdheepak/kickstart.nvim/assets/1813121/f3ff9a2b-c31f-44df-a4fa-8a0d7b17cf7b + ### Introduction A starting point for Neovim that is: From f192d6c0c922a76cbab2a733b32bd485733039e6 Mon Sep 17 00:00:00 2001 From: Andres Lowrie Date: Fri, 7 Jul 2023 08:37:12 -0500 Subject: [PATCH 069/480] correct typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hey y'all 👋 I think there may have been a typo? --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 64f386c6c07..e0b0470a332 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ A starting point for Neovim that is: * Documented * Modular -This repo is meant to be used as by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss. +This repo is meant to be used by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss. Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions. From c318423299d9cda10d4e2dacb0519bdc81750317 Mon Sep 17 00:00:00 2001 From: Andrew Stewart Date: Mon, 17 Jul 2023 10:21:44 -0400 Subject: [PATCH 070/480] Remove timeout --- init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/init.lua b/init.lua index f8d9383f7ad..859d9d2a6c7 100644 --- a/init.lua +++ b/init.lua @@ -239,7 +239,6 @@ vim.wo.signcolumn = 'yes' -- Decrease update time vim.o.updatetime = 250 -vim.o.timeout = true vim.o.timeoutlen = 300 -- Set completeopt to have a better completion experience From 7ed9b0cb78f5dd7d768c4dda630f474b40eb050d Mon Sep 17 00:00:00 2001 From: Dennis-Rall <56480601+Dennis-Rall@users.noreply.github.com> Date: Thu, 20 Jul 2023 10:56:15 +0200 Subject: [PATCH 071/480] Add hint to uncomment line to autodetect plugins --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4a128bcf503..b38867ddc9c 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Additional system requirements: * Inside of your copy, feel free to modify any file you like! It's your copy! * Feel free to change any of the default options in `init.lua` to better suit your needs. * For adding plugins, there are 3 primary options: - * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` + * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` (uncomment line 206 in init.lua therefore) * Modify `init.lua` with additional plugins. * Include the `lua/kickstart/plugins/*` files in your configuration. From 1586c0b4bc50dcda8095c27a3730236e55d50d40 Mon Sep 17 00:00:00 2001 From: Dennis-Rall <56480601+Dennis-Rall@users.noreply.github.com> Date: Thu, 20 Jul 2023 16:42:46 +0200 Subject: [PATCH 072/480] Remove fixed line number and describe line --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b38867ddc9c..ef5976007ab 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Additional system requirements: * Inside of your copy, feel free to modify any file you like! It's your copy! * Feel free to change any of the default options in `init.lua` to better suit your needs. * For adding plugins, there are 3 primary options: - * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` (uncomment line 206 in init.lua therefore) + * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` (uncomment the line importing the `custom/plugins` directory in the `init.lua` file to enable this) * Modify `init.lua` with additional plugins. * Include the `lua/kickstart/plugins/*` files in your configuration. From 14c2bc820d9d64a789a2226cf3bcc573d363a98f Mon Sep 17 00:00:00 2001 From: Numkil Date: Mon, 24 Jul 2023 20:41:14 +0200 Subject: [PATCH 073/480] setup more language servers i use + allow customizing filetypes --- init.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 859d9d2a6c7..e5cbed988c5 100644 --- a/init.lua +++ b/init.lua @@ -424,12 +424,16 @@ end -- -- Add any additional override configuration in the following tables. They will be passed to -- the `settings` field of the server config. You must look up that documentation yourself. +-- +-- If you want to override the default filetypes that your language server will attach to you can +-- define the property 'filetypes' to the map in question. local servers = { -- clangd = {}, -- gopls = {}, -- pyright = {}, -- rust_analyzer = {}, -- tsserver = {}, + -- html = { filetypes = { 'html', 'twig', 'hbs'} }, lua_ls = { Lua = { @@ -459,8 +463,9 @@ mason_lspconfig.setup_handlers { capabilities = capabilities, on_attach = on_attach, settings = servers[server_name], + filetypes = servers[server_name].filetypes, } - end, + end } -- [[ Configure nvim-cmp ]] From cf6808c9bf9ef4402ef5773f39486814fdb7184f Mon Sep 17 00:00:00 2001 From: Merel Jossart Date: Tue, 25 Jul 2023 17:06:04 +0200 Subject: [PATCH 074/480] Fix bug when server not explicitely defined in configuration but installed --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index e5cbed988c5..c6e7a981557 100644 --- a/init.lua +++ b/init.lua @@ -463,7 +463,7 @@ mason_lspconfig.setup_handlers { capabilities = capabilities, on_attach = on_attach, settings = servers[server_name], - filetypes = servers[server_name].filetypes, + filetypes = (servers[server_name] or {}).filetypes, } end } From 8ac673057455fc3579a9bb8364411a09e2791ab6 Mon Sep 17 00:00:00 2001 From: Ikko Eltociear Ashimine Date: Mon, 31 Jul 2023 02:46:27 +0900 Subject: [PATCH 075/480] Fix typo in init.lua releated -> related --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index c6e7a981557..160d94007c3 100644 --- a/init.lua +++ b/init.lua @@ -110,7 +110,7 @@ require('lazy').setup({ -- Useful plugin to show you pending keybinds. { 'folke/which-key.nvim', opts = {} }, { - -- Adds git releated signs to the gutter, as well as utilities for managing changes + -- Adds git related signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', opts = { -- See `:help gitsigns.txt` From d4fc04b7066a69cd1c5bf77d2e37dc6e5f026f35 Mon Sep 17 00:00:00 2001 From: Peter Benjamin Date: Sat, 5 Aug 2023 17:28:18 -0700 Subject: [PATCH 076/480] fix(init): turn telescope-fzf-native into a dependecy --- init.lua | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index 160d94007c3..933f5f16466 100644 --- a/init.lua +++ b/init.lua @@ -167,19 +167,24 @@ require('lazy').setup({ { 'numToStr/Comment.nvim', opts = {} }, -- Fuzzy Finder (files, lsp, etc) - { 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } }, - - -- Fuzzy Finder Algorithm which requires local dependencies to be built. - -- Only load if `make` is available. Make sure you have the system - -- requirements installed. { - 'nvim-telescope/telescope-fzf-native.nvim', - -- NOTE: If you are having trouble with this installation, - -- refer to the README for telescope-fzf-native for more instructions. - build = 'make', - cond = function() - return vim.fn.executable 'make' == 1 - end, + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim' + } + -- Fuzzy Finder Algorithm which requires local dependencies to be built. + -- Only load if `make` is available. Make sure you have the system + -- requirements installed. + { + 'nvim-telescope/telescope-fzf-native.nvim', + -- NOTE: If you are having trouble with this installation, + -- refer to the README for telescope-fzf-native for more instructions. + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, }, { From ae33f2a2ee3f82358db1ac64fc8de48186526cdb Mon Sep 17 00:00:00 2001 From: Peter Benjamin Date: Sat, 5 Aug 2023 17:31:01 -0700 Subject: [PATCH 077/480] fix: fix brackets --- init.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index 933f5f16466..f5389e4749a 100644 --- a/init.lua +++ b/init.lua @@ -172,18 +172,18 @@ require('lazy').setup({ branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' - } - -- Fuzzy Finder Algorithm which requires local dependencies to be built. - -- Only load if `make` is available. Make sure you have the system - -- requirements installed. - { - 'nvim-telescope/telescope-fzf-native.nvim', - -- NOTE: If you are having trouble with this installation, - -- refer to the README for telescope-fzf-native for more instructions. - build = 'make', - cond = function() - return vim.fn.executable 'make' == 1 - end, + -- Fuzzy Finder Algorithm which requires local dependencies to be built. + -- Only load if `make` is available. Make sure you have the system + -- requirements installed. + { + 'nvim-telescope/telescope-fzf-native.nvim', + -- NOTE: If you are having trouble with this installation, + -- refer to the README for telescope-fzf-native for more instructions. + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, }, }, From a5a263d3364b9ff6bbd2c20ab9c8bd99461cb645 Mon Sep 17 00:00:00 2001 From: daan Date: Sun, 6 Aug 2023 16:27:05 +0100 Subject: [PATCH 078/480] fix: missing comma --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index f5389e4749a..1192c4634a4 100644 --- a/init.lua +++ b/init.lua @@ -171,7 +171,7 @@ require('lazy').setup({ 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { - 'nvim-lua/plenary.nvim' + 'nvim-lua/plenary.nvim', -- Fuzzy Finder Algorithm which requires local dependencies to be built. -- Only load if `make` is available. Make sure you have the system -- requirements installed. From 6f2bf867b7846ab3def05f265ad40e8706e3be71 Mon Sep 17 00:00:00 2001 From: Smig <89040888+smiggiddy@users.noreply.github.com> Date: Thu, 10 Aug 2023 15:00:15 -0400 Subject: [PATCH 079/480] Update init.lua added a URL to the lua-guide may help others who miss the :help lua-guide --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 1192c4634a4..1332c3b97a5 100644 --- a/init.lua +++ b/init.lua @@ -17,7 +17,9 @@ Kickstart.nvim is a template for your own configuration. a guide. One possible example: - https://learnxinyminutes.com/docs/lua/ + And then you can explore or search through `:help lua-guide` + - https://neovim.io/doc/user/lua-guide.html Kickstart Guide: From 356d6c4e8edc17458075465d11d74547cc7f95ed Mon Sep 17 00:00:00 2001 From: Erik Date: Sat, 19 Aug 2023 13:38:31 +0200 Subject: [PATCH 080/480] Fix typo in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ef5976007ab..4a312bc9cb4 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Distribution Alternatives: `~/.config/nvim` (MacOS) `%userprofile%\AppData\Local\nvim\` (Windows) -* run: `git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim` OR: `gh repo clone nvim-lua/kickstart.nvim` +* Run: `git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim` OR: `gh repo clone nvim-lua/kickstart.nvim` * Run Neovim (from terminal or shortcut) and allow lazy.nvim to download files and set up the basics. * Once the setup is complete, restart Neovim. * **You're ready to go!** From c8a54e047780775437d29a8d69562babfe3949cf Mon Sep 17 00:00:00 2001 From: "E. Aakash" <09e.aakash@gmail.com> Date: Sun, 20 Aug 2023 14:43:34 +0530 Subject: [PATCH 081/480] Use telescope for goto implementation --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 1332c3b97a5..7eb1d231c7f 100644 --- a/init.lua +++ b/init.lua @@ -403,7 +403,7 @@ local on_attach = function(_, bufnr) nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation') + nmap('gI', require('telescope.builtin').lsp_implementaitons, '[G]oto [I]mplementation') nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') From 50026915ecaf3c94da29cad9da098a7d11b0e9d8 Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Mon, 21 Aug 2023 17:19:13 -0400 Subject: [PATCH 082/480] Update init.lua Fix typo in original. Co-authored-by: Luis G Estrades --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 7eb1d231c7f..d9967930782 100644 --- a/init.lua +++ b/init.lua @@ -403,7 +403,7 @@ local on_attach = function(_, bufnr) nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - nmap('gI', require('telescope.builtin').lsp_implementaitons, '[G]oto [I]mplementation') + nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') From eb134632eaf198f12ba163facc6c93b112ee2bb9 Mon Sep 17 00:00:00 2001 From: George Angelopoulos Date: Tue, 22 Aug 2023 07:17:15 +0300 Subject: [PATCH 083/480] Revert gitsigns keymaps but fix vimdiff and fugitive conflict Originally, the keymaps for jumping to next and previous git hunks were ]c and [c. This was changed in #323 (ba1654b) because they overwrote the built-in vimdiff keymaps. However, the more traditional solution is to have ]c and [c *extend* the built-in keymap. This is what fugitive and gitgutter have been doing for years. Gitsigns doesn't do this by itself, but it has a recommended keymap configuration on which the present patch is based: https://github.com/lewis6991/gitsigns.nvim#keymaps The only thing I've added is to have the keymaps work in visual mode as well, which is the same behavior as the built in vimdiff keymaps. --- init.lua | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 1332c3b97a5..8c213667202 100644 --- a/init.lua +++ b/init.lua @@ -124,9 +124,20 @@ require('lazy').setup({ changedelete = { text = '~' }, }, on_attach = function(bufnr) - vim.keymap.set('n', 'gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' }) - vim.keymap.set('n', 'gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' }) - vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) + vim.keymap.set('n', 'hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' }) + + -- don't override the built-in and fugitive keymaps + local gs = package.loaded.gitsigns + vim.keymap.set({'n', 'v'}, ']c', function() + if vim.wo.diff then return ']c' end + vim.schedule(function() gs.next_hunk() end) + return '' + end, {expr=true, buffer = bufnr, desc = "Jump to next hunk"}) + vim.keymap.set({'n', 'v'}, '[c', function() + if vim.wo.diff then return '[c' end + vim.schedule(function() gs.prev_hunk() end) + return '' + end, {expr=true, buffer = bufnr, desc = "Jump to previous hunk"}) end, }, }, From 7c7a5a739ad8284ef91f62796a68e174fc2ce146 Mon Sep 17 00:00:00 2001 From: George Angelopoulos Date: Sun, 27 Aug 2023 06:48:22 +0300 Subject: [PATCH 084/480] treesitter: ensure 'javascript' installed along with typescript and tsx This parser is actually needed for some *JSX* parsing, and since typescript and tsx are already getting installed, it makes sense to also install the javascript parser. --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 1332c3b97a5..ad993ea7669 100644 --- a/init.lua +++ b/init.lua @@ -313,7 +313,7 @@ vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { de -- See `:help nvim-treesitter` require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, From 8aea243ee30466eda8fd252e41694e3ee7d596b2 Mon Sep 17 00:00:00 2001 From: Dilshod Temirkhodjaev Date: Mon, 4 Sep 2023 17:36:28 +0500 Subject: [PATCH 085/480] Add telescope search resume key binding --- init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/init.lua b/init.lua index ad993ea7669..be65154660f 100644 --- a/init.lua +++ b/init.lua @@ -308,6 +308,7 @@ vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) +vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]resume' }) -- [[ Configure Treesitter ]] -- See `:help nvim-treesitter` From 604e4ef901c9cc8b10a1ea3820a576754a495f8a Mon Sep 17 00:00:00 2001 From: Luca Saccarola Date: Tue, 5 Sep 2023 14:12:56 +0200 Subject: [PATCH 086/480] docs: restructure README --- README.md | 75 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 4a312bc9cb4..963883d4547 100644 --- a/README.md +++ b/README.md @@ -20,35 +20,52 @@ Distribution Alternatives: ### Installation -* Backup your previous configuration (if any exists) - -### Archive Installation -* On the home/landing page for the project find the blue "<> CODE" button click it and select Local > Download ZIP. -* Extract the archive to: - `~/.config/nvim` (Linux) - `~/.config/nvim` (MacOS) - `%userprofile%\AppData\Local\nvim\` (Windows) -* Ensure your extraction method did not extract with a parent folder. For example in ~/.config/nvim you should have init.lua not another folder called kickstart.nvim. - -### Git Clone Installation -* From a terminal cd/dir to: - `~/.config/nvim` (Linux) - `~/.config/nvim` (MacOS) - `%userprofile%\AppData\Local\nvim\` (Windows) - -* Run: `git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim` OR: `gh repo clone nvim-lua/kickstart.nvim` -* Run Neovim (from terminal or shortcut) and allow lazy.nvim to download files and set up the basics. -* Once the setup is complete, restart Neovim. -* **You're ready to go!** - -* (Recommended/Optional) Fork this repo (so that you have your own copy that you can modify). -* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `%userprofile%\AppData\Local\nvim\` (Windows) - * If you don't want to include it as a git repo, you can just clone it and then move the files to this location - -Additional system requirements: -- Make sure to review the readmes of the plugins if you are experiencing errors. In particular: - - [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. -- See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native` +> **NOTE** +> [Backup](#FAQ) your previous configuration (if any exists) + +Requirements: +* Make sure to review the readmes of the plugins if you are experiencing errors. In particular: + * [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. +* See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native` + +Neovim's configurations are located under the following paths, depending on your OS: + +| OS | PATH | +| :- | :--- | +| Linux | `~/.config/nvim` | +| MacOS | `~/.config/nvim` | +| Windows | `%userprofile%\AppData\Local\nvim\` | + +#### Archive Installation + +* On the home/landing page for the project find the green "`<> CODE`" button click it and select `Local > Download ZIP`. +* Extract the archive to the appropriate configuration path. +* Ensure your extraction method did not extract with a parent folder. For example in `~/.config/nvim` you should have `init.lua` not another folder called `kickstart.nvim`. + +#### Git Clone Installation + +From a terminal `cd`/`dir` to the configuration path and then run: + +```sh +git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim +# OR +gh repo clone nvim-lua/kickstart.nvim +``` + +### Post Installation + +Run the following command and then **you are ready to go**! + +```sh +nvim --headless "+Lazy! sync" +qa +``` + +### Recommended Optional + +[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo (so that you have your own copy that you can modify) and then installing you can install to your machine using the methods above. + +> **NOTE** +> Your fork's url will be something like this: `https://github.com//kickstart.nvim.git` ### Configuration And Extension From 023344e6c4f78ca3620849a8ae58ad9162a938df Mon Sep 17 00:00:00 2001 From: Luca Saccarola Date: Thu, 7 Sep 2023 18:36:05 +0200 Subject: [PATCH 087/480] docs: remove archive installation --- README.md | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 963883d4547..49fa0f315e6 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Distribution Alternatives: ### Installation -> **NOTE** +> **NOTE** > [Backup](#FAQ) your previous configuration (if any exists) Requirements: @@ -32,24 +32,17 @@ Neovim's configurations are located under the following paths, depending on your | OS | PATH | | :- | :--- | -| Linux | `~/.config/nvim` | -| MacOS | `~/.config/nvim` | +| Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | +| MacOS | `$XDG_CONFIG_HOME/nvim`, '~/.config/nvim` | | Windows | `%userprofile%\AppData\Local\nvim\` | -#### Archive Installation - -* On the home/landing page for the project find the green "`<> CODE`" button click it and select `Local > Download ZIP`. -* Extract the archive to the appropriate configuration path. -* Ensure your extraction method did not extract with a parent folder. For example in `~/.config/nvim` you should have `init.lua` not another folder called `kickstart.nvim`. - -#### Git Clone Installation - -From a terminal `cd`/`dir` to the configuration path and then run: +Clone kickstart.nvim: ```sh -git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim -# OR -gh repo clone nvim-lua/kickstart.nvim +# on Linux and Mac +git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim +# on Windows +git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ ``` ### Post Installation @@ -60,7 +53,7 @@ Run the following command and then **you are ready to go**! nvim --headless "+Lazy! sync" +qa ``` -### Recommended Optional +### Recommended Steps [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo (so that you have your own copy that you can modify) and then installing you can install to your machine using the methods above. From b9937c915f5b7cac5e812b459e00d3c437eaaf04 Mon Sep 17 00:00:00 2001 From: Christopher Gillis <771603+Chris-Gillis@users.noreply.github.com> Date: Sat, 23 Sep 2023 12:10:51 -0400 Subject: [PATCH 088/480] Remove extra "r" Search Resume description --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index ea330eb16f4..cec3084e844 100644 --- a/init.lua +++ b/init.lua @@ -319,7 +319,7 @@ vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) -vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]resume' }) +vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) -- [[ Configure Treesitter ]] -- See `:help nvim-treesitter` From 50dd4eea0da09b78c9d23067b17dab54588c42fe Mon Sep 17 00:00:00 2001 From: tcld Date: Sun, 24 Sep 2023 10:24:33 +0200 Subject: [PATCH 089/480] Add documentation for custom which-key groups --- init.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/init.lua b/init.lua index cec3084e844..6f8f714607c 100644 --- a/init.lua +++ b/init.lua @@ -438,6 +438,17 @@ local on_attach = function(_, bufnr) end, { desc = 'Format current buffer with LSP' }) end +-- document existing key chains +require('which-key').register({ + ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, + ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, + ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, + ['h'] = { name = 'More git', _ = 'which_key_ignore' }, + ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, + ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, + ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, +}) + -- Enable the following language servers -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. -- From aba674408e3887331e94153fd1bcfa74a35f68b7 Mon Sep 17 00:00:00 2001 From: Anthony Fiddes <11233666+Anthony-Fiddes@users.noreply.github.com> Date: Wed, 27 Sep 2023 16:44:03 -0700 Subject: [PATCH 090/480] Remove lazy-lock.json from .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index ea93edad490..d699e1d68cc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,3 @@ tags test.sh .luarc.json nvim -lazy-lock.json From 006aabe333555a68d01df81eafcaff12d318f70b Mon Sep 17 00:00:00 2001 From: Emmanuel Chucks <31349069+emmanuelchucks@users.noreply.github.com> Date: Thu, 28 Sep 2023 05:57:53 +0000 Subject: [PATCH 091/480] fix(init.lua): indent blankline v3 setup --- init.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index cec3084e844..8ec8d54eb22 100644 --- a/init.lua +++ b/init.lua @@ -170,10 +170,12 @@ require('lazy').setup({ 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` -- See `:help indent_blankline.txt` - opts = { - char = '┊', - show_trailing_blankline_indent = false, - }, + config = function() + require('ibl').setup { + char = '┊', + show_trailing_blankline_indent = false, + } + end, }, -- "gc" to comment visual regions/lines From ce733acf00fa6910102caced839b6b30f482a85d Mon Sep 17 00:00:00 2001 From: Lukas Reineke Date: Thu, 28 Sep 2023 23:11:05 +0900 Subject: [PATCH 092/480] fix: fix indent-blankline config --- init.lua | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 8ec8d54eb22..3a00dea2f5a 100644 --- a/init.lua +++ b/init.lua @@ -170,12 +170,8 @@ require('lazy').setup({ 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` -- See `:help indent_blankline.txt` - config = function() - require('ibl').setup { - char = '┊', - show_trailing_blankline_indent = false, - } - end, + main = "ibl", + opts = {}, }, -- "gc" to comment visual regions/lines From 21276e92105d6cb1eba30228df97f394034a7a2d Mon Sep 17 00:00:00 2001 From: Ashraf Michail Date: Sat, 30 Sep 2023 00:35:22 +0000 Subject: [PATCH 093/480] Defer Treesitter setup to improve startup time of nvim {filename} --- init.lua | 113 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 58 insertions(+), 55 deletions(-) diff --git a/init.lua b/init.lua index 52571130c65..e5bc576e457 100644 --- a/init.lua +++ b/init.lua @@ -321,69 +321,72 @@ vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = -- [[ Configure Treesitter ]] -- See `:help nvim-treesitter` -require('nvim-treesitter.configs').setup { - -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' }, - - -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) - auto_install = false, - - highlight = { enable = true }, - indent = { enable = true }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = '', - node_incremental = '', - scope_incremental = '', - node_decremental = '', - }, - }, - textobjects = { - select = { +-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}' +vim.defer_fn(function() + require('nvim-treesitter.configs').setup { + -- Add languages to be installed here that you want installed for treesitter + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' }, + + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) + auto_install = false, + + highlight = { enable = true }, + indent = { enable = true }, + incremental_selection = { enable = true, - lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim keymaps = { - -- You can use the capture groups defined in textobjects.scm - ['aa'] = '@parameter.outer', - ['ia'] = '@parameter.inner', - ['af'] = '@function.outer', - ['if'] = '@function.inner', - ['ac'] = '@class.outer', - ['ic'] = '@class.inner', + init_selection = '', + node_incremental = '', + scope_incremental = '', + node_decremental = '', }, }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - [']m'] = '@function.outer', - [']]'] = '@class.outer', + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, }, - goto_next_end = { - [']M'] = '@function.outer', - [']['] = '@class.outer', + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + [']m'] = '@function.outer', + [']]'] = '@class.outer', + }, + goto_next_end = { + [']M'] = '@function.outer', + [']['] = '@class.outer', + }, + goto_previous_start = { + ['[m'] = '@function.outer', + ['[['] = '@class.outer', + }, + goto_previous_end = { + ['[M'] = '@function.outer', + ['[]'] = '@class.outer', + }, }, - goto_previous_start = { - ['[m'] = '@function.outer', - ['[['] = '@class.outer', - }, - goto_previous_end = { - ['[M'] = '@function.outer', - ['[]'] = '@class.outer', + swap = { + enable = true, + swap_next = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, }, }, - swap = { - enable = true, - swap_next = { - ['a'] = '@parameter.inner', - }, - swap_previous = { - ['A'] = '@parameter.inner', - }, - }, - }, -} + } +end, 0) -- Diagnostic keymaps vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) From 3bb734163810a2ce8e65a9fca3a360eae9e19d89 Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Sat, 30 Sep 2023 20:06:22 -0400 Subject: [PATCH 094/480] Fix git clone instruction - separate code blocks for Windows and UNIX. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 49fa0f315e6..4d27756c92e 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,10 @@ Clone kickstart.nvim: ```sh # on Linux and Mac git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim +``` + + +``` # on Windows git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ ``` From 7ae344ac621f58c29690bfa44eac0fb33a9d16a2 Mon Sep 17 00:00:00 2001 From: Anthony Fiddes <11233666+Anthony-Fiddes@users.noreply.github.com> Date: Fri, 6 Oct 2023 16:25:57 -0700 Subject: [PATCH 095/480] Fix Mason setup issue and run stylua. --- init.lua | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/init.lua b/init.lua index e5bc576e457..4438ca19331 100644 --- a/init.lua +++ b/init.lua @@ -81,7 +81,7 @@ require('lazy').setup({ 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs to stdpath for neovim - { 'williamboman/mason.nvim', config = true }, + 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim', -- Useful status updates for LSP @@ -128,16 +128,24 @@ require('lazy').setup({ -- don't override the built-in and fugitive keymaps local gs = package.loaded.gitsigns - vim.keymap.set({'n', 'v'}, ']c', function() - if vim.wo.diff then return ']c' end - vim.schedule(function() gs.next_hunk() end) + vim.keymap.set({ 'n', 'v' }, ']c', function() + if vim.wo.diff then + return ']c' + end + vim.schedule(function() + gs.next_hunk() + end) return '' - end, {expr=true, buffer = bufnr, desc = "Jump to next hunk"}) - vim.keymap.set({'n', 'v'}, '[c', function() - if vim.wo.diff then return '[c' end - vim.schedule(function() gs.prev_hunk() end) + end, { expr = true, buffer = bufnr, desc = 'Jump to next hunk' }) + vim.keymap.set({ 'n', 'v' }, '[c', function() + if vim.wo.diff then + return '[c' + end + vim.schedule(function() + gs.prev_hunk() + end) return '' - end, {expr=true, buffer = bufnr, desc = "Jump to previous hunk"}) + end, { expr = true, buffer = bufnr, desc = 'Jump to previous hunk' }) end, }, }, @@ -170,7 +178,7 @@ require('lazy').setup({ 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` -- See `:help indent_blankline.txt` - main = "ibl", + main = 'ibl', opts = {}, }, @@ -326,10 +334,10 @@ vim.defer_fn(function() require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' }, - + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, - + highlight = { enable = true }, indent = { enable = true }, incremental_selection = { @@ -440,7 +448,7 @@ local on_attach = function(_, bufnr) end -- document existing key chains -require('which-key').register({ +require('which-key').register { ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, @@ -448,7 +456,7 @@ require('which-key').register({ ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, -}) +} -- Enable the following language servers -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. @@ -481,6 +489,11 @@ require('neodev').setup() local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) +-- mason-lspconfig requires that these setup functions are called in this order +-- before setting up the servers. +require('mason').setup() +require('mason-lspconfig').setup() + -- Ensure the servers above are installed local mason_lspconfig = require 'mason-lspconfig' @@ -496,7 +509,7 @@ mason_lspconfig.setup_handlers { settings = servers[server_name], filetypes = (servers[server_name] or {}).filetypes, } - end + end, } -- [[ Configure nvim-cmp ]] From 095aa9409efc2f72fd0f723cf66414d37069aef6 Mon Sep 17 00:00:00 2001 From: amtoine Date: Sat, 7 Oct 2023 13:49:47 +0200 Subject: [PATCH 096/480] remove spaces in empty lines --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index e5bc576e457..5c8372a68e4 100644 --- a/init.lua +++ b/init.lua @@ -326,10 +326,10 @@ vim.defer_fn(function() require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' }, - + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, - + highlight = { enable = true }, indent = { enable = true }, incremental_selection = { From 95b0b6cf3204d091cc616034a9ec42918d1cabc6 Mon Sep 17 00:00:00 2001 From: Anthony Fiddes <11233666+Anthony-Fiddes@users.noreply.github.com> Date: Sat, 7 Oct 2023 16:14:26 -0700 Subject: [PATCH 097/480] Move mason setup up further This helps if a user needs to find a mason executable --- init.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index 4438ca19331..11f55d05fb0 100644 --- a/init.lua +++ b/init.lua @@ -458,6 +458,11 @@ require('which-key').register { ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, } +-- mason-lspconfig requires that these setup functions are called in this order +-- before setting up the servers. +require('mason').setup() +require('mason-lspconfig').setup() + -- Enable the following language servers -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. -- @@ -489,11 +494,6 @@ require('neodev').setup() local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) --- mason-lspconfig requires that these setup functions are called in this order --- before setting up the servers. -require('mason').setup() -require('mason-lspconfig').setup() - -- Ensure the servers above are installed local mason_lspconfig = require 'mason-lspconfig' From 1dce55107d7ab88ad4273e348a508a34b95c3709 Mon Sep 17 00:00:00 2001 From: Ashraf Michail Date: Tue, 3 Oct 2023 13:22:25 +0000 Subject: [PATCH 098/480] Fix bash errors --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 11f55d05fb0..ee1f390ee9c 100644 --- a/init.lua +++ b/init.lua @@ -333,7 +333,7 @@ vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = vim.defer_fn(function() require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, From ae637b285a755604f78935d0e706793efe087863 Mon Sep 17 00:00:00 2001 From: Pedro Santayana Date: Sat, 7 Oct 2023 22:34:24 -0300 Subject: [PATCH 099/480] docs: fix misstype on README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4d27756c92e..433a51de6f0 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Neovim's configurations are located under the following paths, depending on your | OS | PATH | | :- | :--- | | Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | -| MacOS | `$XDG_CONFIG_HOME/nvim`, '~/.config/nvim` | +| MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | | Windows | `%userprofile%\AppData\Local\nvim\` | Clone kickstart.nvim: From b075c37e936eea30feb8bea7beb2d28cca5fc66d Mon Sep 17 00:00:00 2001 From: Alvaro-Kothe Date: Tue, 10 Oct 2023 19:57:49 -0300 Subject: [PATCH 100/480] Fix help for indent-blankline plugin Since version 3 `:help indent_blankline` no longer works. Replace it with `:help ibl`. --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index ee1f390ee9c..fb080807d14 100644 --- a/init.lua +++ b/init.lua @@ -177,7 +177,7 @@ require('lazy').setup({ -- Add indentation guides even on blank lines 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` - -- See `:help indent_blankline.txt` + -- See `:help ibl` main = 'ibl', opts = {}, }, From 8edfc11edfbf436317fd7364b516ca2fb8ce4112 Mon Sep 17 00:00:00 2001 From: Theo P Date: Fri, 13 Oct 2023 16:21:10 +0900 Subject: [PATCH 101/480] feat(lsp): use Telescope builtin functions for LSP definition and type definition --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index fb080807d14..a7667ddcc63 100644 --- a/init.lua +++ b/init.lua @@ -422,10 +422,10 @@ local on_attach = function(_, bufnr) nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') - nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') + nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') + nmap('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') From c760a75ae3cbe7016cd7d729c522a8a08aa34c4e Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Wed, 25 Oct 2023 21:46:24 +0200 Subject: [PATCH 102/480] Update README Post Installation steps Change the recommendation to just run nvim normally instead of the headless mode for the first run. This will show Lazy UI updating the plugins which would match what the video show and may be easier to understand what is going on thant the silent headless run. --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 433a51de6f0..f8198270aed 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,15 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\L ### Post Installation -Run the following command and then **you are ready to go**! +Start Neovim + +```sh +nvim +``` + +The `Lazy` plugin manager will start automatically on the first run and install the configured plugins - as can be seen in the introduction video. After the installation is complete you can press `q` to close the `Lazy` UI and **you are ready to go**! Next time you run nvim `Lazy` will no longer show up. + +If you would prefer to hide this step and run the plugin sync from the command line, you can use: ```sh nvim --headless "+Lazy! sync" +qa From ca942c012aedd74b8b02c369b1b4d7f7c501525e Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Sat, 28 Oct 2023 23:33:10 +0200 Subject: [PATCH 103/480] README.md: add a note about NVIM_APPNAME in the FAQ section --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index f8198270aed..9652d708b3a 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,13 @@ Each PR, especially those which increase the line count, should have a descripti * You should back it up, then delete all files associated with it. * This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` * You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide) +* Can I keep my existing configuration in parallel to kickstart? + * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example you can install the kickstart configuration in `~/.config/nvim-kickstart` and create a script `~/bin/nvim-kickstart`: + ``` + #!/bin/sh + exec env NVIM_APPNAME=nvim-kickstart nvim "$@" + ``` + When you run Neovim with `nvim-kickstart` it will use the alternative config directory and the matching local directory: `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim distribution that you would like to try out. * What if I want to "uninstall" this configuration: * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information * Are there any cool videos about this plugin? From dc3bf5768bbcc6171499138a0be8086522e75703 Mon Sep 17 00:00:00 2001 From: n-a11s Date: Fri, 3 Nov 2023 13:47:30 +0100 Subject: [PATCH 104/480] Update README.md Added information on where to install if you use Powershell in windows. Since CMD and Powershell work differently. `%userprofile%` only works for the CMD application. `$env:USERPROFILE` works in Powershell. --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9652d708b3a..e2d9ea84b9a 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,8 @@ Neovim's configurations are located under the following paths, depending on your | :- | :--- | | Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | | MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | -| Windows | `%userprofile%\AppData\Local\nvim\` | +| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` | +| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` | Clone kickstart.nvim: @@ -45,10 +46,16 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HO ``` -# on Windows +# on Windows (cmd) git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ ``` +``` +# on Windows (powershell) +git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\ +``` + + ### Post Installation Start Neovim From 5e31405ea48518f84e561b4ad14edb878b7df59a Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Fri, 3 Nov 2023 19:04:25 +0100 Subject: [PATCH 105/480] README.md: Added a FAQ: why is init.lua a single file --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 9652d708b3a..1f8e6f40476 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,16 @@ Each PR, especially those which increase the line count, should have a descripti * Are there any cool videos about this plugin? * Current iteration of kickstart (coming soon) * Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). Note the install via init.lua no longer works as specified. Please follow the install instructions in this file instead as they're up to date. +* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files? + * The main purpose of kickstart is to serve as a teaching tool and a reference + configuration that someone can easily `git clone` as a basis for their own. + As you progress in learning Neovim and Lua, you might consider splitting `init.lua` + into smaller parts. A fork of kickstart that does this while maintaining the exact + same functionality is available here: + * [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim) + * Discussions on this topic can be found here: + * [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218) + * [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473) ### Windows Installation From 3824f1462c6618a8bd6a94de85955d7964cd48dc Mon Sep 17 00:00:00 2001 From: Sebastian Lara Menares Date: Mon, 6 Nov 2023 11:10:16 -0300 Subject: [PATCH 106/480] add Telescope live_grep on Git root --- init.lua | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index a7667ddcc63..a301a94e2eb 100644 --- a/init.lua +++ b/init.lua @@ -308,6 +308,40 @@ require('telescope').setup { -- Enable telescope fzf native, if installed pcall(require('telescope').load_extension, 'fzf') +-- Telescope live_grep in git root +-- Function to find the git root directory based on the current buffer's path +local function find_git_root() + -- Use the current buffer's path as the starting point for the git search + local current_file = vim.api.nvim_buf_get_name(0) + -- If the buffer is not associated with a file, return nil + if current_file == "" then + print("Buffer is not associated with a file") + return nil + end + -- Extract the directory from the current file's path + local current_dir = vim.fn.fnamemodify(current_file, ":h") + -- Find the Git root directory from the current file's path + print("git -C " .. vim.fn.escape(current_dir, " ") .. " rev-parse --show-toplevel") + local git_root = vim.fn.systemlist("git -C " .. vim.fn.escape(current_dir, " ") .. " rev-parse --show-toplevel")[1] + if vim.v.shell_error ~= 0 then + print("Not a git repository") + return nil + end + return git_root +end + +-- Custom live_grep function to search in git root +local function live_grep_git_root() + local git_root = find_git_root() + if git_root then + require('telescope.builtin').live_grep({ + search_dirs = {git_root}, + }) + end +end + +vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {}) + -- See `:help telescope.builtin` vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) vim.keymap.set('n', '', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) @@ -323,7 +357,8 @@ vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) -vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', 'sG', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', 'sg', ':LiveGrepGitRoot', { desc = '[S]earch by [G]rep on Git Root' }) vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) From 51407a956cc497b930abcf7815c36f1577f764c2 Mon Sep 17 00:00:00 2001 From: Sebastian Lara Menares Date: Mon, 6 Nov 2023 15:29:09 -0300 Subject: [PATCH 107/480] change keymap to not disrupt existing users of Search by Grep --- init.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index a301a94e2eb..b4b83051fe6 100644 --- a/init.lua +++ b/init.lua @@ -321,7 +321,6 @@ local function find_git_root() -- Extract the directory from the current file's path local current_dir = vim.fn.fnamemodify(current_file, ":h") -- Find the Git root directory from the current file's path - print("git -C " .. vim.fn.escape(current_dir, " ") .. " rev-parse --show-toplevel") local git_root = vim.fn.systemlist("git -C " .. vim.fn.escape(current_dir, " ") .. " rev-parse --show-toplevel")[1] if vim.v.shell_error ~= 0 then print("Not a git repository") @@ -357,8 +356,8 @@ vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) -vim.keymap.set('n', 'sG', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) -vim.keymap.set('n', 'sg', ':LiveGrepGitRoot', { desc = '[S]earch by [G]rep on Git Root' }) +vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', 'sG', ':LiveGrepGitRoot', { desc = '[S]earch by [G]rep on Git Root' }) vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) From e901c84fb69d4c27a6bb5cfda8f52fdada690649 Mon Sep 17 00:00:00 2001 From: Sebastian Lara Menares Date: Mon, 6 Nov 2023 22:29:05 -0300 Subject: [PATCH 108/480] Live Grep from Git root falls back to cwd on special buffers --- init.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index b4b83051fe6..0976a461a58 100644 --- a/init.lua +++ b/init.lua @@ -313,18 +313,21 @@ pcall(require('telescope').load_extension, 'fzf') local function find_git_root() -- Use the current buffer's path as the starting point for the git search local current_file = vim.api.nvim_buf_get_name(0) + local current_dir + local cwd = vim.fn.getcwd() -- If the buffer is not associated with a file, return nil if current_file == "" then - print("Buffer is not associated with a file") - return nil + current_dir = cwd + else + -- Extract the directory from the current file's path + current_dir = vim.fn.fnamemodify(current_file, ":h") end - -- Extract the directory from the current file's path - local current_dir = vim.fn.fnamemodify(current_file, ":h") + -- Find the Git root directory from the current file's path local git_root = vim.fn.systemlist("git -C " .. vim.fn.escape(current_dir, " ") .. " rev-parse --show-toplevel")[1] if vim.v.shell_error ~= 0 then - print("Not a git repository") - return nil + print("Not a git repository. Searching on current working directory") + return cwd end return git_root end From 16c4c4b73fb4cd3a6da1cb3a7e57a994ef79429c Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Tue, 7 Nov 2023 11:18:15 +0100 Subject: [PATCH 109/480] init.lua: move diagnostic keymaps together with other keymaps --- init.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 0976a461a58..225ad21a458 100644 --- a/init.lua +++ b/init.lua @@ -281,6 +281,12 @@ vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) +-- Diagnostic keymaps +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) + -- [[ Highlight on yank ]] -- See `:help vim.highlight.on_yank()` local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) @@ -433,12 +439,6 @@ vim.defer_fn(function() } end, 0) --- Diagnostic keymaps -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) -vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) - -- [[ Configure LSP ]] -- This function gets run when an LSP connects to a particular buffer. local on_attach = function(_, bufnr) From a819985529d0ff51454037c853cf648e74012891 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Tue, 7 Nov 2023 11:27:14 +0100 Subject: [PATCH 110/480] init.lua: minor edits of section comments for consistency --- init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 225ad21a458..748e7f81454 100644 --- a/init.lua +++ b/init.lua @@ -37,13 +37,14 @@ I hope you enjoy your Neovim journey, P.S. You can delete this when you're done too. It's your config now :) --]] + -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' --- Install package manager +-- [[ Install `lazy.nvim` plugin manager ]] -- https://github.com/folke/lazy.nvim -- `:help lazy.nvim.txt` for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' @@ -59,6 +60,7 @@ if not vim.loop.fs_stat(lazypath) then end vim.opt.rtp:prepend(lazypath) +-- [[ Configure plugins ]] -- NOTE: Here is where you install your plugins. -- You can configure plugins using the `config` key. -- From c4d1262a17f1710b8f2893f7df97df5c36894d1e Mon Sep 17 00:00:00 2001 From: Shashwat Agrawal Date: Sat, 11 Nov 2023 20:31:05 +0530 Subject: [PATCH 111/480] fix(auto-completion): ensure first menu item is selected by default --- init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init.lua b/init.lua index 748e7f81454..385b19a0733 100644 --- a/init.lua +++ b/init.lua @@ -564,6 +564,9 @@ cmp.setup { luasnip.lsp_expand(args.body) end, }, + completion = { + completeopt = 'menu,menuone,noinsert' + }, mapping = cmp.mapping.preset.insert { [''] = cmp.mapping.select_next_item(), [''] = cmp.mapping.select_prev_item(), From 2ff3d497df07da7d66ffb130432c7d32f29b4616 Mon Sep 17 00:00:00 2001 From: j-hui Date: Mon, 13 Nov 2023 15:46:34 -0500 Subject: [PATCH 112/480] init.lua: remove 'legacy' tag from fidget.nvim --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 385b19a0733..3a98da03be6 100644 --- a/init.lua +++ b/init.lua @@ -88,7 +88,7 @@ require('lazy').setup({ -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, + { 'j-hui/fidget.nvim', opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', From 1d1b53cbf0442b02dc034527a505afc2aef20cf9 Mon Sep 17 00:00:00 2001 From: Tommy Williams Date: Fri, 24 Nov 2023 09:55:19 -0700 Subject: [PATCH 113/480] option to reduce noisy Lua_LS's missing-fields warnings (#511) --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 3a98da03be6..e7f1eec416d 100644 --- a/init.lua +++ b/init.lua @@ -522,6 +522,8 @@ local servers = { Lua = { workspace = { checkThirdParty = false }, telemetry = { enable = false }, + -- NOTE: toggle below to ignore Lua_LS's noisy `missing-fields` warnings + -- diagnostics = { disable = { 'missing-fields' } }, }, }, } From 160675b839debfdfa52df747cb8567d178123c34 Mon Sep 17 00:00:00 2001 From: matt <55467261+mattwyd@users.noreply.github.com> Date: Wed, 29 Nov 2023 19:34:43 -0500 Subject: [PATCH 114/480] Update README.md (#520) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7f54ce88704..1979e9ec276 100644 --- a/README.md +++ b/README.md @@ -39,19 +39,19 @@ Neovim's configurations are located under the following paths, depending on your Clone kickstart.nvim: -```sh # on Linux and Mac +```sh git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim ``` -``` # on Windows (cmd) +``` git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ ``` -``` # on Windows (powershell) +``` git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\ ``` From 8aa5fa6ffd8546cd21e9aad893411d7715ebe9d5 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Thu, 30 Nov 2023 10:04:27 +0100 Subject: [PATCH 115/480] README.md: update install section formatting (#523) --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1979e9ec276..36c1386128e 100644 --- a/README.md +++ b/README.md @@ -39,18 +39,17 @@ Neovim's configurations are located under the following paths, depending on your Clone kickstart.nvim: -# on Linux and Mac +- on Linux and Mac ```sh git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim ``` - -# on Windows (cmd) +- on Windows (cmd) ``` git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ ``` -# on Windows (powershell) +- on Windows (powershell) ``` git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\ ``` From 0f94dff33f8ecdbf224c56e4141b5ef2fa9534d8 Mon Sep 17 00:00:00 2001 From: Sudo <788991+wadkar@users.noreply.github.com> Date: Fri, 1 Dec 2023 07:30:55 +0900 Subject: [PATCH 116/480] Use alias instead of a wrapper script (#524) It is much easier to stick an alias statement in `~/.{z,ba}shrc` than create a script, invoke another instance of interpreter and then run neovim --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 36c1386128e..78ac6df0fb5 100644 --- a/README.md +++ b/README.md @@ -156,12 +156,11 @@ Each PR, especially those which increase the line count, should have a descripti * This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` * You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide) * Can I keep my existing configuration in parallel to kickstart? - * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example you can install the kickstart configuration in `~/.config/nvim-kickstart` and create a script `~/bin/nvim-kickstart`: + * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example you can install the kickstart configuration in `~/.config/nvim-kickstart` and create an alias: ``` - #!/bin/sh - exec env NVIM_APPNAME=nvim-kickstart nvim "$@" + alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim' ``` - When you run Neovim with `nvim-kickstart` it will use the alternative config directory and the matching local directory: `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim distribution that you would like to try out. + When you run Neovim using `nvim-kickstart` alias it will use the alternative config directory and the matching local directory `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim distribution that you would like to try out. * What if I want to "uninstall" this configuration: * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information * Are there any cool videos about this plugin? From 06b790c6b08d29f885d4c3f1d6adee8625ed522f Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Sat, 2 Dec 2023 22:27:13 +0100 Subject: [PATCH 117/480] Add a github action on pull request to check lua formatting (#526) GitHub Action used: https://github.com/marketplace/actions/stylua This runs `stylua --check` on a PR and it will show success or failure. The suggested stylua changes can be inspected when clicking on the details. The PR can still be merged even if the check fails. --- .github/workflows/stylua.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/stylua.yml diff --git a/.github/workflows/stylua.yml b/.github/workflows/stylua.yml new file mode 100644 index 00000000000..e189fe01da2 --- /dev/null +++ b/.github/workflows/stylua.yml @@ -0,0 +1,18 @@ +# Check Lua Formatting +name: Check Lua Formatting +on: pull_request + +jobs: + stylua-check: + name: Stylua Check + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v2 + - name: Stylua Check + uses: JohnnyMorganz/stylua-action@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: latest + args: --check . + From 54d44575d17d3f0e8851d8174fd5f0c4d842df2b Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Sun, 3 Dec 2023 20:23:39 +0100 Subject: [PATCH 118/480] Run stylua (#525) --- init.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index e7f1eec416d..94f7cf4ecbe 100644 --- a/init.lua +++ b/init.lua @@ -324,17 +324,17 @@ local function find_git_root() local current_dir local cwd = vim.fn.getcwd() -- If the buffer is not associated with a file, return nil - if current_file == "" then + if current_file == '' then current_dir = cwd else -- Extract the directory from the current file's path - current_dir = vim.fn.fnamemodify(current_file, ":h") + current_dir = vim.fn.fnamemodify(current_file, ':h') end -- Find the Git root directory from the current file's path - local git_root = vim.fn.systemlist("git -C " .. vim.fn.escape(current_dir, " ") .. " rev-parse --show-toplevel")[1] + local git_root = vim.fn.systemlist('git -C ' .. vim.fn.escape(current_dir, ' ') .. ' rev-parse --show-toplevel')[1] if vim.v.shell_error ~= 0 then - print("Not a git repository. Searching on current working directory") + print 'Not a git repository. Searching on current working directory' return cwd end return git_root @@ -344,9 +344,9 @@ end local function live_grep_git_root() local git_root = find_git_root() if git_root then - require('telescope.builtin').live_grep({ - search_dirs = {git_root}, - }) + require('telescope.builtin').live_grep { + search_dirs = { git_root }, + } end end @@ -567,7 +567,7 @@ cmp.setup { end, }, completion = { - completeopt = 'menu,menuone,noinsert' + completeopt = 'menu,menuone,noinsert', }, mapping = cmp.mapping.preset.insert { [''] = cmp.mapping.select_next_item(), From 4dfb4237f5b42a1e58d59b0afeaea3a67b042401 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Mon, 4 Dec 2023 16:35:54 +0100 Subject: [PATCH 119/480] Add gitsigns recommended keymaps (#531) * Import gitsigns README.md recommended keymaps (and apply stylua) the previously added visual mode for ]c [c is kept. * Add gitsigns keymap descriptions --- init.lua | 59 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index 94f7cf4ecbe..76ddd45a83f 100644 --- a/init.lua +++ b/init.lua @@ -126,11 +126,16 @@ require('lazy').setup({ changedelete = { text = '~' }, }, on_attach = function(bufnr) - vim.keymap.set('n', 'hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' }) - - -- don't override the built-in and fugitive keymaps local gs = package.loaded.gitsigns - vim.keymap.set({ 'n', 'v' }, ']c', function() + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map({ 'n', 'v' }, ']c', function() if vim.wo.diff then return ']c' end @@ -138,8 +143,9 @@ require('lazy').setup({ gs.next_hunk() end) return '' - end, { expr = true, buffer = bufnr, desc = 'Jump to next hunk' }) - vim.keymap.set({ 'n', 'v' }, '[c', function() + end, { expr = true, desc = 'Jump to next hunk' }) + + map({ 'n', 'v' }, '[c', function() if vim.wo.diff then return '[c' end @@ -147,7 +153,37 @@ require('lazy').setup({ gs.prev_hunk() end) return '' - end, { expr = true, buffer = bufnr, desc = 'Jump to previous hunk' }) + end, { expr = true, desc = 'Jump to previous hunk' }) + + -- Actions + -- visual mode + map('v', 'hs', function() + gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'stage git hunk' }) + map('v', 'hr', function() + gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'reset git hunk' }) + -- normal mode + map('n', 'hs', gs.stage_hunk, { desc = 'git stage hunk' }) + map('n', 'hr', gs.reset_hunk, { desc = 'git reset hunk' }) + map('n', 'hS', gs.stage_buffer, { desc = 'git Stage buffer' }) + map('n', 'hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' }) + map('n', 'hR', gs.reset_buffer, { desc = 'git Reset buffer' }) + map('n', 'hp', gs.preview_hunk, { desc = 'preview git hunk' }) + map('n', 'hb', function() + gs.blame_line { full = false } + end, { desc = 'git blame line' }) + map('n', 'hd', gs.diffthis, { desc = 'git diff against index' }) + map('n', 'hD', function() + gs.diffthis '~' + end, { desc = 'git diff against last commit' }) + + -- Toggles + map('n', 'tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' }) + map('n', 'td', gs.toggle_deleted, { desc = 'toggle git show deleted' }) + + -- Text object + map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'select git hunk' }) end, }, }, @@ -491,11 +527,18 @@ require('which-key').register { ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, - ['h'] = { name = 'More git', _ = 'which_key_ignore' }, + ['h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, + ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, } +-- register which-key VISUAL mode +-- required for visual hs (hunk stage) to work +require('which-key').register({ + [''] = { name = 'VISUAL ' }, + ['h'] = { 'Git [H]unk' }, +}, { mode = 'v' }) -- mason-lspconfig requires that these setup functions are called in this order -- before setting up the servers. From 184ddbc8c478a32ff4aead03e0591e0004b2ef91 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Mon, 4 Dec 2023 16:45:01 +0100 Subject: [PATCH 120/480] Adds two essential telescope keymaps (#528) * Added keymap for select Telescope picker * Added keymap for search in all open files --- init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/init.lua b/init.lua index 76ddd45a83f..36cc9a525ac 100644 --- a/init.lua +++ b/init.lua @@ -399,6 +399,14 @@ vim.keymap.set('n', '/', function() }) end, { desc = '[/] Fuzzily search in current buffer' }) +local function telescope_live_grep_open_files() + require('telescope.builtin').live_grep { + grep_open_files = true, + prompt_title = 'Live Grep in Open Files', + } +end +vim.keymap.set('n', 's/', telescope_live_grep_open_files, { desc = '[S]earch [/] in Open Files' }) +vim.keymap.set('n', 'ss', require('telescope.builtin').builtin, { desc = '[S]earch [S]elect Telescope' }) vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) From 29d10214410c24c51e9124209b673a192c2c6b4f Mon Sep 17 00:00:00 2001 From: Shashwat Agrawal <72117025+ShashwatAgrawal20@users.noreply.github.com> Date: Fri, 8 Dec 2023 18:44:06 +0530 Subject: [PATCH 121/480] feat(cmp): path completion feature (#536) --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 36cc9a525ac..cf4a3790026 100644 --- a/init.lua +++ b/init.lua @@ -105,6 +105,7 @@ require('lazy').setup({ -- Adds LSP completion capabilities 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-path', -- Adds a number of user-friendly snippets 'rafamadriz/friendly-snippets', @@ -652,6 +653,7 @@ cmp.setup { sources = { { name = 'nvim_lsp' }, { name = 'luasnip' }, + { name = 'path' }, }, } From 872d4b1a87047c656d944a052b9882600d9e5e11 Mon Sep 17 00:00:00 2001 From: Ari Pollak Date: Thu, 21 Dec 2023 15:35:28 -0500 Subject: [PATCH 122/480] Switch cmp up mapping from C-d to C-b to match regular vim up key (#549) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index cf4a3790026..48cf771ba28 100644 --- a/init.lua +++ b/init.lua @@ -624,7 +624,7 @@ cmp.setup { mapping = cmp.mapping.preset.insert { [''] = cmp.mapping.select_next_item(), [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete {}, [''] = cmp.mapping.confirm { From 8f023f77e5531853c45b4f2143a9c109d65efc20 Mon Sep 17 00:00:00 2001 From: John Pekcan Date: Sat, 23 Dec 2023 20:59:59 -0800 Subject: [PATCH 123/480] fix: restore mason config timing for dap startup (#555) Co-authored-by: John Pekcan --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 48cf771ba28..7e68de67481 100644 --- a/init.lua +++ b/init.lua @@ -83,7 +83,7 @@ require('lazy').setup({ 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs to stdpath for neovim - 'williamboman/mason.nvim', + { 'williamboman/mason.nvim', config = true }, 'williamboman/mason-lspconfig.nvim', -- Useful status updates for LSP From 9569656754618e0379ceeb4a88f38e468aea3c9f Mon Sep 17 00:00:00 2001 From: gitressa <3491208+gitressa@users.noreply.github.com> Date: Wed, 3 Jan 2024 16:03:23 +0100 Subject: [PATCH 124/480] Move video up on the README.md page (#563) To help new users get started, how about moving the video link ("Effective Neovim: Instant IDE ") right after "Post Installation"? This way new users, can install it, and right away proceed to learn how to use it. --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 78ac6df0fb5..e1a4ee1991c 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,10 @@ If you would prefer to hide this step and run the plugin sync from the command l nvim --headless "+Lazy! sync" +qa ``` +### Introduction + +To get started, see [Effective Neovim: Instant IDE](https://youtu.be/stqUbv-5u2s), covering the previous version. Note: The install via init.lua is outdated, please follow the install instructions in this file instead. An updated video is coming soon. + ### Recommended Steps [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo (so that you have your own copy that you can modify) and then installing you can install to your machine using the methods above. @@ -163,9 +167,6 @@ Each PR, especially those which increase the line count, should have a descripti When you run Neovim using `nvim-kickstart` alias it will use the alternative config directory and the matching local directory `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim distribution that you would like to try out. * What if I want to "uninstall" this configuration: * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information -* Are there any cool videos about this plugin? - * Current iteration of kickstart (coming soon) - * Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). Note the install via init.lua no longer works as specified. Please follow the install instructions in this file instead as they're up to date. * Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files? * The main purpose of kickstart is to serve as a teaching tool and a reference configuration that someone can easily `git clone` as a basis for their own. From 106d27678528424f907e9f494c5a47d892c56646 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Wed, 3 Jan 2024 18:30:37 +0100 Subject: [PATCH 125/480] Improve stylua github workflow (#571) Addressing issue nvim-lua/kickstart.nvim#570 This improves the github workflow to no longer require manual approval for PRs from first time contributors. Changes the github event from pull_request to pull_request_target and adds an explicit PR head checkout --- .github/workflows/stylua.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/stylua.yml b/.github/workflows/stylua.yml index e189fe01da2..5ec9dabacd2 100644 --- a/.github/workflows/stylua.yml +++ b/.github/workflows/stylua.yml @@ -1,6 +1,6 @@ # Check Lua Formatting name: Check Lua Formatting -on: pull_request +on: pull_request_target jobs: stylua-check: @@ -9,6 +9,8 @@ jobs: steps: - name: Checkout Code uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} - name: Stylua Check uses: JohnnyMorganz/stylua-action@v3 with: From 0550903c11017b09b841a6c2659990d9d2dd16c3 Mon Sep 17 00:00:00 2001 From: Mohamad Alamin Yassin Date: Mon, 8 Jan 2024 20:17:01 +0300 Subject: [PATCH 126/480] Add Missing Fields to Treesitter Config to Resolve Warnings (#582) This commit introduces three additional fields - `sync_install`, `ignore_install`, and `modules` - to the Treesitter configuration. This update is aimed at resolving warnings that were previously displayed, potentially causing confusion or frustration for new users of Neovim. By explicitly defining these fields, the configuration aligns better with the latest `nvim-treesitter` requirements. --- init.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 7e68de67481..dd9ef7b9e7b 100644 --- a/init.lua +++ b/init.lua @@ -427,7 +427,14 @@ vim.defer_fn(function() -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, - + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) + auto_install = false, + -- Install languages synchronously (only applied to `ensure_installed`) + sync_install = false, + -- List of parsers to ignore installing + ignore_install = {}, + -- You can specify additional Treesitter modules here: -- For example: -- playground = {--enable = true,-- }, + modules = {}, highlight = { enable = true }, indent = { enable = true }, incremental_selection = { From 3acb368f2c15d6f8eac75050b07765be0d789220 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Mon, 8 Jan 2024 20:44:00 +0100 Subject: [PATCH 127/480] README.md: rename the duplicate "Introduction" to "Getting Started" (#572) Changing this second "Introduction" heading to "Getting Started" The recent change in README which moved the youtube link from FAQ to it's own section used the heading "Introduction" which is already the first heading in the file. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e1a4ee1991c..a4c6bd78683 100644 --- a/README.md +++ b/README.md @@ -71,9 +71,9 @@ If you would prefer to hide this step and run the plugin sync from the command l nvim --headless "+Lazy! sync" +qa ``` -### Introduction +### Getting Started -To get started, see [Effective Neovim: Instant IDE](https://youtu.be/stqUbv-5u2s), covering the previous version. Note: The install via init.lua is outdated, please follow the install instructions in this file instead. An updated video is coming soon. +See [Effective Neovim: Instant IDE](https://youtu.be/stqUbv-5u2s), covering the previous version. Note: The install via init.lua is outdated, please follow the install instructions in this file instead. An updated video is coming soon. ### Recommended Steps From 888f993e86607ed4a835cd14e5f34ecacc2339ff Mon Sep 17 00:00:00 2001 From: Sreejith I V <46400271+pzerone@users.noreply.github.com> Date: Wed, 10 Jan 2024 20:06:33 +0530 Subject: [PATCH 128/480] Removed duplicate line (#583) --- init.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/init.lua b/init.lua index dd9ef7b9e7b..1ff16af54b7 100644 --- a/init.lua +++ b/init.lua @@ -425,8 +425,6 @@ vim.defer_fn(function() -- Add languages to be installed here that you want installed for treesitter ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, - -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) - auto_install = false, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, -- Install languages synchronously (only applied to `ensure_installed`) From 5b2ff0fb9ced5f2b70011be5fdf527091ff049cd Mon Sep 17 00:00:00 2001 From: Victor Bertin <83238030+v-bertin@users.noreply.github.com> Date: Mon, 29 Jan 2024 13:48:14 +0100 Subject: [PATCH 129/480] Set status line theme to the global colorscheme (#600) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 1ff16af54b7..3694bc03883 100644 --- a/init.lua +++ b/init.lua @@ -205,7 +205,7 @@ require('lazy').setup({ opts = { options = { icons_enabled = false, - theme = 'onedark', + theme = 'auto', component_separators = '|', section_separators = '', }, From 2868d5e65cbe17cc34cc48e8c654522174a03952 Mon Sep 17 00:00:00 2001 From: Nazar <63452145+Tokarak@users.noreply.github.com> Date: Mon, 29 Jan 2024 18:52:50 +0000 Subject: [PATCH 130/480] Add Onedark Style (#590) * Add style options to Onedark setup (init.lua) * stylua init.lua * Load onedark through `require` * Improve commenting --- init.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 3694bc03883..6c6ae020bcd 100644 --- a/init.lua +++ b/init.lua @@ -193,8 +193,13 @@ require('lazy').setup({ -- Theme inspired by Atom 'navarasu/onedark.nvim', priority = 1000, + lazy = false, config = function() - vim.cmd.colorscheme 'onedark' + require('onedark').setup { + -- Set a style preset. 'dark' is default. + style = 'dark', -- dark, darker, cool, deep, warm, warmer, light + } + require('onedark').load() end, }, From 0fcfe12789d949b82a83d989df2373a943c4b858 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Thu, 1 Feb 2024 17:01:46 +0100 Subject: [PATCH 131/480] issue: #594 stylua workflow only on official kickstart repo (#609) Only run the github stylua workflow check on the official kickstart repo (nvim-lua/kickstart.nvim) so that it's not enforced on any other forks. As suggested by: @zwergius --- .github/workflows/stylua.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/stylua.yml b/.github/workflows/stylua.yml index 5ec9dabacd2..75db6c3355b 100644 --- a/.github/workflows/stylua.yml +++ b/.github/workflows/stylua.yml @@ -4,6 +4,7 @@ on: pull_request_target jobs: stylua-check: + if: github.repository == 'nvim-lua/kickstart.nvim' name: Stylua Check runs-on: ubuntu-latest steps: From eb0a425bed00d3e1d95836b9c4c47f3cbb1a315e Mon Sep 17 00:00:00 2001 From: Micah Effiong <52747707+micaiah-effiong@users.noreply.github.com> Date: Fri, 2 Feb 2024 21:24:46 +0100 Subject: [PATCH 132/480] feat: added contexts for code action - source fix-all errors (#599) * feat: added contexts for code action - source fix-all errors * fix: resolve stylua checks * fix: resolve stylua checks --- init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 6c6ae020bcd..c7e64006143 100644 --- a/init.lua +++ b/init.lua @@ -514,7 +514,9 @@ local on_attach = function(_, bufnr) end nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') - nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + nmap('ca', function() + vim.lsp.buf.code_action { context = { only = { 'quickfix', 'refactor', 'source' } } } + end, '[C]ode [A]ction') nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') From a6614a4629ffaea1aa89acb49bf14fded669eb90 Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Sat, 3 Feb 2024 19:15:25 -0500 Subject: [PATCH 133/480] Fixes #607. Add hints for new neovim users to learn how to learn. (#615) --- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/README.md b/README.md index a4c6bd78683..b7fe337a600 100644 --- a/README.md +++ b/README.md @@ -192,3 +192,55 @@ This requires: {'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } ``` +### Hints And Tips For New Neovimmers + +Neovim is a very rich and powerful environment, but it can also feel a bit +intimidating for new users trying to find their way around, especially if +they're coming from other environments like Visual Studio Code or a traditional +IDE. + +There's no way this README can provide you with everything you need to know, but +here are a few tips so you can learn how to learn. + +### Use The Help, Luke! + +Neovim's help system is incredibly thorough and extensive. You should really +take a moment to get comfortable navigating through help topics, going back and +forth, navigating the menus, etc. This won't just help you read the help, it +will empower you in the rest of your Neovim journey. + +You can double click on a topic to drill down, and hit Ctrl-o (Hold down the +Control key and the 'o' key) to go back. + +Read the first page you get when you run :help carefully. it will serve you +well. + +You can also get help on a particular thing by typing ":help ". + +Like, let's say we want to learn more about folding, just type ":help folding". + +### To The Telescope! + +One of the more powerful features you get by installing this project is the +brilliant Telescope plugin co-written by @tjdevries. + +Take a minute to browse through ":help telescope" and get a sense for all the +amazing superpowers you've gained. + +In particular, there are two Telescope features that are incredible for helping +you understand how to do a particular thing or how to configure a particular +feature. + +If you're not sure what to look for, try ":Telescope help_tags". Let's say we +want to configure Neovim to automatically word wrap. We might type ":Telescope +help_tags" and then type w, r, a, p. Notice how the list of results changes with +each new letter you type? When you're done you've got a screen full of topics +involving word wrap. + +Another common question is "What keys do I hit to make a thing happen?". To get +an answer, one way is to use ":Telescope keymaps". You'll get the same list of +results that changes to adapt with each new key you press. + +With these hints in mind you should be in good shape to get learning. Remember, +you are on a journey of discovery here, adapting your programming environment to +your needs. It will take effort, but the rewards are worth it! :) From 8f8acb5bd6e89b9938859195cc9b360eabc69872 Mon Sep 17 00:00:00 2001 From: rgarber11 Date: Mon, 5 Feb 2024 13:49:19 -0500 Subject: [PATCH 134/480] Add Build Step to LuaSnip (#611) --- init.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index c7e64006143..fd4567d902b 100644 --- a/init.lua +++ b/init.lua @@ -100,7 +100,18 @@ require('lazy').setup({ 'hrsh7th/nvim-cmp', dependencies = { -- Snippet Engine & its associated nvim-cmp source - 'L3MON4D3/LuaSnip', + { + 'L3MON4D3/LuaSnip', + build = (function() + -- Build Step is needed for regex support in snippets + -- This step is not supported in many windows environments + -- Remove the below condition to re-enable on windows + if vim.fn.has 'win32' == 1 then + return + end + return 'make install_jsregexp' + end)(), + }, 'saadparwaiz1/cmp_luasnip', -- Adds LSP completion capabilities From 28fa1810e65ad8dd31f8fe8486992ef416c98d4c Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Mon, 26 Feb 2024 10:03:53 -0500 Subject: [PATCH 135/480] rewrite: slimmer, trimmer and more lazy kickstart.nvim (#635) We've removed over 1/3 of the code that was in kickstart previously, and more than doubled the amount of comments explaining every line of code (to the best of my ability). kickstart now properly uses many of the lazy.nvim config and loading idioms, which should be really helpful for people moving both to modular configs, as well as extending the kickstart config in one file. Additional features: - Beautiful ascii art - Added some documentation that explains what is an LSP, what is telescope, etc - There is now a `:checkhealth` for kickstart, which checks some basic information and adds useful information for maintainers (for people cloning the repo). - Improved LSP configuration and tool installation, for easier first time startup - Changed init.lua ordering, so that it moves from simple options to complicated config ``` ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- Lua 1 108 404 298 ------------------------------------------------------------------------------- ``` --- .gitignore | 3 + README.md | 158 +-- init.lua | 1314 ++++++++++++++----------- lua/kickstart/health.lua | 51 + lua/kickstart/plugins/autoformat.lua | 74 -- lua/kickstart/plugins/indent_line.lua | 9 + 6 files changed, 836 insertions(+), 773 deletions(-) create mode 100644 lua/kickstart/health.lua delete mode 100644 lua/kickstart/plugins/autoformat.lua create mode 100644 lua/kickstart/plugins/indent_line.lua diff --git a/.gitignore b/.gitignore index d699e1d68cc..005b535b606 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ tags test.sh .luarc.json nvim + +spell/ +lazy-lock.json diff --git a/README.md b/README.md index b7fe337a600..c9b9d84e87b 100644 --- a/README.md +++ b/README.md @@ -1,59 +1,73 @@ # kickstart.nvim -https://github.com/kdheepak/kickstart.nvim/assets/1813121/f3ff9a2b-c31f-44df-a4fa-8a0d7b17cf7b - -### Introduction +## Introduction A starting point for Neovim that is: * Small -* Single-file (with examples of moving to multi-file) -* Documented -* Modular +* Single-file +* Completely Documented + +**NOT** a Neovim distribution, but instead a starting point for your configuration. -This repo is meant to be used by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss. +## Installation -Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions. +### Install Neovim -Distribution Alternatives: -- [LazyVim](https://www.lazyvim.org/): A delightful distribution maintained by @folke (the author of lazy.nvim, the package manager used here) +Kickstart.nvim targets *only* the latest +['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest +['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. +If you are experiencing issues, please make sure you have the latest versions. -### Installation +### Install External Dependencies > **NOTE** > [Backup](#FAQ) your previous configuration (if any exists) -Requirements: -* Make sure to review the readmes of the plugins if you are experiencing errors. In particular: - * [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. -* See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native` +External Requirements: +- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`) +- [ripgrep](https://github.com/BurntSushi/ripgrep#installation) +- Language Setup: + - If want to write Typescript, you need `npm` + - If want to write Golang, you will need `go` + - etc. + +> **NOTE** +> See [Windows Installation](#Windows-Installation) to double check any additional Windows notes Neovim's configurations are located under the following paths, depending on your OS: | OS | PATH | | :- | :--- | -| Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | -| MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | +| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | | Windows (cmd)| `%userprofile%\AppData\Local\nvim\` | | Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` | Clone kickstart.nvim: -- on Linux and Mac +
Linux and Mac + ```sh git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim ``` -- on Windows (cmd) +
+ +
Windows + +If you're using `cmd.exe`: + ``` git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ ``` -- on Windows (powershell) +If you're using `powershell.exe` + ``` git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\ ``` +
### Post Installation @@ -63,37 +77,33 @@ Start Neovim nvim ``` -The `Lazy` plugin manager will start automatically on the first run and install the configured plugins - as can be seen in the introduction video. After the installation is complete you can press `q` to close the `Lazy` UI and **you are ready to go**! Next time you run nvim `Lazy` will no longer show up. +That's it! Lazy will install all the plugins you have. Use `:Lazy` to view +current plugin status. -If you would prefer to hide this step and run the plugin sync from the command line, you can use: - -```sh -nvim --headless "+Lazy! sync" +qa -``` +Read through the `init.lua` file in your configuration folder for more +information about extending and exploring Neovim. ### Getting Started -See [Effective Neovim: Instant IDE](https://youtu.be/stqUbv-5u2s), covering the previous version. Note: The install via init.lua is outdated, please follow the install instructions in this file instead. An updated video is coming soon. +See [Effective Neovim: Instant IDE](https://youtu.be/stqUbv-5u2s), covering the +previous version. Note: The install via init.lua is outdated, please follow the +install instructions in this file instead. An updated video is coming soon. ### Recommended Steps -[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo (so that you have your own copy that you can modify) and then installing you can install to your machine using the methods above. +[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo +(so that you have your own copy that you can modify) and then installing you +can install to your machine using the methods above. > **NOTE** > Your fork's url will be something like this: `https://github.com//kickstart.nvim.git` -### Configuration And Extension - -* Inside of your copy, feel free to modify any file you like! It's your copy! -* Feel free to change any of the default options in `init.lua` to better suit your needs. -* For adding plugins, there are 3 primary options: - * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` (uncomment the line importing the `custom/plugins` directory in the `init.lua` file to enable this) - * Modify `init.lua` with additional plugins. - * Include the `lua/kickstart/plugins/*` files in your configuration. +#### Examples of adding popularly requested plugins -You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration. +
+ Adding autopairs -#### Example: Adding an autopairs plugin +This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs) and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim). In the file: `lua/custom/plugins/autopairs.lua`, add: @@ -117,10 +127,11 @@ return { } ``` +
+
+ Adding a file tree plugin -This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs) and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim). - -#### Example: Adding a file tree plugin +This will install the tree plugin and add the command `:Neotree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information. In the file: `lua/custom/plugins/filetree.lua`, add: @@ -142,23 +153,13 @@ return { } ``` -This will install the tree plugin and add the command `:Neotree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information. - -### Contribution - -Pull-requests are welcome. The goal of this repo is not to create a Neovim configuration framework, but to offer a starting template that shows, by example, available features in Neovim. Some things that will not be included: - -* Custom language server configuration (null-ls templates) -* Theming beyond a default colorscheme necessary for LSP highlight groups - -Each PR, especially those which increase the line count, should have a description as to why the PR is necessary. +
### FAQ * What should I do if I already have a pre-existing neovim configuration? * You should back it up, then delete all files associated with it. * This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` - * You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide) * Can I keep my existing configuration in parallel to kickstart? * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example you can install the kickstart configuration in `~/.config/nvim-kickstart` and create an alias: ``` @@ -191,56 +192,3 @@ This requires: ```lua {'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } ``` - -### Hints And Tips For New Neovimmers - -Neovim is a very rich and powerful environment, but it can also feel a bit -intimidating for new users trying to find their way around, especially if -they're coming from other environments like Visual Studio Code or a traditional -IDE. - -There's no way this README can provide you with everything you need to know, but -here are a few tips so you can learn how to learn. - -### Use The Help, Luke! - -Neovim's help system is incredibly thorough and extensive. You should really -take a moment to get comfortable navigating through help topics, going back and -forth, navigating the menus, etc. This won't just help you read the help, it -will empower you in the rest of your Neovim journey. - -You can double click on a topic to drill down, and hit Ctrl-o (Hold down the -Control key and the 'o' key) to go back. - -Read the first page you get when you run :help carefully. it will serve you -well. - -You can also get help on a particular thing by typing ":help ". - -Like, let's say we want to learn more about folding, just type ":help folding". - -### To The Telescope! - -One of the more powerful features you get by installing this project is the -brilliant Telescope plugin co-written by @tjdevries. - -Take a minute to browse through ":help telescope" and get a sense for all the -amazing superpowers you've gained. - -In particular, there are two Telescope features that are incredible for helping -you understand how to do a particular thing or how to configure a particular -feature. - -If you're not sure what to look for, try ":Telescope help_tags". Let's say we -want to configure Neovim to automatically word wrap. We might type ":Telescope -help_tags" and then type w, r, a, p. Notice how the list of results changes with -each new letter you type? When you're done you've got a screen full of topics -involving word wrap. - -Another common question is "What keys do I hit to make a thing happen?". To get -an answer, one way is to use ":Telescope keymaps". You'll get the same list of -results that changes to adapt with each new key you press. - -With these hints in mind you should be in good shape to get learning. Remember, -you are on a journey of discovery here, adapting your programming environment to -your needs. It will take effort, but the rewards are worth it! :) diff --git a/init.lua b/init.lua index fd4567d902b..0d19b081263 100644 --- a/init.lua +++ b/init.lua @@ -3,101 +3,627 @@ ===================================================================== ==================== READ THIS BEFORE CONTINUING ==================== ===================================================================== +======== .-----. ======== +======== .----------------------. | === | ======== +======== |.-""""""""""""""""""-.| |-----| ======== +======== || || | === | ======== +======== || KICKSTART.NVIM || |-----| ======== +======== || || | === | ======== +======== || || |-----| ======== +======== ||:Tutor || |:::::| ======== +======== |'-..................-'| |____o| ======== +======== `"")----------------(""` ___________ ======== +======== /::::::::::| |::::::::::\ \ no mouse \ ======== +======== /:::========| |==hjkl==:::\ \ required \ ======== +======== '""""""""""""' '""""""""""""' '""""""""""' ======== +======== ======== +===================================================================== +===================================================================== -Kickstart.nvim is *not* a distribution. - -Kickstart.nvim is a template for your own configuration. - The goal is that you can read every line of code, top-to-bottom, understand - what your configuration is doing, and modify it to suit your needs. +What is Kickstart? - Once you've done that, you should start exploring, configuring and tinkering to - explore Neovim! + Kickstart.nvim is *not* a distribution. - If you don't know anything about Lua, I recommend taking some time to read through - a guide. One possible example: - - https://learnxinyminutes.com/docs/lua/ + Kickstart.nvim is a starting point for your own configuration. + The goal is that you can read every line of code, top-to-bottom, understand + what your configuration is doing, and modify it to suit your needs. + Once you've done that, you can start exploring, configuring and tinkering to + make Neovim your own! That might mean leaving kickstart just the way it is for a while + or immediately breaking it into modular pieces. It's up to you! - And then you can explore or search through `:help lua-guide` - - https://neovim.io/doc/user/lua-guide.html + If you don't know anything about Lua, I recommend taking some time to read through + a guide. One possible example which will only take 10-15 minutes: + - https://learnxinyminutes.com/docs/lua/ + After understanding a bit more about Lua, you can use `:help lua-guide` as a + reference for how Neovim integrates Lua. + - :help lua-guide + - (or HTML version): https://neovim.io/doc/user/lua-guide.html Kickstart Guide: -I have left several `:help X` comments throughout the init.lua -You should run that command and read that help section for more information. + TODO: The very first thing you should do is to run the command `:Tutor` in Neovim. + + If you don't know what this means, type the following: + - + - : + - Tutor + - + + (If you already know how the Neovim basics, you can skip this step) + + Once you've completed that, you can continue working through **AND READING** the rest + of the kickstart init.lua + + Next, run AND READ `:help`. + This will open up a help window with some basic information + about reading, navigating and searching the builtin help documentation. + + This should be the first place you go to look when you're stuck or confused + with something. It's one of my favorite neovim features. -In addition, I have some `NOTE:` items throughout the file. -These are for you, the reader to help understand what is happening. Feel free to delete -them once you know what you're doing, but they should serve as a guide for when you -are first encountering a few different constructs in your nvim config. + MOST IMPORTANTLY, we provide a keymap "sh" to [s]earch the [h]elp documentation, + which is very useful when you're not sure exactly what you're looking for. + + I have left several `:help X` comments throughout the init.lua + These are hints about where to find more information about the relevant settings, + plugins or neovim features used in kickstart. + + NOTE: Look for lines like this + + Throughout the file. These are for you, the reader, to help understand what is happening. + Feel free to delete them once you know what you're doing, but they should serve as a guide + for when you are first encountering a few different constructs in your nvim config. + +If you experience any errors while trying to install kickstart, run `:checkhealth` for more info I hope you enjoy your Neovim journey, - TJ -P.S. You can delete this when you're done too. It's your config now :) +P.S. You can delete this when you're done too. It's your config now! :) --]] -- Set as the leader key -- See `:help mapleader` --- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) +-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' +-- [[ Setting options ]] +-- See `:help vim.opt` +-- NOTE: You can change these options as you wish! +-- For more options, you can see `:help option-list` + +-- Make line numbers default +vim.opt.number = true +-- You can also add relative line numbers, for help with jumping. +-- Experiment for yourself to see if you like it! +-- vim.opt.relativenumber = true + +-- Enable mouse mode, can be useful for resizing splits for example! +vim.opt.mouse = 'a' + +-- Don't show the mode, since it's already in status line +vim.opt.showmode = false + +-- Sync clipboard between OS and Neovim. +-- Remove this option if you want your OS clipboard to remain independent. +-- See `:help 'clipboard'` +vim.opt.clipboard = 'unnamedplus' + +-- Enable break indent +vim.opt.breakindent = true + +-- Save undo history +vim.opt.undofile = true + +-- Case-insensitive searching UNLESS \C or capital in search +vim.opt.ignorecase = true +vim.opt.smartcase = true + +-- Keep signcolumn on by default +vim.opt.signcolumn = 'yes' + +-- Decrease update time +vim.opt.updatetime = 250 +vim.opt.timeoutlen = 300 + +-- Configure how new splits should be opened +vim.opt.splitright = true +vim.opt.splitbelow = true + +-- Sets how neovim will display certain whitespace in the editor. +-- See :help 'list' +-- and :help 'listchars' +vim.opt.list = true +vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } + +-- Preview substitutions live, as you type! +vim.opt.inccommand = 'split' + +-- Show which line your cursor is on +vim.opt.cursorline = true + +-- Minimal number of screen lines to keep above and below the cursor. +vim.opt.scrolloff = 10 + +-- [[ Basic Keymaps ]] +-- See `:help vim.keymap.set()` + +-- Set highlight on search, but clear on pressing in normal mode +vim.opt.hlsearch = true +vim.keymap.set('n', '', 'nohlsearch') + +-- Diagnostic keymaps +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' }) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' }) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' }) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) + +-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier +-- for people to discover. Otherwise, you normally need to press , which +-- is not what someone will guess without a bit more experience. +-- +-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping +-- or just use to exit terminal mode +vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) + +-- TIP: Disable arrow keys in normal mode +-- vim.keymap.set('n', '', 'echo "Use h to move!!"') +-- vim.keymap.set('n', '', 'echo "Use l to move!!"') +-- vim.keymap.set('n', '', 'echo "Use k to move!!"') +-- vim.keymap.set('n', '', 'echo "Use j to move!!"') + +-- Keybinds to make split navigation easier. +-- Use CTRL+ to switch between windows +-- +-- See `:help wincmd` for a list of all window commands +vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) + +-- Highlight when yanking (copying) text +-- Try it with `yap` in normal mode +-- See `:help vim.highlight.on_yank()` +vim.api.nvim_create_autocmd('TextYankPost', { + group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) + -- [[ Install `lazy.nvim` plugin manager ]] --- https://github.com/folke/lazy.nvim --- `:help lazy.nvim.txt` for more info +-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not vim.loop.fs_stat(lazypath) then - vim.fn.system { - 'git', - 'clone', - '--filter=blob:none', - 'https://github.com/folke/lazy.nvim.git', - '--branch=stable', -- latest stable release - lazypath, - } -end + local lazyrepo = 'https://github.com/folke/lazy.nvim.git' + vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } +end ---@diagnostic disable-next-line: undefined-field vim.opt.rtp:prepend(lazypath) --- [[ Configure plugins ]] --- NOTE: Here is where you install your plugins. --- You can configure plugins using the `config` key. +-- [[ Configure and install plugins ]] +-- +-- To check the current status of your plugins, run +-- :Lazy -- --- You can also configure plugins after the setup call, --- as they will be available in your neovim runtime. +-- You can press `?` in this menu for help. Use `:q` to close the window +-- +-- To update plugins, you can run +-- :Lazy update +-- +-- NOTE: Here is where you install your plugins. require('lazy').setup({ - -- NOTE: First, some plugins that don't require any configuration - -- Git related plugins - 'tpope/vim-fugitive', - 'tpope/vim-rhubarb', + -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). + 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically - -- Detect tabstop and shiftwidth automatically - 'tpope/vim-sleuth', + -- NOTE: Plugins can also be added by using a table, + -- with the first argument being the link and the following + -- keys can be used to configure plugin behavior/loading/etc. + -- + -- Use `opts = {}` to force a plugin to be loaded. + -- + -- This is equivalent to: + -- require('Comment').setup({}) - -- NOTE: This is where your plugins related to LSP can be installed. - -- The configuration is done below. Search for lspconfig to find it below. - { - -- LSP Configuration & Plugins + -- "gc" to comment visual regions/lines + { 'numToStr/Comment.nvim', opts = {} }, + + -- Here is a more advanced example where we pass configuration + -- options to `gitsigns.nvim`. This is equivalent to the following lua: + -- require('gitsigns').setup({ ... }) + -- + -- See `:help gitsigns` to understand what the configuration keys do + { -- Adds git related signs to the gutter, as well as utilities for managing changes + 'lewis6991/gitsigns.nvim', + opts = { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + }, + }, + + -- NOTE: Plugins can also be configured to run lua code when they are loaded. + -- + -- This is often very useful to both group configuration, as well as handle + -- lazy loading plugins that don't need to be loaded immediately at startup. + -- + -- For example, in the following configuration, we use: + -- event = 'VeryLazy' + -- + -- which loads which-key after all the UI elements are loaded. Events can be + -- normal autocommands events (:help autocomd-events). + -- + -- Then, because we use the `config` key, the configuration only runs + -- after the plugin has been loaded: + -- config = function() ... end + + { -- Useful plugin to show you pending keybinds. + 'folke/which-key.nvim', + event = 'VeryLazy', -- Sets the loading event to 'VeryLazy' + config = function() -- This is the function that runs, AFTER loading + require('which-key').setup() + + -- Document existing key chains + require('which-key').register { + ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, + ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, + ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, + ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, + ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, + } + end, + }, + + -- NOTE: Plugins can specify dependencies. + -- + -- The dependencies are proper plugin specifications as well - anything + -- you do for a plugin at the top level, you can do for a dependency. + -- + -- Use the `dependencies` key to specify the dependencies of a particular plugin + + { -- Fuzzy Finder (files, lsp, etc) + 'nvim-telescope/telescope.nvim', + event = 'VeryLazy', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + { -- If encountering errors, see telescope-fzf-native README for install instructions + 'nvim-telescope/telescope-fzf-native.nvim', + + -- `build` is used to run some command when the plugin is installed/updated. + -- This is only run then, not every time Neovim starts up. + build = 'make', + + -- `cond` is a condition used to determine whether this plugin should be + -- installed and loaded. + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, + { 'nvim-telescope/telescope-ui-select.nvim' }, + + -- Useful for getting pretty icons, but requires special font. + -- If you already have a Nerd Font, or terminal set up with fallback fonts + -- you can enable this + -- { 'nvim-tree/nvim-web-devicons' } + }, + config = function() + -- Telescope is a fuzzy finder that comes with a lot of different things that + -- it can fuzzy find! It's more than just a "file finder", it can search + -- many different aspects of Neovim, your workspace, LSP, and more! + -- + -- The easiest way to use telescope, is to start by doing something like: + -- :Telescope help_tags + -- + -- After running this command, a window will open up and you're able to + -- type in the prompt window. You'll see a list of help_tags options and + -- a corresponding preview of the help. + -- + -- Two important keymaps to use while in telescope are: + -- - Insert mode: + -- - Normal mode: ? + -- + -- This opens a window that shows you all of the keymaps for the current + -- telescope picker. This is really useful to discover what Telescope can + -- do as well as how to actually do it! + + -- [[ Configure Telescope ]] + -- See `:help telescope` and `:help telescope.setup()` + require('telescope').setup { + -- You can put your default mappings / updates / etc. in here + -- All the info you're looking for is in `:help telescope.setup()` + -- + -- defaults = { + -- mappings = { + -- i = { [''] = 'to_fuzzy_refine' }, + -- }, + -- }, + -- pickers = {} + extensions = { + ['ui-select'] = { + require('telescope.themes').get_dropdown(), + }, + }, + } + + -- Enable telescope extensions, if they are installed + pcall(require('telescope').load_extension, 'fzf') + pcall(require('telescope').load_extension, 'ui-select') + + -- See `:help telescope.builtin` + local builtin = require 'telescope.builtin' + vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) + vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) + vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) + vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) + vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) + vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) + vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) + vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) + vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) + vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + + -- Slightly advanced example of overriding default behavior and theme + vim.keymap.set('n', '/', function() + -- You can pass additional configuration to telescope to change theme, layout, etc. + builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) + end, { desc = '[/] Fuzzily search in current buffer' }) + + -- Also possible to pass additional configuration options. + -- See `:help telescope.builtin.live_grep()` for information about particular keys + vim.keymap.set('n', 's/', function() + builtin.live_grep { + grep_open_files = true, + prompt_title = 'Live Grep in Open Files', + } + end, { desc = '[S]earch [/] in Open Files' }) + + -- Shortcut for searching your neovim configuration files + vim.keymap.set('n', 'sn', function() + builtin.find_files { cwd = vim.fn.stdpath 'config' } + end, { desc = '[S]earch [N]eovim files' }) + end, + }, + + { -- LSP Configuration & Plugins 'neovim/nvim-lspconfig', dependencies = { - -- Automatically install LSPs to stdpath for neovim - { 'williamboman/mason.nvim', config = true }, + -- Automatically install LSPs and related tools to stdpath for neovim + 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim', + 'WhoIsSethDaniel/mason-tool-installer.nvim', - -- Useful status updates for LSP + -- Useful status updates for LSP. -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` { 'j-hui/fidget.nvim', opts = {} }, + }, + config = function() + -- Brief Aside: **What is LSP?** + -- + -- LSP is an acronym you've probably heard, but might not understand what it is. + -- + -- LSP stands for Language Server Protocol. It's a protocol that helps editors + -- and language tooling communicate in a standardized fashion. + -- + -- In general, you have a "server" which is some tool built to understand a particular + -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc). These Language Servers + -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone + -- processes that communicate with some "client" - in this case, Neovim! + -- + -- LSP provides Neovim with features like: + -- - Go to definition + -- - Find references + -- - Autocompletion + -- - Symbol Search + -- - and more! + -- + -- Thus, Language Servers are external tools that must be installed separately from + -- Neovim. This is where `mason` and related plugins come into play. + -- + -- If you're wondering about lsp vs treesitter, you can check out the wonderfully + -- and elegantly composed help section, :help lsp-vs-treesitter + + -- This function gets run when an LSP attaches to a particular buffer. + -- That is to say, every time a new file is opened that is associated with + -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this + -- function will be executed to configure the current buffer + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), + callback = function(event) + -- NOTE: Remember that lua is a real programming language, and as such it is possible + -- to define small helper and utility functions so you don't have to repeat yourself + -- many times. + -- + -- In this case, we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. + local map = function(keys, func, desc) + vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end + + -- Jump to the definition of the word under your cursor. + -- This is where a variable was first declared, or where a function is defined, etc. + -- To jump back, press . + map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + + -- Find references for the word under your cursor. + map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + + -- Jump to the implementation of the word under your cursor. + -- Useful when your language has ways of declaring types without an actual implementation. + map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + + -- Jump to the type of the word under your cursor. + -- Useful when you're not sure what type a variable is and you want to see + -- the definition of its *type*, not where it was *defined*. + map('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') + + -- Fuzzy find all the symbols in your current document. + -- Symbols are things like variables, functions, types, etc. + map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + + -- Fuzzy find all the symbols in your current workspace + -- Similar to document symbols, except searches over your whole project. + map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + + -- Rename the variable under your cursor + -- Most Language Servers support renaming across files, etc. + map('rn', vim.lsp.buf.rename, '[R]e[n]ame') + + -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. + map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + + -- Opens a popup that displays documentation about the word under your cursor + -- See `:help K` for why this keymap + map('K', vim.lsp.buf.hover, 'Hover Documentation') + + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header + map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + + -- The following two autocommands are used to highlight references of the + -- word under your cursor when your cursor rests there for a little while. + -- See `:help CursorHold` for information about when this is executed + -- + -- When you move your cursor, the highlights will be cleared (the second autocommand). + local client = vim.lsp.get_client_by_id(event.data.client_id) + if client and client.server_capabilities.documentHighlightProvider then + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + buffer = event.buf, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + buffer = event.buf, + callback = vim.lsp.buf.clear_references, + }) + end + end, + }) + + -- LSP servers and clients are able to communicate to each other what features they support. + -- By default, Neovim doesn't support everything that is in the LSP Specification. + -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. + -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers. + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) + + -- Enable the following language servers + -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. + -- + -- Add any additional override configuration in the following tables. Available keys are: + -- - cmd (table): Override the default command used to start the server + -- - filetypes (table): Override the default list of associated filetypes for the server + -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. + -- - settings (table): Override the default settings passed when initializing the server. + -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ + local servers = { + -- clangd = {}, + -- gopls = {}, + -- pyright = {}, + -- rust_analyzer = {}, + -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs + -- + -- Some languages (like typescript) have entire language plugins that can be useful: + -- https://github.com/pmizio/typescript-tools.nvim + -- + -- But for many setups, the LSP (`tsserver`) will work just fine + -- tsserver = {}, + -- + + lua_ls = { + -- cmd = {...}, + -- filetypes { ...}, + -- capabilities = {}, + settings = { + Lua = { + runtime = { version = 'LuaJIT' }, + workspace = { + checkThirdParty = false, + -- Tells lua_ls where to find all the Lua files that you have loaded + -- for your neovim configuration. + library = { + '${3rd}/luv/library', + unpack(vim.api.nvim_get_runtime_file('', true)), + }, + -- If lua_ls is really slow on your computer, you can try this instead: + -- library = { vim.env.VIMRUNTIME }, + }, + -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings + -- diagnostics = { disable = { 'missing-fields' } }, + }, + }, + }, + } + + -- 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 + -- :Mason + -- + -- You can press `g?` for help in this menu + require('mason').setup() + + -- You can add other tools here that you want Mason to install + -- for you, so that they are available from within Neovim. + local ensure_installed = vim.tbl_keys(servers or {}) + vim.list_extend(ensure_installed, { + 'stylua', -- Used to format lua code + }) + require('mason-tool-installer').setup { ensure_installed = ensure_installed } + + require('mason-lspconfig').setup { + handlers = { + function(server_name) + local server = servers[server_name] or {} + require('lspconfig')[server_name].setup { + cmd = server.cmd, + settings = server.settings, + filetypes = server.filetypes, + -- This handles overriding only values explicitly passed + -- by the server configuration above. Useful when disabling + -- certain features of an LSP (for example, turning off formatting for tsserver) + capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}), + } + end, + }, + } + end, + }, - -- Additional lua configuration, makes nvim stuff amazing! - 'folke/neodev.nvim', + { -- Autoformat + 'stevearc/conform.nvim', + opts = { + notify_on_error = false, + format_on_save = { + timeout_ms = 500, + lsp_fallback = true, + }, + formatters_by_ft = { + lua = { 'stylua' }, + -- Conform can also run multiple formatters sequentially + -- python = { "isort", "black" }, + -- + -- You can use a sub-list to tell conform to run *until* a formatter + -- is found. + -- javascript = { { "prettierd", "prettier" } }, + }, }, }, - { - -- Autocompletion + { -- Autocompletion 'hrsh7th/nvim-cmp', + event = 'InsertEnter', dependencies = { -- Snippet Engine & its associated nvim-cmp source { @@ -106,7 +632,7 @@ require('lazy').setup({ -- Build Step is needed for regex support in snippets -- This step is not supported in many windows environments -- Remove the below condition to re-enable on windows - if vim.fn.has 'win32' == 1 then + if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then return end return 'make install_jsregexp' @@ -114,571 +640,171 @@ require('lazy').setup({ }, 'saadparwaiz1/cmp_luasnip', - -- Adds LSP completion capabilities + -- Adds other completion capabilities. + -- nvim-cmp does not ship with all sources by default. They are split + -- into multiple repos for maintenance purposes. 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-path', - -- Adds a number of user-friendly snippets - 'rafamadriz/friendly-snippets', - }, - }, - - -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, - { - -- Adds git related signs to the gutter, as well as utilities for managing changes - 'lewis6991/gitsigns.nvim', - opts = { - -- See `:help gitsigns.txt` - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, - on_attach = function(bufnr) - local gs = package.loaded.gitsigns - - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end - - -- Navigation - map({ 'n', 'v' }, ']c', function() - if vim.wo.diff then - return ']c' - end - vim.schedule(function() - gs.next_hunk() - end) - return '' - end, { expr = true, desc = 'Jump to next hunk' }) - - map({ 'n', 'v' }, '[c', function() - if vim.wo.diff then - return '[c' - end - vim.schedule(function() - gs.prev_hunk() - end) - return '' - end, { expr = true, desc = 'Jump to previous hunk' }) - - -- Actions - -- visual mode - map('v', 'hs', function() - gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'stage git hunk' }) - map('v', 'hr', function() - gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'reset git hunk' }) - -- normal mode - map('n', 'hs', gs.stage_hunk, { desc = 'git stage hunk' }) - map('n', 'hr', gs.reset_hunk, { desc = 'git reset hunk' }) - map('n', 'hS', gs.stage_buffer, { desc = 'git Stage buffer' }) - map('n', 'hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' }) - map('n', 'hR', gs.reset_buffer, { desc = 'git Reset buffer' }) - map('n', 'hp', gs.preview_hunk, { desc = 'preview git hunk' }) - map('n', 'hb', function() - gs.blame_line { full = false } - end, { desc = 'git blame line' }) - map('n', 'hd', gs.diffthis, { desc = 'git diff against index' }) - map('n', 'hD', function() - gs.diffthis '~' - end, { desc = 'git diff against last commit' }) - - -- Toggles - map('n', 'tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' }) - map('n', 'td', gs.toggle_deleted, { desc = 'toggle git show deleted' }) - - -- Text object - map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'select git hunk' }) - end, + -- If you want to add a bunch of pre-configured snippets, + -- you can use this plugin to help you. It even has snippets + -- for various frameworks/libraries/etc. but you will have to + -- set up the ones that are useful for you. + -- 'rafamadriz/friendly-snippets', }, - }, - - { - -- Theme inspired by Atom - 'navarasu/onedark.nvim', - priority = 1000, - lazy = false, config = function() - require('onedark').setup { - -- Set a style preset. 'dark' is default. - style = 'dark', -- dark, darker, cool, deep, warm, warmer, light + -- See `:help cmp` + local cmp = require 'cmp' + local luasnip = require 'luasnip' + luasnip.config.setup {} + + cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + completion = { completeopt = 'menu,menuone,noinsert' }, + + -- For an understanding of why these mappings were + -- chosen, you will need to read `:help ins-completion` + -- + -- No, but seriously. Please read `:help ins-completion`, it is really good! + mapping = cmp.mapping.preset.insert { + -- Select the [n]ext item + [''] = cmp.mapping.select_next_item(), + -- Select the [p]revious item + [''] = cmp.mapping.select_prev_item(), + + -- Accept ([y]es) the completion. + -- This will auto-import if your LSP supports it. + -- This will expand snippets if the LSP sent a snippet. + [''] = cmp.mapping.confirm { select = true }, + + -- Manually trigger a completion from nvim-cmp. + -- Generally you don't need this, because nvim-cmp will display + -- completions whenever it has completion options available. + [''] = cmp.mapping.complete {}, + + -- Think of as moving to the right of your snippet expansion. + -- So if you have a snippet that's like: + -- function $name($args) + -- $body + -- end + -- + -- will move you to the right of each of the expansion locations. + -- is similar, except moving you backwards. + [''] = cmp.mapping(function() + if luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function() + if luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + end + end, { 'i', 's' }), + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'path' }, + }, } - require('onedark').load() end, }, - { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - -- See `:help lualine.txt` - opts = { - options = { - icons_enabled = false, - theme = 'auto', - component_separators = '|', - section_separators = '', - }, - }, - }, + { -- You can easily change to a different colorscheme. + -- Change the name of the colorscheme plugin below, and then + -- change the command in the config to whatever the name of that colorscheme is + -- + -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme` + 'folke/tokyonight.nvim', + lazy = false, -- make sure we load this during startup if it is your main colorscheme + priority = 1000, -- make sure to load this before all the other start plugins + config = function() + -- Load the colorscheme here + vim.cmd.colorscheme 'tokyonight-night' - { - -- Add indentation guides even on blank lines - 'lukas-reineke/indent-blankline.nvim', - -- Enable `lukas-reineke/indent-blankline.nvim` - -- See `:help ibl` - main = 'ibl', - opts = {}, + -- You can configure highlights by doing something like + vim.cmd.hi 'Comment gui=none' + end, }, - -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, + -- Highlight todo, notes, etc in comments + { 'folke/todo-comments.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, - -- Fuzzy Finder (files, lsp, etc) - { - 'nvim-telescope/telescope.nvim', - branch = '0.1.x', - dependencies = { - 'nvim-lua/plenary.nvim', - -- Fuzzy Finder Algorithm which requires local dependencies to be built. - -- Only load if `make` is available. Make sure you have the system - -- requirements installed. - { - 'nvim-telescope/telescope-fzf-native.nvim', - -- NOTE: If you are having trouble with this installation, - -- refer to the README for telescope-fzf-native for more instructions. - build = 'make', - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - }, + { -- Collection of various small independent plugins/modules + 'echasnovski/mini.nvim', + config = function() + -- Better Around/Inside textobjects + -- + -- Examples: + -- - va) - [V]isually select [A]round [)]parenthen + -- - yinq - [Y]ank [I]nside [N]ext [']quote + -- - ci' - [C]hange [I]nside [']quote + require('mini.ai').setup { n_lines = 500 } + + -- Add/delete/replace surroundings (brackets, quotes, etc.) + -- + -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren + -- - sd' - [S]urround [D]elete [']quotes + -- - sr)' - [S]urround [R]eplace [)] ['] + require('mini.surround').setup() + + -- Simple and easy statusline. + -- You could remove this setup call if you don't like it, + -- and try some other statusline plugin + require('mini.statusline').setup() + + -- ... and there is more! + -- Check out: https://github.com/echasnovski/mini.nvim + end, }, - { - -- Highlight, edit, and navigate code + { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', - dependencies = { - 'nvim-treesitter/nvim-treesitter-textobjects', - }, build = ':TSUpdate', + config = function() + -- [[ Configure Treesitter ]] See `:help nvim-treesitter` + + ---@diagnostic disable-next-line: missing-fields + require('nvim-treesitter.configs').setup { + ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' }, + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) + auto_install = true, + highlight = { enable = true }, + indent = { enable = true }, + } + + -- There are additional nvim-treesitter modules that you can use to interact + -- with nvim-treesitter. You should go explore a few and see what interests you: + -- + -- - Incremental selection: Included, see :help nvim-treesitter-incremental-selection-mod + -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context + -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects + end, }, - -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart - -- These are some example plugins that I've included in the kickstart repository. - -- Uncomment any of the lines below to enable them. - -- require 'kickstart.plugins.autoformat', + -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the + -- init.lua. If you want these files, they are in the repository, so you can just download them and + -- put them in the right spots if you want. + + -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for kickstart + -- + -- Here are some example plugins that I've included in the kickstart repository. + -- Uncomment any of the lines below to enable them (you will need to restart nvim). + -- -- require 'kickstart.plugins.debug', + -- require 'kickstart.plugins.indent_line', -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` - -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping - -- up-to-date with whatever is in the kickstart repo. - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. + -- This is the easiest way to modularize your config. -- - -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins + -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. + -- For additional information see: :help lazy.nvim-lazy.nvim-structuring-your-plugins -- { import = 'custom.plugins' }, }, {}) --- [[ Setting options ]] --- See `:help vim.o` --- NOTE: You can change these options as you wish! - --- Set highlight on search -vim.o.hlsearch = false - --- Make line numbers default -vim.wo.number = true - --- Enable mouse mode -vim.o.mouse = 'a' - --- Sync clipboard between OS and Neovim. --- Remove this option if you want your OS clipboard to remain independent. --- See `:help 'clipboard'` -vim.o.clipboard = 'unnamedplus' - --- Enable break indent -vim.o.breakindent = true - --- Save undo history -vim.o.undofile = true - --- Case-insensitive searching UNLESS \C or capital in search -vim.o.ignorecase = true -vim.o.smartcase = true - --- Keep signcolumn on by default -vim.wo.signcolumn = 'yes' - --- Decrease update time -vim.o.updatetime = 250 -vim.o.timeoutlen = 300 - --- Set completeopt to have a better completion experience -vim.o.completeopt = 'menuone,noselect' - --- NOTE: You should make sure your terminal supports this -vim.o.termguicolors = true - --- [[ Basic Keymaps ]] - --- Keymaps for better default experience --- See `:help vim.keymap.set()` -vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) - --- Remap for dealing with word wrap -vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) -vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) - --- Diagnostic keymaps -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) -vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) - --- [[ Highlight on yank ]] --- See `:help vim.highlight.on_yank()` -local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) -vim.api.nvim_create_autocmd('TextYankPost', { - callback = function() - vim.highlight.on_yank() - end, - group = highlight_group, - pattern = '*', -}) - --- [[ Configure Telescope ]] --- See `:help telescope` and `:help telescope.setup()` -require('telescope').setup { - defaults = { - mappings = { - i = { - [''] = false, - [''] = false, - }, - }, - }, -} - --- Enable telescope fzf native, if installed -pcall(require('telescope').load_extension, 'fzf') - --- Telescope live_grep in git root --- Function to find the git root directory based on the current buffer's path -local function find_git_root() - -- Use the current buffer's path as the starting point for the git search - local current_file = vim.api.nvim_buf_get_name(0) - local current_dir - local cwd = vim.fn.getcwd() - -- If the buffer is not associated with a file, return nil - if current_file == '' then - current_dir = cwd - else - -- Extract the directory from the current file's path - current_dir = vim.fn.fnamemodify(current_file, ':h') - end - - -- Find the Git root directory from the current file's path - local git_root = vim.fn.systemlist('git -C ' .. vim.fn.escape(current_dir, ' ') .. ' rev-parse --show-toplevel')[1] - if vim.v.shell_error ~= 0 then - print 'Not a git repository. Searching on current working directory' - return cwd - end - return git_root -end - --- Custom live_grep function to search in git root -local function live_grep_git_root() - local git_root = find_git_root() - if git_root then - require('telescope.builtin').live_grep { - search_dirs = { git_root }, - } - end -end - -vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {}) - --- See `:help telescope.builtin` -vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) -vim.keymap.set('n', '', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) -vim.keymap.set('n', '/', function() - -- You can pass additional configuration to telescope to change theme, layout, etc. - require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) -end, { desc = '[/] Fuzzily search in current buffer' }) - -local function telescope_live_grep_open_files() - require('telescope.builtin').live_grep { - grep_open_files = true, - prompt_title = 'Live Grep in Open Files', - } -end -vim.keymap.set('n', 's/', telescope_live_grep_open_files, { desc = '[S]earch [/] in Open Files' }) -vim.keymap.set('n', 'ss', require('telescope.builtin').builtin, { desc = '[S]earch [S]elect Telescope' }) -vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) -vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) -vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) -vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) -vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) -vim.keymap.set('n', 'sG', ':LiveGrepGitRoot', { desc = '[S]earch by [G]rep on Git Root' }) -vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) -vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) - --- [[ Configure Treesitter ]] --- See `:help nvim-treesitter` --- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}' -vim.defer_fn(function() - require('nvim-treesitter.configs').setup { - -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, - - -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) - auto_install = false, - -- Install languages synchronously (only applied to `ensure_installed`) - sync_install = false, - -- List of parsers to ignore installing - ignore_install = {}, - -- You can specify additional Treesitter modules here: -- For example: -- playground = {--enable = true,-- }, - modules = {}, - highlight = { enable = true }, - indent = { enable = true }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = '', - node_incremental = '', - scope_incremental = '', - node_decremental = '', - }, - }, - textobjects = { - select = { - enable = true, - lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ['aa'] = '@parameter.outer', - ['ia'] = '@parameter.inner', - ['af'] = '@function.outer', - ['if'] = '@function.inner', - ['ac'] = '@class.outer', - ['ic'] = '@class.inner', - }, - }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - [']m'] = '@function.outer', - [']]'] = '@class.outer', - }, - goto_next_end = { - [']M'] = '@function.outer', - [']['] = '@class.outer', - }, - goto_previous_start = { - ['[m'] = '@function.outer', - ['[['] = '@class.outer', - }, - goto_previous_end = { - ['[M'] = '@function.outer', - ['[]'] = '@class.outer', - }, - }, - swap = { - enable = true, - swap_next = { - ['a'] = '@parameter.inner', - }, - swap_previous = { - ['A'] = '@parameter.inner', - }, - }, - }, - } -end, 0) - --- [[ Configure LSP ]] --- This function gets run when an LSP connects to a particular buffer. -local on_attach = function(_, bufnr) - -- NOTE: Remember that lua is a real programming language, and as such it is possible - -- to define small helper and utility functions so you don't have to repeat yourself - -- many times. - -- - -- In this case, we create a function that lets us more easily define mappings specific - -- for LSP related items. It sets the mode, buffer and description for us each time. - local nmap = function(keys, func, desc) - if desc then - desc = 'LSP: ' .. desc - end - - vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) - end - - nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') - nmap('ca', function() - vim.lsp.buf.code_action { context = { only = { 'quickfix', 'refactor', 'source' } } } - end, '[C]ode [A]ction') - - nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - nmap('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') - nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') - - -- See `:help K` for why this keymap - nmap('K', vim.lsp.buf.hover, 'Hover Documentation') - nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') - - -- Lesser used LSP functionality - nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') - nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') - nmap('wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, '[W]orkspace [L]ist Folders') - - -- Create a command `:Format` local to the LSP buffer - vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) - vim.lsp.buf.format() - end, { desc = 'Format current buffer with LSP' }) -end - --- document existing key chains -require('which-key').register { - ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, - ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, - ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, - ['h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, - ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, - ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, - ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, - ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, -} --- register which-key VISUAL mode --- required for visual hs (hunk stage) to work -require('which-key').register({ - [''] = { name = 'VISUAL ' }, - ['h'] = { 'Git [H]unk' }, -}, { mode = 'v' }) - --- mason-lspconfig requires that these setup functions are called in this order --- before setting up the servers. -require('mason').setup() -require('mason-lspconfig').setup() - --- Enable the following language servers --- Feel free to add/remove any LSPs that you want here. They will automatically be installed. --- --- Add any additional override configuration in the following tables. They will be passed to --- the `settings` field of the server config. You must look up that documentation yourself. --- --- If you want to override the default filetypes that your language server will attach to you can --- define the property 'filetypes' to the map in question. -local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, - -- tsserver = {}, - -- html = { filetypes = { 'html', 'twig', 'hbs'} }, - - lua_ls = { - Lua = { - workspace = { checkThirdParty = false }, - telemetry = { enable = false }, - -- NOTE: toggle below to ignore Lua_LS's noisy `missing-fields` warnings - -- diagnostics = { disable = { 'missing-fields' } }, - }, - }, -} - --- Setup neovim lua configuration -require('neodev').setup() - --- nvim-cmp supports additional completion capabilities, so broadcast that to servers -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) - --- Ensure the servers above are installed -local mason_lspconfig = require 'mason-lspconfig' - -mason_lspconfig.setup { - ensure_installed = vim.tbl_keys(servers), -} - -mason_lspconfig.setup_handlers { - function(server_name) - require('lspconfig')[server_name].setup { - capabilities = capabilities, - on_attach = on_attach, - settings = servers[server_name], - filetypes = (servers[server_name] or {}).filetypes, - } - end, -} - --- [[ Configure nvim-cmp ]] --- See `:help cmp` -local cmp = require 'cmp' -local luasnip = require 'luasnip' -require('luasnip.loaders.from_vscode').lazy_load() -luasnip.config.setup {} - -cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - completion = { - completeopt = 'menu,menuone,noinsert', - }, - mapping = cmp.mapping.preset.insert { - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete {}, - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 's' }), - }, - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'path' }, - }, -} - -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/kickstart/health.lua b/lua/kickstart/health.lua new file mode 100644 index 00000000000..957204e8dad --- /dev/null +++ b/lua/kickstart/health.lua @@ -0,0 +1,51 @@ +--[[ +-- +-- This file is not required for your own configuration, +-- but helps people determine if their system is setup correctly. +-- +--]] + +local check_version = function() + if not vim.version.cmp then + vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", tostring(vim.version()))) + return + end + + if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then + vim.health.ok(string.format("Neovim version is: '%s'", tostring(vim.version()))) + else + vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", tostring(vim.version()))) + end +end + +local check_external_reqs = function() + -- Basic utils: `git`, `make`, `unzip` + for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do + local is_executable = vim.fn.executable(exe) == 1 + if is_executable then + vim.health.ok(string.format("Found executable: '%s'", exe)) + else + vim.health.warn(string.format("Could not find executable: '%s'", exe)) + end + end + + return true +end + +return { + check = function() + vim.health.start 'kickstart.nvim' + + vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth` + + Fix only warnings for plugins and languages you intend to use. + Mason will give warnings for languages that are not installed. + You do not need to install, unless you want to use those languages!]] + + local uv = vim.uv or vim.loop + vim.health.info('System Information: ' .. vim.inspect(uv.os_uname())) + + check_version() + check_external_reqs() + end, +} diff --git a/lua/kickstart/plugins/autoformat.lua b/lua/kickstart/plugins/autoformat.lua deleted file mode 100644 index bc56b15b027..00000000000 --- a/lua/kickstart/plugins/autoformat.lua +++ /dev/null @@ -1,74 +0,0 @@ --- autoformat.lua --- --- Use your language server to automatically format your code on save. --- Adds additional commands as well to manage the behavior - -return { - 'neovim/nvim-lspconfig', - config = function() - -- Switch for controlling whether you want autoformatting. - -- Use :KickstartFormatToggle to toggle autoformatting on or off - local format_is_enabled = true - vim.api.nvim_create_user_command('KickstartFormatToggle', function() - format_is_enabled = not format_is_enabled - print('Setting autoformatting to: ' .. tostring(format_is_enabled)) - end, {}) - - -- Create an augroup that is used for managing our formatting autocmds. - -- We need one augroup per client to make sure that multiple clients - -- can attach to the same buffer without interfering with each other. - local _augroups = {} - local get_augroup = function(client) - if not _augroups[client.id] then - local group_name = 'kickstart-lsp-format-' .. client.name - local id = vim.api.nvim_create_augroup(group_name, { clear = true }) - _augroups[client.id] = id - end - - return _augroups[client.id] - end - - -- Whenever an LSP attaches to a buffer, we will run this function. - -- - -- See `:help LspAttach` for more information about this autocmd event. - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }), - -- This is where we attach the autoformatting for reasonable clients - callback = function(args) - local client_id = args.data.client_id - local client = vim.lsp.get_client_by_id(client_id) - local bufnr = args.buf - - -- Only attach to clients that support document formatting - if not client.server_capabilities.documentFormattingProvider then - return - end - - -- Tsserver usually works poorly. Sorry you work with bad languages - -- You can remove this line if you know what you're doing :) - if client.name == 'tsserver' then - return - end - - -- Create an autocmd that will run *before* we save the buffer. - -- Run the formatting command for the LSP that has just attached. - vim.api.nvim_create_autocmd('BufWritePre', { - group = get_augroup(client), - buffer = bufnr, - callback = function() - if not format_is_enabled then - return - end - - vim.lsp.buf.format { - async = false, - filter = function(c) - return c.id == client.id - end, - } - end, - }) - end, - }) - end, -} diff --git a/lua/kickstart/plugins/indent_line.lua b/lua/kickstart/plugins/indent_line.lua new file mode 100644 index 00000000000..ed7f269399f --- /dev/null +++ b/lua/kickstart/plugins/indent_line.lua @@ -0,0 +1,9 @@ +return { + { -- Add indentation guides even on blank lines + 'lukas-reineke/indent-blankline.nvim', + -- Enable `lukas-reineke/indent-blankline.nvim` + -- See `:help ibl` + main = 'ibl', + opts = {}, + }, +} From b3ad2e23ba277ad4f3b84a9ed19aaf37566cb30f Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Mon, 26 Feb 2024 10:45:32 -0500 Subject: [PATCH 136/480] fixup: add autocommand link for help and description --- init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init.lua b/init.lua index 0d19b081263..fb569a4a306 100644 --- a/init.lua +++ b/init.lua @@ -184,10 +184,14 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +-- [[ Basic Autocommands ]] +-- See :help lua-guide-autocommands + -- Highlight when yanking (copying) text -- Try it with `yap` in normal mode -- See `:help vim.highlight.on_yank()` vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight when yanking (copying) text', group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), callback = function() vim.highlight.on_yank() From 5ef35bb0ed94da7f84a1dd5a875549e01c406901 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Mon, 26 Feb 2024 10:46:31 -0500 Subject: [PATCH 137/480] fixup: change comment to reflect auto_install --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index fb569a4a306..1e5691a7e37 100644 --- a/init.lua +++ b/init.lua @@ -775,7 +775,7 @@ require('lazy').setup({ ---@diagnostic disable-next-line: missing-fields require('nvim-treesitter.configs').setup { ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' }, - -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) + -- Autoinstall languages that are not installed auto_install = true, highlight = { enable = true }, indent = { enable = true }, From 4c1b92625bec9517eb5403adbdd59223d2076011 Mon Sep 17 00:00:00 2001 From: brxxlstxrs <92815065+brxxlstxrs@users.noreply.github.com> Date: Tue, 27 Feb 2024 21:08:37 +0300 Subject: [PATCH 138/480] add plugin specs docstring, remove lazy.nvim configuration (empty) table (#652) --- init.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 1e5691a7e37..0506b3e64c6 100644 --- a/init.lua +++ b/init.lua @@ -218,7 +218,9 @@ vim.opt.rtp:prepend(lazypath) -- :Lazy update -- -- NOTE: Here is where you install your plugins. -require('lazy').setup({ +require('lazy').setup { + + -- [[ Plugin Specs list ]] -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically @@ -808,7 +810,7 @@ require('lazy').setup({ -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- For additional information see: :help lazy.nvim-lazy.nvim-structuring-your-plugins -- { import = 'custom.plugins' }, -}, {}) +} -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et From 09b3f08c22622e5065e816448f2930c45c561cbe Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Wed, 28 Feb 2024 19:23:13 +0100 Subject: [PATCH 139/480] Change mini.statusline location format to LINE:COLUMN (#659) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Default mini.statusline location format is: 'cursor line | total lines │ cursor column | total columns' --- init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init.lua b/init.lua index 0506b3e64c6..89da77b977e 100644 --- a/init.lua +++ b/init.lua @@ -762,6 +762,9 @@ require('lazy').setup { -- You could remove this setup call if you don't like it, -- and try some other statusline plugin require('mini.statusline').setup() + MiniStatusline.section_location = function() + return '%2l:%-2v' + end -- ... and there is more! -- Check out: https://github.com/echasnovski/mini.nvim From 786b8be5be0897f6137d3fa697d671103075068d Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Thu, 29 Feb 2024 12:08:01 -0500 Subject: [PATCH 140/480] fixup: updated some style stuff --- init.lua | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/init.lua b/init.lua index 89da77b977e..c81ae2ebaf6 100644 --- a/init.lua +++ b/init.lua @@ -219,9 +219,6 @@ vim.opt.rtp:prepend(lazypath) -- -- NOTE: Here is where you install your plugins. require('lazy').setup { - - -- [[ Plugin Specs list ]] - -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically @@ -592,15 +589,11 @@ require('lazy').setup { handlers = { function(server_name) local server = servers[server_name] or {} - require('lspconfig')[server_name].setup { - cmd = server.cmd, - settings = server.settings, - filetypes = server.filetypes, - -- This handles overriding only values explicitly passed - -- by the server configuration above. Useful when disabling - -- certain features of an LSP (for example, turning off formatting for tsserver) - capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}), - } + -- This handles overriding only values explicitly passed + -- by the server configuration above. Useful when disabling + -- certain features of an LSP (for example, turning off formatting for tsserver) + server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) + require('lspconfig')[server_name].setup(server) end, }, } @@ -761,9 +754,15 @@ require('lazy').setup { -- Simple and easy statusline. -- You could remove this setup call if you don't like it, -- and try some other statusline plugin - require('mini.statusline').setup() - MiniStatusline.section_location = function() - return '%2l:%-2v' + local statusline = require 'mini.statusline' + statusline.setup() + + -- You can confiure sections in the statusline by overriding their + -- default behavior. For example, here we disable the section for + -- cursor information because line numbers are already enabled + ---@diagnostic disable-next-line: duplicate-set-field + statusline.section_location = function() + return '' end -- ... and there is more! From d262316a7701f981896b02a5d147fc6a5a322f51 Mon Sep 17 00:00:00 2001 From: Anton Kastritskii Date: Thu, 29 Feb 2024 18:14:36 +0000 Subject: [PATCH 141/480] feat: enable lua lsp snipppets (#660) --- init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init.lua b/init.lua index c81ae2ebaf6..9146b5f2f6f 100644 --- a/init.lua +++ b/init.lua @@ -562,6 +562,9 @@ require('lazy').setup { -- If lua_ls is really slow on your computer, you can try this instead: -- library = { vim.env.VIMRUNTIME }, }, + completion = { + callSnippet = 'Replace', + }, -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings -- diagnostics = { disable = { 'missing-fields' } }, }, From bcbdae55b00c76b978d28bd2496f92317c9984b7 Mon Sep 17 00:00:00 2001 From: Nhan Luu <62146587+nhld@users.noreply.github.com> Date: Sat, 2 Mar 2024 04:07:34 +0700 Subject: [PATCH 142/480] chore: fix typos (#666) --- init.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/init.lua b/init.lua index 9146b5f2f6f..3f53732864f 100644 --- a/init.lua +++ b/init.lua @@ -134,8 +134,8 @@ vim.opt.splitright = true vim.opt.splitbelow = true -- Sets how neovim will display certain whitespace in the editor. --- See :help 'list' --- and :help 'listchars' +-- See `:help 'list'` +-- and `:help 'listchars'` vim.opt.list = true vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } @@ -185,7 +185,7 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the lower win vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) -- [[ Basic Autocommands ]] --- See :help lua-guide-autocommands +-- See `:help lua-guide-autocommands` -- Highlight when yanking (copying) text -- Try it with `yap` in normal mode @@ -261,7 +261,7 @@ require('lazy').setup { -- event = 'VeryLazy' -- -- which loads which-key after all the UI elements are loaded. Events can be - -- normal autocommands events (:help autocomd-events). + -- normal autocommands events (`:help autocmd-events`). -- -- Then, because we use the `config` key, the configuration only runs -- after the plugin has been loaded: @@ -434,7 +434,7 @@ require('lazy').setup { -- Neovim. This is where `mason` and related plugins come into play. -- -- If you're wondering about lsp vs treesitter, you can check out the wonderfully - -- and elegantly composed help section, :help lsp-vs-treesitter + -- and elegantly composed help section, `:help lsp-vs-treesitter` -- This function gets run when an LSP attaches to a particular buffer. -- That is to say, every time a new file is opened that is associated with @@ -742,7 +742,7 @@ require('lazy').setup { -- Better Around/Inside textobjects -- -- Examples: - -- - va) - [V]isually select [A]round [)]parenthen + -- - va) - [V]isually select [A]round [)]paren -- - yinq - [Y]ank [I]nside [N]ext [']quote -- - ci' - [C]hange [I]nside [']quote require('mini.ai').setup { n_lines = 500 } @@ -760,7 +760,7 @@ require('lazy').setup { local statusline = require 'mini.statusline' statusline.setup() - -- You can confiure sections in the statusline by overriding their + -- You can configure sections in the statusline by overriding their -- default behavior. For example, here we disable the section for -- cursor information because line numbers are already enabled ---@diagnostic disable-next-line: duplicate-set-field @@ -791,7 +791,7 @@ require('lazy').setup { -- There are additional nvim-treesitter modules that you can use to interact -- with nvim-treesitter. You should go explore a few and see what interests you: -- - -- - Incremental selection: Included, see :help nvim-treesitter-incremental-selection-mod + -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects end, @@ -813,7 +813,7 @@ require('lazy').setup { -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- For additional information see: :help lazy.nvim-lazy.nvim-structuring-your-plugins + -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` -- { import = 'custom.plugins' }, } From 77156e78ba2adb8c2f38b0918831256230d99eeb Mon Sep 17 00:00:00 2001 From: Taulant Aliraj Date: Sun, 3 Mar 2024 02:07:58 +0000 Subject: [PATCH 143/480] feat: use VimEnter event instead of VeryLazy (#673) --- init.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index 3f53732864f..292ec0779a9 100644 --- a/init.lua +++ b/init.lua @@ -258,9 +258,9 @@ require('lazy').setup { -- lazy loading plugins that don't need to be loaded immediately at startup. -- -- For example, in the following configuration, we use: - -- event = 'VeryLazy' + -- event = 'VimEnter' -- - -- which loads which-key after all the UI elements are loaded. Events can be + -- which loads which-key before all the UI elements are loaded. Events can be -- normal autocommands events (`:help autocmd-events`). -- -- Then, because we use the `config` key, the configuration only runs @@ -269,7 +269,7 @@ require('lazy').setup { { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', - event = 'VeryLazy', -- Sets the loading event to 'VeryLazy' + event = 'VimEnter', -- Sets the loading event to 'VimEnter' config = function() -- This is the function that runs, AFTER loading require('which-key').setup() @@ -293,7 +293,7 @@ require('lazy').setup { { -- Fuzzy Finder (files, lsp, etc) 'nvim-telescope/telescope.nvim', - event = 'VeryLazy', + event = 'VimEnter', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim', @@ -734,7 +734,7 @@ require('lazy').setup { }, -- Highlight todo, notes, etc in comments - { 'folke/todo-comments.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, + { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, { -- Collection of various small independent plugins/modules 'echasnovski/mini.nvim', From 6205c93462cbe44678df91c5e8050c037e1b56ba Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Sun, 3 Mar 2024 03:12:55 +0100 Subject: [PATCH 144/480] README.md: updated windows install instructions (#674) --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index c9b9d84e87b..0f6911c610c 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,8 @@ Neovim's configurations are located under the following paths, depending on your | Windows (cmd)| `%userprofile%\AppData\Local\nvim\` | | Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` | +### Install Kickstart + Clone kickstart.nvim:
Linux and Mac @@ -192,3 +194,23 @@ This requires: ```lua {'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } ``` + +Alternatively one can install gcc and make which don't require changing the config, +the easiest way is to use choco: + +1. install [chocolatey](https://chocolatey.org/install) +either follow the instructions on the page or use winget, +run in cmd as **admin**: +``` +winget install --accept-source-agreements chocolatey.chocolatey +``` + +2. install all requirements using choco, exit previous cmd and +open a new one so that choco path is set, run in cmd as **admin**: +``` +choco install -y neovim git ripgrep wget fd unzip gzip mingw make +``` + +Then continue with the [Install Kickstart](#Install-Kickstart) step. + + From a5e15fb5d219b9bd0100d188d607f2012b92b757 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Sun, 3 Mar 2024 03:13:16 -0500 Subject: [PATCH 145/480] fix: add note in readme for custom plugins --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0f6911c610c..b6d19f49787 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,8 @@ can install to your machine using the methods above. #### Examples of adding popularly requested plugins +NOTE: You'll need to uncomment the line in the init.lua that turns on loading custom plugins. +
Adding autopairs From bce0a027648f5be3707a26972e5c417bc2080e48 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Mon, 4 Mar 2024 01:32:06 +0100 Subject: [PATCH 146/480] fix: checkhealth reported nvim version (#685) --- lua/kickstart/health.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/kickstart/health.lua b/lua/kickstart/health.lua index 957204e8dad..04df77b33e8 100644 --- a/lua/kickstart/health.lua +++ b/lua/kickstart/health.lua @@ -6,15 +6,16 @@ --]] local check_version = function() + local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch) if not vim.version.cmp then - vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", tostring(vim.version()))) + vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) return end if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then - vim.health.ok(string.format("Neovim version is: '%s'", tostring(vim.version()))) + vim.health.ok(string.format("Neovim version is: '%s'", verstr)) else - vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", tostring(vim.version()))) + vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) end end From dbd48e258a3534441d1918ab39d656a96bb9cbee Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Mon, 4 Mar 2024 14:16:50 +0100 Subject: [PATCH 147/480] Change statusline location to LINE:COLUMN (#689) --- init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 292ec0779a9..16d3c26b1ec 100644 --- a/init.lua +++ b/init.lua @@ -761,11 +761,11 @@ require('lazy').setup { statusline.setup() -- You can configure sections in the statusline by overriding their - -- default behavior. For example, here we disable the section for - -- cursor information because line numbers are already enabled + -- default behavior. For example, here we set the section for + -- cursor location to LINE:COLUMN ---@diagnostic disable-next-line: duplicate-set-field statusline.section_location = function() - return '' + return '%2l:%-2v' end -- ... and there is more! From 4966fcd9830685c89862ff9fc5e839bd8049d205 Mon Sep 17 00:00:00 2001 From: Chiller Dragon Date: Mon, 4 Mar 2024 21:47:11 +0800 Subject: [PATCH 148/480] chore: remove trailing spaces from readme (#679) --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b6d19f49787..82eecebda9e 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ If you are experiencing issues, please make sure you have the latest versions. ### Install External Dependencies -> **NOTE** +> **NOTE** > [Backup](#FAQ) your previous configuration (if any exists) External Requirements: @@ -60,13 +60,13 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HO If you're using `cmd.exe`: ``` -git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ +git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ ``` If you're using `powershell.exe` ``` -git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\ +git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\ ```
@@ -97,7 +97,7 @@ install instructions in this file instead. An updated video is coming soon. (so that you have your own copy that you can modify) and then installing you can install to your machine using the methods above. -> **NOTE** +> **NOTE** > Your fork's url will be something like this: `https://github.com//kickstart.nvim.git` #### Examples of adding popularly requested plugins @@ -214,5 +214,3 @@ choco install -y neovim git ripgrep wget fd unzip gzip mingw make ``` Then continue with the [Install Kickstart](#Install-Kickstart) step. - - From c37d78cff1e6240211a6289a4c2215cb79088e91 Mon Sep 17 00:00:00 2001 From: Chiller Dragon Date: Mon, 4 Mar 2024 21:47:45 +0800 Subject: [PATCH 149/480] chore: link new installation youtube video (#678) --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 82eecebda9e..c44d5f9a5a2 100644 --- a/README.md +++ b/README.md @@ -87,9 +87,7 @@ information about extending and exploring Neovim. ### Getting Started -See [Effective Neovim: Instant IDE](https://youtu.be/stqUbv-5u2s), covering the -previous version. Note: The install via init.lua is outdated, please follow the -install instructions in this file instead. An updated video is coming soon. +[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o) ### Recommended Steps From 55d3128edd0c087b73e25ae9608c425312957659 Mon Sep 17 00:00:00 2001 From: Ryan Winchester Date: Tue, 5 Mar 2024 21:19:06 -0400 Subject: [PATCH 150/480] Add more detail to colorscheme comment (#713) --- init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 16d3c26b1ec..e8c8693fa6f 100644 --- a/init.lua +++ b/init.lua @@ -725,7 +725,9 @@ require('lazy').setup { lazy = false, -- make sure we load this during startup if it is your main colorscheme priority = 1000, -- make sure to load this before all the other start plugins config = function() - -- Load the colorscheme here + -- Load the colorscheme here. + -- Like many other themes, this one has different styles, and you could load + -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. vim.cmd.colorscheme 'tokyonight-night' -- You can configure highlights by doing something like From a9f2db587376d70a4fed5d14665f01d45a3574cf Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Wed, 6 Mar 2024 17:49:44 +0100 Subject: [PATCH 151/480] Make the Nerd Font an optional requirement (#716) --- README.md | 2 ++ init.lua | 36 +++++++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c44d5f9a5a2..6d48c18e546 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,8 @@ If you are experiencing issues, please make sure you have the latest versions. External Requirements: - Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`) - [ripgrep](https://github.com/BurntSushi/ripgrep#installation) +- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons + - if you have it set `vim.g.have_nerd_font` in `init.lua` to true - Language Setup: - If want to write Typescript, you need `npm` - If want to write Golang, you will need `go` diff --git a/init.lua b/init.lua index e8c8693fa6f..3bdb5e36998 100644 --- a/init.lua +++ b/init.lua @@ -90,6 +90,9 @@ P.S. You can delete this when you're done too. It's your config now! :) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' +-- Set to true if you have a Nerd Font installed +vim.g.have_nerd_font = false + -- [[ Setting options ]] -- See `:help vim.opt` -- NOTE: You can change these options as you wish! @@ -218,7 +221,7 @@ vim.opt.rtp:prepend(lazypath) -- :Lazy update -- -- NOTE: Here is where you install your plugins. -require('lazy').setup { +require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically @@ -312,10 +315,8 @@ require('lazy').setup { }, { 'nvim-telescope/telescope-ui-select.nvim' }, - -- Useful for getting pretty icons, but requires special font. - -- If you already have a Nerd Font, or terminal set up with fallback fonts - -- you can enable this - -- { 'nvim-tree/nvim-web-devicons' } + -- Useful for getting pretty icons, but requires a Nerd Font. + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that @@ -760,7 +761,8 @@ require('lazy').setup { -- You could remove this setup call if you don't like it, -- and try some other statusline plugin local statusline = require 'mini.statusline' - statusline.setup() + -- set use_icons to true if you have a Nerd Font + statusline.setup { use_icons = vim.g.have_nerd_font } -- You can configure sections in the statusline by overriding their -- default behavior. For example, here we set the section for @@ -817,7 +819,27 @@ require('lazy').setup { -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` -- { import = 'custom.plugins' }, -} +}, { + ui = { + -- If you have a Nerd Font, set icons to an empty table which will use the + -- default lazy.nvim defined Nerd Font icons otherwise define a unicode icons table + icons = vim.g.have_nerd_font and {} or { + cmd = '⌘', + config = '🛠', + event = '📅', + ft = '📂', + init = '⚙', + keys = '🗝', + plugin = '🔌', + runtime = '💻', + require = '🌙', + source = '📄', + start = '🚀', + task = '📌', + lazy = '💤 ', + }, + }, +}) -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et From bcc1f102d8c6a873ebdccd5c3e9546c7278784ed Mon Sep 17 00:00:00 2001 From: Nora Ayesha <160715982+noraayesha@users.noreply.github.com> Date: Sat, 9 Mar 2024 02:26:32 +0600 Subject: [PATCH 152/480] Fix typos and whatnot (#731) --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 6d48c18e546..9ed19123c33 100644 --- a/README.md +++ b/README.md @@ -94,8 +94,8 @@ information about extending and exploring Neovim. ### Recommended Steps [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo -(so that you have your own copy that you can modify) and then installing you -can install to your machine using the methods above. +(so that you have your own copy that you can modify) and then install. You +can install it on your machine using the methods above. > **NOTE** > Your fork's url will be something like this: `https://github.com//kickstart.nvim.git` @@ -135,7 +135,7 @@ return {
Adding a file tree plugin -This will install the tree plugin and add the command `:Neotree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information. +This will install the tree plugin and add the command `:Neotree` for you. For more information, see the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim). In the file: `lua/custom/plugins/filetree.lua`, add: @@ -162,10 +162,10 @@ return { ### FAQ * What should I do if I already have a pre-existing neovim configuration? - * You should back it up, then delete all files associated with it. + * You should back it up and then delete all associated files. * This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` * Can I keep my existing configuration in parallel to kickstart? - * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example you can install the kickstart configuration in `~/.config/nvim-kickstart` and create an alias: + * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example, you can install the kickstart configuration in `~/.config/nvim-kickstart` and create an alias: ``` alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim' ``` @@ -174,9 +174,9 @@ return { * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information * Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files? * The main purpose of kickstart is to serve as a teaching tool and a reference - configuration that someone can easily `git clone` as a basis for their own. + configuration that someone can easily use to `git clone` as a basis for their own. As you progress in learning Neovim and Lua, you might consider splitting `init.lua` - into smaller parts. A fork of kickstart that does this while maintaining the exact + into smaller parts. A fork of kickstart that does this while maintaining the same functionality is available here: * [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim) * Discussions on this topic can be found here: @@ -185,19 +185,19 @@ return { ### Windows Installation -Installation may require installing build tools, and updating the run command for `telescope-fzf-native` +Installation may require installing build tools and updating the run command for `telescope-fzf-native` See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) This requires: -- Install CMake, and the Microsoft C++ Build Tools on Windows +- Install CMake and the Microsoft C++ Build Tools on Windows ```lua {'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } ``` -Alternatively one can install gcc and make which don't require changing the config, +Alternatively, one can install gcc and make which don't require changing the config, the easiest way is to use choco: 1. install [chocolatey](https://chocolatey.org/install) @@ -208,9 +208,9 @@ winget install --accept-source-agreements chocolatey.chocolatey ``` 2. install all requirements using choco, exit previous cmd and -open a new one so that choco path is set, run in cmd as **admin**: +open a new one so that choco path is set, and run in cmd as **admin**: ``` choco install -y neovim git ripgrep wget fd unzip gzip mingw make ``` -Then continue with the [Install Kickstart](#Install-Kickstart) step. +Then, continue with the [Install Kickstart](#Install-Kickstart) step. From 92826b9b3231973f82288361d846034710b5e694 Mon Sep 17 00:00:00 2001 From: "name.tar.xz" <54463026+name-tar-xz@users.noreply.github.com> Date: Sun, 10 Mar 2024 01:55:08 +0530 Subject: [PATCH 153/480] use init for colorscheme (#715) --- init.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 3bdb5e36998..cfbe00d24af 100644 --- a/init.lua +++ b/init.lua @@ -723,9 +723,8 @@ require('lazy').setup({ -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme` 'folke/tokyonight.nvim', - lazy = false, -- make sure we load this during startup if it is your main colorscheme priority = 1000, -- make sure to load this before all the other start plugins - config = function() + init = function() -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. From c99171f460f06bd96920e39b80e43bbf3c0bedb6 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Mon, 11 Mar 2024 22:52:18 +0100 Subject: [PATCH 154/480] README.md: update neo-tree example - remove legacy setting (#744) --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 9ed19123c33..36920a79da3 100644 --- a/README.md +++ b/README.md @@ -140,9 +140,6 @@ This will install the tree plugin and add the command `:Neotree` for you. For mo In the file: `lua/custom/plugins/filetree.lua`, add: ```lua --- Unless you are still migrating, remove the deprecated commands from v1.x -vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) - return { "nvim-neo-tree/neo-tree.nvim", version = "*", From ba48d61b7396004a5b78720abaa29cc783850788 Mon Sep 17 00:00:00 2001 From: Ryan Baumgardner <26423650+rbaumgardner93@users.noreply.github.com> Date: Mon, 11 Mar 2024 19:18:45 -0400 Subject: [PATCH 155/480] feat: allow treesitter defaults to be overwritten from custom directory (#732) --- init.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index cfbe00d24af..9216e600ccc 100644 --- a/init.lua +++ b/init.lua @@ -779,17 +779,18 @@ require('lazy').setup({ { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', - config = function() + opts = { + ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' }, + -- Autoinstall languages that are not installed + auto_install = true, + highlight = { enable = true }, + indent = { enable = true }, + }, + config = function(_, opts) -- [[ Configure Treesitter ]] See `:help nvim-treesitter` ---@diagnostic disable-next-line: missing-fields - require('nvim-treesitter.configs').setup { - ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' }, - -- Autoinstall languages that are not installed - auto_install = true, - highlight = { enable = true }, - indent = { enable = true }, - } + require('nvim-treesitter.configs').setup(opts) -- There are additional nvim-treesitter modules that you can use to interact -- with nvim-treesitter. You should go explore a few and see what interests you: From 1b79a29bc2f71f757c672998203f15b371781fd7 Mon Sep 17 00:00:00 2001 From: Chiller Dragon Date: Tue, 12 Mar 2024 07:20:39 +0800 Subject: [PATCH 156/480] chore: rename to for consistency (#719) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 9216e600ccc..c570c4c264a 100644 --- a/init.lua +++ b/init.lua @@ -456,7 +456,7 @@ require('lazy').setup({ -- Jump to the definition of the word under your cursor. -- This is where a variable was first declared, or where a function is defined, etc. - -- To jump back, press . + -- To jump back, press . map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') -- Find references for the word under your cursor. From 4733fbe5a7a25c9c5a93eb2aeff9c756f92ba157 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Tue, 12 Mar 2024 22:06:12 +0100 Subject: [PATCH 157/480] Added folke/neodev.nvim for proper nvim api completion and annotation (#754) Fixes nvim-lua/kickstart.nvim#692 `neodev` configures Lua LSP for your Neovim config, runtime and plugins used for completion, annotations and signatures of Neovim apis With neodev, there's no more need to manually set lua_ls workspace settings which don't seem to work properly anyway as currently nvim api completion does not work. --- init.lua | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index c570c4c264a..04cc6b7a03d 100644 --- a/init.lua +++ b/init.lua @@ -410,6 +410,10 @@ require('lazy').setup({ -- Useful status updates for LSP. -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` { 'j-hui/fidget.nvim', opts = {} }, + + -- `neodev` configures Lua LSP for your Neovim config, runtime and plugins + -- used for completion, annotations and signatures of Neovim apis + { 'folke/neodev.nvim', opts = {} }, }, config = function() -- Brief Aside: **What is LSP?** @@ -551,18 +555,6 @@ require('lazy').setup({ -- capabilities = {}, settings = { Lua = { - runtime = { version = 'LuaJIT' }, - workspace = { - checkThirdParty = false, - -- Tells lua_ls where to find all the Lua files that you have loaded - -- for your neovim configuration. - library = { - '${3rd}/luv/library', - unpack(vim.api.nvim_get_runtime_file('', true)), - }, - -- If lua_ls is really slow on your computer, you can try this instead: - -- library = { vim.env.VIMRUNTIME }, - }, completion = { callSnippet = 'Replace', }, From a9fa4c6cc8c284254cb40df45cd1286a250e08c7 Mon Sep 17 00:00:00 2001 From: James Karefylakis Date: Wed, 13 Mar 2024 08:12:35 +1100 Subject: [PATCH 158/480] Use `cmp-nvim-lua` as `nvim-cmp` source for neovim Lua API (#696) * Use cmp-nvim-lua as nvim-cmp source for neovim Lua API * Move the dependency to a more suitable place --- init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init.lua b/init.lua index 04cc6b7a03d..fe2564868a3 100644 --- a/init.lua +++ b/init.lua @@ -640,6 +640,9 @@ require('lazy').setup({ -- into multiple repos for maintenance purposes. 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-path', + -- nvim-cmp source for neovim Lua API + -- so that things like vim.keymap.set, etc. are autocompleted + 'hrsh7th/cmp-nvim-lua', -- If you want to add a bunch of pre-configured snippets, -- you can use this plugin to help you. It even has snippets @@ -701,6 +704,7 @@ require('lazy').setup({ end, { 'i', 's' }), }, sources = { + { name = 'nvim_lua' }, { name = 'nvim_lsp' }, { name = 'luasnip' }, { name = 'path' }, From 205c04b2b54b6f72227a92a3ad9df9d8634c4cb9 Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Tue, 12 Mar 2024 18:09:47 -0400 Subject: [PATCH 159/480] Revert "Use `cmp-nvim-lua` as `nvim-cmp` source for neovim Lua API (#696)" (#755) This reverts commit a9fa4c6cc8c284254cb40df45cd1286a250e08c7. --- init.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/init.lua b/init.lua index fe2564868a3..04cc6b7a03d 100644 --- a/init.lua +++ b/init.lua @@ -640,9 +640,6 @@ require('lazy').setup({ -- into multiple repos for maintenance purposes. 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-path', - -- nvim-cmp source for neovim Lua API - -- so that things like vim.keymap.set, etc. are autocompleted - 'hrsh7th/cmp-nvim-lua', -- If you want to add a bunch of pre-configured snippets, -- you can use this plugin to help you. It even has snippets @@ -704,7 +701,6 @@ require('lazy').setup({ end, { 'i', 's' }), }, sources = { - { name = 'nvim_lua' }, { name = 'nvim_lsp' }, { name = 'luasnip' }, { name = 'path' }, From 8d73f7d20a70812bc2c67e1017822c285e746758 Mon Sep 17 00:00:00 2001 From: TLW <58749948+TinyLittleWheatley@users.noreply.github.com> Date: Fri, 15 Mar 2024 17:24:49 +0330 Subject: [PATCH 160/480] doc: add info about timeoutlen (#691) Add separate comment for `timeoutlen` option `timeoutlen` option was under unrelated comment with `updatetime` option. --- init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init.lua b/init.lua index 04cc6b7a03d..964ff8201f3 100644 --- a/init.lua +++ b/init.lua @@ -130,6 +130,9 @@ vim.opt.signcolumn = 'yes' -- Decrease update time vim.opt.updatetime = 250 + +-- Decrease mapped sequence wait time +-- Displays which-key popup sooner vim.opt.timeoutlen = 300 -- Configure how new splits should be opened From ed32b88ff319deac536eac98655c750c5d2b8202 Mon Sep 17 00:00:00 2001 From: Rafael Zasas <42390827+RafaelZasas@users.noreply.github.com> Date: Fri, 15 Mar 2024 16:12:41 +0200 Subject: [PATCH 161/480] Add / cmp mapping to scroll cmp docs (#750) --- init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init.lua b/init.lua index 964ff8201f3..26774a53512 100644 --- a/init.lua +++ b/init.lua @@ -674,6 +674,10 @@ require('lazy').setup({ -- Select the [p]revious item [''] = cmp.mapping.select_prev_item(), + -- scroll the documentation window [b]ack / [f]orward + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + -- Accept ([y]es) the completion. -- This will auto-import if your LSP supports it. -- This will expand snippets if the LSP sent a snippet. From 366f401a7f8a3b4b5be9f7580863f1c2d47f16a5 Mon Sep 17 00:00:00 2001 From: Vladislav Grechannik <52157081+VlaDexa@users.noreply.github.com> Date: Fri, 15 Mar 2024 15:35:42 +0100 Subject: [PATCH 162/480] Move friendly snippets to dependencies of LuaSnip (#759) Co-authored-by: TJ DeVries --- init.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 26774a53512..552e16a23ad 100644 --- a/init.lua +++ b/init.lua @@ -635,6 +635,17 @@ require('lazy').setup({ end return 'make install_jsregexp' end)(), + dependencies = { + -- `friendly-snippets` contains a variety of premade snippets. + -- See the README about individual language/framework/plugin snippets: + -- https://github.com/rafamadriz/friendly-snippets + -- { + -- 'rafamadriz/friendly-snippets', + -- config = function() + -- require('luasnip.loaders.from_vscode').lazy_load() + -- end, + -- }, + }, }, 'saadparwaiz1/cmp_luasnip', @@ -643,12 +654,6 @@ require('lazy').setup({ -- into multiple repos for maintenance purposes. 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-path', - - -- If you want to add a bunch of pre-configured snippets, - -- you can use this plugin to help you. It even has snippets - -- for various frameworks/libraries/etc. but you will have to - -- set up the ones that are useful for you. - -- 'rafamadriz/friendly-snippets', }, config = function() -- See `:help cmp` From c314857f2c36b5a341c1227a90af635dd28b180e Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Fri, 15 Mar 2024 11:18:43 -0400 Subject: [PATCH 163/480] doc: add note about advanced luasnip features --- init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init.lua b/init.lua index 552e16a23ad..c504ccb6927 100644 --- a/init.lua +++ b/init.lua @@ -711,6 +711,9 @@ require('lazy').setup({ luasnip.jump(-1) end end, { 'i', 's' }), + + -- For more advanced luasnip keymaps (e.g. selecting choice nodes, expansion) see: + -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps }, sources = { { name = 'nvim_lsp' }, From 15098f9b4cfff9c1d2e9d17ba17864d89da3d161 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Fri, 15 Mar 2024 11:35:07 -0400 Subject: [PATCH 164/480] fix: disable ts indenting for Ruby Tree-sitter indenting for ruby is pretty terrible. But the fix requires a few steps, so showed those and documented how you could do that for other languages as well (with the tricky part being the additional_vim_regex_highlighting trick) --- init.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index c504ccb6927..87133ddcfe3 100644 --- a/init.lua +++ b/init.lua @@ -790,8 +790,14 @@ require('lazy').setup({ ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' }, -- Autoinstall languages that are not installed auto_install = true, - highlight = { enable = true }, - indent = { enable = true }, + highlight = { + enable = true, + -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. + -- If you are experiencing weird indenting issues, add the language to + -- the list of additional_vim_regex_highlighting and disabled languages for indent. + additional_vim_regex_highlighting = { 'ruby' }, + }, + indent = { enable = true, disable = { 'ruby' } }, }, config = function(_, opts) -- [[ Configure Treesitter ]] See `:help nvim-treesitter` From bfbb8eec8fb5908d5e08934ad30fd900b24ef90d Mon Sep 17 00:00:00 2001 From: stgpepper <74211382+stgpepper@users.noreply.github.com> Date: Fri, 15 Mar 2024 22:51:41 +0200 Subject: [PATCH 165/480] Update README.md (#763) Added file text to code block for consistency since the other plugin had file also inside code block. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 36920a79da3..0f0bb1b30a9 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,8 @@ This will install the tree plugin and add the command `:Neotree` for you. For mo In the file: `lua/custom/plugins/filetree.lua`, add: ```lua +-- File: lua/custom/plugins/filetree.lua + return { "nvim-neo-tree/neo-tree.nvim", version = "*", From 40999d32bea66d333297469d8d87bd27bee2943a Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Fri, 15 Mar 2024 21:53:33 +0100 Subject: [PATCH 166/480] conform: disable autoformat on save for specified filetypes (#694) Provide a method to disable autoformat on save lsp fallback for specified filetypes. By default disable for C/C++ as an example, because it does not have a well standardized coding style. Based on conform recipe: https://github.com/stevearc/conform.nvim/blob/master/doc/recipes.md --- init.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 87133ddcfe3..506bbaf5458 100644 --- a/init.lua +++ b/init.lua @@ -603,10 +603,16 @@ require('lazy').setup({ 'stevearc/conform.nvim', opts = { notify_on_error = false, - format_on_save = { - timeout_ms = 500, - lsp_fallback = true, - }, + format_on_save = function(bufnr) + -- Disable "format_on_save lsp_fallback" for languages that don't + -- have a well standardized coding style. You can add additional + -- languages here or re-enable it for the disabled ones. + local disable_filetypes = { c = true, cpp = true } + return { + timeout_ms = 500, + lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], + } + end, formatters_by_ft = { lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially From adfbdeab9151d6e554e72b65a7d1a14bffbf118e Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Sun, 17 Mar 2024 21:22:58 +0100 Subject: [PATCH 167/480] README: additional install recipes for various OS (#767) --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0f0bb1b30a9..e9d31703866 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,8 @@ External Requirements: - etc. > **NOTE** -> See [Windows Installation](#Windows-Installation) to double check any additional Windows notes +> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes +> and quick install snippets Neovim's configurations are located under the following paths, depending on your OS: @@ -182,8 +183,15 @@ return { * [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218) * [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473) -### Windows Installation +### Install Recipes +Below you can find OS specific install instructions for Neovim and dependencies. + +After installing all the dependencies continue with the [Install Kickstart](#Install-Kickstart) step. + +#### Windows Installation + +
Windows with Microsoft C++ Build Tools and CMake Installation may require installing build tools and updating the run command for `telescope-fzf-native` See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) @@ -195,7 +203,8 @@ This requires: ```lua {'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } ``` - +
+
Windows with gcc/make using chocolatey Alternatively, one can install gcc and make which don't require changing the config, the easiest way is to use choco: @@ -211,5 +220,41 @@ open a new one so that choco path is set, and run in cmd as **admin**: ``` choco install -y neovim git ripgrep wget fd unzip gzip mingw make ``` +
+
WSL (Windows Subsystem for Linux) + +``` +wsl --install +wsl +sudo add-apt-repository ppa:neovim-ppa/unstable -y +sudo apt update +sudo apt install make gcc ripgrep unzip neovim +``` +
+ +#### Linux Install +
Ubuntu Install Steps + +``` +sudo add-apt-repository ppa:neovim-ppa/unstable -y +sudo apt update +sudo apt install make gcc ripgrep unzip neovim +``` +
+
Debian Install Steps + +``` +sudo apt update +sudo apt install make gcc ripgrep unzip git +echo "deb https://deb.debian.org/debian unstable main" | sudo tee -a /etc/apt/sources.list +sudo apt update +sudo apt install -t unstable neovim +``` +
+
Fedora Install Steps + +``` +sudo dnf install -y gcc make git ripgrep fd-find neovim +``` +
-Then, continue with the [Install Kickstart](#Install-Kickstart) step. From 3cc014b5fc80bef14821634d886fe31885aad2ca Mon Sep 17 00:00:00 2001 From: Shane Crowley <66971213+edibotopic@users.noreply.github.com> Date: Mon, 18 Mar 2024 13:57:48 +0000 Subject: [PATCH 168/480] assign table to filetype in lua_ls config comment (#770) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 506bbaf5458..6e813f44bcf 100644 --- a/init.lua +++ b/init.lua @@ -554,7 +554,7 @@ require('lazy').setup({ lua_ls = { -- cmd = {...}, - -- filetypes { ...}, + -- filetypes = { ...}, -- capabilities = {}, settings = { Lua = { From e58ca75bf4d32adf85278598c093bf795f33af6b Mon Sep 17 00:00:00 2001 From: Fredrik Averpil Date: Mon, 18 Mar 2024 15:00:48 +0100 Subject: [PATCH 169/480] feat: add linter plugin (#699) --- init.lua | 1 + lua/kickstart/plugins/lint.lua | 55 ++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 lua/kickstart/plugins/lint.lua diff --git a/init.lua b/init.lua index 6e813f44bcf..c2428867272 100644 --- a/init.lua +++ b/init.lua @@ -831,6 +831,7 @@ require('lazy').setup({ -- -- require 'kickstart.plugins.debug', -- require 'kickstart.plugins.indent_line', + -- require 'kickstart.plugins.lint', -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua new file mode 100644 index 00000000000..7f0dc42fbbf --- /dev/null +++ b/lua/kickstart/plugins/lint.lua @@ -0,0 +1,55 @@ +return { + + { -- Linting + 'mfussenegger/nvim-lint', + event = { 'BufReadPre', 'BufNewFile' }, + config = function() + local lint = require 'lint' + lint.linters_by_ft = { + markdown = { 'markdownlint' }, + } + + -- To allow other plugins to add linters to require('lint').linters_by_ft, + -- instead set linters_by_ft like this: + -- lint.linters_by_ft = lint.linters_by_ft or {} + -- lint.linters_by_ft['markdown'] = { 'markdownlint' } + -- + -- However, note that this will enable a set of default linters, + -- which will cause errors unless these tools are available: + -- { + -- clojure = { "clj-kondo" }, + -- dockerfile = { "hadolint" }, + -- inko = { "inko" }, + -- janet = { "janet" }, + -- json = { "jsonlint" }, + -- markdown = { "vale" }, + -- rst = { "vale" }, + -- ruby = { "ruby" }, + -- terraform = { "tflint" }, + -- text = { "vale" } + -- } + -- + -- You can disable the default linters by setting their filetypes to nil: + -- lint.linters_by_ft['clojure'] = nil + -- lint.linters_by_ft['dockerfile'] = nil + -- lint.linters_by_ft['inko'] = nil + -- lint.linters_by_ft['janet'] = nil + -- lint.linters_by_ft['json'] = nil + -- lint.linters_by_ft['markdown'] = nil + -- lint.linters_by_ft['rst'] = nil + -- lint.linters_by_ft['ruby'] = nil + -- lint.linters_by_ft['terraform'] = nil + -- lint.linters_by_ft['text'] = nil + + -- Create autocommand which carries out the actual linting + -- on the specified events. + local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true }) + vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { + group = lint_augroup, + callback = function() + require('lint').try_lint() + end, + }) + end, + }, +} From 8895c696ea7b5ffb795dd0248594babc7bd82368 Mon Sep 17 00:00:00 2001 From: Togglebit <74262215+togglebyte@users.noreply.github.com> Date: Mon, 18 Mar 2024 18:35:53 +0100 Subject: [PATCH 170/480] Some suggestions and capitalised a few words (#771) --- init.lua | 108 +++++++++++++++++++++++++++---------------------------- 1 file changed, 53 insertions(+), 55 deletions(-) diff --git a/init.lua b/init.lua index c2428867272..013fcc29267 100644 --- a/init.lua +++ b/init.lua @@ -29,7 +29,7 @@ What is Kickstart? what your configuration is doing, and modify it to suit your needs. Once you've done that, you can start exploring, configuring and tinkering to - make Neovim your own! That might mean leaving kickstart just the way it is for a while + make Neovim your own! That might mean leaving Kickstart just the way it is for a while or immediately breaking it into modular pieces. It's up to you! If you don't know anything about Lua, I recommend taking some time to read through @@ -51,32 +51,32 @@ Kickstart Guide: - Tutor - - (If you already know how the Neovim basics, you can skip this step) + (If you already know the Neovim basics, you can skip this step.) Once you've completed that, you can continue working through **AND READING** the rest - of the kickstart init.lua + of the kickstart init.lua. Next, run AND READ `:help`. This will open up a help window with some basic information about reading, navigating and searching the builtin help documentation. This should be the first place you go to look when you're stuck or confused - with something. It's one of my favorite neovim features. + with something. It's one of my favorite Neovim features. MOST IMPORTANTLY, we provide a keymap "sh" to [s]earch the [h]elp documentation, - which is very useful when you're not sure exactly what you're looking for. + which is very useful when you're not exactly sure of what you're looking for. I have left several `:help X` comments throughout the init.lua These are hints about where to find more information about the relevant settings, - plugins or neovim features used in kickstart. + plugins or Neovim features used in Kickstart. NOTE: Look for lines like this - Throughout the file. These are for you, the reader, to help understand what is happening. + Throughout the file. These are for you, the reader, to help you understand what is happening. Feel free to delete them once you know what you're doing, but they should serve as a guide - for when you are first encountering a few different constructs in your nvim config. + for when you are first encountering a few different constructs in your Neovim config. -If you experience any errors while trying to install kickstart, run `:checkhealth` for more info +If you experience any errors while trying to install kickstart, run `:checkhealth` for more info. I hope you enjoy your Neovim journey, - TJ @@ -100,14 +100,14 @@ vim.g.have_nerd_font = false -- Make line numbers default vim.opt.number = true --- You can also add relative line numbers, for help with jumping. +-- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! -- vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' --- Don't show the mode, since it's already in status line +-- Don't show the mode, since it's already in the status line vim.opt.showmode = false -- Sync clipboard between OS and Neovim. @@ -121,7 +121,7 @@ vim.opt.breakindent = true -- Save undo history vim.opt.undofile = true --- Case-insensitive searching UNLESS \C or capital in search +-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term vim.opt.ignorecase = true vim.opt.smartcase = true @@ -139,7 +139,7 @@ vim.opt.timeoutlen = 300 vim.opt.splitright = true vim.opt.splitbelow = true --- Sets how neovim will display certain whitespace in the editor. +-- Sets how neovim will display certain whitespace characters in the editor. -- See `:help 'list'` -- and `:help 'listchars'` vim.opt.list = true @@ -220,7 +220,7 @@ vim.opt.rtp:prepend(lazypath) -- -- You can press `?` in this menu for help. Use `:q` to close the window -- --- To update plugins, you can run +-- To update plugins you can run -- :Lazy update -- -- NOTE: Here is where you install your plugins. @@ -241,7 +241,7 @@ require('lazy').setup({ { 'numToStr/Comment.nvim', opts = {} }, -- Here is a more advanced example where we pass configuration - -- options to `gitsigns.nvim`. This is equivalent to the following lua: + -- options to `gitsigns.nvim`. This is equivalent to the following Lua: -- require('gitsigns').setup({ ... }) -- -- See `:help gitsigns` to understand what the configuration keys do @@ -258,7 +258,7 @@ require('lazy').setup({ }, }, - -- NOTE: Plugins can also be configured to run lua code when they are loaded. + -- NOTE: Plugins can also be configured to run Lua code when they are loaded. -- -- This is often very useful to both group configuration, as well as handle -- lazy loading plugins that don't need to be loaded immediately at startup. @@ -303,7 +303,7 @@ require('lazy').setup({ branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim', - { -- If encountering errors, see telescope-fzf-native README for install instructions + { -- If encountering errors, see telescope-fzf-native README for installation instructions 'nvim-telescope/telescope-fzf-native.nvim', -- `build` is used to run some command when the plugin is installed/updated. @@ -326,19 +326,19 @@ require('lazy').setup({ -- it can fuzzy find! It's more than just a "file finder", it can search -- many different aspects of Neovim, your workspace, LSP, and more! -- - -- The easiest way to use telescope, is to start by doing something like: + -- The easiest way to use Telescope, is to start by doing something like: -- :Telescope help_tags -- -- After running this command, a window will open up and you're able to - -- type in the prompt window. You'll see a list of help_tags options and + -- type in the prompt window. You'll see a list of `help_tags` options and -- a corresponding preview of the help. -- - -- Two important keymaps to use while in telescope are: + -- Two important keymaps to use while in Telescope are: -- - Insert mode: -- - Normal mode: ? -- -- This opens a window that shows you all of the keymaps for the current - -- telescope picker. This is really useful to discover what Telescope can + -- Telescope picker. This is really useful to discover what Telescope can -- do as well as how to actually do it! -- [[ Configure Telescope ]] @@ -360,7 +360,7 @@ require('lazy').setup({ }, } - -- Enable telescope extensions, if they are installed + -- Enable Telescope extensions if they are installed pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'ui-select') @@ -379,14 +379,14 @@ require('lazy').setup({ -- Slightly advanced example of overriding default behavior and theme vim.keymap.set('n', '/', function() - -- You can pass additional configuration to telescope to change theme, layout, etc. + -- You can pass additional configuration to Telescope to change the theme, layout, etc. builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { winblend = 10, previewer = false, }) end, { desc = '[/] Fuzzily search in current buffer' }) - -- Also possible to pass additional configuration options. + -- It's also possible to pass additional configuration options. -- See `:help telescope.builtin.live_grep()` for information about particular keys vim.keymap.set('n', 's/', function() builtin.live_grep { @@ -395,7 +395,7 @@ require('lazy').setup({ } end, { desc = '[S]earch [/] in Open Files' }) - -- Shortcut for searching your neovim configuration files + -- Shortcut for searching your Neovim configuration files vim.keymap.set('n', 'sn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[S]earch [N]eovim files' }) @@ -405,7 +405,7 @@ require('lazy').setup({ { -- LSP Configuration & Plugins 'neovim/nvim-lspconfig', dependencies = { - -- Automatically install LSPs and related tools to stdpath for neovim + -- Automatically install LSPs and related tools to stdpath for Neovim 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', @@ -419,15 +419,15 @@ require('lazy').setup({ { 'folke/neodev.nvim', opts = {} }, }, config = function() - -- Brief Aside: **What is LSP?** + -- Brief aside: **What is LSP?** -- - -- LSP is an acronym you've probably heard, but might not understand what it is. + -- LSP is an initialism you've probably heard, but might not understand what it is. -- -- LSP stands for Language Server Protocol. It's a protocol that helps editors -- and language tooling communicate in a standardized fashion. -- -- In general, you have a "server" which is some tool built to understand a particular - -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc). These Language Servers + -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone -- processes that communicate with some "client" - in this case, Neovim! -- @@ -451,9 +451,8 @@ require('lazy').setup({ vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), callback = function(event) - -- NOTE: Remember that lua is a real programming language, and as such it is possible - -- to define small helper and utility functions so you don't have to repeat yourself - -- many times. + -- NOTE: Remember that Lua is a real programming language, and as such it is possible + -- to define small helper and utility functions so you don't have to repeat yourself. -- -- In this case, we create a function that lets us more easily define mappings specific -- for LSP related items. It sets the mode, buffer and description for us each time. @@ -482,11 +481,11 @@ require('lazy').setup({ -- Symbols are things like variables, functions, types, etc. map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - -- Fuzzy find all the symbols in your current workspace - -- Similar to document symbols, except searches over your whole project. + -- Fuzzy find all the symbols in your current workspace. + -- Similar to document symbols, except searches over your entire project. map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') - -- Rename the variable under your cursor + -- Rename the variable under your cursor. -- Most Language Servers support renaming across files, etc. map('rn', vim.lsp.buf.rename, '[R]e[n]ame') @@ -495,11 +494,11 @@ require('lazy').setup({ map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') -- Opens a popup that displays documentation about the word under your cursor - -- See `:help K` for why this keymap + -- See `:help K` for why this keymap. map('K', vim.lsp.buf.hover, 'Hover Documentation') -- WARN: This is not Goto Definition, this is Goto Declaration. - -- For example, in C this would take you to the header + -- For example, in C this would take you to the header. map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') -- The following two autocommands are used to highlight references of the @@ -523,7 +522,7 @@ require('lazy').setup({ }) -- LSP servers and clients are able to communicate to each other what features they support. - -- By default, Neovim doesn't support everything that is in the LSP Specification. + -- By default, Neovim doesn't support everything that is in the LSP specification. -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers. local capabilities = vim.lsp.protocol.make_client_capabilities() @@ -573,14 +572,14 @@ require('lazy').setup({ -- other tools, you can run -- :Mason -- - -- You can press `g?` for help in this menu + -- You can press `g?` for help in this menu. require('mason').setup() -- You can add other tools here that you want Mason to install -- for you, so that they are available from within Neovim. local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { - 'stylua', -- Used to format lua code + 'stylua', -- Used to format Lua code }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } @@ -633,9 +632,9 @@ require('lazy').setup({ { 'L3MON4D3/LuaSnip', build = (function() - -- Build Step is needed for regex support in snippets - -- This step is not supported in many windows environments - -- Remove the below condition to re-enable on windows + -- Build Step is needed for regex support in snippets. + -- This step is not supported in many windows environments. + -- Remove the below condition to re-enable on windows. if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then return end @@ -685,7 +684,7 @@ require('lazy').setup({ -- Select the [p]revious item [''] = cmp.mapping.select_prev_item(), - -- scroll the documentation window [b]ack / [f]orward + -- Scroll the documentation window [b]ack / [f]orward [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), @@ -718,7 +717,7 @@ require('lazy').setup({ end end, { 'i', 's' }), - -- For more advanced luasnip keymaps (e.g. selecting choice nodes, expansion) see: + -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps }, sources = { @@ -732,18 +731,18 @@ require('lazy').setup({ { -- You can easily change to a different colorscheme. -- Change the name of the colorscheme plugin below, and then - -- change the command in the config to whatever the name of that colorscheme is + -- change the command in the config to whatever the name of that colorscheme is. -- - -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme` + -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. 'folke/tokyonight.nvim', - priority = 1000, -- make sure to load this before all the other start plugins + priority = 1000, -- Make sure to load this before all the other start plugins. init = function() -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. vim.cmd.colorscheme 'tokyonight-night' - -- You can configure highlights by doing something like + -- You can configure highlights by doing something like: vim.cmd.hi 'Comment gui=none' end, }, @@ -788,7 +787,6 @@ require('lazy').setup({ -- Check out: https://github.com/echasnovski/mini.nvim end, }, - { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', @@ -822,11 +820,11 @@ require('lazy').setup({ -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the -- init.lua. If you want these files, they are in the repository, so you can just download them and - -- put them in the right spots if you want. + -- place them in the correct locations. - -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for kickstart + -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart -- - -- Here are some example plugins that I've included in the kickstart repository. + -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- -- require 'kickstart.plugins.debug', @@ -841,8 +839,8 @@ require('lazy').setup({ -- { import = 'custom.plugins' }, }, { ui = { - -- If you have a Nerd Font, set icons to an empty table which will use the - -- default lazy.nvim defined Nerd Font icons otherwise define a unicode icons table + -- If you are using a Nerd Font: set icons to an empty table which will use the + -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table icons = vim.g.have_nerd_font and {} or { cmd = '⌘', config = '🛠', From 963c78a57d6e640c4c33bb419192d0072871322e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Miguel=20Sarasola?= Date: Mon, 18 Mar 2024 22:38:14 +0100 Subject: [PATCH 171/480] Add nvim-nio as dependency for nvim-dap-ui (#774) It's a dependency now --- lua/kickstart/plugins/debug.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 7fc783fabd4..7be4abdbd96 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -14,6 +14,9 @@ return { -- Creates a beautiful debugger UI 'rcarriga/nvim-dap-ui', + -- Required dependency for nvim-dap-ui + 'nvim-neotest/nvim-nio', + -- Installs the debug adapters for you 'williamboman/mason.nvim', 'jay-babu/mason-nvim-dap.nvim', From fab2f979503b64e3d675f58586ce720b55af4ec4 Mon Sep 17 00:00:00 2001 From: E <2061889+bozoputer@users.noreply.github.com> Date: Wed, 20 Mar 2024 14:27:18 -0400 Subject: [PATCH 172/480] Update README.md (#781) The recommended step of forking the repo coming sequentially after the step instructing users to clone the current repo doesn't make sense. This commit orders the install instructions in a manner that's more logical. --- README.md | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index e9d31703866..82ca52c9726 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,16 @@ Neovim's configurations are located under the following paths, depending on your ### Install Kickstart -Clone kickstart.nvim: +#### Recommended Step + +[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo so that you have your own copy that you can modify, then install by cloning the fork to your machine using one of the commands below, depending on your OS. + +> **NOTE** +> Your fork's url will be something like this: `https://github.com//kickstart.nvim.git` + +#### Clone kickstart.nvim +> **NOTE** +> If following the recommended step above (i.e., forking the repo), replace `nvim-lua` with `` in the commands below
Linux and Mac @@ -88,18 +97,6 @@ current plugin status. Read through the `init.lua` file in your configuration folder for more information about extending and exploring Neovim. -### Getting Started - -[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o) - -### Recommended Steps - -[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo -(so that you have your own copy that you can modify) and then install. You -can install it on your machine using the methods above. - -> **NOTE** -> Your fork's url will be something like this: `https://github.com//kickstart.nvim.git` #### Examples of adding popularly requested plugins @@ -159,6 +156,10 @@ return {
+### Getting Started + +[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o) + ### FAQ * What should I do if I already have a pre-existing neovim configuration? From 103604928755c08eb60b261309773acede464c05 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Thu, 21 Mar 2024 20:47:55 +0100 Subject: [PATCH 173/480] README: wrap long lines (#784) --- README.md | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 82ca52c9726..531c2fe1a02 100644 --- a/README.md +++ b/README.md @@ -50,14 +50,20 @@ Neovim's configurations are located under the following paths, depending on your #### Recommended Step -[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo so that you have your own copy that you can modify, then install by cloning the fork to your machine using one of the commands below, depending on your OS. +[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo +so that you have your own copy that you can modify, then install by cloning the +fork to your machine using one of the commands below, depending on your OS. + + > **NOTE** -> Your fork's url will be something like this: `https://github.com//kickstart.nvim.git` +> Your fork's url will be something like this: +> `https://github.com//kickstart.nvim.git` #### Clone kickstart.nvim > **NOTE** -> If following the recommended step above (i.e., forking the repo), replace `nvim-lua` with `` in the commands below +> If following the recommended step above (i.e., forking the repo), replace +> `nvim-lua` with `` in the commands below
Linux and Mac @@ -105,7 +111,9 @@ NOTE: You'll need to uncomment the line in the init.lua that turns on loading cu
Adding autopairs -This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs) and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim). +This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs) +and enable it on startup. For more information, see documentation for +[lazy.nvim](https://github.com/folke/lazy.nvim). In the file: `lua/custom/plugins/autopairs.lua`, add: @@ -133,7 +141,9 @@ return {
Adding a file tree plugin -This will install the tree plugin and add the command `:Neotree` for you. For more information, see the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim). +This will install the tree plugin and add the command `:Neotree` for you. +For more information, see the documentation at +[neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim). In the file: `lua/custom/plugins/filetree.lua`, add: @@ -164,13 +174,19 @@ return { * What should I do if I already have a pre-existing neovim configuration? * You should back it up and then delete all associated files. - * This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` + * This includes your existing init.lua and the neovim files in `~/.local` + which can be deleted with `rm -rf ~/.local/share/nvim/` * Can I keep my existing configuration in parallel to kickstart? - * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example, you can install the kickstart configuration in `~/.config/nvim-kickstart` and create an alias: + * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` + to maintain multiple configurations. For example, you can install the kickstart + configuration in `~/.config/nvim-kickstart` and create an alias: ``` alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim' ``` - When you run Neovim using `nvim-kickstart` alias it will use the alternative config directory and the matching local directory `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim distribution that you would like to try out. + When you run Neovim using `nvim-kickstart` alias it will use the alternative + config directory and the matching local directory + `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim + distribution that you would like to try out. * What if I want to "uninstall" this configuration: * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information * Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files? From 18670e4ebe2f3ba255fa4bfc18c37dd5273d7fb1 Mon Sep 17 00:00:00 2001 From: Liu Qisheng <81770798+Saplyn@users.noreply.github.com> Date: Wed, 27 Mar 2024 22:16:48 +0800 Subject: [PATCH 174/480] fix #799 (#800) Add `'luadoc'`, to the `ensure_installed` of `nvim-treesitter/nvim-treesitter` --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 013fcc29267..db55a9e8fd6 100644 --- a/init.lua +++ b/init.lua @@ -791,7 +791,7 @@ require('lazy').setup({ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opts = { - ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' }, + ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' }, -- Autoinstall languages that are not installed auto_install = true, highlight = { From 9e4cf7ab24af1871c462994e72b1e8fd48f2da85 Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Wed, 27 Mar 2024 11:22:28 -0400 Subject: [PATCH 175/480] Add instructions to quit :lazy. Fixes #761 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 531c2fe1a02..3453cfad5c1 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ nvim ``` That's it! Lazy will install all the plugins you have. Use `:Lazy` to view -current plugin status. +current plugin status. Hit `q` to close the window. Read through the `init.lua` file in your configuration folder for more information about extending and exploring Neovim. From a8617dda6ba2784bbd0ba78f354f77cc497811f3 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Sun, 31 Mar 2024 19:36:43 +0200 Subject: [PATCH 176/480] Add a keymap space-f to format buffer using conform (#817) This works also for visual range selection Copied from conform recipe: https://github.com/stevearc/conform.nvim/blob/master/doc/recipes.md --- init.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/init.lua b/init.lua index db55a9e8fd6..667fb9c5138 100644 --- a/init.lua +++ b/init.lua @@ -600,6 +600,16 @@ require('lazy').setup({ { -- Autoformat 'stevearc/conform.nvim', + keys = { + { + 'f', + function() + require('conform').format { async = true, lsp_fallback = true } + end, + mode = '', + desc = '[F]ormat buffer', + }, + }, opts = { notify_on_error = false, format_on_save = function(bufnr) From 4028a5224fcf5c27eb35b8cb5913159d6ab2afd2 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Mon, 1 Apr 2024 02:00:11 +0200 Subject: [PATCH 177/480] Don't lazy load conform plugin (#818) --- init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/init.lua b/init.lua index 667fb9c5138..496f45b85b1 100644 --- a/init.lua +++ b/init.lua @@ -600,6 +600,7 @@ require('lazy').setup({ { -- Autoformat 'stevearc/conform.nvim', + lazy = false, keys = { { 'f', From ff6b7da9965eb7dde61ade1c19ff3ccdc355c3b3 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Mon, 1 Apr 2024 16:36:32 +0200 Subject: [PATCH 178/480] README: move backup and paths from external deps to install section (#819) --- README.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3453cfad5c1..5ca19d7a07c 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,6 @@ If you are experiencing issues, please make sure you have the latest versions. ### Install External Dependencies -> **NOTE** -> [Backup](#FAQ) your previous configuration (if any exists) - External Requirements: - Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`) - [ripgrep](https://github.com/BurntSushi/ripgrep#installation) @@ -38,6 +35,11 @@ External Requirements: > See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes > and quick install snippets +### Install Kickstart + +> **NOTE** +> [Backup](#FAQ) your previous configuration (if any exists) + Neovim's configurations are located under the following paths, depending on your OS: | OS | PATH | @@ -46,16 +48,12 @@ Neovim's configurations are located under the following paths, depending on your | Windows (cmd)| `%userprofile%\AppData\Local\nvim\` | | Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` | -### Install Kickstart - #### Recommended Step [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo so that you have your own copy that you can modify, then install by cloning the fork to your machine using one of the commands below, depending on your OS. - - > **NOTE** > Your fork's url will be something like this: > `https://github.com//kickstart.nvim.git` From 79e04bbdd406979a4c3597e0dd64cd254e944ba1 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Thu, 4 Apr 2024 16:31:37 +0200 Subject: [PATCH 179/480] Add a pull request template (#825) --- .github/pull_request_template.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000000..f401c9ffd9c --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,8 @@ +*************************************************************************** +**NOTE** +Please verify that the `base repository` above has the intended destination! +Github by default opens Pull Requests against the parent of a forked repository. +If this is your personal fork and you didn't intend to open a PR for contribution +to the original project then adjust the `base repository` accordingly. +************************************************************************** + From 255a510831f6f824dcd14dcbe9f48a78b540e90e Mon Sep 17 00:00:00 2001 From: Viet <51826956+hoangvietdo@users.noreply.github.com> Date: Tue, 9 Apr 2024 05:13:22 +0900 Subject: [PATCH 180/480] Update README (#832) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ca19d7a07c..4dd8ac873d4 100644 --- a/README.md +++ b/README.md @@ -253,7 +253,7 @@ sudo apt install make gcc ripgrep unzip neovim ``` sudo add-apt-repository ppa:neovim-ppa/unstable -y sudo apt update -sudo apt install make gcc ripgrep unzip neovim +sudo apt install make gcc ripgrep unzip git neovim ```
Debian Install Steps From dfc4cf1971c8437cce09a0a267838972168c4474 Mon Sep 17 00:00:00 2001 From: rdvm Date: Tue, 16 Apr 2024 10:29:27 -0500 Subject: [PATCH 181/480] Arch, btw (#852) * Arch, btw * Add unzip * Add unzip for Fedora and --needed arg for Arch --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4dd8ac873d4..e67b94a3b6b 100644 --- a/README.md +++ b/README.md @@ -269,7 +269,14 @@ sudo apt install -t unstable neovim
Fedora Install Steps ``` -sudo dnf install -y gcc make git ripgrep fd-find neovim +sudo dnf install -y gcc make git ripgrep fd-find unzip neovim +``` +
+ +
Arch Install Steps + +``` +sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim ```
From 6a1017b2371efc306f8cbd89d3e7fcb4e2650a86 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Wed, 17 Apr 2024 15:59:14 +0200 Subject: [PATCH 182/480] Comment about nerd font selection. Fixes #853 (#854) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 496f45b85b1..1d922dfc52c 100644 --- a/init.lua +++ b/init.lua @@ -90,7 +90,7 @@ P.S. You can delete this when you're done too. It's your config now! :) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' --- Set to true if you have a Nerd Font installed +-- Set to true if you have a Nerd Font installed and selected in the terminal vim.g.have_nerd_font = false -- [[ Setting options ]] From 6d4dabe8f6dcec0af1509e0cf5ef5fbb95779d43 Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Wed, 17 Apr 2024 14:02:24 -0400 Subject: [PATCH 183/480] Fix: #847 - add prefer_git to treesitter config (#856) --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 1d922dfc52c..cc49351ed52 100644 --- a/init.lua +++ b/init.lua @@ -817,6 +817,8 @@ require('lazy').setup({ config = function(_, opts) -- [[ Configure Treesitter ]] See `:help nvim-treesitter` + -- Prefer git instead of curl in order to improve connectivity in some environments + require('nvim-treesitter.install').prefer_git = true ---@diagnostic disable-next-line: missing-fields require('nvim-treesitter.configs').setup(opts) From 089656394eeffcfd9c6d1de0d2df1286bd69e765 Mon Sep 17 00:00:00 2001 From: Vladislav Grechannik <52157081+VlaDexa@users.noreply.github.com> Date: Wed, 17 Apr 2024 20:04:55 +0200 Subject: [PATCH 184/480] Enable inlay hints for the supporting servers (#843) --- init.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/init.lua b/init.lua index cc49351ed52..4bd9b7f583d 100644 --- a/init.lua +++ b/init.lua @@ -286,6 +286,7 @@ require('lazy').setup({ ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, + ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, } end, }, @@ -518,6 +519,16 @@ require('lazy').setup({ callback = vim.lsp.buf.clear_references, }) end + + -- The following autocommand is used to enable inlay hints in your + -- code, if the language server you are using supports them + -- + -- This may be unwanted, since they displace some of your code + if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then + map('th', function() + vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled()) + end, '[T]oggle Inlay [H]ints') + end end, }) From 9a288f82eea2afc87b827ef02b45335dc1c53a25 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Wed, 17 Apr 2024 21:25:54 +0200 Subject: [PATCH 185/480] Move plugin examples from README to optional plugin files (#831) * Move autopairs example from README to an optional plugin * Move neo-tree example from README to an optional plugin --- README.md | 65 +---------------------------- init.lua | 2 + lua/kickstart/plugins/autopairs.lua | 16 +++++++ lua/kickstart/plugins/neo-tree.lua | 25 +++++++++++ 4 files changed, 45 insertions(+), 63 deletions(-) create mode 100644 lua/kickstart/plugins/autopairs.lua create mode 100644 lua/kickstart/plugins/neo-tree.lua diff --git a/README.md b/README.md index e67b94a3b6b..a427def240a 100644 --- a/README.md +++ b/README.md @@ -99,71 +99,10 @@ That's it! Lazy will install all the plugins you have. Use `:Lazy` to view current plugin status. Hit `q` to close the window. Read through the `init.lua` file in your configuration folder for more -information about extending and exploring Neovim. +information about extending and exploring Neovim. That includes also +examples of adding popularly requested plugins. -#### Examples of adding popularly requested plugins - -NOTE: You'll need to uncomment the line in the init.lua that turns on loading custom plugins. - -
- Adding autopairs - -This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs) -and enable it on startup. For more information, see documentation for -[lazy.nvim](https://github.com/folke/lazy.nvim). - -In the file: `lua/custom/plugins/autopairs.lua`, add: - -```lua --- File: lua/custom/plugins/autopairs.lua - -return { - "windwp/nvim-autopairs", - -- Optional dependency - dependencies = { 'hrsh7th/nvim-cmp' }, - config = function() - require("nvim-autopairs").setup {} - -- If you want to automatically add `(` after selecting a function or method - local cmp_autopairs = require('nvim-autopairs.completion.cmp') - local cmp = require('cmp') - cmp.event:on( - 'confirm_done', - cmp_autopairs.on_confirm_done() - ) - end, -} -``` - -
-
- Adding a file tree plugin - -This will install the tree plugin and add the command `:Neotree` for you. -For more information, see the documentation at -[neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim). - -In the file: `lua/custom/plugins/filetree.lua`, add: - -```lua --- File: lua/custom/plugins/filetree.lua - -return { - "nvim-neo-tree/neo-tree.nvim", - version = "*", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - "MunifTanjim/nui.nvim", - }, - config = function () - require('neo-tree').setup {} - end, -} -``` - -
- ### Getting Started [The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o) diff --git a/init.lua b/init.lua index 4bd9b7f583d..21d7df83780 100644 --- a/init.lua +++ b/init.lua @@ -854,6 +854,8 @@ require('lazy').setup({ -- require 'kickstart.plugins.debug', -- require 'kickstart.plugins.indent_line', -- require 'kickstart.plugins.lint', + -- require 'kickstart.plugins.autopairs', + -- require 'kickstart.plugins.neo-tree', -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. diff --git a/lua/kickstart/plugins/autopairs.lua b/lua/kickstart/plugins/autopairs.lua new file mode 100644 index 00000000000..87a7e5ffa2e --- /dev/null +++ b/lua/kickstart/plugins/autopairs.lua @@ -0,0 +1,16 @@ +-- autopairs +-- https://github.com/windwp/nvim-autopairs + +return { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + -- Optional dependency + dependencies = { 'hrsh7th/nvim-cmp' }, + config = function() + require('nvim-autopairs').setup {} + -- If you want to automatically add `(` after selecting a function or method + local cmp_autopairs = require 'nvim-autopairs.completion.cmp' + local cmp = require 'cmp' + cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) + end, +} diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua new file mode 100644 index 00000000000..c793b885bc6 --- /dev/null +++ b/lua/kickstart/plugins/neo-tree.lua @@ -0,0 +1,25 @@ +-- Neo-tree is a Neovim plugin to browse the file system +-- https://github.com/nvim-neo-tree/neo-tree.nvim + +return { + 'nvim-neo-tree/neo-tree.nvim', + version = '*', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended + 'MunifTanjim/nui.nvim', + }, + cmd = 'Neotree', + keys = { + { '\\', ':Neotree reveal', { desc = 'NeoTree reveal' } }, + }, + opts = { + filesystem = { + window = { + mappings = { + ['\\'] = 'close_window', + }, + }, + }, + }, +} From 5870387de023ca65e92a78972970313691bad308 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Thu, 18 Apr 2024 03:00:39 +0200 Subject: [PATCH 186/480] Add gitsigns recommended keymaps as an optional plugin (#858) --- init.lua | 6 +++ lua/kickstart/plugins/gitsigns.lua | 61 ++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 lua/kickstart/plugins/gitsigns.lua diff --git a/init.lua b/init.lua index 21d7df83780..a182828eebf 100644 --- a/init.lua +++ b/init.lua @@ -287,7 +287,12 @@ require('lazy').setup({ ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, + ['h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, } + -- visual mode + require('which-key').register({ + ['h'] = { 'Git [H]unk' }, + }, { mode = 'v' }) end, }, @@ -856,6 +861,7 @@ require('lazy').setup({ -- require 'kickstart.plugins.lint', -- require 'kickstart.plugins.autopairs', -- require 'kickstart.plugins.neo-tree', + -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. diff --git a/lua/kickstart/plugins/gitsigns.lua b/lua/kickstart/plugins/gitsigns.lua new file mode 100644 index 00000000000..4bcc70f4c79 --- /dev/null +++ b/lua/kickstart/plugins/gitsigns.lua @@ -0,0 +1,61 @@ +-- Adds git related signs to the gutter, as well as utilities for managing changes +-- NOTE: gitsigns is already included in init.lua but contains only the base +-- config. This will add also the recommended keymaps. + +return { + { + 'lewis6991/gitsigns.nvim', + opts = { + on_attach = function(bufnr) + local gitsigns = require 'gitsigns' + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map('n', ']c', function() + if vim.wo.diff then + vim.cmd.normal { ']c', bang = true } + else + gitsigns.nav_hunk 'next' + end + end, { desc = 'Jump to next git [c]hange' }) + + map('n', '[c', function() + if vim.wo.diff then + vim.cmd.normal { '[c', bang = true } + else + gitsigns.nav_hunk 'prev' + end + end, { desc = 'Jump to previous git [c]hange' }) + + -- Actions + -- visual mode + map('v', 'hs', function() + gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'stage git hunk' }) + map('v', 'hr', function() + gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'reset git hunk' }) + -- normal mode + map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) + map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) + map('n', 'hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) + map('n', 'hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' }) + map('n', 'hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) + map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) + map('n', 'hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) + map('n', 'hd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) + map('n', 'hD', function() + gitsigns.diffthis '@' + end, { desc = 'git [D]iff against last commit' }) + -- Toggles + map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) + map('n', 'tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' }) + end, + }, + }, +} From f72f7968e878fdcf657c1c6b5c20463296fcdb54 Mon Sep 17 00:00:00 2001 From: GameFuzzy Date: Fri, 19 Apr 2024 19:50:42 +0200 Subject: [PATCH 187/480] fix: restore Mason config timing for DAP startup (again) (#865) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index a182828eebf..62d2c5cfe8c 100644 --- a/init.lua +++ b/init.lua @@ -412,7 +412,7 @@ require('lazy').setup({ 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs and related tools to stdpath for Neovim - 'williamboman/mason.nvim', + { 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants 'williamboman/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', From 48fc8e09e86eb2ac82e6ea48fc4fe248ec7c1fc1 Mon Sep 17 00:00:00 2001 From: Evan Carroll Date: Sat, 20 Apr 2024 10:55:01 -0500 Subject: [PATCH 188/480] Update README.md (#860) Attempted fix for #859, provide reasonable Debian install instructions -- comment on GitHub issue with refinement. --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a427def240a..4cb89536d7c 100644 --- a/README.md +++ b/README.md @@ -200,9 +200,14 @@ sudo apt install make gcc ripgrep unzip git neovim ``` sudo apt update sudo apt install make gcc ripgrep unzip git -echo "deb https://deb.debian.org/debian unstable main" | sudo tee -a /etc/apt/sources.list -sudo apt update -sudo apt install -t unstable neovim + +# Now we install nvim +curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz +sudo rm -rf /opt/nvim +sudo tar -C /opt -xzf nvim-linux64.tar.gz + +# make it available in /usr/local/bin, distro installs to /usr/bin +sudo ln -sf /opt/nvim-linux64/bin/nvim /usr/local/bin/ ```
Fedora Install Steps From 48d9f5c4d31c391aca2c95fd0b7085dd34f5418f Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Sat, 20 Apr 2024 19:14:24 +0200 Subject: [PATCH 189/480] Minor improvements of debian install instructions. Fixes #859 (#869) --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4cb89536d7c..dd51f209b38 100644 --- a/README.md +++ b/README.md @@ -199,11 +199,13 @@ sudo apt install make gcc ripgrep unzip git neovim ``` sudo apt update -sudo apt install make gcc ripgrep unzip git +sudo apt install make gcc ripgrep unzip git curl # Now we install nvim curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz -sudo rm -rf /opt/nvim +sudo rm -rf /opt/nvim-linux64 +sudo mkdir -p /opt/nvim-linux64 +sudo chmod a+rX /opt/nvim-linux64 sudo tar -C /opt -xzf nvim-linux64.tar.gz # make it available in /usr/local/bin, distro installs to /usr/bin From 563007e2f458f659ef188da5d5ed5e03190f15e3 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Sat, 20 Apr 2024 19:14:49 +0200 Subject: [PATCH 190/480] Add a commented out example of the classic complete keymaps. Fixes #866 (#868) --- init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/init.lua b/init.lua index 62d2c5cfe8c..3c70d7364af 100644 --- a/init.lua +++ b/init.lua @@ -720,6 +720,12 @@ require('lazy').setup({ -- This will expand snippets if the LSP sent a snippet. [''] = cmp.mapping.confirm { select = true }, + -- If you prefer more traditional completion keymaps, + -- you can uncomment the following lines + --[''] = cmp.mapping.confirm { select = true }, + --[''] = cmp.mapping.select_next_item(), + --[''] = cmp.mapping.select_prev_item(), + -- Manually trigger a completion from nvim-cmp. -- Generally you don't need this, because nvim-cmp will display -- completions whenever it has completion options available. From c3b0103a3e35d35f36ee59453e6a734a140ca7d6 Mon Sep 17 00:00:00 2001 From: Vladislav Grechannik <52157081+VlaDexa@users.noreply.github.com> Date: Mon, 22 Apr 2024 13:27:13 +0200 Subject: [PATCH 191/480] Fix deprecation notice of inlay hints (#873) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 3c70d7364af..256da5b8d6f 100644 --- a/init.lua +++ b/init.lua @@ -531,7 +531,7 @@ require('lazy').setup({ -- This may be unwanted, since they displace some of your code if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then map('th', function() - vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled()) + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) end, '[T]oggle Inlay [H]ints') end end, From 76c25b08ccb4060282c01b5fb3e4fb13c2f95fb4 Mon Sep 17 00:00:00 2001 From: Francis Belanger Date: Mon, 22 Apr 2024 11:43:10 -0400 Subject: [PATCH 192/480] Fix highlight errors when lsp crash or stop (#864) * Fix highlight errors when lsp crash or stop It adds a check wether the client is still available before highlighting. If the client is not there anymore it returns `true` to unregister the autocommand This fix the `method textDocument/documentHighlight is not supported by any of the servers registered for the current buffer` errors when doing a LspRestart or the server crashes * Delete the highlight autocommands in the LspDetatch event * Only delete autocmds for the current buffer with the group name * Simplify clearing the autocommands --------- Co-authored-by: Francis Belanger --- init.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/init.lua b/init.lua index 256da5b8d6f..ccca32c815f 100644 --- a/init.lua +++ b/init.lua @@ -514,13 +514,16 @@ require('lazy').setup({ -- When you move your cursor, the highlights will be cleared (the second autocommand). local client = vim.lsp.get_client_by_id(event.data.client_id) if client and client.server_capabilities.documentHighlightProvider then + local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = true }) vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { buffer = event.buf, + group = highlight_augroup, callback = vim.lsp.buf.document_highlight, }) vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { buffer = event.buf, + group = highlight_augroup, callback = vim.lsp.buf.clear_references, }) end @@ -537,6 +540,14 @@ require('lazy').setup({ end, }) + vim.api.nvim_create_autocmd('LspDetach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), + callback = function(event) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event.buf } + end, + }) + -- LSP servers and clients are able to communicate to each other what features they support. -- By default, Neovim doesn't support everything that is in the LSP specification. -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. From 7464adef9beba4b16ceb885f2d2ee2b9c65281fa Mon Sep 17 00:00:00 2001 From: Francis Belanger Date: Mon, 22 Apr 2024 15:53:45 -0400 Subject: [PATCH 193/480] fix: highlight group clear on each attach (#874) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index ccca32c815f..036eefb8c3b 100644 --- a/init.lua +++ b/init.lua @@ -514,7 +514,7 @@ require('lazy').setup({ -- When you move your cursor, the highlights will be cleared (the second autocommand). local client = vim.lsp.get_client_by_id(event.data.client_id) if client and client.server_capabilities.documentHighlightProvider then - local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = true }) + local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { buffer = event.buf, group = highlight_augroup, From 32cc8b66f002ea3c47e2e58f5367ef63df9b29ca Mon Sep 17 00:00:00 2001 From: Adolfo Gante Date: Mon, 22 Apr 2024 14:15:42 -0700 Subject: [PATCH 194/480] Update README.md (#875) Line 102. Placed 'also' before the 'includes'. "That includes also examples of adding popularly requested plugins." ---> "That also includes examples of adding popularly requested plugins." --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dd51f209b38..be313bdb565 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ That's it! Lazy will install all the plugins you have. Use `:Lazy` to view current plugin status. Hit `q` to close the window. Read through the `init.lua` file in your configuration folder for more -information about extending and exploring Neovim. That includes also +information about extending and exploring Neovim. That also includes examples of adding popularly requested plugins. From 9166575b5b1e76755988103fe31b3b02d3e613a4 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Sat, 27 Apr 2024 22:40:27 +0200 Subject: [PATCH 195/480] README: add clipboard tool dependency (#886) Fixes: #884 Neovim requires an external tool for proper system clipboard integration. Some systems install this already by default: - on Fedora xsel is already installed by default - on Windows using the choko install the win32yank is alredy installed This is not installed by default on ubuntu or debian so adding that to the dependencies list and to the install instructions snippets. --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index be313bdb565..f445b65ecd5 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ If you are experiencing issues, please make sure you have the latest versions. External Requirements: - Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`) - [ripgrep](https://github.com/BurntSushi/ripgrep#installation) +- Clipboard tool (xclip/xsel/win32yank or other depending on platform) - A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons - if you have it set `vim.g.have_nerd_font` in `init.lua` to true - Language Setup: @@ -182,7 +183,7 @@ wsl --install wsl sudo add-apt-repository ppa:neovim-ppa/unstable -y sudo apt update -sudo apt install make gcc ripgrep unzip neovim +sudo apt install make gcc ripgrep unzip git xclip neovim ```
@@ -192,14 +193,14 @@ sudo apt install make gcc ripgrep unzip neovim ``` sudo add-apt-repository ppa:neovim-ppa/unstable -y sudo apt update -sudo apt install make gcc ripgrep unzip git neovim +sudo apt install make gcc ripgrep unzip git xclip neovim ```
Debian Install Steps ``` sudo apt update -sudo apt install make gcc ripgrep unzip git curl +sudo apt install make gcc ripgrep unzip git xclip curl # Now we install nvim curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz From 083764a71b6771b4bfc50014f2979bf627d2362f Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Thu, 2 May 2024 22:53:07 +0200 Subject: [PATCH 196/480] Move LspDetach handler near kickstart-lsp-highlight group (#900) Moved to make sure the kickstart-lsp-highlight group exists when the LspDetach handler is invoked. The LspDetach handler is used to clean up any lsp highlights that were enabled by CursorHold if the LSP is stopped or crashed. --- init.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index 036eefb8c3b..457ad214873 100644 --- a/init.lua +++ b/init.lua @@ -526,6 +526,14 @@ require('lazy').setup({ group = highlight_augroup, callback = vim.lsp.buf.clear_references, }) + + vim.api.nvim_create_autocmd('LspDetach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } + end, + }) end -- The following autocommand is used to enable inlay hints in your @@ -540,14 +548,6 @@ require('lazy').setup({ end, }) - vim.api.nvim_create_autocmd('LspDetach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), - callback = function(event) - vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event.buf } - end, - }) - -- LSP servers and clients are able to communicate to each other what features they support. -- By default, Neovim doesn't support everything that is in the LSP specification. -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. From b46a24a8c90bab0e4d3dff00eb1ad01eed4d10d8 Mon Sep 17 00:00:00 2001 From: Richard Macklin <1863540+rmacklin@users.noreply.github.com> Date: Sun, 5 May 2024 18:01:39 -0700 Subject: [PATCH 197/480] Add diff to treesitter's ensure_installed languages (#908) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 457ad214873..88658ef3033 100644 --- a/init.lua +++ b/init.lua @@ -835,7 +835,7 @@ require('lazy').setup({ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opts = { - ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' }, + ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' }, -- Autoinstall languages that are not installed auto_install = true, highlight = { From 4c50790e263fb22bb1cf4ee20a808da3733781dc Mon Sep 17 00:00:00 2001 From: Smig <89040888+smiggiddy@users.noreply.github.com> Date: Wed, 8 May 2024 10:55:49 -0400 Subject: [PATCH 198/480] fix: debug.lua (#918) --- lua/kickstart/plugins/debug.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 7be4abdbd96..d4d146594e0 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -31,7 +31,7 @@ return { require('mason-nvim-dap').setup { -- Makes a best effort to setup the various debuggers with -- reasonable debug configurations - automatic_setup = true, + automatic_installation = true, -- You can provide additional configuration to the handlers, -- see mason-nvim-dap README for more information From 74322d795c35c0e5af6d5e3d2f8e0809b0a75567 Mon Sep 17 00:00:00 2001 From: Per Malmberg Date: Fri, 10 May 2024 19:43:22 +0200 Subject: [PATCH 199/480] Automatically set detached state as needed. (#925) * Automatically set detached state as needed. * Use vim.fn.has instead. * Fix int vs bool. --- lua/kickstart/plugins/debug.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index d4d146594e0..31dfecf5b38 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -85,6 +85,12 @@ return { dap.listeners.before.event_exited['dapui_config'] = dapui.close -- Install golang specific config - require('dap-go').setup() + require('dap-go').setup { + delve = { + -- On Windows delve must be run attached or it crashes. + -- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring + detached = vim.fn.has 'win32' == 0, + }, + } end, } From 024767ee1f56d735273519b985da44cee9bdabda Mon Sep 17 00:00:00 2001 From: Vladislav Grechannik <52157081+VlaDexa@users.noreply.github.com> Date: Tue, 16 Jul 2024 18:05:40 +0200 Subject: [PATCH 200/480] which-key v3 update (#1022) * which-key v3 update * remove unneeded brackets from which-key registration --- init.lua | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index 88658ef3033..907ef90ce0b 100644 --- a/init.lua +++ b/init.lua @@ -280,19 +280,15 @@ require('lazy').setup({ require('which-key').setup() -- Document existing key chains - require('which-key').register { - ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, - ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, - ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, - ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, - ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, - ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, - ['h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, + require('which-key').add { + { 'c', group = '[C]ode' }, + { 'd', group = '[D]ocument' }, + { 'r', group = '[R]ename' }, + { 's', group = '[S]earch' }, + { 'w', group = '[W]orkspace' }, + { 't', group = '[T]oggle' }, + { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, } - -- visual mode - require('which-key').register({ - ['h'] = { 'Git [H]unk' }, - }, { mode = 'v' }) end, }, From fca8610331a0ff7c3b6b51fa66b3c393c4b523bb Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 16 Jul 2024 18:06:47 +0200 Subject: [PATCH 201/480] fix(lazy): added error handling for bootstrap (#1001) --- init.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 907ef90ce0b..f5205cafde6 100644 --- a/init.lua +++ b/init.lua @@ -209,7 +209,10 @@ vim.api.nvim_create_autocmd('TextYankPost', { local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not vim.loop.fs_stat(lazypath) then local lazyrepo = 'https://github.com/folke/lazy.nvim.git' - vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } + local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } + if vim.v.shell_error ~= 0 then + error('Error cloning lazy.nvim:\n' .. out) + end end ---@diagnostic disable-next-line: undefined-field vim.opt.rtp:prepend(lazypath) From 6f64ee1384f786f411ab25a8bbf088c0df29307a Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Wed, 17 Jul 2024 21:37:31 -0400 Subject: [PATCH 202/480] fix: add required parsers from nvim-treesitter --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index f5205cafde6..624e23d87fe 100644 --- a/init.lua +++ b/init.lua @@ -834,7 +834,7 @@ require('lazy').setup({ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' }, + ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, -- Autoinstall languages that are not installed auto_install = true, highlight = { From 1dbc74dc31459d3a1c9aae85cfb07306cd91fbf6 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Sun, 21 Jul 2024 22:22:10 +0200 Subject: [PATCH 203/480] Fix neo-tree keymap description (#932) The lazy.nvim keys parameter does not need the `desc` to be inside a table in the way that vim.keymap.set() does. With this fix the keymap description will be properly shown for example in telescope keymap search --- lua/kickstart/plugins/neo-tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua index c793b885bc6..f126d68af2c 100644 --- a/lua/kickstart/plugins/neo-tree.lua +++ b/lua/kickstart/plugins/neo-tree.lua @@ -11,7 +11,7 @@ return { }, cmd = 'Neotree', keys = { - { '\\', ':Neotree reveal', { desc = 'NeoTree reveal' } }, + { '\\', ':Neotree reveal', desc = 'NeoTree reveal' }, }, opts = { filesystem = { From 2606000d6b4e7db0fe5acf5e1f106890ea2797d2 Mon Sep 17 00:00:00 2001 From: Tom Kuson Date: Sun, 21 Jul 2024 22:22:44 +0200 Subject: [PATCH 204/480] Remove redundant require (#959) --- lua/kickstart/plugins/lint.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index 7f0dc42fbbf..ca9bc237904 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -47,7 +47,7 @@ return { vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { group = lint_augroup, callback = function() - require('lint').try_lint() + lint.try_lint() end, }) end, From c361ae05a5c5405da41d8bf335342eb2a08d0208 Mon Sep 17 00:00:00 2001 From: Vladislav Grechannik <52157081+VlaDexa@users.noreply.github.com> Date: Sun, 21 Jul 2024 22:24:57 +0200 Subject: [PATCH 205/480] Make debug lazy loadable (#978) --- lua/kickstart/plugins/debug.lua | 35 +++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 31dfecf5b38..196f2c6dbd6 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -24,6 +24,28 @@ return { -- Add your own debuggers here 'leoluz/nvim-dap-go', }, + keys = function(_, keys) + local dap = require 'dap' + local dapui = require 'dapui' + return { + -- Basic debugging keymaps, feel free to change to your liking! + { '', dap.continue, desc = 'Debug: Start/Continue' }, + { '', dap.step_into, desc = 'Debug: Step Into' }, + { '', dap.step_over, desc = 'Debug: Step Over' }, + { '', dap.step_out, desc = 'Debug: Step Out' }, + { 'b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' }, + { + 'B', + function() + dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') + end, + desc = 'Debug: Set Breakpoint', + }, + -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. + { '', dapui.toggle, desc = 'Debug: See last session result.' }, + unpack(keys), + } + end, config = function() local dap = require 'dap' local dapui = require 'dapui' @@ -45,16 +67,6 @@ return { }, } - -- Basic debugging keymaps, feel free to change to your liking! - vim.keymap.set('n', '', dap.continue, { desc = 'Debug: Start/Continue' }) - vim.keymap.set('n', '', dap.step_into, { desc = 'Debug: Step Into' }) - vim.keymap.set('n', '', dap.step_over, { desc = 'Debug: Step Over' }) - vim.keymap.set('n', '', dap.step_out, { desc = 'Debug: Step Out' }) - vim.keymap.set('n', 'b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) - vim.keymap.set('n', 'B', function() - dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') - end, { desc = 'Debug: Set Breakpoint' }) - -- Dap UI setup -- For more information, see |:help nvim-dap-ui| dapui.setup { @@ -77,9 +89,6 @@ return { }, } - -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. - vim.keymap.set('n', '', dapui.toggle, { desc = 'Debug: See last session result.' }) - dap.listeners.after.event_initialized['dapui_config'] = dapui.open dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close From 83a289ae6a4410cb842bceda343df1c84e5f60b9 Mon Sep 17 00:00:00 2001 From: Artyom <84637383+MZhuvka@users.noreply.github.com> Date: Sun, 21 Jul 2024 23:33:26 +0300 Subject: [PATCH 206/480] Update README.md | %userprofile%\appdata\local -> %localappdata% (#963) - Replace `%userprofile%\AppData\Local\nvim\` and `$env:USERPROFILE\AppData\Local\nvim` to `%localappdata%\nvim` and `$env:LOCALAPPDATA\nvim respectfully` --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f445b65ecd5..3f19854cd20 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,8 @@ Neovim's configurations are located under the following paths, depending on your | OS | PATH | | :- | :--- | | Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | -| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` | -| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` | +| Windows (cmd)| `%localappdata%\nvim\` | +| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` | #### Recommended Step @@ -77,13 +77,13 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HO If you're using `cmd.exe`: ``` -git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ +git clone https://github.com/nvim-lua/kickstart.nvim.git %localappdata%\nvim\ ``` If you're using `powershell.exe` ``` -git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\ +git clone https://github.com/nvim-lua/kickstart.nvim.git $env:LOCALAPPDATA\nvim\ ```
From 7c37cfa639d97445acce5744d5ea47fba963e38d Mon Sep 17 00:00:00 2001 From: Vladislav Grechannik <52157081+VlaDexa@users.noreply.github.com> Date: Sun, 21 Jul 2024 22:34:17 +0200 Subject: [PATCH 207/480] Make conform.nvim be lazy-loadable again (#977) The PR that disabled lazy loading (#818) was to fix plugin not being loaded before write. This sets up lazy to load conform before write. --- init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 624e23d87fe..de4264b2f04 100644 --- a/init.lua +++ b/init.lua @@ -626,7 +626,8 @@ require('lazy').setup({ { -- Autoformat 'stevearc/conform.nvim', - lazy = false, + event = { 'BufWritePre' }, + cmd = { 'ConformInfo' }, keys = { { 'f', From f20f0f5b2e01c9e9f1df2079f804c342f08ad061 Mon Sep 17 00:00:00 2001 From: Richard Macklin <1863540+rmacklin@users.noreply.github.com> Date: Sun, 21 Jul 2024 13:34:51 -0700 Subject: [PATCH 208/480] Fix comment about mini.ai example (#985) This example wasn't using `'` so this makes more sense --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index de4264b2f04..8e252894c45 100644 --- a/init.lua +++ b/init.lua @@ -801,7 +801,7 @@ require('lazy').setup({ -- -- Examples: -- - va) - [V]isually select [A]round [)]paren - -- - yinq - [Y]ank [I]nside [N]ext [']quote + -- - yinq - [Y]ank [I]nside [N]ext [Q]uote -- - ci' - [C]hange [I]nside [']quote require('mini.ai').setup { n_lines = 500 } From dc3dcc5a1cff1a3ea4b5b07d1407e90478884f0d Mon Sep 17 00:00:00 2001 From: Vladislav Grechannik <52157081+VlaDexa@users.noreply.github.com> Date: Mon, 22 Jul 2024 02:35:07 +0200 Subject: [PATCH 209/480] Neovim 0.10 updates (#936) * Neovim 0.10 updates Provide the buffer for which to enable inlay hints Co-authored-by: Matt Mirus * refactor: replace vim.loop with vim.uv * Upgrade folke/neodev (sunsetting) to folke/lazydev * Update checkhealth for 0.10 release --------- Co-authored-by: Matt Mirus Co-authored-by: mrr11k Co-authored-by: Seb Tomasini --- init.lua | 29 +++++++++++------------------ lua/kickstart/health.lua | 6 +++--- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/init.lua b/init.lua index 8e252894c45..a1c900f5ec1 100644 --- a/init.lua +++ b/init.lua @@ -162,9 +162,6 @@ vim.opt.hlsearch = true vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic keymaps -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' }) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' }) -vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier @@ -207,7 +204,7 @@ vim.api.nvim_create_autocmd('TextYankPost', { -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' -if not vim.loop.fs_stat(lazypath) then +if not vim.uv.fs_stat(lazypath) then local lazyrepo = 'https://github.com/folke/lazy.nvim.git' local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } if vim.v.shell_error ~= 0 then @@ -237,11 +234,6 @@ require('lazy').setup({ -- -- Use `opts = {}` to force a plugin to be loaded. -- - -- This is equivalent to: - -- require('Comment').setup({}) - - -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, -- Here is a more advanced example where we pass configuration -- options to `gitsigns.nvim`. This is equivalent to the following Lua: @@ -419,9 +411,9 @@ require('lazy').setup({ -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` { 'j-hui/fidget.nvim', opts = {} }, - -- `neodev` configures Lua LSP for your Neovim config, runtime and plugins + -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins -- used for completion, annotations and signatures of Neovim apis - { 'folke/neodev.nvim', opts = {} }, + { 'folke/lazydev.nvim', ft = 'lua', opts = {} }, }, config = function() -- Brief aside: **What is LSP?** @@ -498,10 +490,6 @@ require('lazy').setup({ -- or a suggestion from your LSP for this to activate. map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') - -- Opens a popup that displays documentation about the word under your cursor - -- See `:help K` for why this keymap. - map('K', vim.lsp.buf.hover, 'Hover Documentation') - -- WARN: This is not Goto Definition, this is Goto Declaration. -- For example, in C this would take you to the header. map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') @@ -512,7 +500,7 @@ require('lazy').setup({ -- -- When you move your cursor, the highlights will be cleared (the second autocommand). local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client.server_capabilities.documentHighlightProvider then + if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { buffer = event.buf, @@ -539,9 +527,9 @@ require('lazy').setup({ -- code, if the language server you are using supports them -- -- This may be unwanted, since they displace some of your code - if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then + if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then map('th', function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints') end end, @@ -765,6 +753,11 @@ require('lazy').setup({ -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps }, sources = { + { + name = 'lazydev', + -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it + group_index = 0, + }, { name = 'nvim_lsp' }, { name = 'luasnip' }, { name = 'path' }, diff --git a/lua/kickstart/health.lua b/lua/kickstart/health.lua index 04df77b33e8..b59d08649af 100644 --- a/lua/kickstart/health.lua +++ b/lua/kickstart/health.lua @@ -6,13 +6,13 @@ --]] local check_version = function() - local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch) - if not vim.version.cmp then + local verstr = tostring(vim.version()) + if not vim.version.ge then vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) return end - if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then + if vim.version.ge(vim.version(), '0.10-dev') then vim.health.ok(string.format("Neovim version is: '%s'", verstr)) else vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) From a986882465144ca2031293e881346a396013b399 Mon Sep 17 00:00:00 2001 From: Richard Macklin <1863540+rmacklin@users.noreply.github.com> Date: Sun, 21 Jul 2024 19:08:09 -0700 Subject: [PATCH 210/480] Update lazydev config to fix "Undefined field `fs_stat`" LSP error (#1040) dc3dcc5a1cff1a3ea4b5b07d1407e90478884f0d switched from neodev to lazydev, but in the process it introduced an LSP error in `init.lua`, which degrades the desired "first timer" experience of kickstart.nvim. This commit follows the configuration suggested in https://github.com/folke/lazydev.nvim/tree/6184ebbbc8045d70077659b7d30c705a588dc62f#-installation which resolves the LSP error. --- init.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index a1c900f5ec1..77181309c0e 100644 --- a/init.lua +++ b/init.lua @@ -413,7 +413,17 @@ require('lazy').setup({ -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins -- used for completion, annotations and signatures of Neovim apis - { 'folke/lazydev.nvim', ft = 'lua', opts = {} }, + { + 'folke/lazydev.nvim', + ft = 'lua', + opts = { + library = { + -- Load luvit types when the `vim.uv` word is found + { path = 'luvit-meta/library', words = { 'vim%.uv' } }, + }, + }, + }, + { 'Bilal2453/luvit-meta', lazy = true }, }, config = function() -- Brief aside: **What is LSP?** From 45c1ee09dc3677377e938ebdfc54926edd594daa Mon Sep 17 00:00:00 2001 From: srdtrk <59252793+srdtrk@users.noreply.github.com> Date: Mon, 22 Jul 2024 04:21:21 +0200 Subject: [PATCH 211/480] lint: fix lsp warning in `vim.lsp.inlay_hint.is_enabled` (#947) * fix: lsp warning * review suggestion Co-authored-by: Tom Kuson --------- Co-authored-by: Tom Kuson From f5d2ad10f6789464457663626d6db1be93d57ac6 Mon Sep 17 00:00:00 2001 From: Richard Macklin <1863540+rmacklin@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:00:35 -0700 Subject: [PATCH 212/480] Update comment about the toggle inlay hints keymap (#1041) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 77181309c0e..0d380e8dc28 100644 --- a/init.lua +++ b/init.lua @@ -533,7 +533,7 @@ require('lazy').setup({ }) end - -- The following autocommand is used to enable inlay hints in your + -- The following code creates a keymap to toggle inlay hints in your -- code, if the language server you are using supports them -- -- This may be unwanted, since they displace some of your code From 9e0f306ab8b6ceeb2ea04d65da0abc9f1f15971b Mon Sep 17 00:00:00 2001 From: Arvin Verain Date: Mon, 29 Jul 2024 00:39:54 +0800 Subject: [PATCH 213/480] Remove redundant hlsearch option (#1058) --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 0d380e8dc28..bfbb676ab62 100644 --- a/init.lua +++ b/init.lua @@ -157,8 +157,8 @@ vim.opt.scrolloff = 10 -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` --- Set highlight on search, but clear on pressing in normal mode -vim.opt.hlsearch = true +-- Clear highlights on search when pressing in normal mode +-- See `:help hlsearch` vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic keymaps From 693713c83d1e632ccfeeb6ac092cb86896e6e57f Mon Sep 17 00:00:00 2001 From: Brandon Clark Date: Sun, 28 Jul 2024 12:43:08 -0400 Subject: [PATCH 214/480] Modify conform comments to prevent deprecation warning when used (#1057) --- init.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index bfbb676ab62..d4d7b8c269f 100644 --- a/init.lua +++ b/init.lua @@ -653,9 +653,8 @@ require('lazy').setup({ -- Conform can also run multiple formatters sequentially -- python = { "isort", "black" }, -- - -- You can use a sub-list to tell conform to run *until* a formatter - -- is found. - -- javascript = { { "prettierd", "prettier" } }, + -- You can use 'stop_after_first' to run the first available formatter from the list + -- javascript = { "prettierd", "prettier", stop_after_first = true }, }, }, }, From 4e6e0db7e5d9ef865533a8dfb1f48ce4ea2cec15 Mon Sep 17 00:00:00 2001 From: Ihsan Tonuzi <115842560+iton0@users.noreply.github.com> Date: Sun, 28 Jul 2024 17:39:34 -0400 Subject: [PATCH 215/480] refactor: remove lazydev and luvit-meta as lsp dependencies (#1047) --- init.lua | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/init.lua b/init.lua index d4d7b8c269f..5f442b6b2ed 100644 --- a/init.lua +++ b/init.lua @@ -399,7 +399,22 @@ require('lazy').setup({ end, }, - { -- LSP Configuration & Plugins + -- LSP Plugins + { + -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins + -- used for completion, annotations and signatures of Neovim apis + 'folke/lazydev.nvim', + ft = 'lua', + opts = { + library = { + -- Load luvit types when the `vim.uv` word is found + { path = 'luvit-meta/library', words = { 'vim%.uv' } }, + }, + }, + }, + { 'Bilal2453/luvit-meta', lazy = true }, + { + -- Main LSP Configuration 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs and related tools to stdpath for Neovim @@ -410,20 +425,6 @@ require('lazy').setup({ -- Useful status updates for LSP. -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` { 'j-hui/fidget.nvim', opts = {} }, - - -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins - -- used for completion, annotations and signatures of Neovim apis - { - 'folke/lazydev.nvim', - ft = 'lua', - opts = { - library = { - -- Load luvit types when the `vim.uv` word is found - { path = 'luvit-meta/library', words = { 'vim%.uv' } }, - }, - }, - }, - { 'Bilal2453/luvit-meta', lazy = true }, }, config = function() -- Brief aside: **What is LSP?** From aa344b3b4775a099778474fbf4c3127890f3163e Mon Sep 17 00:00:00 2001 From: abeldekat <58370433+abeldekat@users.noreply.github.com> Date: Sun, 28 Jul 2024 21:41:34 +0000 Subject: [PATCH 216/480] performance: defer clipboard because xsel and pbcopy can be slow (#1049) --- init.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 5f442b6b2ed..ee1d3b4909e 100644 --- a/init.lua +++ b/init.lua @@ -111,9 +111,12 @@ vim.opt.mouse = 'a' vim.opt.showmode = false -- Sync clipboard between OS and Neovim. +-- Schedule the setting after `UiEnter` because it can increase startup-time. -- Remove this option if you want your OS clipboard to remain independent. -- See `:help 'clipboard'` -vim.opt.clipboard = 'unnamedplus' +vim.schedule(function() + vim.opt.clipboard = 'unnamedplus' +end) -- Enable break indent vim.opt.breakindent = true From 49733497844bdf9e18b522ca7d6dd87810970c59 Mon Sep 17 00:00:00 2001 From: jstrot <44594069+jstrot@users.noreply.github.com> Date: Mon, 29 Jul 2024 20:01:19 -0400 Subject: [PATCH 217/480] Remove treesitter prefer_git option (#1061) - It's not safe and can corrupt other git repos - nvim-treesiter maintainers consider `prefer_git` as deprecated and no longer needed. See nvim-treesitter PR for details: https://github.com/nvim-treesitter/nvim-treesitter/pull/6959 --- init.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/init.lua b/init.lua index ee1d3b4909e..04c5896c8ec 100644 --- a/init.lua +++ b/init.lua @@ -856,8 +856,6 @@ require('lazy').setup({ config = function(_, opts) -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - -- Prefer git instead of curl in order to improve connectivity in some environments - require('nvim-treesitter.install').prefer_git = true ---@diagnostic disable-next-line: missing-fields require('nvim-treesitter.configs').setup(opts) From 18b909236dd2a227b7381413c8a926ac4583202b Mon Sep 17 00:00:00 2001 From: jstrot <44594069+jstrot@users.noreply.github.com> Date: Mon, 29 Jul 2024 20:02:37 -0400 Subject: [PATCH 218/480] Add explicit dependency of nvim-lspconfig on cmp-nvim-lsp (#1042) --- init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init.lua b/init.lua index 04c5896c8ec..220d3045268 100644 --- a/init.lua +++ b/init.lua @@ -428,6 +428,9 @@ require('lazy').setup({ -- Useful status updates for LSP. -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` { 'j-hui/fidget.nvim', opts = {} }, + + -- Allows extra capabilities provided by nvim-cmp + 'hrsh7th/cmp-nvim-lsp', }, config = function() -- Brief aside: **What is LSP?** From 89c4ffb4978e046d3fc0fda6103445cf00bc3bbc Mon Sep 17 00:00:00 2001 From: theoboldalex <44616505+theoboldalex@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:49:25 +0100 Subject: [PATCH 219/480] Update README.md (#1091) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3f19854cd20..0b56eab3c4e 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,8 @@ External Requirements: - A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons - if you have it set `vim.g.have_nerd_font` in `init.lua` to true - Language Setup: - - If want to write Typescript, you need `npm` - - If want to write Golang, you will need `go` + - If you want to write Typescript, you need `npm` + - If you want to write Golang, you will need `go` - etc. > **NOTE** From c3edce5313fbe9638149f099869d51fee1b9cd09 Mon Sep 17 00:00:00 2001 From: Matt Gallagher <46973220+mattgallagher92@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:53:57 +0100 Subject: [PATCH 220/480] Add note in README about lazy-lock.json (#1090) --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 0b56eab3c4e..53ae459c786 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,10 @@ fork to your machine using one of the commands below, depending on your OS. > Your fork's url will be something like this: > `https://github.com//kickstart.nvim.git` +You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file +too - it's ignored in the kickstart repo to make maintenance easier, but it's +[recommmended to track it in version control](https://lazy.folke.io/usage/lockfile). + #### Clone kickstart.nvim > **NOTE** > If following the recommended step above (i.e., forking the repo), replace From 7d82dae2439f9bc46ea520f2a63620c62d8a7db5 Mon Sep 17 00:00:00 2001 From: "Michael L." Date: Thu, 22 Aug 2024 22:56:33 +0200 Subject: [PATCH 221/480] Check for loop or uv for lazypath (#1095) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 220d3045268..314a05b6bb3 100644 --- a/init.lua +++ b/init.lua @@ -207,7 +207,7 @@ vim.api.nvim_create_autocmd('TextYankPost', { -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' -if not vim.uv.fs_stat(lazypath) then +if not (vim.uv or vim.loop).fs_stat(lazypath) then local lazyrepo = 'https://github.com/folke/lazy.nvim.git' local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } if vim.v.shell_error ~= 0 then From cd998d7ad995dda14566505f8d80b01cedf048e0 Mon Sep 17 00:00:00 2001 From: Ihsan Tonuzi <115842560+iton0@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:00:39 -0400 Subject: [PATCH 222/480] refactor: update treesitter and which-key config (#1068) --- init.lua | 60 +++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/init.lua b/init.lua index 314a05b6bb3..41b5a97bb0b 100644 --- a/init.lua +++ b/init.lua @@ -275,7 +275,44 @@ require('lazy').setup({ 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' config = function() -- This is the function that runs, AFTER loading - require('which-key').setup() + require('which-key').setup { + icons = { + -- set icon mappings to true if you have a Nerd Font + mappings = vim.g.have_nerd_font, + -- If you are using a Nerd Font: set icons.keys to an empty table which will use the + -- default whick-key.nvim defined Nerd Font icons, otherwise define a string table + keys = vim.g.have_nerd_font and {} or { + Up = ' ', + Down = ' ', + Left = ' ', + Right = ' ', + C = ' ', + M = ' ', + D = ' ', + S = ' ', + CR = ' ', + Esc = ' ', + ScrollWheelDown = ' ', + ScrollWheelUp = ' ', + NL = ' ', + BS = ' ', + Space = ' ', + Tab = ' ', + F1 = '', + F2 = '', + F3 = '', + F4 = '', + F5 = '', + F6 = '', + F7 = '', + F8 = '', + F9 = '', + F10 = '', + F11 = '', + F12 = '', + }, + }, + } -- Document existing key chains require('which-key').add { @@ -843,6 +880,8 @@ require('lazy').setup({ { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', + main = 'nvim-treesitter.configs', -- Sets main module to use for opts + -- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = { ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, -- Autoinstall languages that are not installed @@ -856,19 +895,12 @@ require('lazy').setup({ }, indent = { enable = true, disable = { 'ruby' } }, }, - config = function(_, opts) - -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - - ---@diagnostic disable-next-line: missing-fields - require('nvim-treesitter.configs').setup(opts) - - -- There are additional nvim-treesitter modules that you can use to interact - -- with nvim-treesitter. You should go explore a few and see what interests you: - -- - -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` - -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context - -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects - end, + -- There are additional nvim-treesitter modules that you can use to interact + -- with nvim-treesitter. You should go explore a few and see what interests you: + -- + -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` + -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context + -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects }, -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the From 8629705821718f5feed33de2bf1aec9955ef9dd4 Mon Sep 17 00:00:00 2001 From: Bayram Kazik <48856944+bayramkzk@users.noreply.github.com> Date: Sun, 25 Aug 2024 00:31:43 +0300 Subject: [PATCH 223/480] Include visual mode in LSP code action keymap (#1060) (#1064) --- init.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 41b5a97bb0b..13ea93a25a5 100644 --- a/init.lua +++ b/init.lua @@ -316,7 +316,7 @@ require('lazy').setup({ -- Document existing key chains require('which-key').add { - { 'c', group = '[C]ode' }, + { 'c', group = '[C]ode', mode = { 'n', 'x' } }, { 'd', group = '[D]ocument' }, { 'r', group = '[R]ename' }, { 's', group = '[S]earch' }, @@ -507,8 +507,9 @@ require('lazy').setup({ -- -- In this case, we create a function that lets us more easily define mappings specific -- for LSP related items. It sets the mode, buffer and description for us each time. - local map = function(keys, func, desc) - vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + local map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) end -- Jump to the definition of the word under your cursor. @@ -542,7 +543,7 @@ require('lazy').setup({ -- Execute a code action, usually your cursor needs to be on top of an error -- or a suggestion from your LSP for this to activate. - map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' }) -- WARN: This is not Goto Definition, this is Goto Declaration. -- For example, in C this would take you to the header. From 22bed46b0786b25af536b2bac91502f80684a130 Mon Sep 17 00:00:00 2001 From: Bayram Kazik <48856944+bayramkzk@users.noreply.github.com> Date: Mon, 26 Aug 2024 06:23:17 +0300 Subject: [PATCH 224/480] Enable silent option for default neo-tree plugin keybinding (#1108) --- lua/kickstart/plugins/neo-tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua index f126d68af2c..bd4422695aa 100644 --- a/lua/kickstart/plugins/neo-tree.lua +++ b/lua/kickstart/plugins/neo-tree.lua @@ -11,7 +11,7 @@ return { }, cmd = 'Neotree', keys = { - { '\\', ':Neotree reveal', desc = 'NeoTree reveal' }, + { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, }, opts = { filesystem = { From 0c9f059d88c261cc22952ebb457dc59bb746bde0 Mon Sep 17 00:00:00 2001 From: Harshit Pant <97608579+pantharshit007@users.noreply.github.com> Date: Mon, 26 Aug 2024 08:57:46 +0530 Subject: [PATCH 225/480] Fix: updated the windows installation commands (#1101) * Update README.md * Update README.md * Fix: updated the windows installation commands --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 53ae459c786..e14cbe222b2 100644 --- a/README.md +++ b/README.md @@ -81,13 +81,13 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HO If you're using `cmd.exe`: ``` -git clone https://github.com/nvim-lua/kickstart.nvim.git %localappdata%\nvim\ +git clone https://github.com/nvim-lua/kickstart.nvim.git "%localappdata%\nvim" ``` If you're using `powershell.exe` ``` -git clone https://github.com/nvim-lua/kickstart.nvim.git $env:LOCALAPPDATA\nvim\ +git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim" ```
From 4e3ffc6fd9b918aa6aff535a786eba2cb6eda614 Mon Sep 17 00:00:00 2001 From: Ihsan Tonuzi <115842560+iton0@users.noreply.github.com> Date: Sun, 25 Aug 2024 23:28:26 -0400 Subject: [PATCH 226/480] fix: remove deprecated opt for conform.nvim (#1070) - changed lsp_fallback -> lsp_format - updated format_on_save function to reflect change above --- init.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 13ea93a25a5..edc418222de 100644 --- a/init.lua +++ b/init.lua @@ -675,7 +675,7 @@ require('lazy').setup({ { 'f', function() - require('conform').format { async = true, lsp_fallback = true } + require('conform').format { async = true, lsp_format = 'fallback' } end, mode = '', desc = '[F]ormat buffer', @@ -688,9 +688,15 @@ require('lazy').setup({ -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. local disable_filetypes = { c = true, cpp = true } + local lsp_format_opt + if disable_filetypes[vim.bo[bufnr].filetype] then + lsp_format_opt = 'never' + else + lsp_format_opt = 'fallback' + end return { timeout_ms = 500, - lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], + lsp_format = lsp_format_opt, } end, formatters_by_ft = { From fdb0622a04da07865732ff88ff2f7a894342352c Mon Sep 17 00:00:00 2001 From: Ihsan Tonuzi <115842560+iton0@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:17:22 -0400 Subject: [PATCH 227/480] cleanup: refactor which-key configuration for cleaner setup (#1102) - Moved `which-key` configuration from inline `config` to `opts` for better organization. - Updated the key mappings setup to use `spec` for defining existing key chains. - Removed deprecated or unnecessary comments and code. This change aligns with updated `which-key` configuration practices, improving readability and maintainability as recommended by @VlaDexa in #1068. --- init.lua | 96 +++++++++++++++++++++++++++----------------------------- 1 file changed, 47 insertions(+), 49 deletions(-) diff --git a/init.lua b/init.lua index edc418222de..2513d537e30 100644 --- a/init.lua +++ b/init.lua @@ -274,57 +274,55 @@ require('lazy').setup({ { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' - config = function() -- This is the function that runs, AFTER loading - require('which-key').setup { - icons = { - -- set icon mappings to true if you have a Nerd Font - mappings = vim.g.have_nerd_font, - -- If you are using a Nerd Font: set icons.keys to an empty table which will use the - -- default whick-key.nvim defined Nerd Font icons, otherwise define a string table - keys = vim.g.have_nerd_font and {} or { - Up = ' ', - Down = ' ', - Left = ' ', - Right = ' ', - C = ' ', - M = ' ', - D = ' ', - S = ' ', - CR = ' ', - Esc = ' ', - ScrollWheelDown = ' ', - ScrollWheelUp = ' ', - NL = ' ', - BS = ' ', - Space = ' ', - Tab = ' ', - F1 = '', - F2 = '', - F3 = '', - F4 = '', - F5 = '', - F6 = '', - F7 = '', - F8 = '', - F9 = '', - F10 = '', - F11 = '', - F12 = '', - }, + opts = { + icons = { + -- set icon mappings to true if you have a Nerd Font + mappings = vim.g.have_nerd_font, + -- If you are using a Nerd Font: set icons.keys to an empty table which will use the + -- default whick-key.nvim defined Nerd Font icons, otherwise define a string table + keys = vim.g.have_nerd_font and {} or { + Up = ' ', + Down = ' ', + Left = ' ', + Right = ' ', + C = ' ', + M = ' ', + D = ' ', + S = ' ', + CR = ' ', + Esc = ' ', + ScrollWheelDown = ' ', + ScrollWheelUp = ' ', + NL = ' ', + BS = ' ', + Space = ' ', + Tab = ' ', + F1 = '', + F2 = '', + F3 = '', + F4 = '', + F5 = '', + F6 = '', + F7 = '', + F8 = '', + F9 = '', + F10 = '', + F11 = '', + F12 = '', }, - } - -- Document existing key chains - require('which-key').add { - { 'c', group = '[C]ode', mode = { 'n', 'x' } }, - { 'd', group = '[D]ocument' }, - { 'r', group = '[R]ename' }, - { 's', group = '[S]earch' }, - { 'w', group = '[W]orkspace' }, - { 't', group = '[T]oggle' }, - { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, - } - end, + -- Document existing key chains + spec = { + { 'c', group = '[C]ode', mode = { 'n', 'x' } }, + { 'd', group = '[D]ocument' }, + { 'r', group = '[R]ename' }, + { 's', group = '[S]earch' }, + { 'w', group = '[W]orkspace' }, + { 't', group = '[T]oggle' }, + { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + }, + }, + }, }, -- NOTE: Plugins can specify dependencies. From 898ccf18d1f0c117dc042f0085299621d2cb65e5 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Mon, 26 Aug 2024 22:43:59 +0200 Subject: [PATCH 228/480] Fix the which-key spec issue caused by recent cleanup (#1113) The recent cleanup accidentally broke the leader key specs because the spec block was in the wrong level of braces. That resulted in which-key no longer showing the description of the key chains such as [S]earch and others. --- init.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/init.lua b/init.lua index 2513d537e30..13c8143daa0 100644 --- a/init.lua +++ b/init.lua @@ -310,17 +310,17 @@ require('lazy').setup({ F11 = '', F12 = '', }, + }, - -- Document existing key chains - spec = { - { 'c', group = '[C]ode', mode = { 'n', 'x' } }, - { 'd', group = '[D]ocument' }, - { 'r', group = '[R]ename' }, - { 's', group = '[S]earch' }, - { 'w', group = '[W]orkspace' }, - { 't', group = '[T]oggle' }, - { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, - }, + -- Document existing key chains + spec = { + { 'c', group = '[C]ode', mode = { 'n', 'x' } }, + { 'd', group = '[D]ocument' }, + { 'r', group = '[R]ename' }, + { 's', group = '[S]earch' }, + { 'w', group = '[W]orkspace' }, + { 't', group = '[T]oggle' }, + { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, }, }, }, From f6540d843cd7a6e67e2b126692d847167b933718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Baquero?= <88566759+Cheveniko@users.noreply.github.com> Date: Tue, 10 Sep 2024 15:27:24 -0500 Subject: [PATCH 229/480] feat: update references of tsserver to ts_ls (#1131) --- init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 13c8143daa0..ea86b792abe 100644 --- a/init.lua +++ b/init.lua @@ -614,8 +614,8 @@ require('lazy').setup({ -- Some languages (like typescript) have entire language plugins that can be useful: -- https://github.com/pmizio/typescript-tools.nvim -- - -- But for many setups, the LSP (`tsserver`) will work just fine - -- tsserver = {}, + -- But for many setups, the LSP (`ts_ls`) will work just fine + -- ts_ls = {}, -- lua_ls = { @@ -656,7 +656,7 @@ require('lazy').setup({ local server = servers[server_name] or {} -- This handles overriding only values explicitly passed -- by the server configuration above. Useful when disabling - -- certain features of an LSP (for example, turning off formatting for tsserver) + -- certain features of an LSP (for example, turning off formatting for ts_ls) server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) require('lspconfig')[server_name].setup(server) end, From 431b69eefc0744ec9f88e6896f693a3dee030d34 Mon Sep 17 00:00:00 2001 From: Bastien Traverse Date: Tue, 24 Sep 2024 17:06:14 +0200 Subject: [PATCH 230/480] fix: update lazy uninstall information link (#1148) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e14cbe222b2..800ca990d51 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ examples of adding popularly requested plugins. `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim distribution that you would like to try out. * What if I want to "uninstall" this configuration: - * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information + * See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information * Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files? * The main purpose of kickstart is to serve as a teaching tool and a reference configuration that someone can easily use to `git clone` as a basis for their own. From 3a986c328db657e2ff362a3fcc70e21cc8a009f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20NICOLAS?= Date: Wed, 30 Oct 2024 16:41:46 +0100 Subject: [PATCH 231/480] Disable linting autocmd for readonly buffers (#1202) * Disable linting autocmd for readonly buffers This should avoid linting in buffers outside of the user's control, having in mind especially the handy LSP pop-ups that describe your hovered symbol using markdown. Co-authored-by: Robin Gruyters <2082795+rgruyters@users.noreply.github.com> * Justify guarding try_lint in readonly buffers Co-authored-by: Robin Gruyters <2082795+rgruyters@users.noreply.github.com> --------- Co-authored-by: Robin Gruyters <2082795+rgruyters@users.noreply.github.com> --- lua/kickstart/plugins/lint.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index ca9bc237904..907c6bf3e31 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -47,7 +47,12 @@ return { vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { group = lint_augroup, callback = function() - lint.try_lint() + -- Only run the linter in buffers that you can modify in order to + -- avoid superfluous noise, notably within the handy LSP pop-ups that + -- describe the hovered symbol using Markdown. + if vim.opt_local.modifiable:get() then + lint.try_lint() + end end, }) end, From 5724f502ae3da989c79bdeb6ccc3fd608ac1bbbe Mon Sep 17 00:00:00 2001 From: sam <110125971+samarth-na@users.noreply.github.com> Date: Wed, 30 Oct 2024 21:19:16 +0530 Subject: [PATCH 232/480] samarth-nagar fix: lazy help tag on line 931 (#1167) * samarth-nagar fix: lazy help tag on line 931 found in issue #1152 * fixed white space --------- Co-authored-by: sam <110125971+samarth-nagar@users.noreply.github.com> --- init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index ea86b792abe..e588129fbdf 100644 --- a/init.lua +++ b/init.lua @@ -928,8 +928,12 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` -- { import = 'custom.plugins' }, + -- + -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` + -- Or use telescope! + -- In normal mode type `sh` then write `lazy.nvim-plugin` + -- you can continue same window with `sr` which resumes last telescope search }, { ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the From 82e9cf2c06976faef51b4fe4ec97f50ef22daea6 Mon Sep 17 00:00:00 2001 From: gloomy-lemon-debatable <91877885+gloomy-lemon-debatable@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:50:27 +0000 Subject: [PATCH 233/480] Change diagnostic symbols if vim.g.have_nerd_font is true (#1195) * feat: Change diagnostic symbols if vim.g.have_nerd_font is true * feat: Comment out changes regarding diagnostic symbols so that only those who want to change them can do so --------- Co-authored-by: name --- init.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/init.lua b/init.lua index e588129fbdf..b58677d1f9b 100644 --- a/init.lua +++ b/init.lua @@ -588,6 +588,15 @@ require('lazy').setup({ end, }) + -- Change diagnostic symbols in the sign column (gutter) + -- if vim.g.have_nerd_font then + -- local signs = { Error = '', Warn = '', Hint = '', Info = '' } + -- for type, icon in pairs(signs) do + -- local hl = 'DiagnosticSign' .. type + -- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) + -- end + -- end + -- LSP servers and clients are able to communicate to each other what features they support. -- By default, Neovim doesn't support everything that is in the LSP specification. -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. From d1f6be8b2f7411bd5a394b92d1c19547dfc930e0 Mon Sep 17 00:00:00 2001 From: gloomy-lemon-debatable <91877885+gloomy-lemon-debatable@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:01:42 +0000 Subject: [PATCH 234/480] Set breakpoint icons and their highlight colors (#1194) * feat: Set breakpoint icons and their highlight colors * docs: Delete reference URL (written in PR) feat: "Break" and "Stop" arguments of vim.api.nvim_set_hl are changed because they are too common nouns feat: Comment out changes regarding diagnostic symbols so that only those who want to change them can do so --------- Co-authored-by: name --- lua/kickstart/plugins/debug.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 196f2c6dbd6..2226d963442 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -89,6 +89,18 @@ return { }, } + -- Change breakpoint icons + -- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' }) + -- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' }) + -- local breakpoint_icons = vim.g.have_nerd_font + -- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' } + -- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' } + -- for type, icon in pairs(breakpoint_icons) do + -- local tp = 'Dap' .. type + -- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak' + -- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl }) + -- end + dap.listeners.after.event_initialized['dapui_config'] = dapui.open dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close From 34e7535c03925e278b6d4ef9addd48bd2219ba96 Mon Sep 17 00:00:00 2001 From: Will Winder Date: Wed, 30 Oct 2024 14:58:52 -0400 Subject: [PATCH 235/480] Remove two because there are more than two. (#1213) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index b58677d1f9b..4ce35f4b5c4 100644 --- a/init.lua +++ b/init.lua @@ -917,7 +917,7 @@ require('lazy').setup({ -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects }, - -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the + -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the -- init.lua. If you want these files, they are in the repository, so you can just download them and -- place them in the correct locations. From dc564f9776e9781fd1b052387414e6d40d6c6caa Mon Sep 17 00:00:00 2001 From: gloomy-lemon-debatable <91877885+gloomy-lemon-debatable@users.noreply.github.com> Date: Wed, 20 Nov 2024 22:37:22 +0900 Subject: [PATCH 236/480] feat: Change to prepare for upcoming deprecation of configuring diagnostic-signs using sign_define() (#1232) --- init.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 4ce35f4b5c4..e3b7b56c631 100644 --- a/init.lua +++ b/init.lua @@ -590,11 +590,12 @@ require('lazy').setup({ -- Change diagnostic symbols in the sign column (gutter) -- if vim.g.have_nerd_font then - -- local signs = { Error = '', Warn = '', Hint = '', Info = '' } + -- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' } + -- local diagnostic_signs = {} -- for type, icon in pairs(signs) do - -- local hl = 'DiagnosticSign' .. type - -- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) + -- diagnostic_signs[vim.diagnostic.severity[type]] = icon -- end + -- vim.diagnostic.config { signs = { text = diagnostic_signs } } -- end -- LSP servers and clients are able to communicate to each other what features they support. From 0d10cd7fa82c53983c35ec54d8c428a17af9094b Mon Sep 17 00:00:00 2001 From: Anjishnu Banerjee <107052359+kaezrr@users.noreply.github.com> Date: Wed, 20 Nov 2024 19:10:51 +0530 Subject: [PATCH 237/480] Fix nvim-dap not lazy loading (#1216) * Fix nvim-dap not lazy loading The keys property had local variables 'dap' and 'dap-ui' that used `require` and prevented all DAP related plugins from lazy-loading. Fixed this by changing keys to a table and substituting the local variables with a lamba function * Make debug keybind descriptions more consistent --- lua/kickstart/plugins/debug.lua | 75 +++++++++++++++++++++++---------- 1 file changed, 53 insertions(+), 22 deletions(-) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 2226d963442..753cb0cedd3 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -24,28 +24,59 @@ return { -- Add your own debuggers here 'leoluz/nvim-dap-go', }, - keys = function(_, keys) - local dap = require 'dap' - local dapui = require 'dapui' - return { - -- Basic debugging keymaps, feel free to change to your liking! - { '', dap.continue, desc = 'Debug: Start/Continue' }, - { '', dap.step_into, desc = 'Debug: Step Into' }, - { '', dap.step_over, desc = 'Debug: Step Over' }, - { '', dap.step_out, desc = 'Debug: Step Out' }, - { 'b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' }, - { - 'B', - function() - dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') - end, - desc = 'Debug: Set Breakpoint', - }, - -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. - { '', dapui.toggle, desc = 'Debug: See last session result.' }, - unpack(keys), - } - end, + keys = { + -- Basic debugging keymaps, feel free to change to your liking! + { + '', + function() + require('dap').continue() + end, + desc = 'Debug: Start/Continue', + }, + { + '', + function() + require('dap').step_into() + end, + desc = 'Debug: Step Into', + }, + { + '', + function() + require('dap').step_over() + end, + desc = 'Debug: Step Over', + }, + { + '', + function() + require('dap').step_out() + end, + desc = 'Debug: Step Out', + }, + { + 'b', + function() + require('dap').toggle_breakpoint() + end, + desc = 'Debug: Toggle Breakpoint', + }, + { + 'B', + function() + require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') + end, + desc = 'Debug: Set Breakpoint', + }, + -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. + { + '', + function() + require('dapui').toggle() + end, + desc = 'Debug: See last session result.', + }, + }, config = function() local dap = require 'dap' local dapui = require 'dapui' From 2b721711b1c92e157555a645255b316d89f9f4fd Mon Sep 17 00:00:00 2001 From: Miha <79801427+mihasket@users.noreply.github.com> Date: Wed, 20 Nov 2024 14:41:50 +0100 Subject: [PATCH 238/480] fix: which-key comment typo (#1227) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index e3b7b56c631..08717d537e6 100644 --- a/init.lua +++ b/init.lua @@ -279,7 +279,7 @@ require('lazy').setup({ -- set icon mappings to true if you have a Nerd Font mappings = vim.g.have_nerd_font, -- If you are using a Nerd Font: set icons.keys to an empty table which will use the - -- default whick-key.nvim defined Nerd Font icons, otherwise define a string table + -- default which-key.nvim defined Nerd Font icons, otherwise define a string table keys = vim.g.have_nerd_font and {} or { Up = ' ', Down = ' ', From 0ef62ad9defe6429c5638a167dd39d536cba5971 Mon Sep 17 00:00:00 2001 From: ben fleis Date: Thu, 12 Dec 2024 16:50:55 +0100 Subject: [PATCH 239/480] Tweak outdated comment about lazy's `config` key usage. (#1250) Remove outdated comment describing use of `config` key, replacing with corrected `opt` key note. Fixes #1249 --- init.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 08717d537e6..b29693accab 100644 --- a/init.lua +++ b/init.lua @@ -267,9 +267,8 @@ require('lazy').setup({ -- which loads which-key before all the UI elements are loaded. Events can be -- normal autocommands events (`:help autocmd-events`). -- - -- Then, because we use the `config` key, the configuration only runs - -- after the plugin has been loaded: - -- config = function() ... end + -- Then, because we use the `opt` key (recommended), the configuration runs + -- after the plugin has been loaded as `require(MODULE).setup(opts)`. { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', From c6b54364ee381f0d1919160d769b41229268ab27 Mon Sep 17 00:00:00 2001 From: Artem Dragunov Date: Thu, 12 Dec 2024 18:51:58 +0300 Subject: [PATCH 240/480] Use consistent syntax style for { ... } "pseudocode" (#1247) ``` require('gitsigns').setup({ ... }) ``` This was the first occurrence It may be nice to have the same style everywhere Cosmetic change (just to make docs/comments even more perfect) --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index b29693accab..8e56a216be3 100644 --- a/init.lua +++ b/init.lua @@ -628,8 +628,8 @@ require('lazy').setup({ -- lua_ls = { - -- cmd = {...}, - -- filetypes = { ...}, + -- cmd = { ... }, + -- filetypes = { ... }, -- capabilities = {}, settings = { Lua = { From 1d2247a9d73a86449704deba935e735ae3991878 Mon Sep 17 00:00:00 2001 From: ben fleis Date: Thu, 12 Dec 2024 22:26:20 +0100 Subject: [PATCH 241/480] Issue 1249 which key comments (#1263) * Tweak outdated comment about lazy's `config` key usage. Remove outdated comment describing use of `config` key, replacing with corrected `opt` key note. Fixes #1249 * fix typo opt -> opts Fixes #1250 --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 8e56a216be3..ee8fbc992e1 100644 --- a/init.lua +++ b/init.lua @@ -267,7 +267,7 @@ require('lazy').setup({ -- which loads which-key before all the UI elements are loaded. Events can be -- normal autocommands events (`:help autocmd-events`). -- - -- Then, because we use the `opt` key (recommended), the configuration runs + -- Then, because we use the `opts` key (recommended), the configuration runs -- after the plugin has been loaded as `require(MODULE).setup(opts)`. { -- Useful plugin to show you pending keybinds. From b9ccc8414f6e783e45043ecaf8a4b18b32dc3092 Mon Sep 17 00:00:00 2001 From: Scott Swensen Date: Sat, 14 Dec 2024 22:42:39 -0700 Subject: [PATCH 242/480] fix(gitsigns): make visual mode descriptions consistent with normal mode (#1266) --- lua/kickstart/plugins/gitsigns.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kickstart/plugins/gitsigns.lua b/lua/kickstart/plugins/gitsigns.lua index 4bcc70f4c79..c269bc06e15 100644 --- a/lua/kickstart/plugins/gitsigns.lua +++ b/lua/kickstart/plugins/gitsigns.lua @@ -36,10 +36,10 @@ return { -- visual mode map('v', 'hs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'stage git hunk' }) + end, { desc = 'git [s]tage hunk' }) map('v', 'hr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'reset git hunk' }) + end, { desc = 'git [r]eset hunk' }) -- normal mode map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) From f4486eec723e378c1e0b4ac7aa12bfb5b9570303 Mon Sep 17 00:00:00 2001 From: George Date: Sun, 29 Dec 2024 18:39:47 +0200 Subject: [PATCH 243/480] Fix README.md grammar and typos (#1291) --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 800ca990d51..08cecfa3427 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ If you are experiencing issues, please make sure you have the latest versions. External Requirements: - Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`) - [ripgrep](https://github.com/BurntSushi/ripgrep#installation) -- Clipboard tool (xclip/xsel/win32yank or other depending on platform) +- Clipboard tool (xclip/xsel/win32yank or other depending on the platform) - A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons - if you have it set `vim.g.have_nerd_font` in `init.lua` to true - Language Setup: @@ -56,12 +56,12 @@ so that you have your own copy that you can modify, then install by cloning the fork to your machine using one of the commands below, depending on your OS. > **NOTE** -> Your fork's url will be something like this: +> Your fork's URL will be something like this: > `https://github.com//kickstart.nvim.git` You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file too - it's ignored in the kickstart repo to make maintenance easier, but it's -[recommmended to track it in version control](https://lazy.folke.io/usage/lockfile). +[recommended to track it in version control](https://lazy.folke.io/usage/lockfile). #### Clone kickstart.nvim > **NOTE** @@ -101,7 +101,7 @@ nvim ``` That's it! Lazy will install all the plugins you have. Use `:Lazy` to view -current plugin status. Hit `q` to close the window. +the current plugin status. Hit `q` to close the window. Read through the `init.lua` file in your configuration folder for more information about extending and exploring Neovim. That also includes @@ -114,9 +114,9 @@ examples of adding popularly requested plugins. ### FAQ -* What should I do if I already have a pre-existing neovim configuration? +* What should I do if I already have a pre-existing Neovim configuration? * You should back it up and then delete all associated files. - * This includes your existing init.lua and the neovim files in `~/.local` + * This includes your existing init.lua and the Neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` * Can I keep my existing configuration in parallel to kickstart? * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` @@ -174,7 +174,7 @@ run in cmd as **admin**: winget install --accept-source-agreements chocolatey.chocolatey ``` -2. install all requirements using choco, exit previous cmd and +2. install all requirements using choco, exit the previous cmd and open a new one so that choco path is set, and run in cmd as **admin**: ``` choco install -y neovim git ripgrep wget fd unzip gzip mingw make From d0a75ce25e4dbd6eeeae1cf46a80540b3efdf66d Mon Sep 17 00:00:00 2001 From: Ihsan Tonuzi <115842560+iton0@users.noreply.github.com> Date: Sun, 29 Dec 2024 12:00:16 -0500 Subject: [PATCH 244/480] chore: add pre-issue requirements (#1288) * chore: add pre-issue requirements Based on #1285 * docs: add header about documentation Based on #1285 --- .github/ISSUE_TEMPLATE/bug_report.md | 11 +++++++++-- README.md | 7 ++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 2ad4d31ddb0..55b45b0d127 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -9,6 +9,13 @@ assignees: '' +## Before Reporting an Issue +- I have read the kickstart.nvim README.md. +- I have read the appropiate plugin's documentation. +- I have searched that this issue has not been reported before. + +- [ ] **By checking this, I confirm that the above steps are completed. I understand leaving this unchecked will result in this report being closed immediately.** + ## Describe the bug @@ -18,8 +25,8 @@ assignees: '' ## Desktop -- OS: -- Terminal: +- OS: +- Terminal: ## Neovim Version diff --git a/README.md b/README.md index 08cecfa3427..aa5f4fc8f1e 100644 --- a/README.md +++ b/README.md @@ -103,10 +103,15 @@ nvim That's it! Lazy will install all the plugins you have. Use `:Lazy` to view the current plugin status. Hit `q` to close the window. +#### Read The Friendly Documentation + Read through the `init.lua` file in your configuration folder for more information about extending and exploring Neovim. That also includes examples of adding popularly requested plugins. +> [!NOTE] +> For more information about a particular plugin check its repository's documentation. + ### Getting Started @@ -135,7 +140,7 @@ examples of adding popularly requested plugins. * The main purpose of kickstart is to serve as a teaching tool and a reference configuration that someone can easily use to `git clone` as a basis for their own. As you progress in learning Neovim and Lua, you might consider splitting `init.lua` - into smaller parts. A fork of kickstart that does this while maintaining the + into smaller parts. A fork of kickstart that does this while maintaining the same functionality is available here: * [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim) * Discussions on this topic can be found here: From fbe95053c255c1093914e8ad32af2ba5a06300a4 Mon Sep 17 00:00:00 2001 From: Ryan Jensen Date: Sun, 29 Dec 2024 11:04:10 -0600 Subject: [PATCH 245/480] Fix which-key delay settings (#1276) The which-key plugin used to rely on vim.opt.timeoutlen, but it was updated a few months ago to use its own opt.delay instead. https://github.com/folke/which-key.nvim/blob/8ab96b38a2530eacba5be717f52e04601eb59326/NEWS.md?plain=1#L10 I set which-key's delay to 0 ms because it makes it feel snappy and responsive! That way, we give new users a good first impression. --- init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index ee8fbc992e1..7758df93a2e 100644 --- a/init.lua +++ b/init.lua @@ -135,7 +135,6 @@ vim.opt.signcolumn = 'yes' vim.opt.updatetime = 250 -- Decrease mapped sequence wait time --- Displays which-key popup sooner vim.opt.timeoutlen = 300 -- Configure how new splits should be opened @@ -274,6 +273,9 @@ require('lazy').setup({ 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' opts = { + -- delay between pressing a key and opening which-key (milliseconds) + -- this setting is independent of vim.opt.timeoutlen + delay = 0, icons = { -- set icon mappings to true if you have a Nerd Font mappings = vim.g.have_nerd_font, From 3700a70d8a749f5cdf08f0c43ab8aa3b37aa65e1 Mon Sep 17 00:00:00 2001 From: Tomas Gareau Date: Tue, 7 Jan 2025 09:44:29 -0600 Subject: [PATCH 246/480] fix: prevent mason setup from being run twice (#1298) * fix: prevent mason setup from being run twice Addresses https://github.com/nvim-lua/kickstart.nvim/issues/1297 Currently, we're calling `require('mason').setup(...)` twice: * once when setting it as a dependency of `nvim-lspconfig` (since we set `config = true`) * once in the `config` function we define for `nvim-lspconfig` Calling setup twice can cause issues with, e.g., setting the `PATH` option: you might append Mason's bin dir in one setup call and prepend it in the other. We've kept the setup of `mason` in the `nvim-lspconfig` dependencies table since leaving it to the `config` function caused some plugin-loading-order related issues in the past. See: * https://github.com/nvim-lua/kickstart.nvim/pull/210 * https://github.com/nvim-lua/kickstart.nvim/issues/554 * https://github.com/nvim-lua/kickstart.nvim/pull/555 * https://github.com/nvim-lua/kickstart.nvim/pull/865 * docs: tweak comments per review feedback --- init.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 7758df93a2e..610018e8d99 100644 --- a/init.lua +++ b/init.lua @@ -457,7 +457,9 @@ require('lazy').setup({ 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs and related tools to stdpath for Neovim - { 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants + -- Mason must be loaded before its dependents so we need to set it up here. + -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` + { 'williamboman/mason.nvim', opts = {} }, 'williamboman/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', @@ -646,13 +648,16 @@ require('lazy').setup({ } -- 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 + -- + -- To check the current status of installed tools and/or manually install + -- other tools, you can run -- :Mason -- - -- You can press `g?` for help in this menu. - require('mason').setup() - + -- You can press `g?` for help in this menu. + -- + -- `mason` had to be setup earlier: to configure its options see the + -- `dependencies` table for `nvim-lspconfig` above. + -- -- You can add other tools here that you want Mason to install -- for you, so that they are available from within Neovim. local ensure_installed = vim.tbl_keys(servers or {}) From 5c643521f6b077e71c2f0ad7e9324c27bc4e899a Mon Sep 17 00:00:00 2001 From: Nhan Luu <62146587+nhld@users.noreply.github.com> Date: Thu, 16 Jan 2025 02:37:03 +0700 Subject: [PATCH 247/480] chore: remove redundant comment (#1307) --- init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/init.lua b/init.lua index 610018e8d99..edbc37834f2 100644 --- a/init.lua +++ b/init.lua @@ -464,7 +464,6 @@ require('lazy').setup({ 'WhoIsSethDaniel/mason-tool-installer.nvim', -- Useful status updates for LSP. - -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` { 'j-hui/fidget.nvim', opts = {} }, -- Allows extra capabilities provided by nvim-cmp From 07a5e52ef1186054c0fa126d067c7eb9c74cfb66 Mon Sep 17 00:00:00 2001 From: Nhan Luu <62146587+nhld@users.noreply.github.com> Date: Thu, 16 Jan 2025 02:37:36 +0700 Subject: [PATCH 248/480] chore: fix typo in bug report issue template (#1306) --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 55b45b0d127..86598b8dc98 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -11,7 +11,7 @@ assignees: '' ## Before Reporting an Issue - I have read the kickstart.nvim README.md. -- I have read the appropiate plugin's documentation. +- I have read the appropriate plugin's documentation. - I have searched that this issue has not been reported before. - [ ] **By checking this, I confirm that the above steps are completed. I understand leaving this unchecked will result in this report being closed immediately.** From 66ad6d96b840762b16a8a0e5c72f109dc6230d58 Mon Sep 17 00:00:00 2001 From: Diorman Colmenares <229201+diorman@users.noreply.github.com> Date: Wed, 15 Jan 2025 11:38:26 -0800 Subject: [PATCH 249/480] Use luals 3rd library for luv (#1303) --- init.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/init.lua b/init.lua index edbc37834f2..4eae8e7d95a 100644 --- a/init.lua +++ b/init.lua @@ -447,11 +447,10 @@ require('lazy').setup({ opts = { library = { -- Load luvit types when the `vim.uv` word is found - { path = 'luvit-meta/library', words = { 'vim%.uv' } }, + { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, }, }, }, - { 'Bilal2453/luvit-meta', lazy = true }, { -- Main LSP Configuration 'neovim/nvim-lspconfig', From 52f2f309ab2bb777067acc7ed05952d44cc7c6ed Mon Sep 17 00:00:00 2001 From: Ryan Nevius Date: Sat, 15 Feb 2025 04:23:31 +0100 Subject: [PATCH 250/480] chore(docs): Update README.md (#1344) Neovim has renamed the "linux64" binary to "linux-x86_64". --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index aa5f4fc8f1e..3cabe65606e 100644 --- a/README.md +++ b/README.md @@ -212,14 +212,14 @@ sudo apt update sudo apt install make gcc ripgrep unzip git xclip curl # Now we install nvim -curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz -sudo rm -rf /opt/nvim-linux64 -sudo mkdir -p /opt/nvim-linux64 -sudo chmod a+rX /opt/nvim-linux64 -sudo tar -C /opt -xzf nvim-linux64.tar.gz +curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz +sudo rm -rf /opt/nvim-linux-x86_64 +sudo mkdir -p /opt/nvim-linux-x86_64 +sudo chmod a+rX /opt/nvim-linux-x86_64 +sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz # make it available in /usr/local/bin, distro installs to /usr/bin -sudo ln -sf /opt/nvim-linux64/bin/nvim /usr/local/bin/ +sudo ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/ ```
Fedora Install Steps From c057743836608e163c058c46dd2467616b063bfd Mon Sep 17 00:00:00 2001 From: bleacheda <60625523+bleacheda@users.noreply.github.com> Date: Sat, 15 Feb 2025 05:32:50 +0200 Subject: [PATCH 251/480] =?UTF-8?q?docs:=20clarify=20using=20opts=20=3D=20?= =?UTF-8?q?{}=20vs=20config=20=3D=20function()=20...=20require('plu?= =?UTF-8?q?=E2=80=A6=20(#1316)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: clarify using opts = {} vs config = function() ... require('plugin').setup({}) .. end The current documentation mentioning that using "require" is equivalent to using "opts" without detailing the use in the "config = function()" block seems inaccurate. Lower in the configuration the "config = function()" block is used without clarifying why it needed and what it does. This clarification may help new users understand the difference between the two, or how and where to place the "require" statement. * Update init.lua * remove whitespace --- init.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 4eae8e7d95a..99c7c9cb0a9 100644 --- a/init.lua +++ b/init.lua @@ -234,12 +234,22 @@ require('lazy').setup({ -- with the first argument being the link and the following -- keys can be used to configure plugin behavior/loading/etc. -- - -- Use `opts = {}` to force a plugin to be loaded. + -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded. -- + -- Alternatively, use `config = function() ... end` for full control over the configuration. + -- If you prefer to call `setup` explicitly, use: + -- { + -- 'lewis6991/gitsigns.nvim', + -- config = function() + -- require('gitsigns').setup({ + -- -- Your gitsigns configuration here + -- }) + -- end, + -- } + -- -- Here is a more advanced example where we pass configuration - -- options to `gitsigns.nvim`. This is equivalent to the following Lua: - -- require('gitsigns').setup({ ... }) + -- options to `gitsigns.nvim`. -- -- See `:help gitsigns` to understand what the configuration keys do { -- Adds git related signs to the gutter, as well as utilities for managing changes From ae5d7b6c89178ad45c77c544da2f3289029a2d29 Mon Sep 17 00:00:00 2001 From: Erlan Rangel Date: Fri, 14 Feb 2025 23:48:37 -0600 Subject: [PATCH 252/480] fix (#1319): gitsigns deprecated functions (#1321) - This commit change two functions that are marked as deprecated now: `gitsigns.stage_hunk` and `gitsigns.toggle_deleted` --- lua/kickstart/plugins/gitsigns.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/kickstart/plugins/gitsigns.lua b/lua/kickstart/plugins/gitsigns.lua index c269bc06e15..cbbd22d24fc 100644 --- a/lua/kickstart/plugins/gitsigns.lua +++ b/lua/kickstart/plugins/gitsigns.lua @@ -44,7 +44,7 @@ return { map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) map('n', 'hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) - map('n', 'hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' }) + map('n', 'hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' }) map('n', 'hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) map('n', 'hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) @@ -54,7 +54,7 @@ return { end, { desc = 'git [D]iff against last commit' }) -- Toggles map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) - map('n', 'tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' }) + map('n', 'tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' }) end, }, }, From 187d3e45195185b3e4b4e35dd8c32cf2d14f10dc Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Sun, 16 Feb 2025 22:37:44 -0500 Subject: [PATCH 253/480] Add a blurb about installing missing emoji on Ubuntu Right next to the nerdfonts blurb as requested. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3cabe65606e..92841110bf2 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ External Requirements: - Clipboard tool (xclip/xsel/win32yank or other depending on the platform) - A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons - if you have it set `vim.g.have_nerd_font` in `init.lua` to true +- Emoji fonts (Ubuntu only, and only if you want emoji!) `sudo apt install fonts-noto-color-emoji` - Language Setup: - If you want to write Typescript, you need `npm` - If you want to write Golang, you will need `go` From a0b9aaf8b53cade4c28c6ecb0e2286abf022587a Mon Sep 17 00:00:00 2001 From: Jonas Zeltner Date: Mon, 17 Feb 2025 04:42:19 +0100 Subject: [PATCH 254/480] fix: arguments for the `vim.lsp.Client.supports_method` method (#1356) --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 99c7c9cb0a9..7ef6120b7b4 100644 --- a/init.lua +++ b/init.lua @@ -564,7 +564,7 @@ require('lazy').setup({ -- -- When you move your cursor, the highlights will be cleared (the second autocommand). local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { buffer = event.buf, @@ -591,7 +591,7 @@ require('lazy').setup({ -- code, if the language server you are using supports them -- -- This may be unwanted, since they displace some of your code - if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then map('th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints') From efcc1e25a56cbf81de91a0ef7bd40ff08b7fd131 Mon Sep 17 00:00:00 2001 From: GeloCraft <115651305+gelocraft@users.noreply.github.com> Date: Tue, 18 Feb 2025 02:01:07 +0800 Subject: [PATCH 255/480] feat(diagnostic): add diagnostic config (#1335) Co-authored-by: gelocraft --- init.lua | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/init.lua b/init.lua index 7ef6120b7b4..d91174b5492 100644 --- a/init.lua +++ b/init.lua @@ -599,15 +599,34 @@ require('lazy').setup({ end, }) - -- Change diagnostic symbols in the sign column (gutter) - -- if vim.g.have_nerd_font then - -- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' } - -- local diagnostic_signs = {} - -- for type, icon in pairs(signs) do - -- diagnostic_signs[vim.diagnostic.severity[type]] = icon - -- end - -- vim.diagnostic.config { signs = { text = diagnostic_signs } } - -- end + -- Diagnostic Config + -- See :help vim.diagnostic.Opts + vim.diagnostic.config { + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = vim.g.have_nerd_font and { + text = { + [vim.diagnostic.severity.ERROR] = '󰅚 ', + [vim.diagnostic.severity.WARN] = '󰀪 ', + [vim.diagnostic.severity.INFO] = '󰋽 ', + [vim.diagnostic.severity.HINT] = '󰌶 ', + }, + } or {}, + virtual_text = { + source = 'if_many', + spacing = 2, + format = function(diagnostic) + local diagnostic_message = { + [vim.diagnostic.severity.ERROR] = diagnostic.message, + [vim.diagnostic.severity.WARN] = diagnostic.message, + [vim.diagnostic.severity.INFO] = diagnostic.message, + [vim.diagnostic.severity.HINT] = diagnostic.message, + } + return diagnostic_message[diagnostic.severity] + end, + }, + } -- LSP servers and clients are able to communicate to each other what features they support. -- By default, Neovim doesn't support everything that is in the LSP specification. From e27a7418f0e67f9ba95edec075deff9940bc3ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20Guerra?= Date: Tue, 18 Feb 2025 01:10:48 +0100 Subject: [PATCH 256/480] perf: load tokyonight.nvim in the intended way (#1360) Fixes #1357 --- init.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index d91174b5492..b57a4b9b8a0 100644 --- a/init.lua +++ b/init.lua @@ -874,14 +874,18 @@ require('lazy').setup({ -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. 'folke/tokyonight.nvim', priority = 1000, -- Make sure to load this before all the other start plugins. - init = function() + config = function() + ---@diagnostic disable-next-line: missing-fields + require('tokyonight').setup { + styles = { + comments = { italic = false }, -- Disable italics in comments + }, + } + -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. vim.cmd.colorscheme 'tokyonight-night' - - -- You can configure highlights by doing something like: - vim.cmd.hi 'Comment gui=none' end, }, From 47b17e6dffe01667c658bcd8a363a84bd97256f5 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 18 Feb 2025 00:12:06 +0000 Subject: [PATCH 257/480] feat: add basic function signature help (#1358) * feat: add basic function signature help * Update init.lua Co-authored-by: makeworld <25111343+makew0rld@users.noreply.github.com> --------- Co-authored-by: makeworld <25111343+makew0rld@users.noreply.github.com> --- init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init.lua b/init.lua index b57a4b9b8a0..de34808e02e 100644 --- a/init.lua +++ b/init.lua @@ -786,6 +786,8 @@ require('lazy').setup({ -- into multiple repos for maintenance purposes. 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-path', + 'hrsh7th/cmp-path', + 'htsh7th/cmp-nvim-lsp-signature-help', }, config = function() -- See `:help cmp` @@ -862,6 +864,7 @@ require('lazy').setup({ { name = 'nvim_lsp' }, { name = 'luasnip' }, { name = 'path' }, + { name = 'nvim_lsp_signature_help' }, }, } end, From 184e95956c1fbaea6d5152814356b43540c10836 Mon Sep 17 00:00:00 2001 From: Aryan Rajoria <57455619+aryan-rajoria@users.noreply.github.com> Date: Tue, 18 Feb 2025 00:05:15 -0500 Subject: [PATCH 258/480] Fix: fix the cmp-nvim-lsp-signature-help link (#1363) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index de34808e02e..c8f2dc5b0f9 100644 --- a/init.lua +++ b/init.lua @@ -787,7 +787,7 @@ require('lazy').setup({ 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-path', 'hrsh7th/cmp-path', - 'htsh7th/cmp-nvim-lsp-signature-help', + 'hrsh7th/cmp-nvim-lsp-signature-help', }, config = function() -- See `:help cmp` From 076673e5f9df52a8c5fb4dc8b9fec25d9db6dbba Mon Sep 17 00:00:00 2001 From: Jonas Zeltner Date: Tue, 18 Feb 2025 17:15:13 +0100 Subject: [PATCH 259/480] fix: regression introduced in a0b9aaf8b53cade4c28c6ecb0e2286abf022587a (#1367) --- init.lua | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index c8f2dc5b0f9..22ee9e4878d 100644 --- a/init.lua +++ b/init.lua @@ -558,13 +558,26 @@ require('lazy').setup({ -- For example, in C this would take you to the header. map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) + ---@param client vim.lsp.Client + ---@param method vim.lsp.protocol.Method + ---@param bufnr? integer some lsp support methods only in specific files + ---@return boolean + local function client_supports_method(client, method, bufnr) + if vim.fn.has 'nvim-0.11' == 1 then + return client:supports_method(method, bufnr) + else + return client.supports_method(method, { bufnr = bufnr }) + end + end + -- The following two autocommands are used to highlight references of the -- word under your cursor when your cursor rests there for a little while. -- See `:help CursorHold` for information about when this is executed -- -- When you move your cursor, the highlights will be cleared (the second autocommand). local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then + if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { buffer = event.buf, @@ -591,7 +604,7 @@ require('lazy').setup({ -- code, if the language server you are using supports them -- -- This may be unwanted, since they displace some of your code - if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then + if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then map('th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints') From 321b2559dc878121b66bcfaf81af16c60f8f1168 Mon Sep 17 00:00:00 2001 From: Ari Pollak Date: Wed, 19 Feb 2025 09:38:58 -0500 Subject: [PATCH 260/480] Remove duplicate cmp-path (#1369) --- init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/init.lua b/init.lua index 22ee9e4878d..40c8f59d2ac 100644 --- a/init.lua +++ b/init.lua @@ -799,7 +799,6 @@ require('lazy').setup({ -- into multiple repos for maintenance purposes. 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-path', - 'hrsh7th/cmp-path', 'hrsh7th/cmp-nvim-lsp-signature-help', }, config = function() From 77f71c627f4dcfbc07f6c8f15c2e102699350f65 Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Wed, 19 Feb 2025 09:40:16 -0500 Subject: [PATCH 261/480] Propsed fix for init.lua warnings as per https://github.com/nvim-lua/kickstart.nvim/issues/1305#issuecomment-2657770325 (#1354) --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 40c8f59d2ac..5cac3d14601 100644 --- a/init.lua +++ b/init.lua @@ -707,6 +707,8 @@ require('lazy').setup({ require('mason-tool-installer').setup { ensure_installed = ensure_installed } require('mason-lspconfig').setup { + ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) + automatic_installation = false, handlers = { function(server_name) local server = servers[server_name] or {} From 0221cff7f5b2d2cf9a1bd284bea65665bf886462 Mon Sep 17 00:00:00 2001 From: Crypto-Spartan <29098151+Crypto-Spartan@users.noreply.github.com> Date: Wed, 12 Mar 2025 17:24:44 -0400 Subject: [PATCH 262/480] feat: add `vim.opt.confirm = true` (#1384) --- init.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/init.lua b/init.lua index 5cac3d14601..1427b6c7d5d 100644 --- a/init.lua +++ b/init.lua @@ -156,6 +156,11 @@ vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. vim.opt.scrolloff = 10 +-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`), +-- instead raise a dialog asking if you wish to save the current file(s) +-- See `:help 'confirm'` +vim.opt.confirm = true + -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` From 0f81a970c2e2e4f7f1073f4b12d554624ddff1ce Mon Sep 17 00:00:00 2001 From: Luca Saccarola <96259932+saccarosium@users.noreply.github.com> Date: Thu, 20 Mar 2025 23:16:35 +0100 Subject: [PATCH 263/480] fix: use correct github abmonition syntax (#1414) --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 92841110bf2..8ace8b9b22b 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,13 @@ External Requirements: - If you want to write Golang, you will need `go` - etc. -> **NOTE** +> [!NOTE] > See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes > and quick install snippets ### Install Kickstart -> **NOTE** +> [!NOTE] > [Backup](#FAQ) your previous configuration (if any exists) Neovim's configurations are located under the following paths, depending on your OS: @@ -56,7 +56,7 @@ Neovim's configurations are located under the following paths, depending on your so that you have your own copy that you can modify, then install by cloning the fork to your machine using one of the commands below, depending on your OS. -> **NOTE** +> [!NOTE] > Your fork's URL will be something like this: > `https://github.com//kickstart.nvim.git` @@ -65,7 +65,8 @@ too - it's ignored in the kickstart repo to make maintenance easier, but it's [recommended to track it in version control](https://lazy.folke.io/usage/lockfile). #### Clone kickstart.nvim -> **NOTE** + +> [!NOTE] > If following the recommended step above (i.e., forking the repo), replace > `nvim-lua` with `` in the commands below From 33fcfe4877a822db6ffda394a0698f47ad98fd9a Mon Sep 17 00:00:00 2001 From: RulentWave <49258216+RulentWave@users.noreply.github.com> Date: Mon, 24 Mar 2025 15:33:53 -0400 Subject: [PATCH 264/480] changed Conform's format_on_save lambda so that buffers that match disable_filetypes return nil. This allows you to enable a formatter for langages in the disable_filetypes table to have a formatter that can be run manually with Leader-f but doesnt enable format_on_save for them (#1395) --- init.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/init.lua b/init.lua index 1427b6c7d5d..fe030ddf249 100644 --- a/init.lua +++ b/init.lua @@ -749,16 +749,14 @@ require('lazy').setup({ -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. local disable_filetypes = { c = true, cpp = true } - local lsp_format_opt if disable_filetypes[vim.bo[bufnr].filetype] then - lsp_format_opt = 'never' + return nil else - lsp_format_opt = 'fallback' + return { + timeout_ms = 500, + lsp_format = 'fallback', + } end - return { - timeout_ms = 500, - lsp_format = lsp_format_opt, - } end, formatters_by_ft = { lua = { 'stylua' }, From 33ce2e4717ccf19941097768e561b59a0cb939d6 Mon Sep 17 00:00:00 2001 From: Sander Date: Mon, 24 Mar 2025 20:34:57 +0100 Subject: [PATCH 265/480] feat(keymap): move windows without `` (#1368) --- init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/init.lua b/init.lua index fe030ddf249..cbf9ff65d67 100644 --- a/init.lua +++ b/init.lua @@ -194,6 +194,12 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +-- NOTE: Some terminals have coliding keymaps or are not able to send distinct keycodes +-- vim.keymap.set("n", "", "H", { desc = "Move window to the left" }) +-- vim.keymap.set("n", "", "L", { desc = "Move window to the right" }) +-- vim.keymap.set("n", "", "J", { desc = "Move window to the lower" }) +-- vim.keymap.set("n", "", "K", { desc = "Move window to the upper" }) + -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` From c347c82d1f52d10e761d6ef201f44a09936304c9 Mon Sep 17 00:00:00 2001 From: dasvh Date: Wed, 9 Apr 2025 16:39:17 +0200 Subject: [PATCH 266/480] fix: minor misspellings (#1450) * fix: minor misspellings * revert change for `-Bbuild` --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index cbf9ff65d67..1f8d9c871a8 100644 --- a/init.lua +++ b/init.lua @@ -194,7 +194,7 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) --- NOTE: Some terminals have coliding keymaps or are not able to send distinct keycodes +-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes -- vim.keymap.set("n", "", "H", { desc = "Move window to the left" }) -- vim.keymap.set("n", "", "L", { desc = "Move window to the right" }) -- vim.keymap.set("n", "", "J", { desc = "Move window to the lower" }) From 69346f59a4db0b7d0afa4eb2508e936fd0d002d9 Mon Sep 17 00:00:00 2001 From: "Theo P." <63016528+theopn@users.noreply.github.com> Date: Wed, 9 Apr 2025 11:01:57 -0400 Subject: [PATCH 267/480] Change LSP Keybindings to Match the Default `gr` Bindings Introduced in Neovim 0.11 (#1427) * refactor: change LSP keybindings to the default gr bindings introduced in 0.11 * refactor: modify existing LSP functions to follow convention --- init.lua | 50 +++++++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/init.lua b/init.lua index 1f8d9c871a8..bafc666922b 100644 --- a/init.lua +++ b/init.lua @@ -336,11 +336,7 @@ require('lazy').setup({ -- Document existing key chains spec = { - { 'c', group = '[C]ode', mode = { 'n', 'x' } }, - { 'd', group = '[D]ocument' }, - { 'r', group = '[R]ename' }, { 's', group = '[S]earch' }, - { 'w', group = '[W]orkspace' }, { 't', group = '[T]oggle' }, { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, }, @@ -532,42 +528,42 @@ require('lazy').setup({ vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) end - -- Jump to the definition of the word under your cursor. - -- This is where a variable was first declared, or where a function is defined, etc. - -- To jump back, press . - map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') + + -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. + map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) -- Find references for the word under your cursor. - map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') -- Jump to the implementation of the word under your cursor. -- Useful when your language has ways of declaring types without an actual implementation. - map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - -- Jump to the type of the word under your cursor. - -- Useful when you're not sure what type a variable is and you want to see - -- the definition of its *type*, not where it was *defined*. - map('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') + -- Jump to the definition of the word under your cursor. + -- This is where a variable was first declared, or where a function is defined, etc. + -- To jump back, press . + map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header. + map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') -- Fuzzy find all the symbols in your current document. -- Symbols are things like variables, functions, types, etc. - map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') -- Fuzzy find all the symbols in your current workspace. -- Similar to document symbols, except searches over your entire project. - map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') - - -- Rename the variable under your cursor. - -- Most Language Servers support renaming across files, etc. - map('rn', vim.lsp.buf.rename, '[R]e[n]ame') - - -- Execute a code action, usually your cursor needs to be on top of an error - -- or a suggestion from your LSP for this to activate. - map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' }) + map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') - -- WARN: This is not Goto Definition, this is Goto Declaration. - -- For example, in C this would take you to the header. - map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + -- Jump to the type of the word under your cursor. + -- Useful when you're not sure what type a variable is and you want to see + -- the definition of its *type*, not where it was *defined*. + map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) ---@param client vim.lsp.Client From 0ac5cb6802d7bd468fdf3ae64d475676d6c63645 Mon Sep 17 00:00:00 2001 From: Dmytro Onypko Date: Wed, 9 Apr 2025 16:05:40 +0100 Subject: [PATCH 268/480] Remove Telescope `0.1` branch lock (#1448) --- init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/init.lua b/init.lua index bafc666922b..0b4bed8eb0b 100644 --- a/init.lua +++ b/init.lua @@ -353,7 +353,6 @@ require('lazy').setup({ { -- Fuzzy Finder (files, lsp, etc) 'nvim-telescope/telescope.nvim', event = 'VimEnter', - branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim', { -- If encountering errors, see telescope-fzf-native README for installation instructions From addbed53e4a8b85f6ab3f996a5bf6d6d047a15fa Mon Sep 17 00:00:00 2001 From: Liam Dyer Date: Wed, 9 Apr 2025 17:25:57 -0400 Subject: [PATCH 269/480] feat: switch nvim-cmp for blink.cmp (#1426) --- init.lua | 164 ++++++++++++---------------- lua/kickstart/plugins/autopairs.lua | 10 +- 2 files changed, 73 insertions(+), 101 deletions(-) diff --git a/init.lua b/init.lua index 0b4bed8eb0b..776c6873ff6 100644 --- a/init.lua +++ b/init.lua @@ -481,8 +481,8 @@ require('lazy').setup({ -- Useful status updates for LSP. { 'j-hui/fidget.nvim', opts = {} }, - -- Allows extra capabilities provided by nvim-cmp - 'hrsh7th/cmp-nvim-lsp', + -- Allows extra capabilities provided by blink.cmp + 'saghen/blink.cmp', }, config = function() -- Brief aside: **What is LSP?** @@ -649,10 +649,9 @@ require('lazy').setup({ -- LSP servers and clients are able to communicate to each other what features they support. -- By default, Neovim doesn't support everything that is in the LSP specification. - -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. - -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers. - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) + -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities. + -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers. + local capabilities = require('blink.cmp').get_lsp_capabilities() -- Enable the following language servers -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. @@ -771,12 +770,14 @@ require('lazy').setup({ }, { -- Autocompletion - 'hrsh7th/nvim-cmp', - event = 'InsertEnter', + 'saghen/blink.cmp', + event = 'VimEnter', + version = '1.*', dependencies = { - -- Snippet Engine & its associated nvim-cmp source + -- Snippet Engine { 'L3MON4D3/LuaSnip', + version = '2.*', build = (function() -- Build Step is needed for regex support in snippets. -- This step is not supported in many windows environments. @@ -797,95 +798,74 @@ require('lazy').setup({ -- end, -- }, }, + opts = {}, }, - 'saadparwaiz1/cmp_luasnip', - - -- Adds other completion capabilities. - -- nvim-cmp does not ship with all sources by default. They are split - -- into multiple repos for maintenance purposes. - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-nvim-lsp-signature-help', + 'folke/lazydev.nvim', }, - config = function() - -- See `:help cmp` - local cmp = require 'cmp' - local luasnip = require 'luasnip' - luasnip.config.setup {} - - cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - completion = { completeopt = 'menu,menuone,noinsert' }, - - -- For an understanding of why these mappings were - -- chosen, you will need to read `:help ins-completion` + --- @module 'blink.cmp' + --- @type blink.cmp.Config + opts = { + keymap = { + -- 'default' (recommended) for mappings similar to built-in completions + -- to accept ([y]es) the completion. + -- This will auto-import if your LSP supports it. + -- This will expand snippets if the LSP sent a snippet. + -- 'super-tab' for tab to accept + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- For an understanding of why the 'default' preset is recommended, + -- you will need to read `:help ins-completion` -- -- No, but seriously. Please read `:help ins-completion`, it is really good! - mapping = cmp.mapping.preset.insert { - -- Select the [n]ext item - [''] = cmp.mapping.select_next_item(), - -- Select the [p]revious item - [''] = cmp.mapping.select_prev_item(), - - -- Scroll the documentation window [b]ack / [f]orward - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - - -- Accept ([y]es) the completion. - -- This will auto-import if your LSP supports it. - -- This will expand snippets if the LSP sent a snippet. - [''] = cmp.mapping.confirm { select = true }, - - -- If you prefer more traditional completion keymaps, - -- you can uncomment the following lines - --[''] = cmp.mapping.confirm { select = true }, - --[''] = cmp.mapping.select_next_item(), - --[''] = cmp.mapping.select_prev_item(), - - -- Manually trigger a completion from nvim-cmp. - -- Generally you don't need this, because nvim-cmp will display - -- completions whenever it has completion options available. - [''] = cmp.mapping.complete {}, - - -- Think of as moving to the right of your snippet expansion. - -- So if you have a snippet that's like: - -- function $name($args) - -- $body - -- end - -- - -- will move you to the right of each of the expansion locations. - -- is similar, except moving you backwards. - [''] = cmp.mapping(function() - if luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function() - if luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - end - end, { 'i', 's' }), + -- + -- All presets have the following mappings: + -- /: move to right/left of your snippet expansion + -- : Open menu or open docs if already open + -- / or /: Select next/previous item + -- : Hide menu + -- : Toggle signature help + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + preset = 'default', - -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: - -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps - }, - sources = { - { - name = 'lazydev', - -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it - group_index = 0, - }, - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'path' }, - { name = 'nvim_lsp_signature_help' }, + -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: + -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps + }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'mono', + }, + + completion = { + -- By default, you may press `` to show the documentation. + -- Optionally, set `auto_show = true` to show the documentation after a delay. + documentation = { auto_show = false, auto_show_delay_ms = 500 }, + }, + + sources = { + default = { 'lsp', 'path', 'snippets', 'lazydev' }, + providers = { + lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, }, - } - end, + }, + + snippets = { preset = 'luasnip' }, + + -- Blink.cmp includes an optional, recommended rust fuzzy matcher, + -- which automatically downloads a prebuilt binary when enabled. + -- + -- By default, we use the Lua implementation instead, but you may enable + -- the rust implementation via `'prefer_rust_with_warning'` + -- + -- See :h blink-cmp-config-fuzzy for more information + fuzzy = { implementation = 'lua' }, + + -- Shows a signature help window while you type arguments for a function + signature = { enabled = true }, + }, }, { -- You can easily change to a different colorscheme. diff --git a/lua/kickstart/plugins/autopairs.lua b/lua/kickstart/plugins/autopairs.lua index 87a7e5ffa2e..386d392e7ad 100644 --- a/lua/kickstart/plugins/autopairs.lua +++ b/lua/kickstart/plugins/autopairs.lua @@ -4,13 +4,5 @@ return { 'windwp/nvim-autopairs', event = 'InsertEnter', - -- Optional dependency - dependencies = { 'hrsh7th/nvim-cmp' }, - config = function() - require('nvim-autopairs').setup {} - -- If you want to automatically add `(` after selecting a function or method - local cmp_autopairs = require 'nvim-autopairs.completion.cmp' - local cmp = require 'cmp' - cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) - end, + opts = {}, } From 94e74b2ce26ce5e8f06ff2b307dad7a85b3d07d3 Mon Sep 17 00:00:00 2001 From: guru245 Date: Sat, 10 May 2025 08:41:44 +0900 Subject: [PATCH 270/480] Change to Mason's new address (#1516) --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 776c6873ff6..0d0e8a81c3b 100644 --- a/init.lua +++ b/init.lua @@ -474,8 +474,8 @@ require('lazy').setup({ -- Automatically install LSPs and related tools to stdpath for Neovim -- Mason must be loaded before its dependents so we need to set it up here. -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` - { 'williamboman/mason.nvim', opts = {} }, - 'williamboman/mason-lspconfig.nvim', + { 'mason-org/mason.nvim', opts = {} }, + 'mason-org/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', -- Useful status updates for LSP. From 9849bbfed7e2d79d94cb252ac1302e66cd2d9ce1 Mon Sep 17 00:00:00 2001 From: guru245 Date: Sun, 11 May 2025 09:11:50 +0900 Subject: [PATCH 271/480] feat: switch vim-sleuth for guess-indent.nvim (#1512) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 0d0e8a81c3b..6be82d59eb1 100644 --- a/init.lua +++ b/init.lua @@ -239,7 +239,7 @@ vim.opt.rtp:prepend(lazypath) -- NOTE: Here is where you install your plugins. require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). - 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically + 'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically -- NOTE: Plugins can also be added by using a table, -- with the first argument being the link and the following From 0264dd98ec2b2f4dd0ed150f4324e76c5fa733fd Mon Sep 17 00:00:00 2001 From: Ori Perry <48057913+oriori1703@users.noreply.github.com> Date: Sun, 11 May 2025 03:16:03 +0300 Subject: [PATCH 272/480] Replace vim.opt with vim.o (#1495) * Replace vim.opt with vim.o Because it offers a nicer interface and info on hover. For now leave vim.opt when using the table interface (until vim.o with tables is implemented) * Add type hint for vim.opt.rtp * Add a comment about using vim.opt instead of vim.o --- init.lua | 54 +++++++++++++++++++--------------- lua/kickstart/plugins/lint.lua | 2 +- 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/init.lua b/init.lua index 6be82d59eb1..eb715025c30 100644 --- a/init.lua +++ b/init.lua @@ -94,72 +94,77 @@ vim.g.maplocalleader = ' ' vim.g.have_nerd_font = false -- [[ Setting options ]] --- See `:help vim.opt` +-- See `:help vim.o` -- NOTE: You can change these options as you wish! -- For more options, you can see `:help option-list` -- Make line numbers default -vim.opt.number = true +vim.o.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +-- vim.o.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! -vim.opt.mouse = 'a' +vim.o.mouse = 'a' -- Don't show the mode, since it's already in the status line -vim.opt.showmode = false +vim.o.showmode = false -- Sync clipboard between OS and Neovim. -- Schedule the setting after `UiEnter` because it can increase startup-time. -- Remove this option if you want your OS clipboard to remain independent. -- See `:help 'clipboard'` vim.schedule(function() - vim.opt.clipboard = 'unnamedplus' + vim.o.clipboard = 'unnamedplus' end) -- Enable break indent -vim.opt.breakindent = true +vim.o.breakindent = true -- Save undo history -vim.opt.undofile = true +vim.o.undofile = true -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term -vim.opt.ignorecase = true -vim.opt.smartcase = true +vim.o.ignorecase = true +vim.o.smartcase = true -- Keep signcolumn on by default -vim.opt.signcolumn = 'yes' +vim.o.signcolumn = 'yes' -- Decrease update time -vim.opt.updatetime = 250 +vim.o.updatetime = 250 -- Decrease mapped sequence wait time -vim.opt.timeoutlen = 300 +vim.o.timeoutlen = 300 -- Configure how new splits should be opened -vim.opt.splitright = true -vim.opt.splitbelow = true +vim.o.splitright = true +vim.o.splitbelow = true -- Sets how neovim will display certain whitespace characters in the editor. -- See `:help 'list'` -- and `:help 'listchars'` -vim.opt.list = true +-- +-- Notice listchars is set using `vim.opt` instead of `vim.o`. +-- It is very similar to `vim.o` but offers an interface for conveniently interacting with tables. +-- See `:help lua-options` +-- and `:help lua-options-guide` +vim.o.list = true vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } -- Preview substitutions live, as you type! -vim.opt.inccommand = 'split' +vim.o.inccommand = 'split' -- Show which line your cursor is on -vim.opt.cursorline = true +vim.o.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. -vim.opt.scrolloff = 10 +vim.o.scrolloff = 10 -- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`), -- instead raise a dialog asking if you wish to save the current file(s) -- See `:help 'confirm'` -vim.opt.confirm = true +vim.o.confirm = true -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -223,8 +228,11 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then if vim.v.shell_error ~= 0 then error('Error cloning lazy.nvim:\n' .. out) end -end ---@diagnostic disable-next-line: undefined-field -vim.opt.rtp:prepend(lazypath) +end + +---@type vim.Option +local rtp = vim.opt.rtp +rtp:prepend(lazypath) -- [[ Configure and install plugins ]] -- @@ -295,7 +303,7 @@ require('lazy').setup({ event = 'VimEnter', -- Sets the loading event to 'VimEnter' opts = { -- delay between pressing a key and opening which-key (milliseconds) - -- this setting is independent of vim.opt.timeoutlen + -- this setting is independent of vim.o.timeoutlen delay = 0, icons = { -- set icon mappings to true if you have a Nerd Font diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index 907c6bf3e31..dec42f097c6 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -50,7 +50,7 @@ return { -- Only run the linter in buffers that you can modify in order to -- avoid superfluous noise, notably within the handy LSP pop-ups that -- describe the hovered symbol using Markdown. - if vim.opt_local.modifiable:get() then + if vim.bo.modifiable then lint.try_lint() end end, From 1ddd3d2784ef65875952d862ccfac853ee4ae4d2 Mon Sep 17 00:00:00 2001 From: pynappo Date: Sat, 10 May 2025 17:18:04 -0700 Subject: [PATCH 273/480] don't lazy-load neo-tree so netrw hijacking on startup works (#1489) --- lua/kickstart/plugins/neo-tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua index bd4422695aa..c7067891df0 100644 --- a/lua/kickstart/plugins/neo-tree.lua +++ b/lua/kickstart/plugins/neo-tree.lua @@ -9,7 +9,7 @@ return { 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended 'MunifTanjim/nui.nvim', }, - cmd = 'Neotree', + lazy = false, keys = { { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, }, From 27d52b670c37a15c4e3565950fd7c17faa82cb1e Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Sun, 11 May 2025 02:23:54 +0200 Subject: [PATCH 274/480] README: mention fd-find in requirements (#1477) Fixes #1476 --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8ace8b9b22b..4113950550d 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,8 @@ If you are experiencing issues, please make sure you have the latest versions. External Requirements: - Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`) -- [ripgrep](https://github.com/BurntSushi/ripgrep#installation) +- [ripgrep](https://github.com/BurntSushi/ripgrep#installation), + [fd-find](https://github.com/sharkdp/fd#installation) - Clipboard tool (xclip/xsel/win32yank or other depending on the platform) - A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons - if you have it set `vim.g.have_nerd_font` in `init.lua` to true From 9f2c97d34af7d8b729923b95478529e2e40b4e8d Mon Sep 17 00:00:00 2001 From: Omri Sarig Date: Sun, 11 May 2025 02:29:04 +0200 Subject: [PATCH 275/480] fix: rename vim.highlight.on_yank to vim.hl.on_yank (#1482) The functions of vim.highlight were renamed to vim.hl on commit 18b43c331d8a0ed87d7cbefe2a18543b8e4ad360 of neovim, which was applied with the release of nvim version 0.11. Now, the use of vim.highlight is deprecated, and instead, one should use vim.hl functions. In practice, vim.highlight is still working, however, asking for help for vim.highlight.on_yank fails (E149), while asking for help for vim.hl.on_yank works as expected. So, by updating the used function, a new user will have easier time looking getting the relevant help. Co-authored-by: Omri Sarig --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index eb715025c30..b98ffc6198a 100644 --- a/init.lua +++ b/init.lua @@ -210,12 +210,12 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the upper win -- Highlight when yanking (copying) text -- Try it with `yap` in normal mode --- See `:help vim.highlight.on_yank()` +-- See `:help vim.hl.on_yank()` vim.api.nvim_create_autocmd('TextYankPost', { desc = 'Highlight when yanking (copying) text', group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), callback = function() - vim.highlight.on_yank() + vim.hl.on_yank() end, }) From e8627e589d40178c316a6bdfbc674a093c8696a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Calla=20Alarc=C3=B3n?= Date: Thu, 22 May 2025 23:10:04 +0200 Subject: [PATCH 276/480] Update remaining Mason's old address (#1530) --- lua/kickstart/plugins/debug.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 753cb0cedd3..8e332bf2ff9 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -18,7 +18,7 @@ return { 'nvim-neotest/nvim-nio', -- Installs the debug adapters for you - 'williamboman/mason.nvim', + 'mason-org/mason.nvim', 'jay-babu/mason-nvim-dap.nvim', -- Add your own debuggers here From 79d20cd623f73a1793a44516dfb723986b16d8f2 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 2 May 2025 19:48:31 +1200 Subject: [PATCH 277/480] added it --- lua/custom/plugins/nvim-tmux-navigator.lua | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 lua/custom/plugins/nvim-tmux-navigator.lua diff --git a/lua/custom/plugins/nvim-tmux-navigator.lua b/lua/custom/plugins/nvim-tmux-navigator.lua new file mode 100644 index 00000000000..a63ac9940d9 --- /dev/null +++ b/lua/custom/plugins/nvim-tmux-navigator.lua @@ -0,0 +1,7 @@ +return { + 'christoomey/vim-tmux-navigator', + vim.keymap.set('n', '', ':TmuxNavigateLeft'), + vim.keymap.set('n', '', ':TmuxNavigateDown'), + vim.keymap.set('n', '', ':TmuxNavigateUp'), + vim.keymap.set('n', '', ':TmuxNavigateRight'), +} From 4eaaee898e0277434c7431cbad2ba7e06f04d1f1 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 2 May 2025 19:48:44 +1200 Subject: [PATCH 278/480] added that too --- lua/custom/toggle-path-cmp.lua | 47 ++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 lua/custom/toggle-path-cmp.lua diff --git a/lua/custom/toggle-path-cmp.lua b/lua/custom/toggle-path-cmp.lua new file mode 100644 index 00000000000..71e90ebd37f --- /dev/null +++ b/lua/custom/toggle-path-cmp.lua @@ -0,0 +1,47 @@ +local cmp = require 'cmp' + +local M = {} + +function M.toggle_path_completion() + local snippet = cmp.get_config().snippet + local completion = cmp.get_config().completion + local mapping = cmp.get_config().mapping + local sources = cmp.get_config().sources + local path_enabled = false + + for _, source in ipairs(sources) do + if source.name == 'path' then + path_enabled = true + break + end + end + + if path_enabled then + cmp.setup { + snippet, + completion, + mapping, + sources = { + { name = 'lazydev', group_index = 0 }, + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, + } + print 'Path completion disabled' + else + cmp.setup { + snippet, + completion, + mapping, + sources = { + { name = 'lazydev', group_index = 0 }, + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'path' }, + }, + } + print 'Path completion enabled' + end +end + +return M From b1b384df4a8663f1f11b1fcb7cc56cf610c2751d Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 2 May 2025 19:52:59 +1200 Subject: [PATCH 279/480] yes, i have my own settings --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index b98ffc6198a..ed464d6ec9f 100644 --- a/init.lua +++ b/init.lua @@ -984,7 +984,7 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! From d2d4e216dc62cf978dbdc752194547b45b642407 Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 3 May 2025 01:01:26 +1200 Subject: [PATCH 280/480] custom options --- lua/custom/options.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lua/custom/options.lua diff --git a/lua/custom/options.lua b/lua/custom/options.lua new file mode 100644 index 00000000000..36db2c6dd32 --- /dev/null +++ b/lua/custom/options.lua @@ -0,0 +1,19 @@ +-- Place custom vim options here + +-- Set based on your font installation +vim.g.have_nerd_font = true + +-- Indentation settings +vim.o.expandtab = true +vim.o.smartindent = true +vim.o.tabstop = 4 +vim.o.shiftwidth = 4 + +-- Add any other custom vim.o or vim.g settings from your old config here +-- For example, if you changed defaults for: +-- vim.opt.number = true -- (Already default in kickstart) +-- vim.opt.mouse = 'a' -- (Already default in kickstart) +-- etc... Review the options section of your old init.lua and add any *changed* values here. +-- The kickstart defaults are generally sensible, so you might not need many overrides. + +-- print 'Custom options loaded!' -- Optional: Add print statement for debugging From c57bbcc77b621f596257e9dcc518ec2274cf6a57 Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 3 May 2025 01:12:39 +1200 Subject: [PATCH 281/480] custom plugin init --- lua/custom/plugins/init.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8d7a..6bd0b736914 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,12 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information -return {} +return { + { import = 'custom.plugins.theme' }, + { import = 'custom.plugins.telescope' }, + { import = 'custom.plugins.lsp' }, + { import = 'custom.plugins.formatting' }, + { import = 'custom.plugins.treesitter' }, + { import = 'custom.plugins.completion' }, + { import = 'custom.plugins.nvim-tmux-navigator' }, +} From aa13dab32c8cf2c39b9ee9fd851463ac66b6513f Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 3 May 2025 01:19:44 +1200 Subject: [PATCH 282/480] custom theme --- lua/custom/plugins/theme.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 lua/custom/plugins/theme.lua diff --git a/lua/custom/plugins/theme.lua b/lua/custom/plugins/theme.lua new file mode 100644 index 00000000000..3bff8c6dd16 --- /dev/null +++ b/lua/custom/plugins/theme.lua @@ -0,0 +1,12 @@ +-- Theme configuration + +return { + { + 'catppuccin/nvim', + priority = 1000, + config = function() + vim.cmd.colorscheme 'catppuccin-mocha' + end, + }, + { 'folke/tokyonight.nvim', enabled = false }, +} From 1f78968ac93573c89321d0135d45c925fcb28a4d Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 3 May 2025 01:26:05 +1200 Subject: [PATCH 283/480] custom telescope --- lua/custom/plugins/telescope.lua | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 lua/custom/plugins/telescope.lua diff --git a/lua/custom/plugins/telescope.lua b/lua/custom/plugins/telescope.lua new file mode 100644 index 00000000000..61dbbf3f6c1 --- /dev/null +++ b/lua/custom/plugins/telescope.lua @@ -0,0 +1,49 @@ +-- Telescope override configuration + +return { + { + 'nvim-telescope/telescope.nvim', + -- Ensure dependencies are loaded (lazy.nvim usually handles this if defined elsewhere) + -- Listing them here ensures they are available if Telescope is the first plugin requiring them. + dependencies = { + 'nvim-lua/plenary.nvim', + { + 'nvim-telescope/telescope-fzf-native.nvim', + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, + { 'nvim-telescope/telescope-ui-select.nvim' }, + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, -- Conditionally enable based on options + }, + opts = { -- Use opts to merge/override defaults + pickers = { + find_files = { + -- Use rg for finding files (ensure rg is installed via Nix/Home Manager) + find_command = { 'rg', '--files', '--hidden', '-g', '!.git' }, + }, + }, + -- Ensure extensions are configured if kickstart doesn't handle it via opts + extensions = { + ['ui-select'] = { + require('telescope.themes').get_dropdown(), + }, + -- Configuration for fzf-native extension + fzf = { + fuzzy = true, + override_generic_sorter = true, + override_file_sorter = true, + case_mode = 'smart_case', + }, + }, + }, + -- The config function ensures extensions are loaded after setup + config = function(_, opts) + require('telescope').setup(opts) + -- Load extensions after setup + pcall(require('telescope').load_extension, 'fzf') + pcall(require('telescope').load_extension, 'ui-select') + end, + }, +} From 0024c62a36a5d1d1b556b8e119e081ddf8f0d085 Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 3 May 2025 01:52:58 +1200 Subject: [PATCH 284/480] custom lsp --- lua/custom/plugins/lsp.lua | 159 +++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 lua/custom/plugins/lsp.lua diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua new file mode 100644 index 00000000000..f03bbd83acf --- /dev/null +++ b/lua/custom/plugins/lsp.lua @@ -0,0 +1,159 @@ +-- LSP configuration override + +return { + { + 'neovim/nvim-lspconfig', + -- Define dependencies required by lspconfig and related features + dependencies = { + -- Mason must be loaded before mason-lspconfig + { 'williamboman/mason.nvim', opts = {} }, -- Basic setup for mason + { + 'williamboman/mason-lspconfig.nvim', + -- This table overrides the `ensure_installed` option for mason-lspconfig + opts = { + ensure_installed = { + -- List ALL servers you want mason-lspconfig to manage installation for + 'lua_ls', -- Keep kickstart default + 'clangd', -- Your addition + 'pyright', -- Your addition + -- Add others like 'bashls', 'yamlls', 'nixd', 'gopls', 'rust_analyzer' etc. if needed + }, + -- You can add other mason-lspconfig options here if needed + -- automatic_installation = true, -- Example: if you want auto-install + }, + }, + -- Optional: Tool installer for linters/formatters not handled by LSP + -- 'WhoIsSethDaniel/mason-tool-installer.nvim', -- If you use it, configure its ensure_installed separately + + -- Status updates for LSP + { 'j-hui/fidget.nvim', opts = {} }, + + -- LSP source for nvim-cmp (ensure this is also listed as dep for nvim-cmp) + 'hrsh7th/cmp-nvim-lsp', + }, + config = function(_, opts) + -- This config function runs AFTER the plugin and its dependencies are loaded. + -- It sets up the LSP servers based on the configurations provided. + + -- Get LSP capabilities from nvim-cmp + local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) + + -- Setup LSP servers using mason-lspconfig + -- This iterates through the servers listed in `ensure_installed` above + -- and calls lspconfig's setup function for each. + require('mason-lspconfig').setup_handlers { + function(server_name) -- Default handler + require('lspconfig')[server_name].setup { + capabilities = capabilities, -- Pass cmp capabilities to the server + -- Add any server-specific overrides here if needed, e.g.: + -- on_attach = function(client, bufnr) ... end, + -- settings = { ... }, + } + end, + -- Example of specific setup for a server if needed: + -- ['lua_ls'] = function() + -- require('lspconfig').lua_ls.setup { + -- capabilities = capabilities, + -- settings = { Lua = { completion = { callSnippet = 'Replace' } } }, + -- } + -- end, + } + + -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section + -- This ensures the standard LSP keymaps (gd, gr, etc.) are set on attach. + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach-override', { clear = true }), + callback = function(event) + local map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end + + -- Standard LSP keymaps (copy these from kickstart init.lua or customize) + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') + map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) + map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') + map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') + map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') + + -- Highlight references (optional, from kickstart) + local client = vim.lsp.get_client_by_id(event.data.client_id) + if client and client.supports_method 'textDocument/documentHighlight' then + local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override', { clear = false }) + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + -- Ensure highlight group is cleared on detach + vim.api.nvim_create_autocmd('LspDetach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-detach-override', { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight-override', buffer = event2.buf } + end, + }) + end + + -- Inlay hints toggle (optional, from kickstart) + if client and client.supports_method 'textDocument/inlayHint' then + map('th', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) + end, '[T]oggle Inlay [H]ints') + end + end, + }) + + -- Diagnostic configuration (can be kept from kickstart or customized) + vim.diagnostic.config { + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = vim.g.have_nerd_font + and { + text = { + [vim.diagnostic.severity.ERROR] = '󰅚 ', -- Error icon + [vim.diagnostic.severity.WARN] = '󰀪 ', -- Warning icon + [vim.diagnostic.severity.INFO] = '󰋽 ', -- Info icon + [vim.diagnostic.severity.HINT] = '󰌶 ', -- Hint icon + }, + } + or {}, -- Use kickstart's sign definitions + virtual_text = { + source = 'if_many', + spacing = 2, + format = function(diagnostic) + -- Map diagnostic severity to the message itself (simple format) + local diagnostic_message = { + [vim.diagnostic.severity.ERROR] = diagnostic.message, + [vim.diagnostic.severity.WARN] = diagnostic.message, + [vim.diagnostic.severity.INFO] = diagnostic.message, + [vim.diagnostic.severity.HINT] = diagnostic.message, + } + return diagnostic_message[diagnostic.severity] + end, + }, + } + end, -- End of config function + }, + + -- Add the lazydev setup here as well, as it relates to LSP for Lua development + { + 'folke/lazydev.nvim', + ft = 'lua', + opts = { + library = { + { path = 'luvit-meta/library', words = { 'vim%.uv' } }, -- Corrected path if using luvit types + }, + }, + }, +} From 32c47943d312217fba0a3246ff150597e050454d Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 3 May 2025 01:54:16 +1200 Subject: [PATCH 285/480] custom formatting --- lua/custom/plugins/formatting.lua | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lua/custom/plugins/formatting.lua diff --git a/lua/custom/plugins/formatting.lua b/lua/custom/plugins/formatting.lua new file mode 100644 index 00000000000..a053bf9d3e0 --- /dev/null +++ b/lua/custom/plugins/formatting.lua @@ -0,0 +1,37 @@ +-- Formatter configuration + +return { + -- ======================================== + -- Formatter Configuration (conform.nvim) + -- ======================================== + { + 'stevearc/conform.nvim', + event = 'BufWritePre', -- Format on save + -- cmd = { 'ConformInfo' }, -- Optional: If you want the command available + -- keys = { ... } -- Optional: Define keys if needed + opts = { + formatters_by_ft = { + lua = { 'stylua' }, + c = { 'clang_format' }, + cpp = { 'clang_format' }, + python = { 'isort', 'black' }, + nix = { 'nixpkgs-fmt' }, -- Add nix formatter + -- Add other filetypes and formatters, e.g.: + -- javascript = { "prettier" }, + -- typescript = { "prettier" }, + -- css = { "prettier" }, + -- html = { "prettier" }, + -- json = { "prettier" }, + -- yaml = { "prettier" }, + -- markdown = { "prettier" }, + -- bash = { "shfmt" }, + }, + -- Configure format_on_save behavior + format_on_save = { + -- I recommend these options, but adjust to your liking + timeout_ms = 500, -- Stop formatting if it takes too long + lsp_fallback = true, -- Fallback to LSP formatting if conform fails + }, + }, + }, +} From 4117430cd1f2c01a088f643450ffab65003f11aa Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 3 May 2025 01:55:45 +1200 Subject: [PATCH 286/480] custom treesitter --- lua/custom/plugins/treesitter.lua | 52 +++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 lua/custom/plugins/treesitter.lua diff --git a/lua/custom/plugins/treesitter.lua b/lua/custom/plugins/treesitter.lua new file mode 100644 index 00000000000..7c48f8f0a6d --- /dev/null +++ b/lua/custom/plugins/treesitter.lua @@ -0,0 +1,52 @@ +-- Treesitter configuration override + +return { + -- ======================================== + -- Treesitter Configuration Override + -- ======================================== + { + 'nvim-treesitter/nvim-treesitter', + -- build = ':TSUpdate', -- Keep build command if needed from kickstart + -- main = 'nvim-treesitter.configs', -- Keep if needed from kickstart + opts = { -- Use opts to merge/override defaults + ensure_installed = { + -- List ALL parsers you want installed based on your previous config + 'bash', + 'c', + 'cmake', + 'cpp', + 'diff', + 'html', + 'lua', + 'luadoc', + 'make', + 'markdown', + 'markdown_inline', + 'nix', -- Added based on previous diff + 'python', -- Added based on previous diff + 'query', + 'vim', + 'vimdoc', + 'yaml', -- Added based on previous diff + -- Add any others you commonly use + }, + -- Autoinstall languages that are not installed + auto_install = true, -- Keep kickstart's default or set as desired + + -- Keep other kickstart defaults like highlight/indent settings unless you want to change them + highlight = { + enable = true, + -- additional_vim_regex_highlighting = { 'ruby' }, -- Keep if needed + }, + indent = { + enable = true, + -- disable = { 'ruby' }, -- Keep if needed + }, + }, + -- If kickstart used a config function for treesitter and you need to replicate + -- parts of it that aren't handled by opts, add it here. + -- config = function(_, opts) + -- require('nvim-treesitter.configs').setup(opts) + -- end, + }, +} From 3069f013d3352561506737ebb1565397622b2548 Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 3 May 2025 02:01:13 +1200 Subject: [PATCH 287/480] custom completion --- lua/custom/plugins/completion.lua | 87 +++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 lua/custom/plugins/completion.lua diff --git a/lua/custom/plugins/completion.lua b/lua/custom/plugins/completion.lua new file mode 100644 index 00000000000..786ca632e1a --- /dev/null +++ b/lua/custom/plugins/completion.lua @@ -0,0 +1,87 @@ +-- Autocompletion configuration (nvim-cmp) + +return { + { + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', -- Load when entering insert mode + dependencies = { + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + { -- LuaSnip and its potential build step + 'L3MON4D3/LuaSnip', + -- Follow latest V2 release. + version = 'v2.*', -- <--- REVERTED TO USING VERSION + -- tag = '', -- Removed tag specification + -- install jsregexp (optional!:). + build = (function() + -- Build Step is needed for regex support in snippets. This step is optional. + -- Remove the below condition to build Luasnip with regex support on Mac and Linux. + if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then + return + end + return 'make install_jsregexp' + end)(), + }, + 'saadparwaiz1/cmp_luasnip', -- Snippet source for nvim-cmp + -- Add other cmp sources if needed, e.g.: + -- 'hrsh7th/cmp-cmdline', + }, + config = function() + local cmp = require 'cmp' + local luasnip = require 'luasnip' + luasnip.config.setup {} -- Setup luasnip first + + -- Configure nvim-cmp + cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) -- Expand snippets using luasnip + end, + }, + completion = { + -- Set completeopt to have a better completion experience + -- :help completeopt + -- menuone: popup even when there's only one match + -- noinsert: Do not insert text until a selection is made + -- noselect: Do not select the first item by default + completeopt = 'menu,menuone,noinsert', + }, + -- Key Mappings for completion + mapping = cmp.mapping.preset.insert { + [''] = cmp.mapping.select_next_item(), -- Select next item + [''] = cmp.mapping.select_prev_item(), -- Select previous item + [''] = cmp.mapping.scroll_docs(-4), -- Scroll documentation back + [''] = cmp.mapping.scroll_docs(4), -- Scroll documentation forward + [''] = cmp.mapping.confirm { select = true }, -- Confirm selection + [''] = cmp.mapping.complete {}, -- Trigger completion manually + + -- Handle snippet jumping + [''] = cmp.mapping(function() + if luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + end + end, { 'i', 's' }), -- Jump forward in snippet + [''] = cmp.mapping(function() + if luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + end + end, { 'i', 's' }), -- Jump backward in snippet + }, + -- Completion sources + sources = cmp.config.sources { + { name = 'nvim_lsp' }, -- LSP symbols + { name = 'luasnip' }, -- Snippets + { name = 'buffer' }, -- Words from current buffer + { name = 'path' }, -- Filesystem paths + }, + -- Add other cmp setup options from your old config if any + } + + -- *** FIX: Require and setup your custom toggle module AFTER cmp is setup *** + -- Ensure the 'custom.toggle-path-cmp' module exists in lua/custom/ + local completion_toggle = require 'custom.toggle-path-cmp' + vim.keymap.set('n', 'tp', completion_toggle.toggle_path_completion, { desc = '[T]oggle [p]ath autocompletion' }) + end, -- End of config function + }, +} From 2639f27f8445468d228cdce518e303ef02c4ea28 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 9 May 2025 12:19:20 +1200 Subject: [PATCH 288/480] fixing keymaps --- init.lua | 3 +++ lua/custom/keymaps.lua | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 lua/custom/keymaps.lua diff --git a/init.lua b/init.lua index ed464d6ec9f..f63c4ca3989 100644 --- a/init.lua +++ b/init.lua @@ -219,6 +219,9 @@ vim.api.nvim_create_autocmd('TextYankPost', { end, }) +require 'custom.options' +require 'custom.keymaps' + -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' diff --git a/lua/custom/keymaps.lua b/lua/custom/keymaps.lua new file mode 100644 index 00000000000..46a8e101989 --- /dev/null +++ b/lua/custom/keymaps.lua @@ -0,0 +1,25 @@ +-- [[ Basic Keymaps ]] +-- See `:help vim.keymap.set()` + +-- Clear highlights on search when pressing in normal mode +-- See `:help hlsearch` +vim.keymap.set('n', '', 'nohlsearch', { desc = 'Clear Search Highlight' }) + +-- Diagnostic keymaps (These might also be set by LSP config, but having them here is fine) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) + +-- Exit terminal mode in the builtin terminal +vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) + +-- Keybinds to make split navigation easier. +-- Use CTRL+ to switch between windows +-- See `:help wincmd` +vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) + +-- Add any other general-purpose keymaps you want here + +-- Standard practice for Lua modules that don't need to return complex data +return {} From 06037c9bb419511e089084b0e90677fb87a8c885 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 9 May 2025 13:16:17 +1200 Subject: [PATCH 289/480] refactor --- lua/custom/plugins/completion.lua | 4 +- lua/custom/plugins/formatting.lua | 5 +- lua/custom/plugins/lsp.lua | 101 ++++++++++++++---------------- lua/custom/plugins/treesitter.lua | 2 - 4 files changed, 51 insertions(+), 61 deletions(-) diff --git a/lua/custom/plugins/completion.lua b/lua/custom/plugins/completion.lua index 786ca632e1a..f0e7d27069c 100644 --- a/lua/custom/plugins/completion.lua +++ b/lua/custom/plugins/completion.lua @@ -1,5 +1,3 @@ --- Autocompletion configuration (nvim-cmp) - return { { 'hrsh7th/nvim-cmp', @@ -11,7 +9,7 @@ return { { -- LuaSnip and its potential build step 'L3MON4D3/LuaSnip', -- Follow latest V2 release. - version = 'v2.*', -- <--- REVERTED TO USING VERSION + version = 'v2.*', -- tag = '', -- Removed tag specification -- install jsregexp (optional!:). build = (function() diff --git a/lua/custom/plugins/formatting.lua b/lua/custom/plugins/formatting.lua index a053bf9d3e0..68524c3ea85 100644 --- a/lua/custom/plugins/formatting.lua +++ b/lua/custom/plugins/formatting.lua @@ -14,7 +14,10 @@ return { lua = { 'stylua' }, c = { 'clang_format' }, cpp = { 'clang_format' }, - python = { 'isort', 'black' }, + -- Use ruff for Python formatting (includes isort and is faster than black + -- Ensure 'ruff' is installed via Home Manager (pkgs.ruff) + python = { 'ruff_format', 'ruff_fix' }, + -- python = { 'isort', 'black' }, nix = { 'nixpkgs-fmt' }, -- Add nix formatter -- Add other filetypes and formatters, e.g.: -- javascript = { "prettier" }, diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index f03bbd83acf..1477574aaec 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -18,8 +18,8 @@ return { 'pyright', -- Your addition -- Add others like 'bashls', 'yamlls', 'nixd', 'gopls', 'rust_analyzer' etc. if needed }, - -- You can add other mason-lspconfig options here if needed - -- automatic_installation = true, -- Example: if you want auto-install + -- Optional: Configure automatic setup (might replace manual loop below) + -- automatic_installation = false, -- v2 uses different approach }, }, -- Optional: Tool installer for linters/formatters not handled by LSP @@ -37,30 +37,22 @@ return { -- Get LSP capabilities from nvim-cmp local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) + -- + -- Call mason-lspconfig's setup function (mainly for ensure_installed) + require('mason-lspconfig').setup(opts) - -- Setup LSP servers using mason-lspconfig - -- This iterates through the servers listed in `ensure_installed` above - -- and calls lspconfig's setup function for each. - require('mason-lspconfig').setup_handlers { - function(server_name) -- Default handler - require('lspconfig')[server_name].setup { - capabilities = capabilities, -- Pass cmp capabilities to the server - -- Add any server-specific overrides here if needed, e.g.: - -- on_attach = function(client, bufnr) ... end, - -- settings = { ... }, - } - end, - -- Example of specific setup for a server if needed: - -- ['lua_ls'] = function() - -- require('lspconfig').lua_ls.setup { - -- capabilities = capabilities, - -- settings = { Lua = { completion = { callSnippet = 'Replace' } } }, - -- } - -- end, - } + -- Manually iterate through the servers list and set them up with lspconfig + local servers_to_setup = require('mason-lspconfig').get_ensure_installed() + + for _, server_name in ipairs(servers_to_setup) do + -- print('Setting up LSP server: ' .. server_name) -- Debug print + require('lspconfig')[server_name].setup { + capabilities = capabilities, -- Pass augmented capabilities + -- Add any server-specific overrides here if needed + } + end -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section - -- This ensures the standard LSP keymaps (gd, gr, etc.) are set on attach. vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('kickstart-lsp-attach-override', { clear = true }), callback = function(event) @@ -69,7 +61,7 @@ return { vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) end - -- Standard LSP keymaps (copy these from kickstart init.lua or customize) + -- Standard LSP keymaps map('grn', vim.lsp.buf.rename, '[R]e[n]ame') map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') @@ -80,21 +72,25 @@ return { map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') - -- Highlight references (optional, from kickstart) + -- Highlight references local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client.supports_method 'textDocument/documentHighlight' then + local function client_supports_method(client, method, bufnr) + if vim.fn.has 'nvim-0.11' == 1 then + return client:supports_method(method, { bufnr = bufnr }) + else + return client.supports_method(method, { bufnr = bufnr }) + end + end + if client and client_supports_method(client, 'textDocument/documentHighlight', event.buf) then local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override', { clear = false }) - vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.document_highlight, - }) - vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.clear_references, - }) - -- Ensure highlight group is cleared on detach + vim.api.nvim_create_autocmd( + { 'CursorHold', 'CursorHoldI' }, + { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight } + ) + vim.api.nvim_create_autocmd( + { 'CursorMoved', 'CursorMovedI' }, + { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.clear_references } + ) vim.api.nvim_create_autocmd('LspDetach', { group = vim.api.nvim_create_augroup('kickstart-lsp-detach-override', { clear = true }), callback = function(event2) @@ -104,8 +100,8 @@ return { }) end - -- Inlay hints toggle (optional, from kickstart) - if client and client.supports_method 'textDocument/inlayHint' then + -- Inlay hints toggle + if client and client_supports_method(client, 'textDocument/inlayHint', event.buf) then map('th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints') @@ -113,26 +109,23 @@ return { end, }) - -- Diagnostic configuration (can be kept from kickstart or customized) + -- Diagnostic configuration vim.diagnostic.config { severity_sort = true, float = { border = 'rounded', source = 'if_many' }, underline = { severity = vim.diagnostic.severity.ERROR }, - signs = vim.g.have_nerd_font - and { - text = { - [vim.diagnostic.severity.ERROR] = '󰅚 ', -- Error icon - [vim.diagnostic.severity.WARN] = '󰀪 ', -- Warning icon - [vim.diagnostic.severity.INFO] = '󰋽 ', -- Info icon - [vim.diagnostic.severity.HINT] = '󰌶 ', -- Hint icon - }, - } - or {}, -- Use kickstart's sign definitions + signs = vim.g.have_nerd_font and { + text = { + [vim.diagnostic.severity.ERROR] = '󰅚 ', + [vim.diagnostic.severity.WARN] = '󰀪 ', + [vim.diagnostic.severity.INFO] = '󰋽 ', + [vim.diagnostic.severity.HINT] = '󰌶 ', + }, + } or {}, virtual_text = { source = 'if_many', spacing = 2, format = function(diagnostic) - -- Map diagnostic severity to the message itself (simple format) local diagnostic_message = { [vim.diagnostic.severity.ERROR] = diagnostic.message, [vim.diagnostic.severity.WARN] = diagnostic.message, @@ -146,14 +139,12 @@ return { end, -- End of config function }, - -- Add the lazydev setup here as well, as it relates to LSP for Lua development + -- lazydev setup { 'folke/lazydev.nvim', ft = 'lua', opts = { - library = { - { path = 'luvit-meta/library', words = { 'vim%.uv' } }, -- Corrected path if using luvit types - }, + library = { { path = 'luvit-meta/library', words = { 'vim%.uv' } } }, }, }, } diff --git a/lua/custom/plugins/treesitter.lua b/lua/custom/plugins/treesitter.lua index 7c48f8f0a6d..47f69f23d99 100644 --- a/lua/custom/plugins/treesitter.lua +++ b/lua/custom/plugins/treesitter.lua @@ -1,5 +1,3 @@ --- Treesitter configuration override - return { -- ======================================== -- Treesitter Configuration Override From 05f2cfd7f86bad4721da844a24d39ef6def75d37 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 9 May 2025 13:31:25 +1200 Subject: [PATCH 290/480] refactor bugs --- lua/custom/plugins/lsp.lua | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 1477574aaec..76f25ddc69a 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -1,6 +1,7 @@ --- LSP configuration override - return { + -- ======================================== + -- LSP Configuration Override (via mason-lspconfig) + -- ======================================== { 'neovim/nvim-lspconfig', -- Define dependencies required by lspconfig and related features @@ -9,21 +10,19 @@ return { { 'williamboman/mason.nvim', opts = {} }, -- Basic setup for mason { 'williamboman/mason-lspconfig.nvim', - -- This table overrides the `ensure_installed` option for mason-lspconfig + -- This table defines the options for mason-lspconfig + -- It tells mason-lspconfig which servers Mason should install. opts = { ensure_installed = { - -- List ALL servers you want mason-lspconfig to manage installation for - 'lua_ls', -- Keep kickstart default - 'clangd', -- Your addition - 'pyright', -- Your addition + 'lua_ls', + 'clangd', + 'pyright', -- Add others like 'bashls', 'yamlls', 'nixd', 'gopls', 'rust_analyzer' etc. if needed }, - -- Optional: Configure automatic setup (might replace manual loop below) - -- automatic_installation = false, -- v2 uses different approach }, }, -- Optional: Tool installer for linters/formatters not handled by LSP - -- 'WhoIsSethDaniel/mason-tool-installer.nvim', -- If you use it, configure its ensure_installed separately + -- 'WhoIsSethDaniel/mason-tool-installer.nvim', -- Status updates for LSP { 'j-hui/fidget.nvim', opts = {} }, @@ -35,15 +34,19 @@ return { -- This config function runs AFTER the plugin and its dependencies are loaded. -- It sets up the LSP servers based on the configurations provided. - -- Get LSP capabilities from nvim-cmp + -- Get LSP capabilities, augmented by nvim-cmp local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) - -- - -- Call mason-lspconfig's setup function (mainly for ensure_installed) - require('mason-lspconfig').setup(opts) - -- Manually iterate through the servers list and set them up with lspconfig - local servers_to_setup = require('mason-lspconfig').get_ensure_installed() + -- Call mason-lspconfig's setup function. This primarily ensures that the + -- ensure_installed list above is processed by Mason for installation. + -- We don't rely on this setup call to configure the servers below anymore. + -- require('mason-lspconfig').setup(opts) -- This might not even be needed if opts are passed automatically + + -- Manually define the list of servers we want lspconfig to setup. + -- This list should match the 'ensure_installed' list for mason-lspconfig above. + local servers_to_setup = { 'lua_ls', 'clangd', 'pyright' } -- <-- EXPLICIT LIST HERE + -- Iterate through the defined servers list and set them up with lspconfig for _, server_name in ipairs(servers_to_setup) do -- print('Setting up LSP server: ' .. server_name) -- Debug print require('lspconfig')[server_name].setup { From 00404dc3df57ec2b13b9fc6adb995c4811cdf753 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 9 May 2025 13:38:59 +1200 Subject: [PATCH 291/480] more bugs --- lua/custom/plugins/telescope.lua | 55 ++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/lua/custom/plugins/telescope.lua b/lua/custom/plugins/telescope.lua index 61dbbf3f6c1..e821007f25c 100644 --- a/lua/custom/plugins/telescope.lua +++ b/lua/custom/plugins/telescope.lua @@ -1,10 +1,10 @@ --- Telescope override configuration - return { + -- ======================================== + -- Telescope Override + -- ======================================== { 'nvim-telescope/telescope.nvim', - -- Ensure dependencies are loaded (lazy.nvim usually handles this if defined elsewhere) - -- Listing them here ensures they are available if Telescope is the first plugin requiring them. + -- Ensure dependencies are loaded dependencies = { 'nvim-lua/plenary.nvim', { @@ -24,17 +24,17 @@ return { find_command = { 'rg', '--files', '--hidden', '-g', '!.git' }, }, }, - -- Ensure extensions are configured if kickstart doesn't handle it via opts + -- Configure extensions extensions = { ['ui-select'] = { require('telescope.themes').get_dropdown(), }, -- Configuration for fzf-native extension fzf = { - fuzzy = true, - override_generic_sorter = true, - override_file_sorter = true, - case_mode = 'smart_case', + fuzzy = true, -- Enable fuzzy matching + override_generic_sorter = true, -- Override the generic sorter + override_file_sorter = true, -- Override the file sorter + case_mode = 'smart_case', -- Ignore case unless capitals are used }, }, }, @@ -44,6 +44,43 @@ return { -- Load extensions after setup pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'ui-select') + + -- *** ADD TELESCOPE KEYMAPS HERE *** + local builtin = require 'telescope.builtin' + -- Add the find_files keymap + vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) + + -- Add other Telescope keymaps from kickstart's init.lua (uncomment to enable) + vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) + vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) + vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) + vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) + vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) + vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) + vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) + vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) + vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + + -- Fuzzy search in current buffer (corrected function body) + vim.keymap.set('n', '/', function() + builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) + end, { desc = '[/] Fuzzily search in current buffer' }) + + -- Search in open files (corrected function body) + vim.keymap.set('n', 's/', function() + builtin.live_grep { + grep_open_files = true, + prompt_title = 'Live Grep in Open Files', + } + end, { desc = '[S]earch [/] in Open Files' }) + + -- Search Neovim files (corrected function body) + vim.keymap.set('n', 'sn', function() + builtin.find_files { cwd = vim.fn.stdpath 'config' } + end, { desc = '[S]earch [N]eovim files' }) end, }, } From 3a74a3910b4c09da3cfe5181b8cc33d57ef8e94b Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 14 May 2025 11:29:56 +1200 Subject: [PATCH 292/480] typo --- lua/custom/plugins/formatting.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/formatting.lua b/lua/custom/plugins/formatting.lua index 68524c3ea85..4e121fb4a6c 100644 --- a/lua/custom/plugins/formatting.lua +++ b/lua/custom/plugins/formatting.lua @@ -18,7 +18,7 @@ return { -- Ensure 'ruff' is installed via Home Manager (pkgs.ruff) python = { 'ruff_format', 'ruff_fix' }, -- python = { 'isort', 'black' }, - nix = { 'nixpkgs-fmt' }, -- Add nix formatter + nix = { 'nixpkgs_fmt' }, -- Add nix formatter -- Add other filetypes and formatters, e.g.: -- javascript = { "prettier" }, -- typescript = { "prettier" }, From 85aa75c8e5f6749351f753607c935ec9bc5bb200 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 14 May 2025 12:27:48 +1200 Subject: [PATCH 293/480] trying different nix formatter --- lua/custom/plugins/formatting.lua | 2 +- lua/custom/plugins/lsp.lua | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/custom/plugins/formatting.lua b/lua/custom/plugins/formatting.lua index 4e121fb4a6c..af803017b7e 100644 --- a/lua/custom/plugins/formatting.lua +++ b/lua/custom/plugins/formatting.lua @@ -18,7 +18,7 @@ return { -- Ensure 'ruff' is installed via Home Manager (pkgs.ruff) python = { 'ruff_format', 'ruff_fix' }, -- python = { 'isort', 'black' }, - nix = { 'nixpkgs_fmt' }, -- Add nix formatter + nix = { 'alejandra' }, -- Add nix formatter -- Add other filetypes and formatters, e.g.: -- javascript = { "prettier" }, -- typescript = { "prettier" }, diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 76f25ddc69a..615dc109074 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -17,6 +17,7 @@ return { 'lua_ls', 'clangd', 'pyright', + 'nixd', -- Add others like 'bashls', 'yamlls', 'nixd', 'gopls', 'rust_analyzer' etc. if needed }, }, From 795a2302b9b5cdbe9d9fbd6e919c6246e83f8f7b Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 14 May 2025 12:51:44 +1200 Subject: [PATCH 294/480] keep the lock i guess --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 005b535b606..8a192cab54d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ test.sh nvim spell/ -lazy-lock.json From f1624aff868d9c738c06619068afff75ed875292 Mon Sep 17 00:00:00 2001 From: dlond Date: Thu, 15 May 2025 09:32:34 +1200 Subject: [PATCH 295/480] trying different nix lsp --- lua/custom/plugins/lsp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 615dc109074..54cd7c5cb3c 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -17,7 +17,7 @@ return { 'lua_ls', 'clangd', 'pyright', - 'nixd', + 'nil_ls', -- Add others like 'bashls', 'yamlls', 'nixd', 'gopls', 'rust_analyzer' etc. if needed }, }, From d9c09a23cdce0721a6e6ce442decaf7a09614e76 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 16 May 2025 10:39:38 +1200 Subject: [PATCH 296/480] removed Mason --- init.lua | 48 +----- lua/custom/plugins/formatting.lua | 70 ++++----- lua/custom/plugins/lsp.lua | 244 +++++++++++++----------------- lua/kickstart/plugins/debug.lua | 21 --- 4 files changed, 143 insertions(+), 240 deletions(-) diff --git a/init.lua b/init.lua index f63c4ca3989..9af8960ddf5 100644 --- a/init.lua +++ b/init.lua @@ -301,7 +301,7 @@ require('lazy').setup({ -- Then, because we use the `opts` key (recommended), the configuration runs -- after the plugin has been loaded as `require(MODULE).setup(opts)`. - { -- Useful plugin to show you pending keybinds. + { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' opts = { @@ -382,7 +382,7 @@ require('lazy').setup({ { 'nvim-telescope/telescope-ui-select.nvim' }, -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that @@ -482,13 +482,6 @@ require('lazy').setup({ -- Main LSP Configuration 'neovim/nvim-lspconfig', dependencies = { - -- Automatically install LSPs and related tools to stdpath for Neovim - -- Mason must be loaded before its dependents so we need to set it up here. - -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` - { 'mason-org/mason.nvim', opts = {} }, - 'mason-org/mason-lspconfig.nvim', - 'WhoIsSethDaniel/mason-tool-installer.nvim', - -- Useful status updates for LSP. { 'j-hui/fidget.nvim', opts = {} }, @@ -515,9 +508,6 @@ require('lazy').setup({ -- - Symbol Search -- - and more! -- - -- Thus, Language Servers are external tools that must be installed separately from - -- Neovim. This is where `mason` and related plugins come into play. - -- -- If you're wondering about lsp vs treesitter, you can check out the wonderfully -- and elegantly composed help section, `:help lsp-vs-treesitter` @@ -702,40 +692,6 @@ require('lazy').setup({ }, }, } - - -- 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 - -- :Mason - -- - -- You can press `g?` for help in this menu. - -- - -- `mason` had to be setup earlier: to configure its options see the - -- `dependencies` table for `nvim-lspconfig` above. - -- - -- You can add other tools here that you want Mason to install - -- for you, so that they are available from within Neovim. - local ensure_installed = vim.tbl_keys(servers or {}) - vim.list_extend(ensure_installed, { - 'stylua', -- Used to format Lua code - }) - require('mason-tool-installer').setup { ensure_installed = ensure_installed } - - require('mason-lspconfig').setup { - ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) - automatic_installation = false, - handlers = { - function(server_name) - local server = servers[server_name] or {} - -- This handles overriding only values explicitly passed - -- by the server configuration above. Useful when disabling - -- certain features of an LSP (for example, turning off formatting for ts_ls) - server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) - require('lspconfig')[server_name].setup(server) - end, - }, - } end, }, diff --git a/lua/custom/plugins/formatting.lua b/lua/custom/plugins/formatting.lua index af803017b7e..047980de013 100644 --- a/lua/custom/plugins/formatting.lua +++ b/lua/custom/plugins/formatting.lua @@ -1,40 +1,40 @@ -- Formatter configuration return { - -- ======================================== - -- Formatter Configuration (conform.nvim) - -- ======================================== - { - 'stevearc/conform.nvim', - event = 'BufWritePre', -- Format on save - -- cmd = { 'ConformInfo' }, -- Optional: If you want the command available - -- keys = { ... } -- Optional: Define keys if needed - opts = { - formatters_by_ft = { - lua = { 'stylua' }, - c = { 'clang_format' }, - cpp = { 'clang_format' }, - -- Use ruff for Python formatting (includes isort and is faster than black - -- Ensure 'ruff' is installed via Home Manager (pkgs.ruff) - python = { 'ruff_format', 'ruff_fix' }, - -- python = { 'isort', 'black' }, - nix = { 'alejandra' }, -- Add nix formatter - -- Add other filetypes and formatters, e.g.: - -- javascript = { "prettier" }, - -- typescript = { "prettier" }, - -- css = { "prettier" }, - -- html = { "prettier" }, - -- json = { "prettier" }, - -- yaml = { "prettier" }, - -- markdown = { "prettier" }, - -- bash = { "shfmt" }, - }, - -- Configure format_on_save behavior - format_on_save = { - -- I recommend these options, but adjust to your liking - timeout_ms = 500, -- Stop formatting if it takes too long - lsp_fallback = true, -- Fallback to LSP formatting if conform fails - }, + -- ======================================== + -- Formatter Configuration (conform.nvim) + -- ======================================== + { + 'stevearc/conform.nvim', + event = 'BufWritePre', -- Format on save + -- cmd = { 'ConformInfo' }, -- Optional: If you want the command available + -- keys = { ... } -- Optional: Define keys if needed + opts = { + formatters_by_ft = { + lua = { 'stylua' }, + c = { 'clang_format' }, + cpp = { 'clang_format' }, + -- Use ruff for Python formatting (includes isort and is faster than black + -- Ensure 'ruff' is installed via Home Manager (pkgs.ruff) + python = { 'ruff_format', 'ruff_fix' }, + -- python = { 'isort', 'black' }, + nix = { 'alejandra' }, -- Add nix formatter + -- Add other filetypes and formatters, e.g.: + -- javascript = { "prettier" }, + -- typescript = { "prettier" }, + -- css = { "prettier" }, + -- html = { "prettier" }, + -- json = { "prettier" }, + -- yaml = { "prettier" }, + -- markdown = { "prettier" }, + -- bash = { "shfmt" }, + }, + -- Configure format_on_save behavior + format_on_save = { + -- I recommend these options, but adjust to your liking + timeout_ms = 500, -- Stop formatting if it takes too long + lsp_fallback = true, -- Fallback to LSP formatting if conform fails + }, + }, }, - }, } diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 54cd7c5cb3c..b3c5249f978 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -1,154 +1,122 @@ return { - -- ======================================== - -- LSP Configuration Override (via mason-lspconfig) - -- ======================================== - { - 'neovim/nvim-lspconfig', - -- Define dependencies required by lspconfig and related features - dependencies = { - -- Mason must be loaded before mason-lspconfig - { 'williamboman/mason.nvim', opts = {} }, -- Basic setup for mason - { - 'williamboman/mason-lspconfig.nvim', - -- This table defines the options for mason-lspconfig - -- It tells mason-lspconfig which servers Mason should install. - opts = { - ensure_installed = { - 'lua_ls', - 'clangd', - 'pyright', - 'nil_ls', - -- Add others like 'bashls', 'yamlls', 'nixd', 'gopls', 'rust_analyzer' etc. if needed - }, - }, - }, - -- Optional: Tool installer for linters/formatters not handled by LSP - -- 'WhoIsSethDaniel/mason-tool-installer.nvim', - - -- Status updates for LSP - { 'j-hui/fidget.nvim', opts = {} }, + -- ======================================== + -- LSP Configuration Override + -- ======================================== + { + -- Status updates for LSP + { 'j-hui/fidget.nvim', opts = {} }, - -- LSP source for nvim-cmp (ensure this is also listed as dep for nvim-cmp) - 'hrsh7th/cmp-nvim-lsp', + -- LSP source for nvim-cmp (ensure this is also listed as dep for nvim-cmp) + 'hrsh7th/cmp-nvim-lsp', }, config = function(_, opts) - -- This config function runs AFTER the plugin and its dependencies are loaded. - -- It sets up the LSP servers based on the configurations provided. + -- Get LSP capabilities, augmented by nvim-cmp + local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) - -- Get LSP capabilities, augmented by nvim-cmp - local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) + local servers_to_setup = { 'lua_ls', 'clangd', 'pyright' } -- <-- EXPLICIT LIST HERE - -- Call mason-lspconfig's setup function. This primarily ensures that the - -- ensure_installed list above is processed by Mason for installation. - -- We don't rely on this setup call to configure the servers below anymore. - -- require('mason-lspconfig').setup(opts) -- This might not even be needed if opts are passed automatically - - -- Manually define the list of servers we want lspconfig to setup. - -- This list should match the 'ensure_installed' list for mason-lspconfig above. - local servers_to_setup = { 'lua_ls', 'clangd', 'pyright' } -- <-- EXPLICIT LIST HERE + -- Iterate through the defined servers list and set them up with lspconfig + for _, server_name in ipairs(servers_to_setup) do + require('lspconfig')[server_name].setup { + capabilities = capabilities, -- Pass augmented capabilities + -- Add any server-specific overrides here if needed + } + end - -- Iterate through the defined servers list and set them up with lspconfig - for _, server_name in ipairs(servers_to_setup) do - -- print('Setting up LSP server: ' .. server_name) -- Debug print - require('lspconfig')[server_name].setup { - capabilities = capabilities, -- Pass augmented capabilities - -- Add any server-specific overrides here if needed - } - end + -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach-override', { clear = true }), + callback = function(event) + local map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end - -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach-override', { clear = true }), - callback = function(event) - local map = function(keys, func, desc, mode) - mode = mode or 'n' - vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) - end + -- Standard LSP keymaps + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') + map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) + map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') + map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') + map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') - -- Standard LSP keymaps - map('grn', vim.lsp.buf.rename, '[R]e[n]ame') - map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) - map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') - map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') - map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') + -- Highlight references + local client = vim.lsp.get_client_by_id(event.data.client_id) + local function client_supports_method(client, method, bufnr) + if vim.fn.has 'nvim-0.11' == 1 then + return client:supports_method(method, { bufnr = bufnr }) + else + return client.supports_method(method, { bufnr = bufnr }) + end + end - -- Highlight references - local client = vim.lsp.get_client_by_id(event.data.client_id) - local function client_supports_method(client, method, bufnr) - if vim.fn.has 'nvim-0.11' == 1 then - return client:supports_method(method, { bufnr = bufnr }) - else - return client.supports_method(method, { bufnr = bufnr }) - end - end - if client and client_supports_method(client, 'textDocument/documentHighlight', event.buf) then - local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override', { clear = false }) - vim.api.nvim_create_autocmd( - { 'CursorHold', 'CursorHoldI' }, - { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight } - ) - vim.api.nvim_create_autocmd( - { 'CursorMoved', 'CursorMovedI' }, - { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.clear_references } - ) - vim.api.nvim_create_autocmd('LspDetach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-detach-override', { clear = true }), - callback = function(event2) - vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight-override', buffer = event2.buf } - end, - }) - end + if client and client_supports_method(client, 'textDocument/documentHighlight', event.buf) then + local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override', + { clear = false }) + vim.api.nvim_create_autocmd( + { 'CursorHold', 'CursorHoldI' }, + { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight } + ) + vim.api.nvim_create_autocmd( + { 'CursorMoved', 'CursorMovedI' }, + { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.clear_references } + ) + vim.api.nvim_create_autocmd('LspDetach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-detach-override', { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight-override', buffer = event2.buf } + end, + }) + end - -- Inlay hints toggle - if client and client_supports_method(client, 'textDocument/inlayHint', event.buf) then - map('th', function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) - end, '[T]oggle Inlay [H]ints') - end - end, - }) + -- Inlay hints toggle + if client and client_supports_method(client, 'textDocument/inlayHint', event.buf) then + map('th', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) + end, '[T]oggle Inlay [H]ints') + end + end, + }) - -- Diagnostic configuration - vim.diagnostic.config { - severity_sort = true, - float = { border = 'rounded', source = 'if_many' }, - underline = { severity = vim.diagnostic.severity.ERROR }, - signs = vim.g.have_nerd_font and { - text = { - [vim.diagnostic.severity.ERROR] = '󰅚 ', - [vim.diagnostic.severity.WARN] = '󰀪 ', - [vim.diagnostic.severity.INFO] = '󰋽 ', - [vim.diagnostic.severity.HINT] = '󰌶 ', - }, - } or {}, - virtual_text = { - source = 'if_many', - spacing = 2, - format = function(diagnostic) - local diagnostic_message = { - [vim.diagnostic.severity.ERROR] = diagnostic.message, - [vim.diagnostic.severity.WARN] = diagnostic.message, - [vim.diagnostic.severity.INFO] = diagnostic.message, - [vim.diagnostic.severity.HINT] = diagnostic.message, - } - return diagnostic_message[diagnostic.severity] - end, - }, - } + -- Diagnostic configuration + vim.diagnostic.config { + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = vim.g.have_nerd_font and { + text = { + [vim.diagnostic.severity.ERROR] = '󰅚 ', + [vim.diagnostic.severity.WARN] = '󰀪 ', + [vim.diagnostic.severity.INFO] = '󰋽 ', + [vim.diagnostic.severity.HINT] = '󰌶 ', + }, + } or {}, + virtual_text = { + source = 'if_many', + spacing = 2, + format = function(diagnostic) + local diagnostic_message = { + [vim.diagnostic.severity.ERROR] = diagnostic.message, + [vim.diagnostic.severity.WARN] = diagnostic.message, + [vim.diagnostic.severity.INFO] = diagnostic.message, + [vim.diagnostic.severity.HINT] = diagnostic.message, + } + return diagnostic_message[diagnostic.severity] + end, + }, + } end, -- End of config function - }, - -- lazydev setup - { - 'folke/lazydev.nvim', - ft = 'lua', - opts = { - library = { { path = 'luvit-meta/library', words = { 'vim%.uv' } } }, + -- lazydev setup + { + 'folke/lazydev.nvim', + ft = 'lua', + opts = { + library = { { path = 'luvit-meta/library', words = { 'vim%.uv' } } }, + }, }, - }, } diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 8e332bf2ff9..77880880eda 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -17,10 +17,6 @@ return { -- Required dependency for nvim-dap-ui 'nvim-neotest/nvim-nio', - -- Installs the debug adapters for you - 'mason-org/mason.nvim', - 'jay-babu/mason-nvim-dap.nvim', - -- Add your own debuggers here 'leoluz/nvim-dap-go', }, @@ -81,23 +77,6 @@ return { local dap = require 'dap' local dapui = require 'dapui' - require('mason-nvim-dap').setup { - -- Makes a best effort to setup the various debuggers with - -- reasonable debug configurations - automatic_installation = true, - - -- You can provide additional configuration to the handlers, - -- see mason-nvim-dap README for more information - handlers = {}, - - -- You'll need to check that you have the required things installed - -- online, please don't ask me how to install them :) - ensure_installed = { - -- Update this to ensure that you have the debuggers for the langs you want - 'delve', - }, - } - -- Dap UI setup -- For more information, see |:help nvim-dap-ui| dapui.setup { From eb6772ea33ef846482cb945e02e216deb93eaf6d Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 20 May 2025 19:35:23 +1200 Subject: [PATCH 297/480] trying to fix auto indenting on some files --- lua/custom/options.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/options.lua b/lua/custom/options.lua index 36db2c6dd32..6401b8b9f60 100644 --- a/lua/custom/options.lua +++ b/lua/custom/options.lua @@ -5,7 +5,7 @@ vim.g.have_nerd_font = true -- Indentation settings vim.o.expandtab = true -vim.o.smartindent = true +-- vim.o.smartindent = true vim.o.tabstop = 4 vim.o.shiftwidth = 4 From 2bbca46cd989048111c17552590a0ba1ed33b476 Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 20 May 2025 19:41:06 +1200 Subject: [PATCH 298/480] trying to fix auto indenting on some files part 2 --- lua/custom/options.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/custom/options.lua b/lua/custom/options.lua index 6401b8b9f60..6bb32e88f5f 100644 --- a/lua/custom/options.lua +++ b/lua/custom/options.lua @@ -5,7 +5,8 @@ vim.g.have_nerd_font = true -- Indentation settings vim.o.expandtab = true --- vim.o.smartindent = true +vim.o.smartindent = true +vim.o.autoindent = true vim.o.tabstop = 4 vim.o.shiftwidth = 4 From 1b1e2947f6d7a8f99b3d4fad9547fc290850e2ef Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 20 May 2025 19:54:56 +1200 Subject: [PATCH 299/480] trying to fix auto indenting on some files part 3 --- lua/custom/plugins/lsp.lua | 213 ++++++++++++++++++------------------- 1 file changed, 106 insertions(+), 107 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index b3c5249f978..5011b1d0e2a 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -1,122 +1,121 @@ -return { - -- ======================================== - -- LSP Configuration Override - -- ======================================== - { - -- Status updates for LSP - { 'j-hui/fidget.nvim', opts = {} }, +-- ~/dlond/nvim/lua/custom/plugins/lsp.lua +-- LSP configuration, assuming LSP servers are installed via Nix/Home Manager - -- LSP source for nvim-cmp (ensure this is also listed as dep for nvim-cmp) - 'hrsh7th/cmp-nvim-lsp', +return { + -- ======================================== + -- LSP Configuration (LSP servers provided by Nix/Home Manager) + -- ======================================== + { + 'neovim/nvim-lspconfig', + event = { "BufReadPre", "BufNewFile" }, -- Load LSP config early + dependencies = { + -- Dependencies for nvim-lspconfig itself, if any. + -- Mason and mason-lspconfig are removed as Nix handles LSP installation. + { 'j-hui/fidget.nvim', opts = {} }, -- Useful status updates for LSP + 'hrsh7th/cmp-nvim-lsp', -- LSP completion source for nvim-cmp }, config = function(_, opts) - -- Get LSP capabilities, augmented by nvim-cmp - local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) + -- This config function runs AFTER the plugin and its dependencies are loaded. + -- It sets up the LSP servers. - local servers_to_setup = { 'lua_ls', 'clangd', 'pyright' } -- <-- EXPLICIT LIST HERE + -- Get LSP capabilities, augmented by nvim-cmp + local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) - -- Iterate through the defined servers list and set them up with lspconfig - for _, server_name in ipairs(servers_to_setup) do - require('lspconfig')[server_name].setup { - capabilities = capabilities, -- Pass augmented capabilities - -- Add any server-specific overrides here if needed - } - end + -- Define the list of LSP servers you want to configure. + -- These servers must be installed via Nix/Home Manager and be in your PATH. + local servers_to_setup = { + "lua_ls", + "clangd", + "pyright", + "nixd", + -- Add other servers like "bashls", "yamlls", "gopls", "rust_analyzer" etc. + -- Ensure the corresponding packages (e.g., pkgs.bash-language-server) + -- are in your Home Manager home.packages list. + } - -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach-override', { clear = true }), - callback = function(event) - local map = function(keys, func, desc, mode) - mode = mode or 'n' - vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) - end + -- Iterate through the defined servers list and set them up with lspconfig + for _, server_name in ipairs(servers_to_setup) do + -- print('Attempting to set up LSP server: ' .. server_name) -- Debug print + require('lspconfig')[server_name].setup { + capabilities = capabilities, -- Pass augmented capabilities + -- Add any server-specific overrides here if needed, e.g.: + -- For lua_ls: + -- settings = { Lua = { diagnostics = { globals = {'vim'} } } }, + } + end - -- Standard LSP keymaps - map('grn', vim.lsp.buf.rename, '[R]e[n]ame') - map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) - map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') - map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') - map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') + -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach-override', { clear = true }), + callback = function(event) + local map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end - -- Highlight references - local client = vim.lsp.get_client_by_id(event.data.client_id) - local function client_supports_method(client, method, bufnr) - if vim.fn.has 'nvim-0.11' == 1 then - return client:supports_method(method, { bufnr = bufnr }) - else - return client.supports_method(method, { bufnr = bufnr }) - end - end + -- Standard LSP keymaps + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') + map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) + map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') + map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') + map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') - if client and client_supports_method(client, 'textDocument/documentHighlight', event.buf) then - local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override', - { clear = false }) - vim.api.nvim_create_autocmd( - { 'CursorHold', 'CursorHoldI' }, - { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight } - ) - vim.api.nvim_create_autocmd( - { 'CursorMoved', 'CursorMovedI' }, - { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.clear_references } - ) - vim.api.nvim_create_autocmd('LspDetach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-detach-override', { clear = true }), - callback = function(event2) - vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight-override', buffer = event2.buf } - end, - }) - end + -- Highlight references + local client = vim.lsp.get_client_by_id(event.data.client_id) + local function client_supports_method(client, method, bufnr) + if vim.fn.has 'nvim-0.11' == 1 then + return client:supports_method(method, { bufnr = bufnr }) + else + return client.supports_method(method, { bufnr = bufnr }) + end + end + if client and client_supports_method(client, 'textDocument/documentHighlight', event.buf) then + local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override', { clear = false }) + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight }) + vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.clear_references }) + vim.api.nvim_create_autocmd('LspDetach', { group = vim.api.nvim_create_augroup('kickstart-lsp-detach-override', { clear = true }), callback = function(event2) vim.lsp.buf.clear_references(); vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight-override', buffer = event2.buf } end }) + end - -- Inlay hints toggle - if client and client_supports_method(client, 'textDocument/inlayHint', event.buf) then - map('th', function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) - end, '[T]oggle Inlay [H]ints') - end - end, - }) + -- Inlay hints toggle + if client and client_supports_method(client, 'textDocument/inlayHint', event.buf) then + map('th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints') + end + end, + }) + + -- Diagnostic configuration + vim.diagnostic.config { + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = vim.g.have_nerd_font and { + text = { + [vim.diagnostic.severity.ERROR] = '󰅚 ', [vim.diagnostic.severity.WARN] = '󰀪 ', [vim.diagnostic.severity.INFO] = '󰋽 ', [vim.diagnostic.severity.HINT] = '󰌶 ', + }, + } or {}, + virtual_text = { + source = 'if_many', spacing = 2, + format = function(diagnostic) + local diagnostic_message = { [vim.diagnostic.severity.ERROR] = diagnostic.message, [vim.diagnostic.severity.WARN] = diagnostic.message, [vim.diagnostic.severity.INFO] = diagnostic.message, [vim.diagnostic.severity.HINT] = diagnostic.message } + return diagnostic_message[diagnostic.severity] + end, + }, + } - -- Diagnostic configuration - vim.diagnostic.config { - severity_sort = true, - float = { border = 'rounded', source = 'if_many' }, - underline = { severity = vim.diagnostic.severity.ERROR }, - signs = vim.g.have_nerd_font and { - text = { - [vim.diagnostic.severity.ERROR] = '󰅚 ', - [vim.diagnostic.severity.WARN] = '󰀪 ', - [vim.diagnostic.severity.INFO] = '󰋽 ', - [vim.diagnostic.severity.HINT] = '󰌶 ', - }, - } or {}, - virtual_text = { - source = 'if_many', - spacing = 2, - format = function(diagnostic) - local diagnostic_message = { - [vim.diagnostic.severity.ERROR] = diagnostic.message, - [vim.diagnostic.severity.WARN] = diagnostic.message, - [vim.diagnostic.severity.INFO] = diagnostic.message, - [vim.diagnostic.severity.HINT] = diagnostic.message, - } - return diagnostic_message[diagnostic.severity] - end, - }, - } end, -- End of config function + }, - -- lazydev setup - { - 'folke/lazydev.nvim', - ft = 'lua', - opts = { - library = { { path = 'luvit-meta/library', words = { 'vim%.uv' } } }, - }, + -- lazydev setup (still useful for Neovim Lua development) + { + 'folke/lazydev.nvim', + ft = 'lua', + opts = { + library = { { path = 'luvit-meta/library', words = { 'vim%.uv' } } }, }, + }, } + From 1cd72c0f254726b88f8f9e6102b34caed83d928a Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 20 May 2025 20:23:40 +1200 Subject: [PATCH 300/480] trying to fix auto indenting on some files part 4? --- lua/custom/plugins/lsp.lua | 222 +++++++++++++++++++------------------ 1 file changed, 116 insertions(+), 106 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 5011b1d0e2a..15b7106f08e 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -2,120 +2,130 @@ -- LSP configuration, assuming LSP servers are installed via Nix/Home Manager return { - -- ======================================== - -- LSP Configuration (LSP servers provided by Nix/Home Manager) - -- ======================================== - { - 'neovim/nvim-lspconfig', - event = { "BufReadPre", "BufNewFile" }, -- Load LSP config early - dependencies = { - -- Dependencies for nvim-lspconfig itself, if any. - -- Mason and mason-lspconfig are removed as Nix handles LSP installation. - { 'j-hui/fidget.nvim', opts = {} }, -- Useful status updates for LSP - 'hrsh7th/cmp-nvim-lsp', -- LSP completion source for nvim-cmp - }, - config = function(_, opts) - -- This config function runs AFTER the plugin and its dependencies are loaded. - -- It sets up the LSP servers. - - -- Get LSP capabilities, augmented by nvim-cmp - local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) + -- ======================================== + -- LSP Configuration (LSP servers provided by Nix/Home Manager) + -- ======================================== + { + 'neovim/nvim-lspconfig', + event = { "BufReadPre", "BufNewFile" }, -- Load LSP config early + dependencies = { + -- Dependencies for nvim-lspconfig itself, if any. + -- Mason and mason-lspconfig are removed as Nix handles LSP installation. + { 'j-hui/fidget.nvim', opts = {} }, -- Useful status updates for LSP + 'hrsh7th/cmp-nvim-lsp', -- LSP completion source for nvim-cmp + }, + config = function(_, opts) + -- This config function runs AFTER the plugin and its dependencies are loaded. + -- It sets up the LSP servers. - -- Define the list of LSP servers you want to configure. - -- These servers must be installed via Nix/Home Manager and be in your PATH. - local servers_to_setup = { - "lua_ls", - "clangd", - "pyright", - "nixd", - -- Add other servers like "bashls", "yamlls", "gopls", "rust_analyzer" etc. - -- Ensure the corresponding packages (e.g., pkgs.bash-language-server) - -- are in your Home Manager home.packages list. - } + -- Get LSP capabilities, augmented by nvim-cmp + local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) - -- Iterate through the defined servers list and set them up with lspconfig - for _, server_name in ipairs(servers_to_setup) do - -- print('Attempting to set up LSP server: ' .. server_name) -- Debug print - require('lspconfig')[server_name].setup { - capabilities = capabilities, -- Pass augmented capabilities - -- Add any server-specific overrides here if needed, e.g.: - -- For lua_ls: - -- settings = { Lua = { diagnostics = { globals = {'vim'} } } }, - } - end + -- Define the list of LSP servers you want to configure. + -- These servers must be installed via Nix/Home Manager and be in your PATH. + local servers_to_setup = { + "lua_ls", + "clangd", + "pyright", + "nixd", + "ruff_lsp", + -- Add other servers like "bashls", "yamlls", "gopls", "rust_analyzer" etc. + -- Ensure the corresponding packages (e.g., pkgs.bash-language-server) + -- are in your Home Manager home.packages list. + } - -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach-override', { clear = true }), - callback = function(event) - local map = function(keys, func, desc, mode) - mode = mode or 'n' - vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) - end + -- Iterate through the defined servers list and set them up with lspconfig + for _, server_name in ipairs(servers_to_setup) do + -- print('Attempting to set up LSP server: ' .. server_name) -- Debug print + require('lspconfig')[server_name].setup { + capabilities = capabilities, -- Pass augmented capabilities + -- Add any server-specific overrides here if needed, e.g.: + -- For lua_ls: + -- settings = { Lua = { diagnostics = { globals = {'vim'} } } }, + } + end - -- Standard LSP keymaps - map('grn', vim.lsp.buf.rename, '[R]e[n]ame') - map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) - map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') - map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') - map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') + -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach-override', { clear = true }), + callback = function(event) + local map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end - -- Highlight references - local client = vim.lsp.get_client_by_id(event.data.client_id) - local function client_supports_method(client, method, bufnr) - if vim.fn.has 'nvim-0.11' == 1 then - return client:supports_method(method, { bufnr = bufnr }) - else - return client.supports_method(method, { bufnr = bufnr }) - end - end - if client and client_supports_method(client, 'textDocument/documentHighlight', event.buf) then - local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override', { clear = false }) - vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight }) - vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.clear_references }) - vim.api.nvim_create_autocmd('LspDetach', { group = vim.api.nvim_create_augroup('kickstart-lsp-detach-override', { clear = true }), callback = function(event2) vim.lsp.buf.clear_references(); vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight-override', buffer = event2.buf } end }) - end + -- Standard LSP keymaps + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') + map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) + map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') + map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') + map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') - -- Inlay hints toggle - if client and client_supports_method(client, 'textDocument/inlayHint', event.buf) then - map('th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints') - end - end, - }) + -- Highlight references + local client = vim.lsp.get_client_by_id(event.data.client_id) + local function client_supports_method(client, method, bufnr) + if vim.fn.has 'nvim-0.11' == 1 then + return client:supports_method(method, { bufnr = bufnr }) + else + return client.supports_method(method, { bufnr = bufnr }) + end + end + if client and client_supports_method(client, 'textDocument/documentHighlight', event.buf) then + local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override', + { clear = false }) + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, + { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight }) + vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, + { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.clear_references }) + vim.api.nvim_create_autocmd('LspDetach', + { group = vim.api.nvim_create_augroup('kickstart-lsp-detach-override', { clear = true }), callback = function( + event2) + vim.lsp.buf.clear_references(); vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight-override', buffer = event2.buf } + end }) + end - -- Diagnostic configuration - vim.diagnostic.config { - severity_sort = true, - float = { border = 'rounded', source = 'if_many' }, - underline = { severity = vim.diagnostic.severity.ERROR }, - signs = vim.g.have_nerd_font and { - text = { - [vim.diagnostic.severity.ERROR] = '󰅚 ', [vim.diagnostic.severity.WARN] = '󰀪 ', [vim.diagnostic.severity.INFO] = '󰋽 ', [vim.diagnostic.severity.HINT] = '󰌶 ', - }, - } or {}, - virtual_text = { - source = 'if_many', spacing = 2, - format = function(diagnostic) - local diagnostic_message = { [vim.diagnostic.severity.ERROR] = diagnostic.message, [vim.diagnostic.severity.WARN] = diagnostic.message, [vim.diagnostic.severity.INFO] = diagnostic.message, [vim.diagnostic.severity.HINT] = diagnostic.message } - return diagnostic_message[diagnostic.severity] - end, - }, - } + -- Inlay hints toggle + if client and client_supports_method(client, 'textDocument/inlayHint', event.buf) then + map('th', + function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, + '[T]oggle Inlay [H]ints') + end + end, + }) - end, -- End of config function - }, + -- Diagnostic configuration + vim.diagnostic.config { + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = vim.g.have_nerd_font and { + text = { + [vim.diagnostic.severity.ERROR] = '󰅚 ', [vim.diagnostic.severity.WARN] = '󰀪 ', [vim.diagnostic.severity.INFO] = '󰋽 ', [vim.diagnostic.severity.HINT] = '󰌶 ', + }, + } or {}, + virtual_text = { + source = 'if_many', spacing = 2, + format = function(diagnostic) + local diagnostic_message = { [vim.diagnostic.severity.ERROR] = diagnostic.message, + [vim.diagnostic.severity.WARN] = diagnostic.message, [vim.diagnostic.severity.INFO] = + diagnostic.message, [vim.diagnostic.severity.HINT] = diagnostic.message } + return diagnostic_message[diagnostic.severity] + end, + }, + } + end, -- End of config function + }, - -- lazydev setup (still useful for Neovim Lua development) - { - 'folke/lazydev.nvim', - ft = 'lua', - opts = { - library = { { path = 'luvit-meta/library', words = { 'vim%.uv' } } }, + -- lazydev setup (still useful for Neovim Lua development) + { + 'folke/lazydev.nvim', + ft = 'lua', + opts = { + library = { { path = 'luvit-meta/library', words = { 'vim%.uv' } } }, + }, }, - }, } - From 8cff14c262a43fab5d213fd1850ed96a58ead1e4 Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 20 May 2025 20:41:04 +1200 Subject: [PATCH 301/480] fixed python stuff --- lua/custom/plugins/lsp.lua | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 15b7106f08e..4c1e0e906c6 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -12,7 +12,7 @@ return { -- Dependencies for nvim-lspconfig itself, if any. -- Mason and mason-lspconfig are removed as Nix handles LSP installation. { 'j-hui/fidget.nvim', opts = {} }, -- Useful status updates for LSP - 'hrsh7th/cmp-nvim-lsp', -- LSP completion source for nvim-cmp + 'hrsh7th/cmp-nvim-lsp', -- LSP completion source for nvim-cmp }, config = function(_, opts) -- This config function runs AFTER the plugin and its dependencies are loaded. @@ -28,7 +28,7 @@ return { "clangd", "pyright", "nixd", - "ruff_lsp", + "ruff", -- Add other servers like "bashls", "yamlls", "gopls", "rust_analyzer" etc. -- Ensure the corresponding packages (e.g., pkgs.bash-language-server) -- are in your Home Manager home.packages list. @@ -82,10 +82,13 @@ return { vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.clear_references }) vim.api.nvim_create_autocmd('LspDetach', - { group = vim.api.nvim_create_augroup('kickstart-lsp-detach-override', { clear = true }), callback = function( - event2) - vim.lsp.buf.clear_references(); vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight-override', buffer = event2.buf } - end }) + { + group = vim.api.nvim_create_augroup('kickstart-lsp-detach-override', { clear = true }), + callback = function( + event2) + vim.lsp.buf.clear_references(); vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight-override', buffer = event2.buf } + end + }) end -- Inlay hints toggle @@ -110,9 +113,13 @@ return { virtual_text = { source = 'if_many', spacing = 2, format = function(diagnostic) - local diagnostic_message = { [vim.diagnostic.severity.ERROR] = diagnostic.message, - [vim.diagnostic.severity.WARN] = diagnostic.message, [vim.diagnostic.severity.INFO] = - diagnostic.message, [vim.diagnostic.severity.HINT] = diagnostic.message } + local diagnostic_message = { + [vim.diagnostic.severity.ERROR] = diagnostic.message, + [vim.diagnostic.severity.WARN] = diagnostic.message, + [vim.diagnostic.severity.INFO] = + diagnostic.message, + [vim.diagnostic.severity.HINT] = diagnostic.message + } return diagnostic_message[diagnostic.severity] end, }, From 32471236f840f961b12b9d7b6bc0364c2b934d51 Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 20 May 2025 20:42:31 +1200 Subject: [PATCH 302/480] just formatting --- init.lua | 4 +- lua/custom/plugins/formatting.lua | 70 ++++----- lua/custom/plugins/lsp.lua | 249 +++++++++++++++--------------- 3 files changed, 164 insertions(+), 159 deletions(-) diff --git a/init.lua b/init.lua index 9af8960ddf5..c0a27d1e690 100644 --- a/init.lua +++ b/init.lua @@ -301,7 +301,7 @@ require('lazy').setup({ -- Then, because we use the `opts` key (recommended), the configuration runs -- after the plugin has been loaded as `require(MODULE).setup(opts)`. - { -- Useful plugin to show you pending keybinds. + { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' opts = { @@ -382,7 +382,7 @@ require('lazy').setup({ { 'nvim-telescope/telescope-ui-select.nvim' }, -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that diff --git a/lua/custom/plugins/formatting.lua b/lua/custom/plugins/formatting.lua index 047980de013..af803017b7e 100644 --- a/lua/custom/plugins/formatting.lua +++ b/lua/custom/plugins/formatting.lua @@ -1,40 +1,40 @@ -- Formatter configuration return { - -- ======================================== - -- Formatter Configuration (conform.nvim) - -- ======================================== - { - 'stevearc/conform.nvim', - event = 'BufWritePre', -- Format on save - -- cmd = { 'ConformInfo' }, -- Optional: If you want the command available - -- keys = { ... } -- Optional: Define keys if needed - opts = { - formatters_by_ft = { - lua = { 'stylua' }, - c = { 'clang_format' }, - cpp = { 'clang_format' }, - -- Use ruff for Python formatting (includes isort and is faster than black - -- Ensure 'ruff' is installed via Home Manager (pkgs.ruff) - python = { 'ruff_format', 'ruff_fix' }, - -- python = { 'isort', 'black' }, - nix = { 'alejandra' }, -- Add nix formatter - -- Add other filetypes and formatters, e.g.: - -- javascript = { "prettier" }, - -- typescript = { "prettier" }, - -- css = { "prettier" }, - -- html = { "prettier" }, - -- json = { "prettier" }, - -- yaml = { "prettier" }, - -- markdown = { "prettier" }, - -- bash = { "shfmt" }, - }, - -- Configure format_on_save behavior - format_on_save = { - -- I recommend these options, but adjust to your liking - timeout_ms = 500, -- Stop formatting if it takes too long - lsp_fallback = true, -- Fallback to LSP formatting if conform fails - }, - }, + -- ======================================== + -- Formatter Configuration (conform.nvim) + -- ======================================== + { + 'stevearc/conform.nvim', + event = 'BufWritePre', -- Format on save + -- cmd = { 'ConformInfo' }, -- Optional: If you want the command available + -- keys = { ... } -- Optional: Define keys if needed + opts = { + formatters_by_ft = { + lua = { 'stylua' }, + c = { 'clang_format' }, + cpp = { 'clang_format' }, + -- Use ruff for Python formatting (includes isort and is faster than black + -- Ensure 'ruff' is installed via Home Manager (pkgs.ruff) + python = { 'ruff_format', 'ruff_fix' }, + -- python = { 'isort', 'black' }, + nix = { 'alejandra' }, -- Add nix formatter + -- Add other filetypes and formatters, e.g.: + -- javascript = { "prettier" }, + -- typescript = { "prettier" }, + -- css = { "prettier" }, + -- html = { "prettier" }, + -- json = { "prettier" }, + -- yaml = { "prettier" }, + -- markdown = { "prettier" }, + -- bash = { "shfmt" }, + }, + -- Configure format_on_save behavior + format_on_save = { + -- I recommend these options, but adjust to your liking + timeout_ms = 500, -- Stop formatting if it takes too long + lsp_fallback = true, -- Fallback to LSP formatting if conform fails + }, }, + }, } diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 4c1e0e906c6..3e5c02f2a4b 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -2,137 +2,142 @@ -- LSP configuration, assuming LSP servers are installed via Nix/Home Manager return { - -- ======================================== - -- LSP Configuration (LSP servers provided by Nix/Home Manager) - -- ======================================== - { - 'neovim/nvim-lspconfig', - event = { "BufReadPre", "BufNewFile" }, -- Load LSP config early - dependencies = { - -- Dependencies for nvim-lspconfig itself, if any. - -- Mason and mason-lspconfig are removed as Nix handles LSP installation. - { 'j-hui/fidget.nvim', opts = {} }, -- Useful status updates for LSP - 'hrsh7th/cmp-nvim-lsp', -- LSP completion source for nvim-cmp - }, - config = function(_, opts) - -- This config function runs AFTER the plugin and its dependencies are loaded. - -- It sets up the LSP servers. + -- ======================================== + -- LSP Configuration (LSP servers provided by Nix/Home Manager) + -- ======================================== + { + 'neovim/nvim-lspconfig', + event = { 'BufReadPre', 'BufNewFile' }, -- Load LSP config early + dependencies = { + -- Dependencies for nvim-lspconfig itself, if any. + -- Mason and mason-lspconfig are removed as Nix handles LSP installation. + { 'j-hui/fidget.nvim', opts = {} }, -- Useful status updates for LSP + 'hrsh7th/cmp-nvim-lsp', -- LSP completion source for nvim-cmp + }, + config = function(_, opts) + -- This config function runs AFTER the plugin and its dependencies are loaded. + -- It sets up the LSP servers. - -- Get LSP capabilities, augmented by nvim-cmp - local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) + -- Get LSP capabilities, augmented by nvim-cmp + local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) - -- Define the list of LSP servers you want to configure. - -- These servers must be installed via Nix/Home Manager and be in your PATH. - local servers_to_setup = { - "lua_ls", - "clangd", - "pyright", - "nixd", - "ruff", - -- Add other servers like "bashls", "yamlls", "gopls", "rust_analyzer" etc. - -- Ensure the corresponding packages (e.g., pkgs.bash-language-server) - -- are in your Home Manager home.packages list. - } - - -- Iterate through the defined servers list and set them up with lspconfig - for _, server_name in ipairs(servers_to_setup) do - -- print('Attempting to set up LSP server: ' .. server_name) -- Debug print - require('lspconfig')[server_name].setup { - capabilities = capabilities, -- Pass augmented capabilities - -- Add any server-specific overrides here if needed, e.g.: - -- For lua_ls: - -- settings = { Lua = { diagnostics = { globals = {'vim'} } } }, - } - end + -- Define the list of LSP servers you want to configure. + -- These servers must be installed via Nix/Home Manager and be in your PATH. + local servers_to_setup = { + 'lua_ls', + 'clangd', + 'pyright', + 'nixd', + 'ruff', + -- Add other servers like "bashls", "yamlls", "gopls", "rust_analyzer" etc. + -- Ensure the corresponding packages (e.g., pkgs.bash-language-server) + -- are in your Home Manager home.packages list. + } - -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach-override', { clear = true }), - callback = function(event) - local map = function(keys, func, desc, mode) - mode = mode or 'n' - vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) - end + -- Iterate through the defined servers list and set them up with lspconfig + for _, server_name in ipairs(servers_to_setup) do + -- print('Attempting to set up LSP server: ' .. server_name) -- Debug print + require('lspconfig')[server_name].setup { + capabilities = capabilities, -- Pass augmented capabilities + -- Add any server-specific overrides here if needed, e.g.: + -- For lua_ls: + -- settings = { Lua = { diagnostics = { globals = {'vim'} } } }, + } + end - -- Standard LSP keymaps - map('grn', vim.lsp.buf.rename, '[R]e[n]ame') - map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) - map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') - map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') - map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') + -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach-override', { clear = true }), + callback = function(event) + local map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end - -- Highlight references - local client = vim.lsp.get_client_by_id(event.data.client_id) - local function client_supports_method(client, method, bufnr) - if vim.fn.has 'nvim-0.11' == 1 then - return client:supports_method(method, { bufnr = bufnr }) - else - return client.supports_method(method, { bufnr = bufnr }) - end - end - if client and client_supports_method(client, 'textDocument/documentHighlight', event.buf) then - local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override', - { clear = false }) - vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, - { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight }) - vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, - { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.clear_references }) - vim.api.nvim_create_autocmd('LspDetach', - { - group = vim.api.nvim_create_augroup('kickstart-lsp-detach-override', { clear = true }), - callback = function( - event2) - vim.lsp.buf.clear_references(); vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight-override', buffer = event2.buf } - end - }) - end + -- Standard LSP keymaps + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') + map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) + map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') + map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') + map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') - -- Inlay hints toggle - if client and client_supports_method(client, 'textDocument/inlayHint', event.buf) then - map('th', - function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, - '[T]oggle Inlay [H]ints') - end - end, + -- Highlight references + local client = vim.lsp.get_client_by_id(event.data.client_id) + local function client_supports_method(client, method, bufnr) + if vim.fn.has 'nvim-0.11' == 1 then + return client:supports_method(method, { bufnr = bufnr }) + else + return client.supports_method(method, { bufnr = bufnr }) + end + end + if client and client_supports_method(client, 'textDocument/documentHighlight', event.buf) then + local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override', { clear = false }) + vim.api.nvim_create_autocmd( + { 'CursorHold', 'CursorHoldI' }, + { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight } + ) + vim.api.nvim_create_autocmd( + { 'CursorMoved', 'CursorMovedI' }, + { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.clear_references } + ) + vim.api.nvim_create_autocmd('LspDetach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-detach-override', { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight-override', buffer = event2.buf } + end, }) + end - -- Diagnostic configuration - vim.diagnostic.config { - severity_sort = true, - float = { border = 'rounded', source = 'if_many' }, - underline = { severity = vim.diagnostic.severity.ERROR }, - signs = vim.g.have_nerd_font and { - text = { - [vim.diagnostic.severity.ERROR] = '󰅚 ', [vim.diagnostic.severity.WARN] = '󰀪 ', [vim.diagnostic.severity.INFO] = '󰋽 ', [vim.diagnostic.severity.HINT] = '󰌶 ', - }, - } or {}, - virtual_text = { - source = 'if_many', spacing = 2, - format = function(diagnostic) - local diagnostic_message = { - [vim.diagnostic.severity.ERROR] = diagnostic.message, - [vim.diagnostic.severity.WARN] = diagnostic.message, - [vim.diagnostic.severity.INFO] = - diagnostic.message, - [vim.diagnostic.severity.HINT] = diagnostic.message - } - return diagnostic_message[diagnostic.severity] - end, - }, - } - end, -- End of config function - }, + -- Inlay hints toggle + if client and client_supports_method(client, 'textDocument/inlayHint', event.buf) then + map('th', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) + end, '[T]oggle Inlay [H]ints') + end + end, + }) - -- lazydev setup (still useful for Neovim Lua development) - { - 'folke/lazydev.nvim', - ft = 'lua', - opts = { - library = { { path = 'luvit-meta/library', words = { 'vim%.uv' } } }, + -- Diagnostic configuration + vim.diagnostic.config { + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = vim.g.have_nerd_font and { + text = { + [vim.diagnostic.severity.ERROR] = '󰅚 ', + [vim.diagnostic.severity.WARN] = '󰀪 ', + [vim.diagnostic.severity.INFO] = '󰋽 ', + [vim.diagnostic.severity.HINT] = '󰌶 ', + }, + } or {}, + virtual_text = { + source = 'if_many', + spacing = 2, + format = function(diagnostic) + local diagnostic_message = { + [vim.diagnostic.severity.ERROR] = diagnostic.message, + [vim.diagnostic.severity.WARN] = diagnostic.message, + [vim.diagnostic.severity.INFO] = diagnostic.message, + [vim.diagnostic.severity.HINT] = diagnostic.message, + } + return diagnostic_message[diagnostic.severity] + end, }, + } + end, -- End of config function + }, + + -- lazydev setup (still useful for Neovim Lua development) + { + 'folke/lazydev.nvim', + ft = 'lua', + opts = { + library = { { path = 'luvit-meta/library', words = { 'vim%.uv' } } }, }, + }, } From 270d57b15f74d27984ccdd86881643b25e7cba10 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 00:09:45 +1200 Subject: [PATCH 303/480] fixing weird bug --- lua/custom/plugins/lsp.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 3e5c02f2a4b..fe4590f1723 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -17,6 +17,11 @@ return { config = function(_, opts) -- This config function runs AFTER the plugin and its dependencies are loaded. -- It sets up the LSP servers. + local nix_paths_status, nix_paths = pcall(require, 'custom.nix_paths') + if not nix_paths_status then + print('Error loading custom.nix_paths: ' .. (nix_paths or 'Unknown error')) + nix_paths = {} -- Provide an empty table to avoid further errors + end -- Get LSP capabilities, augmented by nvim-cmp local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) From 34097ce9d304f798f4350449070639742cad40b9 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 00:42:42 +1200 Subject: [PATCH 304/480] fixing weird bug pt 2 --- lua/custom/plugins/lsp.lua | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index fe4590f1723..4558274c328 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -41,13 +41,34 @@ return { -- Iterate through the defined servers list and set them up with lspconfig for _, server_name in ipairs(servers_to_setup) do - -- print('Attempting to set up LSP server: ' .. server_name) -- Debug print - require('lspconfig')[server_name].setup { - capabilities = capabilities, -- Pass augmented capabilities - -- Add any server-specific overrides here if needed, e.g.: - -- For lua_ls: - -- settings = { Lua = { diagnostics = { globals = {'vim'} } } }, + local server_opts = { + capabilities = capabilities, } + + if server_name == 'clangd' then + if nix_paths.clangd_query_driver and nix_paths.macos_sdk_path and nix_paths.libcxx_include_path then + server_opts.cmd = { + 'clangd', + '--query-driver=' .. nix_paths.clangd_query_driver, + '-isysroot', + nix_paths.macos_sdk_path, + '-isystem', + nix_paths.libcxx_include_path, + } + else + print 'Warning: Nix paths for clangd not fully defined in custom.nix_paths.lua. Clangd might not work correctly.' + -- Fallback or default cmd if paths are missing + server_opts.cmd = { 'clangd' } + end + end + require('lspconfig')[server_name].setup(server_opts) + -- print('Attempting to set up LSP server: ' .. server_name) -- Debug print + -- require('lspconfig')[server_name].setup { + -- capabilities = capabilities, -- Pass augmented capabilities + -- -- Add any server-specific overrides here if needed, e.g.: + -- -- For lua_ls: + -- -- settings = { Lua = { diagnostics = { globals = {'vim'} } } }, + -- } end -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section From c0474f5c1142e4e6c24d416b18900f06cd59f6a2 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 00:47:28 +1200 Subject: [PATCH 305/480] fixing weird bug pt 3 --- lua/custom/plugins/lsp.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 4558274c328..30591728209 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -50,10 +50,10 @@ return { server_opts.cmd = { 'clangd', '--query-driver=' .. nix_paths.clangd_query_driver, - '-isysroot', - nix_paths.macos_sdk_path, - '-isystem', - nix_paths.libcxx_include_path, + -- '-isysroot', + -- nix_paths.macos_sdk_path, + -- '-isystem', + -- nix_paths.libcxx_include_path, } else print 'Warning: Nix paths for clangd not fully defined in custom.nix_paths.lua. Clangd might not work correctly.' From 3d1eeaa62cbc9c5753adb3c46e482346b4aad616 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 01:07:37 +1200 Subject: [PATCH 306/480] Revert "just formatting" This reverts commit 18e5475a9edec2d4c4f3ce994cac4bfd04df0172. --- init.lua | 4 +- lua/custom/plugins/formatting.lua | 70 +++++----- lua/custom/plugins/lsp.lua | 38 +----- lua/kickstart/plugins/debug.lua | 218 +++++++++++++++--------------- 4 files changed, 152 insertions(+), 178 deletions(-) diff --git a/init.lua b/init.lua index c0a27d1e690..9af8960ddf5 100644 --- a/init.lua +++ b/init.lua @@ -301,7 +301,7 @@ require('lazy').setup({ -- Then, because we use the `opts` key (recommended), the configuration runs -- after the plugin has been loaded as `require(MODULE).setup(opts)`. - { -- Useful plugin to show you pending keybinds. + { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' opts = { @@ -382,7 +382,7 @@ require('lazy').setup({ { 'nvim-telescope/telescope-ui-select.nvim' }, -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that diff --git a/lua/custom/plugins/formatting.lua b/lua/custom/plugins/formatting.lua index af803017b7e..047980de013 100644 --- a/lua/custom/plugins/formatting.lua +++ b/lua/custom/plugins/formatting.lua @@ -1,40 +1,40 @@ -- Formatter configuration return { - -- ======================================== - -- Formatter Configuration (conform.nvim) - -- ======================================== - { - 'stevearc/conform.nvim', - event = 'BufWritePre', -- Format on save - -- cmd = { 'ConformInfo' }, -- Optional: If you want the command available - -- keys = { ... } -- Optional: Define keys if needed - opts = { - formatters_by_ft = { - lua = { 'stylua' }, - c = { 'clang_format' }, - cpp = { 'clang_format' }, - -- Use ruff for Python formatting (includes isort and is faster than black - -- Ensure 'ruff' is installed via Home Manager (pkgs.ruff) - python = { 'ruff_format', 'ruff_fix' }, - -- python = { 'isort', 'black' }, - nix = { 'alejandra' }, -- Add nix formatter - -- Add other filetypes and formatters, e.g.: - -- javascript = { "prettier" }, - -- typescript = { "prettier" }, - -- css = { "prettier" }, - -- html = { "prettier" }, - -- json = { "prettier" }, - -- yaml = { "prettier" }, - -- markdown = { "prettier" }, - -- bash = { "shfmt" }, - }, - -- Configure format_on_save behavior - format_on_save = { - -- I recommend these options, but adjust to your liking - timeout_ms = 500, -- Stop formatting if it takes too long - lsp_fallback = true, -- Fallback to LSP formatting if conform fails - }, + -- ======================================== + -- Formatter Configuration (conform.nvim) + -- ======================================== + { + 'stevearc/conform.nvim', + event = 'BufWritePre', -- Format on save + -- cmd = { 'ConformInfo' }, -- Optional: If you want the command available + -- keys = { ... } -- Optional: Define keys if needed + opts = { + formatters_by_ft = { + lua = { 'stylua' }, + c = { 'clang_format' }, + cpp = { 'clang_format' }, + -- Use ruff for Python formatting (includes isort and is faster than black + -- Ensure 'ruff' is installed via Home Manager (pkgs.ruff) + python = { 'ruff_format', 'ruff_fix' }, + -- python = { 'isort', 'black' }, + nix = { 'alejandra' }, -- Add nix formatter + -- Add other filetypes and formatters, e.g.: + -- javascript = { "prettier" }, + -- typescript = { "prettier" }, + -- css = { "prettier" }, + -- html = { "prettier" }, + -- json = { "prettier" }, + -- yaml = { "prettier" }, + -- markdown = { "prettier" }, + -- bash = { "shfmt" }, + }, + -- Configure format_on_save behavior + format_on_save = { + -- I recommend these options, but adjust to your liking + timeout_ms = 500, -- Stop formatting if it takes too long + lsp_fallback = true, -- Fallback to LSP formatting if conform fails + }, + }, }, - }, } diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 30591728209..3e5c02f2a4b 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -17,11 +17,6 @@ return { config = function(_, opts) -- This config function runs AFTER the plugin and its dependencies are loaded. -- It sets up the LSP servers. - local nix_paths_status, nix_paths = pcall(require, 'custom.nix_paths') - if not nix_paths_status then - print('Error loading custom.nix_paths: ' .. (nix_paths or 'Unknown error')) - nix_paths = {} -- Provide an empty table to avoid further errors - end -- Get LSP capabilities, augmented by nvim-cmp local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) @@ -41,34 +36,13 @@ return { -- Iterate through the defined servers list and set them up with lspconfig for _, server_name in ipairs(servers_to_setup) do - local server_opts = { - capabilities = capabilities, - } - - if server_name == 'clangd' then - if nix_paths.clangd_query_driver and nix_paths.macos_sdk_path and nix_paths.libcxx_include_path then - server_opts.cmd = { - 'clangd', - '--query-driver=' .. nix_paths.clangd_query_driver, - -- '-isysroot', - -- nix_paths.macos_sdk_path, - -- '-isystem', - -- nix_paths.libcxx_include_path, - } - else - print 'Warning: Nix paths for clangd not fully defined in custom.nix_paths.lua. Clangd might not work correctly.' - -- Fallback or default cmd if paths are missing - server_opts.cmd = { 'clangd' } - end - end - require('lspconfig')[server_name].setup(server_opts) -- print('Attempting to set up LSP server: ' .. server_name) -- Debug print - -- require('lspconfig')[server_name].setup { - -- capabilities = capabilities, -- Pass augmented capabilities - -- -- Add any server-specific overrides here if needed, e.g.: - -- -- For lua_ls: - -- -- settings = { Lua = { diagnostics = { globals = {'vim'} } } }, - -- } + require('lspconfig')[server_name].setup { + capabilities = capabilities, -- Pass augmented capabilities + -- Add any server-specific overrides here if needed, e.g.: + -- For lua_ls: + -- settings = { Lua = { diagnostics = { globals = {'vim'} } } }, + } end -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 77880880eda..e0cf37896d1 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -7,121 +7,121 @@ -- kickstart.nvim and not kitchen-sink.nvim ;) return { - -- NOTE: Yes, you can install new plugins here! - 'mfussenegger/nvim-dap', - -- NOTE: And you can specify dependencies as well - dependencies = { - -- Creates a beautiful debugger UI - 'rcarriga/nvim-dap-ui', + -- NOTE: Yes, you can install new plugins here! + 'mfussenegger/nvim-dap', + -- NOTE: And you can specify dependencies as well + dependencies = { + -- Creates a beautiful debugger UI + 'rcarriga/nvim-dap-ui', - -- Required dependency for nvim-dap-ui - 'nvim-neotest/nvim-nio', + -- Required dependency for nvim-dap-ui + 'nvim-neotest/nvim-nio', - -- Add your own debuggers here - 'leoluz/nvim-dap-go', - }, - keys = { - -- Basic debugging keymaps, feel free to change to your liking! - { - '', - function() - require('dap').continue() - end, - desc = 'Debug: Start/Continue', + -- Add your own debuggers here + 'leoluz/nvim-dap-go', }, - { - '', - function() - require('dap').step_into() - end, - desc = 'Debug: Step Into', - }, - { - '', - function() - require('dap').step_over() - end, - desc = 'Debug: Step Over', - }, - { - '', - function() - require('dap').step_out() - end, - desc = 'Debug: Step Out', - }, - { - 'b', - function() - require('dap').toggle_breakpoint() - end, - desc = 'Debug: Toggle Breakpoint', - }, - { - 'B', - function() - require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') - end, - desc = 'Debug: Set Breakpoint', - }, - -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. - { - '', - function() - require('dapui').toggle() - end, - desc = 'Debug: See last session result.', + keys = { + -- Basic debugging keymaps, feel free to change to your liking! + { + '', + function() + require('dap').continue() + end, + desc = 'Debug: Start/Continue', + }, + { + '', + function() + require('dap').step_into() + end, + desc = 'Debug: Step Into', + }, + { + '', + function() + require('dap').step_over() + end, + desc = 'Debug: Step Over', + }, + { + '', + function() + require('dap').step_out() + end, + desc = 'Debug: Step Out', + }, + { + 'b', + function() + require('dap').toggle_breakpoint() + end, + desc = 'Debug: Toggle Breakpoint', + }, + { + 'B', + function() + require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') + end, + desc = 'Debug: Set Breakpoint', + }, + -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. + { + '', + function() + require('dapui').toggle() + end, + desc = 'Debug: See last session result.', + }, }, - }, - config = function() - local dap = require 'dap' - local dapui = require 'dapui' + config = function() + local dap = require 'dap' + local dapui = require 'dapui' - -- Dap UI setup - -- For more information, see |:help nvim-dap-ui| - dapui.setup { - -- Set icons to characters that are more likely to work in every terminal. - -- Feel free to remove or use ones that you like more! :) - -- Don't feel like these are good choices. - icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, - controls = { - icons = { - pause = '⏸', - play = '▶', - step_into = '⏎', - step_over = '⏭', - step_out = '⏮', - step_back = 'b', - run_last = '▶▶', - terminate = '⏹', - disconnect = '⏏', - }, - }, - } + -- Dap UI setup + -- For more information, see |:help nvim-dap-ui| + dapui.setup { + -- Set icons to characters that are more likely to work in every terminal. + -- Feel free to remove or use ones that you like more! :) + -- Don't feel like these are good choices. + icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, + controls = { + icons = { + pause = '⏸', + play = '▶', + step_into = '⏎', + step_over = '⏭', + step_out = '⏮', + step_back = 'b', + run_last = '▶▶', + terminate = '⏹', + disconnect = '⏏', + }, + }, + } - -- Change breakpoint icons - -- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' }) - -- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' }) - -- local breakpoint_icons = vim.g.have_nerd_font - -- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' } - -- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' } - -- for type, icon in pairs(breakpoint_icons) do - -- local tp = 'Dap' .. type - -- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak' - -- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl }) - -- end + -- Change breakpoint icons + -- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' }) + -- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' }) + -- local breakpoint_icons = vim.g.have_nerd_font + -- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' } + -- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' } + -- for type, icon in pairs(breakpoint_icons) do + -- local tp = 'Dap' .. type + -- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak' + -- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl }) + -- end - dap.listeners.after.event_initialized['dapui_config'] = dapui.open - dap.listeners.before.event_terminated['dapui_config'] = dapui.close - dap.listeners.before.event_exited['dapui_config'] = dapui.close + dap.listeners.after.event_initialized['dapui_config'] = dapui.open + dap.listeners.before.event_terminated['dapui_config'] = dapui.close + dap.listeners.before.event_exited['dapui_config'] = dapui.close - -- Install golang specific config - require('dap-go').setup { - delve = { - -- On Windows delve must be run attached or it crashes. - -- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring - detached = vim.fn.has 'win32' == 0, - }, - } - end, + -- Install golang specific config + require('dap-go').setup { + delve = { + -- On Windows delve must be run attached or it crashes. + -- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring + detached = vim.fn.has 'win32' == 0, + }, + } + end, } From 4fed66be0f5f57dbc70940b38c711bd16e5e3b56 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 04:13:06 +1200 Subject: [PATCH 307/480] adding lsp server options pt 1 --- lua/custom/plugins/lsp.lua | 68 ++++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 13 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 3e5c02f2a4b..11d3ba3e371 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -18,31 +18,73 @@ return { -- This config function runs AFTER the plugin and its dependencies are loaded. -- It sets up the LSP servers. + -- Load Nix-provided paths from the generated Lua file + local nix_paths_status, nix_paths = pcall(require, 'custom.nix_paths') + if not nix_paths_status then + vim.notify('Error loading custom.nix_paths: ' .. (nix_paths or 'Unknown error'), vim.log.levels.ERROR) + nix_paths = {} -- Provide an empty table to avoid further errors + end + -- Get LSP capabilities, augmented by nvim-cmp local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) -- Define the list of LSP servers you want to configure. -- These servers must be installed via Nix/Home Manager and be in your PATH. - local servers_to_setup = { - 'lua_ls', - 'clangd', - 'pyright', - 'nixd', - 'ruff', + local servers = { + lua_ls = { + -- cmd = { ... } + -- filetypes = { ... } + -- capabilities = {} + settings = { + Lua = { + completion = { + callSnippet = 'Replace', + }, + diagnostics = { disable = { 'missing-fields' } }, + }, + }, + }, + clangd = { + cmd = (function() + if nix_paths.clang_driver_path then + return { + 'clangd', + '--query-driver=' .. nix_paths.clang_driver_path, + } + else + vim.notify('Warning: Nix path for clang_driver_path not defined. clangd might not work correctly.', vim.log.levels.WARN) + return { 'clangd' } -- Fallback + end + end)(), + }, + pyright = { + settings = { + python = { + analysis = { + autoSearchPaths = true, + diagnosticMode = 'openFilesOnly', + useLibraryCodeForTypes = true, + typeCheckingMode = 'basic', + }, + }, + positionEncoding = 'utf-8', + }, + }, + nixd = {}, + ruff = {}, -- Add other servers like "bashls", "yamlls", "gopls", "rust_analyzer" etc. -- Ensure the corresponding packages (e.g., pkgs.bash-language-server) -- are in your Home Manager home.packages list. } -- Iterate through the defined servers list and set them up with lspconfig - for _, server_name in ipairs(servers_to_setup) do - -- print('Attempting to set up LSP server: ' .. server_name) -- Debug print - require('lspconfig')[server_name].setup { - capabilities = capabilities, -- Pass augmented capabilities - -- Add any server-specific overrides here if needed, e.g.: - -- For lua_ls: - -- settings = { Lua = { diagnostics = { globals = {'vim'} } } }, + for server_name, server_config_override in ipairs(servers) do + local server_ops = { + capabilities = capabilities, } + server_ops = vim.tbl_deep_extend('force', server_ops, server_config_override or {}) + -- print('Attempting to set up LSP server: ' .. server_name) -- Debug print + require('lspconfig')[server_name].setup(server_ops) end -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section From a9e4683338d2ccfbcfdb2df60c62c32d44f85269 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 04:35:55 +1200 Subject: [PATCH 308/480] adding lsp server options pt 2 --- lua/custom/plugins/lsp.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 11d3ba3e371..cd764bf515b 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -25,6 +25,8 @@ return { nix_paths = {} -- Provide an empty table to avoid further errors end + print('DEBUG: nix_paths content: ' .. vim.inspect(nix_paths)) + -- Get LSP capabilities, augmented by nvim-cmp local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) From 57fcdd272fe41f8d800de112a537e2adf2c60d57 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 05:05:02 +1200 Subject: [PATCH 309/480] adding lsp server options pt 3 --- lua/custom/plugins/lsp.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index cd764bf515b..497285dc7d5 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -19,6 +19,7 @@ return { -- It sets up the LSP servers. -- Load Nix-provided paths from the generated Lua file + package.loaded['custom.nix_paths'] = nil local nix_paths_status, nix_paths = pcall(require, 'custom.nix_paths') if not nix_paths_status then vim.notify('Error loading custom.nix_paths: ' .. (nix_paths or 'Unknown error'), vim.log.levels.ERROR) From 7a85b4da6d63871b08c2d3e8e231bcbda1c51206 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 05:45:53 +1200 Subject: [PATCH 310/480] adding lsp server options pt 4 --- lua/custom/plugins/lsp.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 497285dc7d5..5c56587a54d 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -81,13 +81,21 @@ return { } -- Iterate through the defined servers list and set them up with lspconfig + print 'LSPConfig: Iterating servers...' for server_name, server_config_override in ipairs(servers) do + print('Attempting to set up LSP server: ' .. server_name) -- Debug print local server_ops = { capabilities = capabilities, } server_ops = vim.tbl_deep_extend('force', server_ops, server_config_override or {}) - -- print('Attempting to set up LSP server: ' .. server_name) -- Debug print - require('lspconfig')[server_name].setup(server_ops) + local setup_ok, setup_err = pcall(require('lspconfig')[server_name].setup, server_ops) + if not setup_ok then + vim.notify("Error setting up LSP server '" .. server_name .. "': " .. tostring(setup_err), vim.log.levels.ERROR) + print('LSPConfig ERROR for ' .. server_name .. ': ' .. tostring(setup_err)) -- DEBUG + else + print('LSPConfig: Successfully called setup for: ' .. server_name) -- DEBUG + end + -- require('lspconfig')[server_name].setup(server_ops) end -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section From d5d9193e6b167950b77c4fab31dcd86b4715ff02 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 05:50:28 +1200 Subject: [PATCH 311/480] adding lsp server options pt 5 --- lua/custom/plugins/lsp.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 5c56587a54d..1a5647c7b61 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -79,6 +79,7 @@ return { -- Ensure the corresponding packages (e.g., pkgs.bash-language-server) -- are in your Home Manager home.packages list. } + print('DEBUG: servers table content: ' .. vim.inspect(servers)) -- Iterate through the defined servers list and set them up with lspconfig print 'LSPConfig: Iterating servers...' @@ -97,6 +98,7 @@ return { end -- require('lspconfig')[server_name].setup(server_ops) end + print 'LSPConfig: Finished iterating servers.' -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section vim.api.nvim_create_autocmd('LspAttach', { From ca6cc310e91a2ee7b57e8192edcc774f57914689 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 06:01:33 +1200 Subject: [PATCH 312/480] adding lsp server options pt 6 --- lua/custom/plugins/lsp.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 1a5647c7b61..0a36dc6acd3 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -81,6 +81,14 @@ return { } print('DEBUG: servers table content: ' .. vim.inspect(servers)) + local first_key, first_value = next(servers) + print('DEBUG: next(servers) returned key: ' .. tostring(first_key) .. ', value: ' .. vim.inspect(first_value)) + if first_key == nil then + print "DEBUG: The 'servers' table is effectively empty for iteration with pairs()." + else + print "DEBUG: The 'servers' table is NOT empty for iteration." + end + -- Iterate through the defined servers list and set them up with lspconfig print 'LSPConfig: Iterating servers...' for server_name, server_config_override in ipairs(servers) do From cca069720d2727a0bbb8b6a0bba42fd08f162403 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 06:09:08 +1200 Subject: [PATCH 313/480] adding lsp server options pt 7 --- lua/custom/plugins/lsp.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 0a36dc6acd3..5adb541c1ef 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -81,13 +81,14 @@ return { } print('DEBUG: servers table content: ' .. vim.inspect(servers)) - local first_key, first_value = next(servers) - print('DEBUG: next(servers) returned key: ' .. tostring(first_key) .. ', value: ' .. vim.inspect(first_value)) - if first_key == nil then - print "DEBUG: The 'servers' table is effectively empty for iteration with pairs()." - else - print "DEBUG: The 'servers' table is NOT empty for iteration." - end + local _ = next(servers) + print 'DEBUG: Called next(servers) once.' + -- print('DEBUG: next(servers) returned key: ' .. tostring(first_key) .. ', value: ' .. vim.inspect(first_value)) + -- if first_key == nil then + -- print "DEBUG: The 'servers' table is effectively empty for iteration with pairs()." + -- else + -- print "DEBUG: The 'servers' table is NOT empty for iteration." + -- end -- Iterate through the defined servers list and set them up with lspconfig print 'LSPConfig: Iterating servers...' From b9264d8424061614f9b6d4f8f4b1efcd6a1116cb Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 06:13:04 +1200 Subject: [PATCH 314/480] adding lsp server options pt 8 --- lua/custom/plugins/lsp.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 5adb541c1ef..abb8054ca76 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -81,8 +81,6 @@ return { } print('DEBUG: servers table content: ' .. vim.inspect(servers)) - local _ = next(servers) - print 'DEBUG: Called next(servers) once.' -- print('DEBUG: next(servers) returned key: ' .. tostring(first_key) .. ', value: ' .. vim.inspect(first_value)) -- if first_key == nil then -- print "DEBUG: The 'servers' table is effectively empty for iteration with pairs()." @@ -92,7 +90,7 @@ return { -- Iterate through the defined servers list and set them up with lspconfig print 'LSPConfig: Iterating servers...' - for server_name, server_config_override in ipairs(servers) do + for server_name, server_config_override in pairs(servers) do print('Attempting to set up LSP server: ' .. server_name) -- Debug print local server_ops = { capabilities = capabilities, From 7ae4827388cca9eff5648df19aab9e53aab0fe7d Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 06:22:01 +1200 Subject: [PATCH 315/480] adding lsp server options pt 9 --- lua/custom/plugins/lsp.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index abb8054ca76..85667a412f8 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -49,16 +49,27 @@ return { }, clangd = { cmd = (function() - if nix_paths.clang_driver_path then + if nix_paths.clang_driver_path and nix_paths.macos_sdk_path and nix_paths.libcxx_include_path then return { 'clangd', '--query-driver=' .. nix_paths.clang_driver_path, + -- Explicitly pass system root and C++ standard library include path as clangd arguments. + -- These are compiler flags that clangd can use to understand the environment. + '--compile-commands-dir=' + .. vim.fn.getcwd() + .. '/build', -- Assuming compile_commands.json is in /build + '-extra-arg=-isysroot=' .. nix_paths.macos_sdk_path, + '-extra-arg=-isystem=' .. nix_paths.libcxx_include_path, + -- You could also try adding the resource-dir from compile_commands.json if needed: + -- "-extra-arg=-resource-dir=/nix/store/YOUR_CLANG_RESOURCE_DIR_HASH/lib/clang/VERSION" } else - vim.notify('Warning: Nix path for clang_driver_path not defined. clangd might not work correctly.', vim.log.levels.WARN) + vim.notify('Warning: One or more Nix paths for clangd (driver, sdk, libcxx) not defined. Clangd might have issues.', vim.log.levels.WARN) return { 'clangd' } -- Fallback end end)(), + -- Ensure clangd knows the project root to find compile_commands.json and .clangd + root_dir = require('lspconfig.util').root_pattern('compile_commands.json', '.git', '.clangd'), }, pyright = { settings = { From 75f313b260c1eceaf4e0d128105533f336b2afa8 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 06:29:09 +1200 Subject: [PATCH 316/480] adding lsp server options pt 10 --- lua/custom/plugins/lsp.lua | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 85667a412f8..4bfc47febf8 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -49,27 +49,25 @@ return { }, clangd = { cmd = (function() - if nix_paths.clang_driver_path and nix_paths.macos_sdk_path and nix_paths.libcxx_include_path then + if nix_paths.clang_driver_path then return { 'clangd', '--query-driver=' .. nix_paths.clang_driver_path, - -- Explicitly pass system root and C++ standard library include path as clangd arguments. - -- These are compiler flags that clangd can use to understand the environment. + -- No other compiler flags like -isysroot or -isystem should be passed directly here. + -- Clangd gets those from compile_commands.json or by querying the driver. '--compile-commands-dir=' .. vim.fn.getcwd() - .. '/build', -- Assuming compile_commands.json is in /build - '-extra-arg=-isysroot=' .. nix_paths.macos_sdk_path, - '-extra-arg=-isystem=' .. nix_paths.libcxx_include_path, - -- You could also try adding the resource-dir from compile_commands.json if needed: - -- "-extra-arg=-resource-dir=/nix/store/YOUR_CLANG_RESOURCE_DIR_HASH/lib/clang/VERSION" + .. '/build', -- Ensure clangd finds compile_commands.json } else - vim.notify('Warning: One or more Nix paths for clangd (driver, sdk, libcxx) not defined. Clangd might have issues.', vim.log.levels.WARN) + vim.notify( + 'Warning: Nix path for clang_driver_path not defined in custom.nix_paths.lua. Clangd might use system clangd or have issues.', + vim.log.levels.WARN + ) return { 'clangd' } -- Fallback end end)(), - -- Ensure clangd knows the project root to find compile_commands.json and .clangd - root_dir = require('lspconfig.util').root_pattern('compile_commands.json', '.git', '.clangd'), + root_dir = require('lspconfig.util').root_pattern('compile_commands.json', '.git'), -- Helps find project root }, pyright = { settings = { From 2c4fdd67094f2af7e5215db298704e4f5e8a833f Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 09:41:37 +1200 Subject: [PATCH 317/480] removing print debug --- lua/custom/plugins/lsp.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 4bfc47febf8..1dd1bca5bbb 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -26,7 +26,7 @@ return { nix_paths = {} -- Provide an empty table to avoid further errors end - print('DEBUG: nix_paths content: ' .. vim.inspect(nix_paths)) + -- print('DEBUG: nix_paths content: ' .. vim.inspect(nix_paths)) -- Get LSP capabilities, augmented by nvim-cmp local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) @@ -88,7 +88,7 @@ return { -- Ensure the corresponding packages (e.g., pkgs.bash-language-server) -- are in your Home Manager home.packages list. } - print('DEBUG: servers table content: ' .. vim.inspect(servers)) + -- print('DEBUG: servers table content: ' .. vim.inspect(servers)) -- print('DEBUG: next(servers) returned key: ' .. tostring(first_key) .. ', value: ' .. vim.inspect(first_value)) -- if first_key == nil then @@ -98,9 +98,9 @@ return { -- end -- Iterate through the defined servers list and set them up with lspconfig - print 'LSPConfig: Iterating servers...' + -- print 'LSPConfig: Iterating servers...' for server_name, server_config_override in pairs(servers) do - print('Attempting to set up LSP server: ' .. server_name) -- Debug print + -- print('Attempting to set up LSP server: ' .. server_name) -- Debug print local server_ops = { capabilities = capabilities, } @@ -108,13 +108,13 @@ return { local setup_ok, setup_err = pcall(require('lspconfig')[server_name].setup, server_ops) if not setup_ok then vim.notify("Error setting up LSP server '" .. server_name .. "': " .. tostring(setup_err), vim.log.levels.ERROR) - print('LSPConfig ERROR for ' .. server_name .. ': ' .. tostring(setup_err)) -- DEBUG + -- print('LSPConfig ERROR for ' .. server_name .. ': ' .. tostring(setup_err)) -- DEBUG else - print('LSPConfig: Successfully called setup for: ' .. server_name) -- DEBUG + -- print('LSPConfig: Successfully called setup for: ' .. server_name) -- DEBUG end -- require('lspconfig')[server_name].setup(server_ops) end - print 'LSPConfig: Finished iterating servers.' + -- print 'LSPConfig: Finished iterating servers.' -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section vim.api.nvim_create_autocmd('LspAttach', { From a5ece39d806f8533789e860574c094c69e3938b4 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 18:48:27 +1200 Subject: [PATCH 318/480] latex lsp --- lua/custom/plugins/lsp.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 1dd1bca5bbb..9cbe237e2b7 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -84,6 +84,7 @@ return { }, nixd = {}, ruff = {}, + texlab = {}, -- Add other servers like "bashls", "yamlls", "gopls", "rust_analyzer" etc. -- Ensure the corresponding packages (e.g., pkgs.bash-language-server) -- are in your Home Manager home.packages list. From e3507c1e65893b12fda59d6bbafc4ff5f83e6540 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 19:03:46 +1200 Subject: [PATCH 319/480] try simplify clangd lsp --- lua/custom/plugins/lsp.lua | 52 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 9cbe237e2b7..b89b7e0f460 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -19,12 +19,12 @@ return { -- It sets up the LSP servers. -- Load Nix-provided paths from the generated Lua file - package.loaded['custom.nix_paths'] = nil - local nix_paths_status, nix_paths = pcall(require, 'custom.nix_paths') - if not nix_paths_status then - vim.notify('Error loading custom.nix_paths: ' .. (nix_paths or 'Unknown error'), vim.log.levels.ERROR) - nix_paths = {} -- Provide an empty table to avoid further errors - end + -- package.loaded['custom.nix_paths'] = nil + -- local nix_paths_status, nix_paths = pcall(require, 'custom.nix_paths') + -- if not nix_paths_status then + -- vim.notify('Error loading custom.nix_paths: ' .. (nix_paths or 'Unknown error'), vim.log.levels.ERROR) + -- nix_paths = {} -- Provide an empty table to avoid further errors + -- end -- print('DEBUG: nix_paths content: ' .. vim.inspect(nix_paths)) @@ -48,26 +48,26 @@ return { }, }, clangd = { - cmd = (function() - if nix_paths.clang_driver_path then - return { - 'clangd', - '--query-driver=' .. nix_paths.clang_driver_path, - -- No other compiler flags like -isysroot or -isystem should be passed directly here. - -- Clangd gets those from compile_commands.json or by querying the driver. - '--compile-commands-dir=' - .. vim.fn.getcwd() - .. '/build', -- Ensure clangd finds compile_commands.json - } - else - vim.notify( - 'Warning: Nix path for clang_driver_path not defined in custom.nix_paths.lua. Clangd might use system clangd or have issues.', - vim.log.levels.WARN - ) - return { 'clangd' } -- Fallback - end - end)(), - root_dir = require('lspconfig.util').root_pattern('compile_commands.json', '.git'), -- Helps find project root + -- cmd = (function() + -- if nix_paths.clang_driver_path then + -- return { + -- 'clangd', + -- '--query-driver=' .. nix_paths.clang_driver_path, + -- -- No other compiler flags like -isysroot or -isystem should be passed directly here. + -- -- Clangd gets those from compile_commands.json or by querying the driver. + -- '--compile-commands-dir=' + -- .. vim.fn.getcwd() + -- .. '/build', -- Ensure clangd finds compile_commands.json + -- } + -- else + -- vim.notify( + -- 'Warning: Nix path for clang_driver_path not defined in custom.nix_paths.lua. Clangd might use system clangd or have issues.', + -- vim.log.levels.WARN + -- ) + -- return { 'clangd' } -- Fallback + -- end + -- end)(), + root_dir = require('lspconfig.util').root_pattern('compile_commands.json', '.git', '.clangd'), -- Helps find project root }, pyright = { settings = { From 55232515635ab80c614699fd2e6a0b02fad78317 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 21 May 2025 19:24:59 +1200 Subject: [PATCH 320/480] clean up --- lua/custom/plugins/lsp.lua | 43 -------------------------------------- 1 file changed, 43 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index b89b7e0f460..8e01b537654 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -18,16 +18,6 @@ return { -- This config function runs AFTER the plugin and its dependencies are loaded. -- It sets up the LSP servers. - -- Load Nix-provided paths from the generated Lua file - -- package.loaded['custom.nix_paths'] = nil - -- local nix_paths_status, nix_paths = pcall(require, 'custom.nix_paths') - -- if not nix_paths_status then - -- vim.notify('Error loading custom.nix_paths: ' .. (nix_paths or 'Unknown error'), vim.log.levels.ERROR) - -- nix_paths = {} -- Provide an empty table to avoid further errors - -- end - - -- print('DEBUG: nix_paths content: ' .. vim.inspect(nix_paths)) - -- Get LSP capabilities, augmented by nvim-cmp local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) @@ -48,25 +38,6 @@ return { }, }, clangd = { - -- cmd = (function() - -- if nix_paths.clang_driver_path then - -- return { - -- 'clangd', - -- '--query-driver=' .. nix_paths.clang_driver_path, - -- -- No other compiler flags like -isysroot or -isystem should be passed directly here. - -- -- Clangd gets those from compile_commands.json or by querying the driver. - -- '--compile-commands-dir=' - -- .. vim.fn.getcwd() - -- .. '/build', -- Ensure clangd finds compile_commands.json - -- } - -- else - -- vim.notify( - -- 'Warning: Nix path for clang_driver_path not defined in custom.nix_paths.lua. Clangd might use system clangd or have issues.', - -- vim.log.levels.WARN - -- ) - -- return { 'clangd' } -- Fallback - -- end - -- end)(), root_dir = require('lspconfig.util').root_pattern('compile_commands.json', '.git', '.clangd'), -- Helps find project root }, pyright = { @@ -89,19 +60,9 @@ return { -- Ensure the corresponding packages (e.g., pkgs.bash-language-server) -- are in your Home Manager home.packages list. } - -- print('DEBUG: servers table content: ' .. vim.inspect(servers)) - - -- print('DEBUG: next(servers) returned key: ' .. tostring(first_key) .. ', value: ' .. vim.inspect(first_value)) - -- if first_key == nil then - -- print "DEBUG: The 'servers' table is effectively empty for iteration with pairs()." - -- else - -- print "DEBUG: The 'servers' table is NOT empty for iteration." - -- end -- Iterate through the defined servers list and set them up with lspconfig - -- print 'LSPConfig: Iterating servers...' for server_name, server_config_override in pairs(servers) do - -- print('Attempting to set up LSP server: ' .. server_name) -- Debug print local server_ops = { capabilities = capabilities, } @@ -109,13 +70,9 @@ return { local setup_ok, setup_err = pcall(require('lspconfig')[server_name].setup, server_ops) if not setup_ok then vim.notify("Error setting up LSP server '" .. server_name .. "': " .. tostring(setup_err), vim.log.levels.ERROR) - -- print('LSPConfig ERROR for ' .. server_name .. ': ' .. tostring(setup_err)) -- DEBUG else - -- print('LSPConfig: Successfully called setup for: ' .. server_name) -- DEBUG end - -- require('lspconfig')[server_name].setup(server_ops) end - -- print 'LSPConfig: Finished iterating servers.' -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section vim.api.nvim_create_autocmd('LspAttach', { From e9c8f498914c5f377a07cf153953b324aaef8ca1 Mon Sep 17 00:00:00 2001 From: dlond Date: Thu, 22 May 2025 05:29:19 +1200 Subject: [PATCH 321/480] added dap for c/c++ & python --- lua/custom/plugins/debug.lua | 130 +++++++++++++++++++++++++++++++++++ lua/custom/plugins/init.lua | 11 +-- 2 files changed, 136 insertions(+), 5 deletions(-) create mode 100644 lua/custom/plugins/debug.lua diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua new file mode 100644 index 00000000000..50a8b6f8e5c --- /dev/null +++ b/lua/custom/plugins/debug.lua @@ -0,0 +1,130 @@ +-- ~/dlond/nvim/lua/custom/plugins/debug.lua +-- Debug Adapter Protocol (DAP) setup, integrating kickstart's UI preferences + +return { + -- Main DAP plugin + { + 'mfussenegger/nvim-dap', + dependencies = { + -- UI for nvim-dap + { + 'rcarriga/nvim-dap-ui', + dependencies = { 'nvim-neotest/nvim-nio' }, -- nvim-dap-ui often needs nio + config = function() + local dapui = require 'dapui' + dapui.setup { + -- Borrowed icon and control settings from kickstart/plugins/debug.lua + icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, + controls = { + icons = { + pause = '⏸', + play = '▶', + step_into = '⏎', + step_over = '⏭', + step_out = '⏮', + step_back = 'b', -- Kickstart uses 'b', nvim-dap default might be different + run_last = '▶▶', + terminate = '⏹', + disconnect = '⏏', + }, + }, + -- You can customize layouts, floating window behavior, etc. + -- layouts = { ... }, + -- floating = { ... }, + } + + -- Automatically open/close dapui when DAP session starts/stops + local dap = require 'dap' + dap.listeners.after.event_initialized['dapui_config'] = function() + dapui.open() + end + dap.listeners.before.event_terminated['dapui_config'] = function() + dapui.close() + end + dap.listeners.before.event_exited['dapui_config'] = function() + dapui.close() + end + end, + }, + -- Optional: Virtual text for DAP (shows variable values inline) + -- { 'theHamsta/nvim-dap-virtual-text', opts = {} }, + + -- If you need Go debugging, you would add 'leoluz/nvim-dap-go' here + -- and call its setup in the nvim-dap config function. + -- { 'leoluz/nvim-dap-go' }, + }, + config = function() + local dap = require 'dap' + + -- Configure the LLDB DAP adapter for C/C++ + -- Assumes 'lldb-dap' executable is in PATH (from pkgs.llvmPackages_XX.lldb) + dap.adapters.lldb = { + type = 'executable', + command = 'lldb-dap', + name = 'lldb-dap (Nix)', + } + dap.configurations.cpp = { + { + name = 'Launch C/C++ (lldb-dap)', + type = 'lldb', + request = 'launch', + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + args = {}, + -- Ensure your C/C++ project is compiled with debug symbols (e.g., -g flag with clang/gcc) + }, + } + dap.configurations.c = dap.configurations.cpp -- Use same config for C + + -- Python DAP configuration (using debugpy) + -- Ensure python3Packages.debugpy is in your home.packages + dap.adapters.python = { + type = 'executable', + command = 'python', -- Should be the python from your Nix env + args = { '-m', 'debugpy.adapter' }, + } + dap.configurations.python = { + { + type = 'python', + request = 'launch', + name = 'Launch Python file', + program = '${file}', -- Debug the current file + pythonPath = function() + local venv = os.getenv 'VIRTUAL_ENV' + if venv then + return venv .. '/bin/python' + end + -- Fallback to trying to find python3, then python in PATH + -- This could be made more robust by getting python path from Nix if needed + local py3 = vim.fn.executable 'python3' + if py3 ~= 0 and py3 ~= '' then + return py3 + end + return 'python' + end, + }, + } + + -- If you added 'leoluz/nvim-dap-go' as a dependency: + -- require('dap-go').setup() -- Call its setup function + + -- Your preferred DAP keybindings + vim.keymap.set('n', 'db', dap.toggle_breakpoint, { desc = 'DAP: Toggle [B]reakpoint' }) + vim.keymap.set('n', 'dc', dap.continue, { desc = 'DAP: [C]ontinue' }) + vim.keymap.set('n', 'dj', dap.step_into, { desc = 'DAP: Step [I]nto (j)' }) + vim.keymap.set('n', 'dk', dap.step_over, { desc = 'DAP: Step [O]ver (k)' }) + vim.keymap.set('n', 'do', dap.step_out, { desc = 'DAP: Step [O]ut' }) + vim.keymap.set('n', 'dr', dap.repl.open, { desc = 'DAP: Open [R]EPL' }) + vim.keymap.set('n', 'dl', dap.run_last, { desc = 'DAP: Run [L]ast' }) + vim.keymap.set('n', 'du', function() + require('dapui').toggle() + end, { desc = 'DAP: Toggle [U]I' }) + vim.keymap.set('n', 'dt', dap.terminate, { desc = 'DAP: [T]erminate' }) + -- Kickstart's to toggle UI (can be added if you like it) + -- vim.keymap.set('n', '', function() require('dapui').toggle() end, { desc = 'Debug: Toggle UI' }) + end, + }, +} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 6bd0b736914..f2a2987b7c0 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -3,11 +3,12 @@ -- -- See the kickstart.nvim README for more information return { - { import = 'custom.plugins.theme' }, - { import = 'custom.plugins.telescope' }, - { import = 'custom.plugins.lsp' }, - { import = 'custom.plugins.formatting' }, - { import = 'custom.plugins.treesitter' }, { import = 'custom.plugins.completion' }, + { import = 'custom.plugins.debug' }, + { import = 'custom.plugins.formatting' }, + { import = 'custom.plugins.lsp' }, { import = 'custom.plugins.nvim-tmux-navigator' }, + { import = 'custom.plugins.telescope' }, + { import = 'custom.plugins.theme' }, + { import = 'custom.plugins.treesitter' }, } From abed9bdabce79bc19bcd83481f64e63368608178 Mon Sep 17 00:00:00 2001 From: dlond Date: Thu, 22 May 2025 17:55:13 +1200 Subject: [PATCH 322/480] trying to add clangd and cmake lsps --- lua/custom/plugins/lsp.lua | 13 +++++++------ lua/custom/plugins/treesitter.lua | 11 ++++------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 8e01b537654..ec02e830663 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -9,8 +9,6 @@ return { 'neovim/nvim-lspconfig', event = { 'BufReadPre', 'BufNewFile' }, -- Load LSP config early dependencies = { - -- Dependencies for nvim-lspconfig itself, if any. - -- Mason and mason-lspconfig are removed as Nix handles LSP installation. { 'j-hui/fidget.nvim', opts = {} }, -- Useful status updates for LSP 'hrsh7th/cmp-nvim-lsp', -- LSP completion source for nvim-cmp }, @@ -38,7 +36,8 @@ return { }, }, clangd = { - root_dir = require('lspconfig.util').root_pattern('compile_commands.json', '.git', '.clangd'), -- Helps find project root + cmd = { 'clangd', '--compile-commands-dir=build' }, + root_dir = require('lspconfig.util').root_pattern('CMakeLists.tst', '.git'), }, pyright = { settings = { @@ -56,9 +55,11 @@ return { nixd = {}, ruff = {}, texlab = {}, - -- Add other servers like "bashls", "yamlls", "gopls", "rust_analyzer" etc. - -- Ensure the corresponding packages (e.g., pkgs.bash-language-server) - -- are in your Home Manager home.packages list. + cmake = { + cmd = { 'cmake-language-server', '--stdio' }, + filetypes = { 'cmake' }, + root_dir = require('lspconfig.util').root_pattern('CMakeLists.tst', '.git'), + }, } -- Iterate through the defined servers list and set them up with lspconfig diff --git a/lua/custom/plugins/treesitter.lua b/lua/custom/plugins/treesitter.lua index 47f69f23d99..39bfce565a8 100644 --- a/lua/custom/plugins/treesitter.lua +++ b/lua/custom/plugins/treesitter.lua @@ -8,7 +8,6 @@ return { -- main = 'nvim-treesitter.configs', -- Keep if needed from kickstart opts = { -- Use opts to merge/override defaults ensure_installed = { - -- List ALL parsers you want installed based on your previous config 'bash', 'c', 'cmake', @@ -20,16 +19,14 @@ return { 'make', 'markdown', 'markdown_inline', - 'nix', -- Added based on previous diff - 'python', -- Added based on previous diff + 'nix', + 'python', 'query', 'vim', 'vimdoc', - 'yaml', -- Added based on previous diff - -- Add any others you commonly use + 'yaml', }, - -- Autoinstall languages that are not installed - auto_install = true, -- Keep kickstart's default or set as desired + auto_install = true, -- Keep other kickstart defaults like highlight/indent settings unless you want to change them highlight = { From be59c986be0af705157a7169a745bf235d960ee4 Mon Sep 17 00:00:00 2001 From: dlond Date: Thu, 22 May 2025 18:13:57 +1200 Subject: [PATCH 323/480] trying to add clangd and cmake lsps p 2 --- lua/custom/plugins/lsp.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index ec02e830663..bd68b38481e 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -36,8 +36,9 @@ return { }, }, clangd = { - cmd = { 'clangd', '--compile-commands-dir=build' }, - root_dir = require('lspconfig.util').root_pattern('CMakeLists.tst', '.git'), + cmd = { 'clangd' }, + filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, + root_dir = require('lspconfig.util').root_pattern('CMakeLists.txt', '.git'), }, pyright = { settings = { @@ -56,9 +57,9 @@ return { ruff = {}, texlab = {}, cmake = { - cmd = { 'cmake-language-server', '--stdio' }, + cmd = { 'cmake-language-server' }, filetypes = { 'cmake' }, - root_dir = require('lspconfig.util').root_pattern('CMakeLists.tst', '.git'), + root_dir = require('lspconfig.util').root_pattern('CMakeLists.txt', '.git'), }, } From d7711c7cdb109092bd91ef6521ad76e891fb95a5 Mon Sep 17 00:00:00 2001 From: dlond Date: Sun, 25 May 2025 17:02:21 +1200 Subject: [PATCH 324/480] help clangd find compiler and resource-dir --- lua/custom/plugins/lsp.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index bd68b38481e..5ca897e267d 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -13,6 +13,8 @@ return { 'hrsh7th/cmp-nvim-lsp', -- LSP completion source for nvim-cmp }, config = function(_, opts) + -- local query_driver = vim.fn.trim(vim.fn.system 'which clang++') + -- local resource_dir = vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir') -- This config function runs AFTER the plugin and its dependencies are loaded. -- It sets up the LSP servers. @@ -36,7 +38,12 @@ return { }, }, clangd = { - cmd = { 'clangd' }, + cmd = { + 'clangd', + '--compile-commands-dir=build', + '--query-driver=' .. vim.fn.trim(vim.fn.system 'which clang++'), + '--resource-dir' .. vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir'), + }, filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, root_dir = require('lspconfig.util').root_pattern('CMakeLists.txt', '.git'), }, From 769db3c470d95a465f64ad6476dc0e1d83bbb953 Mon Sep 17 00:00:00 2001 From: dlond Date: Sun, 25 May 2025 17:04:57 +1200 Subject: [PATCH 325/480] typo --- lua/custom/plugins/lsp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 5ca897e267d..a5de595c5e2 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -42,7 +42,7 @@ return { 'clangd', '--compile-commands-dir=build', '--query-driver=' .. vim.fn.trim(vim.fn.system 'which clang++'), - '--resource-dir' .. vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir'), + '--resource-dir=' .. vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir'), }, filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, root_dir = require('lspconfig.util').root_pattern('CMakeLists.txt', '.git'), From 1f639e9335c8b277fee6287c843e9a9a787bd196 Mon Sep 17 00:00:00 2001 From: dlond Date: Sun, 25 May 2025 22:05:21 +1200 Subject: [PATCH 326/480] changed build dir tree --- lua/custom/plugins/lsp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index a5de595c5e2..df0a43179cf 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -40,7 +40,7 @@ return { clangd = { cmd = { 'clangd', - '--compile-commands-dir=build', + '--compile-commands-dir=build/debug', '--query-driver=' .. vim.fn.trim(vim.fn.system 'which clang++'), '--resource-dir=' .. vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir'), }, From 75a8067a4caea6b836678732c2b89cd428e1008d Mon Sep 17 00:00:00 2001 From: dlond Date: Sun, 25 May 2025 22:16:50 +1200 Subject: [PATCH 327/480] added path to debugserver --- lua/custom/plugins/debug.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index 50a8b6f8e5c..bfa5a8c9c67 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -62,6 +62,9 @@ return { type = 'executable', command = 'lldb-dap', name = 'lldb-dap (Nix)', + env = { + LLDB_DEBUGSERVER_PATH = '/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/debugserver', + }, } dap.configurations.cpp = { { From 709e2bfc7ba30609dfc99e7da4009227775c3d9a Mon Sep 17 00:00:00 2001 From: dlond Date: Sun, 25 May 2025 22:31:23 +1200 Subject: [PATCH 328/480] added path to debugserver - fixing --- lua/custom/plugins/debug.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index bfa5a8c9c67..fe096e8a83e 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -60,7 +60,7 @@ return { -- Assumes 'lldb-dap' executable is in PATH (from pkgs.llvmPackages_XX.lldb) dap.adapters.lldb = { type = 'executable', - command = 'lldb-dap', + command = '/nix/store/143hsrh16zml9n71xk9ysr81z0s1rvpk-lldb-19.1.7/bin/lldb-dap', name = 'lldb-dap (Nix)', env = { LLDB_DEBUGSERVER_PATH = '/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/debugserver', @@ -72,7 +72,12 @@ return { type = 'lldb', request = 'launch', program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + local debug_bin = vim.fn.getcwd() .. 'build/debug/cpp-hello' + if vim.fn.filereadable(debug_bin) == 1 then + return debug_bin + else + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end end, cwd = '${workspaceFolder}', stopOnEntry = false, From 840532a28cf672e7707eff16c792db31f42d325a Mon Sep 17 00:00:00 2001 From: dlond Date: Sun, 25 May 2025 22:48:56 +1200 Subject: [PATCH 329/480] added path to debugserver - fixing pt 2 --- lua/custom/plugins/debug.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index fe096e8a83e..8114f773acf 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -60,7 +60,7 @@ return { -- Assumes 'lldb-dap' executable is in PATH (from pkgs.llvmPackages_XX.lldb) dap.adapters.lldb = { type = 'executable', - command = '/nix/store/143hsrh16zml9n71xk9ysr81z0s1rvpk-lldb-19.1.7/bin/lldb-dap', + command = 'lldb-dap', name = 'lldb-dap (Nix)', env = { LLDB_DEBUGSERVER_PATH = '/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/debugserver', @@ -72,11 +72,11 @@ return { type = 'lldb', request = 'launch', program = function() - local debug_bin = vim.fn.getcwd() .. 'build/debug/cpp-hello' + local debug_bin = vim.fn.getcwd() .. '/build/debug/cpp-hello' if vim.fn.filereadable(debug_bin) == 1 then return debug_bin else - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + -- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end end, cwd = '${workspaceFolder}', From aaa7a8558d80f69df78b4094da21ffc7282d4706 Mon Sep 17 00:00:00 2001 From: dlond Date: Sun, 25 May 2025 22:54:39 +1200 Subject: [PATCH 330/480] added path to debugserver - fixing pt 3 --- lua/custom/plugins/debug.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index 8114f773acf..7b1262a8145 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -62,9 +62,6 @@ return { type = 'executable', command = 'lldb-dap', name = 'lldb-dap (Nix)', - env = { - LLDB_DEBUGSERVER_PATH = '/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/debugserver', - }, } dap.configurations.cpp = { { From ab6af8750d51bb3026b460e8011ebafc2ae5f4d4 Mon Sep 17 00:00:00 2001 From: dlond Date: Sun, 25 May 2025 23:11:43 +1200 Subject: [PATCH 331/480] adding telescope to pick bin to debug --- lua/custom/plugins/debug.lua | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index 7b1262a8145..0075c4df090 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -69,12 +69,34 @@ return { type = 'lldb', request = 'launch', program = function() - local debug_bin = vim.fn.getcwd() .. '/build/debug/cpp-hello' - if vim.fn.filereadable(debug_bin) == 1 then - return debug_bin - else - -- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + local pickers = require 'telescope.pickers' + local finders = require 'telescope.finders' + local conf = require('telescope.config').values + local entry_maker = function(entry) + return { + value = entry, + display = entry, + ordinal = entry, + } end + + local co = coroutine.running() + pickers + .new({}, { + prompt_title = 'Select binary', + finder = finders.new_oneshot_job { 'fd', '--type=f', '', 'build/debug', 'build/release' }, + sorter = conf.generic_sorter {}, + attach_mappings = function(_, map) + map('i', '', function(bufnr) + local entry = require('telescope.actions.state').get_selected_entry() + require('telescope.actions').close(bufnr) + coroutine.resume(co, entry.value) + end) + return true + end, + }) + :find() + return coroutine.yield() end, cwd = '${workspaceFolder}', stopOnEntry = false, From 6455565e7992c6206bc0b3d1139130fe57394a9f Mon Sep 17 00:00:00 2001 From: dlond Date: Sun, 25 May 2025 23:31:39 +1200 Subject: [PATCH 332/480] refactored binary picker --- lua/custom/plugins/debug.lua | 31 +----------------------- lua/custom/utils.lua | 46 ++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 30 deletions(-) create mode 100644 lua/custom/utils.lua diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index 0075c4df090..e2fdbc0d44d 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -68,36 +68,7 @@ return { name = 'Launch C/C++ (lldb-dap)', type = 'lldb', request = 'launch', - program = function() - local pickers = require 'telescope.pickers' - local finders = require 'telescope.finders' - local conf = require('telescope.config').values - local entry_maker = function(entry) - return { - value = entry, - display = entry, - ordinal = entry, - } - end - - local co = coroutine.running() - pickers - .new({}, { - prompt_title = 'Select binary', - finder = finders.new_oneshot_job { 'fd', '--type=f', '', 'build/debug', 'build/release' }, - sorter = conf.generic_sorter {}, - attach_mappings = function(_, map) - map('i', '', function(bufnr) - local entry = require('telescope.actions.state').get_selected_entry() - require('telescope.actions').close(bufnr) - coroutine.resume(co, entry.value) - end) - return true - end, - }) - :find() - return coroutine.yield() - end, + program = require('custom.utils').pick_executable, cwd = '${workspaceFolder}', stopOnEntry = false, args = {}, diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua new file mode 100644 index 00000000000..1f20621528c --- /dev/null +++ b/lua/custom/utils.lua @@ -0,0 +1,46 @@ +return { + pick_executable = function() + local pickers = require 'telescope.pickers' + local finders = require 'telescope.finders' + local conf = require('telescope.config').values + + local entry_maker = function(entry) + return { + value = entry, + display = entry, + ordinal = entry, + } + end + + local co = coroutine.running() + pickers + .new({}, { + prompt_title = 'Select binary', + finder = finders.new_oneshot_job { + 'fd', + '--type', + 'f', + '--exec-batch', + 'test', + '-x', + '{}', + ';', + 'echo', + '{}', + '', + 'build/', + }, + sorter = conf.generic_sorter {}, + attach_mappings = function(_, map) + map('i', '', function(bufnr) + local entry = require('telescope.actions.state').get_selected_entry() + require('telescope.actions').close(bufnr) + coroutine.resume(co, entry.value) + end) + return true + end, + }) + :find() + return coroutine.yield() + end, +} From 97ee0a6ecaf6269e75072a4f044f28ed4d6f3b5a Mon Sep 17 00:00:00 2001 From: dlond Date: Sun, 25 May 2025 23:44:51 +1200 Subject: [PATCH 333/480] fix refactor --- lua/custom/plugins/debug.lua | 7 +++- lua/custom/utils.lua | 78 ++++++++++++++++++------------------ 2 files changed, 45 insertions(+), 40 deletions(-) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index e2fdbc0d44d..4fc1ac6682a 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -68,7 +68,12 @@ return { name = 'Launch C/C++ (lldb-dap)', type = 'lldb', request = 'launch', - program = require('custom.utils').pick_executable, + program = function() + local utils = require 'custom.utils' + local co = utils.pick_executable '${workspaceFolder}/build' + local ok, result = coroutine.resume(co) + return ok and result or nil + end, cwd = '${workspaceFolder}', stopOnEntry = false, args = {}, diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index 1f20621528c..7d5ab3c866c 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -1,46 +1,46 @@ return { - pick_executable = function() + pick_executable = function(start_dir) + local scan = require 'plenary.scandir' + local Path = require 'plenary.path' + local results = {} + + -- Recursively scan for files + scan.scan_dir(start_dir, { + hidden = true, + depth = 3, + add_dirs = false, + on_insert = function(file) + local file_type = vim.fn.system { 'file', '-b', file } + if file_type:match 'Mach%-O' or file_type:match 'ELF' then + table.insert(results, file) + end + end, + }) + local pickers = require 'telescope.pickers' local finders = require 'telescope.finders' local conf = require('telescope.config').values + local actions = require 'telescope.actions' + local action_state = require 'telescope.actions.state' - local entry_maker = function(entry) - return { - value = entry, - display = entry, - ordinal = entry, - } - end - - local co = coroutine.running() - pickers - .new({}, { - prompt_title = 'Select binary', - finder = finders.new_oneshot_job { - 'fd', - '--type', - 'f', - '--exec-batch', - 'test', - '-x', - '{}', - ';', - 'echo', - '{}', - '', - 'build/', - }, - sorter = conf.generic_sorter {}, - attach_mappings = function(_, map) - map('i', '', function(bufnr) - local entry = require('telescope.actions.state').get_selected_entry() - require('telescope.actions').close(bufnr) - coroutine.resume(co, entry.value) - end) - return true - end, - }) - :find() - return coroutine.yield() + return coroutine.create(function(coro) + pickers + .new({}, { + prompt_title = 'Select Executable', + finder = finders.new_table { + results = results, + }, + sorter = conf.generic_sorter {}, + attach_mappings = function(_, map) + actions.select_default:replace(function(prompt_bufnr) + local selection = action_state.get_selected_entry() + actions.close(prompt_bufnr) + coroutine.resume(coro, selection[1]) + end) + return true + end, + }) + :find() + end) end, } From 6ade3bdbd9db0b7933e0ebbb7ca2c5e1278e3d70 Mon Sep 17 00:00:00 2001 From: dlond Date: Sun, 25 May 2025 23:49:55 +1200 Subject: [PATCH 334/480] fix refactor pt 2 --- lua/custom/plugins/debug.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index 4fc1ac6682a..4e8e5c94b51 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -70,7 +70,8 @@ return { request = 'launch', program = function() local utils = require 'custom.utils' - local co = utils.pick_executable '${workspaceFolder}/build' + local cwd = vim.fn.getcwd() + local co = utils.pick_executable(cwd .. '/build') local ok, result = coroutine.resume(co) return ok and result or nil end, From a7e384d20cdfcee7ccfa5d9f1b6c00c5e0d8e92b Mon Sep 17 00:00:00 2001 From: dlond Date: Sun, 25 May 2025 23:54:26 +1200 Subject: [PATCH 335/480] fix refactor pt 3 --- lua/custom/plugins/debug.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index 4e8e5c94b51..d680ee8c1b7 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -71,7 +71,7 @@ return { program = function() local utils = require 'custom.utils' local cwd = vim.fn.getcwd() - local co = utils.pick_executable(cwd .. '/build') + local co = utils.pick_executable 'build' local ok, result = coroutine.resume(co) return ok and result or nil end, From 3a76cd484c02e0d9e71d998012db6d04ce7a360e Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 00:10:00 +1200 Subject: [PATCH 336/480] fix refactor pt 4 --- lua/custom/plugins/debug.lua | 10 ++--- lua/custom/utils.lua | 79 +++++++++++++++++++----------------- 2 files changed, 46 insertions(+), 43 deletions(-) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index d680ee8c1b7..67b48a85d72 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -55,6 +55,7 @@ return { }, config = function() local dap = require 'dap' + local pick_executable = require('custom.utils').pick_executable -- Configure the LLDB DAP adapter for C/C++ -- Assumes 'lldb-dap' executable is in PATH (from pkgs.llvmPackages_XX.lldb) @@ -69,11 +70,10 @@ return { type = 'lldb', request = 'launch', program = function() - local utils = require 'custom.utils' - local cwd = vim.fn.getcwd() - local co = utils.pick_executable 'build' - local ok, result = coroutine.resume(co) - return ok and result or nil + return coroutine.create(function() + local executable = pick_executable(ivim.fn.getcwd() .. '/build') + coroutine.yield(executable) + end) end, cwd = '${workspaceFolder}', stopOnEntry = false, diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index 7d5ab3c866c..b94a5772a43 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -1,46 +1,49 @@ return { pick_executable = function(start_dir) - local scan = require 'plenary.scandir' - local Path = require 'plenary.path' - local results = {} + local function is_executable(path) + return vim.fn.filereadable(path) == 1 and vim.fn.executable(path) == 1 + end - -- Recursively scan for files - scan.scan_dir(start_dir, { - hidden = true, - depth = 3, - add_dirs = false, - on_insert = function(file) - local file_type = vim.fn.system { 'file', '-b', file } - if file_type:match 'Mach%-O' or file_type:match 'ELF' then - table.insert(results, file) + local function collect_executables(dir) + local files = vim.fn.globpath(dir, '**', true, true) + local binaries = {} + for _, path in ipairs(files) do + if is_executable(path) then + table.insert(binaries, path) end - end, - }) + end + return binaries + end - local pickers = require 'telescope.pickers' - local finders = require 'telescope.finders' - local conf = require('telescope.config').values - local actions = require 'telescope.actions' - local action_state = require 'telescope.actions.state' + local co = coroutine.running() + if not co then + error 'pick_executable must be called from a coroutine' + end - return coroutine.create(function(coro) - pickers - .new({}, { - prompt_title = 'Select Executable', - finder = finders.new_table { - results = results, - }, - sorter = conf.generic_sorter {}, - attach_mappings = function(_, map) - actions.select_default:replace(function(prompt_bufnr) - local selection = action_state.get_selected_entry() - actions.close(prompt_bufnr) - coroutine.resume(coro, selection[1]) - end) - return true - end, - }) - :find() - end) + local executables = collect_executables(start_dir) + if #executables == 0 then + vim.notify('No executables found in ' .. start_dir, vim.log.levels.WARN) + return + end + + require('telescope.pickers') + .new({}, { + prompt_title = 'Select Executable', + finder = require('telescope.finders').new_table { + results = executables, + }, + sorter = require('telescope.config').values.generic_sorter {}, + attach_mappings = function(_, map) + map('i', '', function(prompt_bufnr) + local entry = require('telescope.actions.state').get_selected_entry() + require('telescope.actions').close(prompt_bufnr) + coroutine.resume(co, entry.value) + end) + return true + end, + }) + :find() + + return coroutine.yield() end, } From a030434bf00536967be181606e93b8d6f151e7cd Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 00:11:46 +1200 Subject: [PATCH 337/480] fix refactor pt 5 --- lua/custom/plugins/debug.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index 67b48a85d72..6d26796f3e7 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -71,7 +71,7 @@ return { request = 'launch', program = function() return coroutine.create(function() - local executable = pick_executable(ivim.fn.getcwd() .. '/build') + local executable = pick_executable(vim.fn.getcwd() .. '/build') coroutine.yield(executable) end) end, From f19561b13fd2500ecdce187f999b8af222fd21f9 Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 00:19:21 +1200 Subject: [PATCH 338/480] fix refactor pt 6 --- lua/custom/utils.lua | 88 +++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 42 deletions(-) diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index b94a5772a43..a07d704d7b1 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -1,49 +1,53 @@ -return { - pick_executable = function(start_dir) - local function is_executable(path) - return vim.fn.filereadable(path) == 1 and vim.fn.executable(path) == 1 - end +local function is_executable(path) + -- Use `file` command to identify Mach-O or ELF binaries + local output = vim.fn.system { 'file', '-b', path } + return output:match 'Mach%-O' or output:match 'ELF' +end - local function collect_executables(dir) - local files = vim.fn.globpath(dir, '**', true, true) - local binaries = {} - for _, path in ipairs(files) do - if is_executable(path) then - table.insert(binaries, path) - end - end - return binaries +local function collect_executables(dir) + local files = vim.fn.globpath(dir, '**', true, true) + local binaries = {} + for _, path in ipairs(files) do + if vim.fn.filereadable(path) == 1 and is_executable(path) then + table.insert(binaries, path) end + end + return binaries +end - local co = coroutine.running() - if not co then - error 'pick_executable must be called from a coroutine' - end +local function pick_executable(start_dir) + local co = coroutine.running() + if not co then + error 'pick_executable must be called from a coroutine' + end - local executables = collect_executables(start_dir) - if #executables == 0 then - vim.notify('No executables found in ' .. start_dir, vim.log.levels.WARN) - return - end + local executables = collect_executables(start_dir) + if #executables == 0 then + vim.notify('No executables found in ' .. start_dir, vim.log.levels.WARN) + return + end + + require('telescope.pickers') + .new({}, { + prompt_title = 'Select Executable', + finder = require('telescope.finders').new_table { + results = executables, + }, + sorter = require('telescope.config').values.generic_sorter {}, + attach_mappings = function(_, map) + map('i', '', function(prompt_bufnr) + local entry = require('telescope.actions.state').get_selected_entry() + require('telescope.actions').close(prompt_bufnr) + coroutine.resume(co, entry.value) + end) + return true + end, + }) + :find() - require('telescope.pickers') - .new({}, { - prompt_title = 'Select Executable', - finder = require('telescope.finders').new_table { - results = executables, - }, - sorter = require('telescope.config').values.generic_sorter {}, - attach_mappings = function(_, map) - map('i', '', function(prompt_bufnr) - local entry = require('telescope.actions.state').get_selected_entry() - require('telescope.actions').close(prompt_bufnr) - coroutine.resume(co, entry.value) - end) - return true - end, - }) - :find() + return coroutine.yield() +end - return coroutine.yield() - end, +return { + pick_executable = pick_executable, } From d06e7b8f2de3e37cb16b9bfb7a14d6b13ec38758 Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 00:26:05 +1200 Subject: [PATCH 339/480] filter exes --- lua/custom/utils.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index a07d704d7b1..ca866b781d8 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -8,7 +8,7 @@ local function collect_executables(dir) local files = vim.fn.globpath(dir, '**', true, true) local binaries = {} for _, path in ipairs(files) do - if vim.fn.filereadable(path) == 1 and is_executable(path) then + if vim.fn.filereadable(path) == 1 and is_executable(path) and not path:match 'CMakeFiles' then table.insert(binaries, path) end end From d2da11491d334c4bf52ca4c39350925b9cf32538 Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 00:46:10 +1200 Subject: [PATCH 340/480] exe picker more robust --- lua/custom/plugins/debug.lua | 15 ++++++++------- lua/custom/utils.lua | 15 +++++++++++++-- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index 6d26796f3e7..61066d1df98 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -55,7 +55,6 @@ return { }, config = function() local dap = require 'dap' - local pick_executable = require('custom.utils').pick_executable -- Configure the LLDB DAP adapter for C/C++ -- Assumes 'lldb-dap' executable is in PATH (from pkgs.llvmPackages_XX.lldb) @@ -69,12 +68,14 @@ return { name = 'Launch C/C++ (lldb-dap)', type = 'lldb', request = 'launch', - program = function() - return coroutine.create(function() - local executable = pick_executable(vim.fn.getcwd() .. '/build') - coroutine.yield(executable) - end) - end, + program = coroutine.wrap(function() + local exe = require('custom.utils').pick_executable(vim.fn.getcwd() .. '/build') + if not exe then + vim.notify('Debug session cancelled: executable not selected', vim.log.levels.INFO) + return nil + end + return exe + end), cwd = '${workspaceFolder}', stopOnEntry = false, args = {}, diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index ca866b781d8..68dba294efb 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -27,6 +27,9 @@ local function pick_executable(start_dir) return end + local actions = require 'telescope.actions' + local action_state = require 'telescope.actions.state' + require('telescope.pickers') .new({}, { prompt_title = 'Select Executable', @@ -36,10 +39,18 @@ local function pick_executable(start_dir) sorter = require('telescope.config').values.generic_sorter {}, attach_mappings = function(_, map) map('i', '', function(prompt_bufnr) - local entry = require('telescope.actions.state').get_selected_entry() - require('telescope.actions').close(prompt_bufnr) + local entry = action_state.get_selected_entry() + actions.close(prompt_bufnr) coroutine.resume(co, entry.value) end) + map('i', '', function(prompt_bufnr) + actions.close(prompt_bufnr) + coroutine.resume(co, nil) + end) + map('n', 'q', function(prompt_bufnr) + actions.close(prompt_bufnr) + coroutine.resume(co, nil) + end) return true end, }) From 8a51315db48812a7b0722efd8653d1048f54cb96 Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 01:13:05 +1200 Subject: [PATCH 341/480] broke the tele picker, fix pt 1 --- lua/custom/plugins/debug.lua | 13 +++--- lua/custom/utils.lua | 78 +++++++++++++++++++----------------- 2 files changed, 47 insertions(+), 44 deletions(-) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index 61066d1df98..8a3080de9a8 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -55,6 +55,7 @@ return { }, config = function() local dap = require 'dap' + local utils = require 'custom.utils' -- Configure the LLDB DAP adapter for C/C++ -- Assumes 'lldb-dap' executable is in PATH (from pkgs.llvmPackages_XX.lldb) @@ -63,19 +64,15 @@ return { command = 'lldb-dap', name = 'lldb-dap (Nix)', } + dap.configurations.cpp = { { name = 'Launch C/C++ (lldb-dap)', type = 'lldb', request = 'launch', - program = coroutine.wrap(function() - local exe = require('custom.utils').pick_executable(vim.fn.getcwd() .. '/build') - if not exe then - vim.notify('Debug session cancelled: executable not selected', vim.log.levels.INFO) - return nil - end - return exe - end), + program = function() + return utils.pick_executable_for_dap(vim.fn.getcwd() .. '/build') + end, cwd = '${workspaceFolder}', stopOnEntry = false, args = {}, diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index 68dba294efb..0ae2d96586f 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -1,64 +1,70 @@ -local function is_executable(path) - -- Use `file` command to identify Mach-O or ELF binaries - local output = vim.fn.system { 'file', '-b', path } - return output:match 'Mach%-O' or output:match 'ELF' -end +local async = require 'plenary.async.util' +local pickers = require 'telescope.pickers' +local finders = require 'telescope.finders' +local sorters = require('telescope.config').values +local actions = require 'telescope.actions' +local action_state = require 'telescope.actions.state' +local Path = require 'plenary.path' -local function collect_executables(dir) - local files = vim.fn.globpath(dir, '**', true, true) - local binaries = {} - for _, path in ipairs(files) do - if vim.fn.filereadable(path) == 1 and is_executable(path) and not path:match 'CMakeFiles' then - table.insert(binaries, path) +local function collect_executables(start_dir) + local results = {} + local fd = vim.fn.systemlist { 'fd', '--type', 'x', '--exec', 'file', '{}', start_dir } + for _, line in ipairs(fd) do + local path, typeinfo = line:match '^(.-):%s*(.+)$' + if path and not path:match 'CMakeFiles' and typeinfo and typeinfo:match 'Mach%-O' or typeinfo:match 'ELF' then + table.insert(results, path) end end - return binaries + return results end -local function pick_executable(start_dir) - local co = coroutine.running() - if not co then - error 'pick_executable must be called from a coroutine' - end - +local function pick_executable(start_dir, on_choice) local executables = collect_executables(start_dir) if #executables == 0 then vim.notify('No executables found in ' .. start_dir, vim.log.levels.WARN) + on_choice(nil) return end - local actions = require 'telescope.actions' - local action_state = require 'telescope.actions.state' - - require('telescope.pickers') + pickers .new({}, { prompt_title = 'Select Executable', - finder = require('telescope.finders').new_table { - results = executables, - }, - sorter = require('telescope.config').values.generic_sorter {}, + finder = finders.new_table { results = executables }, + sorter = sorters.generic_sorter {}, attach_mappings = function(_, map) - map('i', '', function(prompt_bufnr) + actions.select_default:replace(function(prompt_bufnr) local entry = action_state.get_selected_entry() actions.close(prompt_bufnr) - coroutine.resume(co, entry.value) + on_result(entry.value) end) - map('i', '', function(prompt_bufnr) - actions.close(prompt_bufnr) - coroutine.resume(co, nil) + map('i', '', function(buf) + actions.close(buf) + on_result(nil) end) - map('n', 'q', function(prompt_bufnr) - actions.close(prompt_bufnr) - coroutine.resume(co, nil) + map('n', 'q', function(buf) + actions.close(buf) + on_result(nil) end) return true end, }) :find() +end - return coroutine.yield() +local function pick_executable_for_dap(start_dir) + return async.void(function() + local co = coroutine.running() + pick_executable(start_dir, function(choice) + coroutine.resume(co, choice) + end) + local result = coroutine.yield() + if not result then + vim.notify('Debug launch cancelled', vim.log.levels.INFO) + end + return result + end)() end return { - pick_executable = pick_executable, + pick_executable_for_dap = pick_executable_for_dap, } From a5b0da62c11dfb923a820fc9c1a77bce136c8ea2 Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 01:29:35 +1200 Subject: [PATCH 342/480] broke the tele picker, fix pt 2 --- lua/custom/plugins/debug.lua | 3 +- lua/custom/utils.lua | 80 +++++++++++++++--------------------- 2 files changed, 35 insertions(+), 48 deletions(-) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index 8a3080de9a8..8b790461586 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -55,7 +55,6 @@ return { }, config = function() local dap = require 'dap' - local utils = require 'custom.utils' -- Configure the LLDB DAP adapter for C/C++ -- Assumes 'lldb-dap' executable is in PATH (from pkgs.llvmPackages_XX.lldb) @@ -71,7 +70,7 @@ return { type = 'lldb', request = 'launch', program = function() - return utils.pick_executable_for_dap(vim.fn.getcwd() .. '/build') + return require('custom.utils').pick_executable(vim.fn.getcwd() .. '/build') end, cwd = '${workspaceFolder}', stopOnEntry = false, diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index 0ae2d96586f..751b9ce810f 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -1,4 +1,4 @@ -local async = require 'plenary.async.util' +local async = require 'plenary.async' local pickers = require 'telescope.pickers' local finders = require 'telescope.finders' local sorters = require('telescope.config').values @@ -18,53 +18,41 @@ local function collect_executables(start_dir) return results end -local function pick_executable(start_dir, on_choice) - local executables = collect_executables(start_dir) - if #executables == 0 then - vim.notify('No executables found in ' .. start_dir, vim.log.levels.WARN) - on_choice(nil) - return - end - - pickers - .new({}, { - prompt_title = 'Select Executable', - finder = finders.new_table { results = executables }, - sorter = sorters.generic_sorter {}, - attach_mappings = function(_, map) - actions.select_default:replace(function(prompt_bufnr) - local entry = action_state.get_selected_entry() - actions.close(prompt_bufnr) - on_result(entry.value) - end) - map('i', '', function(buf) - actions.close(buf) - on_result(nil) - end) - map('n', 'q', function(buf) - actions.close(buf) - on_result(nil) - end) - return true - end, - }) - :find() -end - -local function pick_executable_for_dap(start_dir) - return async.void(function() - local co = coroutine.running() - pick_executable(start_dir, function(choice) - coroutine.resume(co, choice) - end) - local result = coroutine.yield() - if not result then - vim.notify('Debug launch cancelled', vim.log.levels.INFO) +local function pick_executable(start_dir) + return async.wrap(function(start_dir, on_choice) + local executables = collect_executables(start_dir) + if #executables == 0 then + vim.notify('No executables found in ' .. start_dir, vim.log.levels.WARN) + on_choice(nil) + return end - return result - end)() + + pickers + .new({}, { + prompt_title = 'Select Executable', + finder = finders.new_table { results = executables }, + sorter = sorters.generic_sorter {}, + attach_mappings = function(_, map) + actions.select_default:replace(function(prompt_bufnr) + local entry = action_state.get_selected_entry() + actions.close(prompt_bufnr) + on_choice(entry.value) + end) + map('i', '', function(buf) + actions.close(buf) + on_choice(nil) + end) + map('n', 'q', function(buf) + actions.close(buf) + on_choice(nil) + end) + return true + end, + }) + :find() + end, 2)(start_dir) end return { - pick_executable_for_dap = pick_executable_for_dap, + pick_executable = pick_executable, } From 12ae5d3a90d192cbe50beb438c1d916898d15a18 Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 02:02:45 +1200 Subject: [PATCH 343/480] broke the tele picker, fix pt 3 --- lua/custom/utils.lua | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index 751b9ce810f..e8af9741440 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -4,25 +4,38 @@ local finders = require 'telescope.finders' local sorters = require('telescope.config').values local actions = require 'telescope.actions' local action_state = require 'telescope.actions.state' -local Path = require 'plenary.path' local function collect_executables(start_dir) local results = {} - local fd = vim.fn.systemlist { 'fd', '--type', 'x', '--exec', 'file', '{}', start_dir } - for _, line in ipairs(fd) do + local fd_result = vim + .system({ + 'fd', + '--type', + 'x', + '--exec', + 'file', + '{}', + start_dir, + }, { text = true }) + :wait() + + local lines = vim.split(fd_result.stdout, '\n', { trimempty = true }) + + for _, line in ipairs(lines) do local path, typeinfo = line:match '^(.-):%s*(.+)$' - if path and not path:match 'CMakeFiles' and typeinfo and typeinfo:match 'Mach%-O' or typeinfo:match 'ELF' then + if path and not path:match 'CMakeFiles' and typeinfo and (typeinfo:match 'Mach%-O' or typeinfo:match 'ELF') then table.insert(results, path) end end + return results end local function pick_executable(start_dir) - return async.wrap(function(start_dir, on_choice) - local executables = collect_executables(start_dir) + return async.wrap(function(_start_dir, on_choice) + local executables = collect_executables(_start_dir) if #executables == 0 then - vim.notify('No executables found in ' .. start_dir, vim.log.levels.WARN) + vim.notify('No executables found in ' .. _start_dir, vim.log.levels.WARN) on_choice(nil) return end @@ -33,17 +46,17 @@ local function pick_executable(start_dir) finder = finders.new_table { results = executables }, sorter = sorters.generic_sorter {}, attach_mappings = function(_, map) - actions.select_default:replace(function(prompt_bufnr) + actions.select_default:replace(function(bufnr) local entry = action_state.get_selected_entry() - actions.close(prompt_bufnr) + actions.close(bufnr) on_choice(entry.value) end) - map('i', '', function(buf) - actions.close(buf) + map('i', '', function(bufnr) + actions.close(bufnr) on_choice(nil) end) - map('n', 'q', function(buf) - actions.close(buf) + map('n', 'q', function(bufnr) + actions.close(bufnr) on_choice(nil) end) return true From ed9c58d02a642528998422bb0ff4d0795b6ebd2f Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 02:09:23 +1200 Subject: [PATCH 344/480] broke the tele picker, fix pt 4 --- lua/custom/utils.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index e8af9741440..9aca987d2c9 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -32,6 +32,7 @@ local function collect_executables(start_dir) end local function pick_executable(start_dir) + vim.notify('pick_executable() was triggered with start_dir=' .. start_dir, vim.log.levels.INFO) return async.wrap(function(_start_dir, on_choice) local executables = collect_executables(_start_dir) if #executables == 0 then From e9822545a9ab28254f5faabcd5c34f1d979772b8 Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 02:30:39 +1200 Subject: [PATCH 345/480] broke the tele picker, fix pt 5 --- lua/custom/utils.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index 9aca987d2c9..0e93ba80b8a 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -10,12 +10,11 @@ local function collect_executables(start_dir) local fd_result = vim .system({ 'fd', - '--type', - 'x', + '.', + start_dir, '--exec', 'file', '{}', - start_dir, }, { text = true }) :wait() From 910e6e4842de9e8a8d03d91188d3a5bf1592d853 Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 02:36:48 +1200 Subject: [PATCH 346/480] broke the tele picker, fix pt 6 --- lua/custom/plugins/debug.lua | 2 +- lua/custom/utils.lua | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index 8b790461586..dc3e4311195 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -70,7 +70,7 @@ return { type = 'lldb', request = 'launch', program = function() - return require('custom.utils').pick_executable(vim.fn.getcwd() .. '/build') + return require('custom.utils').pick_executable(vim.fn.getcwd() .. '/build/debug') end, cwd = '${workspaceFolder}', stopOnEntry = false, diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index 0e93ba80b8a..30502fe2b55 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -7,20 +7,18 @@ local action_state = require 'telescope.actions.state' local function collect_executables(start_dir) local results = {} - local fd_result = vim - .system({ - 'fd', - '.', - start_dir, - '--exec', - 'file', - '{}', - }, { text = true }) - :wait() - local lines = vim.split(fd_result.stdout, '\n', { trimempty = true }) + -- Add '.', start_dir so it works with your fd version + local fd = vim.fn.systemlist { + 'fd', + '.', + start_dir, + '--exec', + 'file', + '{}', + } - for _, line in ipairs(lines) do + for _, line in ipairs(fd) do local path, typeinfo = line:match '^(.-):%s*(.+)$' if path and not path:match 'CMakeFiles' and typeinfo and (typeinfo:match 'Mach%-O' or typeinfo:match 'ELF') then table.insert(results, path) @@ -31,9 +29,11 @@ local function collect_executables(start_dir) end local function pick_executable(start_dir) - vim.notify('pick_executable() was triggered with start_dir=' .. start_dir, vim.log.levels.INFO) return async.wrap(function(_start_dir, on_choice) + print('pick_executable() was triggered with start_dir=' .. _start_dir) + local executables = collect_executables(_start_dir) + if #executables == 0 then vim.notify('No executables found in ' .. _start_dir, vim.log.levels.WARN) on_choice(nil) @@ -46,9 +46,9 @@ local function pick_executable(start_dir) finder = finders.new_table { results = executables }, sorter = sorters.generic_sorter {}, attach_mappings = function(_, map) - actions.select_default:replace(function(bufnr) + actions.select_default:replace(function(prompt_bufnr) local entry = action_state.get_selected_entry() - actions.close(bufnr) + actions.close(prompt_bufnr) on_choice(entry.value) end) map('i', '', function(bufnr) From b54c7d6461531091e0e7ee77e3a1c23f2da5f575 Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 03:01:56 +1200 Subject: [PATCH 347/480] broke the tele picker, fix pt n --- lua/custom/plugins/debug.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index dc3e4311195..af825f7b8f9 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -11,6 +11,7 @@ return { 'rcarriga/nvim-dap-ui', dependencies = { 'nvim-neotest/nvim-nio' }, -- nvim-dap-ui often needs nio config = function() + local asyn = require 'plenary.async' local dapui = require 'dapui' dapui.setup { -- Borrowed icon and control settings from kickstart/plugins/debug.lua @@ -35,6 +36,7 @@ return { -- Automatically open/close dapui when DAP session starts/stops local dap = require 'dap' + dap.listeners.after.event_initialized['dapui_config'] = function() dapui.open() end @@ -55,6 +57,7 @@ return { }, config = function() local dap = require 'dap' + local async = require 'plenary.async' -- Configure the LLDB DAP adapter for C/C++ -- Assumes 'lldb-dap' executable is in PATH (from pkgs.llvmPackages_XX.lldb) @@ -124,6 +127,12 @@ return { require('dapui').toggle() end, { desc = 'DAP: Toggle [U]I' }) vim.keymap.set('n', 'dt', dap.terminate, { desc = 'DAP: [T]erminate' }) + + vim.keymap.set('n', '', function() + async.run(function() + dap.continue() + end) + end, { desc = 'DAP Continue (async-safe)' }) -- Kickstart's to toggle UI (can be added if you like it) -- vim.keymap.set('n', '', function() require('dapui').toggle() end, { desc = 'Debug: Toggle UI' }) end, From d5a3c86a8590fec8e8815133c20e6d71c685d818 Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 03:41:15 +1200 Subject: [PATCH 348/480] dap refactor, make some commands async-safe --- lua/custom/plugins/debug.lua | 44 ++++++++++++++++++++++++------------ lua/custom/utils.lua | 2 -- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index af825f7b8f9..941cc268a7d 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -57,6 +57,7 @@ return { }, config = function() local dap = require 'dap' + local dapui = require 'dapui' local async = require 'plenary.async' -- Configure the LLDB DAP adapter for C/C++ @@ -73,7 +74,7 @@ return { type = 'lldb', request = 'launch', program = function() - return require('custom.utils').pick_executable(vim.fn.getcwd() .. '/build/debug') + return require('custom.utils').pick_executable(vim.fn.getcwd() .. '/build') end, cwd = '${workspaceFolder}', stopOnEntry = false, @@ -115,26 +116,39 @@ return { -- If you added 'leoluz/nvim-dap-go' as a dependency: -- require('dap-go').setup() -- Call its setup function - -- Your preferred DAP keybindings + -- Launch and Control + vim.keymap.set('n', 'dc', function() + async.run(function() + dap.continue() + if not dapui.windows or vim.tbl_isempty(dapui.windows) then + dapui.open() + end + end) + end, { desc = 'DAP: [C]ontinue show UI (async-safe)' }) vim.keymap.set('n', 'db', dap.toggle_breakpoint, { desc = 'DAP: Toggle [B]reakpoint' }) - vim.keymap.set('n', 'dc', dap.continue, { desc = 'DAP: [C]ontinue' }) - vim.keymap.set('n', 'dj', dap.step_into, { desc = 'DAP: Step [I]nto (j)' }) + vim.keymap.set('n', 'dl', dap.run_last, { desc = 'DAP: Run [L]ast' }) + + -- DAP: Stepping + vim.keymap.set('n', 'di', dap.step_into, { desc = 'DAP: Step [I]nto' }) vim.keymap.set('n', 'dk', dap.step_over, { desc = 'DAP: Step [O]ver (k)' }) vim.keymap.set('n', 'do', dap.step_out, { desc = 'DAP: Step [O]ut' }) - vim.keymap.set('n', 'dr', dap.repl.open, { desc = 'DAP: Open [R]EPL' }) - vim.keymap.set('n', 'dl', dap.run_last, { desc = 'DAP: Run [L]ast' }) - vim.keymap.set('n', 'du', function() - require('dapui').toggle() - end, { desc = 'DAP: Toggle [U]I' }) - vim.keymap.set('n', 'dt', dap.terminate, { desc = 'DAP: [T]erminate' }) + vim.keymap.set('n', 'dx', function() + async.run(function() + dap.run_to_cursor() + end) + end, { desc = 'DAP: Run to Cursor (x) (asyn-safe)' }) - vim.keymap.set('n', '', function() + -- DAP: Termination + vim.keymap.set('n', 'dt', function() async.run(function() - dap.continue() + dap.terminate() + dapui.close() end) - end, { desc = 'DAP Continue (async-safe)' }) - -- Kickstart's to toggle UI (can be added if you like it) - -- vim.keymap.set('n', '', function() require('dapui').toggle() end, { desc = 'Debug: Toggle UI' }) + end, { desc = 'DAP: [T]erminate (async-safe)' }) + + -- DAP: UI + vim.keymap.set('n', 'dr', dap.repl.open, { desc = 'DAP: Open [R]EPL' }) + vim.keymap.set('n', 'du', dapui.toggle, { desc = 'DAP: Toggle [U]I' }) end, }, } diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index 30502fe2b55..9c62984a247 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -30,8 +30,6 @@ end local function pick_executable(start_dir) return async.wrap(function(_start_dir, on_choice) - print('pick_executable() was triggered with start_dir=' .. _start_dir) - local executables = collect_executables(_start_dir) if #executables == 0 then From 97ab584fe64f73387aa0b5467bcfd1a149d2c942 Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 04:03:37 +1200 Subject: [PATCH 349/480] refactored toggle path completion --- lua/custom/plugins/completion.lua | 35 ++++++++++++++++++++--- lua/custom/toggle-path-cmp.lua | 47 ------------------------------- 2 files changed, 31 insertions(+), 51 deletions(-) delete mode 100644 lua/custom/toggle-path-cmp.lua diff --git a/lua/custom/plugins/completion.lua b/lua/custom/plugins/completion.lua index f0e7d27069c..81a23b17470 100644 --- a/lua/custom/plugins/completion.lua +++ b/lua/custom/plugins/completion.lua @@ -30,6 +30,36 @@ return { local luasnip = require 'luasnip' luasnip.config.setup {} -- Setup luasnip first + local function toggle_path_completion() + local config = cmp.get_config() + local snippet = config.snippet + local completion = config.completion + local mapping = config.mapping + + local path_enabled = vim.tbl_any(function(src) + return src.name == 'path' + end, config.sources) + + local new_sources = { + { name = 'lazydev', group_index = 0 }, + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + } + + if not path_enabled then + table.insert(new_sources, { name = 'path' }) + end + + cmp.setup { + snippet = snippet, + completion = completion, + mapping = mapping, + sources = new_sources, + } + + print('Path completion ' .. (path_enabled and 'disabled' or 'enabled')) + end + -- Configure nvim-cmp cmp.setup { snippet = { @@ -76,10 +106,7 @@ return { -- Add other cmp setup options from your old config if any } - -- *** FIX: Require and setup your custom toggle module AFTER cmp is setup *** - -- Ensure the 'custom.toggle-path-cmp' module exists in lua/custom/ - local completion_toggle = require 'custom.toggle-path-cmp' - vim.keymap.set('n', 'tp', completion_toggle.toggle_path_completion, { desc = '[T]oggle [p]ath autocompletion' }) + vim.keymap.set('n', 'tp', toggle_path_completion, { desc = '[T]oggle [p]ath completion' }) end, -- End of config function }, } diff --git a/lua/custom/toggle-path-cmp.lua b/lua/custom/toggle-path-cmp.lua deleted file mode 100644 index 71e90ebd37f..00000000000 --- a/lua/custom/toggle-path-cmp.lua +++ /dev/null @@ -1,47 +0,0 @@ -local cmp = require 'cmp' - -local M = {} - -function M.toggle_path_completion() - local snippet = cmp.get_config().snippet - local completion = cmp.get_config().completion - local mapping = cmp.get_config().mapping - local sources = cmp.get_config().sources - local path_enabled = false - - for _, source in ipairs(sources) do - if source.name == 'path' then - path_enabled = true - break - end - end - - if path_enabled then - cmp.setup { - snippet, - completion, - mapping, - sources = { - { name = 'lazydev', group_index = 0 }, - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - }, - } - print 'Path completion disabled' - else - cmp.setup { - snippet, - completion, - mapping, - sources = { - { name = 'lazydev', group_index = 0 }, - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'path' }, - }, - } - print 'Path completion enabled' - end -end - -return M From d619d03e560def920cf159dfeb81803917a0cd54 Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 04:47:46 +1200 Subject: [PATCH 350/480] trying to fix auto indenting again --- init.lua | 11 ++++++----- lua/custom/options.lua | 7 ++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index 9af8960ddf5..b27ccf4e559 100644 --- a/init.lua +++ b/init.lua @@ -219,9 +219,6 @@ vim.api.nvim_create_autocmd('TextYankPost', { end, }) -require 'custom.options' -require 'custom.keymaps' - -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' @@ -301,7 +298,7 @@ require('lazy').setup({ -- Then, because we use the `opts` key (recommended), the configuration runs -- after the plugin has been loaded as `require(MODULE).setup(opts)`. - { -- Useful plugin to show you pending keybinds. + { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' opts = { @@ -382,7 +379,7 @@ require('lazy').setup({ { 'nvim-telescope/telescope-ui-select.nvim' }, -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that @@ -971,5 +968,9 @@ require('lazy').setup({ }, }) +require 'custom.options' +require 'custom.keymaps' +require 'custom.utils' + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/custom/options.lua b/lua/custom/options.lua index 6bb32e88f5f..4b7a7fb2289 100644 --- a/lua/custom/options.lua +++ b/lua/custom/options.lua @@ -4,11 +4,12 @@ vim.g.have_nerd_font = true -- Indentation settings -vim.o.expandtab = true vim.o.smartindent = true vim.o.autoindent = true -vim.o.tabstop = 4 -vim.o.shiftwidth = 4 +vim.o.expandtab = true +vim.o.tabstop = 2 +vim.o.shiftwidth = 2 +vim.o.softtabstop = 2 -- Add any other custom vim.o or vim.g settings from your old config here -- For example, if you changed defaults for: From 003d871cddc2be9aa43177bc81d839c1170a884c Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 05:30:45 +1200 Subject: [PATCH 351/480] cleanup --- lua/custom/plugins/blink.lua | 9 +++++++++ lua/custom/plugins/init.lua | 4 ++++ lua/custom/plugins/treesitter.lua | 5 +++++ 3 files changed, 18 insertions(+) create mode 100644 lua/custom/plugins/blink.lua diff --git a/lua/custom/plugins/blink.lua b/lua/custom/plugins/blink.lua new file mode 100644 index 00000000000..32f4748df85 --- /dev/null +++ b/lua/custom/plugins/blink.lua @@ -0,0 +1,9 @@ +return { + 'saghen/blink.cmp', + opts = { + fuzzy = { + engine = 'lua', -- prevent warning about native lib + max_distance = 2, + }, + }, +} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index f2a2987b7c0..aac28135afc 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -11,4 +11,8 @@ return { { import = 'custom.plugins.telescope' }, { import = 'custom.plugins.theme' }, { import = 'custom.plugins.treesitter' }, + { + 'nvim-tree/nvim-web-devicons', + lazy = true, + }, } diff --git a/lua/custom/plugins/treesitter.lua b/lua/custom/plugins/treesitter.lua index 39bfce565a8..84372d1de09 100644 --- a/lua/custom/plugins/treesitter.lua +++ b/lua/custom/plugins/treesitter.lua @@ -6,6 +6,8 @@ return { 'nvim-treesitter/nvim-treesitter', -- build = ':TSUpdate', -- Keep build command if needed from kickstart -- main = 'nvim-treesitter.configs', -- Keep if needed from kickstart + event = { 'BufReadPost', 'BufNewFile' }, + build = ':TSUpdate', opts = { -- Use opts to merge/override defaults ensure_installed = { 'bash', @@ -38,6 +40,9 @@ return { -- disable = { 'ruby' }, -- Keep if needed }, }, + config = function(_, opts) + require('nvim-treesitter.configs').setup(opts) + end, -- If kickstart used a config function for treesitter and you need to replicate -- parts of it that aren't handled by opts, add it here. -- config = function(_, opts) From 0a859f314e0d1bc3ea86a6f70556159bd8f82b83 Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 26 May 2025 06:26:18 +1200 Subject: [PATCH 352/480] more cleanup --- init.lua | 10 ++++------ lua/custom/plugins/init.lua | 12 ++++++++---- lua/custom/plugins/telescope.lua | 1 - 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/init.lua b/init.lua index b27ccf4e559..1f1d2276c99 100644 --- a/init.lua +++ b/init.lua @@ -166,6 +166,7 @@ vim.o.scrolloff = 10 -- See `:help 'confirm'` vim.o.confirm = true +require 'custom.options' -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -205,6 +206,8 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the upper win -- vim.keymap.set("n", "", "J", { desc = "Move window to the lower" }) -- vim.keymap.set("n", "", "K", { desc = "Move window to the upper" }) +require 'custom.keymaps' + -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -246,6 +249,7 @@ rtp:prepend(lazypath) -- -- NOTE: Here is where you install your plugins. require('lazy').setup({ + { import = 'custom.plugins' }, -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically @@ -377,9 +381,6 @@ require('lazy').setup({ end, }, { 'nvim-telescope/telescope-ui-select.nvim' }, - - -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that @@ -940,7 +941,6 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! @@ -968,8 +968,6 @@ require('lazy').setup({ }, }) -require 'custom.options' -require 'custom.keymaps' require 'custom.utils' -- The line beneath this is called `modeline`. See `:help modeline` diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index aac28135afc..1241e745efd 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -3,6 +3,14 @@ -- -- See the kickstart.nvim README for more information return { + { + 'nvim-tree/nvim-web-devicons', + lazy = false, + priority = 1000, + config = function() + require('nvim-web-devicons').setup() + end, + }, { import = 'custom.plugins.completion' }, { import = 'custom.plugins.debug' }, { import = 'custom.plugins.formatting' }, @@ -11,8 +19,4 @@ return { { import = 'custom.plugins.telescope' }, { import = 'custom.plugins.theme' }, { import = 'custom.plugins.treesitter' }, - { - 'nvim-tree/nvim-web-devicons', - lazy = true, - }, } diff --git a/lua/custom/plugins/telescope.lua b/lua/custom/plugins/telescope.lua index e821007f25c..2b5c79be960 100644 --- a/lua/custom/plugins/telescope.lua +++ b/lua/custom/plugins/telescope.lua @@ -15,7 +15,6 @@ return { end, }, { 'nvim-telescope/telescope-ui-select.nvim' }, - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, -- Conditionally enable based on options }, opts = { -- Use opts to merge/override defaults pickers = { From 2113b33a58d464b3349dcb6fcaf71c0cfeebc83d Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 27 May 2025 03:50:02 +1200 Subject: [PATCH 353/480] add some bugs --- lua/custom/keymaps.lua | 1 + lua/custom/plugins/debug.lua | 3 +- lua/custom/plugins/lsp.lua | 11 ++----- lua/custom/utils.lua | 56 ++++++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 9 deletions(-) diff --git a/lua/custom/keymaps.lua b/lua/custom/keymaps.lua index 46a8e101989..d24be16670b 100644 --- a/lua/custom/keymaps.lua +++ b/lua/custom/keymaps.lua @@ -20,6 +20,7 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the lower win vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) -- Add any other general-purpose keymaps you want here +vim.keymap.set('n', ' -- Standard practice for Lua modules that don't need to return complex data return {} diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index 941cc268a7d..0a121dd74b9 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -74,7 +74,8 @@ return { type = 'lldb', request = 'launch', program = function() - return require('custom.utils').pick_executable(vim.fn.getcwd() .. '/build') + local target = require('custom.target'):get_target() + return require('custom.utils').pick_executable(vim.fn.getcwd() .. / .. target) end, cwd = '${workspaceFolder}', stopOnEntry = false, diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index df0a43179cf..71ddae6c96e 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -13,8 +13,6 @@ return { 'hrsh7th/cmp-nvim-lsp', -- LSP completion source for nvim-cmp }, config = function(_, opts) - -- local query_driver = vim.fn.trim(vim.fn.system 'which clang++') - -- local resource_dir = vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir') -- This config function runs AFTER the plugin and its dependencies are loaded. -- It sets up the LSP servers. @@ -23,6 +21,8 @@ return { -- Define the list of LSP servers you want to configure. -- These servers must be installed via Nix/Home Manager and be in your PATH. + local utils = require 'custom.utils' + local target = utils:get_target() local servers = { lua_ls = { -- cmd = { ... } @@ -38,12 +38,7 @@ return { }, }, clangd = { - cmd = { - 'clangd', - '--compile-commands-dir=build/debug', - '--query-driver=' .. vim.fn.trim(vim.fn.system 'which clang++'), - '--resource-dir=' .. vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir'), - }, + cmd = utils.make_clangd_cmd(target), filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, root_dir = require('lspconfig.util').root_pattern('CMakeLists.txt', '.git'), }, diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index 9c62984a247..18a8aba8eac 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -66,4 +66,60 @@ end return { pick_executable = pick_executable, + clangd_base_cmd = { + 'clangd', + '--background-index', + '--clang-tidy', + '--header-insertion=never', + '--query-driver=' .. vim.fn.trim(vim.fn.system 'which clang++'), + '--resource-dir=' .. vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir'), + }, + + make_clangd_cmd = function(self, compile_commands_dir) + local cmd = vim.deepcopy(self.clangd_base_cmd) + table.insert(cmd, '--compile-commands-dir=' .. compile_commands_dir) + return cmd + end, + + find_targets = function() + return vim.fn.systemlist 'fd -u compile_commands.json -x dirname {}' + end, + + get_target = function(self) + return vim.g.current_target_dir or 'build/debug' + end, + + set_target = function(self, dir) + vim.g.current_target_dir = dir + self:reload_clangd() + end, + + pick_target = function(self) + local targets = self.find_targets() + if vim.tbl_isempty(targets) then + vim.notify('No build targets found.', vim.log.WARN) + return + end + vim.ui.select(targets, { prompt = 'Select build target:' }, function(choice) + if choice then + self:set_target(choice) + end + end) + end, + + reload_clangd = function(self) + local lspconfig = require 'lspconfig' + local clients = vim.lsp.get_active_clients { name = 'clangd' } + + for _, cliet in ipairs(clients) do + client.stop() + end + + vim.defer_fn(function() + lspconfig.clangd.setup { + cmd = self:make_clangd_cmd(self:get_target()), + } + vim.cmd 'edit' + end, 200) + end, } From 5ff3f3f4bac5c1eaa5fb7a95468a7a2eb57b3bc5 Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 27 May 2025 04:04:27 +1200 Subject: [PATCH 354/480] add some more bugs --- lua/custom/keymaps.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/custom/keymaps.lua b/lua/custom/keymaps.lua index d24be16670b..dd8d311e3f4 100644 --- a/lua/custom/keymaps.lua +++ b/lua/custom/keymaps.lua @@ -20,7 +20,9 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the lower win vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) -- Add any other general-purpose keymaps you want here -vim.keymap.set('n', ' +vim.keymap.set('n', 'T', function() + require('custom.utils'):pick_target() +end, {desc = "Choose [T]arget"}) -- Standard practice for Lua modules that don't need to return complex data return {} From 309b541c97639e30144ad1d6d7a57e4463eb62b5 Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 27 May 2025 04:08:35 +1200 Subject: [PATCH 355/480] fix a bug --- lua/custom/plugins/debug.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index 0a121dd74b9..5cd545eca92 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -75,7 +75,7 @@ return { request = 'launch', program = function() local target = require('custom.target'):get_target() - return require('custom.utils').pick_executable(vim.fn.getcwd() .. / .. target) + return require('custom.utils').pick_executable(vim.fn.getcwd() .. '/' .. target) end, cwd = '${workspaceFolder}', stopOnEntry = false, From 86a195fe35356985c9789b6b14cbb9825f41440d Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 27 May 2025 04:16:35 +1200 Subject: [PATCH 356/480] +/- bug --- lua/custom/plugins/debug.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index 5cd545eca92..d2e896a7a64 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -74,8 +74,9 @@ return { type = 'lldb', request = 'launch', program = function() - local target = require('custom.target'):get_target() - return require('custom.utils').pick_executable(vim.fn.getcwd() .. '/' .. target) + local utils = require 'custom.utils' + local target = utils:get_target() + return utils.pick_executable(vim.fn.getcwd() .. '/' .. target) end, cwd = '${workspaceFolder}', stopOnEntry = false, From 5382ab6ad23a2c42c54641898ab1408d99637bce Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 27 May 2025 04:50:02 +1200 Subject: [PATCH 357/480] configured statusline --- lua/custom/plugins/statusline.lua | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lua/custom/plugins/statusline.lua diff --git a/lua/custom/plugins/statusline.lua b/lua/custom/plugins/statusline.lua new file mode 100644 index 00000000000..1f422afff50 --- /dev/null +++ b/lua/custom/plugins/statusline.lua @@ -0,0 +1,38 @@ +return { + 'echasnovski/mini.statusline', + dependencies = { 'nvim-tree/nvim-web-devicons' }, -- optional for icons + opts = function(_, opts) + local statusline = require 'mini.statusline' + + -- Add new section function + statusline.section_target = function() + local target = require('custom.utils'):get_target() + return target and (' ' .. target) or '' + end + + -- Override content.active to include target + opts.content = opts.content or {} + opts.content.active = function() + local mode, git, diagnostics, filename, fileinfo, target, location = + statusline.section_mode(), + statusline.section_git(), + statusline.section_diagnostics(), + statusline.section_filename(), + statusline.section_fileinfo(), + statusline.section_target(), + statusline.section_location() + + return statusline.combine_groups { + { hl = 'MiniStatuslineModeNormal', strings = { mode } }, + { hl = 'MiniStatuslineDevinfo', strings = { git, diagnostics } }, + '%<', + { hl = 'MiniStatuslineFilename', strings = { filename } }, + { hl = 'MiniStatuslineFileinfo', strings = { fileinfo } }, + { hl = 'MiniStatuslineTarget', strings = { target } }, + { hl = 'MiniStatuslineLocation', strings = { location } }, + } + end + + return opts + end, +} From d1bd0c8fb81260d9ff810c33c5855757f6f291fd Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 27 May 2025 04:54:10 +1200 Subject: [PATCH 358/480] configured statusline fixes --- lua/custom/plugins/statusline.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/custom/plugins/statusline.lua b/lua/custom/plugins/statusline.lua index 1f422afff50..d89cc7a5d47 100644 --- a/lua/custom/plugins/statusline.lua +++ b/lua/custom/plugins/statusline.lua @@ -14,13 +14,13 @@ return { opts.content = opts.content or {} opts.content.active = function() local mode, git, diagnostics, filename, fileinfo, target, location = - statusline.section_mode(), - statusline.section_git(), - statusline.section_diagnostics(), - statusline.section_filename(), - statusline.section_fileinfo(), - statusline.section_target(), - statusline.section_location() + statusline.section_mode {}, + statusline.section_git {}, + statusline.section_diagnostics {}, + statusline.section_filename {}, + statusline.section_fileinfo {}, + statusline.section_target {}, + statusline.section_location {} return statusline.combine_groups { { hl = 'MiniStatuslineModeNormal', strings = { mode } }, From 3885d2be6339dc3cd71102070e1cad1d9ee16283 Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 27 May 2025 05:07:19 +1200 Subject: [PATCH 359/480] more fixes --- lua/custom/utils.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index 18a8aba8eac..ca9b425f3c3 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -119,7 +119,10 @@ return { lspconfig.clangd.setup { cmd = self:make_clangd_cmd(self:get_target()), } - vim.cmd 'edit' + local bufname = vim.api.nvim_buf_get_name(0) + if bufname ~= '' then + vim.cmd 'edit' + end end, 200) end, } From 7f1af2ecb53a093e6dc99119ad60fe9edc431e9f Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 27 May 2025 05:15:53 +1200 Subject: [PATCH 360/480] more fixes --- lua/custom/plugins/blink.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/custom/plugins/blink.lua b/lua/custom/plugins/blink.lua index 32f4748df85..6348b0fa38c 100644 --- a/lua/custom/plugins/blink.lua +++ b/lua/custom/plugins/blink.lua @@ -3,7 +3,6 @@ return { opts = { fuzzy = { engine = 'lua', -- prevent warning about native lib - max_distance = 2, }, }, } From 68e83d7f4763b6be801af131f410c3c870bfc20f Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 27 May 2025 05:26:46 +1200 Subject: [PATCH 361/480] more fixes --- lua/custom/plugins/blink.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lua/custom/plugins/blink.lua b/lua/custom/plugins/blink.lua index 6348b0fa38c..1baf69e0896 100644 --- a/lua/custom/plugins/blink.lua +++ b/lua/custom/plugins/blink.lua @@ -1,8 +1,6 @@ return { 'saghen/blink.cmp', opts = { - fuzzy = { - engine = 'lua', -- prevent warning about native lib - }, + fuzzy = {}, }, } From 5da87e351e4b0a2b30d4c3753a68e57f3271f935 Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 27 May 2025 05:46:18 +1200 Subject: [PATCH 362/480] more fixes --- lua/custom/utils.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index ca9b425f3c3..6c354301fda 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -111,7 +111,7 @@ return { local lspconfig = require 'lspconfig' local clients = vim.lsp.get_active_clients { name = 'clangd' } - for _, cliet in ipairs(clients) do + for _, client in ipairs(clients) do client.stop() end From f7d3587953925cf04dc7c4b81e393bd175020c6b Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 27 May 2025 05:57:32 +1200 Subject: [PATCH 363/480] more fixes --- lua/custom/utils.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index 6c354301fda..0b775340b58 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -109,7 +109,7 @@ return { reload_clangd = function(self) local lspconfig = require 'lspconfig' - local clients = vim.lsp.get_active_clients { name = 'clangd' } + local clients = vim.lsp.get_clients { name = 'clangd' } for _, client in ipairs(clients) do client.stop() From 64f2e2dc279977892a40c8913e840078f79dcab7 Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 27 May 2025 06:36:19 +1200 Subject: [PATCH 364/480] more fixes --- lua/custom/utils.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index 0b775340b58..dcf57f693ec 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -109,20 +109,24 @@ return { reload_clangd = function(self) local lspconfig = require 'lspconfig' - local clients = vim.lsp.get_clients { name = 'clangd' } + local buf = vim.api.nvim_get_current_buf() + local ft = vim.bo[buf].filetype + if vim.api.nvim_buf_get_name(buf) == '' or not vim.tbl_contains({ 'c', 'cpp', 'objc', 'objcpp' }, ft) then + vim.notify('Not reloading clangd: no file or wrong filetype', vim.log.levels.WARN) + return + end - for _, client in ipairs(clients) do - client.stop() + for _, client in ipairs(vim.lsp.get_clients()) do + if client.name == 'clangd' then + client.stop() + end end vim.defer_fn(function() lspconfig.clangd.setup { cmd = self:make_clangd_cmd(self:get_target()), } - local bufname = vim.api.nvim_buf_get_name(0) - if bufname ~= '' then - vim.cmd 'edit' - end + vim.cmd 'edit' end, 200) end, } From 6bff9eec92d00bbab710fcfb407452567319cef5 Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 27 May 2025 07:04:25 +1200 Subject: [PATCH 365/480] debugging --- lua/custom/utils.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index dcf57f693ec..8f0d8cf87ac 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -123,6 +123,9 @@ return { end vim.defer_fn(function() + local cmd = self:make_clangd_cmd(self:get_target()) + vim.print(cmd) + vim.notify(vim.inspect(cmd), vim.log.levels.INFO) lspconfig.clangd.setup { cmd = self:make_clangd_cmd(self:get_target()), } From 270bf3371aadf655d865d1b5b4071aea3793f4f0 Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 27 May 2025 07:17:01 +1200 Subject: [PATCH 366/480] debugging --- lua/custom/utils.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index 8f0d8cf87ac..261d283be8e 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -108,6 +108,10 @@ return { end, reload_clangd = function(self) + print ' reload_clangd called' + local target = self:get_target() + local cmd = self:make_clangd_cmd(target) + print(' clangd cmd:', vim.inspect(cmd)) local lspconfig = require 'lspconfig' local buf = vim.api.nvim_get_current_buf() local ft = vim.bo[buf].filetype @@ -123,6 +127,7 @@ return { end vim.defer_fn(function() + print ' calling clangd.setup' local cmd = self:make_clangd_cmd(self:get_target()) vim.print(cmd) vim.notify(vim.inspect(cmd), vim.log.levels.INFO) From 1d03948bb4edd99182e9be6b2b9110752c9885fc Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 27 May 2025 11:59:56 +1200 Subject: [PATCH 367/480] done --- lua/custom/utils.lua | 77 +++++++++++++++++++++++++++++++------------- 1 file changed, 55 insertions(+), 22 deletions(-) diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index 261d283be8e..da64dfc6833 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -66,6 +66,7 @@ end return { pick_executable = pick_executable, + clangd_base_cmd = { 'clangd', '--background-index', @@ -74,7 +75,6 @@ return { '--query-driver=' .. vim.fn.trim(vim.fn.system 'which clang++'), '--resource-dir=' .. vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir'), }, - make_clangd_cmd = function(self, compile_commands_dir) local cmd = vim.deepcopy(self.clangd_base_cmd) table.insert(cmd, '--compile-commands-dir=' .. compile_commands_dir) @@ -91,6 +91,7 @@ return { set_target = function(self, dir) vim.g.current_target_dir = dir + print(' set_target:', dir) self:reload_clangd() end, @@ -108,33 +109,65 @@ return { end, reload_clangd = function(self) - print ' reload_clangd called' - local target = self:get_target() - local cmd = self:make_clangd_cmd(target) - print(' clangd cmd:', vim.inspect(cmd)) local lspconfig = require 'lspconfig' - local buf = vim.api.nvim_get_current_buf() - local ft = vim.bo[buf].filetype - if vim.api.nvim_buf_get_name(buf) == '' or not vim.tbl_contains({ 'c', 'cpp', 'objc', 'objcpp' }, ft) then - vim.notify('Not reloading clangd: no file or wrong filetype', vim.log.levels.WARN) - return - end + local configs = require"lspconfig.configs") + + local cmd = self:make_clangd_cmd(self:get_target()) + print(' clangd cmd:', vim.inspect(cmd)) for _, client in ipairs(vim.lsp.get_clients()) do if client.name == 'clangd' then + print(' stopping old clangd') client.stop() end end - vim.defer_fn(function() - print ' calling clangd.setup' - local cmd = self:make_clangd_cmd(self:get_target()) - vim.print(cmd) - vim.notify(vim.inspect(cmd), vim.log.levels.INFO) - lspconfig.clangd.setup { - cmd = self:make_clangd_cmd(self:get_target()), - } - vim.cmd 'edit' - end, 200) - end, + if not configs.clangd then + configs.clangd = { + default_config = { + cmd = cmd, + filetypes = { 'c', 'cpp', 'objc', 'objcpp' }, + root_dir = lspconfig.util.root_pattern("compile_commands.json", '.git'), + single_file_support = true, + }, + } +else + configs.clangd.default_config.cmd = cmd +end + + lspconfig.clangd.setup({ cmd = cmd }) + +local buf = vim.api.nvim_get_current_buf() + local name = vim.api.nvim_buf_get_name(buf) + loal ft = vim.bo[buf].filetype + + if name ~= "" and ft:match('c') then + print(" reopening buffer to auto-attach clangd") + vim.cmd("edit") +else + print(" Skipping buffer reload: name or filetype invalid") + end +end, + +list_attached_clients = function() + local clients = vim.lsp.get_clients({ bufnr = 0 }) + if vim.tbl_isempty(clients) then + print("No LSP clients attached to this buffer.") + return + end + for _, client in ipairs(clients) do + print("LSP:", client.name, "id:", client.id) + end +end, + +list_attached_clients = function() + local clients = vim.lsp.get_clients({ bufnr = 0 }) + if vim.tbl_isempty(clients) then + print("No LSP clients attached to this buffer.") + return + end + for _, client in ipairs(clients) do + print("LSP:", client.name, "id:", client.id) + end +end, } From 049d9f270ade5caa8d7a8286ad49e448368c4242 Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 27 May 2025 12:06:15 +1200 Subject: [PATCH 368/480] debugging --- lua/custom/utils.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index da64dfc6833..fecfc230d90 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -110,7 +110,7 @@ return { reload_clangd = function(self) local lspconfig = require 'lspconfig' - local configs = require"lspconfig.configs") + local configs = require("lspconfig.configs") local cmd = self:make_clangd_cmd(self:get_target()) print(' clangd cmd:', vim.inspect(cmd)) From 3bab6822738724b980778747b9d00605174e8faf Mon Sep 17 00:00:00 2001 From: dlond Date: Thu, 29 May 2025 20:29:10 +1200 Subject: [PATCH 369/480] changing kick overrides pattern --- init.lua | 13 +- lua/custom/keymaps.lua | 22 +-- lua/custom/plugins/debug.lua | 7 +- lua/custom/plugins/init.lua | 14 +- lua/custom/plugins/lsp.lua | 200 ++++-------------------- lua/custom/plugins/lsp/clangd.lua | 62 ++++++++ lua/custom/plugins/statusline.lua | 8 +- lua/custom/utils.lua | 242 +++++++++--------------------- 8 files changed, 189 insertions(+), 379 deletions(-) create mode 100644 lua/custom/plugins/lsp/clangd.lua diff --git a/init.lua b/init.lua index 1f1d2276c99..29f39c87c1f 100644 --- a/init.lua +++ b/init.lua @@ -167,6 +167,7 @@ vim.o.scrolloff = 10 vim.o.confirm = true require 'custom.options' + -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -249,7 +250,6 @@ rtp:prepend(lazypath) -- -- NOTE: Here is where you install your plugins. require('lazy').setup({ - { import = 'custom.plugins' }, -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically @@ -381,6 +381,9 @@ require('lazy').setup({ end, }, { 'nvim-telescope/telescope-ui-select.nvim' }, + + -- Useful for getting pretty icons, but requires a Nerd Font. + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that @@ -690,6 +693,11 @@ require('lazy').setup({ }, }, } + + for server_name, server in pairs(servers) do + server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) + require('lspconfig')[server_name].setup(server) + end end, }, @@ -941,6 +949,7 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! @@ -968,7 +977,5 @@ require('lazy').setup({ }, }) -require 'custom.utils' - -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/custom/keymaps.lua b/lua/custom/keymaps.lua index dd8d311e3f4..cac7357242f 100644 --- a/lua/custom/keymaps.lua +++ b/lua/custom/keymaps.lua @@ -1,28 +1,10 @@ -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` --- Clear highlights on search when pressing in normal mode --- See `:help hlsearch` -vim.keymap.set('n', '', 'nohlsearch', { desc = 'Clear Search Highlight' }) - --- Diagnostic keymaps (These might also be set by LSP config, but having them here is fine) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) - --- Exit terminal mode in the builtin terminal -vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) - --- Keybinds to make split navigation easier. --- Use CTRL+ to switch between windows --- See `:help wincmd` -vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) - -- Add any other general-purpose keymaps you want here vim.keymap.set('n', 'T', function() - require('custom.utils'):pick_target() -end, {desc = "Choose [T]arget"}) + require('custom.lsp.clangd'):pick_target() +end, { desc = 'Choose [T]arget' }) -- Standard practice for Lua modules that don't need to return complex data return {} diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua index d2e896a7a64..7471cb99325 100644 --- a/lua/custom/plugins/debug.lua +++ b/lua/custom/plugins/debug.lua @@ -74,9 +74,10 @@ return { type = 'lldb', request = 'launch', program = function() - local utils = require 'custom.utils' - local target = utils:get_target() - return utils.pick_executable(vim.fn.getcwd() .. '/' .. target) + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + -- local utils = require 'custom.utils' + -- local target = utils:get_target() + -- return utils.pick_executable(vim.fn.getcwd() .. '/' .. target) end, cwd = '${workspaceFolder}', stopOnEntry = false, diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 1241e745efd..b73c04ef721 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -11,12 +11,12 @@ return { require('nvim-web-devicons').setup() end, }, - { import = 'custom.plugins.completion' }, - { import = 'custom.plugins.debug' }, - { import = 'custom.plugins.formatting' }, + -- { import = 'custom.plugins.completion' }, + -- { import = 'custom.plugins.debug' }, + -- { import = 'custom.plugins.formatting' }, { import = 'custom.plugins.lsp' }, - { import = 'custom.plugins.nvim-tmux-navigator' }, - { import = 'custom.plugins.telescope' }, - { import = 'custom.plugins.theme' }, - { import = 'custom.plugins.treesitter' }, + -- { import = 'custom.plugins.nvim-tmux-navigator' }, + -- { import = 'custom.plugins.telescope' }, + -- { import = 'custom.plugins.theme' }, + -- { import = 'custom.plugins.treesitter' }, } diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 71ddae6c96e..4af7e87d54d 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -1,176 +1,38 @@ -- ~/dlond/nvim/lua/custom/plugins/lsp.lua -- LSP configuration, assuming LSP servers are installed via Nix/Home Manager -return { - -- ======================================== - -- LSP Configuration (LSP servers provided by Nix/Home Manager) - -- ======================================== - { - 'neovim/nvim-lspconfig', - event = { 'BufReadPre', 'BufNewFile' }, -- Load LSP config early - dependencies = { - { 'j-hui/fidget.nvim', opts = {} }, -- Useful status updates for LSP - 'hrsh7th/cmp-nvim-lsp', -- LSP completion source for nvim-cmp - }, - config = function(_, opts) - -- This config function runs AFTER the plugin and its dependencies are loaded. - -- It sets up the LSP servers. - - -- Get LSP capabilities, augmented by nvim-cmp - local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) - - -- Define the list of LSP servers you want to configure. - -- These servers must be installed via Nix/Home Manager and be in your PATH. - local utils = require 'custom.utils' - local target = utils:get_target() - local servers = { - lua_ls = { - -- cmd = { ... } - -- filetypes = { ... } - -- capabilities = {} - settings = { - Lua = { - completion = { - callSnippet = 'Replace', - }, - diagnostics = { disable = { 'missing-fields' } }, - }, - }, - }, - clangd = { - cmd = utils.make_clangd_cmd(target), - filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, - root_dir = require('lspconfig.util').root_pattern('CMakeLists.txt', '.git'), - }, - pyright = { - settings = { - python = { - analysis = { - autoSearchPaths = true, - diagnosticMode = 'openFilesOnly', - useLibraryCodeForTypes = true, - typeCheckingMode = 'basic', - }, - }, - positionEncoding = 'utf-8', - }, +local lspconfig = require 'lspconfig' +local capabilities = require('blink.cmp').get_lsp_capabilities() + +local servers = { + pyright = { + settings = { + python = { + analysis = { + autoSearchPaths = true, + diagnosticMode = 'openFilesOnly', + useLibraryCodeForTypes = true, + typeCheckingMode = 'basic', }, - nixd = {}, - ruff = {}, - texlab = {}, - cmake = { - cmd = { 'cmake-language-server' }, - filetypes = { 'cmake' }, - root_dir = require('lspconfig.util').root_pattern('CMakeLists.txt', '.git'), - }, - } - - -- Iterate through the defined servers list and set them up with lspconfig - for server_name, server_config_override in pairs(servers) do - local server_ops = { - capabilities = capabilities, - } - server_ops = vim.tbl_deep_extend('force', server_ops, server_config_override or {}) - local setup_ok, setup_err = pcall(require('lspconfig')[server_name].setup, server_ops) - if not setup_ok then - vim.notify("Error setting up LSP server '" .. server_name .. "': " .. tostring(setup_err), vim.log.levels.ERROR) - else - end - end - - -- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach-override', { clear = true }), - callback = function(event) - local map = function(keys, func, desc, mode) - mode = mode or 'n' - vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) - end - - -- Standard LSP keymaps - map('grn', vim.lsp.buf.rename, '[R]e[n]ame') - map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) - map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') - map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') - map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') - - -- Highlight references - local client = vim.lsp.get_client_by_id(event.data.client_id) - local function client_supports_method(client, method, bufnr) - if vim.fn.has 'nvim-0.11' == 1 then - return client:supports_method(method, { bufnr = bufnr }) - else - return client.supports_method(method, { bufnr = bufnr }) - end - end - if client and client_supports_method(client, 'textDocument/documentHighlight', event.buf) then - local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight-override', { clear = false }) - vim.api.nvim_create_autocmd( - { 'CursorHold', 'CursorHoldI' }, - { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight } - ) - vim.api.nvim_create_autocmd( - { 'CursorMoved', 'CursorMovedI' }, - { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.clear_references } - ) - vim.api.nvim_create_autocmd('LspDetach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-detach-override', { clear = true }), - callback = function(event2) - vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight-override', buffer = event2.buf } - end, - }) - end - - -- Inlay hints toggle - if client and client_supports_method(client, 'textDocument/inlayHint', event.buf) then - map('th', function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) - end, '[T]oggle Inlay [H]ints') - end - end, - }) - - -- Diagnostic configuration - vim.diagnostic.config { - severity_sort = true, - float = { border = 'rounded', source = 'if_many' }, - underline = { severity = vim.diagnostic.severity.ERROR }, - signs = vim.g.have_nerd_font and { - text = { - [vim.diagnostic.severity.ERROR] = '󰅚 ', - [vim.diagnostic.severity.WARN] = '󰀪 ', - [vim.diagnostic.severity.INFO] = '󰋽 ', - [vim.diagnostic.severity.HINT] = '󰌶 ', - }, - } or {}, - virtual_text = { - source = 'if_many', - spacing = 2, - format = function(diagnostic) - local diagnostic_message = { - [vim.diagnostic.severity.ERROR] = diagnostic.message, - [vim.diagnostic.severity.WARN] = diagnostic.message, - [vim.diagnostic.severity.INFO] = diagnostic.message, - [vim.diagnostic.severity.HINT] = diagnostic.message, - } - return diagnostic_message[diagnostic.severity] - end, - }, - } - end, -- End of config function - }, - - -- lazydev setup (still useful for Neovim Lua development) - { - 'folke/lazydev.nvim', - ft = 'lua', - opts = { - library = { { path = 'luvit-meta/library', words = { 'vim%.uv' } } }, + }, + positionEncoding = 'utf-8', }, }, + nixd = {}, + ruff = {}, + texlab = {}, + cmake = { + cmd = { 'cmake-language-server' }, + filetypes = { 'cmake' }, + root_dir = require('lspconfig.util').root_pattern('CMakeLists.txt', '.git'), + }, } + +for server_name, server in pairs(servers) do + server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) + require('lspconfig')[server_name].setup(server) +end + +require('custom.plugins.lsp.clangd').setup() + +return {} diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua new file mode 100644 index 00000000000..fe5571bfe48 --- /dev/null +++ b/lua/custom/plugins/lsp/clangd.lua @@ -0,0 +1,62 @@ +local M = {} + +local lspconfig = require 'lspconfig' +local capabilities = require('blink.cmp').get_lsp_capabilities() +local Path = require 'plenary.path' +local pickers = require 'telescope.pickers' +local finders = require 'telescope.finders' +local conf = require('telescope.config').values + +local current_target = './build/debug' + +local function make_clangd_cmd() + return { + 'clangd', + '--background-index', + '--clang-tidy', + '--header-insertion=never', + '--query-driver=' .. vim.fn.exepath 'clang++', + '--resource-dir=' .. vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir', + '--compile-commands-dir=' .. current_target, + } +end + +local function reload_clangd() + for _, client in pairs(vim.lsp.get_active_clients()) do + if client.name == 'clangd' then + client.stop() + end + end + M.setup() +end + +function M.pick_target() + pickers + .new({}, { + prompt_title = 'Choose build target', + finder = finders.new_oneshot_job { 'fd', '-u', 'compile_commands.json', '-x', 'dirname', '{}' }, + sorter = conf.generic_sorter {}, + attach_mappings = function(_, map) + map('i', '', function(prompt_bufnr) + local entry = require('telescope.actions.state').get_selected_entry() + current_target = entry[1] + require('telescope.actions').close(prompt_bufnr) + reload_clangd() + end) + return true + end, + }) + :find() +end + +function M.setup() + lspconfig.clangd.setup { + cmd = make_clangd_cmd(), + filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }; + root_dir = lspconfig.util.root_pattern('.git'), + single_file_support = true, + capabilities = capabilities, + } +end + +return M diff --git a/lua/custom/plugins/statusline.lua b/lua/custom/plugins/statusline.lua index d89cc7a5d47..0b53e8fb147 100644 --- a/lua/custom/plugins/statusline.lua +++ b/lua/custom/plugins/statusline.lua @@ -5,10 +5,10 @@ return { local statusline = require 'mini.statusline' -- Add new section function - statusline.section_target = function() - local target = require('custom.utils'):get_target() - return target and (' ' .. target) or '' - end + -- statusline.section_target = function() + -- local target = require('custom.utils'):get_target() + -- return target and (' ' .. target) or '' + -- end -- Override content.active to include target opts.content = opts.content or {} diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua index fecfc230d90..b45ac58e4d5 100644 --- a/lua/custom/utils.lua +++ b/lua/custom/utils.lua @@ -1,173 +1,69 @@ -local async = require 'plenary.async' -local pickers = require 'telescope.pickers' -local finders = require 'telescope.finders' -local sorters = require('telescope.config').values -local actions = require 'telescope.actions' -local action_state = require 'telescope.actions.state' - -local function collect_executables(start_dir) - local results = {} - - -- Add '.', start_dir so it works with your fd version - local fd = vim.fn.systemlist { - 'fd', - '.', - start_dir, - '--exec', - 'file', - '{}', - } - - for _, line in ipairs(fd) do - local path, typeinfo = line:match '^(.-):%s*(.+)$' - if path and not path:match 'CMakeFiles' and typeinfo and (typeinfo:match 'Mach%-O' or typeinfo:match 'ELF') then - table.insert(results, path) - end - end - - return results -end - -local function pick_executable(start_dir) - return async.wrap(function(_start_dir, on_choice) - local executables = collect_executables(_start_dir) - - if #executables == 0 then - vim.notify('No executables found in ' .. _start_dir, vim.log.levels.WARN) - on_choice(nil) - return - end - - pickers - .new({}, { - prompt_title = 'Select Executable', - finder = finders.new_table { results = executables }, - sorter = sorters.generic_sorter {}, - attach_mappings = function(_, map) - actions.select_default:replace(function(prompt_bufnr) - local entry = action_state.get_selected_entry() - actions.close(prompt_bufnr) - on_choice(entry.value) - end) - map('i', '', function(bufnr) - actions.close(bufnr) - on_choice(nil) - end) - map('n', 'q', function(bufnr) - actions.close(bufnr) - on_choice(nil) - end) - return true - end, - }) - :find() - end, 2)(start_dir) -end - -return { - pick_executable = pick_executable, - - clangd_base_cmd = { - 'clangd', - '--background-index', - '--clang-tidy', - '--header-insertion=never', - '--query-driver=' .. vim.fn.trim(vim.fn.system 'which clang++'), - '--resource-dir=' .. vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir'), - }, - make_clangd_cmd = function(self, compile_commands_dir) - local cmd = vim.deepcopy(self.clangd_base_cmd) - table.insert(cmd, '--compile-commands-dir=' .. compile_commands_dir) - return cmd - end, - - find_targets = function() - return vim.fn.systemlist 'fd -u compile_commands.json -x dirname {}' - end, - - get_target = function(self) - return vim.g.current_target_dir or 'build/debug' - end, - - set_target = function(self, dir) - vim.g.current_target_dir = dir - print(' set_target:', dir) - self:reload_clangd() - end, - - pick_target = function(self) - local targets = self.find_targets() - if vim.tbl_isempty(targets) then - vim.notify('No build targets found.', vim.log.WARN) - return - end - vim.ui.select(targets, { prompt = 'Select build target:' }, function(choice) - if choice then - self:set_target(choice) - end - end) - end, - - reload_clangd = function(self) - local lspconfig = require 'lspconfig' - local configs = require("lspconfig.configs") - - local cmd = self:make_clangd_cmd(self:get_target()) - print(' clangd cmd:', vim.inspect(cmd)) - - for _, client in ipairs(vim.lsp.get_clients()) do - if client.name == 'clangd' then - print(' stopping old clangd') - client.stop() - end - end - - if not configs.clangd then - configs.clangd = { - default_config = { - cmd = cmd, - filetypes = { 'c', 'cpp', 'objc', 'objcpp' }, - root_dir = lspconfig.util.root_pattern("compile_commands.json", '.git'), - single_file_support = true, - }, - } -else - configs.clangd.default_config.cmd = cmd -end - - lspconfig.clangd.setup({ cmd = cmd }) - -local buf = vim.api.nvim_get_current_buf() - local name = vim.api.nvim_buf_get_name(buf) - loal ft = vim.bo[buf].filetype - - if name ~= "" and ft:match('c') then - print(" reopening buffer to auto-attach clangd") - vim.cmd("edit") -else - print(" Skipping buffer reload: name or filetype invalid") - end -end, - -list_attached_clients = function() - local clients = vim.lsp.get_clients({ bufnr = 0 }) - if vim.tbl_isempty(clients) then - print("No LSP clients attached to this buffer.") - return - end - for _, client in ipairs(clients) do - print("LSP:", client.name, "id:", client.id) - end -end, - -list_attached_clients = function() - local clients = vim.lsp.get_clients({ bufnr = 0 }) - if vim.tbl_isempty(clients) then - print("No LSP clients attached to this buffer.") - return - end - for _, client in ipairs(clients) do - print("LSP:", client.name, "id:", client.id) - end -end, -} +-- local async = require 'plenary.async' +-- local pickers = require 'telescope.pickers' +-- local finders = require 'telescope.finders' +-- local sorters = require('telescope.config').values +-- local actions = require 'telescope.actions' +-- local action_state = require 'telescope.actions.state' +-- +-- local function collect_executables(start_dir) +-- local results = {} +-- +-- -- Add '.', start_dir so it works with your fd version +-- local fd = vim.fn.systemlist { +-- 'fd', +-- '.', +-- start_dir, +-- '--exec', +-- 'file', +-- '{}', +-- } +-- +-- for _, line in ipairs(fd) do +-- local path, typeinfo = line:match '^(.-):%s*(.+)$' +-- if path and not path:match 'CMakeFiles' and typeinfo and (typeinfo:match 'Mach%-O' or typeinfo:match 'ELF') then +-- table.insert(results, path) +-- end +-- end +-- +-- return results +-- end +-- +-- local function pick_executable(start_dir) +-- return async.wrap(function(_start_dir, on_choice) +-- local executables = collect_executables(_start_dir) +-- +-- if #executables == 0 then +-- vim.notify('No executables found in ' .. _start_dir, vim.log.levels.WARN) +-- on_choice(nil) +-- return +-- end +-- +-- pickers +-- .new({}, { +-- prompt_title = 'Select Executable', +-- finder = finders.new_table { results = executables }, +-- sorter = sorters.generic_sorter {}, +-- attach_mappings = function(_, map) +-- actions.select_default:replace(function(prompt_bufnr) +-- local entry = action_state.get_selected_entry() +-- actions.close(prompt_bufnr) +-- on_choice(entry.value) +-- end) +-- map('i', '', function(bufnr) +-- actions.close(bufnr) +-- on_choice(nil) +-- end) +-- map('n', 'q', function(bufnr) +-- actions.close(bufnr) +-- on_choice(nil) +-- end) +-- return true +-- end, +-- }) +-- :find() +-- end, 2)(start_dir) +-- end +-- +-- return { +-- pick_executable = pick_executable, +-- } From b48c2e9acf69c5dfd464a608d70069ea0243982d Mon Sep 17 00:00:00 2001 From: dlond Date: Thu, 29 May 2025 20:37:46 +1200 Subject: [PATCH 370/480] typo --- lua/custom/plugins/lsp/clangd.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index fe5571bfe48..ff6be504a06 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -16,13 +16,13 @@ local function make_clangd_cmd() '--clang-tidy', '--header-insertion=never', '--query-driver=' .. vim.fn.exepath 'clang++', - '--resource-dir=' .. vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir', + '--resource-dir=' .. vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir'), '--compile-commands-dir=' .. current_target, } end local function reload_clangd() - for _, client in pairs(vim.lsp.get_active_clients()) do + for _, client in pairs(vim.lsp.get_clients()) do if client.name == 'clangd' then client.stop() end @@ -52,8 +52,8 @@ end function M.setup() lspconfig.clangd.setup { cmd = make_clangd_cmd(), - filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }; - root_dir = lspconfig.util.root_pattern('.git'), + filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, + root_dir = lspconfig.util.root_pattern '.git', single_file_support = true, capabilities = capabilities, } From 68450346a1200dd2b9342213dd1150f43b20be11 Mon Sep 17 00:00:00 2001 From: dlond Date: Thu, 29 May 2025 21:24:30 +1200 Subject: [PATCH 371/480] refactor lsp --- init.lua | 2 +- lua/custom/plugins/lsp/clangd.lua | 11 +++++++---- lua/custom/plugins/lsp/init.lua | 4 ++++ lua/custom/plugins/{ => lsp}/lsp.lua | 4 +--- 4 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 lua/custom/plugins/lsp/init.lua rename lua/custom/plugins/{ => lsp}/lsp.lua (90%) diff --git a/init.lua b/init.lua index 29f39c87c1f..74a20fbef95 100644 --- a/init.lua +++ b/init.lua @@ -949,7 +949,7 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - { import = 'custom.plugins' }, + -- { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index ff6be504a06..10e63ff247c 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -1,8 +1,6 @@ local M = {} -local lspconfig = require 'lspconfig' -local capabilities = require('blink.cmp').get_lsp_capabilities() -local Path = require 'plenary.path' +-- local Path = require 'plenary.path' local pickers = require 'telescope.pickers' local finders = require 'telescope.finders' local conf = require('telescope.config').values @@ -50,6 +48,9 @@ function M.pick_target() end function M.setup() + local lspconfig = require 'lspconfig' + local capabilities = require('blink.cmp').get_lsp_capabilities() + lspconfig.clangd.setup { cmd = make_clangd_cmd(), filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, @@ -59,4 +60,6 @@ function M.setup() } end -return M +M.setup() + +return {} diff --git a/lua/custom/plugins/lsp/init.lua b/lua/custom/plugins/lsp/init.lua new file mode 100644 index 00000000000..3606ccbf276 --- /dev/null +++ b/lua/custom/plugins/lsp/init.lua @@ -0,0 +1,4 @@ +return { + require 'custom.plugins.lsp.lsp', + require 'custom.plugins.lsp.clangd', +} diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp/lsp.lua similarity index 90% rename from lua/custom/plugins/lsp.lua rename to lua/custom/plugins/lsp/lsp.lua index 4af7e87d54d..5a3c4e78807 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp/lsp.lua @@ -30,9 +30,7 @@ local servers = { for server_name, server in pairs(servers) do server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) - require('lspconfig')[server_name].setup(server) + lspconfig[server_name].setup(server) end -require('custom.plugins.lsp.clangd').setup() - return {} From aabb6bf2bc48e671cdfacabf7ec71469620b1173 Mon Sep 17 00:00:00 2001 From: dlond Date: Thu, 29 May 2025 22:36:54 +1200 Subject: [PATCH 372/480] clangd lazy spec --- lua/custom/plugins/lsp/clangd.lua | 61 ++++++++++++++----------------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 10e63ff247c..dd093875253 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -1,45 +1,48 @@ local M = {} --- local Path = require 'plenary.path' local pickers = require 'telescope.pickers' local finders = require 'telescope.finders' local conf = require('telescope.config').values -local current_target = './build/debug' - -local function make_clangd_cmd() +local function build_cmd(commands_dir) return { 'clangd', '--background-index', '--clang-tidy', '--header-insertion=never', - '--query-driver=' .. vim.fn.exepath 'clang++', + '--query-driver=' .. vim.vn.exepath 'clang++', '--resource-dir=' .. vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir'), - '--compile-commands-dir=' .. current_target, + '--compile-commands-dir=' .. commands_dir, } end -local function reload_clangd() - for _, client in pairs(vim.lsp.get_clients()) do - if client.name == 'clangd' then - client.stop() - end - end - M.setup() +function M.reload_clangd(commands_dir) + local lspconfig = require 'lspconfig' + + commands_dir = commands_dir or './build/debug' + + lspconfig.clangd.setup { + cmd = build_cmd(commands_dir), + root_dir = lspconfig.util.root_pattern '.git', + single_file_support = true, + capabilities = require('blink.cmp').get_lsp_capabilities(), + } + + vim.cmd.edit() end -function M.pick_target() +function M.pick_commands_dir() pickers .new({}, { - prompt_title = 'Choose build target', + prompt_title = 'Choose compile_commands.json location', finder = finders.new_oneshot_job { 'fd', '-u', 'compile_commands.json', '-x', 'dirname', '{}' }, sorter = conf.generic_sorter {}, attach_mappings = function(_, map) map('i', '', function(prompt_bufnr) local entry = require('telescope.actions.state').get_selected_entry() - current_target = entry[1] + local commands_dir = entry[1] require('telescope.actions').close(prompt_bufnr) - reload_clangd() + M.reload_clangd(commands_dir) end) return true end, @@ -47,19 +50,11 @@ function M.pick_target() :find() end -function M.setup() - local lspconfig = require 'lspconfig' - local capabilities = require('blink.cmp').get_lsp_capabilities() - - lspconfig.clangd.setup { - cmd = make_clangd_cmd(), - filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, - root_dir = lspconfig.util.root_pattern '.git', - single_file_support = true, - capabilities = capabilities, - } -end - -M.setup() - -return {} +return { + 'neovim/nvim-lspconfig', + ft = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, + config = function() + M.reload_clangd() + vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) + end, +} From eedb67c18d38299a7433f6d6cfd1f3917b8621d1 Mon Sep 17 00:00:00 2001 From: dlond Date: Thu, 29 May 2025 22:56:44 +1200 Subject: [PATCH 373/480] refactor --- lua/custom/plugins/lsp/clangd.lua | 105 +++++++++++++++--------------- 1 file changed, 51 insertions(+), 54 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index dd093875253..d2478c52f24 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -1,60 +1,57 @@ -local M = {} - -local pickers = require 'telescope.pickers' -local finders = require 'telescope.finders' -local conf = require('telescope.config').values - -local function build_cmd(commands_dir) - return { - 'clangd', - '--background-index', - '--clang-tidy', - '--header-insertion=never', - '--query-driver=' .. vim.vn.exepath 'clang++', - '--resource-dir=' .. vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir'), - '--compile-commands-dir=' .. commands_dir, - } -end - -function M.reload_clangd(commands_dir) - local lspconfig = require 'lspconfig' - - commands_dir = commands_dir or './build/debug' - - lspconfig.clangd.setup { - cmd = build_cmd(commands_dir), - root_dir = lspconfig.util.root_pattern '.git', - single_file_support = true, - capabilities = require('blink.cmp').get_lsp_capabilities(), - } - - vim.cmd.edit() -end - -function M.pick_commands_dir() - pickers - .new({}, { - prompt_title = 'Choose compile_commands.json location', - finder = finders.new_oneshot_job { 'fd', '-u', 'compile_commands.json', '-x', 'dirname', '{}' }, - sorter = conf.generic_sorter {}, - attach_mappings = function(_, map) - map('i', '', function(prompt_bufnr) - local entry = require('telescope.actions.state').get_selected_entry() - local commands_dir = entry[1] - require('telescope.actions').close(prompt_bufnr) - M.reload_clangd(commands_dir) - end) - return true - end, - }) - :find() -end - return { 'neovim/nvim-lspconfig', ft = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, config = function() - M.reload_clangd() - vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) + local function build_cmd(commands_dir) + return { + 'clangd', + '--background-index', + '--clang-tidy', + '--header-insertion=never', + '--query-driver=' .. vim.vn.exepath 'clang++', + '--resource-dir=' .. vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir'), + '--compile-commands-dir=' .. commands_dir, + } + end + + local function reload_clangd(commands_dir) + commands_dir = commands_dir or './build/debug' + local lspconfig = require 'lspconfig' + + lspconfig.clangd.setup { + cmd = build_cmd(commands_dir), + root_dir = lspconfig.util.root_pattern '.git', + single_file_support = true, + capabilities = require('blink.cmp').get_lsp_capabilities(), + } + + vim.cmd.edit() + end + + local function pick_commands_dir() + local pickers = require 'telescope.pickers' + local finders = require 'telescope.finders' + local conf = require('telescope.config').values + pickers + .new({}, { + prompt_title = 'Choose compile_commands.json location', + finder = finders.new_oneshot_job { 'fd', '-u', 'compile_commands.json', '-x', 'dirname', '{}' }, + sorter = conf.generic_sorter {}, + attach_mappings = function(_, map) + map('i', '', function(prompt_bufnr) + local entry = require('telescope.actions.state').get_selected_entry() + local commands_dir = entry[1] + require('telescope.actions').close(prompt_bufnr) + reload_clangd(commands_dir) + end) + return true + end, + }) + :find() + end + + reload_clangd() + + vim.keymap.set('n', 'cc', pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) end, } From 7bf3c2c465e4069b7e689de5068dbb534d5c46cf Mon Sep 17 00:00:00 2001 From: dlond Date: Thu, 29 May 2025 23:01:41 +1200 Subject: [PATCH 374/480] load custom plugins --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 74a20fbef95..29f39c87c1f 100644 --- a/init.lua +++ b/init.lua @@ -949,7 +949,7 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! From cf313f6f0e2d9164740b988cd18664fd70f02ffb Mon Sep 17 00:00:00 2001 From: dlond Date: Thu, 29 May 2025 23:06:04 +1200 Subject: [PATCH 375/480] typo. dap target not ready --- lua/custom/plugins/lsp/clangd.lua | 2 +- lua/custom/plugins/statusline.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index d2478c52f24..1c8fe599636 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -8,7 +8,7 @@ return { '--background-index', '--clang-tidy', '--header-insertion=never', - '--query-driver=' .. vim.vn.exepath 'clang++', + '--query-driver=' .. vim.fn.exepath 'clang++', '--resource-dir=' .. vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir'), '--compile-commands-dir=' .. commands_dir, } diff --git a/lua/custom/plugins/statusline.lua b/lua/custom/plugins/statusline.lua index 0b53e8fb147..58e088d8f2c 100644 --- a/lua/custom/plugins/statusline.lua +++ b/lua/custom/plugins/statusline.lua @@ -19,7 +19,7 @@ return { statusline.section_diagnostics {}, statusline.section_filename {}, statusline.section_fileinfo {}, - statusline.section_target {}, + -- statusline.section_target {}, statusline.section_location {} return statusline.combine_groups { From cc7c0b5c08d33855c70edb4d923ed9d40d732e84 Mon Sep 17 00:00:00 2001 From: dlond Date: Thu, 29 May 2025 23:51:57 +1200 Subject: [PATCH 376/480] installed luarocks --- init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init.lua b/init.lua index 29f39c87c1f..bbb648166bd 100644 --- a/init.lua +++ b/init.lua @@ -956,6 +956,9 @@ require('lazy').setup({ -- In normal mode type `sh` then write `lazy.nvim-plugin` -- you can continue same window with `sr` which resumes last telescope search }, { + -- rocks = { + -- enabled = false, + -- }, ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table From 427939537da3c57ef90d5ebbd48605283e65f60b Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 00:56:59 +1200 Subject: [PATCH 377/480] added some automation --- lua/custom/plugins/lsp/clangd.lua | 136 ++++++++++++++++++++---------- 1 file changed, 90 insertions(+), 46 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 1c8fe599636..198d0f41e2a 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -1,56 +1,100 @@ -return { - 'neovim/nvim-lspconfig', - ft = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, - config = function() - local function build_cmd(commands_dir) - return { - 'clangd', - '--background-index', - '--clang-tidy', - '--header-insertion=never', - '--query-driver=' .. vim.fn.exepath 'clang++', - '--resource-dir=' .. vim.fn.trim(vim.fn.system 'clang++ --print-resource-dir'), - '--compile-commands-dir=' .. commands_dir, - } - end +local M = {} - local function reload_clangd(commands_dir) - commands_dir = commands_dir or './build/debug' - local lspconfig = require 'lspconfig' +M.clang_filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' } - lspconfig.clangd.setup { - cmd = build_cmd(commands_dir), - root_dir = lspconfig.util.root_pattern '.git', - single_file_support = true, - capabilities = require('blink.cmp').get_lsp_capabilities(), - } +local lspconfig = require 'lspconfig' - vim.cmd.edit() +local function find_compile_commands() + local lines = vim.fn.systemlist { 'fd', '-u', '-t', 'f', 'compile_commands.json' } + table.sort(lines, function(a, b) + return a:match 'debug' and not b:match 'debug' + end) + return vim.fn.fnamemodify(lines[1] or '', ':h') +end + +function M.stop_clangd() + for _, client in ipairs(vim.lsp.get_clients()) do + if client.name == 'clangd' then + client.stop() end + end +end + +function M.setup_clangd(commands_dir) + M.stop_clangd() + + lspconfig.clangd.setup { + cmd = { + 'clangd', + '--background-index', + '--clang-tidy', + '--header-insertion=never', + '--query-driver=' .. vim.fn.exepath 'clang++', + '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], + '--compile-commands-dir=' .. (commands_dir or '.'), + }, + root_dir = lspconfig.util.root_pattern '.git', + single_file_support = true, + capabilities = require('blink.cmp').get_lsp_capabilities(), + } - local function pick_commands_dir() - local pickers = require 'telescope.pickers' - local finders = require 'telescope.finders' - local conf = require('telescope.config').values - pickers - .new({}, { - prompt_title = 'Choose compile_commands.json location', - finder = finders.new_oneshot_job { 'fd', '-u', 'compile_commands.json', '-x', 'dirname', '{}' }, - sorter = conf.generic_sorter {}, - attach_mappings = function(_, map) - map('i', '', function(prompt_bufnr) - local entry = require('telescope.actions.state').get_selected_entry() - local commands_dir = entry[1] - require('telescope.actions').close(prompt_bufnr) - reload_clangd(commands_dir) - end) - return true - end, - }) - :find() + for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do + local ft = vim.api.nvim_buf_get_option(bufnr, 'filetype') + if vim.tbl_contains(M.clang_filetypes, ft) then + vim.lsp.buf_attach_client(bufnr, vim.lsp.get_active_clients({ name = 'clangd' })[1].id) end + end +end - reload_clangd() +function M.pick_commands_dir() + local pickers = require 'telescope.pickers' + local finders = require 'telescope.finders' + local conf = require('telescope.config').values + pickers + .new({}, { + prompt_title = 'Choose compile_commands.json location', + finder = finders.new_oneshot_job { 'fd', '-u', 'compile_commands.json', '-x', 'dirname', '{}' }, + sorter = conf.generic_sorter {}, + attach_mappings = function(_, map) + map('i', '', function(prompt_bufnr) + local entry = require('telescope.actions.state').get_selected_entry() + local commands_dir = entry[1] + require('telescope.actions').close(prompt_bufnr) + reload_clangd(commands_dir) + end) + return true + end, + }) + :find() +end + +function M.watch_compile_commands() + local uv = vim.uv or vim.loop + local watcher = uv.new_fs_event() + local cwd = vim.fn.getcwd() + + watcher:start( + cwd, + { recursive = true }, + vim.schedule_wrap(function(_, fname, status) + if fname and fname:match 'compile_commands%.json$' and status.change then + watcher:stop() + M.setup_clangd(vim.fn.fnamemodify(fname, ':h')) + end + end) + ) +end + +return { + 'neovim/nvim-lspconfig', + ft = M.clang_filetypes, + config = function() + local dir = find_compile_commands() + if dir ~= '' then + M.setup_clangd(dir) + else + M.watch_compile_commands() + end vim.keymap.set('n', 'cc', pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) end, From 683627659e31dd0ae1d627653a988feee0d63190 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 00:58:41 +1200 Subject: [PATCH 378/480] typo --- lua/custom/plugins/lsp/clangd.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 198d0f41e2a..2767eae1a50 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -96,6 +96,6 @@ return { M.watch_compile_commands() end - vim.keymap.set('n', 'cc', pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) + vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) end, } From 1ba09dc67b079f3aa6c32a792e475c87150977a4 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 01:05:27 +1200 Subject: [PATCH 379/480] typo --- lua/custom/plugins/lsp/clangd.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 2767eae1a50..54243420924 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -60,7 +60,8 @@ function M.pick_commands_dir() local entry = require('telescope.actions.state').get_selected_entry() local commands_dir = entry[1] require('telescope.actions').close(prompt_bufnr) - reload_clangd(commands_dir) + if commands_dir ~= '' then + M.setup_clangd(commands_dir) end) return true end, From 5d7b298adc164cf022f458a3bc189791f768a4d9 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 01:12:36 +1200 Subject: [PATCH 380/480] changed deprecated cmd --- lua/custom/plugins/lsp/clangd.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 54243420924..cc4ea828359 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -39,9 +39,9 @@ function M.setup_clangd(commands_dir) } for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do - local ft = vim.api.nvim_buf_get_option(bufnr, 'filetype') + local ft = vim.api.nvim_get_option_value('filetype', { buf = bufnr }) if vim.tbl_contains(M.clang_filetypes, ft) then - vim.lsp.buf_attach_client(bufnr, vim.lsp.get_active_clients({ name = 'clangd' })[1].id) + vim.lsp.buf_attach_client(bufnr, vim.lsp.get_clients({ name = 'clangd' })[1].id) end end end @@ -62,6 +62,7 @@ function M.pick_commands_dir() require('telescope.actions').close(prompt_bufnr) if commands_dir ~= '' then M.setup_clangd(commands_dir) + end end) return true end, From 14138a6b2a50d06ca5cb83baedeaf5549a025289 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 01:15:53 +1200 Subject: [PATCH 381/480] force shutdown --- lua/custom/plugins/lsp/clangd.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index cc4ea828359..922ed559f70 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -15,7 +15,7 @@ end function M.stop_clangd() for _, client in ipairs(vim.lsp.get_clients()) do if client.name == 'clangd' then - client.stop() + client.stop { force = true } end end end From fd43193eee00c5ea44cb81e1f1d26888f0187869 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 01:31:04 +1200 Subject: [PATCH 382/480] debugging watcher --- lua/custom/plugins/lsp/clangd.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 922ed559f70..3695ea90796 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -3,6 +3,7 @@ local M = {} M.clang_filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' } local lspconfig = require 'lspconfig' +local watcher = nil local function find_compile_commands() local lines = vim.fn.systemlist { 'fd', '-u', '-t', 'f', 'compile_commands.json' } @@ -21,6 +22,7 @@ function M.stop_clangd() end function M.setup_clangd(commands_dir) + vim.notify('[clangd] Setting up with: ' .. commands_dir) M.stop_clangd() lspconfig.clangd.setup { @@ -71,16 +73,23 @@ function M.pick_commands_dir() end function M.watch_compile_commands() + if watcher then + return + end + local uv = vim.uv or vim.loop - local watcher = uv.new_fs_event() + watcher = uv.new_fs_event() local cwd = vim.fn.getcwd() + vim.notify('clangd: Watching for compile_commands.json in ' .. cwd, vim.log.levels.INFO) watcher:start( cwd, { recursive = true }, vim.schedule_wrap(function(_, fname, status) if fname and fname:match 'compile_commands%.json$' and status.change then + vim.notify('[clangd] Detected change: ' .. fname, vim.log.levels.INFO) watcher:stop() + watcher = nil M.setup_clangd(vim.fn.fnamemodify(fname, ':h')) end end) From bb078e642e3fc4d9029dc70fbfb31830118ba002 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 01:42:30 +1200 Subject: [PATCH 383/480] debugging watcher --- lua/custom/plugins/lsp/clangd.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 3695ea90796..52d3cf55153 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -3,7 +3,7 @@ local M = {} M.clang_filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' } local lspconfig = require 'lspconfig' -local watcher = nil +local watcher local function find_compile_commands() local lines = vim.fn.systemlist { 'fd', '-u', '-t', 'f', 'compile_commands.json' } @@ -17,6 +17,7 @@ function M.stop_clangd() for _, client in ipairs(vim.lsp.get_clients()) do if client.name == 'clangd' then client.stop { force = true } + vim.notify '[clangd] stopped clangd' end end end @@ -77,11 +78,11 @@ function M.watch_compile_commands() return end + vim.notify('clangd: Starting watcher for compile_commands.json', vim.log.levels.INFO) local uv = vim.uv or vim.loop watcher = uv.new_fs_event() local cwd = vim.fn.getcwd() - vim.notify('clangd: Watching for compile_commands.json in ' .. cwd, vim.log.levels.INFO) watcher:start( cwd, { recursive = true }, @@ -101,6 +102,7 @@ return { ft = M.clang_filetypes, config = function() local dir = find_compile_commands() + vim.notify('[clangd] Found compile_commands at: ' .. dir) if dir ~= '' then M.setup_clangd(dir) else From 8c2846693728d6b87c8d3b09fa0e8ab494d7d4b7 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 01:50:13 +1200 Subject: [PATCH 384/480] debugging watcher --- lua/custom/plugins/lsp/clangd.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 52d3cf55153..9a014a2177c 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -7,10 +7,16 @@ local watcher local function find_compile_commands() local lines = vim.fn.systemlist { 'fd', '-u', '-t', 'f', 'compile_commands.json' } + + if vim.tbl_isempty(lines) then + return nil + end + table.sort(lines, function(a, b) return a:match 'debug' and not b:match 'debug' end) - return vim.fn.fnamemodify(lines[1] or '', ':h') + + return vim.fn.fnamemodify(lines[1], ':h') end function M.stop_clangd() @@ -102,10 +108,11 @@ return { ft = M.clang_filetypes, config = function() local dir = find_compile_commands() - vim.notify('[clangd] Found compile_commands at: ' .. dir) - if dir ~= '' then + if dir then + vim.notify('[clangd] Found compile_commands at: ' .. dir) M.setup_clangd(dir) else + vim.notify '[clangd] No compile_commands found, watching ...' M.watch_compile_commands() end From 9169d2f78937a5d2e22f828e35478e051e3754c6 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 02:08:35 +1200 Subject: [PATCH 385/480] debugging watcher --- init.lua | 3 --- lua/custom/plugins/lsp/clangd.lua | 12 ++++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/init.lua b/init.lua index bbb648166bd..29f39c87c1f 100644 --- a/init.lua +++ b/init.lua @@ -956,9 +956,6 @@ require('lazy').setup({ -- In normal mode type `sh` then write `lazy.nvim-plugin` -- you can continue same window with `sr` which resumes last telescope search }, { - -- rocks = { - -- enabled = false, - -- }, ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 9a014a2177c..c1f8b0387b0 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -47,12 +47,12 @@ function M.setup_clangd(commands_dir) capabilities = require('blink.cmp').get_lsp_capabilities(), } - for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do - local ft = vim.api.nvim_get_option_value('filetype', { buf = bufnr }) - if vim.tbl_contains(M.clang_filetypes, ft) then - vim.lsp.buf_attach_client(bufnr, vim.lsp.get_clients({ name = 'clangd' })[1].id) - end - end + -- for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do + -- local ft = vim.api.nvim_get_option_value('filetype', { buf = bufnr }) + -- if vim.tbl_contains(M.clang_filetypes, ft) then + -- vim.lsp.buf_attach_client(bufnr, vim.lsp.get_clients({ name = 'clangd' })[1].id) + -- end + -- end end function M.pick_commands_dir() From 4c6d17824cdd85edb080362f317f9002b163845b Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 02:14:17 +1200 Subject: [PATCH 386/480] debugging watcher --- lua/custom/plugins/lsp/clangd.lua | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index c1f8b0387b0..7ceb8901b21 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -107,14 +107,19 @@ return { 'neovim/nvim-lspconfig', ft = M.clang_filetypes, config = function() - local dir = find_compile_commands() - if dir then - vim.notify('[clangd] Found compile_commands at: ' .. dir) - M.setup_clangd(dir) - else - vim.notify '[clangd] No compile_commands found, watching ...' - M.watch_compile_commands() - end + vim.api.nvim_create_autocmd('FileType', { + pattern = M.clang_filetypes, + callback = function() + local dir = find_compile_commands() + if dir then + vim.notify('[clangd] Found compile_commands at: ' .. dir) + M.setup_clangd(dir) + else + vim.notify '[clangd] No compile_commands found, watching ...' + M.watch_compile_commands() + end + end, + }) vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) end, From c77e2e0a995693ff09f44c2de7c5cf0ec1d2e2f5 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 02:29:30 +1200 Subject: [PATCH 387/480] debugging watcher --- lua/custom/plugins/lsp/clangd.lua | 48 ++++++++++++++++++------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 7ceb8901b21..ed1e90d9025 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -7,15 +7,12 @@ local watcher local function find_compile_commands() local lines = vim.fn.systemlist { 'fd', '-u', '-t', 'f', 'compile_commands.json' } - if vim.tbl_isempty(lines) then return nil end - table.sort(lines, function(a, b) return a:match 'debug' and not b:match 'debug' end) - return vim.fn.fnamemodify(lines[1], ':h') end @@ -80,27 +77,38 @@ function M.pick_commands_dir() end function M.watch_compile_commands() - if watcher then - return - end - vim.notify('clangd: Starting watcher for compile_commands.json', vim.log.levels.INFO) local uv = vim.uv or vim.loop - watcher = uv.new_fs_event() - local cwd = vim.fn.getcwd() + local check_interval = 1000 -- ms + + local function try_attach() + local dir = find_compile_commands() + if dir then + vim.notify('[clangd] Found compile_commands at: ' .. dir) + M.setup_clangd(dir) + return true + end + return false + end + + local timer = uv.new_timer() + timer:start(0, check_interval, function() + if try_attach() then + timer:stop() + timer:close() + end + end) - watcher:start( - cwd, - { recursive = true }, - vim.schedule_wrap(function(_, fname, status) - if fname and fname:match 'compile_commands%.json$' and status.change then - vim.notify('[clangd] Detected change: ' .. fname, vim.log.levels.INFO) - watcher:stop() - watcher = nil + local fs_watcher = uv.new_fs_event() + fs_watcher:start(vim.fn.getcwd(), { recursive = true }, function(_, fname, status) + if fname and fname:match 'compile_commands%.json$' and status.change then + fs_watcher:stop() + vim.schedule(function() + vim.notify '[clangd] Detected compile_commands.json change, reloading ...' M.setup_clangd(vim.fn.fnamemodify(fname, ':h')) - end - end) - ) + end) + end + end) end return { From 75add61c7ffeee45ff10f3651edd137e7d3381b7 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 02:57:52 +1200 Subject: [PATCH 388/480] simplified clangd setup --- lua/custom/plugins/lsp/clangd.lua | 152 +++++++++++++++--------------- 1 file changed, 75 insertions(+), 77 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index ed1e90d9025..2804c3046a2 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -1,19 +1,14 @@ local M = {} - M.clang_filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' } local lspconfig = require 'lspconfig' -local watcher local function find_compile_commands() - local lines = vim.fn.systemlist { 'fd', '-u', '-t', 'f', 'compile_commands.json' } - if vim.tbl_isempty(lines) then - return nil - end - table.sort(lines, function(a, b) + local results = vim.fn.systemlist { 'fd', '-u', '-t', 'f', 'compile_commands.json' } + table.sort(results, function(a, b) return a:match 'debug' and not b:match 'debug' end) - return vim.fn.fnamemodify(lines[1], ':h') + return results[1] and vim.fn.fnamemodify(results[1], ':h') or nil end function M.stop_clangd() @@ -25,31 +20,39 @@ function M.stop_clangd() end end -function M.setup_clangd(commands_dir) - vim.notify('[clangd] Setting up with: ' .. commands_dir) +function M.start_clangd(commands_dir) M.stop_clangd() + local cmd = { + 'clangd', + '--background-index', + '--clang-tidy', + '--header-insertion=never', + '--query-driver=' .. vim.fn.exepath 'clang++', + '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], + } + if commands_dir then + table.insert(cmd, '--compile_commands-dir=' .. commands_dir) + end + lspconfig.clangd.setup { - cmd = { - 'clangd', - '--background-index', - '--clang-tidy', - '--header-insertion=never', - '--query-driver=' .. vim.fn.exepath 'clang++', - '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], - '--compile-commands-dir=' .. (commands_dir or '.'), - }, + cmd = cmd, root_dir = lspconfig.util.root_pattern '.git', - single_file_support = true, + -- single_file_support = true, capabilities = require('blink.cmp').get_lsp_capabilities(), } - -- for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do - -- local ft = vim.api.nvim_get_option_value('filetype', { buf = bufnr }) - -- if vim.tbl_contains(M.clang_filetypes, ft) then - -- vim.lsp.buf_attach_client(bufnr, vim.lsp.get_clients({ name = 'clangd' })[1].id) - -- end - -- end + vim.defer_fn(function() + for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do + local ft = vim.api.nvim_get_option_value('filetype', { buf = bufnr }) + if vim.tbl_contains(M.clang_filetypes, ft) then + local client = vim.lsp.get_clients({ name = 'clangd' })[1] + if client then + vim.lsp.buf_attach_client(bufnr, client.id) + end + end + end + end, 100) end function M.pick_commands_dir() @@ -58,16 +61,16 @@ function M.pick_commands_dir() local conf = require('telescope.config').values pickers .new({}, { - prompt_title = 'Choose compile_commands.json location', + prompt_title = 'Pick compile_commands.json dir', finder = finders.new_oneshot_job { 'fd', '-u', 'compile_commands.json', '-x', 'dirname', '{}' }, sorter = conf.generic_sorter {}, attach_mappings = function(_, map) map('i', '', function(prompt_bufnr) local entry = require('telescope.actions.state').get_selected_entry() - local commands_dir = entry[1] + local dir = entry[1] require('telescope.actions').close(prompt_bufnr) - if commands_dir ~= '' then - M.setup_clangd(commands_dir) + if dir then + M.start_clangd(dir) end end) return true @@ -76,58 +79,53 @@ function M.pick_commands_dir() :find() end -function M.watch_compile_commands() - vim.notify('clangd: Starting watcher for compile_commands.json', vim.log.levels.INFO) - local uv = vim.uv or vim.loop - local check_interval = 1000 -- ms - - local function try_attach() - local dir = find_compile_commands() - if dir then - vim.notify('[clangd] Found compile_commands at: ' .. dir) - M.setup_clangd(dir) - return true - end - return false - end - - local timer = uv.new_timer() - timer:start(0, check_interval, function() - if try_attach() then - timer:stop() - timer:close() - end - end) - - local fs_watcher = uv.new_fs_event() - fs_watcher:start(vim.fn.getcwd(), { recursive = true }, function(_, fname, status) - if fname and fname:match 'compile_commands%.json$' and status.change then - fs_watcher:stop() - vim.schedule(function() - vim.notify '[clangd] Detected compile_commands.json change, reloading ...' - M.setup_clangd(vim.fn.fnamemodify(fname, ':h')) - end) - end - end) -end +-- function M.watch_compile_commands() +-- vim.notify('clangd: Starting watcher for compile_commands.json', vim.log.levels.INFO) +-- local uv = vim.uv or vim.loop +-- local check_interval = 1000 -- ms +-- +-- local function try_attach() +-- local dir = find_compile_commands() +-- if dir then +-- vim.notify('[clangd] Found compile_commands at: ' .. dir) +-- M.setup_clangd(dir) +-- return true +-- end +-- return false +-- end +-- +-- local timer = uv.new_timer() +-- timer:start(0, check_interval, function() +-- if try_attach() then +-- timer:stop() +-- timer:close() +-- end +-- end) +-- +-- local fs_watcher = uv.new_fs_event() +-- fs_watcher:start(vim.fn.getcwd(), { recursive = true }, function(_, fname, status) +-- if fname and fname:match 'compile_commands%.json$' and status.change then +-- fs_watcher:stop() +-- vim.schedule(function() +-- vim.notify '[clangd] Detected compile_commands.json change, reloading ...' +-- M.setup_clangd(vim.fn.fnamemodify(fname, ':h')) +-- end) +-- end +-- end) +-- end return { 'neovim/nvim-lspconfig', ft = M.clang_filetypes, config = function() - vim.api.nvim_create_autocmd('FileType', { - pattern = M.clang_filetypes, - callback = function() - local dir = find_compile_commands() - if dir then - vim.notify('[clangd] Found compile_commands at: ' .. dir) - M.setup_clangd(dir) - else - vim.notify '[clangd] No compile_commands found, watching ...' - M.watch_compile_commands() - end - end, - }) + local dir = find_compile_commands() + if dir then + vim.notify('[clangd] Starting with compile_commands from: ' .. dir) + M.start_clangd(dir) + else + vim.notify '[clangd] No compile_commands found. Using fallback config.\nUse cc to manually set location.' + M.start_clangd(nil) + end vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) end, From de83e49f9006e05beba8c864de706d7d7c16e74a Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 03:04:57 +1200 Subject: [PATCH 389/480] simplified clangd setup --- lua/custom/plugins/lsp/clangd.lua | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 2804c3046a2..7784b1e9f76 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -118,14 +118,22 @@ return { 'neovim/nvim-lspconfig', ft = M.clang_filetypes, config = function() - local dir = find_compile_commands() - if dir then - vim.notify('[clangd] Starting with compile_commands from: ' .. dir) - M.start_clangd(dir) - else - vim.notify '[clangd] No compile_commands found. Using fallback config.\nUse cc to manually set location.' - M.start_clangd(nil) - end + vim.api.nvim_create_autocmd('FileType', { + pattern = M.clang_filetypes, + group = vim.api.nvim_create_autocmd('clangd-setup', { clear = true }), + callback = function() + if not vim.lsp.get_clients({ name = 'clangd' })[1] then + local dir = find_compile_commands() + if dir then + vim.notify('[clangd] Starting with compile_commands from: ' .. dir) + M.start_clangd(dir) + else + vim.notify '[clangd] No compile_commands found. Using fallback config.\nUse cc to manually set location.' + M.start_clangd(nil) + end + end + end, + }) vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) end, From 352054c7636059bec8ba825dc4338557177c918a Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 03:07:51 +1200 Subject: [PATCH 390/480] typo --- lua/custom/plugins/lsp/clangd.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 7784b1e9f76..1dfa8e3ce66 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -120,7 +120,7 @@ return { config = function() vim.api.nvim_create_autocmd('FileType', { pattern = M.clang_filetypes, - group = vim.api.nvim_create_autocmd('clangd-setup', { clear = true }), + group = vim.api.nvim_create_augroup('clangd-setup', { clear = true }), callback = function() if not vim.lsp.get_clients({ name = 'clangd' })[1] then local dir = find_compile_commands() From 08ff4fe831a96418dc280d61e8cd85c613231fb4 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 03:18:44 +1200 Subject: [PATCH 391/480] typo --- lua/custom/plugins/lsp/clangd.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 1dfa8e3ce66..87ec8008782 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -35,6 +35,8 @@ function M.start_clangd(commands_dir) table.insert(cmd, '--compile_commands-dir=' .. commands_dir) end + print(vim.inspect(cmd)) + lspconfig.clangd.setup { cmd = cmd, root_dir = lspconfig.util.root_pattern '.git', From ee0741597fdd4f34da4bf54ffd25600633b5abe0 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 03:22:07 +1200 Subject: [PATCH 392/480] typo --- lua/custom/plugins/lsp/clangd.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 87ec8008782..4ab40954886 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -32,7 +32,7 @@ function M.start_clangd(commands_dir) '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], } if commands_dir then - table.insert(cmd, '--compile_commands-dir=' .. commands_dir) + table.insert(cmd, '--compile-commands-dir=' .. commands_dir) end print(vim.inspect(cmd)) From d523eeb957983504def18573085549515c8ccb9a Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 03:42:06 +1200 Subject: [PATCH 393/480] refactor --- lua/custom/plugins/lsp/clangd.lua | 84 ++++++++++++++++++------------- 1 file changed, 48 insertions(+), 36 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 4ab40954886..14191439d58 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -8,7 +8,7 @@ local function find_compile_commands() table.sort(results, function(a, b) return a:match 'debug' and not b:match 'debug' end) - return results[1] and vim.fn.fnamemodify(results[1], ':h') or nil + return vim.fn.fnamemodify(results[1] or '', ':h') end function M.stop_clangd() @@ -20,7 +20,7 @@ function M.stop_clangd() end end -function M.start_clangd(commands_dir) +function M.start_clangd(dir) M.stop_clangd() local cmd = { @@ -31,32 +31,43 @@ function M.start_clangd(commands_dir) '--query-driver=' .. vim.fn.exepath 'clang++', '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], } - if commands_dir then - table.insert(cmd, '--compile-commands-dir=' .. commands_dir) + if dir and dir ~= '' then + table.insert(cmd, '--compile-commands-dir=' .. dir) + vim.notify('[clangd] Setting up with: ' .. dir) + else + table.insert(cmd, '--compile-commands-dir=.') + vim.notify '[clangd] No compile_commands.json found.\nUse cc to manually set location' end - print(vim.inspect(cmd)) - lspconfig.clangd.setup { cmd = cmd, + filetypes = M.clang_filetypes, root_dir = lspconfig.util.root_pattern '.git', - -- single_file_support = true, capabilities = require('blink.cmp').get_lsp_capabilities(), + single_file_support = true, } +end + +function M.reload_clangd() + M.stop_clangd() vim.defer_fn(function() - for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do - local ft = vim.api.nvim_get_option_value('filetype', { buf = bufnr }) - if vim.tbl_contains(M.clang_filetypes, ft) then - local client = vim.lsp.get_clients({ name = 'clangd' })[1] - if client then - vim.lsp.buf_attach_client(bufnr, client.id) - end - end - end + M.start_clangd(find_compile_commands()) end, 100) end +-- for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do +-- local ft = vim.api.nvim_get_option_value('filetype', { buf = bufnr }) +-- if vim.tbl_contains(M.clang_filetypes, ft) then +-- local client = vim.lsp.get_clients({ name = 'clangd' })[1] +-- if client then +-- vim.lsp.buf_attach_client(bufnr, client.id) +-- end +-- end +-- end +-- end, 100) +-- end + function M.pick_commands_dir() local pickers = require 'telescope.pickers' local finders = require 'telescope.finders' @@ -69,11 +80,11 @@ function M.pick_commands_dir() attach_mappings = function(_, map) map('i', '', function(prompt_bufnr) local entry = require('telescope.actions.state').get_selected_entry() - local dir = entry[1] require('telescope.actions').close(prompt_bufnr) - if dir then - M.start_clangd(dir) - end + M.stop_clangd() + vim.defer_fn(function() + M.start_clangd(entry[1]) + end, 100) end) return true end, @@ -120,22 +131,23 @@ return { 'neovim/nvim-lspconfig', ft = M.clang_filetypes, config = function() - vim.api.nvim_create_autocmd('FileType', { - pattern = M.clang_filetypes, - group = vim.api.nvim_create_augroup('clangd-setup', { clear = true }), - callback = function() - if not vim.lsp.get_clients({ name = 'clangd' })[1] then - local dir = find_compile_commands() - if dir then - vim.notify('[clangd] Starting with compile_commands from: ' .. dir) - M.start_clangd(dir) - else - vim.notify '[clangd] No compile_commands found. Using fallback config.\nUse cc to manually set location.' - M.start_clangd(nil) - end - end - end, - }) + -- vim.api.nvim_create_autocmd('FileType', { + -- pattern = M.clang_filetypes, + -- group = vim.api.nvim_create_augroup('clangd-setup', { clear = true }), + -- callback = function() + -- if not vim.lsp.get_clients({ name = 'clangd' })[1] then + -- local dir = find_compile_commands() + -- if dir then + -- vim.notify('[clangd] Starting with compile_commands from: ' .. dir) + -- M.start_clangd(dir) + -- else + -- vim.notify '[clangd] No compile_commands found. Using fallback config.\nUse cc to manually set location.' + -- M.start_clangd(nil) + -- end + -- end + -- end, + -- }) + M.start_clangd(find_compile_commands()) vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) end, From b2038d37887f53c30e6efef2d4b5603f8a1c92f9 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 04:10:53 +1200 Subject: [PATCH 394/480] try watch compile_config --- lua/custom/plugins/lsp/clangd.lua | 115 +++++++++++++----------------- 1 file changed, 48 insertions(+), 67 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 14191439d58..a9bed36d2b5 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -14,8 +14,10 @@ end function M.stop_clangd() for _, client in ipairs(vim.lsp.get_clients()) do if client.name == 'clangd' then - client.stop { force = true } - vim.notify '[clangd] stopped clangd' + pcall(function() + client.stop { force = true } + end) + vim.notify '[clangd] Stopped clangd' end end end @@ -32,11 +34,11 @@ function M.start_clangd(dir) '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], } if dir and dir ~= '' then - table.insert(cmd, '--compile-commands-dir=' .. dir) vim.notify('[clangd] Setting up with: ' .. dir) + table.insert(cmd, '--compile-commands-dir=' .. dir) else - table.insert(cmd, '--compile-commands-dir=.') vim.notify '[clangd] No compile_commands.json found.\nUse cc to manually set location' + table.insert(cmd, '--compile-commands-dir=.') end lspconfig.clangd.setup { @@ -56,18 +58,6 @@ function M.reload_clangd() end, 100) end --- for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do --- local ft = vim.api.nvim_get_option_value('filetype', { buf = bufnr }) --- if vim.tbl_contains(M.clang_filetypes, ft) then --- local client = vim.lsp.get_clients({ name = 'clangd' })[1] --- if client then --- vim.lsp.buf_attach_client(bufnr, client.id) --- end --- end --- end --- end, 100) --- end - function M.pick_commands_dir() local pickers = require 'telescope.pickers' local finders = require 'telescope.finders' @@ -92,62 +82,53 @@ function M.pick_commands_dir() :find() end --- function M.watch_compile_commands() --- vim.notify('clangd: Starting watcher for compile_commands.json', vim.log.levels.INFO) --- local uv = vim.uv or vim.loop --- local check_interval = 1000 -- ms --- --- local function try_attach() --- local dir = find_compile_commands() --- if dir then --- vim.notify('[clangd] Found compile_commands at: ' .. dir) --- M.setup_clangd(dir) --- return true --- end --- return false --- end --- --- local timer = uv.new_timer() --- timer:start(0, check_interval, function() --- if try_attach() then --- timer:stop() --- timer:close() --- end --- end) --- --- local fs_watcher = uv.new_fs_event() --- fs_watcher:start(vim.fn.getcwd(), { recursive = true }, function(_, fname, status) --- if fname and fname:match 'compile_commands%.json$' and status.change then --- fs_watcher:stop() --- vim.schedule(function() --- vim.notify '[clangd] Detected compile_commands.json change, reloading ...' --- M.setup_clangd(vim.fn.fnamemodify(fname, ':h')) --- end) --- end --- end) --- end +function M.watch_compile_commands(dir) + local uv = vim.uv or vim.loop + local watcher = uv.new_fs_event() + local debounce_timer + + local watch_path = dir or vim.fn.getcwd() + local watch_file = watch_path .. '/compile_commands.json' + + if not vim.fn.filereadable(watch_file) then + return + end + + watcher:start(watch_path, { recursive = true }, function(err, fname, status) + if err then + vim.schedule(function() + vim.notify('[clangd] Watcher error: ' .. err, vim.log.levels.ERROR) + end) + return + end + if fname and fname:match 'compile_commands%.json$' and status.change then + if debounce_timer then + debounce_timer.stop() + debounce_timer.close() + end + debounce_timer = uv.new_timer() + debounce_timer:start(200, 0, function() + vim.schedule(function() + vim.notify '[clangd] Detected compile_commands.json change. Reloading ...' + -- M.start_clangd(watch_path) + M.reload_clangd() + end) + end) + end + end) + + vim.notify('[clangd] Watching: ' .. watch_file) +end return { 'neovim/nvim-lspconfig', ft = M.clang_filetypes, config = function() - -- vim.api.nvim_create_autocmd('FileType', { - -- pattern = M.clang_filetypes, - -- group = vim.api.nvim_create_augroup('clangd-setup', { clear = true }), - -- callback = function() - -- if not vim.lsp.get_clients({ name = 'clangd' })[1] then - -- local dir = find_compile_commands() - -- if dir then - -- vim.notify('[clangd] Starting with compile_commands from: ' .. dir) - -- M.start_clangd(dir) - -- else - -- vim.notify '[clangd] No compile_commands found. Using fallback config.\nUse cc to manually set location.' - -- M.start_clangd(nil) - -- end - -- end - -- end, - -- }) - M.start_clangd(find_compile_commands()) + local dir = find_compile_commands() + M.start_clangd(dir) + if dir ~= '' then + M.watch_compile_commands(dir) + end vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) end, From 381206c8f21e6db207eb6d383cc3324d1dbfb415 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 04:33:51 +1200 Subject: [PATCH 395/480] try watch compile_config --- lua/custom/plugins/lsp/clangd.lua | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index a9bed36d2b5..16a78ed46ed 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -124,12 +124,22 @@ return { 'neovim/nvim-lspconfig', ft = M.clang_filetypes, config = function() - local dir = find_compile_commands() - M.start_clangd(dir) - if dir ~= '' then - M.watch_compile_commands(dir) - end - - vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) + vim.api.nvim_create_autocmd('BufReadPost', { + group = vim.api.nvim_create_augroup('clangd-lazy-init', { clear = true }), + pattern = '*', + callback = function(args) + local ft = vim.bo[args.buf].filetype + if vim.tbl_contains(M.clang_filetypes, ft) then + local dir = find_compile_commands() + M.start_clangd(dir) + if dir ~= '' then + M.watch_compile_commands(dir) + end + + vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) + vim.api.nvim_clear_autocmds { group = 'clangd-lazy-init' } + end + end, + }) end, } From 386cb4d2fff3f3412c7dbf8f8c6df63f09fa8853 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 04:48:00 +1200 Subject: [PATCH 396/480] try watch compile_config --- lua/custom/plugins/lsp/clangd.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 16a78ed46ed..77c77b5983e 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -95,6 +95,7 @@ function M.watch_compile_commands(dir) end watcher:start(watch_path, { recursive = true }, function(err, fname, status) + print('[clangd] Watcher triggered: ', fname, vim.inspect(status)) if err then vim.schedule(function() vim.notify('[clangd] Watcher error: ' .. err, vim.log.levels.ERROR) @@ -110,8 +111,8 @@ function M.watch_compile_commands(dir) debounce_timer:start(200, 0, function() vim.schedule(function() vim.notify '[clangd] Detected compile_commands.json change. Reloading ...' - -- M.start_clangd(watch_path) - M.reload_clangd() + watcher:stop() + M.start_clangd(vim.fn.fnamemodify(fname, ':h') end) end) end From e11a8036d615f84015457cf4b88dcd5fc0c7613f Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 04:51:09 +1200 Subject: [PATCH 397/480] typo --- lua/custom/plugins/lsp/clangd.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 77c77b5983e..c5f43217392 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -112,7 +112,7 @@ function M.watch_compile_commands(dir) vim.schedule(function() vim.notify '[clangd] Detected compile_commands.json change. Reloading ...' watcher:stop() - M.start_clangd(vim.fn.fnamemodify(fname, ':h') + M.start_clangd(vim.fn.fnamemodify(fname, ':h')) end) end) end From ec295c9438fc07dc4cc6d2eaea694535ebf47488 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 04:56:46 +1200 Subject: [PATCH 398/480] debugging watcher --- lua/custom/plugins/lsp/clangd.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index c5f43217392..2707eea556f 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -95,13 +95,28 @@ function M.watch_compile_commands(dir) end watcher:start(watch_path, { recursive = true }, function(err, fname, status) - print('[clangd] Watcher triggered: ', fname, vim.inspect(status)) + vim.schedule(function() + print('[clangd] Watcher triggered: ', fname, vim.inspect(status)) + end) if err then vim.schedule(function() vim.notify('[clangd] Watcher error: ' .. err, vim.log.levels.ERROR) end) return end + + if fname then + vim.schedule(function() + vim.notify('[clangd] File triggered: ' .. fname) + end) + end + + if fname and fname:match 'compile_commands%.json$' and status.change then + vim.schedule(function() + vim.notify '[clangd] Matched pattern for compile_commands.json' + end) + end + if fname and fname:match 'compile_commands%.json$' and status.change then if debounce_timer then debounce_timer.stop() From 2232bed0b01bde97c2a6312a73e6f6f91687e714 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 05:07:12 +1200 Subject: [PATCH 399/480] debugging watcher --- lua/custom/plugins/lsp/clangd.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 2707eea556f..6880239b948 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -105,11 +105,11 @@ function M.watch_compile_commands(dir) return end - if fname then - vim.schedule(function() - vim.notify('[clangd] File triggered: ' .. fname) - end) - end + -- if fname then + -- vim.schedule(function() + -- vim.notify('[clangd] File triggered: ' .. fname) + -- end) + -- end if fname and fname:match 'compile_commands%.json$' and status.change then vim.schedule(function() From 01eb5e1bcc09226b85f0b87d97573464d6bcd0e8 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 05:14:08 +1200 Subject: [PATCH 400/480] debugging watcher --- lua/custom/plugins/lsp/clangd.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 6880239b948..72abe7c48db 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -95,9 +95,9 @@ function M.watch_compile_commands(dir) end watcher:start(watch_path, { recursive = true }, function(err, fname, status) - vim.schedule(function() - print('[clangd] Watcher triggered: ', fname, vim.inspect(status)) - end) + -- vim.schedule(function() + -- print('[clangd] Watcher triggered: ', fname, vim.inspect(status)) + -- end) if err then vim.schedule(function() vim.notify('[clangd] Watcher error: ' .. err, vim.log.levels.ERROR) From de6105eb2422b2981e21846c1950a0966621f3bc Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 05:34:43 +1200 Subject: [PATCH 401/480] debugging watcher --- lua/custom/plugins/lsp/clangd.lua | 81 +++++++++++++++---------------- 1 file changed, 38 insertions(+), 43 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 72abe7c48db..3b7388ef1ec 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -23,8 +23,6 @@ function M.stop_clangd() end function M.start_clangd(dir) - M.stop_clangd() - local cmd = { 'clangd', '--background-index', @@ -50,11 +48,13 @@ function M.start_clangd(dir) } end -function M.reload_clangd() +function M.reload_clangd(dir) M.stop_clangd() + dir = dir or find_compile_commands() + vim.defer_fn(function() - M.start_clangd(find_compile_commands()) + M.start_clangd(dir) end, 100) end @@ -82,10 +82,22 @@ function M.pick_commands_dir() :find() end +local watcher, debounce_timer + function M.watch_compile_commands(dir) local uv = vim.uv or vim.loop - local watcher = uv.new_fs_event() - local debounce_timer + + if watcher then + watcher:stop() + watcher:close() + watcher = nil + end + + if debounce_timer then + debounce_timer:stop() + debounce_timer:close() + debounce_timer = nil + end local watch_path = dir or vim.fn.getcwd() local watch_file = watch_path .. '/compile_commands.json' @@ -94,46 +106,29 @@ function M.watch_compile_commands(dir) return end - watcher:start(watch_path, { recursive = true }, function(err, fname, status) - -- vim.schedule(function() - -- print('[clangd] Watcher triggered: ', fname, vim.inspect(status)) - -- end) - if err then - vim.schedule(function() + watcher = uv.new_fs_event() + watcher:start( + watch_path, + { recursive = true }, + vim.schedule_wrap(function(err, fname, status) + if err then vim.notify('[clangd] Watcher error: ' .. err, vim.log.levels.ERROR) - end) - return - end - - -- if fname then - -- vim.schedule(function() - -- vim.notify('[clangd] File triggered: ' .. fname) - -- end) - -- end - - if fname and fname:match 'compile_commands%.json$' and status.change then - vim.schedule(function() - vim.notify '[clangd] Matched pattern for compile_commands.json' - end) - end - - if fname and fname:match 'compile_commands%.json$' and status.change then - if debounce_timer then - debounce_timer.stop() - debounce_timer.close() + return end - debounce_timer = uv.new_timer() - debounce_timer:start(200, 0, function() - vim.schedule(function() - vim.notify '[clangd] Detected compile_commands.json change. Reloading ...' - watcher:stop() - M.start_clangd(vim.fn.fnamemodify(fname, ':h')) - end) - end) - end - end) - vim.notify('[clangd] Watching: ' .. watch_file) + if fname and fname:match '.*/compile_commands%.json$' and status.change then + debounce_timer = uv.new_timer() + debounce_timer:start(200, 0, function() + vim.schedule(function() + vim.notify '[clangd] Detected compile_commands.json change. Reloading ...' + watch_path = vim.fn.fnamemodify(fname, ':h') + M.start_clangd(watch_path) + M.watch_compile_commands(watch_path) + end) + end) + end + end) + ) end return { From 3c60b5c14969dab66cadcd0bbc6b9e275a95843a Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 05:37:16 +1200 Subject: [PATCH 402/480] debugging watcher --- lua/custom/plugins/lsp/clangd.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 3b7388ef1ec..05acdc682d4 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -71,9 +71,8 @@ function M.pick_commands_dir() map('i', '', function(prompt_bufnr) local entry = require('telescope.actions.state').get_selected_entry() require('telescope.actions').close(prompt_bufnr) - M.stop_clangd() vim.defer_fn(function() - M.start_clangd(entry[1]) + M.reload_clangd(entry[1]) end, 100) end) return true @@ -122,7 +121,7 @@ function M.watch_compile_commands(dir) vim.schedule(function() vim.notify '[clangd] Detected compile_commands.json change. Reloading ...' watch_path = vim.fn.fnamemodify(fname, ':h') - M.start_clangd(watch_path) + M.reload_clangd(watch_path) M.watch_compile_commands(watch_path) end) end) From 642b4582d750acd19f9c3bea158b6491707d9e72 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 05:42:51 +1200 Subject: [PATCH 403/480] debugging watcher --- lua/custom/plugins/lsp/clangd.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 05acdc682d4..16a2af7577c 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -101,9 +101,9 @@ function M.watch_compile_commands(dir) local watch_path = dir or vim.fn.getcwd() local watch_file = watch_path .. '/compile_commands.json' - if not vim.fn.filereadable(watch_file) then - return - end + -- if not vim.fn.filereadable(watch_file) then + -- return + -- end watcher = uv.new_fs_event() watcher:start( From 42b3ab7480c6d56e5bd456adaf95d9e4a19880fa Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 05:57:55 +1200 Subject: [PATCH 404/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 69 ++++++++++++++----------------- 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 16a2af7577c..1caa8da5e85 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -1,5 +1,6 @@ local M = {} M.clang_filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' } +M.auto_watch_enabled = true local lspconfig = require 'lspconfig' @@ -23,6 +24,8 @@ function M.stop_clangd() end function M.start_clangd(dir) + M.stop_clangd() + local cmd = { 'clangd', '--background-index', @@ -48,39 +51,6 @@ function M.start_clangd(dir) } end -function M.reload_clangd(dir) - M.stop_clangd() - - dir = dir or find_compile_commands() - - vim.defer_fn(function() - M.start_clangd(dir) - end, 100) -end - -function M.pick_commands_dir() - local pickers = require 'telescope.pickers' - local finders = require 'telescope.finders' - local conf = require('telescope.config').values - pickers - .new({}, { - prompt_title = 'Pick compile_commands.json dir', - finder = finders.new_oneshot_job { 'fd', '-u', 'compile_commands.json', '-x', 'dirname', '{}' }, - sorter = conf.generic_sorter {}, - attach_mappings = function(_, map) - map('i', '', function(prompt_bufnr) - local entry = require('telescope.actions.state').get_selected_entry() - require('telescope.actions').close(prompt_bufnr) - vim.defer_fn(function() - M.reload_clangd(entry[1]) - end, 100) - end) - return true - end, - }) - :find() -end - local watcher, debounce_timer function M.watch_compile_commands(dir) @@ -101,9 +71,9 @@ function M.watch_compile_commands(dir) local watch_path = dir or vim.fn.getcwd() local watch_file = watch_path .. '/compile_commands.json' - -- if not vim.fn.filereadable(watch_file) then - -- return - -- end + if not M.auto_watch_enabled or not vim.fn.filereadable(watch_file) then + return + end watcher = uv.new_fs_event() watcher:start( @@ -121,7 +91,7 @@ function M.watch_compile_commands(dir) vim.schedule(function() vim.notify '[clangd] Detected compile_commands.json change. Reloading ...' watch_path = vim.fn.fnamemodify(fname, ':h') - M.reload_clangd(watch_path) + M.start_clangd(watch_path) M.watch_compile_commands(watch_path) end) end) @@ -130,6 +100,29 @@ function M.watch_compile_commands(dir) ) end +function M.pick_commands_dir() + local pickers = require 'telescope.pickers' + local finders = require 'telescope.finders' + local conf = require('telescope.config').values + pickers + .new({}, { + prompt_title = 'Pick compile_commands.json dir', + finder = finders.new_oneshot_job { 'fd', '-u', 'compile_commands.json', '-x', 'dirname', '{}' }, + sorter = conf.generic_sorter {}, + attach_mappings = function(_, map) + map('i', '', function(prompt_bufnr) + local entry = require('telescope.actions.state').get_selected_entry() + require('telescope.actions').close(prompt_bufnr) + vim.defer_fn(function() + M.reload_clangd(entry[1]) + end, 100) + end) + return true + end, + }) + :find() +end + return { 'neovim/nvim-lspconfig', ft = M.clang_filetypes, @@ -144,6 +137,8 @@ return { M.start_clangd(dir) if dir ~= '' then M.watch_compile_commands(dir) + else + M.watch_compile_commands() end vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) From 15ab4eb340ec20a905ddd983c3996c314807b7c5 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 06:03:40 +1200 Subject: [PATCH 405/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 1caa8da5e85..590e3b60889 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -127,9 +127,9 @@ return { 'neovim/nvim-lspconfig', ft = M.clang_filetypes, config = function() - vim.api.nvim_create_autocmd('BufReadPost', { + vim.api.nvim_create_autocmd('FileType', { group = vim.api.nvim_create_augroup('clangd-lazy-init', { clear = true }), - pattern = '*', + pattern = table.concat(M.clang_filetypes, ','), callback = function(args) local ft = vim.bo[args.buf].filetype if vim.tbl_contains(M.clang_filetypes, ft) then @@ -141,7 +141,7 @@ return { M.watch_compile_commands() end - vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) + vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd', buffer = args.buf }) vim.api.nvim_clear_autocmds { group = 'clangd-lazy-init' } end end, From 8cfb2a301911f797914b542b15351a7c9683bab8 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 06:06:55 +1200 Subject: [PATCH 406/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 590e3b60889..ec48c41389c 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -114,7 +114,7 @@ function M.pick_commands_dir() local entry = require('telescope.actions.state').get_selected_entry() require('telescope.actions').close(prompt_bufnr) vim.defer_fn(function() - M.reload_clangd(entry[1]) + M.start_clangd(entry[1]) end, 100) end) return true From a0f8c507c07aeb614e8d736e9bd067f6a5e71595 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 06:11:14 +1200 Subject: [PATCH 407/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index ec48c41389c..63db56f7497 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -127,24 +127,12 @@ return { 'neovim/nvim-lspconfig', ft = M.clang_filetypes, config = function() - vim.api.nvim_create_autocmd('FileType', { - group = vim.api.nvim_create_augroup('clangd-lazy-init', { clear = true }), - pattern = table.concat(M.clang_filetypes, ','), - callback = function(args) - local ft = vim.bo[args.buf].filetype - if vim.tbl_contains(M.clang_filetypes, ft) then - local dir = find_compile_commands() - M.start_clangd(dir) - if dir ~= '' then - M.watch_compile_commands(dir) - else - M.watch_compile_commands() - end - - vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd', buffer = args.buf }) - vim.api.nvim_clear_autocmds { group = 'clangd-lazy-init' } - end - end, - }) + local dir = find_compile_commands() + M.start_clangd(dir) + if dir ~= '' then + M.watch_compile_commands(dir) + end + + vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) end, } From bb455470ef212a00c3ace14f438f2fb7c995406b Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 06:13:37 +1200 Subject: [PATCH 408/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 63db56f7497..4fd92dc852c 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -71,9 +71,9 @@ function M.watch_compile_commands(dir) local watch_path = dir or vim.fn.getcwd() local watch_file = watch_path .. '/compile_commands.json' - if not M.auto_watch_enabled or not vim.fn.filereadable(watch_file) then - return - end + -- if not M.auto_watch_enabled or not vim.fn.filereadable(watch_file) then + -- return + -- end watcher = uv.new_fs_event() watcher:start( From a156e541cf7e6df2e88eb154f438a9c67b503ada Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 06:15:53 +1200 Subject: [PATCH 409/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 4fd92dc852c..c2cd5883dfa 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -129,9 +129,7 @@ return { config = function() local dir = find_compile_commands() M.start_clangd(dir) - if dir ~= '' then - M.watch_compile_commands(dir) - end + M.watch_compile_commands(dir) vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) end, From 927e58be65b073a5259682b6f6b7016997798796 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 06:24:25 +1200 Subject: [PATCH 410/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index c2cd5883dfa..1a30900eec6 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -127,6 +127,7 @@ return { 'neovim/nvim-lspconfig', ft = M.clang_filetypes, config = function() + vim.notify('[clangd] find_compile_commands() returned: "' .. dir .. '"') local dir = find_compile_commands() M.start_clangd(dir) M.watch_compile_commands(dir) From ae87dde99808a50d76cae36a8055fab5a04e2871 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 06:25:55 +1200 Subject: [PATCH 411/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 1a30900eec6..386e3a4e532 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -127,8 +127,8 @@ return { 'neovim/nvim-lspconfig', ft = M.clang_filetypes, config = function() - vim.notify('[clangd] find_compile_commands() returned: "' .. dir .. '"') local dir = find_compile_commands() + vim.notify('[clangd] find_compile_commands() returned: "' .. dir .. '"') M.start_clangd(dir) M.watch_compile_commands(dir) From 77e692566415d3977d4162a6675a0164387532d9 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 06:31:03 +1200 Subject: [PATCH 412/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 386e3a4e532..5f0d4fbf61a 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -71,9 +71,9 @@ function M.watch_compile_commands(dir) local watch_path = dir or vim.fn.getcwd() local watch_file = watch_path .. '/compile_commands.json' - -- if not M.auto_watch_enabled or not vim.fn.filereadable(watch_file) then - -- return - -- end + if not M.auto_watch_enabled or not vim.fn.filereadable(watch_file) then + return + end watcher = uv.new_fs_event() watcher:start( @@ -128,7 +128,6 @@ return { ft = M.clang_filetypes, config = function() local dir = find_compile_commands() - vim.notify('[clangd] find_compile_commands() returned: "' .. dir .. '"') M.start_clangd(dir) M.watch_compile_commands(dir) From 1fe74670553add05fef42262abbf540aad5a3183 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 06:40:31 +1200 Subject: [PATCH 413/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 5f0d4fbf61a..42f7772423d 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -37,9 +37,6 @@ function M.start_clangd(dir) if dir and dir ~= '' then vim.notify('[clangd] Setting up with: ' .. dir) table.insert(cmd, '--compile-commands-dir=' .. dir) - else - vim.notify '[clangd] No compile_commands.json found.\nUse cc to manually set location' - table.insert(cmd, '--compile-commands-dir=.') end lspconfig.clangd.setup { @@ -71,8 +68,8 @@ function M.watch_compile_commands(dir) local watch_path = dir or vim.fn.getcwd() local watch_file = watch_path .. '/compile_commands.json' - if not M.auto_watch_enabled or not vim.fn.filereadable(watch_file) then - return + if not vim.fn.filereadable(watch_file) then + vim.notify '[clangd] No compile_commands.json found.\nUse cc to manually set location when available.' end watcher = uv.new_fs_event() From 1f53e61d68fd23a37642ea65312420f745c8010b Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 06:53:56 +1200 Subject: [PATCH 414/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 42f7772423d..b4bd9db3b44 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -37,6 +37,9 @@ function M.start_clangd(dir) if dir and dir ~= '' then vim.notify('[clangd] Setting up with: ' .. dir) table.insert(cmd, '--compile-commands-dir=' .. dir) + M.watch_compile_commands(dir) + else + vim.notify('[clangd] Empty or nil dir: ' .. dir) end lspconfig.clangd.setup { @@ -126,8 +129,7 @@ return { config = function() local dir = find_compile_commands() M.start_clangd(dir) - M.watch_compile_commands(dir) - vim.keymap.set('n', 'cc', M.pick_commands_dir, { desc = 'Pick location of compile_commands.json for clangd' }) + vim.keymap.set('n', 'lc', M.pick_commands_dir, { desc = '[L]ocate [c]ompile_commands.json for clangd' }) end, } From 5b2d259d49de5e030c29bcfdef7cfb936b3826db Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 06:56:27 +1200 Subject: [PATCH 415/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index b4bd9db3b44..67d26c0b513 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -114,7 +114,9 @@ function M.pick_commands_dir() local entry = require('telescope.actions.state').get_selected_entry() require('telescope.actions').close(prompt_bufnr) vim.defer_fn(function() - M.start_clangd(entry[1]) + if entry[1] then + M.start_clangd(entry[1]) + end end, 100) end) return true From c3b32d95c90e66269f5e1085b81ef0f2b69a981c Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 06:58:39 +1200 Subject: [PATCH 416/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 67d26c0b513..05b39c6b16e 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -114,7 +114,7 @@ function M.pick_commands_dir() local entry = require('telescope.actions.state').get_selected_entry() require('telescope.actions').close(prompt_bufnr) vim.defer_fn(function() - if entry[1] then + if entry then M.start_clangd(entry[1]) end end, 100) From 6e3e04a23d589768958793326b95e2a07f859b5f Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 07:26:14 +1200 Subject: [PATCH 417/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 05b39c6b16e..1aad8bcbeea 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -1,6 +1,5 @@ local M = {} M.clang_filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' } -M.auto_watch_enabled = true local lspconfig = require 'lspconfig' @@ -32,14 +31,14 @@ function M.start_clangd(dir) '--clang-tidy', '--header-insertion=never', '--query-driver=' .. vim.fn.exepath 'clang++', - '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], + '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1] or '', } if dir and dir ~= '' then vim.notify('[clangd] Setting up with: ' .. dir) table.insert(cmd, '--compile-commands-dir=' .. dir) M.watch_compile_commands(dir) else - vim.notify('[clangd] Empty or nil dir: ' .. dir) + vim.notify '[clangd] Empty or nil --compile-commands-dir' end lspconfig.clangd.setup { @@ -68,16 +67,16 @@ function M.watch_compile_commands(dir) debounce_timer = nil end - local watch_path = dir or vim.fn.getcwd() - local watch_file = watch_path .. '/compile_commands.json' + local dir = dir or vim.fn.getcwd() + local file = dir .. '/compile_commands.json' - if not vim.fn.filereadable(watch_file) then + if not vim.fn.filereadable(file) then vim.notify '[clangd] No compile_commands.json found.\nUse cc to manually set location when available.' end watcher = uv.new_fs_event() watcher:start( - watch_path, + dir, { recursive = true }, vim.schedule_wrap(function(err, fname, status) if err then @@ -86,13 +85,15 @@ function M.watch_compile_commands(dir) end if fname and fname:match '.*/compile_commands%.json$' and status.change then + if debounce_timer then + debounce_timer:stop() + debounce_timer:close() + end debounce_timer = uv.new_timer() debounce_timer:start(200, 0, function() vim.schedule(function() vim.notify '[clangd] Detected compile_commands.json change. Reloading ...' - watch_path = vim.fn.fnamemodify(fname, ':h') - M.start_clangd(watch_path) - M.watch_compile_commands(watch_path) + M.start_clangd(vim.fn.fnamemodify(fname, ':h')) end) end) end @@ -114,7 +115,7 @@ function M.pick_commands_dir() local entry = require('telescope.actions.state').get_selected_entry() require('telescope.actions').close(prompt_bufnr) vim.defer_fn(function() - if entry then + if entry and type(entry[1]) == 'string' then M.start_clangd(entry[1]) end end, 100) From 59419287391223d7f39157c34517c28a363cbc50 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 07:34:37 +1200 Subject: [PATCH 418/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 1aad8bcbeea..59cfff3fed3 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -47,6 +47,9 @@ function M.start_clangd(dir) root_dir = lspconfig.util.root_pattern '.git', capabilities = require('blink.cmp').get_lsp_capabilities(), single_file_support = true, + on_attach = function(client, bufnr) + vim.notify('[clangd] Attached to buffer ' .. bufnr) + end, } end @@ -84,7 +87,7 @@ function M.watch_compile_commands(dir) return end - if fname and fname:match '.*/compile_commands%.json$' and status.change then + if fname and fname:match '[/\\]compile_commands%.json$' and status.change then if debounce_timer then debounce_timer:stop() debounce_timer:close() From fd75b36a8c454f07455826b4c8c55d774cae2ab7 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 07:38:49 +1200 Subject: [PATCH 419/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 59cfff3fed3..a38c24e7e62 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -87,6 +87,11 @@ function M.watch_compile_commands(dir) return end + vim.notify('[clangd] Watcher triggered: ' .. fname) + if fname:match '[/\\]compile_commands%.json$' then + vim.notify '[clangd] MATCHED compile_commands.json' + end + if fname and fname:match '[/\\]compile_commands%.json$' and status.change then if debounce_timer then debounce_timer:stop() From 75f6ecf3cfac099995372b2f73fa7c5334f743f3 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 07:49:12 +1200 Subject: [PATCH 420/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index a38c24e7e62..8d188fac235 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -87,12 +87,8 @@ function M.watch_compile_commands(dir) return end - vim.notify('[clangd] Watcher triggered: ' .. fname) - if fname:match '[/\\]compile_commands%.json$' then - vim.notify '[clangd] MATCHED compile_commands.json' - end - if fname and fname:match '[/\\]compile_commands%.json$' and status.change then + vim.notify('[clangd] Watcher triggered: ' .. fname) if debounce_timer then debounce_timer:stop() debounce_timer:close() @@ -123,8 +119,15 @@ function M.pick_commands_dir() local entry = require('telescope.actions.state').get_selected_entry() require('telescope.actions').close(prompt_bufnr) vim.defer_fn(function() - if entry and type(entry[1]) == 'string' then - M.start_clangd(entry[1]) + if entry then + if type(entry[1]) == 'string' then + vim.notify('[clangd] pick_commands_dir: ' .. entry[1]) + M.start_clangd(entry[1]) + else + vim.notify('[clangd] pick_commands_dir: ' .. entry[1]) + end + else + vim.notify '[clangd] pick_commands_dir is nil' end end, 100) end) From 0ffa41411b91043ca0f37a2115a22351fb32f101 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 08:27:22 +1200 Subject: [PATCH 421/480] cleanup --- lua/custom/plugins/lsp/clangd.lua | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 8d188fac235..d9a1063f7fb 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -5,10 +5,14 @@ local lspconfig = require 'lspconfig' local function find_compile_commands() local results = vim.fn.systemlist { 'fd', '-u', '-t', 'f', 'compile_commands.json' } + if vim.tbl_isempty(results) then + return nil + end + table.sort(results, function(a, b) return a:match 'debug' and not b:match 'debug' end) - return vim.fn.fnamemodify(results[1] or '', ':h') + return vim.fn.fnamemodify(results[1], ':h') end function M.stop_clangd() @@ -31,14 +35,14 @@ function M.start_clangd(dir) '--clang-tidy', '--header-insertion=never', '--query-driver=' .. vim.fn.exepath 'clang++', - '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1] or '', + '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], } if dir and dir ~= '' then vim.notify('[clangd] Setting up with: ' .. dir) table.insert(cmd, '--compile-commands-dir=' .. dir) M.watch_compile_commands(dir) else - vim.notify '[clangd] Empty or nil --compile-commands-dir' + vim.notify '[clangd] Could not find compile_commands.json.\nUse lc to manually set location when available.' end lspconfig.clangd.setup { @@ -70,13 +74,6 @@ function M.watch_compile_commands(dir) debounce_timer = nil end - local dir = dir or vim.fn.getcwd() - local file = dir .. '/compile_commands.json' - - if not vim.fn.filereadable(file) then - vim.notify '[clangd] No compile_commands.json found.\nUse cc to manually set location when available.' - end - watcher = uv.new_fs_event() watcher:start( dir, From d925a1bb223c4334d7f02ce880ebd1e95495b2d6 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 11:05:02 +1200 Subject: [PATCH 422/480] removing all traces of mason --- lua/kickstart/health.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/kickstart/health.lua b/lua/kickstart/health.lua index b59d08649af..88b642cab66 100644 --- a/lua/kickstart/health.lua +++ b/lua/kickstart/health.lua @@ -40,7 +40,6 @@ return { vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth` Fix only warnings for plugins and languages you intend to use. - Mason will give warnings for languages that are not installed. You do not need to install, unless you want to use those languages!]] local uv = vim.uv or vim.loop From 1dd8f6f04482d772f7ecb5d3a87fc95d9f114b6e Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 11:22:58 +1200 Subject: [PATCH 423/480] clangd lazy load pls --- lua/custom/plugins/lsp/clangd.lua | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index d9a1063f7fb..0e3853187a7 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -138,9 +138,19 @@ return { 'neovim/nvim-lspconfig', ft = M.clang_filetypes, config = function() - local dir = find_compile_commands() - M.start_clangd(dir) - - vim.keymap.set('n', 'lc', M.pick_commands_dir, { desc = '[L]ocate [c]ompile_commands.json for clangd' }) + vim.api.nvim_create_autocmd('BufReadPost', { + group = vim.api.nvim_create_augroup('clangd-once', { clear = true }), + pattern = '*', + callback = function(args) + local ft = vim.bo[args.buf].filetype + if vim.tbl_contains(M.clang_filetypes, ft) then + local dir = find_compile_commands() + M.start_clangd(dir) + + vim.keymap.set('n', 'lc', M.pick_commands_dir, { desc = '[L]ocate [c]ompile_commands.json for clangd' }) + vim.api.nvim_clear_autocmds { group = 'clangd-once' } + end + end, + }) end, } From 2a5c271fd5bbedf0a4e0e17f942b96b5c92d0ac7 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 11:33:00 +1200 Subject: [PATCH 424/480] lazy clangd --- lua/custom/plugins/lsp/clangd.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 0e3853187a7..5845d5aba27 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -144,9 +144,9 @@ return { callback = function(args) local ft = vim.bo[args.buf].filetype if vim.tbl_contains(M.clang_filetypes, ft) then + print('[clangd] BufReadPost fired for ft=' .. ft) local dir = find_compile_commands() M.start_clangd(dir) - vim.keymap.set('n', 'lc', M.pick_commands_dir, { desc = '[L]ocate [c]ompile_commands.json for clangd' }) vim.api.nvim_clear_autocmds { group = 'clangd-once' } end From 9550090c6acd42d652d41bde9836fce2a1b7b650 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 18:50:46 +1200 Subject: [PATCH 425/480] lazy clangd --- lua/custom/plugins/lsp/clangd.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 5845d5aba27..fa373460af2 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -45,6 +45,7 @@ function M.start_clangd(dir) vim.notify '[clangd] Could not find compile_commands.json.\nUse lc to manually set location when available.' end + print(vim.inspect(cmd)) lspconfig.clangd.setup { cmd = cmd, filetypes = M.clang_filetypes, From 22b264311ac09c6bc9027a47e6f233510151dfee Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 19:29:31 +1200 Subject: [PATCH 426/480] lazy clangd --- lua/custom/plugins/lsp/clangd.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index fa373460af2..54a1e48e013 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -144,14 +144,14 @@ return { pattern = '*', callback = function(args) local ft = vim.bo[args.buf].filetype - if vim.tbl_contains(M.clang_filetypes, ft) then - print('[clangd] BufReadPost fired for ft=' .. ft) - local dir = find_compile_commands() + if vim.tbl_contains(require('custom.plugins.lsp.clangd').clang_filetypes, ft) then + local M = require 'custom.plugins.lsp.clangd' + local dir = M.find_compile_commands() M.start_clangd(dir) - vim.keymap.set('n', 'lc', M.pick_commands_dir, { desc = '[L]ocate [c]ompile_commands.json for clangd' }) vim.api.nvim_clear_autocmds { group = 'clangd-once' } end end, }) + vim.keymap.set('n', 'lc', M.pick_commands_dir, { desc = '[L]ocate [c]ompile_commands.json for clangd' }) end, } From f6d59570795b86802a5be5295e0267e7c97be717 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 20:19:13 +1200 Subject: [PATCH 427/480] lazy clangd --- lua/custom/plugins/lsp/clangd.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 54a1e48e013..6643f4926bf 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -137,21 +137,22 @@ end return { 'neovim/nvim-lspconfig', - ft = M.clang_filetypes, config = function() vim.api.nvim_create_autocmd('BufReadPost', { group = vim.api.nvim_create_augroup('clangd-once', { clear = true }), pattern = '*', callback = function(args) local ft = vim.bo[args.buf].filetype - if vim.tbl_contains(require('custom.plugins.lsp.clangd').clang_filetypes, ft) then - local M = require 'custom.plugins.lsp.clangd' + if vim.tbl_contains(M.clang_filetypes, ft) then local dir = M.find_compile_commands() M.start_clangd(dir) vim.api.nvim_clear_autocmds { group = 'clangd-once' } end end, }) - vim.keymap.set('n', 'lc', M.pick_commands_dir, { desc = '[L]ocate [c]ompile_commands.json for clangd' }) + + vim.keymap.set('n', 'lc', M.pick_commands_dir, { + desc = '[L]ocate [c]ompile_commands.json for clangd', + }) end, } From b317778ed1ba39da157f05e2ff7d5a366a99ade9 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 20:26:30 +1200 Subject: [PATCH 428/480] lazy clangd --- lua/custom/plugins/lsp/clangd.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 6643f4926bf..8daa0aa7b1e 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -3,7 +3,7 @@ M.clang_filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' } local lspconfig = require 'lspconfig' -local function find_compile_commands() +function M.find_compile_commands() local results = vim.fn.systemlist { 'fd', '-u', '-t', 'f', 'compile_commands.json' } if vim.tbl_isempty(results) then return nil From 5d94528f6e53aa0159b938231577d8ab182a59cc Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 20:32:46 +1200 Subject: [PATCH 429/480] lazy clangd --- lua/custom/plugins/lsp/clangd.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 8daa0aa7b1e..12b34224d49 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -43,6 +43,8 @@ function M.start_clangd(dir) M.watch_compile_commands(dir) else vim.notify '[clangd] Could not find compile_commands.json.\nUse lc to manually set location when available.' + vim.notify '[clangd] Setting up with: "."' + table.insert(cmd, '--compile-commands-dir="."') end print(vim.inspect(cmd)) From 54b59756d886e1512f0037bcd86bff65a463ef4a Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 20:38:52 +1200 Subject: [PATCH 430/480] lazy clangd --- lua/custom/plugins/lsp/clangd.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 12b34224d49..bb001983134 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -37,15 +37,13 @@ function M.start_clangd(dir) '--query-driver=' .. vim.fn.exepath 'clang++', '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], } - if dir and dir ~= '' then - vim.notify('[clangd] Setting up with: ' .. dir) - table.insert(cmd, '--compile-commands-dir=' .. dir) - M.watch_compile_commands(dir) - else + if not dir or dir == '' then vim.notify '[clangd] Could not find compile_commands.json.\nUse lc to manually set location when available.' - vim.notify '[clangd] Setting up with: "."' - table.insert(cmd, '--compile-commands-dir="."') + dir = '.' end + vim.notify('[clangd] Setting up with: ' .. dir) + table.insert(cmd, '--compile-commands-dir=' .. dir) + M.watch_compile_commands(dir) print(vim.inspect(cmd)) lspconfig.clangd.setup { From 9cbdbe7a829f1743532d4b004bd9ca3ddddbcec3 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 20:45:12 +1200 Subject: [PATCH 431/480] lazy clangd --- lua/custom/plugins/lsp/clangd.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index bb001983134..9415877f633 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -149,6 +149,7 @@ return { vim.api.nvim_clear_autocmds { group = 'clangd-once' } end end, + once = true, }) vim.keymap.set('n', 'lc', M.pick_commands_dir, { From 46d13be5f63f781f4724a2fb1f845e3235308021 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 21:22:16 +1200 Subject: [PATCH 432/480] lazy clangd --- lua/custom/plugins/lsp/clangd.lua | 64 ++++++++++++------------------- 1 file changed, 24 insertions(+), 40 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 9415877f633..870360e3a28 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -2,17 +2,15 @@ local M = {} M.clang_filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' } local lspconfig = require 'lspconfig' +local uv = vim.uv or vim.loop +local watcher, debounce_timer -function M.find_compile_commands() +local function find_compile_commands() local results = vim.fn.systemlist { 'fd', '-u', '-t', 'f', 'compile_commands.json' } - if vim.tbl_isempty(results) then - return nil - end - table.sort(results, function(a, b) return a:match 'debug' and not b:match 'debug' end) - return vim.fn.fnamemodify(results[1], ':h') + return results[1] and vim.fn.fnamemodify(results[1], ':h') or nil end function M.stop_clangd() @@ -37,15 +35,14 @@ function M.start_clangd(dir) '--query-driver=' .. vim.fn.exepath 'clang++', '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], } - if not dir or dir == '' then - vim.notify '[clangd] Could not find compile_commands.json.\nUse lc to manually set location when available.' - dir = '.' + + if dir then + vim.notify('[clangd] Setting up with: ' .. dir) + table.insert(cmd, '--compile-commands-dir=' .. dir) + else + vim.notify '[clangd] No compile_commands.json found.\nUse lc to manually set location.' end - vim.notify('[clangd] Setting up with: ' .. dir) - table.insert(cmd, '--compile-commands-dir=' .. dir) - M.watch_compile_commands(dir) - print(vim.inspect(cmd)) lspconfig.clangd.setup { cmd = cmd, filetypes = M.clang_filetypes, @@ -56,23 +53,20 @@ function M.start_clangd(dir) vim.notify('[clangd] Attached to buffer ' .. bufnr) end, } -end -local watcher, debounce_timer + if dir then + M.watch_compile_commands(dir) + end +end function M.watch_compile_commands(dir) - local uv = vim.uv or vim.loop - if watcher then watcher:stop() watcher:close() - watcher = nil end - if debounce_timer then debounce_timer:stop() debounce_timer:close() - debounce_timer = nil end watcher = uv.new_fs_event() @@ -86,16 +80,12 @@ function M.watch_compile_commands(dir) end if fname and fname:match '[/\\]compile_commands%.json$' and status.change then - vim.notify('[clangd] Watcher triggered: ' .. fname) - if debounce_timer then - debounce_timer:stop() - debounce_timer:close() - end debounce_timer = uv.new_timer() debounce_timer:start(200, 0, function() vim.schedule(function() vim.notify '[clangd] Detected compile_commands.json change. Reloading ...' - M.start_clangd(vim.fn.fnamemodify(fname, ':h')) + local new_dir = vim.fn.fnamemodify(fname, ':h') + M.start_clangd(new_dir) end) end) end @@ -116,18 +106,11 @@ function M.pick_commands_dir() map('i', '', function(prompt_bufnr) local entry = require('telescope.actions.state').get_selected_entry() require('telescope.actions').close(prompt_bufnr) - vim.defer_fn(function() - if entry then - if type(entry[1]) == 'string' then - vim.notify('[clangd] pick_commands_dir: ' .. entry[1]) - M.start_clangd(entry[1]) - else - vim.notify('[clangd] pick_commands_dir: ' .. entry[1]) - end - else - vim.notify '[clangd] pick_commands_dir is nil' - end - end, 100) + if entry then + vim.defer_fn(function() + M.start_clangd(entry[1]) + end, 100) + end end) return true end, @@ -137,6 +120,7 @@ end return { 'neovim/nvim-lspconfig', + ft = M.clang_filetypes, config = function() vim.api.nvim_create_autocmd('BufReadPost', { group = vim.api.nvim_create_augroup('clangd-once', { clear = true }), @@ -144,12 +128,12 @@ return { callback = function(args) local ft = vim.bo[args.buf].filetype if vim.tbl_contains(M.clang_filetypes, ft) then - local dir = M.find_compile_commands() + vim.notify('[clangd] BufReadPost fired for ft=' .. ft) + local dir = find_compile_commands() M.start_clangd(dir) vim.api.nvim_clear_autocmds { group = 'clangd-once' } end end, - once = true, }) vim.keymap.set('n', 'lc', M.pick_commands_dir, { From 551ee11550a49cb1194f1e8eceff3ad2faefe50c Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 23:02:08 +1200 Subject: [PATCH 433/480] just get clangd working --- init.lua | 2 +- lua/custom/plugins/lsp/clangd.lua | 167 ++++++++++++------------------ 2 files changed, 68 insertions(+), 101 deletions(-) diff --git a/init.lua b/init.lua index 29f39c87c1f..34059228c07 100644 --- a/init.lua +++ b/init.lua @@ -665,7 +665,7 @@ require('lazy').setup({ -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { - -- clangd = {}, + clangd = require('custom.plugins.lsp.clangd').get_server_config(), -- gopls = {}, -- pyright = {}, -- rust_analyzer = {}, diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index 870360e3a28..4ebaa5a5cbd 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -1,74 +1,34 @@ local M = {} -M.clang_filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' } -local lspconfig = require 'lspconfig' local uv = vim.uv or vim.loop -local watcher, debounce_timer +local lspconfig_util = require 'lspconfig.util' + +local debounce_timer, watcher local function find_compile_commands() local results = vim.fn.systemlist { 'fd', '-u', '-t', 'f', 'compile_commands.json' } table.sort(results, function(a, b) return a:match 'debug' and not b:match 'debug' end) - return results[1] and vim.fn.fnamemodify(results[1], ':h') or nil -end - -function M.stop_clangd() - for _, client in ipairs(vim.lsp.get_clients()) do - if client.name == 'clangd' then - pcall(function() - client.stop { force = true } - end) - vim.notify '[clangd] Stopped clangd' - end - end -end - -function M.start_clangd(dir) - M.stop_clangd() - - local cmd = { - 'clangd', - '--background-index', - '--clang-tidy', - '--header-insertion=never', - '--query-driver=' .. vim.fn.exepath 'clang++', - '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], - } - - if dir then - vim.notify('[clangd] Setting up with: ' .. dir) - table.insert(cmd, '--compile-commands-dir=' .. dir) - else - vim.notify '[clangd] No compile_commands.json found.\nUse lc to manually set location.' - end - - lspconfig.clangd.setup { - cmd = cmd, - filetypes = M.clang_filetypes, - root_dir = lspconfig.util.root_pattern '.git', - capabilities = require('blink.cmp').get_lsp_capabilities(), - single_file_support = true, - on_attach = function(client, bufnr) - vim.notify('[clangd] Attached to buffer ' .. bufnr) - end, - } - - if dir then - M.watch_compile_commands(dir) - end + local path = results[1] + return path and vim.fn.fnamemodify(path, ':h') or nil end -function M.watch_compile_commands(dir) +local function start_watcher(dir, reload_callback) if watcher then watcher:stop() watcher:close() + watcher = nil end if debounce_timer then debounce_timer:stop() debounce_timer:close() + debounce_timer = nil end + if not dir then + return + end watcher = uv.new_fs_event() watcher:start( dir, @@ -78,14 +38,16 @@ function M.watch_compile_commands(dir) vim.notify('[clangd] Watcher error: ' .. err, vim.log.levels.ERROR) return end - - if fname and fname:match '[/\\]compile_commands%.json$' and status.change then + if fname and fname:match '[\\/].*compile_commands%.json$' and status.change then + if debounce_timer then + debounce_timer:stop() + debounce_timer:close() + end debounce_timer = uv.new_timer() debounce_timer:start(200, 0, function() vim.schedule(function() - vim.notify '[clangd] Detected compile_commands.json change. Reloading ...' - local new_dir = vim.fn.fnamemodify(fname, ':h') - M.start_clangd(new_dir) + vim.notify '[clangd] Detected compile_commands.json change. Restarting clangd...' + reload_callback() end) end) end @@ -93,51 +55,56 @@ function M.watch_compile_commands(dir) ) end -function M.pick_commands_dir() - local pickers = require 'telescope.pickers' - local finders = require 'telescope.finders' - local conf = require('telescope.config').values - pickers - .new({}, { - prompt_title = 'Pick compile_commands.json dir', - finder = finders.new_oneshot_job { 'fd', '-u', 'compile_commands.json', '-x', 'dirname', '{}' }, - sorter = conf.generic_sorter {}, - attach_mappings = function(_, map) - map('i', '', function(prompt_bufnr) - local entry = require('telescope.actions.state').get_selected_entry() - require('telescope.actions').close(prompt_bufnr) - if entry then - vim.defer_fn(function() - M.start_clangd(entry[1]) - end, 100) - end +M.get_server_config = function() + local dir = find_compile_commands() + local cmd = { + 'clangd', + '--background-index', + '--clang-tidy', + '--header-insertion=never', + '--query-driver=' .. vim.fn.exepath 'clang++', + '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], + } + + if dir then + table.insert(cmd, '--compile-commands-dir=' .. dir) + else + vim.notify '[clangd] Could not find compile_commands.json. clangd may still work in single-file mode.' + end + + return { + cmd = cmd, + filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, + capabilities = require('blink.cmp').get_lsp_capabilities(), + root_dir = lspconfig_util.root_pattern '.git', + single_file_support = true, + on_attach = function(client, bufnr) + vim.notify('[clangd] Attached to buffer ' .. bufnr) + if dir then + start_watcher(dir, function() + client.stop() + vim.defer_fn(function() + vim.cmd 'edit' -- reloads current buffer to re-trigger LSP attach + end, 100) end) - return true - end, - }) - :find() + end + end, + } end -return { - 'neovim/nvim-lspconfig', - ft = M.clang_filetypes, - config = function() - vim.api.nvim_create_autocmd('BufReadPost', { - group = vim.api.nvim_create_augroup('clangd-once', { clear = true }), - pattern = '*', - callback = function(args) - local ft = vim.bo[args.buf].filetype - if vim.tbl_contains(M.clang_filetypes, ft) then - vim.notify('[clangd] BufReadPost fired for ft=' .. ft) - local dir = find_compile_commands() - M.start_clangd(dir) - vim.api.nvim_clear_autocmds { group = 'clangd-once' } - end - end, - }) +vim.api.nvim_create_user_command('ReloadClangd', function() + local clients = vim.lsp.get_active_clients() + for _, client in ipairs(clients) do + if client.name == 'clangd' then + client.stop { force = true } + end + end + + vim.defer_fn(function() + vim.cmd 'edit' + end, 100) + + vim.notify '[clangd] Restarted manually via :ReloadClangd' +end, { desc = 'manually reload clangd with updated compile_commands.json' }) - vim.keymap.set('n', 'lc', M.pick_commands_dir, { - desc = '[L]ocate [c]ompile_commands.json for clangd', - }) - end, -} +return M From 91514ba5899d5b488c88ddae41d75ab7f42a6cbb Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 26 Jul 2025 17:20:57 +1200 Subject: [PATCH 434/480] Add CLAUDE.md and improve clangd configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add CLAUDE.md with nvim configuration guidance for future Claude instances - Rename clangd.lua to clangd_helper.lua for better organization - Document modular structure, LSP setup, and common commands - Include information about kickstart.nvim fork and conflict-minimizing design 🤖 Generated with Claude Code (claude.ai/code) Co-Authored-By: Claude --- CLAUDE.md | 61 ++++++++++++++ .../lsp/{clangd.lua => clangd_helper.lua} | 0 lua/custom/plugins/lsp/lsp.lua | 79 ++++++++++++------- 3 files changed, 111 insertions(+), 29 deletions(-) create mode 100644 CLAUDE.md rename lua/custom/plugins/lsp/{clangd.lua => clangd_helper.lua} (100%) diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000000..189cf72e802 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,61 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Neovim Configuration Structure + +This is a Neovim configuration forked from https://github.com/nvim-lua/kickstart.nvim and structured to minimize merge conflicts when updating from upstream. All custom modifications are isolated in the `lua/custom/` directory, allowing the main `init.lua` and kickstart files to be updated with minimal conflicts. + +The configuration is organized in a modular structure: + +- **`init.lua`**: Main configuration file that loads all settings, keymaps, and plugins +- **`lua/custom/`**: Custom configuration modules + - **`options.lua`**: Custom vim options (indentation, Nerd Font settings) + - **`keymaps.lua`**: Custom key mappings + - **`plugins/`**: Plugin configurations + - **`init.lua`**: Plugin imports and basic plugin setup + - **`lsp/`**: LSP-specific configurations + - **`lsp.lua`**: LSP server configurations (Python, Nix, Rust, Go, C/C++) + - **`clangd_helper.lua`**: Advanced clangd setup with compile_commands.json detection and file watching + +## LSP Configuration + +The LSP setup includes: +- **clangd**: C/C++ with automatic compile_commands.json detection and file watching +- **pyright**: Python language server with basic type checking +- **nixd**: Nix language server +- **ruff**: Python linter +- **texlab**: LaTeX support +- **cmake**: CMake language server + +The clangd configuration in `lua/custom/plugins/lsp/clangd_helper.lua` automatically: +- Searches for compile_commands.json files using `fd` +- Watches for changes and restarts clangd when compile_commands.json is updated +- Provides a `:ReloadClangd` command for manual restart + +## Key Features + +- Uses **lazy.nvim** for plugin management +- **Blink.cmp** for autocompletion with LSP integration +- **Telescope** for fuzzy finding +- **Treesitter** for syntax highlighting +- **Which-key** for keymap help +- **Mini.nvim** modules for text objects, surround, and statusline +- **TokyoNight** colorscheme + +## Common Commands + +- `:Lazy` - Manage plugins (install, update, etc.) +- `:checkhealth` - Check Neovim configuration health +- `:ReloadClangd` - Manually restart clangd LSP server +- `sh` - Search help documentation +- `sf` - Find files +- `sg` - Live grep search +- `f` - Format current buffer + +## Development Workflow + +1. Configuration changes are made in `lua/custom/` files +2. Plugin configurations go in `lua/custom/plugins/` +3. LSP servers are expected to be installed system-wide (via Nix/Home Manager based on comments) +4. The configuration uses lazy loading for most plugins to optimize startup time \ No newline at end of file diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd_helper.lua similarity index 100% rename from lua/custom/plugins/lsp/clangd.lua rename to lua/custom/plugins/lsp/clangd_helper.lua diff --git a/lua/custom/plugins/lsp/lsp.lua b/lua/custom/plugins/lsp/lsp.lua index 5a3c4e78807..f74ab68609c 100644 --- a/lua/custom/plugins/lsp/lsp.lua +++ b/lua/custom/plugins/lsp/lsp.lua @@ -1,36 +1,57 @@ -- ~/dlond/nvim/lua/custom/plugins/lsp.lua -- LSP configuration, assuming LSP servers are installed via Nix/Home Manager -local lspconfig = require 'lspconfig' -local capabilities = require('blink.cmp').get_lsp_capabilities() +return { + { + 'neovim/nvim-lspconfig', + -- only load when editing these filetypes (optional) + ft = { 'python', 'lua', 'nix', 'rust', 'go' }, + opts = function() + local lspconfig = require 'lspconfig' + local capabilities = require('blink.cmp').get_lsp_capabilities() -local servers = { - pyright = { - settings = { - python = { - analysis = { - autoSearchPaths = true, - diagnosticMode = 'openFilesOnly', - useLibraryCodeForTypes = true, - typeCheckingMode = 'basic', + local servers = { + pyright = { + settings = { + python = { + analysis = { + autoSearchPaths = true, + diagnosticMode = 'openFilesOnly', + useLibraryCodeForTypes = true, + typeCheckingMode = 'basic', + }, + }, + }, + positionEncoding = 'utf-8', }, - }, - positionEncoding = 'utf-8', - }, - }, - nixd = {}, - ruff = {}, - texlab = {}, - cmake = { - cmd = { 'cmake-language-server' }, - filetypes = { 'cmake' }, - root_dir = require('lspconfig.util').root_pattern('CMakeLists.txt', '.git'), + nixd = {}, + ruff = {}, + texlab = {}, + cmake = { + cmd = { 'cmake-language-server' }, + filetypes = { 'cmake' }, + root_dir = require('lspconfig.util').root_pattern('CMakeLists.txt', '.git'), + }, + clangd = (function() + local cmd = { 'clangd', '--background-index' } + return { + cmd = cmd, + filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, + root_dir = lspconfig.util.root_pattern('compile_commands.json', '.git'), + single_file_support = true, + -- on_attach = function(client, bufnr) + -- local util = require(custom.plugins.lsp.clangd_helper) + -- util.notify_compile_commands(bufnr) + -- util.start_compile_commands_watcher(client, bufnr) + -- end, + } + end)(), + } + + for name, config in pairs(servers) do + config.capabilities = vim.tbl_deep_extend('force', {}, capabilities, config.capabilities or {}) + lspconfig[name].setup(config) + end + end, }, } - -for server_name, server in pairs(servers) do - server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) - lspconfig[server_name].setup(server) -end - -return {} From 6c4db280044bd043a39aafeea5445b418679f26e Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 26 Jul 2025 17:30:40 +1200 Subject: [PATCH 435/480] Add STATUS.md to .gitignore for local project tracking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit STATUS.md will track project state and next actions locally without cluttering the repository history. 🤖 Generated with Claude Code (claude.ai/code) Co-Authored-By: Claude --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 8a192cab54d..13c35962a52 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ test.sh nvim spell/ + +# Project status tracking (local only) +STATUS.md From e9c3342170269de93e7279cc34307c86ae7782c8 Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 26 Jul 2025 19:29:52 +1200 Subject: [PATCH 436/480] title is wrong, merging the .gitignore because who cares --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 13c35962a52..abb1cdbfa5d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ spell/ # Project status tracking (local only) STATUS.md +VIDINTEL.md From 68f26dc50d2a7471327cb47b591975fda833c35b Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 26 Jul 2025 19:56:13 +1200 Subject: [PATCH 437/480] Optimize Neovim configuration structure and LSP setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove duplicate nvim-web-devicons loading (already in kickstart) - Add clangd configuration to custom LSP setup with proper flags - Replace complex clangd_helper with universal LSP reload keybind (lr) - Clean up unused clangd target selection keybind - Streamline plugin organization for better maintainability 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .gitignore | 1 + init.lua | 14 ++- lua/custom/keymaps.lua | 24 ++++- lua/custom/options.lua | 1 - lua/custom/plugins/init.lua | 8 -- lua/custom/plugins/lsp/clangd_helper.lua | 110 ----------------------- lua/custom/plugins/lsp/init.lua | 1 - lua/custom/plugins/lsp/lsp.lua | 29 +++--- 8 files changed, 48 insertions(+), 140 deletions(-) delete mode 100644 lua/custom/plugins/lsp/clangd_helper.lua diff --git a/.gitignore b/.gitignore index abb1cdbfa5d..721c83d6254 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,6 @@ nvim spell/ # Project status tracking (local only) +CLAUDE.md STATUS.md VIDINTEL.md diff --git a/init.lua b/init.lua index 34059228c07..fe6d8a1f0e0 100644 --- a/init.lua +++ b/init.lua @@ -665,7 +665,19 @@ require('lazy').setup({ -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { - clangd = require('custom.plugins.lsp.clangd').get_server_config(), + clangd = { + cmd = { + 'clangd', + '--background-index', + '--clang-tidy', + '--header-insertion=never', + '--query-driver=' .. vim.fn.exepath('clang++'), + '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], + }, + filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, + root_dir = require('lspconfig.util').root_pattern('.git'), + single_file_support = true, + }, -- gopls = {}, -- pyright = {}, -- rust_analyzer = {}, diff --git a/lua/custom/keymaps.lua b/lua/custom/keymaps.lua index cac7357242f..f32998b0e9b 100644 --- a/lua/custom/keymaps.lua +++ b/lua/custom/keymaps.lua @@ -1,10 +1,26 @@ -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` --- Add any other general-purpose keymaps you want here -vim.keymap.set('n', 'T', function() - require('custom.lsp.clangd'):pick_target() -end, { desc = 'Choose [T]arget' }) +-- LSP reload function +local function reload_lsp() + local clients = vim.lsp.get_clients() + if #clients == 0 then + print('No LSP clients running') + return + end + + for _, client in ipairs(clients) do + vim.lsp.stop_client(client.id) + end + + vim.defer_fn(function() + vim.cmd('LspStart') + print('LSP servers reloaded') + end, 500) +end + +-- Reload LSP keybind +vim.keymap.set('n', 'lr', reload_lsp, { desc = '[L]SP [R]eload all servers' }) -- Standard practice for Lua modules that don't need to return complex data return {} diff --git a/lua/custom/options.lua b/lua/custom/options.lua index 4b7a7fb2289..c746b294b82 100644 --- a/lua/custom/options.lua +++ b/lua/custom/options.lua @@ -18,4 +18,3 @@ vim.o.softtabstop = 2 -- etc... Review the options section of your old init.lua and add any *changed* values here. -- The kickstart defaults are generally sensible, so you might not need many overrides. --- print 'Custom options loaded!' -- Optional: Add print statement for debugging diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index b73c04ef721..0f699e4ad09 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -3,14 +3,6 @@ -- -- See the kickstart.nvim README for more information return { - { - 'nvim-tree/nvim-web-devicons', - lazy = false, - priority = 1000, - config = function() - require('nvim-web-devicons').setup() - end, - }, -- { import = 'custom.plugins.completion' }, -- { import = 'custom.plugins.debug' }, -- { import = 'custom.plugins.formatting' }, diff --git a/lua/custom/plugins/lsp/clangd_helper.lua b/lua/custom/plugins/lsp/clangd_helper.lua deleted file mode 100644 index 4ebaa5a5cbd..00000000000 --- a/lua/custom/plugins/lsp/clangd_helper.lua +++ /dev/null @@ -1,110 +0,0 @@ -local M = {} - -local uv = vim.uv or vim.loop -local lspconfig_util = require 'lspconfig.util' - -local debounce_timer, watcher - -local function find_compile_commands() - local results = vim.fn.systemlist { 'fd', '-u', '-t', 'f', 'compile_commands.json' } - table.sort(results, function(a, b) - return a:match 'debug' and not b:match 'debug' - end) - local path = results[1] - return path and vim.fn.fnamemodify(path, ':h') or nil -end - -local function start_watcher(dir, reload_callback) - if watcher then - watcher:stop() - watcher:close() - watcher = nil - end - if debounce_timer then - debounce_timer:stop() - debounce_timer:close() - debounce_timer = nil - end - - if not dir then - return - end - watcher = uv.new_fs_event() - watcher:start( - dir, - { recursive = true }, - vim.schedule_wrap(function(err, fname, status) - if err then - vim.notify('[clangd] Watcher error: ' .. err, vim.log.levels.ERROR) - return - end - if fname and fname:match '[\\/].*compile_commands%.json$' and status.change then - if debounce_timer then - debounce_timer:stop() - debounce_timer:close() - end - debounce_timer = uv.new_timer() - debounce_timer:start(200, 0, function() - vim.schedule(function() - vim.notify '[clangd] Detected compile_commands.json change. Restarting clangd...' - reload_callback() - end) - end) - end - end) - ) -end - -M.get_server_config = function() - local dir = find_compile_commands() - local cmd = { - 'clangd', - '--background-index', - '--clang-tidy', - '--header-insertion=never', - '--query-driver=' .. vim.fn.exepath 'clang++', - '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], - } - - if dir then - table.insert(cmd, '--compile-commands-dir=' .. dir) - else - vim.notify '[clangd] Could not find compile_commands.json. clangd may still work in single-file mode.' - end - - return { - cmd = cmd, - filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, - capabilities = require('blink.cmp').get_lsp_capabilities(), - root_dir = lspconfig_util.root_pattern '.git', - single_file_support = true, - on_attach = function(client, bufnr) - vim.notify('[clangd] Attached to buffer ' .. bufnr) - if dir then - start_watcher(dir, function() - client.stop() - vim.defer_fn(function() - vim.cmd 'edit' -- reloads current buffer to re-trigger LSP attach - end, 100) - end) - end - end, - } -end - -vim.api.nvim_create_user_command('ReloadClangd', function() - local clients = vim.lsp.get_active_clients() - for _, client in ipairs(clients) do - if client.name == 'clangd' then - client.stop { force = true } - end - end - - vim.defer_fn(function() - vim.cmd 'edit' - end, 100) - - vim.notify '[clangd] Restarted manually via :ReloadClangd' -end, { desc = 'manually reload clangd with updated compile_commands.json' }) - -return M diff --git a/lua/custom/plugins/lsp/init.lua b/lua/custom/plugins/lsp/init.lua index 3606ccbf276..000e2c96e89 100644 --- a/lua/custom/plugins/lsp/init.lua +++ b/lua/custom/plugins/lsp/init.lua @@ -1,4 +1,3 @@ return { require 'custom.plugins.lsp.lsp', - require 'custom.plugins.lsp.clangd', } diff --git a/lua/custom/plugins/lsp/lsp.lua b/lua/custom/plugins/lsp/lsp.lua index f74ab68609c..cd330778cdc 100644 --- a/lua/custom/plugins/lsp/lsp.lua +++ b/lua/custom/plugins/lsp/lsp.lua @@ -5,12 +5,25 @@ return { { 'neovim/nvim-lspconfig', -- only load when editing these filetypes (optional) - ft = { 'python', 'lua', 'nix', 'rust', 'go' }, + ft = { 'python', 'lua', 'nix', 'rust', 'go', 'c', 'cpp' }, opts = function() local lspconfig = require 'lspconfig' local capabilities = require('blink.cmp').get_lsp_capabilities() local servers = { + clangd = { + cmd = { + 'clangd', + '--background-index', + '--clang-tidy', + '--header-insertion=never', + '--query-driver=' .. vim.fn.exepath('clang++'), + '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], + }, + filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, + root_dir = require('lspconfig.util').root_pattern('.git'), + single_file_support = true, + }, pyright = { settings = { python = { @@ -32,20 +45,6 @@ return { filetypes = { 'cmake' }, root_dir = require('lspconfig.util').root_pattern('CMakeLists.txt', '.git'), }, - clangd = (function() - local cmd = { 'clangd', '--background-index' } - return { - cmd = cmd, - filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, - root_dir = lspconfig.util.root_pattern('compile_commands.json', '.git'), - single_file_support = true, - -- on_attach = function(client, bufnr) - -- local util = require(custom.plugins.lsp.clangd_helper) - -- util.notify_compile_commands(bufnr) - -- util.start_compile_commands_watcher(client, bufnr) - -- end, - } - end)(), } for name, config in pairs(servers) do From e4822e2109c849d114fd38682ed2fb9aa52650ed Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 26 Jul 2025 20:06:57 +1200 Subject: [PATCH 438/480] Enable essential plugins and clean up configuration structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Enable debug, formatting, telescope, treesitter, and tmux-navigator plugins - Remove duplicate telescope keybinds from init.lua (now handled by custom plugin) - Fix tmux-navigator plugin syntax with proper config function and descriptions - Add KEYBIND_ANALYSIS.md to gitignore for local development notes This activates powerful functionality that was previously commented out: • Debug adapter protocol with d* keybinds • Auto-formatting on save with conform.nvim • Enhanced telescope with ripgrep integration • Additional treesitter languages (nix, cmake, python, etc.) • Seamless tmux pane navigation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .gitignore | 1 + init.lua | 36 +--------------------- lua/custom/plugins/init.lua | 10 +++--- lua/custom/plugins/nvim-tmux-navigator.lua | 14 ++++++--- 4 files changed, 16 insertions(+), 45 deletions(-) diff --git a/.gitignore b/.gitignore index 721c83d6254..7fd59c08cfb 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ spell/ CLAUDE.md STATUS.md VIDINTEL.md +KEYBIND_ANALYSIS.md diff --git a/init.lua b/init.lua index fe6d8a1f0e0..d953804bae1 100644 --- a/init.lua +++ b/init.lua @@ -428,41 +428,7 @@ require('lazy').setup({ pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'ui-select') - -- See `:help telescope.builtin` - local builtin = require 'telescope.builtin' - vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) - vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) - vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) - vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) - vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) - vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) - vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) - vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) - vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) - vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) - - -- Slightly advanced example of overriding default behavior and theme - vim.keymap.set('n', '/', function() - -- You can pass additional configuration to Telescope to change the theme, layout, etc. - builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) - end, { desc = '[/] Fuzzily search in current buffer' }) - - -- It's also possible to pass additional configuration options. - -- See `:help telescope.builtin.live_grep()` for information about particular keys - vim.keymap.set('n', 's/', function() - builtin.live_grep { - grep_open_files = true, - prompt_title = 'Live Grep in Open Files', - } - end, { desc = '[S]earch [/] in Open Files' }) - - -- Shortcut for searching your Neovim configuration files - vim.keymap.set('n', 'sn', function() - builtin.find_files { cwd = vim.fn.stdpath 'config' } - end, { desc = '[S]earch [N]eovim files' }) + -- Telescope keymaps are now handled by custom.plugins.telescope end, }, diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 0f699e4ad09..aa6c8637521 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -4,11 +4,11 @@ -- See the kickstart.nvim README for more information return { -- { import = 'custom.plugins.completion' }, - -- { import = 'custom.plugins.debug' }, - -- { import = 'custom.plugins.formatting' }, + { import = 'custom.plugins.debug' }, + { import = 'custom.plugins.formatting' }, { import = 'custom.plugins.lsp' }, - -- { import = 'custom.plugins.nvim-tmux-navigator' }, - -- { import = 'custom.plugins.telescope' }, + { import = 'custom.plugins.nvim-tmux-navigator' }, + { import = 'custom.plugins.telescope' }, -- { import = 'custom.plugins.theme' }, - -- { import = 'custom.plugins.treesitter' }, + { import = 'custom.plugins.treesitter' }, } diff --git a/lua/custom/plugins/nvim-tmux-navigator.lua b/lua/custom/plugins/nvim-tmux-navigator.lua index a63ac9940d9..0a3762b7f71 100644 --- a/lua/custom/plugins/nvim-tmux-navigator.lua +++ b/lua/custom/plugins/nvim-tmux-navigator.lua @@ -1,7 +1,11 @@ return { - 'christoomey/vim-tmux-navigator', - vim.keymap.set('n', '', ':TmuxNavigateLeft'), - vim.keymap.set('n', '', ':TmuxNavigateDown'), - vim.keymap.set('n', '', ':TmuxNavigateUp'), - vim.keymap.set('n', '', ':TmuxNavigateRight'), + { + 'christoomey/vim-tmux-navigator', + config = function() + vim.keymap.set('n', '', ':TmuxNavigateLeft', { desc = 'Navigate to left tmux pane' }) + vim.keymap.set('n', '', ':TmuxNavigateDown', { desc = 'Navigate to lower tmux pane' }) + vim.keymap.set('n', '', ':TmuxNavigateUp', { desc = 'Navigate to upper tmux pane' }) + vim.keymap.set('n', '', ':TmuxNavigateRight', { desc = 'Navigate to right tmux pane' }) + end, + }, } From 8e88acd58f840849debac965fcf85cd4b5497ded Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 30 Jul 2025 22:50:34 +1200 Subject: [PATCH 439/480] We good? WE GOOD! --- lua/custom/plugins/avante.lua | 46 +++++++++++++++++++++++++++++++++++ lua/custom/plugins/init.lua | 1 + 2 files changed, 47 insertions(+) create mode 100644 lua/custom/plugins/avante.lua diff --git a/lua/custom/plugins/avante.lua b/lua/custom/plugins/avante.lua new file mode 100644 index 00000000000..ff03f7b92c1 --- /dev/null +++ b/lua/custom/plugins/avante.lua @@ -0,0 +1,46 @@ +return { + "yetone/avante.nvim", + event = "VeryLazy", + lazy = false, + version = false, -- set this if you want to always pull the latest change + opts = { + -- add any opts here + }, + -- if you want to build from source then do `make BUILD_FROM_SOURCE=true` + build = "make", + -- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows + dependencies = { + "stevearc/dressing.nvim", + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + --- The below dependencies are optional, + "hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions + "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons + "zbirenbaum/copilot.lua", -- for providers='copilot' + { + -- support for image pasting + "HakonHarnes/img-clip.nvim", + event = "VeryLazy", + opts = { + -- recommended settings + default = { + embed_image_as_base64 = false, + prompt_for_file_name = false, + drag_and_drop = { + insert_mode = true, + }, + -- required for Windows users + use_absolute_path = true, + }, + }, + }, + { + -- Make sure to set this up properly if you have lazy=true + 'MeanderingProgrammer/render-markdown.nvim', + opts = { + file_types = { "markdown", "Avante" }, + }, + ft = { "markdown", "Avante" }, + }, + }, +} \ No newline at end of file diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index aa6c8637521..2650465b5b2 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -3,6 +3,7 @@ -- -- See the kickstart.nvim README for more information return { + { import = 'custom.plugins.avante' }, -- { import = 'custom.plugins.completion' }, { import = 'custom.plugins.debug' }, { import = 'custom.plugins.formatting' }, From 2b112758d5158ae133c113cda5bef369d5876b7e Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 15 Aug 2025 15:18:39 +1200 Subject: [PATCH 440/480] added .envrc so tmux stuff works --- .envrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 00000000000..281accf5adf --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +export PROJECT=$(basename $(pwd)) From 652c389318af0fe69d28906d04b69ceb43c1e83b Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 15 Aug 2025 15:30:04 +1200 Subject: [PATCH 441/480] Add warning when quitting Neovim in shared tmux sessions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implements autocmd that detects when running in a tmux session with multiple attached clients and prompts user before quitting to prevent disrupting other users. Closes #3 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- lua/custom/options.lua | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/lua/custom/options.lua b/lua/custom/options.lua index c746b294b82..1c6c7ba73e0 100644 --- a/lua/custom/options.lua +++ b/lua/custom/options.lua @@ -18,3 +18,44 @@ vim.o.softtabstop = 2 -- etc... Review the options section of your old init.lua and add any *changed* values here. -- The kickstart defaults are generally sensible, so you might not need many overrides. +-- Function to check if running in a shared tmux session +local function is_shared_tmux_session() + if not vim.env.TMUX then + return false + end + + local handle = io.popen('tmux list-sessions -F "#{session_name}:#{session_attached}" 2>/dev/null') + if not handle then + return false + end + + local current_session = vim.fn.system('tmux display-message -p "#S"'):gsub('\n', '') + local output = handle:read('*a') + handle:close() + + for line in output:gmatch('[^\r\n]+') do + local session_name, attached_count = line:match('([^:]+):(%d+)') + if session_name == current_session and tonumber(attached_count) > 1 then + return true + end + end + + return false +end + +-- Warn before quitting if in a shared tmux session +vim.api.nvim_create_autocmd('VimLeavePre', { + callback = function() + if is_shared_tmux_session() then + local choice = vim.fn.confirm( + 'You are in a shared tmux session. Other users may be affected.\nDo you really want to quit?', + '&Yes\n&No', + 2 + ) + if choice ~= 1 then + vim.cmd('cquit!') + end + end + end, +}) + From 876322112e2b3abe109b64495eafad867f64ba93 Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 15 Aug 2025 15:46:31 +1200 Subject: [PATCH 442/480] added codeowners and claude stuff --- .github/CODEOWNERS | 2 ++ .github/workflows/claude.yml | 48 ++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/claude.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000000..c73a9c995b1 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# .github/CODEOWNERS +* @dlond diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 00000000000..53c207a9653 --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,48 @@ +name: Claude PR Assistant + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened, assigned] + pull_request_review: + types: [submitted] + +jobs: + claude-code-action: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || + (github.event_name == 'issues' && contains(github.event.issue.body, '@claude')) + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + issues: read + id-token: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude PR Action + uses: anthropics/claude-code-action@beta + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + # Or use OAuth token instead: + # claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + timeout_minutes: "60" + # mode: tag # Default: responds to @claude mentions + # Optional: Restrict network access to specific domains only + # experimental_allowed_domains: | + # .anthropic.com + # .github.com + # api.github.com + # .githubusercontent.com + # bun.sh + # registry.npmjs.org + # .blob.core.windows.net From bf1e52d87a6c96494e055e3db16b574eb8af36fc Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 15 Aug 2025 18:00:28 +1200 Subject: [PATCH 443/480] added fugitive --- .github/ISSUE_TEMPLATE/bug_report.md | 36 +---------- .github/ISSUE_TEMPLATE/config.yml | 1 + .github/ISSUE_TEMPLATE/feature_request.md | 1 + .github/pull_request_template.md | 9 +-- .github/workflows/stylua.yml | 21 ------- lua/custom/plugins/git.lua | 73 +++++++++++++++++++++++ lua/custom/plugins/init.lua | 1 + 7 files changed, 78 insertions(+), 64 deletions(-) mode change 100644 => 120000 .github/ISSUE_TEMPLATE/bug_report.md create mode 120000 .github/ISSUE_TEMPLATE/config.yml create mode 120000 .github/ISSUE_TEMPLATE/feature_request.md mode change 100644 => 120000 .github/pull_request_template.md delete mode 100644 .github/workflows/stylua.yml create mode 100644 lua/custom/plugins/git.lua diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 86598b8dc98..00000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - - - -## Before Reporting an Issue -- I have read the kickstart.nvim README.md. -- I have read the appropriate plugin's documentation. -- I have searched that this issue has not been reported before. - -- [ ] **By checking this, I confirm that the above steps are completed. I understand leaving this unchecked will result in this report being closed immediately.** - -## Describe the bug - - -## To Reproduce - -1. ... - -## Desktop - -- OS: -- Terminal: - -## Neovim Version - - -``` -``` diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 120000 index 00000000000..5be11b23137 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1 @@ +/nix/store/sxkaavdlrf0762h3k07j2jm9b7d3656n-home-manager-files/.config/git/templates/.github/ISSUE_TEMPLATE/bug_report.md \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 120000 index 00000000000..65302d00713 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +/nix/store/sxkaavdlrf0762h3k07j2jm9b7d3656n-home-manager-files/.config/git/templates/.github/ISSUE_TEMPLATE/config.yml \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 120000 index 00000000000..4d77f8e9325 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1 @@ +/nix/store/sxkaavdlrf0762h3k07j2jm9b7d3656n-home-manager-files/.config/git/templates/.github/ISSUE_TEMPLATE/feature_request.md \ No newline at end of file diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index f401c9ffd9c..00000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,8 +0,0 @@ -*************************************************************************** -**NOTE** -Please verify that the `base repository` above has the intended destination! -Github by default opens Pull Requests against the parent of a forked repository. -If this is your personal fork and you didn't intend to open a PR for contribution -to the original project then adjust the `base repository` accordingly. -************************************************************************** - diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 120000 index 00000000000..5585f140325 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1 @@ +/nix/store/sxkaavdlrf0762h3k07j2jm9b7d3656n-home-manager-files/.config/git/templates/.github/pull_request_template.md \ No newline at end of file diff --git a/.github/workflows/stylua.yml b/.github/workflows/stylua.yml deleted file mode 100644 index 75db6c3355b..00000000000 --- a/.github/workflows/stylua.yml +++ /dev/null @@ -1,21 +0,0 @@ -# Check Lua Formatting -name: Check Lua Formatting -on: pull_request_target - -jobs: - stylua-check: - if: github.repository == 'nvim-lua/kickstart.nvim' - name: Stylua Check - runs-on: ubuntu-latest - steps: - - name: Checkout Code - uses: actions/checkout@v2 - with: - ref: ${{ github.event.pull_request.head.sha }} - - name: Stylua Check - uses: JohnnyMorganz/stylua-action@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - version: latest - args: --check . - diff --git a/lua/custom/plugins/git.lua b/lua/custom/plugins/git.lua new file mode 100644 index 00000000000..aefc725a378 --- /dev/null +++ b/lua/custom/plugins/git.lua @@ -0,0 +1,73 @@ +return { + -- Fugitive - Git integration + { + 'tpope/vim-fugitive', + cmd = { 'Git', 'G', 'Gdiff', 'Gread', 'Gwrite', 'Ggrep', 'GMove', 'GDelete', 'GBrowse', 'GRemove' }, + keys = { + { 'gs', 'Git', desc = 'Git status' }, + { 'gd', 'Gdiff', desc = 'Git diff' }, + { 'gc', 'Git commit', desc = 'Git commit' }, + { 'gb', 'Git blame', desc = 'Git blame' }, + { 'gl', 'Git log', desc = 'Git log' }, + { 'gp', 'Git push', desc = 'Git push' }, + { 'gf', 'Git fetch', desc = 'Git fetch' }, + }, + }, + -- Gitsigns - Git gutter and hunk operations + { + 'lewis6991/gitsigns.nvim', + opts = { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + on_attach = function(bufnr) + local gitsigns = require('gitsigns') + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map('n', ']c', function() + if vim.wo.diff then + vim.cmd.normal({']c', bang = true}) + else + gitsigns.nav_hunk('next') + end + end, { desc = 'Next git hunk' }) + + map('n', '[c', function() + if vim.wo.diff then + vim.cmd.normal({'[c', bang = true}) + else + gitsigns.nav_hunk('prev') + end + end, { desc = 'Previous git hunk' }) + + -- Actions + map('n', 'hs', gitsigns.stage_hunk, { desc = 'Stage hunk' }) + map('n', 'hr', gitsigns.reset_hunk, { desc = 'Reset hunk' }) + map('v', 'hs', function() gitsigns.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end, { desc = 'Stage hunk' }) + map('v', 'hr', function() gitsigns.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end, { desc = 'Reset hunk' }) + map('n', 'hS', gitsigns.stage_buffer, { desc = 'Stage buffer' }) + map('n', 'hu', gitsigns.undo_stage_hunk, { desc = 'Undo stage hunk' }) + map('n', 'hR', gitsigns.reset_buffer, { desc = 'Reset buffer' }) + map('n', 'hp', gitsigns.preview_hunk, { desc = 'Preview hunk' }) + map('n', 'hb', function() gitsigns.blame_line{full=true} end, { desc = 'Blame line' }) + map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = 'Toggle line blame' }) + map('n', 'hd', gitsigns.diffthis, { desc = 'Diff this' }) + map('n', 'hD', function() gitsigns.diffthis('~') end, { desc = 'Diff this ~' }) + map('n', 'td', gitsigns.toggle_deleted, { desc = 'Toggle deleted' }) + + -- Text object + map({'o', 'x'}, 'ih', ':Gitsigns select_hunk', { desc = 'Select hunk' }) + end, + }, + }, +} \ No newline at end of file diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 2650465b5b2..722ec3016d7 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -7,6 +7,7 @@ return { -- { import = 'custom.plugins.completion' }, { import = 'custom.plugins.debug' }, { import = 'custom.plugins.formatting' }, + { import = 'custom.plugins.git' }, { import = 'custom.plugins.lsp' }, { import = 'custom.plugins.nvim-tmux-navigator' }, { import = 'custom.plugins.telescope' }, From f755e49d6695efe2613810725de01b7a5d150625 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 20 Aug 2025 14:28:06 +1200 Subject: [PATCH 444/480] Add git workflow reference to CLAUDE.md Reference the shared git workflow at ../git-workflow.yaml to provide Claude Code instances with standardized development process guidance. Resolves #6 --- CLAUDE.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 189cf72e802..3fd886159a7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -53,6 +53,16 @@ The clangd configuration in `lua/custom/plugins/lsp/clangd_helper.lua` automatic - `sg` - Live grep search - `f` - Format current buffer +## Git Workflow + +This project follows the standardized git workflow documented at: `../git-workflow.yaml` + +Key principles: +- Never work directly on main branch +- Issue-driven development with `gh issue create` +- Always use worktrees for feature development +- Complete cleanup after merge + ## Development Workflow 1. Configuration changes are made in `lua/custom/` files From b2047723b9b5974b391f4c2e507bb19db4b1b0cc Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 20 Aug 2025 14:43:53 +1200 Subject: [PATCH 445/480] Fix tmux quit warning logic bug Replace `cquit!` with `return` when user chooses 'No' to properly prevent nvim from quitting in shared tmux sessions. Previously, clicking 'No' would still force quit nvim due to the inverted logic using `cquit!` command. Resolves #8 --- lua/custom/options.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/custom/options.lua b/lua/custom/options.lua index 1c6c7ba73e0..c16cd476562 100644 --- a/lua/custom/options.lua +++ b/lua/custom/options.lua @@ -53,7 +53,7 @@ vim.api.nvim_create_autocmd('VimLeavePre', { 2 ) if choice ~= 1 then - vim.cmd('cquit!') + return end end end, From 25cab9b193eed7faa2f6520d69503de18f8f9a8c Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 20 Aug 2025 14:56:07 +1200 Subject: [PATCH 446/480] Add development practices reference to CLAUDE.md Reference the shared development practices at ../development-practices.yaml to provide Claude Code instances with consistent guidance on: - Task management with TodoWrite - Tool usage patterns and batching - Debugging approaches and common bug patterns - Code quality standards and communication guidelines Resolves #10 --- CLAUDE.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 3fd886159a7..920b4da45ea 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -63,6 +63,16 @@ Key principles: - Always use worktrees for feature development - Complete cleanup after merge +## Development Practices + +Claude Code instances should follow the development practices documented at: `../development-practices.yaml` + +This includes: +- Task management with TodoWrite +- Tool usage patterns and batching +- Debugging approaches and common bug patterns +- Code quality standards and communication guidelines + ## Development Workflow 1. Configuration changes are made in `lua/custom/` files From 217e4481888b1831165a03c70759004884d27688 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 20 Aug 2025 15:20:01 +1200 Subject: [PATCH 447/480] Organize and commit nvim configuration improvements **Configuration Enhancements:** - Enable Nerd Font support in init.lua - Enhanced LSP configuration with better clangd setup - Improved query driver paths and error handling - Added support for more filetypes (cmake, tex, etc.) **Plugin Management:** - Add GitHub Copilot integration - Remove experimental plugins (avante, completion, statusline, theme) - Reorganize plugin imports for better structure **Repository Maintenance:** - Update .gitignore for better artifact handling - Clean up unused plugin configurations - Establish clean baseline for future development Resolves #12 --- .gitignore | 32 ++++++--- init.lua | 18 +---- lua/custom/plugins/avante.lua | 46 ------------ lua/custom/plugins/completion.lua | 112 ------------------------------ lua/custom/plugins/copilot.lua | 14 ++++ lua/custom/plugins/init.lua | 5 +- lua/custom/plugins/lsp/lsp.lua | 49 +++++++++++-- lua/custom/plugins/statusline.lua | 38 ---------- lua/custom/plugins/theme.lua | 12 ---- 9 files changed, 83 insertions(+), 243 deletions(-) delete mode 100644 lua/custom/plugins/avante.lua delete mode 100644 lua/custom/plugins/completion.lua create mode 100644 lua/custom/plugins/copilot.lua delete mode 100644 lua/custom/plugins/statusline.lua delete mode 100644 lua/custom/plugins/theme.lua diff --git a/.gitignore b/.gitignore index 14a9370b49b..5ffa64347b0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,24 @@ -tags -test.sh -.luarc.json -nvim - -spell/ +# OS files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db -# Project status tracking (local only) -CLAUDE.md -STATUS.md -VIDINTEL.md -KEYBIND_ANALYSIS.md +# Neovim runtime files +.cache/ +.local/ +*.tmp +*.swp +*.swo +*~ +# Plugin artifacts lazy-lock.json +.luarc.json + +# Development artifacts +*.disabled +todo.md diff --git a/init.lua b/init.lua index dee03ef4bac..a8755d7b2e1 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.o` @@ -631,19 +631,7 @@ require('lazy').setup({ -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { - clangd = { - cmd = { - 'clangd', - '--background-index', - '--clang-tidy', - '--header-insertion=never', - '--query-driver=' .. vim.fn.exepath 'clang++', - '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], - }, - filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, - root_dir = require('lspconfig.util').root_pattern '.git', - single_file_support = true, - }, + -- clangd = {}, -- gopls = {}, -- pyright = {}, -- rust_analyzer = {}, @@ -658,7 +646,7 @@ require('lazy').setup({ lua_ls = { -- cmd = { ... }, - -- filetypes = { ... }, + filetypes = { 'lua', 'luau' }, -- capabilities = {}, settings = { Lua = { diff --git a/lua/custom/plugins/avante.lua b/lua/custom/plugins/avante.lua deleted file mode 100644 index ff03f7b92c1..00000000000 --- a/lua/custom/plugins/avante.lua +++ /dev/null @@ -1,46 +0,0 @@ -return { - "yetone/avante.nvim", - event = "VeryLazy", - lazy = false, - version = false, -- set this if you want to always pull the latest change - opts = { - -- add any opts here - }, - -- if you want to build from source then do `make BUILD_FROM_SOURCE=true` - build = "make", - -- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows - dependencies = { - "stevearc/dressing.nvim", - "nvim-lua/plenary.nvim", - "MunifTanjim/nui.nvim", - --- The below dependencies are optional, - "hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions - "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons - "zbirenbaum/copilot.lua", -- for providers='copilot' - { - -- support for image pasting - "HakonHarnes/img-clip.nvim", - event = "VeryLazy", - opts = { - -- recommended settings - default = { - embed_image_as_base64 = false, - prompt_for_file_name = false, - drag_and_drop = { - insert_mode = true, - }, - -- required for Windows users - use_absolute_path = true, - }, - }, - }, - { - -- Make sure to set this up properly if you have lazy=true - 'MeanderingProgrammer/render-markdown.nvim', - opts = { - file_types = { "markdown", "Avante" }, - }, - ft = { "markdown", "Avante" }, - }, - }, -} \ No newline at end of file diff --git a/lua/custom/plugins/completion.lua b/lua/custom/plugins/completion.lua deleted file mode 100644 index 81a23b17470..00000000000 --- a/lua/custom/plugins/completion.lua +++ /dev/null @@ -1,112 +0,0 @@ -return { - { - 'hrsh7th/nvim-cmp', - event = 'InsertEnter', -- Load when entering insert mode - dependencies = { - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-path', - { -- LuaSnip and its potential build step - 'L3MON4D3/LuaSnip', - -- Follow latest V2 release. - version = 'v2.*', - -- tag = '', -- Removed tag specification - -- install jsregexp (optional!:). - build = (function() - -- Build Step is needed for regex support in snippets. This step is optional. - -- Remove the below condition to build Luasnip with regex support on Mac and Linux. - if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then - return - end - return 'make install_jsregexp' - end)(), - }, - 'saadparwaiz1/cmp_luasnip', -- Snippet source for nvim-cmp - -- Add other cmp sources if needed, e.g.: - -- 'hrsh7th/cmp-cmdline', - }, - config = function() - local cmp = require 'cmp' - local luasnip = require 'luasnip' - luasnip.config.setup {} -- Setup luasnip first - - local function toggle_path_completion() - local config = cmp.get_config() - local snippet = config.snippet - local completion = config.completion - local mapping = config.mapping - - local path_enabled = vim.tbl_any(function(src) - return src.name == 'path' - end, config.sources) - - local new_sources = { - { name = 'lazydev', group_index = 0 }, - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - } - - if not path_enabled then - table.insert(new_sources, { name = 'path' }) - end - - cmp.setup { - snippet = snippet, - completion = completion, - mapping = mapping, - sources = new_sources, - } - - print('Path completion ' .. (path_enabled and 'disabled' or 'enabled')) - end - - -- Configure nvim-cmp - cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) -- Expand snippets using luasnip - end, - }, - completion = { - -- Set completeopt to have a better completion experience - -- :help completeopt - -- menuone: popup even when there's only one match - -- noinsert: Do not insert text until a selection is made - -- noselect: Do not select the first item by default - completeopt = 'menu,menuone,noinsert', - }, - -- Key Mappings for completion - mapping = cmp.mapping.preset.insert { - [''] = cmp.mapping.select_next_item(), -- Select next item - [''] = cmp.mapping.select_prev_item(), -- Select previous item - [''] = cmp.mapping.scroll_docs(-4), -- Scroll documentation back - [''] = cmp.mapping.scroll_docs(4), -- Scroll documentation forward - [''] = cmp.mapping.confirm { select = true }, -- Confirm selection - [''] = cmp.mapping.complete {}, -- Trigger completion manually - - -- Handle snippet jumping - [''] = cmp.mapping(function() - if luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - end - end, { 'i', 's' }), -- Jump forward in snippet - [''] = cmp.mapping(function() - if luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - end - end, { 'i', 's' }), -- Jump backward in snippet - }, - -- Completion sources - sources = cmp.config.sources { - { name = 'nvim_lsp' }, -- LSP symbols - { name = 'luasnip' }, -- Snippets - { name = 'buffer' }, -- Words from current buffer - { name = 'path' }, -- Filesystem paths - }, - -- Add other cmp setup options from your old config if any - } - - vim.keymap.set('n', 'tp', toggle_path_completion, { desc = '[T]oggle [p]ath completion' }) - end, -- End of config function - }, -} diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua new file mode 100644 index 00000000000..18744d84091 --- /dev/null +++ b/lua/custom/plugins/copilot.lua @@ -0,0 +1,14 @@ +return { + { + 'github/copilot.vim', + event = 'VimEnter', + config = function() + -- Accept suggestion with Ctrl-y + vim.keymap.set('i', '', 'copilot#Accept("\\")', { + expr = true, + replace_keycodes = false + }) + vim.g.copilot_no_tab_map = true + end, + }, +} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 722ec3016d7..22ef8fa6edd 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -3,14 +3,15 @@ -- -- See the kickstart.nvim README for more information return { - { import = 'custom.plugins.avante' }, -- { import = 'custom.plugins.completion' }, + -- { import = 'custom.plugins.theme' }, + -- { import = 'custom.plugins.avante' }, + { import = 'custom.plugins.copilot' }, { import = 'custom.plugins.debug' }, { import = 'custom.plugins.formatting' }, { import = 'custom.plugins.git' }, { import = 'custom.plugins.lsp' }, { import = 'custom.plugins.nvim-tmux-navigator' }, { import = 'custom.plugins.telescope' }, - -- { import = 'custom.plugins.theme' }, { import = 'custom.plugins.treesitter' }, } diff --git a/lua/custom/plugins/lsp/lsp.lua b/lua/custom/plugins/lsp/lsp.lua index cd330778cdc..9f25c4a3ba7 100644 --- a/lua/custom/plugins/lsp/lsp.lua +++ b/lua/custom/plugins/lsp/lsp.lua @@ -5,10 +5,33 @@ return { { 'neovim/nvim-lspconfig', -- only load when editing these filetypes (optional) - ft = { 'python', 'lua', 'nix', 'rust', 'go', 'c', 'cpp' }, + ft = { + 'c', + 'cpp', + 'objc', + 'objcpp', + 'cuda', + 'cmake', + -- + 'go', + 'nix', + 'python', + 'rust', + 'tex', + }, opts = function() local lspconfig = require 'lspconfig' - local capabilities = require('blink.cmp').get_lsp_capabilities() + local capabilities = {} + pcall(function() + capabilities = require('blink.cmp').get_lsp_capabilities() + end) + local util = require 'lspconfig.util' + + local query_driver = table.concat({ + '/nix/store/*/bin/clang*', + '/opt/homebrew/opt/llvm/bin/clang*', + '/usr/bin/clang*', + }, ';') local servers = { clangd = { @@ -17,13 +40,22 @@ return { '--background-index', '--clang-tidy', '--header-insertion=never', - '--query-driver=' .. vim.fn.exepath('clang++'), - '--resource-dir=' .. vim.fn.systemlist({ 'clang++', '--print-resource-dir' })[1], + '--query-driver=' .. query_driver, + '--compile-commands-dir=build', + '--resource-dir=' .. (function() + local ok, result = pcall(vim.fn.systemlist, { 'clang++', '--print-resource-dir' }) + if ok and result and result[1] then + return result[1] + else + return '/usr/lib/clang/19/include' -- fallback + end + end)(), }, filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, - root_dir = require('lspconfig.util').root_pattern('.git'), + root_dir = util.root_pattern('CMakeLists.txt', '.git'), single_file_support = true, }, + pyright = { settings = { python = { @@ -37,13 +69,16 @@ return { }, positionEncoding = 'utf-8', }, - nixd = {}, ruff = {}, + + nixd = {}, + texlab = {}, + cmake = { cmd = { 'cmake-language-server' }, filetypes = { 'cmake' }, - root_dir = require('lspconfig.util').root_pattern('CMakeLists.txt', '.git'), + root_dir = util.root_pattern('CMakeLists.txt', '.git'), }, } diff --git a/lua/custom/plugins/statusline.lua b/lua/custom/plugins/statusline.lua deleted file mode 100644 index 58e088d8f2c..00000000000 --- a/lua/custom/plugins/statusline.lua +++ /dev/null @@ -1,38 +0,0 @@ -return { - 'echasnovski/mini.statusline', - dependencies = { 'nvim-tree/nvim-web-devicons' }, -- optional for icons - opts = function(_, opts) - local statusline = require 'mini.statusline' - - -- Add new section function - -- statusline.section_target = function() - -- local target = require('custom.utils'):get_target() - -- return target and (' ' .. target) or '' - -- end - - -- Override content.active to include target - opts.content = opts.content or {} - opts.content.active = function() - local mode, git, diagnostics, filename, fileinfo, target, location = - statusline.section_mode {}, - statusline.section_git {}, - statusline.section_diagnostics {}, - statusline.section_filename {}, - statusline.section_fileinfo {}, - -- statusline.section_target {}, - statusline.section_location {} - - return statusline.combine_groups { - { hl = 'MiniStatuslineModeNormal', strings = { mode } }, - { hl = 'MiniStatuslineDevinfo', strings = { git, diagnostics } }, - '%<', - { hl = 'MiniStatuslineFilename', strings = { filename } }, - { hl = 'MiniStatuslineFileinfo', strings = { fileinfo } }, - { hl = 'MiniStatuslineTarget', strings = { target } }, - { hl = 'MiniStatuslineLocation', strings = { location } }, - } - end - - return opts - end, -} diff --git a/lua/custom/plugins/theme.lua b/lua/custom/plugins/theme.lua deleted file mode 100644 index 3bff8c6dd16..00000000000 --- a/lua/custom/plugins/theme.lua +++ /dev/null @@ -1,12 +0,0 @@ --- Theme configuration - -return { - { - 'catppuccin/nvim', - priority = 1000, - config = function() - vim.cmd.colorscheme 'catppuccin-mocha' - end, - }, - { 'folke/tokyonight.nvim', enabled = false }, -} From 9c70d9a98fcd9d8a41d2a74a15f75e07d6401581 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 20 Aug 2025 16:09:19 +1200 Subject: [PATCH 448/480] Share KEYBIND_ANALYSIS.md documentation publicly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add comprehensive keybind analysis and natural language search plugin design documentation to the repository. This high-quality technical documentation can help users understand the keybinding structure and potentially inspire community plugin development. Embracing openness by sharing knowledge! 👐🏾 Resolves #15 --- KEYBIND_ANALYSIS.md | 190 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 KEYBIND_ANALYSIS.md diff --git a/KEYBIND_ANALYSIS.md b/KEYBIND_ANALYSIS.md new file mode 100644 index 00000000000..7fbad0aa202 --- /dev/null +++ b/KEYBIND_ANALYSIS.md @@ -0,0 +1,190 @@ +# Neovim Keybind Analysis & Natural Language Search Plugin Design + +## Current Keybind Inventory + +### Core Navigation & Windows +- `` - Move focus to the left window +- `` - Move focus to the right window +- `` - Move focus to the lower window +- `` - Move focus to the upper window +- `` - Clear search highlights +- `` - Exit terminal mode + +### Search & File Operations (`s*`) +- `sf` - Search Files +- `sh` - Search Help +- `sk` - Search Keymaps +- `ss` - Search Select Telescope +- `sw` - Search current Word +- `sg` - Search by Grep +- `sd` - Search Diagnostics +- `sr` - Search Resume +- `s.` - Search Recent Files +- `s/` - Search in Open Files +- `sn` - Search Neovim files +- `/` - Fuzzily search in current buffer +- `` - Find existing buffers + +### LSP Operations (Dynamic - Buffer Specific) +- `grn` - LSP: Rename +- `gra` - LSP: Code Action +- `grr` - LSP: References +- `gri` - LSP: Implementations +- `grd` - LSP: Definitions +- `grD` - LSP: Declaration +- `gO` - LSP: Open Document Symbols +- `gW` - LSP: Open Workspace Symbols +- `grt` - LSP: Type Definition +- `lr` - LSP Reload all servers + +### Debug Operations (`d*`) - From Commented Plugin +- `dc` - DAP: Continue show UI +- `db` - DAP: Toggle Breakpoint +- `dl` - DAP: Run Last +- `di` - DAP: Step Into +- `dk` - DAP: Step Over +- `do` - DAP: Step Out +- `dx` - DAP: Run to Cursor +- `dt` - DAP: Terminate +- `dr` - DAP: Open REPL +- `du` - DAP: Toggle UI + +### Toggle Operations (`t*`) +- `tp` - Toggle path completion (from commented plugin) +- `th` - Toggle Inlay Hints (LSP dynamic) + +### Other Operations +- `q` - Open diagnostic Quickfix list +- `f` - Format buffer (from main config) + +### Which-Key Groups +- `s` - [S]earch group +- `t` - [T]oggle group +- `h` - Git [H]unk group + +## Issues & Opportunities + +### 1. **Duplicate Keybinds** +Both main `init.lua` and custom telescope plugin define identical telescope keybinds. The custom ones likely override the main ones. + +### 2. **Commented Out Functionality** +Many useful keybinds are in commented-out plugin files: +- Debug operations (`d*`) +- Path completion toggle (`tp`) +- Additional telescope configurations + +### 3. **Missing Categories** +No git operations visible (though which-key defines git hunk group), file operations beyond search, etc. + +### 4. **Inconsistent Description Patterns** +- Some use `[X]` bracket notation +- Some use full words +- LSP uses `LSP:` prefix +- DAP uses `DAP:` prefix + +## Natural Language Search Plugin Design + +### Core Concept +Create a Telescope extension that indexes all keybinds and allows fuzzy natural language search. + +### Implementation Approach + +#### 1. **Keybind Parser Module** (`lua/custom/plugins/keyfinder/parser.lua`) +```lua +-- Scan all config files for vim.keymap.set calls +-- Extract: key, mode, description, file location +-- Build searchable index with synonyms +``` + +#### 2. **Natural Language Matcher** (`lua/custom/plugins/keyfinder/matcher.lua`) +```lua +-- Map natural language to keybind concepts: +-- "find file" -> ["search", "file", "find", "open"] +-- "debug breakpoint" -> ["debug", "breakpoint", "dap", "pause"] +-- "restart lsp" -> ["lsp", "restart", "reload", "server"] +``` + +#### 3. **Telescope Extension** (`lua/custom/plugins/keyfinder/telescope.lua`) +```lua +-- Telescope picker that searches through indexed keybinds +-- Shows: Keybind | Description | Mode | File +-- Supports: fuzzy matching on natural language +``` + +#### 4. **Usage Examples** +- Type "find files" → Shows `sf` - Search Files +- Type "debug step" → Shows debug stepping keybinds +- Type "lsp rename" → Shows `grn` - LSP: Rename +- Type "reload" → Shows `lr` - LSP Reload all servers + +### Integration Points + +#### With Which-Key +- Read which-key group definitions for context +- Show which-key popup for discovered keybinds +- Integrate with which-key's delay system + +#### With Telescope +- Reuse telescope's fuzzy matching +- Follow telescope's UI patterns +- Allow chaining to other telescope commands + +#### With Help System +- Link to `:help` entries when available +- Show function signatures for LSP commands +- Display source file locations + +### Technical Implementation + +#### File Scanning Strategy +1. **Static Analysis**: Parse Lua AST for `vim.keymap.set` calls +2. **Runtime Introspection**: Query `vim.api.nvim_get_keymap()` for active bindings +3. **Plugin Integration**: Hook into lazy.nvim plugin loading to catch dynamic bindings + +#### Search Algorithm +1. **Tokenization**: Split natural language into keywords +2. **Synonym Expansion**: "find" → ["search", "find", "locate", "open"] +3. **Weighted Scoring**: Boost exact matches, penalize partial matches +4. **Context Awareness**: Consider mode, plugin context, frequency of use + +#### Performance Considerations +- **Lazy Loading**: Only scan when plugin is first used +- **Caching**: Store parsed results, invalidate on config changes +- **Incremental Updates**: Watch for file changes, update index incrementally + +### User Experience + +#### Primary Interface +- `?` or `sk` (extend existing keymap search) +- Telescope popup with natural language prompt +- Live preview of matching keybinds + +#### Secondary Features +- **Keybind Execution**: Press Enter to execute the found keybind +- **Help Integration**: `` to show help for selected keybind +- **Source Navigation**: `` to jump to keybind definition +- **Usage Statistics**: Track most-used searches, suggest improvements + +## Next Steps + +1. **Prototype Parser**: Build basic keybind extraction from config files +2. **Simple Matcher**: Implement keyword-based search +3. **Telescope Integration**: Create basic picker interface +4. **Test & Iterate**: Use with real workflows, refine search algorithm +5. **Advanced Features**: Add synonym expansion, usage tracking, help integration + +## Natural Language → Keybind Examples + +| Natural Language | Expected Keybind | Current Status | +|------------------|------------------|----------------| +| "find files" | `sf` | ✅ Active | +| "search in file" | `/` | ✅ Active | +| "debug breakpoint" | `db` | ⚠️ Commented out | +| "lsp rename" | `grn` | ✅ Active (LSP buffer only) | +| "reload lsp" | `lr` | ✅ Active | +| "git blame" | ? | ❌ Not found | +| "format code" | `f` | ✅ Active | +| "open terminal" | ? | ❌ Not found | +| "toggle diagnostics" | ? | ❌ Not found | + +This analysis reveals both the potential and the gaps in your current keybind setup. The natural language search plugin would be most valuable for discovering the numerous LSP keybinds and managing the complexity of your growing configuration. \ No newline at end of file From ac77be6eded420d19f74c18339100e076f1c8a14 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 20 Aug 2025 20:16:35 +1200 Subject: [PATCH 449/480] Update CLAUDE.md and add GitHub automation workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Restructure CLAUDE.md with project leadership and clearer organization - Add GitHub workflows for daily summaries and lead notifications - Add issue template for rebase reminders - Add hooks README for future git hook documentation Closes #17 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/ISSUE_TEMPLATE/rebase-reminder.md | 33 +++++ .github/hooks/README.md | 2 + .github/workflows/daily-summary.yml | 59 +++++++++ .github/workflows/lead-notifications.yml | 128 ++++++++++++++++++ CLAUDE.md | 154 ++++++++++++++-------- 5 files changed, 323 insertions(+), 53 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/rebase-reminder.md create mode 100644 .github/hooks/README.md create mode 100644 .github/workflows/daily-summary.yml create mode 100644 .github/workflows/lead-notifications.yml diff --git a/.github/ISSUE_TEMPLATE/rebase-reminder.md b/.github/ISSUE_TEMPLATE/rebase-reminder.md new file mode 100644 index 00000000000..d5f99fdec68 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/rebase-reminder.md @@ -0,0 +1,33 @@ +--- +name: Rebase Reminder +about: Automated reminder to rebase active worktrees +title: '⚠️ Rebase Reminder: [PR NUMBER]' +labels: rebase-reminder, automated +assignees: '' +--- + +## Action Required +PR #[NUMBER] has been merged to main. Active worktrees should be rebased. + +## Steps to Rebase + +```bash +# Update main +cd ~/dev/projects/[PROJECT] +git fetch origin main +git pull origin main + +# For each active worktree +cd ~/dev/worktrees/[PROJECT]/[WORKTREE] +git rebase origin/main +git push --force-with-lease +``` + +## Checklist +- [ ] Main branch updated +- [ ] Active worktrees identified +- [ ] Each worktree rebased +- [ ] Changes pushed with --force-with-lease + +--- +*This is an automated reminder. Close this issue once all worktrees are rebased.* diff --git a/.github/hooks/README.md b/.github/hooks/README.md new file mode 100644 index 00000000000..fbc96a8440e --- /dev/null +++ b/.github/hooks/README.md @@ -0,0 +1,2 @@ +# GitHub Hooks +Place webhook processing scripts here diff --git a/.github/workflows/daily-summary.yml b/.github/workflows/daily-summary.yml new file mode 100644 index 00000000000..1f5bf0a57e1 --- /dev/null +++ b/.github/workflows/daily-summary.yml @@ -0,0 +1,59 @@ +name: Daily Activity Summary + +on: + schedule: + - cron: '0 9 * * *' # 9 AM daily + workflow_dispatch: # Allow manual trigger + +jobs: + generate-summary: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: read + + steps: + - name: Generate Activity Summary + id: summary + run: | + echo "# 📊 Daily Activity Summary" > summary.md + echo "**Date**: $(date -u +"%Y-%m-%d")" >> summary.md + echo "**Repository**: ${{ github.repository }}" >> summary.md + echo "" >> summary.md + + # Get open PRs + echo "## 🔄 Open Pull Requests" >> summary.md + gh pr list --repo ${{ github.repository }} --state open --limit 10 --json number,title,author,createdAt \ + --jq '.[] | "- PR #\(.number): \(.title) by @\(.author.login)"' >> summary.md || echo "- None" >> summary.md + echo "" >> summary.md + + # Get open issues + echo "## 📝 Open Issues" >> summary.md + gh issue list --repo ${{ github.repository }} --state open --limit 10 --json number,title,author,createdAt \ + --jq '.[] | "- Issue #\(.number): \(.title) by @\(.author.login)"' >> summary.md || echo "- None" >> summary.md + echo "" >> summary.md + + # Recent merges (last 24 hours) + echo "## ✅ Recently Merged (24h)" >> summary.md + gh pr list --repo ${{ github.repository }} --state merged --limit 5 --json number,title,mergedAt \ + --jq '.[] | select(.mergedAt > (now - 86400 | strftime("%Y-%m-%dT%H:%M:%SZ"))) | "- PR #\(.number): \(.title)"' >> summary.md || echo "- None" >> summary.md + + cat summary.md + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create Summary Issue + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + run: | + # Close previous daily summaries + gh issue list --repo ${{ github.repository }} --label "daily-summary" --state open --json number \ + --jq '.[].number' | xargs -I {} gh issue close {} --repo ${{ github.repository }} || true + + # Create new summary + gh issue create \ + --repo ${{ github.repository }} \ + --title "📊 Daily Summary: $(date -u +"%Y-%m-%d")" \ + --body-file summary.md \ + --label "daily-summary,automated" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/lead-notifications.yml b/.github/workflows/lead-notifications.yml new file mode 100644 index 00000000000..eb404873166 --- /dev/null +++ b/.github/workflows/lead-notifications.yml @@ -0,0 +1,128 @@ +name: Lead Notifications + +on: + issues: + types: [opened, closed, reopened, assigned, unassigned] + pull_request: + types: [opened, closed, reopened, review_requested, ready_for_review, merged] + pull_request_review: + types: [submitted] + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + push: + branches: [main] + +jobs: + notify-lead: + runs-on: ubuntu-latest + if: github.actor != 'github-actions[bot]' # Don't notify about bot actions + + steps: + - name: Generate Summary + id: summary + run: | + # Determine event description + case "${{ github.event_name }}" in + "issues") + DESCRIPTION="Issue #${{ github.event.issue.number }}: ${{ github.event.action }}" + URL="${{ github.event.issue.html_url }}" + ;; + "pull_request") + DESCRIPTION="PR #${{ github.event.pull_request.number }}: ${{ github.event.action }}" + URL="${{ github.event.pull_request.html_url }}" + ;; + "pull_request_review") + DESCRIPTION="Review on PR #${{ github.event.pull_request.number }}" + URL="${{ github.event.review.html_url }}" + ;; + "issue_comment") + DESCRIPTION="Comment on #${{ github.event.issue.number }}" + URL="${{ github.event.comment.html_url }}" + ;; + "pull_request_review_comment") + DESCRIPTION="Review comment on PR #${{ github.event.pull_request.number }}" + URL="${{ github.event.comment.html_url }}" + ;; + "push") + DESCRIPTION="Push to main by ${{ github.actor }}" + URL="${{ github.event.compare }}" + ;; + *) + DESCRIPTION="${{ github.event_name }} by ${{ github.actor }}" + URL="${{ github.server_url }}/${{ github.repository }}" + ;; + esac + + echo "description=$DESCRIPTION" >> $GITHUB_OUTPUT + echo "url=$URL" >> $GITHUB_OUTPUT + + - name: Create Desktop Notification (macOS) + if: runner.os == 'macOS' + run: | + osascript -e 'display notification "${{ steps.summary.outputs.description }}" with title "[${{ github.repository }}]" sound name "Glass"' + + - name: Log Activity + run: | + echo "📢 Repository Activity:" + echo "Repository: ${{ github.repository }}" + echo "Event: ${{ github.event_name }}" + echo "Actor: ${{ github.actor }}" + echo "Description: ${{ steps.summary.outputs.description }}" + echo "URL: ${{ steps.summary.outputs.url }}" + echo "Time: $(date -u +"%Y-%m-%d %H:%M:%S UTC")" + + # Optional: Post to Slack + # - name: Slack Notification + # if: github.event_name == 'pull_request' && github.event.action == 'opened' + # uses: slackapi/slack-github-action@v1 + # with: + # payload: | + # { + # "text": "New PR in ${{ github.repository }}", + # "blocks": [{ + # "type": "section", + # "text": { + # "type": "mrkdwn", + # "text": "🔔 *${{ steps.summary.outputs.description }}*\n<${{ steps.summary.outputs.url }}|View on GitHub>" + # } + # }] + # } + # env: + # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + + rebase-reminder: + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true + + steps: + - name: Create Rebase Reminder Issue + run: | + gh issue create \ + --repo ${{ github.repository }} \ + --title "⚠️ Rebase Reminder: PR #${{ github.event.pull_request.number }} merged" \ + --body "PR #${{ github.event.pull_request.number }} was merged to main. + +Active worktrees should be rebased to avoid conflicts: + +\`\`\`bash +# Update main +cd ~/dev/projects/$(basename ${{ github.repository }}) +git fetch origin main +git pull origin main + +# For each active worktree +cd ~/dev/worktrees/$(basename ${{ github.repository }})/ +git rebase origin/main +git push --force-with-lease +\`\`\` + +**Merged PR**: ${{ github.event.pull_request.title }} +**Merged by**: ${{ github.event.pull_request.merged_by.login }} +**Link**: ${{ github.event.pull_request.html_url }} + +This issue can be closed once all active worktrees have been rebased." \ + --label "rebase-reminder,automated" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md index 920b4da45ea..1b27ff75fab 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,12 +1,16 @@ # CLAUDE.md -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. +This file provides guidance to Claude Code when working with Neovim configuration. -## Neovim Configuration Structure +## Project Leadership +You are the lead Claude for the **nvim** project. You have authority to self-assign and work on issues in this repository. -This is a Neovim configuration forked from https://github.com/nvim-lua/kickstart.nvim and structured to minimize merge conflicts when updating from upstream. All custom modifications are isolated in the `lua/custom/` directory, allowing the main `init.lua` and kickstart files to be updated with minimal conflicts. +## Project Overview +A modular Neovim configuration forked from [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim), structured to minimize merge conflicts when updating from upstream. All custom modifications are isolated in the `lua/custom/` directory, allowing the main `init.lua` to stay in sync with kickstart while maintaining our customizations. -The configuration is organized in a modular structure: +**Key Design Principle**: Never modify kickstart files directly - all customizations go in `lua/custom/` to ensure clean merges from upstream. + +## Architecture - **`init.lua`**: Main configuration file that loads all settings, keymaps, and plugins - **`lua/custom/`**: Custom configuration modules @@ -18,9 +22,18 @@ The configuration is organized in a modular structure: - **`lsp.lua`**: LSP server configurations (Python, Nix, Rust, Go, C/C++) - **`clangd_helper.lua`**: Advanced clangd setup with compile_commands.json detection and file watching -## LSP Configuration +### Key Components +- **`init.lua`**: Main configuration file that loads all settings, keymaps, and plugins +- **`lua/custom/`**: Custom configuration modules + - **`options.lua`**: Custom vim options (indentation, Nerd Font settings) + - **`keymaps.lua`**: Custom key mappings + - **`plugins/`**: Plugin configurations + - **`init.lua`**: Plugin imports and basic plugin setup + - **`lsp/`**: LSP-specific configurations + - **`lsp.lua`**: LSP server configurations (Python, Nix, Rust, Go, C/C++) + - **`clangd_helper.lua`**: Advanced clangd setup with compile_commands.json detection -The LSP setup includes: +### LSP Servers Configured: - **clangd**: C/C++ with automatic compile_commands.json detection and file watching - **pyright**: Python language server with basic type checking - **nixd**: Nix language server @@ -28,54 +41,89 @@ The LSP setup includes: - **texlab**: LaTeX support - **cmake**: CMake language server -The clangd configuration in `lua/custom/plugins/lsp/clangd_helper.lua` automatically: -- Searches for compile_commands.json files using `fd` -- Watches for changes and restarts clangd when compile_commands.json is updated -- Provides a `:ReloadClangd` command for manual restart - -## Key Features +## Development Commands -- Uses **lazy.nvim** for plugin management -- **Blink.cmp** for autocompletion with LSP integration -- **Telescope** for fuzzy finding -- **Treesitter** for syntax highlighting -- **Which-key** for keymap help -- **Mini.nvim** modules for text objects, surround, and statusline -- **TokyoNight** colorscheme +### Plugin Management +- `:Lazy` - Open plugin manager UI +- `:Lazy reload` - Reload plugin configurations +- `:checkhealth` - Verify all dependencies and configuration -## Common Commands - -- `:Lazy` - Manage plugins (install, update, etc.) -- `:checkhealth` - Check Neovim configuration health -- `:ReloadClangd` - Manually restart clangd LSP server +### Search & Navigation +- `sf` - Find files (Telescope) +- `sg` - Live grep search (Telescope) - `sh` - Search help documentation -- `sf` - Find files -- `sg` - Live grep search +- `sk` - Search keymaps +- `/` - Fuzzy search in current buffer + +### Git Operations (via vim-fugitive) +- `gs` - Git status +- `gd` - Git diff +- `gc` - Git commit +- `gb` - Git blame +- `gl` - Git log +- `gp` - Git push +- `gf` - Git fetch + +### LSP Operations - `f` - Format current buffer - -## Git Workflow - -This project follows the standardized git workflow documented at: `../git-workflow.yaml` - -Key principles: -- Never work directly on main branch -- Issue-driven development with `gh issue create` -- Always use worktrees for feature development -- Complete cleanup after merge - -## Development Practices - -Claude Code instances should follow the development practices documented at: `../development-practices.yaml` - -This includes: -- Task management with TodoWrite -- Tool usage patterns and batching -- Debugging approaches and common bug patterns -- Code quality standards and communication guidelines - -## Development Workflow - -1. Configuration changes are made in `lua/custom/` files -2. Plugin configurations go in `lua/custom/plugins/` -3. LSP servers are expected to be installed system-wide (via Nix/Home Manager based on comments) -4. The configuration uses lazy loading for most plugins to optimize startup time \ No newline at end of file +- `lr` - Reload all LSP servers +- `:ReloadClangd` - Manually restart clangd +- `grn` - Rename symbol +- `gra` - Code action +- `grr` - Find references +- `grd` - Go to definition + +## Project-Specific Conventions +- Configuration changes are made in `lua/custom/` files +- Plugin configurations go in `lua/custom/plugins/` +- LSP servers are expected to be installed system-wide (via Nix/Home Manager) +- The configuration uses lazy loading for most plugins to optimize startup time + +## External Dependencies + +### System Requirements +- **git**, **make**, **unzip**, **gcc** - Basic build tools +- **ripgrep** - Fast text search (required for Telescope grep) +- **fd** - Fast file finder (required for Telescope file search) +- **Clipboard tool** - xclip/xsel on Linux, pbcopy on macOS +- **Nerd Font** - Optional but recommended for icons (currently enabled) + +### Neovim Plugins +- **lazy.nvim** - Plugin management +- **Blink.cmp** - Autocompletion with LSP integration +- **Telescope** - Fuzzy finding +- **Treesitter** - Syntax highlighting +- **Which-key** - Keymap help +- **Mini.nvim** - Text objects, surround, and statusline +- **TokyoNight** - Colorscheme +- **vim-fugitive** - Git integration (`:Git` commands) +- **gitsigns.nvim** - Git gutter and hunk operations +- **nvim-tmux-navigator** - Seamless tmux/nvim navigation +- **GitHub Copilot** - AI code suggestions (being replaced with zbirenbaum/copilot.lua) + +### LSP Servers (via Nix/Home Manager) +- **clangd** - C/C++ +- **pyright** - Python type checking +- **ruff** - Python linting +- **nixd** - Nix language +- **texlab** - LaTeX +- **cmake-language-server** - CMake + +## Common Tasks +- **Add new plugin**: Create file in `lua/custom/plugins/`, add import to `lua/custom/plugins/init.lua` +- **Update LSP config**: Edit `lua/custom/plugins/lsp/lsp.lua` +- **Change keybindings**: Edit `lua/custom/keymaps.lua` +- **Update from upstream kickstart**: + ```bash + git fetch kickstart + git merge kickstart/master + # Conflicts should only be in init.lua, not in lua/custom/ + ``` +- **Disable a plugin temporarily**: Rename to `.disabled` (e.g., `avante.lua.disabled`) +- **Test plugin changes**: `:Lazy reload` or restart Neovim +- **Check health**: `:checkhealth` to verify all dependencies + +## References +- Team standards: `../CLAUDE.md` +- Git workflow: `../git-workflow.yaml` +- Development practices: `../development-practices.yaml` \ No newline at end of file From f7e21a4a2a23dc63b11ffe40dec13604c47e4845 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 20 Aug 2025 21:40:30 +1200 Subject: [PATCH 450/480] Improve tmux shared session detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add case-insensitive check for 'shared' in session name - Keep existing check for multiple attached clients - Add documentation about vim.fn.confirm() keyboard shortcuts - Update CLAUDE.md with nvdev testing workflow This ensures the quit warning triggers for any session with 'shared' in the name, not just sessions with multiple attachments. Fixes #21 🤖 Generated with Claude Code Co-Authored-By: Claude --- CLAUDE.md | 9 +++++++++ lua/custom/options.lua | 12 ++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 1b27ff75fab..49422f7f775 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -43,6 +43,14 @@ A modular Neovim configuration forked from [kickstart.nvim](https://github.com/n ## Development Commands +### Testing Configuration Changes +- **`nvdev`** - Launch Neovim with isolated test configuration + - Completely separate from regular nvim (uses `NVIM_APPNAME="nvim-custom"`) + - All data/cache/state redirected to project directory + - Logs saved to `.local/state/nvim-launch.log` + - **Use this to verify any configuration changes before committing** + - Example: `nvdev` to test, `nvdev somefile.lua` to test with a specific file + ### Plugin Management - `:Lazy` - Open plugin manager UI - `:Lazy reload` - Reload plugin configurations @@ -113,6 +121,7 @@ A modular Neovim configuration forked from [kickstart.nvim](https://github.com/n - **Add new plugin**: Create file in `lua/custom/plugins/`, add import to `lua/custom/plugins/init.lua` - **Update LSP config**: Edit `lua/custom/plugins/lsp/lsp.lua` - **Change keybindings**: Edit `lua/custom/keymaps.lua` +- **Visual/UI changes**: After Claude tests with `nvdev`, dlond will verify GUI elements (colors, themes, visual plugins) - **Update from upstream kickstart**: ```bash git fetch kickstart diff --git a/lua/custom/options.lua b/lua/custom/options.lua index c16cd476562..b3b15566d3a 100644 --- a/lua/custom/options.lua +++ b/lua/custom/options.lua @@ -33,6 +33,12 @@ local function is_shared_tmux_session() local output = handle:read('*a') handle:close() + -- Check if session name contains "shared" (case insensitive) + if current_session:lower():find('shared') then + return true + end + + -- Also check if multiple users are attached for line in output:gmatch('[^\r\n]+') do local session_name, attached_count = line:match('([^:]+):(%d+)') if session_name == current_session and tonumber(attached_count) > 1 then @@ -50,10 +56,12 @@ vim.api.nvim_create_autocmd('VimLeavePre', { local choice = vim.fn.confirm( 'You are in a shared tmux session. Other users may be affected.\nDo you really want to quit?', '&Yes\n&No', - 2 + 2 -- Default to No ) + -- vim.fn.confirm returns 1 for Yes, 2 for No, 0 for Esc + -- The & makes Y/y and N/n work as shortcuts (case-insensitive) if choice ~= 1 then - return + return -- Prevent quit unless explicitly choosing Yes end end end, From cdedb7f54c6f0663291ff70337c70e1b77e974f1 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 27 Aug 2025 14:18:07 +1200 Subject: [PATCH 451/480] Remove CLAUDE.md from version control MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CLAUDE.md contains project-specific instructions but should not be tracked in git as it can vary between working copies. Added to .gitignore to prevent accidental commits while keeping it locally available for reference. Fixes #25 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .gitignore | 1 + CLAUDE.md | 138 ----------------------------------------------------- 2 files changed, 1 insertion(+), 138 deletions(-) delete mode 100644 CLAUDE.md diff --git a/.gitignore b/.gitignore index 5ffa64347b0..b2080743a0c 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ lazy-lock.json # Development artifacts *.disabled todo.md +CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index 49422f7f775..00000000000 --- a/CLAUDE.md +++ /dev/null @@ -1,138 +0,0 @@ -# CLAUDE.md - -This file provides guidance to Claude Code when working with Neovim configuration. - -## Project Leadership -You are the lead Claude for the **nvim** project. You have authority to self-assign and work on issues in this repository. - -## Project Overview -A modular Neovim configuration forked from [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim), structured to minimize merge conflicts when updating from upstream. All custom modifications are isolated in the `lua/custom/` directory, allowing the main `init.lua` to stay in sync with kickstart while maintaining our customizations. - -**Key Design Principle**: Never modify kickstart files directly - all customizations go in `lua/custom/` to ensure clean merges from upstream. - -## Architecture - -- **`init.lua`**: Main configuration file that loads all settings, keymaps, and plugins -- **`lua/custom/`**: Custom configuration modules - - **`options.lua`**: Custom vim options (indentation, Nerd Font settings) - - **`keymaps.lua`**: Custom key mappings - - **`plugins/`**: Plugin configurations - - **`init.lua`**: Plugin imports and basic plugin setup - - **`lsp/`**: LSP-specific configurations - - **`lsp.lua`**: LSP server configurations (Python, Nix, Rust, Go, C/C++) - - **`clangd_helper.lua`**: Advanced clangd setup with compile_commands.json detection and file watching - -### Key Components -- **`init.lua`**: Main configuration file that loads all settings, keymaps, and plugins -- **`lua/custom/`**: Custom configuration modules - - **`options.lua`**: Custom vim options (indentation, Nerd Font settings) - - **`keymaps.lua`**: Custom key mappings - - **`plugins/`**: Plugin configurations - - **`init.lua`**: Plugin imports and basic plugin setup - - **`lsp/`**: LSP-specific configurations - - **`lsp.lua`**: LSP server configurations (Python, Nix, Rust, Go, C/C++) - - **`clangd_helper.lua`**: Advanced clangd setup with compile_commands.json detection - -### LSP Servers Configured: -- **clangd**: C/C++ with automatic compile_commands.json detection and file watching -- **pyright**: Python language server with basic type checking -- **nixd**: Nix language server -- **ruff**: Python linter -- **texlab**: LaTeX support -- **cmake**: CMake language server - -## Development Commands - -### Testing Configuration Changes -- **`nvdev`** - Launch Neovim with isolated test configuration - - Completely separate from regular nvim (uses `NVIM_APPNAME="nvim-custom"`) - - All data/cache/state redirected to project directory - - Logs saved to `.local/state/nvim-launch.log` - - **Use this to verify any configuration changes before committing** - - Example: `nvdev` to test, `nvdev somefile.lua` to test with a specific file - -### Plugin Management -- `:Lazy` - Open plugin manager UI -- `:Lazy reload` - Reload plugin configurations -- `:checkhealth` - Verify all dependencies and configuration - -### Search & Navigation -- `sf` - Find files (Telescope) -- `sg` - Live grep search (Telescope) -- `sh` - Search help documentation -- `sk` - Search keymaps -- `/` - Fuzzy search in current buffer - -### Git Operations (via vim-fugitive) -- `gs` - Git status -- `gd` - Git diff -- `gc` - Git commit -- `gb` - Git blame -- `gl` - Git log -- `gp` - Git push -- `gf` - Git fetch - -### LSP Operations -- `f` - Format current buffer -- `lr` - Reload all LSP servers -- `:ReloadClangd` - Manually restart clangd -- `grn` - Rename symbol -- `gra` - Code action -- `grr` - Find references -- `grd` - Go to definition - -## Project-Specific Conventions -- Configuration changes are made in `lua/custom/` files -- Plugin configurations go in `lua/custom/plugins/` -- LSP servers are expected to be installed system-wide (via Nix/Home Manager) -- The configuration uses lazy loading for most plugins to optimize startup time - -## External Dependencies - -### System Requirements -- **git**, **make**, **unzip**, **gcc** - Basic build tools -- **ripgrep** - Fast text search (required for Telescope grep) -- **fd** - Fast file finder (required for Telescope file search) -- **Clipboard tool** - xclip/xsel on Linux, pbcopy on macOS -- **Nerd Font** - Optional but recommended for icons (currently enabled) - -### Neovim Plugins -- **lazy.nvim** - Plugin management -- **Blink.cmp** - Autocompletion with LSP integration -- **Telescope** - Fuzzy finding -- **Treesitter** - Syntax highlighting -- **Which-key** - Keymap help -- **Mini.nvim** - Text objects, surround, and statusline -- **TokyoNight** - Colorscheme -- **vim-fugitive** - Git integration (`:Git` commands) -- **gitsigns.nvim** - Git gutter and hunk operations -- **nvim-tmux-navigator** - Seamless tmux/nvim navigation -- **GitHub Copilot** - AI code suggestions (being replaced with zbirenbaum/copilot.lua) - -### LSP Servers (via Nix/Home Manager) -- **clangd** - C/C++ -- **pyright** - Python type checking -- **ruff** - Python linting -- **nixd** - Nix language -- **texlab** - LaTeX -- **cmake-language-server** - CMake - -## Common Tasks -- **Add new plugin**: Create file in `lua/custom/plugins/`, add import to `lua/custom/plugins/init.lua` -- **Update LSP config**: Edit `lua/custom/plugins/lsp/lsp.lua` -- **Change keybindings**: Edit `lua/custom/keymaps.lua` -- **Visual/UI changes**: After Claude tests with `nvdev`, dlond will verify GUI elements (colors, themes, visual plugins) -- **Update from upstream kickstart**: - ```bash - git fetch kickstart - git merge kickstart/master - # Conflicts should only be in init.lua, not in lua/custom/ - ``` -- **Disable a plugin temporarily**: Rename to `.disabled` (e.g., `avante.lua.disabled`) -- **Test plugin changes**: `:Lazy reload` or restart Neovim -- **Check health**: `:checkhealth` to verify all dependencies - -## References -- Team standards: `../CLAUDE.md` -- Git workflow: `../git-workflow.yaml` -- Development practices: `../development-practices.yaml` \ No newline at end of file From 277be1e79b5ad00340306fe0c486b6424ee2f6b5 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 27 Aug 2025 14:44:03 +1200 Subject: [PATCH 452/480] Integrate Copilot with Blink.cmp - Switch from copilot.vim to zbirenbaum/copilot.lua - Add blink-cmp-copilot for completion integration - Configure Blink to show Copilot in completion menu - Fix plugin import issues Testing in progress - can be reverted if needed --- lua/custom/plugins/blink.lua | 23 ++++++++++++++++++++++ lua/custom/plugins/copilot.lua | 35 +++++++++++++++++++++++++++------- 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/lua/custom/plugins/blink.lua b/lua/custom/plugins/blink.lua index 1baf69e0896..3f70437d9c9 100644 --- a/lua/custom/plugins/blink.lua +++ b/lua/custom/plugins/blink.lua @@ -1,6 +1,29 @@ return { 'saghen/blink.cmp', + dependencies = { + "giuxtaposition/blink-cmp-copilot", + }, opts = { + sources = { + default = { "lsp", "path", "copilot", "buffer" }, + providers = { + copilot = { + name = "copilot", + module = "blink-cmp-copilot", + score_offset = 100, -- High priority to show Copilot near the top + async = true, + }, + }, + }, + keymap = { + preset = 'default', + accept = '', -- Your preferred accept key + }, + appearance = { + -- Show source of completion (LSP/Copilot/Buffer) + use_nvim_cmp_as_default = false, + nerd_font_variant = 'mono', + }, fuzzy = {}, }, } diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua index 18744d84091..f46c2590ce6 100644 --- a/lua/custom/plugins/copilot.lua +++ b/lua/custom/plugins/copilot.lua @@ -1,14 +1,35 @@ return { + -- Use copilot.lua for API access (no UI) { - 'github/copilot.vim', - event = 'VimEnter', + "zbirenbaum/copilot.lua", + cmd = "Copilot", + event = "InsertEnter", config = function() - -- Accept suggestion with Ctrl-y - vim.keymap.set('i', '', 'copilot#Accept("\\")', { - expr = true, - replace_keycodes = false + require("copilot").setup({ + suggestion = { enabled = false }, -- Disable inline ghost text + panel = { enabled = false }, -- Disable suggestion panel + filetypes = { + yaml = false, + markdown = false, + help = false, + gitcommit = false, + gitrebase = false, + hgcommit = false, + svn = false, + cvs = false, + ["."] = false, + }, + copilot_node_command = 'node', -- Node.js version must be > 18.x + server_opts_overrides = {}, }) - vim.g.copilot_no_tab_map = true end, }, + + -- Bridge between copilot.lua and blink.cmp + { + "giuxtaposition/blink-cmp-copilot", + dependencies = { + "zbirenbaum/copilot.lua", + }, + }, } From f81cab2da38af90ec2b9c5a85a43c89441a5dd71 Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 2 Sep 2025 13:21:18 +1200 Subject: [PATCH 453/480] refactor: Complete modular migration from kickstart.nvim Major architectural overhaul to transform the flat kickstart.nvim structure into a maintainable, modular configuration while preserving upstream sync capability. ## Structure Changes - Migrated from flat `lua/custom/` to organized `lua/core/` and `lua/plugins/` - Separated plugin specs from configs: `lua/plugins/spec/` and `lua/plugins/config/` - Complex configs (LSP, Debug) now use directory structure with sub-modules: - `lsp/init.lua`, `lsp/servers.lua`, `lsp/keymaps.lua` - `debug/init.lua`, `debug/adapters.lua`, `debug/keymaps.lua` ## Core Improvements - Created dedicated core modules: options, keymaps, autocmds, bootstrap, health - Added comprehensive health check (`lua/core/health.lua`) for diagnostics - Simplified init.lua to just orchestrate module loading - Better separation of concerns throughout ## Plugin Updates - Fixed Blink.cmp configuration (removed invalid fuzzy options) - Integrated Copilot with Blink.cmp for unified completion experience - Added autopairs and indent-line from kickstart examples - Optimized for Nix development environments (removed venv assumptions) ## Documentation - Updated README with modular structure and kickstart sync instructions - Created comprehensive KEYBIND_ANALYSIS.md with all mappings - Added modular.txt help documentation - Created TODO_TEST.md checklist for testing ## Benefits - Easier to maintain and extend - Clean separation allows upstream kickstart merges without conflicts - Scalable architecture for adding new languages/tools - Better code organization and discoverability All kickstart functionality preserved while gaining modularity and maintainability. --- .envrc | 10 + KEYBIND_ANALYSIS.md | 403 ++++---- README.md | 501 +++++---- doc/kickstart.txt | 24 - doc/modular.txt | 222 ++++ doc/tags | 21 +- init.lua | 958 +----------------- lua/core/autocmds.lua | 0 lua/core/bootstrap.lua | 13 + lua/core/health.lua | 98 ++ lua/{custom => core}/keymaps.lua | 0 lua/{custom => core}/options.lua | 0 lua/custom/plugins/blink.lua | 29 - lua/custom/plugins/copilot.lua | 35 - lua/custom/plugins/debug.lua | 157 --- lua/custom/plugins/git.lua | 73 -- lua/custom/plugins/init.lua | 17 - lua/custom/plugins/lsp/init.lua | 3 - lua/custom/plugins/lsp/lsp.lua | 91 -- lua/custom/plugins/nvim-tmux-navigator.lua | 11 - lua/custom/plugins/telescope.lua | 85 -- lua/custom/plugins/treesitter.lua | 52 - lua/custom/utils.lua | 69 -- lua/kickstart/health.lua | 52 - lua/kickstart/plugins/autopairs.lua | 8 - lua/kickstart/plugins/debug.lua | 127 --- lua/kickstart/plugins/gitsigns.lua | 61 -- lua/kickstart/plugins/indent_line.lua | 9 - lua/kickstart/plugins/lint.lua | 60 -- lua/kickstart/plugins/neo-tree.lua | 25 - lua/plugins/config/blink.lua | 126 +++ lua/plugins/config/debug/adapters.lua | 158 +++ lua/plugins/config/debug/init.lua | 38 + lua/plugins/config/debug/keymaps.lua | 59 ++ lua/plugins/config/editor.lua | 59 ++ lua/plugins/config/git.lua | 69 ++ lua/plugins/config/lsp/init.lua | 26 + lua/plugins/config/lsp/keymaps.lua | 57 ++ lua/plugins/config/lsp/servers.lua | 88 ++ lua/plugins/config/telescope.lua | 84 ++ lua/plugins/config/ui.lua | 57 ++ lua/plugins/spec/autopairs.lua | 24 + lua/plugins/spec/blink.lua | 12 + lua/plugins/spec/copilot.lua | 21 + lua/plugins/spec/debug.lua | 20 + lua/plugins/spec/editor.lua | 36 + .../plugins => plugins/spec}/formatting.lua | 0 lua/plugins/spec/git.lua | 26 + lua/plugins/spec/indent-line.lua | 33 + lua/plugins/spec/init.lua | 25 + lua/plugins/spec/lsp.lua | 26 + lua/plugins/spec/nvim-tmux-navigator.lua | 11 + lua/plugins/spec/telescope.lua | 21 + lua/plugins/spec/treesitter.lua | 45 + lua/plugins/spec/ui.lua | 29 + 55 files changed, 2052 insertions(+), 2312 deletions(-) delete mode 100644 doc/kickstart.txt create mode 100644 doc/modular.txt create mode 100644 lua/core/autocmds.lua create mode 100644 lua/core/bootstrap.lua create mode 100644 lua/core/health.lua rename lua/{custom => core}/keymaps.lua (100%) rename lua/{custom => core}/options.lua (100%) delete mode 100644 lua/custom/plugins/blink.lua delete mode 100644 lua/custom/plugins/copilot.lua delete mode 100644 lua/custom/plugins/debug.lua delete mode 100644 lua/custom/plugins/git.lua delete mode 100644 lua/custom/plugins/init.lua delete mode 100644 lua/custom/plugins/lsp/init.lua delete mode 100644 lua/custom/plugins/lsp/lsp.lua delete mode 100644 lua/custom/plugins/nvim-tmux-navigator.lua delete mode 100644 lua/custom/plugins/telescope.lua delete mode 100644 lua/custom/plugins/treesitter.lua delete mode 100644 lua/custom/utils.lua delete mode 100644 lua/kickstart/health.lua delete mode 100644 lua/kickstart/plugins/autopairs.lua delete mode 100644 lua/kickstart/plugins/debug.lua delete mode 100644 lua/kickstart/plugins/gitsigns.lua delete mode 100644 lua/kickstart/plugins/indent_line.lua delete mode 100644 lua/kickstart/plugins/lint.lua delete mode 100644 lua/kickstart/plugins/neo-tree.lua create mode 100644 lua/plugins/config/blink.lua create mode 100644 lua/plugins/config/debug/adapters.lua create mode 100644 lua/plugins/config/debug/init.lua create mode 100644 lua/plugins/config/debug/keymaps.lua create mode 100644 lua/plugins/config/editor.lua create mode 100644 lua/plugins/config/git.lua create mode 100644 lua/plugins/config/lsp/init.lua create mode 100644 lua/plugins/config/lsp/keymaps.lua create mode 100644 lua/plugins/config/lsp/servers.lua create mode 100644 lua/plugins/config/telescope.lua create mode 100644 lua/plugins/config/ui.lua create mode 100644 lua/plugins/spec/autopairs.lua create mode 100644 lua/plugins/spec/blink.lua create mode 100644 lua/plugins/spec/copilot.lua create mode 100644 lua/plugins/spec/debug.lua create mode 100644 lua/plugins/spec/editor.lua rename lua/{custom/plugins => plugins/spec}/formatting.lua (100%) create mode 100644 lua/plugins/spec/git.lua create mode 100644 lua/plugins/spec/indent-line.lua create mode 100644 lua/plugins/spec/init.lua create mode 100644 lua/plugins/spec/lsp.lua create mode 100644 lua/plugins/spec/nvim-tmux-navigator.lua create mode 100644 lua/plugins/spec/telescope.lua create mode 100644 lua/plugins/spec/treesitter.lua create mode 100644 lua/plugins/spec/ui.lua diff --git a/.envrc b/.envrc index 281accf5adf..a87ac425a74 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,11 @@ export PROJECT=$(basename $(pwd)) + +# Get the git project root +export PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd) + +# Set Lua paths for Neovim to find our modules +export LUA_PATH="$PROJECT_ROOT/lua/?.lua;$PROJECT_ROOT/lua/?/init.lua;;" +export LUA_CPATH="$PROJECT_ROOT/lua/?.so;;" + +# Optional: Set NVIM_APPNAME for isolated testing +export NVIM_APPNAME="nvim-$PROJECT" \ No newline at end of file diff --git a/KEYBIND_ANALYSIS.md b/KEYBIND_ANALYSIS.md index 7fbad0aa202..0bd1b49ecd9 100644 --- a/KEYBIND_ANALYSIS.md +++ b/KEYBIND_ANALYSIS.md @@ -1,190 +1,217 @@ -# Neovim Keybind Analysis & Natural Language Search Plugin Design - -## Current Keybind Inventory - -### Core Navigation & Windows -- `` - Move focus to the left window -- `` - Move focus to the right window -- `` - Move focus to the lower window -- `` - Move focus to the upper window -- `` - Clear search highlights -- `` - Exit terminal mode - -### Search & File Operations (`s*`) -- `sf` - Search Files -- `sh` - Search Help -- `sk` - Search Keymaps -- `ss` - Search Select Telescope -- `sw` - Search current Word -- `sg` - Search by Grep -- `sd` - Search Diagnostics -- `sr` - Search Resume -- `s.` - Search Recent Files -- `s/` - Search in Open Files -- `sn` - Search Neovim files -- `/` - Fuzzily search in current buffer -- `` - Find existing buffers - -### LSP Operations (Dynamic - Buffer Specific) -- `grn` - LSP: Rename -- `gra` - LSP: Code Action -- `grr` - LSP: References -- `gri` - LSP: Implementations -- `grd` - LSP: Definitions -- `grD` - LSP: Declaration -- `gO` - LSP: Open Document Symbols -- `gW` - LSP: Open Workspace Symbols -- `grt` - LSP: Type Definition -- `lr` - LSP Reload all servers - -### Debug Operations (`d*`) - From Commented Plugin -- `dc` - DAP: Continue show UI -- `db` - DAP: Toggle Breakpoint -- `dl` - DAP: Run Last -- `di` - DAP: Step Into -- `dk` - DAP: Step Over -- `do` - DAP: Step Out -- `dx` - DAP: Run to Cursor -- `dt` - DAP: Terminate -- `dr` - DAP: Open REPL -- `du` - DAP: Toggle UI - -### Toggle Operations (`t*`) -- `tp` - Toggle path completion (from commented plugin) -- `th` - Toggle Inlay Hints (LSP dynamic) - -### Other Operations -- `q` - Open diagnostic Quickfix list -- `f` - Format buffer (from main config) +# Neovim Keybind Analysis + +## Current Active Keybindings (Modular Config) + +### Leader Key +- **Leader**: `` + +### Core Navigation & Editing +- `` - Clear search highlights (in normal mode) +- `q` - Open diagnostic quickfix list +- `` - Exit terminal mode (in terminal) + +### Window/Tmux Navigation +- `` - Navigate to left window/tmux pane +- `` - Navigate to down window/tmux pane +- `` - Navigate to up window/tmux pane +- `` - Navigate to right window/tmux pane +- `` - Navigate to previous tmux pane + +### Search & Files (`s*`) +- `sf` - **[S]earch [F]iles** - Find files in project +- `sg` - **[S]earch by [G]rep** - Live grep search +- `sh` - **[S]earch [H]elp** - Search help documentation +- `sk` - **[S]earch [K]eymaps** - Browse all keymaps +- `ss` - **[S]earch [S]elect Telescope** - Telescope picker +- `sw` - **[S]earch current [W]ord** - Search word under cursor +- `sd` - **[S]earch [D]iagnostics** - Browse diagnostics +- `sr` - **[S]earch [R]esume** - Resume last search +- `s.` - **[S]earch Recent Files** - Recently opened files +- `s/` - **[S]earch in Open Files** - Grep in open buffers +- `sn` - **[S]earch [N]eovim files** - Browse config files +- `/` - **Fuzzy search in current buffer** +- `` - **Find existing buffers** + +### LSP Operations +- `gd` - **[G]oto [D]efinition** +- `grr` - **[G]oto [R]eferences** +- `gri` - **[G]oto [I]mplementation** +- `grD` - **[G]oto [D]eclaration** +- `grt` - **[G]oto [T]ype definition** +- `grn` - **[G]oto [R]e[n]ame** - Rename symbol +- `gra` - **[G]oto code [A]ction** (also works in visual mode) +- `gO` - **[G]oto [O]pen document symbols** +- `gW` - **[G]oto [W]orkspace symbols** +- `K` - **Hover Documentation** +- `f` - **[F]ormat buffer** +- `lr` - **[L]SP [R]eload** all servers + +### Diagnostics +- `[d` - Previous diagnostic message +- `]d` - Next diagnostic message +- `e` - Show diagnostic error messages (float) +- `q` - Open diagnostic quickfix list + +### Git Operations (`g*`) +#### Fugitive Commands +- `gs` - **[G]it [S]tatus** - Open Git status +- `gd` - **[G]it [D]iff** - Show diff +- `gc` - **[G]it [C]ommit** - Create commit +- `gb` - **[G]it [B]lame** - Show blame +- `gl` - **[G]it [L]og** - View log +- `gp` - **[G]it [P]ush** - Push changes +- `gf` - **[G]it [F]etch** - Fetch from remote + +#### Gitsigns Hunks (`h*`) +- `]c` - Jump to next git change +- `[c` - Jump to previous git change +- `hs` - **[H]unk [S]tage** - Stage current hunk +- `hr` - **[H]unk [R]eset** - Reset current hunk +- `hS` - **[H]unk [S]tage buffer** - Stage entire buffer +- `hu` - **[H]unk [U]ndo stage** - Undo stage hunk +- `hR` - **[H]unk [R]eset buffer** - Reset entire buffer +- `hp` - **[H]unk [P]review** - Preview hunk changes +- `hb` - **[H]unk [B]lame line** - Show blame for line +- `hd` - **[H]unk [D]iff** - Diff against index +- `hD` - **[H]unk [D]iff** - Diff against last commit +- `tb` - **[T]oggle [B]lame line** - Toggle inline blame +- `tD` - **[T]oggle [D]eleted** - Toggle deleted lines + +### Debug Operations (DAP) +- `` - **Start/Continue** debugging +- `` - **Step Over** +- `` - **Step Into** +- `` - **Step Out** +- `` - **Toggle Debug UI** +- `db` - **[D]ebug [B]reakpoint** - Toggle breakpoint +- `dB` - **[D]ebug [B]reakpoint** - Set conditional +- `lp` - **[L]og [P]oint** - Set log point message +- `de` - **[D]ebug [E]val** - Evaluate expression +- `dr` - **[D]ebug [R]EPL** - Open REPL +- `dl` - **[D]ebug [L]ast** - Run last debug session +- `dh` - **[D]ebug [H]over** - Hover variables +- `ds` - **[D]ebug [S]copes** - View scopes +- `df` - **[D]ebug [F]rames** - View call frames +- `dt` - **[D]ebug [T]erminate** - Terminate session +- `dc` - **[D]ebug [C]ontinue** - Continue to cursor + +### Completion (Blink.cmp) +- `` - Trigger/Show completion +- `` - Accept completion +- `` - Cancel/Hide completion +- `` - Select next item +- `` - Select previous item +- `` - Scroll documentation up +- `` - Scroll documentation down +- `` - Next snippet placeholder +- `` - Previous snippet placeholder + +### GitHub Copilot +**Integration**: Copilot is installed (`zbirenbaum/copilot.lua`) and integrated with Blink.cmp. +- Copilot suggestions appear automatically in the completion menu +- Inline ghost text is disabled (handled by Blink.cmp instead) +- Use standard Blink.cmp keybindings to accept Copilot suggestions + +Copilot commands: +- `:Copilot auth` - Authenticate with GitHub +- `:Copilot status` - Check Copilot status +- `:Copilot disable` - Disable Copilot +- `:Copilot enable` - Enable Copilot + +### Text Objects (Mini.ai) +Enhanced text objects for better selection: +- `a` - Around (e.g., `daw` = delete around word) +- `i` - Inside (e.g., `ci"` = change inside quotes) +Common targets: +- `w` - Word +- `W` - WORD (includes punctuation) +- `p` - Paragraph +- `s` - Sentence +- `(`, `)`, `[`, `]`, `{`, `}` - Brackets +- `'`, `"`, `` ` `` - Quotes +- `<`, `>` - Angle brackets +- `t` - Tag (HTML/XML) + +### Surround Operations (Mini.surround) +Default mappings: +- `sa` - Add surrounding (e.g., `saiw"` = surround word with quotes) +- `sd` - Delete surrounding (e.g., `sd"` = delete surrounding quotes) +- `sr` - Replace surrounding (e.g., `sr"'` = replace " with ') +- `sf` - Find surrounding +- `sF` - Find surrounding (left) +- `sh` - Highlight surrounding +- `sn` - Update MiniSurround.config.n_lines + +### Comments (Comment.nvim) +- `gcc` - Toggle comment on current line +- `gc` - Toggle comment (motion/visual mode) +- `gbc` - Toggle block comment on current line +- `gb` - Toggle block comment (motion/visual mode) +Examples: +- `gcap` - Comment a paragraph +- `gc3j` - Comment current line and 3 lines below +- Visual mode: Select lines then `gc` to toggle + +### Autopairs (nvim-autopairs) +Automatic bracket/quote pairing: +- When typing `(`, `[`, `{`, `'`, `"`, or `` ` ``, the closing pair is automatically inserted +- Pressing `` between pairs expands them properly +- Backspace removes both opening and closing pairs + +### Indent Line (indent-blankline.nvim) +Visual indent guides are automatically shown - no keybindings needed + +### Vim Sleuth +Automatically detects and sets indentation settings - no keybindings needed + +### Illuminate (vim-illuminate) +Automatically highlights other occurrences of word under cursor - no keybindings needed +Navigation between occurrences: +- `` or `]]` - Next occurrence (if configured) +- `` or `[[` - Previous occurrence (if configured) ### Which-Key Groups -- `s` - [S]earch group -- `t` - [T]oggle group -- `h` - Git [H]unk group - -## Issues & Opportunities - -### 1. **Duplicate Keybinds** -Both main `init.lua` and custom telescope plugin define identical telescope keybinds. The custom ones likely override the main ones. - -### 2. **Commented Out Functionality** -Many useful keybinds are in commented-out plugin files: -- Debug operations (`d*`) -- Path completion toggle (`tp`) -- Additional telescope configurations - -### 3. **Missing Categories** -No git operations visible (though which-key defines git hunk group), file operations beyond search, etc. - -### 4. **Inconsistent Description Patterns** -- Some use `[X]` bracket notation -- Some use full words -- LSP uses `LSP:` prefix -- DAP uses `DAP:` prefix - -## Natural Language Search Plugin Design - -### Core Concept -Create a Telescope extension that indexes all keybinds and allows fuzzy natural language search. - -### Implementation Approach - -#### 1. **Keybind Parser Module** (`lua/custom/plugins/keyfinder/parser.lua`) -```lua --- Scan all config files for vim.keymap.set calls --- Extract: key, mode, description, file location --- Build searchable index with synonyms -``` - -#### 2. **Natural Language Matcher** (`lua/custom/plugins/keyfinder/matcher.lua`) -```lua --- Map natural language to keybind concepts: --- "find file" -> ["search", "file", "find", "open"] --- "debug breakpoint" -> ["debug", "breakpoint", "dap", "pause"] --- "restart lsp" -> ["lsp", "restart", "reload", "server"] -``` - -#### 3. **Telescope Extension** (`lua/custom/plugins/keyfinder/telescope.lua`) -```lua --- Telescope picker that searches through indexed keybinds --- Shows: Keybind | Description | Mode | File --- Supports: fuzzy matching on natural language -``` - -#### 4. **Usage Examples** -- Type "find files" → Shows `sf` - Search Files -- Type "debug step" → Shows debug stepping keybinds -- Type "lsp rename" → Shows `grn` - LSP: Rename -- Type "reload" → Shows `lr` - LSP Reload all servers - -### Integration Points - -#### With Which-Key -- Read which-key group definitions for context -- Show which-key popup for discovered keybinds -- Integrate with which-key's delay system - -#### With Telescope -- Reuse telescope's fuzzy matching -- Follow telescope's UI patterns -- Allow chaining to other telescope commands - -#### With Help System -- Link to `:help` entries when available -- Show function signatures for LSP commands -- Display source file locations - -### Technical Implementation - -#### File Scanning Strategy -1. **Static Analysis**: Parse Lua AST for `vim.keymap.set` calls -2. **Runtime Introspection**: Query `vim.api.nvim_get_keymap()` for active bindings -3. **Plugin Integration**: Hook into lazy.nvim plugin loading to catch dynamic bindings - -#### Search Algorithm -1. **Tokenization**: Split natural language into keywords -2. **Synonym Expansion**: "find" → ["search", "find", "locate", "open"] -3. **Weighted Scoring**: Boost exact matches, penalize partial matches -4. **Context Awareness**: Consider mode, plugin context, frequency of use - -#### Performance Considerations -- **Lazy Loading**: Only scan when plugin is first used -- **Caching**: Store parsed results, invalidate on config changes -- **Incremental Updates**: Watch for file changes, update index incrementally - -### User Experience - -#### Primary Interface -- `?` or `sk` (extend existing keymap search) -- Telescope popup with natural language prompt -- Live preview of matching keybinds - -#### Secondary Features -- **Keybind Execution**: Press Enter to execute the found keybind -- **Help Integration**: `` to show help for selected keybind -- **Source Navigation**: `` to jump to keybind definition -- **Usage Statistics**: Track most-used searches, suggest improvements - -## Next Steps - -1. **Prototype Parser**: Build basic keybind extraction from config files -2. **Simple Matcher**: Implement keyword-based search -3. **Telescope Integration**: Create basic picker interface -4. **Test & Iterate**: Use with real workflows, refine search algorithm -5. **Advanced Features**: Add synonym expansion, usage tracking, help integration - -## Natural Language → Keybind Examples - -| Natural Language | Expected Keybind | Current Status | -|------------------|------------------|----------------| -| "find files" | `sf` | ✅ Active | -| "search in file" | `/` | ✅ Active | -| "debug breakpoint" | `db` | ⚠️ Commented out | -| "lsp rename" | `grn` | ✅ Active (LSP buffer only) | -| "reload lsp" | `lr` | ✅ Active | -| "git blame" | ? | ❌ Not found | -| "format code" | `f` | ✅ Active | -| "open terminal" | ? | ❌ Not found | -| "toggle diagnostics" | ? | ❌ Not found | - -This analysis reveals both the potential and the gaps in your current keybind setup. The natural language search plugin would be most valuable for discovering the numerous LSP keybinds and managing the complexity of your growing configuration. \ No newline at end of file +Groups that organize keybindings: +- `c` - **[C]ode** operations +- `d` - **[D]ocument/[D]ebug** operations +- `g` - **[G]it** operations +- `h` - **Git [H]unk** operations +- `r` - **[R]ename** operations +- `s` - **[S]earch** operations +- `t` - **[T]oggle** operations +- `w` - **[W]orkspace** operations + +## Keybinding Architecture + +### Organization Pattern +1. **Leader-based commands** - Most actions use `` (Space) +2. **Mnemonic prefixes** - First letter usually matches action (s=search, g=git, d=debug) +3. **LSP shortcuts** - Use `g` prefix for goto operations +4. **Function keys** - Reserved for debugging (F5, F7, F10-F12) +5. **Control combos** - Navigation and completion + +### Configuration Locations +- **Core keymaps**: `lua/core/keymaps.lua` (custom LSP reload) +- **Kickstart defaults**: Built into respective plugin configurations +- **LSP keymaps**: `lua/plugins/config/lsp/keymaps.lua` +- **Telescope keymaps**: `lua/plugins/config/telescope.lua` +- **Git keymaps**: `lua/plugins/config/git.lua` +- **Debug keymaps**: `lua/plugins/config/debug/keymaps.lua` +- **Tmux navigation**: `lua/plugins/spec/nvim-tmux-navigator.lua` +- **Blink.cmp keymaps**: `lua/plugins/config/blink.lua` +- **Editor enhancements**: `lua/plugins/config/editor.lua` (Mini.nvim modules) +- **Which-key groups**: `lua/plugins/config/ui.lua` + +## Tips for Learning Keybindings + +1. **Use Which-key**: Press `` and wait to see available options +2. **Search keymaps**: Use `sk` to search all keybindings +3. **Mnemonic patterns**: Most bindings follow logical patterns (s=search, g=git, etc.) +4. **Check `:checkhealth core`**: Verify all features are working + +## Customization Guide + +To add new keybindings: +1. For general keymaps: Edit `lua/core/keymaps.lua` +2. For plugin-specific: Add to the relevant config file in `lua/plugins/config/` +3. Update Which-key groups in `lua/plugins/config/ui.lua` if adding new categories \ No newline at end of file diff --git a/README.md b/README.md index 4113950550d..8b328ccee92 100644 --- a/README.md +++ b/README.md @@ -1,241 +1,358 @@ -# kickstart.nvim +# 🚀 Modular Neovim Configuration -## Introduction +A clean, fast, and fully-featured Neovim configuration with perfect separation of concerns. Built on modern plugins with LSP, TreeSitter, and Copilot integration. Originally forked from [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim) and transformed into a maintainable modular structure. -A starting point for Neovim that is: +## ✨ Features -* Small -* Single-file -* Completely Documented +### 🎯 Core Features +- **Modular Architecture** - Clean separation between core settings, plugin specs, and configurations +- **LSP Support** - Full language server integration for C/C++, Python, Nix, LaTeX, and more +- **Intelligent Completion** - [Blink.cmp](https://github.com/saghen/blink.cmp) with Copilot integration +- **Fuzzy Finding** - Telescope with FZF for lightning-fast file and text search +- **Git Integration** - Fugitive + Gitsigns for complete git workflow +- **Syntax Highlighting** - TreeSitter-based highlighting with automatic parser installation +- **Debugging** - Full DAP (Debug Adapter Protocol) support -**NOT** a Neovim distribution, but instead a starting point for your configuration. +### 🔧 Language Support +- **C/C++** - clangd with automatic compile_commands.json detection +- **Python** - Pyright + Ruff for type checking and linting +- **Nix** - Full nixd integration +- **LaTeX** - TeXLab for document preparation +- **CMake** - CMake language server +- **Lua** - Optimized for Neovim config development -## Installation +## 📁 Project Structure -### Install Neovim - -Kickstart.nvim targets *only* the latest -['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest -['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. -If you are experiencing issues, please make sure you have the latest versions. - -### Install External Dependencies - -External Requirements: -- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`) -- [ripgrep](https://github.com/BurntSushi/ripgrep#installation), - [fd-find](https://github.com/sharkdp/fd#installation) -- Clipboard tool (xclip/xsel/win32yank or other depending on the platform) -- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons - - if you have it set `vim.g.have_nerd_font` in `init.lua` to true -- Emoji fonts (Ubuntu only, and only if you want emoji!) `sudo apt install fonts-noto-color-emoji` -- Language Setup: - - If you want to write Typescript, you need `npm` - - If you want to write Golang, you will need `go` - - etc. +``` +nvim/ +├── init.lua # Minimal bootstrapper +├── lua/ +│ ├── core/ # Core Neovim settings +│ │ ├── bootstrap.lua # Lazy.nvim installation +│ │ ├── options.lua # Editor options +│ │ ├── keymaps.lua # Core keybindings +│ │ ├── autocmds.lua # Auto commands +│ │ └── health.lua # Health checks +│ └── plugins/ +│ ├── spec/ # Plugin declarations +│ │ ├── lsp.lua # Language servers +│ │ ├── blink.lua # Completion +│ │ ├── telescope.lua # Fuzzy finder +│ │ ├── treesitter.lua # Syntax highlighting +│ │ ├── git.lua # Git integration +│ │ └── ... # Other plugins +│ └── config/ # Plugin configurations +│ ├── lsp/ # LSP setup +│ ├── blink.lua # Completion config +│ ├── telescope.lua # Telescope config +│ └── ... # Other configs +``` -> [!NOTE] -> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes -> and quick install snippets +## 🚀 Installation + +### Prerequisites + +#### System Requirements +- **Neovim** >= 0.10 +- **Git** - Version control +- **Make** - Build tool +- **C Compiler** - For native extensions +- **ripgrep** - Fast text search +- **fd** - Fast file finder + +#### Language Servers (Install via Nix/Homebrew/Package Manager) +```bash +# Example with Nix +nix-env -iA nixpkgs.clang-tools # clangd +nix-env -iA nixpkgs.pyright # Python LSP +nix-env -iA nixpkgs.ruff # Python linter +nix-env -iA nixpkgs.nixd # Nix LSP +nix-env -iA nixpkgs.texlab # LaTeX LSP +``` -### Install Kickstart +### Install Configuration -> [!NOTE] -> [Backup](#FAQ) your previous configuration (if any exists) +#### Backup Existing Config +```bash +mv ~/.config/nvim ~/.config/nvim.backup +``` -Neovim's configurations are located under the following paths, depending on your OS: +#### Clone This Repository +```bash +git clone https://github.com/yourusername/nvim.git ~/.config/nvim +``` -| OS | PATH | -| :- | :--- | -| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | -| Windows (cmd)| `%localappdata%\nvim\` | -| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` | +#### Launch Neovim +```bash +nvim +``` -#### Recommended Step +The first launch will automatically: +1. Install lazy.nvim plugin manager +2. Download and install all plugins +3. Set up TreeSitter parsers -[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo -so that you have your own copy that you can modify, then install by cloning the -fork to your machine using one of the commands below, depending on your OS. +### Health Check -> [!NOTE] -> Your fork's URL will be something like this: -> `https://github.com//kickstart.nvim.git` +After installation, run `:checkhealth core` to verify: +- Neovim version +- Required executables +- LSP servers +- Formatters -You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file -too - it's ignored in the kickstart repo to make maintenance easier, but it's -[recommended to track it in version control](https://lazy.folke.io/usage/lockfile). +## 🔄 Syncing with Kickstart.nvim -#### Clone kickstart.nvim +This configuration maintains compatibility with upstream kickstart.nvim while keeping all customizations in a modular structure. Here's how to sync with kickstart updates: -> [!NOTE] -> If following the recommended step above (i.e., forking the repo), replace -> `nvim-lua` with `` in the commands below +### Initial Setup (One Time) +```bash +# Add kickstart as a remote +git remote add kickstart https://github.com/nvim-lua/kickstart.nvim +git fetch kickstart +``` -
Linux and Mac +### Checking for Updates +```bash +# See what changed in kickstart +git fetch kickstart +git log kickstart/master --oneline -```sh -git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim +# Review specific changes +git diff HEAD kickstart/master -- init.lua ``` -
+### Cherry-Picking Updates +```bash +# Option 1: Cherry-pick specific commits +git cherry-pick -
Windows +# Option 2: Manually review and integrate changes +git diff kickstart/master -- init.lua | less -If you're using `cmd.exe`: - -``` -git clone https://github.com/nvim-lua/kickstart.nvim.git "%localappdata%\nvim" +# Option 3: Check for specific feature updates (e.g., telescope) +git diff kickstart/master -- init.lua | grep -A5 -B5 telescope ``` -If you're using `powershell.exe` +### Update Workflow +1. **Review Changes**: Check kickstart's commit history for interesting updates +2. **Test Locally**: Apply changes in a test branch first +3. **Adapt to Modular Structure**: Move any new plugins/configs to appropriate `lua/plugins/` files +4. **Document**: Update relevant documentation for new features + +### Example: Adding a New Plugin from Kickstart +If kickstart adds a new plugin in their `init.lua`: +1. Create a new spec file: `lua/plugins/spec/newplugin.lua` +2. Add configuration to: `lua/plugins/config/newplugin.lua` (if needed) +3. Update: `lua/plugins/spec/init.lua` to import the new spec + +## ⌨️ Key Mappings + +### Leader Key +The leader key is set to ``. + +### Essential Keybindings + +#### File Navigation +| Key | Description | +|-----|-------------| +| `sf` | **S**earch **F**iles | +| `sg` | **S**earch by **G**rep | +| `sh` | **S**earch **H**elp | +| `` | Switch buffers | +| `/` | Fuzzy search in current buffer | + +#### LSP Features +| Key | Description | +|-----|-------------| +| `gd` | **G**oto **D**efinition | +| `gr` | **G**oto **R**eferences | +| `gI` | **G**oto **I**mplementation | +| `rn` | **R**e**n**ame symbol | +| `ca` | **C**ode **A**ction | +| `K` | Hover documentation | +| `f` | **F**ormat buffer | + +#### Git Operations +| Key | Description | +|-----|-------------| +| `gs` | Git status (Fugitive) | +| `gd` | Git diff | +| `gc` | Git commit | +| `gb` | Git blame | +| `]c` | Next git change | +| `[c` | Previous git change | +| `hs` | Stage hunk | +| `hr` | Reset hunk | + +#### Debugging +| Key | Description | +|-----|-------------| +| `` | Start/Continue debugging | +| `` | Step over | +| `` | Step into | +| `` | Step out | +| `db` | Toggle breakpoint | +| `` | Toggle debug UI | + +#### Window Navigation (Tmux-aware) +| Key | Description | +|-----|-------------| +| `` | Navigate left | +| `` | Navigate down | +| `` | Navigate up | +| `` | Navigate right | + +### Completion Keybindings +| Key | Description | +|-----|-------------| +| `` | Trigger completion | +| `` | Accept completion | +| `` | Cancel completion | +| `` | Next snippet placeholder | +| `` | Previous snippet placeholder | + +## 🔌 Installed Plugins + +### Core +- [lazy.nvim](https://github.com/folke/lazy.nvim) - Plugin manager +- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) - Lua utilities + +### Editor Enhancement +- [mini.nvim](https://github.com/echasnovski/mini.nvim) - Collection of minimal plugins +- [Comment.nvim](https://github.com/numToStr/Comment.nvim) - Smart commenting +- [vim-sleuth](https://github.com/tpope/vim-sleuth) - Auto-detect indentation +- [nvim-autopairs](https://github.com/windwp/nvim-autopairs) - Auto-close brackets +- [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim) - Indent guides +- [vim-illuminate](https://github.com/RRethy/vim-illuminate) - Highlight word under cursor + +### UI/Theme +- [tokyonight.nvim](https://github.com/folke/tokyonight.nvim) - Color scheme +- [which-key.nvim](https://github.com/folke/which-key.nvim) - Keybinding hints +- [todo-comments.nvim](https://github.com/folke/todo-comments.nvim) - Highlight TODO comments + +### Navigation +- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) - Fuzzy finder +- [telescope-fzf-native.nvim](https://github.com/nvim-telescope/telescope-fzf-native.nvim) - FZF sorter +- [vim-tmux-navigator](https://github.com/christoomey/vim-tmux-navigator) - Seamless tmux navigation + +### Git +- [vim-fugitive](https://github.com/tpope/vim-fugitive) - Git commands +- [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim) - Git gutter signs + +### LSP & Completion +- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) - LSP configurations +- [blink.cmp](https://github.com/saghen/blink.cmp) - Completion engine +- [lazydev.nvim](https://github.com/folke/lazydev.nvim) - Lua development +- [fidget.nvim](https://github.com/j-hui/fidget.nvim) - LSP progress + +### Development +- [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) - Syntax highlighting +- [nvim-treesitter-textobjects](https://github.com/nvim-treesitter/nvim-treesitter-textobjects) - Syntax-aware text objects +- [copilot.lua](https://github.com/zbirenbaum/copilot.lua) - GitHub Copilot +- [conform.nvim](https://github.com/stevearc/conform.nvim) - Formatting +- [nvim-dap](https://github.com/mfussenegger/nvim-dap) - Debug Adapter Protocol +- [nvim-dap-ui](https://github.com/rcarriga/nvim-dap-ui) - Debug UI + +## 🛠️ Configuration + +### Customization + +All configuration files are designed to be easily customizable: + +1. **Core Settings**: Edit files in `lua/core/` + - `options.lua` - Vim options + - `keymaps.lua` - Core keybindings + +2. **Add Plugins**: Create new spec files in `lua/plugins/spec/` + ```lua + -- lua/plugins/spec/myplugin.lua + return { + 'username/plugin-name', + opts = { + -- plugin options + } + } + ``` + +3. **Complex Plugin Config**: Add config files to `lua/plugins/config/` + +### LSP Server Configuration + +LSP servers are configured in `lua/plugins/config/lsp/init.lua`. Add new servers to the `servers` table: +```lua +servers = { + myserver = { + settings = { + -- server-specific settings + } + } +} ``` -git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim" -``` - -
-### Post Installation +### Formatter Configuration -Start Neovim +Formatters are configured in `lua/plugins/spec/formatting.lua`: -```sh -nvim +```lua +formatters_by_ft = { + javascript = { "prettier" }, + -- add your formatters here +} ``` -That's it! Lazy will install all the plugins you have. Use `:Lazy` to view -the current plugin status. Hit `q` to close the window. - -#### Read The Friendly Documentation +## 🔧 Commands -Read through the `init.lua` file in your configuration folder for more -information about extending and exploring Neovim. That also includes -examples of adding popularly requested plugins. +### Custom Commands +- `:ReloadLSP` - Restart all LSP servers -> [!NOTE] -> For more information about a particular plugin check its repository's documentation. +### Health Check +- `:checkhealth core` - Run configuration health check +### Plugin Management +- `:Lazy` - Open plugin manager UI +- `:Lazy sync` - Update all plugins +- `:Lazy profile` - Profile startup time -### Getting Started +## 🐛 Troubleshooting -[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o) +### First Steps +1. Run `:checkhealth core` to verify installation +2. Check `:messages` for error messages +3. Ensure all prerequisites are installed -### FAQ +### Common Issues -* What should I do if I already have a pre-existing Neovim configuration? - * You should back it up and then delete all associated files. - * This includes your existing init.lua and the Neovim files in `~/.local` - which can be deleted with `rm -rf ~/.local/share/nvim/` -* Can I keep my existing configuration in parallel to kickstart? - * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` - to maintain multiple configurations. For example, you can install the kickstart - configuration in `~/.config/nvim-kickstart` and create an alias: - ``` - alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim' - ``` - When you run Neovim using `nvim-kickstart` alias it will use the alternative - config directory and the matching local directory - `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim - distribution that you would like to try out. -* What if I want to "uninstall" this configuration: - * See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information -* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files? - * The main purpose of kickstart is to serve as a teaching tool and a reference - configuration that someone can easily use to `git clone` as a basis for their own. - As you progress in learning Neovim and Lua, you might consider splitting `init.lua` - into smaller parts. A fork of kickstart that does this while maintaining the - same functionality is available here: - * [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim) - * Discussions on this topic can be found here: - * [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218) - * [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473) +**Plugins not loading** +- Run `:Lazy sync` to ensure all plugins are installed +- Check for errors in `:messages` -### Install Recipes +**LSP not working** +- Verify language servers are installed (check with `:checkhealth core`) +- Run `:LspInfo` to see active servers +- Try `:ReloadLSP` to restart servers -Below you can find OS specific install instructions for Neovim and dependencies. +**Telescope not finding files** +- Ensure `ripgrep` and `fd` are installed +- Check you're not in a git-ignored directory -After installing all the dependencies continue with the [Install Kickstart](#Install-Kickstart) step. +## 📝 License -#### Windows Installation +This configuration is based on [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim) and is available under the MIT License. -
Windows with Microsoft C++ Build Tools and CMake -Installation may require installing build tools and updating the run command for `telescope-fzf-native` +## 🙏 Acknowledgments -See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) +- [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim) - Initial configuration structure +- [Neovim](https://neovim.io/) - The best text editor +- All plugin authors for their amazing work -This requires: +## 🤝 Contributing -- Install CMake and the Microsoft C++ Build Tools on Windows +Contributions are welcome! Feel free to: +- Report issues +- Suggest new features +- Submit pull requests -```lua -{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } -``` -
-
Windows with gcc/make using chocolatey -Alternatively, one can install gcc and make which don't require changing the config, -the easiest way is to use choco: - -1. install [chocolatey](https://chocolatey.org/install) -either follow the instructions on the page or use winget, -run in cmd as **admin**: -``` -winget install --accept-source-agreements chocolatey.chocolatey -``` - -2. install all requirements using choco, exit the previous cmd and -open a new one so that choco path is set, and run in cmd as **admin**: -``` -choco install -y neovim git ripgrep wget fd unzip gzip mingw make -``` -
-
WSL (Windows Subsystem for Linux) - -``` -wsl --install -wsl -sudo add-apt-repository ppa:neovim-ppa/unstable -y -sudo apt update -sudo apt install make gcc ripgrep unzip git xclip neovim -``` -
- -#### Linux Install -
Ubuntu Install Steps - -``` -sudo add-apt-repository ppa:neovim-ppa/unstable -y -sudo apt update -sudo apt install make gcc ripgrep unzip git xclip neovim -``` -
-
Debian Install Steps - -``` -sudo apt update -sudo apt install make gcc ripgrep unzip git xclip curl - -# Now we install nvim -curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz -sudo rm -rf /opt/nvim-linux-x86_64 -sudo mkdir -p /opt/nvim-linux-x86_64 -sudo chmod a+rX /opt/nvim-linux-x86_64 -sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz - -# make it available in /usr/local/bin, distro installs to /usr/bin -sudo ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/ -``` -
-
Fedora Install Steps - -``` -sudo dnf install -y gcc make git ripgrep fd-find unzip neovim -``` -
- -
Arch Install Steps - -``` -sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim -``` -
+--- +**Happy Coding!** 🎉 \ No newline at end of file diff --git a/doc/kickstart.txt b/doc/kickstart.txt deleted file mode 100644 index cb87ac3f1de..00000000000 --- a/doc/kickstart.txt +++ /dev/null @@ -1,24 +0,0 @@ -================================================================================ -INTRODUCTION *kickstart.nvim* - -Kickstart.nvim is a project to help you get started on your neovim journey. - - *kickstart-is-not* -It is not: -- Complete framework for every plugin under the sun -- Place to add every plugin that could ever be useful - - *kickstart-is* -It is: -- Somewhere that has a good start for the most common "IDE" type features: - - autocompletion - - goto-definition - - find references - - fuzzy finding - - and hinting at what more can be done :) -- A place to _kickstart_ your journey. - - You should fork this project and use/modify it so that it matches your - style and preferences. If you don't want to do that, there are probably - other projects that would fit much better for you (and that's great!)! - - vim:tw=78:ts=8:ft=help:norl: diff --git a/doc/modular.txt b/doc/modular.txt new file mode 100644 index 00000000000..9a9c421aa3d --- /dev/null +++ b/doc/modular.txt @@ -0,0 +1,222 @@ +*modular.txt* Modular Neovim Configuration + +============================================================================== +CONTENTS *modular-contents* + + 1. Introduction ................................ |modular-intro| + 2. Quick Start ................................. |modular-quickstart| + 3. Architecture ................................ |modular-architecture| + 4. Keybindings ................................. |modular-keybindings| + 5. Commands .................................... |modular-commands| + 6. Customization ............................... |modular-customization| + 7. Troubleshooting ............................. |modular-troubleshooting| + +============================================================================== +1. INTRODUCTION *modular-intro* + +This is a modular Neovim configuration built for performance and +maintainability. Originally based on kickstart.nvim but restructured with +clean separation of concerns. + +Key features: + • Modular plugin architecture + • Full LSP support (C/C++, Python, Nix, LaTeX) + • Intelligent completion with Blink.cmp + • Git integration (Fugitive + Gitsigns) + • Debug support (DAP) + • Tmux integration + +============================================================================== +2. QUICK START *modular-quickstart* + +Prerequisites: > + - Neovim >= 0.10 + - Git, Make, C compiler + - ripgrep, fd + - Language servers (via Nix/package manager) + +Installation: >bash + # Backup existing config + mv ~/.config/nvim ~/.config/nvim.backup + + # Clone this config + git clone ~/.config/nvim + + # Start Neovim + nvim + +Health check: >vim + :checkhealth core + +============================================================================== +3. ARCHITECTURE *modular-architecture* + +Directory Structure: > + nvim/ + ├── init.lua # Bootstrap + ├── lua/ + │ ├── core/ # Core settings + │ │ ├── bootstrap.lua # Lazy.nvim + │ │ ├── options.lua # Vim options + │ │ ├── keymaps.lua # Core keymaps + │ │ └── health.lua # Health checks + │ └── plugins/ + │ ├── spec/ # Plugin specs + │ └── config/ # Plugin configs + +Loading Order: + 1. Bootstrap lazy.nvim + 2. Load core options and keymaps + 3. Load plugins via lazy.nvim + 4. Plugin configurations execute + +============================================================================== +4. KEYBINDINGS *modular-keybindings* + +Leader key: + +------------------------------------------------------------------------------ +NAVIGATION *modular-keys-navigation* + + Navigate left (window/tmux) + Navigate down + Navigate up + Navigate right + Clear search highlights + +------------------------------------------------------------------------------ +SEARCH *modular-keys-search* + + sf Search [F]iles + sg Search by [G]rep + sh Search [H]elp + sk Search [K]eymaps + sw Search current [W]ord + sd Search [D]iagnostics + / Fuzzy search in buffer + Find buffers + +------------------------------------------------------------------------------ +LSP *modular-keys-lsp* + + gd Goto Definition + gr Goto References + gI Goto Implementation + K Hover documentation + rn Rename symbol + ca Code action + f Format buffer + lr Reload LSP servers + +------------------------------------------------------------------------------ +GIT *modular-keys-git* + + gs Git status + gd Git diff + gc Git commit + gb Git blame + + ]c Next git change + [c Previous git change + hs Stage hunk + hr Reset hunk + +------------------------------------------------------------------------------ +DEBUG *modular-keys-debug* + + Start/Continue + Step over + Step into + Step out + Toggle UI + db Toggle breakpoint + +------------------------------------------------------------------------------ +COMPLETION *modular-keys-completion* + + Trigger completion + Accept + Cancel + Next snippet placeholder + +============================================================================== +5. COMMANDS *modular-commands* + +Custom Commands: + :ReloadLSP Restart all LSP servers + :checkhealth core Run configuration health check + +Plugin Commands: + :Lazy Plugin manager UI + :Lazy sync Update plugins + :Git Fugitive git status + :Telescope Open telescope + +============================================================================== +6. CUSTOMIZATION *modular-customization* + +------------------------------------------------------------------------------ +ADDING PLUGINS *modular-adding-plugins* + +Create a new spec file: >lua + -- lua/plugins/spec/myplugin.lua + return { + 'author/plugin-name', + event = 'VeryLazy', + opts = { + -- options here + } + } + +Then import it: >lua + -- lua/plugins/spec/init.lua + return { + { import = 'plugins.spec.myplugin' }, + -- other imports... + } + +------------------------------------------------------------------------------ +CONFIGURING LSP *modular-config-lsp* + +Edit `lua/plugins/config/lsp/init.lua`: >lua + local servers = { + myserver = { + settings = { + -- server settings + } + } + } + +------------------------------------------------------------------------------ +CUSTOM KEYMAPS *modular-custom-keymaps* + +Add to `lua/core/keymaps.lua`: >lua + vim.keymap.set('n', 'xx', function() + -- your function + end, { desc = 'My custom action' }) + +============================================================================== +7. TROUBLESHOOTING *modular-troubleshooting* + +Common Issues: + +LSP not working: >vim + :checkhealth core " Check if servers installed + :LspInfo " Check active servers + :ReloadLSP " Restart servers + +Plugins not loading: >vim + :Lazy sync " Update plugins + :messages " Check for errors + +Telescope issues: + • Ensure ripgrep and fd are installed + • Check you're not in git-ignored directory + +For more help: + • Run `:checkhealth core` + • Check `:messages` for errors + • See README.md for detailed documentation + +============================================================================== +vim:tw=78:ts=8:ft=help:norl: \ No newline at end of file diff --git a/doc/tags b/doc/tags index 687ae7721d9..38a19774f6a 100644 --- a/doc/tags +++ b/doc/tags @@ -1,3 +1,18 @@ -kickstart-is kickstart.txt /*kickstart-is* -kickstart-is-not kickstart.txt /*kickstart-is-not* -kickstart.nvim kickstart.txt /*kickstart.nvim* +modular-adding-plugins modular.txt /*modular-adding-plugins* +modular-architecture modular.txt /*modular-architecture* +modular-commands modular.txt /*modular-commands* +modular-config-lsp modular.txt /*modular-config-lsp* +modular-contents modular.txt /*modular-contents* +modular-custom-keymaps modular.txt /*modular-custom-keymaps* +modular-customization modular.txt /*modular-customization* +modular-intro modular.txt /*modular-intro* +modular-keybindings modular.txt /*modular-keybindings* +modular-keys-completion modular.txt /*modular-keys-completion* +modular-keys-debug modular.txt /*modular-keys-debug* +modular-keys-git modular.txt /*modular-keys-git* +modular-keys-lsp modular.txt /*modular-keys-lsp* +modular-keys-navigation modular.txt /*modular-keys-navigation* +modular-keys-search modular.txt /*modular-keys-search* +modular-quickstart modular.txt /*modular-quickstart* +modular-troubleshooting modular.txt /*modular-troubleshooting* +modular.txt modular.txt /*modular.txt* \ No newline at end of file diff --git a/init.lua b/init.lua index a8755d7b2e1..e054d0c95f0 100644 --- a/init.lua +++ b/init.lua @@ -1,947 +1,23 @@ ---[[ +-- Bootstrap lazy.nvim +require 'core.bootstrap' -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== -======== .-----. ======== -======== .----------------------. | === | ======== -======== |.-""""""""""""""""""-.| |-----| ======== -======== || || | === | ======== -======== || KICKSTART.NVIM || |-----| ======== -======== || || | === | ======== -======== || || |-----| ======== -======== ||:Tutor || |:::::| ======== -======== |'-..................-'| |____o| ======== -======== `"")----------------(""` ___________ ======== -======== /::::::::::| |::::::::::\ \ no mouse \ ======== -======== /:::========| |==hjkl==:::\ \ required \ ======== -======== '""""""""""""' '""""""""""""' '""""""""""' ======== -======== ======== -===================================================================== -===================================================================== +-- Core settings (must be before plugins) +require 'core.options' +require 'core.keymaps' +require 'core.autocmds' -What is Kickstart? - - Kickstart.nvim is *not* a distribution. - - Kickstart.nvim is a starting point for your own configuration. - The goal is that you can read every line of code, top-to-bottom, understand - what your configuration is doing, and modify it to suit your needs. - - Once you've done that, you can start exploring, configuring and tinkering to - make Neovim your own! That might mean leaving Kickstart just the way it is for a while - or immediately breaking it into modular pieces. It's up to you! - - If you don't know anything about Lua, I recommend taking some time to read through - a guide. One possible example which will only take 10-15 minutes: - - https://learnxinyminutes.com/docs/lua/ - - After understanding a bit more about Lua, you can use `:help lua-guide` as a - reference for how Neovim integrates Lua. - - :help lua-guide - - (or HTML version): https://neovim.io/doc/user/lua-guide.html - -Kickstart Guide: - - TODO: The very first thing you should do is to run the command `:Tutor` in Neovim. - - If you don't know what this means, type the following: - - - - : - - Tutor - - - - (If you already know the Neovim basics, you can skip this step.) - - Once you've completed that, you can continue working through **AND READING** the rest - of the kickstart init.lua. - - Next, run AND READ `:help`. - This will open up a help window with some basic information - about reading, navigating and searching the builtin help documentation. - - This should be the first place you go to look when you're stuck or confused - with something. It's one of my favorite Neovim features. - - MOST IMPORTANTLY, we provide a keymap "sh" to [s]earch the [h]elp documentation, - which is very useful when you're not exactly sure of what you're looking for. - - I have left several `:help X` comments throughout the init.lua - These are hints about where to find more information about the relevant settings, - plugins or Neovim features used in Kickstart. - - NOTE: Look for lines like this - - Throughout the file. These are for you, the reader, to help you understand what is happening. - Feel free to delete them once you know what you're doing, but they should serve as a guide - for when you are first encountering a few different constructs in your Neovim config. - -If you experience any errors while trying to install kickstart, run `:checkhealth` for more info. - -I hope you enjoy your Neovim journey, -- TJ - -P.S. You can delete this when you're done too. It's your config now! :) ---]] - --- Set as the leader key --- See `:help mapleader` --- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' - --- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = true - --- [[ Setting options ]] --- See `:help vim.o` --- NOTE: You can change these options as you wish! --- For more options, you can see `:help option-list` - --- Make line numbers default -vim.o.number = true --- You can also add relative line numbers, to help with jumping. --- Experiment for yourself to see if you like it! --- vim.o.relativenumber = true - --- Enable mouse mode, can be useful for resizing splits for example! -vim.o.mouse = 'a' - --- Don't show the mode, since it's already in the status line -vim.o.showmode = false - --- Sync clipboard between OS and Neovim. --- Schedule the setting after `UiEnter` because it can increase startup-time. --- Remove this option if you want your OS clipboard to remain independent. --- See `:help 'clipboard'` -vim.schedule(function() - vim.o.clipboard = 'unnamedplus' -end) - --- Enable break indent -vim.o.breakindent = true - --- Save undo history -vim.o.undofile = true - --- Case-insensitive searching UNLESS \C or one or more capital letters in the search term -vim.o.ignorecase = true -vim.o.smartcase = true - --- Keep signcolumn on by default -vim.o.signcolumn = 'yes' - --- Decrease update time -vim.o.updatetime = 250 - --- Decrease mapped sequence wait time -vim.o.timeoutlen = 300 - --- Configure how new splits should be opened -vim.o.splitright = true -vim.o.splitbelow = true - --- Sets how neovim will display certain whitespace characters in the editor. --- See `:help 'list'` --- and `:help 'listchars'` --- --- Notice listchars is set using `vim.opt` instead of `vim.o`. --- It is very similar to `vim.o` but offers an interface for conveniently interacting with tables. --- See `:help lua-options` --- and `:help lua-options-guide` -vim.o.list = true -vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } - --- Preview substitutions live, as you type! -vim.o.inccommand = 'split' - --- Show which line your cursor is on -vim.o.cursorline = true - --- Minimal number of screen lines to keep above and below the cursor. -vim.o.scrolloff = 10 - --- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`), --- instead raise a dialog asking if you wish to save the current file(s) --- See `:help 'confirm'` -vim.o.confirm = true - -require 'custom.options' - --- [[ Basic Keymaps ]] --- See `:help vim.keymap.set()` - --- Clear highlights on search when pressing in normal mode --- See `:help hlsearch` -vim.keymap.set('n', '', 'nohlsearch') - --- Diagnostic keymaps -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) - --- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier --- for people to discover. Otherwise, you normally need to press , which --- is not what someone will guess without a bit more experience. --- --- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping --- or just use to exit terminal mode -vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) - --- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') - --- Keybinds to make split navigation easier. --- Use CTRL+ to switch between windows --- --- See `:help wincmd` for a list of all window commands -vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) - --- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes --- vim.keymap.set("n", "", "H", { desc = "Move window to the left" }) --- vim.keymap.set("n", "", "L", { desc = "Move window to the right" }) --- vim.keymap.set("n", "", "J", { desc = "Move window to the lower" }) --- vim.keymap.set("n", "", "K", { desc = "Move window to the upper" }) - -require 'custom.keymaps' - --- [[ Basic Autocommands ]] --- See `:help lua-guide-autocommands` - --- Highlight when yanking (copying) text --- Try it with `yap` in normal mode --- See `:help vim.hl.on_yank()` -vim.api.nvim_create_autocmd('TextYankPost', { - desc = 'Highlight when yanking (copying) text', - group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), - callback = function() - vim.hl.on_yank() - end, -}) - --- [[ Install `lazy.nvim` plugin manager ]] --- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info -local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' -if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = 'https://github.com/folke/lazy.nvim.git' - local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } - if vim.v.shell_error ~= 0 then - error('Error cloning lazy.nvim:\n' .. out) - end -end - ----@type vim.Option -local rtp = vim.opt.rtp -rtp:prepend(lazypath) - --- [[ Configure and install plugins ]] --- --- To check the current status of your plugins, run --- :Lazy --- --- You can press `?` in this menu for help. Use `:q` to close the window --- --- To update plugins you can run --- :Lazy update --- --- NOTE: Here is where you install your plugins. -require('lazy').setup({ - -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). - 'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically - - -- NOTE: Plugins can also be added by using a table, - -- with the first argument being the link and the following - -- keys can be used to configure plugin behavior/loading/etc. - -- - -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded. - -- - - -- Alternatively, use `config = function() ... end` for full control over the configuration. - -- If you prefer to call `setup` explicitly, use: - -- { - -- 'lewis6991/gitsigns.nvim', - -- config = function() - -- require('gitsigns').setup({ - -- -- Your gitsigns configuration here - -- }) - -- end, - -- } - -- - -- Here is a more advanced example where we pass configuration - -- options to `gitsigns.nvim`. - -- - -- See `:help gitsigns` to understand what the configuration keys do - { -- Adds git related signs to the gutter, as well as utilities for managing changes - 'lewis6991/gitsigns.nvim', - opts = { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, +-- Load plugins via lazy.nvim +require('lazy').setup('plugins.spec', { + change_detection = { enabled = true, notify = false }, + performance = { + rtp = { + disabled_plugins = { + 'gzip', + 'tarPlugin', + 'tohtml', + 'tutor', + 'zipPlugin', }, }, }, - - -- NOTE: Plugins can also be configured to run Lua code when they are loaded. - -- - -- This is often very useful to both group configuration, as well as handle - -- lazy loading plugins that don't need to be loaded immediately at startup. - -- - -- For example, in the following configuration, we use: - -- event = 'VimEnter' - -- - -- which loads which-key before all the UI elements are loaded. Events can be - -- normal autocommands events (`:help autocmd-events`). - -- - -- Then, because we use the `opts` key (recommended), the configuration runs - -- after the plugin has been loaded as `require(MODULE).setup(opts)`. - - { -- Useful plugin to show you pending keybinds. - 'folke/which-key.nvim', - event = 'VimEnter', -- Sets the loading event to 'VimEnter' - opts = { - -- delay between pressing a key and opening which-key (milliseconds) - -- this setting is independent of vim.o.timeoutlen - delay = 0, - icons = { - -- set icon mappings to true if you have a Nerd Font - mappings = vim.g.have_nerd_font, - -- If you are using a Nerd Font: set icons.keys to an empty table which will use the - -- default which-key.nvim defined Nerd Font icons, otherwise define a string table - keys = vim.g.have_nerd_font and {} or { - Up = ' ', - Down = ' ', - Left = ' ', - Right = ' ', - C = ' ', - M = ' ', - D = ' ', - S = ' ', - CR = ' ', - Esc = ' ', - ScrollWheelDown = ' ', - ScrollWheelUp = ' ', - NL = ' ', - BS = ' ', - Space = ' ', - Tab = ' ', - F1 = '', - F2 = '', - F3 = '', - F4 = '', - F5 = '', - F6 = '', - F7 = '', - F8 = '', - F9 = '', - F10 = '', - F11 = '', - F12 = '', - }, - }, - - -- Document existing key chains - spec = { - { 's', group = '[S]earch' }, - { 't', group = '[T]oggle' }, - { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, - }, - }, - }, - - -- NOTE: Plugins can specify dependencies. - -- - -- The dependencies are proper plugin specifications as well - anything - -- you do for a plugin at the top level, you can do for a dependency. - -- - -- Use the `dependencies` key to specify the dependencies of a particular plugin - - { -- Fuzzy Finder (files, lsp, etc) - 'nvim-telescope/telescope.nvim', - event = 'VimEnter', - dependencies = { - 'nvim-lua/plenary.nvim', - { -- If encountering errors, see telescope-fzf-native README for installation instructions - 'nvim-telescope/telescope-fzf-native.nvim', - - -- `build` is used to run some command when the plugin is installed/updated. - -- This is only run then, not every time Neovim starts up. - build = 'make', - - -- `cond` is a condition used to determine whether this plugin should be - -- installed and loaded. - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - { 'nvim-telescope/telescope-ui-select.nvim' }, - - -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, - }, - config = function() - -- Telescope is a fuzzy finder that comes with a lot of different things that - -- it can fuzzy find! It's more than just a "file finder", it can search - -- many different aspects of Neovim, your workspace, LSP, and more! - -- - -- The easiest way to use Telescope, is to start by doing something like: - -- :Telescope help_tags - -- - -- After running this command, a window will open up and you're able to - -- type in the prompt window. You'll see a list of `help_tags` options and - -- a corresponding preview of the help. - -- - -- Two important keymaps to use while in Telescope are: - -- - Insert mode: - -- - Normal mode: ? - -- - -- This opens a window that shows you all of the keymaps for the current - -- Telescope picker. This is really useful to discover what Telescope can - -- do as well as how to actually do it! - - -- [[ Configure Telescope ]] - -- See `:help telescope` and `:help telescope.setup()` - require('telescope').setup { - -- You can put your default mappings / updates / etc. in here - -- All the info you're looking for is in `:help telescope.setup()` - -- - -- defaults = { - -- mappings = { - -- i = { [''] = 'to_fuzzy_refine' }, - -- }, - -- }, - -- pickers = {} - extensions = { - ['ui-select'] = { - require('telescope.themes').get_dropdown(), - }, - }, - } - - -- Enable Telescope extensions if they are installed - pcall(require('telescope').load_extension, 'fzf') - pcall(require('telescope').load_extension, 'ui-select') - - -- Telescope keymaps are now handled by custom.plugins.telescope - end, - }, - - -- LSP Plugins - { - -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins - -- used for completion, annotations and signatures of Neovim apis - 'folke/lazydev.nvim', - ft = 'lua', - opts = { - library = { - -- Load luvit types when the `vim.uv` word is found - { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, - }, - }, - }, - { - -- Main LSP Configuration - 'neovim/nvim-lspconfig', - dependencies = { - -- Useful status updates for LSP. - { 'j-hui/fidget.nvim', opts = {} }, - - -- Allows extra capabilities provided by blink.cmp - 'saghen/blink.cmp', - }, - config = function() - -- Brief aside: **What is LSP?** - -- - -- LSP is an initialism you've probably heard, but might not understand what it is. - -- - -- LSP stands for Language Server Protocol. It's a protocol that helps editors - -- and language tooling communicate in a standardized fashion. - -- - -- In general, you have a "server" which is some tool built to understand a particular - -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers - -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone - -- processes that communicate with some "client" - in this case, Neovim! - -- - -- LSP provides Neovim with features like: - -- - Go to definition - -- - Find references - -- - Autocompletion - -- - Symbol Search - -- - and more! - -- - -- If you're wondering about lsp vs treesitter, you can check out the wonderfully - -- and elegantly composed help section, `:help lsp-vs-treesitter` - - -- This function gets run when an LSP attaches to a particular buffer. - -- That is to say, every time a new file is opened that is associated with - -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this - -- function will be executed to configure the current buffer - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), - callback = function(event) - -- NOTE: Remember that Lua is a real programming language, and as such it is possible - -- to define small helper and utility functions so you don't have to repeat yourself. - -- - -- In this case, we create a function that lets us more easily define mappings specific - -- for LSP related items. It sets the mode, buffer and description for us each time. - local map = function(keys, func, desc, mode) - mode = mode or 'n' - vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) - end - - -- Rename the variable under your cursor. - -- Most Language Servers support renaming across files, etc. - map('grn', vim.lsp.buf.rename, '[R]e[n]ame') - - -- Execute a code action, usually your cursor needs to be on top of an error - -- or a suggestion from your LSP for this to activate. - map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) - - -- Find references for the word under your cursor. - map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - - -- Jump to the implementation of the word under your cursor. - -- Useful when your language has ways of declaring types without an actual implementation. - map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - - -- Jump to the definition of the word under your cursor. - -- This is where a variable was first declared, or where a function is defined, etc. - -- To jump back, press . - map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - - -- WARN: This is not Goto Definition, this is Goto Declaration. - -- For example, in C this would take you to the header. - map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - - -- Fuzzy find all the symbols in your current document. - -- Symbols are things like variables, functions, types, etc. - map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') - - -- Fuzzy find all the symbols in your current workspace. - -- Similar to document symbols, except searches over your entire project. - map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') - - -- Jump to the type of the word under your cursor. - -- Useful when you're not sure what type a variable is and you want to see - -- the definition of its *type*, not where it was *defined*. - map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') - - -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) - ---@param client vim.lsp.Client - ---@param method vim.lsp.protocol.Method - ---@param bufnr? integer some lsp support methods only in specific files - ---@return boolean - local function client_supports_method(client, method, bufnr) - if vim.fn.has 'nvim-0.11' == 1 then - return client:supports_method(method, bufnr) - else - return client.supports_method(method, { bufnr = bufnr }) - end - end - - -- The following two autocommands are used to highlight references of the - -- word under your cursor when your cursor rests there for a little while. - -- See `:help CursorHold` for information about when this is executed - -- - -- When you move your cursor, the highlights will be cleared (the second autocommand). - local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then - local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) - vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.document_highlight, - }) - - vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.clear_references, - }) - - vim.api.nvim_create_autocmd('LspDetach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), - callback = function(event2) - vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } - end, - }) - end - - -- The following code creates a keymap to toggle inlay hints in your - -- code, if the language server you are using supports them - -- - -- This may be unwanted, since they displace some of your code - if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then - map('th', function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) - end, '[T]oggle Inlay [H]ints') - end - end, - }) - - -- Diagnostic Config - -- See :help vim.diagnostic.Opts - vim.diagnostic.config { - severity_sort = true, - float = { border = 'rounded', source = 'if_many' }, - underline = { severity = vim.diagnostic.severity.ERROR }, - signs = vim.g.have_nerd_font and { - text = { - [vim.diagnostic.severity.ERROR] = '󰅚 ', - [vim.diagnostic.severity.WARN] = '󰀪 ', - [vim.diagnostic.severity.INFO] = '󰋽 ', - [vim.diagnostic.severity.HINT] = '󰌶 ', - }, - } or {}, - virtual_text = { - source = 'if_many', - spacing = 2, - format = function(diagnostic) - local diagnostic_message = { - [vim.diagnostic.severity.ERROR] = diagnostic.message, - [vim.diagnostic.severity.WARN] = diagnostic.message, - [vim.diagnostic.severity.INFO] = diagnostic.message, - [vim.diagnostic.severity.HINT] = diagnostic.message, - } - return diagnostic_message[diagnostic.severity] - end, - }, - } - - -- LSP servers and clients are able to communicate to each other what features they support. - -- By default, Neovim doesn't support everything that is in the LSP specification. - -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities. - -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers. - local capabilities = require('blink.cmp').get_lsp_capabilities() - - -- Enable the following language servers - -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. - -- - -- Add any additional override configuration in the following tables. Available keys are: - -- - cmd (table): Override the default command used to start the server - -- - filetypes (table): Override the default list of associated filetypes for the server - -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. - -- - settings (table): Override the default settings passed when initializing the server. - -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ - local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, - -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs - -- - -- Some languages (like typescript) have entire language plugins that can be useful: - -- https://github.com/pmizio/typescript-tools.nvim - -- - -- But for many setups, the LSP (`ts_ls`) will work just fine - -- ts_ls = {}, - -- - - lua_ls = { - -- cmd = { ... }, - filetypes = { 'lua', 'luau' }, - -- capabilities = {}, - settings = { - Lua = { - completion = { - callSnippet = 'Replace', - }, - -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings - -- diagnostics = { disable = { 'missing-fields' } }, - }, - }, - }, - } - - for server_name, server in pairs(servers) do - server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) - require('lspconfig')[server_name].setup(server) - end - end, - }, - - { -- Autoformat - 'stevearc/conform.nvim', - event = { 'BufWritePre' }, - cmd = { 'ConformInfo' }, - keys = { - { - 'f', - function() - require('conform').format { async = true, lsp_format = 'fallback' } - end, - mode = '', - desc = '[F]ormat buffer', - }, - }, - opts = { - notify_on_error = false, - format_on_save = function(bufnr) - -- Disable "format_on_save lsp_fallback" for languages that don't - -- have a well standardized coding style. You can add additional - -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true } - if disable_filetypes[vim.bo[bufnr].filetype] then - return nil - else - return { - timeout_ms = 500, - lsp_format = 'fallback', - } - end - end, - formatters_by_ft = { - lua = { 'stylua' }, - -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, - -- - -- You can use 'stop_after_first' to run the first available formatter from the list - -- javascript = { "prettierd", "prettier", stop_after_first = true }, - }, - }, - }, - - { -- Autocompletion - 'saghen/blink.cmp', - event = 'VimEnter', - version = '1.*', - dependencies = { - -- Snippet Engine - { - 'L3MON4D3/LuaSnip', - version = '2.*', - build = (function() - -- Build Step is needed for regex support in snippets. - -- This step is not supported in many windows environments. - -- Remove the below condition to re-enable on windows. - if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then - return - end - return 'make install_jsregexp' - end)(), - dependencies = { - -- `friendly-snippets` contains a variety of premade snippets. - -- See the README about individual language/framework/plugin snippets: - -- https://github.com/rafamadriz/friendly-snippets - -- { - -- 'rafamadriz/friendly-snippets', - -- config = function() - -- require('luasnip.loaders.from_vscode').lazy_load() - -- end, - -- }, - }, - opts = {}, - }, - 'folke/lazydev.nvim', - }, - --- @module 'blink.cmp' - --- @type blink.cmp.Config - opts = { - keymap = { - -- 'default' (recommended) for mappings similar to built-in completions - -- to accept ([y]es) the completion. - -- This will auto-import if your LSP supports it. - -- This will expand snippets if the LSP sent a snippet. - -- 'super-tab' for tab to accept - -- 'enter' for enter to accept - -- 'none' for no mappings - -- - -- For an understanding of why the 'default' preset is recommended, - -- you will need to read `:help ins-completion` - -- - -- No, but seriously. Please read `:help ins-completion`, it is really good! - -- - -- All presets have the following mappings: - -- /: move to right/left of your snippet expansion - -- : Open menu or open docs if already open - -- / or /: Select next/previous item - -- : Hide menu - -- : Toggle signature help - -- - -- See :h blink-cmp-config-keymap for defining your own keymap - preset = 'default', - - -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: - -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps - }, - - appearance = { - -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' - -- Adjusts spacing to ensure icons are aligned - nerd_font_variant = 'mono', - }, - - completion = { - -- By default, you may press `` to show the documentation. - -- Optionally, set `auto_show = true` to show the documentation after a delay. - documentation = { auto_show = false, auto_show_delay_ms = 500 }, - }, - - sources = { - default = { 'lsp', 'path', 'snippets', 'lazydev' }, - providers = { - lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, - }, - }, - - snippets = { preset = 'luasnip' }, - - -- Blink.cmp includes an optional, recommended rust fuzzy matcher, - -- which automatically downloads a prebuilt binary when enabled. - -- - -- By default, we use the Lua implementation instead, but you may enable - -- the rust implementation via `'prefer_rust_with_warning'` - -- - -- See :h blink-cmp-config-fuzzy for more information - fuzzy = { implementation = 'lua' }, - - -- Shows a signature help window while you type arguments for a function - signature = { enabled = true }, - }, - }, - - { -- You can easily change to a different colorscheme. - -- Change the name of the colorscheme plugin below, and then - -- change the command in the config to whatever the name of that colorscheme is. - -- - -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', - priority = 1000, -- Make sure to load this before all the other start plugins. - config = function() - ---@diagnostic disable-next-line: missing-fields - require('tokyonight').setup { - styles = { - comments = { italic = false }, -- Disable italics in comments - }, - } - - -- Load the colorscheme here. - -- Like many other themes, this one has different styles, and you could load - -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' - end, - }, - - -- Highlight todo, notes, etc in comments - { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, - - { -- Collection of various small independent plugins/modules - 'echasnovski/mini.nvim', - config = function() - -- Better Around/Inside textobjects - -- - -- Examples: - -- - va) - [V]isually select [A]round [)]paren - -- - yinq - [Y]ank [I]nside [N]ext [Q]uote - -- - ci' - [C]hange [I]nside [']quote - require('mini.ai').setup { n_lines = 500 } - - -- Add/delete/replace surroundings (brackets, quotes, etc.) - -- - -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren - -- - sd' - [S]urround [D]elete [']quotes - -- - sr)' - [S]urround [R]eplace [)] ['] - require('mini.surround').setup() - - -- Simple and easy statusline. - -- You could remove this setup call if you don't like it, - -- and try some other statusline plugin - local statusline = require 'mini.statusline' - -- set use_icons to true if you have a Nerd Font - statusline.setup { use_icons = vim.g.have_nerd_font } - - -- You can configure sections in the statusline by overriding their - -- default behavior. For example, here we set the section for - -- cursor location to LINE:COLUMN - ---@diagnostic disable-next-line: duplicate-set-field - statusline.section_location = function() - return '%2l:%-2v' - end - - -- ... and there is more! - -- Check out: https://github.com/echasnovski/mini.nvim - end, - }, - { -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - main = 'nvim-treesitter.configs', -- Sets main module to use for opts - -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, - -- Autoinstall languages that are not installed - auto_install = true, - highlight = { - enable = true, - -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. - -- If you are experiencing weird indenting issues, add the language to - -- the list of additional_vim_regex_highlighting and disabled languages for indent. - additional_vim_regex_highlighting = { 'ruby' }, - }, - indent = { enable = true, disable = { 'ruby' } }, - }, - -- There are additional nvim-treesitter modules that you can use to interact - -- with nvim-treesitter. You should go explore a few and see what interests you: - -- - -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` - -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context - -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects - }, - - -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the - -- init.lua. If you want these files, they are in the repository, so you can just download them and - -- place them in the correct locations. - - -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart - -- - -- Here are some example plugins that I've included in the Kickstart repository. - -- Uncomment any of the lines below to enable them (you will need to restart nvim). - -- - -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps - - -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` - -- This is the easiest way to modularize your config. - -- - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - { import = 'custom.plugins' }, - -- - -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` - -- Or use telescope! - -- In normal mode type `sh` then write `lazy.nvim-plugin` - -- you can continue same window with `sr` which resumes last telescope search -}, { - ui = { - -- If you are using a Nerd Font: set icons to an empty table which will use the - -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table - icons = vim.g.have_nerd_font and {} or { - cmd = '⌘', - config = '🛠', - event = '📅', - ft = '📂', - init = '⚙', - keys = '🗝', - plugin = '🔌', - runtime = '💻', - require = '🌙', - source = '📄', - start = '🚀', - task = '📌', - lazy = '💤 ', - }, - }, }) - --- The line beneath this is called `modeline`. See `:help modeline` --- vim: ts=2 sts=2 sw=2 et diff --git a/lua/core/autocmds.lua b/lua/core/autocmds.lua new file mode 100644 index 00000000000..e69de29bb2d diff --git a/lua/core/bootstrap.lua b/lua/core/bootstrap.lua new file mode 100644 index 00000000000..7420e268604 --- /dev/null +++ b/lua/core/bootstrap.lua @@ -0,0 +1,13 @@ +-- Lazy.nvim installation +local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' +if not vim.loop.fs_stat(lazypath) then + vim.fn.system { + 'git', + 'clone', + '--filter=blob:none', + 'https://github.com/folke/lazy.nvim.git', + '--branch=stable', + lazypath, + } +end +vim.opt.rtp:prepend(lazypath) \ No newline at end of file diff --git a/lua/core/health.lua b/lua/core/health.lua new file mode 100644 index 00000000000..5e2697a93b5 --- /dev/null +++ b/lua/core/health.lua @@ -0,0 +1,98 @@ +-- Health check for the modular Neovim configuration + +local M = {} + +local check_version = function() + local verstr = tostring(vim.version()) + if not vim.version.ge then + vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) + return + end + + if vim.version.ge(vim.version(), '0.10-dev') then + vim.health.ok(string.format("Neovim version is: '%s'", verstr)) + else + vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) + end +end + +local check_external_reqs = function() + -- Basic utils + for _, exe in ipairs { 'git', 'make', 'unzip' } do + local is_executable = vim.fn.executable(exe) == 1 + if is_executable then + vim.health.ok(string.format("Found executable: '%s'", exe)) + else + vim.health.warn(string.format("Could not find executable: '%s'", exe)) + end + end + + -- Search tools + for _, exe in ipairs { 'rg', 'fd' } do + local is_executable = vim.fn.executable(exe) == 1 + if is_executable then + vim.health.ok(string.format("Found search tool: '%s'", exe)) + else + vim.health.warn(string.format("Could not find search tool: '%s' (required for Telescope)", exe)) + end + end +end + +local check_lsp_servers = function() + -- Check for LSP servers installed via Nix + local servers = { + { name = 'clangd', desc = 'C/C++ language server' }, + { name = 'pyright', desc = 'Python language server' }, + { name = 'ruff', desc = 'Python linter/formatter' }, + { name = 'nixd', desc = 'Nix language server' }, + { name = 'texlab', desc = 'LaTeX language server' }, + { name = 'cmake-language-server', desc = 'CMake language server' }, + } + + vim.health.start('LSP Servers (via Nix/Home Manager)') + for _, server in ipairs(servers) do + local is_executable = vim.fn.executable(server.name) == 1 + if is_executable then + vim.health.ok(string.format("Found %s: '%s'", server.desc, server.name)) + else + vim.health.info(string.format("Not found: '%s' (%s) - install via Nix if needed", server.name, server.desc)) + end + end +end + +local check_formatters = function() + -- Check for formatters installed via Nix + local formatters = { + { name = 'stylua', filetype = 'lua' }, + { name = 'clang-format', filetype = 'c/cpp' }, + { name = 'alejandra', filetype = 'nix' }, + } + + vim.health.start('Formatters (via Nix/Home Manager)') + for _, formatter in ipairs(formatters) do + local is_executable = vim.fn.executable(formatter.name) == 1 + if is_executable then + vim.health.ok(string.format("Found formatter for %s: '%s'", formatter.filetype, formatter.name)) + else + vim.health.info(string.format("Not found: '%s' (%s) - install via Nix if needed", formatter.name, formatter.filetype)) + end + end +end + +function M.check() + vim.health.start('Modular Neovim Configuration') + + vim.health.info [[NOTE: Not every warning needs to be fixed. +Only install tools for languages you actually use. +All language servers and formatters should be installed via Nix/Home Manager.]] + + local uv = vim.uv or vim.loop + vim.health.info('System Information: ' .. vim.inspect(uv.os_uname())) + + check_version() + check_external_reqs() + check_lsp_servers() + check_formatters() +end + +return M \ No newline at end of file diff --git a/lua/custom/keymaps.lua b/lua/core/keymaps.lua similarity index 100% rename from lua/custom/keymaps.lua rename to lua/core/keymaps.lua diff --git a/lua/custom/options.lua b/lua/core/options.lua similarity index 100% rename from lua/custom/options.lua rename to lua/core/options.lua diff --git a/lua/custom/plugins/blink.lua b/lua/custom/plugins/blink.lua deleted file mode 100644 index 3f70437d9c9..00000000000 --- a/lua/custom/plugins/blink.lua +++ /dev/null @@ -1,29 +0,0 @@ -return { - 'saghen/blink.cmp', - dependencies = { - "giuxtaposition/blink-cmp-copilot", - }, - opts = { - sources = { - default = { "lsp", "path", "copilot", "buffer" }, - providers = { - copilot = { - name = "copilot", - module = "blink-cmp-copilot", - score_offset = 100, -- High priority to show Copilot near the top - async = true, - }, - }, - }, - keymap = { - preset = 'default', - accept = '', -- Your preferred accept key - }, - appearance = { - -- Show source of completion (LSP/Copilot/Buffer) - use_nvim_cmp_as_default = false, - nerd_font_variant = 'mono', - }, - fuzzy = {}, - }, -} diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua deleted file mode 100644 index f46c2590ce6..00000000000 --- a/lua/custom/plugins/copilot.lua +++ /dev/null @@ -1,35 +0,0 @@ -return { - -- Use copilot.lua for API access (no UI) - { - "zbirenbaum/copilot.lua", - cmd = "Copilot", - event = "InsertEnter", - config = function() - require("copilot").setup({ - suggestion = { enabled = false }, -- Disable inline ghost text - panel = { enabled = false }, -- Disable suggestion panel - filetypes = { - yaml = false, - markdown = false, - help = false, - gitcommit = false, - gitrebase = false, - hgcommit = false, - svn = false, - cvs = false, - ["."] = false, - }, - copilot_node_command = 'node', -- Node.js version must be > 18.x - server_opts_overrides = {}, - }) - end, - }, - - -- Bridge between copilot.lua and blink.cmp - { - "giuxtaposition/blink-cmp-copilot", - dependencies = { - "zbirenbaum/copilot.lua", - }, - }, -} diff --git a/lua/custom/plugins/debug.lua b/lua/custom/plugins/debug.lua deleted file mode 100644 index 7471cb99325..00000000000 --- a/lua/custom/plugins/debug.lua +++ /dev/null @@ -1,157 +0,0 @@ --- ~/dlond/nvim/lua/custom/plugins/debug.lua --- Debug Adapter Protocol (DAP) setup, integrating kickstart's UI preferences - -return { - -- Main DAP plugin - { - 'mfussenegger/nvim-dap', - dependencies = { - -- UI for nvim-dap - { - 'rcarriga/nvim-dap-ui', - dependencies = { 'nvim-neotest/nvim-nio' }, -- nvim-dap-ui often needs nio - config = function() - local asyn = require 'plenary.async' - local dapui = require 'dapui' - dapui.setup { - -- Borrowed icon and control settings from kickstart/plugins/debug.lua - icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, - controls = { - icons = { - pause = '⏸', - play = '▶', - step_into = '⏎', - step_over = '⏭', - step_out = '⏮', - step_back = 'b', -- Kickstart uses 'b', nvim-dap default might be different - run_last = '▶▶', - terminate = '⏹', - disconnect = '⏏', - }, - }, - -- You can customize layouts, floating window behavior, etc. - -- layouts = { ... }, - -- floating = { ... }, - } - - -- Automatically open/close dapui when DAP session starts/stops - local dap = require 'dap' - - dap.listeners.after.event_initialized['dapui_config'] = function() - dapui.open() - end - dap.listeners.before.event_terminated['dapui_config'] = function() - dapui.close() - end - dap.listeners.before.event_exited['dapui_config'] = function() - dapui.close() - end - end, - }, - -- Optional: Virtual text for DAP (shows variable values inline) - -- { 'theHamsta/nvim-dap-virtual-text', opts = {} }, - - -- If you need Go debugging, you would add 'leoluz/nvim-dap-go' here - -- and call its setup in the nvim-dap config function. - -- { 'leoluz/nvim-dap-go' }, - }, - config = function() - local dap = require 'dap' - local dapui = require 'dapui' - local async = require 'plenary.async' - - -- Configure the LLDB DAP adapter for C/C++ - -- Assumes 'lldb-dap' executable is in PATH (from pkgs.llvmPackages_XX.lldb) - dap.adapters.lldb = { - type = 'executable', - command = 'lldb-dap', - name = 'lldb-dap (Nix)', - } - - dap.configurations.cpp = { - { - name = 'Launch C/C++ (lldb-dap)', - type = 'lldb', - request = 'launch', - program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - -- local utils = require 'custom.utils' - -- local target = utils:get_target() - -- return utils.pick_executable(vim.fn.getcwd() .. '/' .. target) - end, - cwd = '${workspaceFolder}', - stopOnEntry = false, - args = {}, - -- Ensure your C/C++ project is compiled with debug symbols (e.g., -g flag with clang/gcc) - }, - } - dap.configurations.c = dap.configurations.cpp -- Use same config for C - - -- Python DAP configuration (using debugpy) - -- Ensure python3Packages.debugpy is in your home.packages - dap.adapters.python = { - type = 'executable', - command = 'python', -- Should be the python from your Nix env - args = { '-m', 'debugpy.adapter' }, - } - dap.configurations.python = { - { - type = 'python', - request = 'launch', - name = 'Launch Python file', - program = '${file}', -- Debug the current file - pythonPath = function() - local venv = os.getenv 'VIRTUAL_ENV' - if venv then - return venv .. '/bin/python' - end - -- Fallback to trying to find python3, then python in PATH - -- This could be made more robust by getting python path from Nix if needed - local py3 = vim.fn.executable 'python3' - if py3 ~= 0 and py3 ~= '' then - return py3 - end - return 'python' - end, - }, - } - - -- If you added 'leoluz/nvim-dap-go' as a dependency: - -- require('dap-go').setup() -- Call its setup function - - -- Launch and Control - vim.keymap.set('n', 'dc', function() - async.run(function() - dap.continue() - if not dapui.windows or vim.tbl_isempty(dapui.windows) then - dapui.open() - end - end) - end, { desc = 'DAP: [C]ontinue show UI (async-safe)' }) - vim.keymap.set('n', 'db', dap.toggle_breakpoint, { desc = 'DAP: Toggle [B]reakpoint' }) - vim.keymap.set('n', 'dl', dap.run_last, { desc = 'DAP: Run [L]ast' }) - - -- DAP: Stepping - vim.keymap.set('n', 'di', dap.step_into, { desc = 'DAP: Step [I]nto' }) - vim.keymap.set('n', 'dk', dap.step_over, { desc = 'DAP: Step [O]ver (k)' }) - vim.keymap.set('n', 'do', dap.step_out, { desc = 'DAP: Step [O]ut' }) - vim.keymap.set('n', 'dx', function() - async.run(function() - dap.run_to_cursor() - end) - end, { desc = 'DAP: Run to Cursor (x) (asyn-safe)' }) - - -- DAP: Termination - vim.keymap.set('n', 'dt', function() - async.run(function() - dap.terminate() - dapui.close() - end) - end, { desc = 'DAP: [T]erminate (async-safe)' }) - - -- DAP: UI - vim.keymap.set('n', 'dr', dap.repl.open, { desc = 'DAP: Open [R]EPL' }) - vim.keymap.set('n', 'du', dapui.toggle, { desc = 'DAP: Toggle [U]I' }) - end, - }, -} diff --git a/lua/custom/plugins/git.lua b/lua/custom/plugins/git.lua deleted file mode 100644 index aefc725a378..00000000000 --- a/lua/custom/plugins/git.lua +++ /dev/null @@ -1,73 +0,0 @@ -return { - -- Fugitive - Git integration - { - 'tpope/vim-fugitive', - cmd = { 'Git', 'G', 'Gdiff', 'Gread', 'Gwrite', 'Ggrep', 'GMove', 'GDelete', 'GBrowse', 'GRemove' }, - keys = { - { 'gs', 'Git', desc = 'Git status' }, - { 'gd', 'Gdiff', desc = 'Git diff' }, - { 'gc', 'Git commit', desc = 'Git commit' }, - { 'gb', 'Git blame', desc = 'Git blame' }, - { 'gl', 'Git log', desc = 'Git log' }, - { 'gp', 'Git push', desc = 'Git push' }, - { 'gf', 'Git fetch', desc = 'Git fetch' }, - }, - }, - -- Gitsigns - Git gutter and hunk operations - { - 'lewis6991/gitsigns.nvim', - opts = { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, - on_attach = function(bufnr) - local gitsigns = require('gitsigns') - - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end - - -- Navigation - map('n', ']c', function() - if vim.wo.diff then - vim.cmd.normal({']c', bang = true}) - else - gitsigns.nav_hunk('next') - end - end, { desc = 'Next git hunk' }) - - map('n', '[c', function() - if vim.wo.diff then - vim.cmd.normal({'[c', bang = true}) - else - gitsigns.nav_hunk('prev') - end - end, { desc = 'Previous git hunk' }) - - -- Actions - map('n', 'hs', gitsigns.stage_hunk, { desc = 'Stage hunk' }) - map('n', 'hr', gitsigns.reset_hunk, { desc = 'Reset hunk' }) - map('v', 'hs', function() gitsigns.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end, { desc = 'Stage hunk' }) - map('v', 'hr', function() gitsigns.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end, { desc = 'Reset hunk' }) - map('n', 'hS', gitsigns.stage_buffer, { desc = 'Stage buffer' }) - map('n', 'hu', gitsigns.undo_stage_hunk, { desc = 'Undo stage hunk' }) - map('n', 'hR', gitsigns.reset_buffer, { desc = 'Reset buffer' }) - map('n', 'hp', gitsigns.preview_hunk, { desc = 'Preview hunk' }) - map('n', 'hb', function() gitsigns.blame_line{full=true} end, { desc = 'Blame line' }) - map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = 'Toggle line blame' }) - map('n', 'hd', gitsigns.diffthis, { desc = 'Diff this' }) - map('n', 'hD', function() gitsigns.diffthis('~') end, { desc = 'Diff this ~' }) - map('n', 'td', gitsigns.toggle_deleted, { desc = 'Toggle deleted' }) - - -- Text object - map({'o', 'x'}, 'ih', ':Gitsigns select_hunk', { desc = 'Select hunk' }) - end, - }, - }, -} \ No newline at end of file diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua deleted file mode 100644 index 22ef8fa6edd..00000000000 --- a/lua/custom/plugins/init.lua +++ /dev/null @@ -1,17 +0,0 @@ --- You can add your own plugins here or in other files in this directory! --- I promise not to create any merge conflicts in this directory :) --- --- See the kickstart.nvim README for more information -return { - -- { import = 'custom.plugins.completion' }, - -- { import = 'custom.plugins.theme' }, - -- { import = 'custom.plugins.avante' }, - { import = 'custom.plugins.copilot' }, - { import = 'custom.plugins.debug' }, - { import = 'custom.plugins.formatting' }, - { import = 'custom.plugins.git' }, - { import = 'custom.plugins.lsp' }, - { import = 'custom.plugins.nvim-tmux-navigator' }, - { import = 'custom.plugins.telescope' }, - { import = 'custom.plugins.treesitter' }, -} diff --git a/lua/custom/plugins/lsp/init.lua b/lua/custom/plugins/lsp/init.lua deleted file mode 100644 index 000e2c96e89..00000000000 --- a/lua/custom/plugins/lsp/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - require 'custom.plugins.lsp.lsp', -} diff --git a/lua/custom/plugins/lsp/lsp.lua b/lua/custom/plugins/lsp/lsp.lua deleted file mode 100644 index 9f25c4a3ba7..00000000000 --- a/lua/custom/plugins/lsp/lsp.lua +++ /dev/null @@ -1,91 +0,0 @@ --- ~/dlond/nvim/lua/custom/plugins/lsp.lua --- LSP configuration, assuming LSP servers are installed via Nix/Home Manager - -return { - { - 'neovim/nvim-lspconfig', - -- only load when editing these filetypes (optional) - ft = { - 'c', - 'cpp', - 'objc', - 'objcpp', - 'cuda', - 'cmake', - -- - 'go', - 'nix', - 'python', - 'rust', - 'tex', - }, - opts = function() - local lspconfig = require 'lspconfig' - local capabilities = {} - pcall(function() - capabilities = require('blink.cmp').get_lsp_capabilities() - end) - local util = require 'lspconfig.util' - - local query_driver = table.concat({ - '/nix/store/*/bin/clang*', - '/opt/homebrew/opt/llvm/bin/clang*', - '/usr/bin/clang*', - }, ';') - - local servers = { - clangd = { - cmd = { - 'clangd', - '--background-index', - '--clang-tidy', - '--header-insertion=never', - '--query-driver=' .. query_driver, - '--compile-commands-dir=build', - '--resource-dir=' .. (function() - local ok, result = pcall(vim.fn.systemlist, { 'clang++', '--print-resource-dir' }) - if ok and result and result[1] then - return result[1] - else - return '/usr/lib/clang/19/include' -- fallback - end - end)(), - }, - filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, - root_dir = util.root_pattern('CMakeLists.txt', '.git'), - single_file_support = true, - }, - - pyright = { - settings = { - python = { - analysis = { - autoSearchPaths = true, - diagnosticMode = 'openFilesOnly', - useLibraryCodeForTypes = true, - typeCheckingMode = 'basic', - }, - }, - }, - positionEncoding = 'utf-8', - }, - ruff = {}, - - nixd = {}, - - texlab = {}, - - cmake = { - cmd = { 'cmake-language-server' }, - filetypes = { 'cmake' }, - root_dir = util.root_pattern('CMakeLists.txt', '.git'), - }, - } - - for name, config in pairs(servers) do - config.capabilities = vim.tbl_deep_extend('force', {}, capabilities, config.capabilities or {}) - lspconfig[name].setup(config) - end - end, - }, -} diff --git a/lua/custom/plugins/nvim-tmux-navigator.lua b/lua/custom/plugins/nvim-tmux-navigator.lua deleted file mode 100644 index 0a3762b7f71..00000000000 --- a/lua/custom/plugins/nvim-tmux-navigator.lua +++ /dev/null @@ -1,11 +0,0 @@ -return { - { - 'christoomey/vim-tmux-navigator', - config = function() - vim.keymap.set('n', '', ':TmuxNavigateLeft', { desc = 'Navigate to left tmux pane' }) - vim.keymap.set('n', '', ':TmuxNavigateDown', { desc = 'Navigate to lower tmux pane' }) - vim.keymap.set('n', '', ':TmuxNavigateUp', { desc = 'Navigate to upper tmux pane' }) - vim.keymap.set('n', '', ':TmuxNavigateRight', { desc = 'Navigate to right tmux pane' }) - end, - }, -} diff --git a/lua/custom/plugins/telescope.lua b/lua/custom/plugins/telescope.lua deleted file mode 100644 index 2b5c79be960..00000000000 --- a/lua/custom/plugins/telescope.lua +++ /dev/null @@ -1,85 +0,0 @@ -return { - -- ======================================== - -- Telescope Override - -- ======================================== - { - 'nvim-telescope/telescope.nvim', - -- Ensure dependencies are loaded - dependencies = { - 'nvim-lua/plenary.nvim', - { - 'nvim-telescope/telescope-fzf-native.nvim', - build = 'make', - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - { 'nvim-telescope/telescope-ui-select.nvim' }, - }, - opts = { -- Use opts to merge/override defaults - pickers = { - find_files = { - -- Use rg for finding files (ensure rg is installed via Nix/Home Manager) - find_command = { 'rg', '--files', '--hidden', '-g', '!.git' }, - }, - }, - -- Configure extensions - extensions = { - ['ui-select'] = { - require('telescope.themes').get_dropdown(), - }, - -- Configuration for fzf-native extension - fzf = { - fuzzy = true, -- Enable fuzzy matching - override_generic_sorter = true, -- Override the generic sorter - override_file_sorter = true, -- Override the file sorter - case_mode = 'smart_case', -- Ignore case unless capitals are used - }, - }, - }, - -- The config function ensures extensions are loaded after setup - config = function(_, opts) - require('telescope').setup(opts) - -- Load extensions after setup - pcall(require('telescope').load_extension, 'fzf') - pcall(require('telescope').load_extension, 'ui-select') - - -- *** ADD TELESCOPE KEYMAPS HERE *** - local builtin = require 'telescope.builtin' - -- Add the find_files keymap - vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) - - -- Add other Telescope keymaps from kickstart's init.lua (uncomment to enable) - vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) - vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) - vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) - vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) - vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) - vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) - vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) - vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) - vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) - - -- Fuzzy search in current buffer (corrected function body) - vim.keymap.set('n', '/', function() - builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) - end, { desc = '[/] Fuzzily search in current buffer' }) - - -- Search in open files (corrected function body) - vim.keymap.set('n', 's/', function() - builtin.live_grep { - grep_open_files = true, - prompt_title = 'Live Grep in Open Files', - } - end, { desc = '[S]earch [/] in Open Files' }) - - -- Search Neovim files (corrected function body) - vim.keymap.set('n', 'sn', function() - builtin.find_files { cwd = vim.fn.stdpath 'config' } - end, { desc = '[S]earch [N]eovim files' }) - end, - }, -} diff --git a/lua/custom/plugins/treesitter.lua b/lua/custom/plugins/treesitter.lua deleted file mode 100644 index 84372d1de09..00000000000 --- a/lua/custom/plugins/treesitter.lua +++ /dev/null @@ -1,52 +0,0 @@ -return { - -- ======================================== - -- Treesitter Configuration Override - -- ======================================== - { - 'nvim-treesitter/nvim-treesitter', - -- build = ':TSUpdate', -- Keep build command if needed from kickstart - -- main = 'nvim-treesitter.configs', -- Keep if needed from kickstart - event = { 'BufReadPost', 'BufNewFile' }, - build = ':TSUpdate', - opts = { -- Use opts to merge/override defaults - ensure_installed = { - 'bash', - 'c', - 'cmake', - 'cpp', - 'diff', - 'html', - 'lua', - 'luadoc', - 'make', - 'markdown', - 'markdown_inline', - 'nix', - 'python', - 'query', - 'vim', - 'vimdoc', - 'yaml', - }, - auto_install = true, - - -- Keep other kickstart defaults like highlight/indent settings unless you want to change them - highlight = { - enable = true, - -- additional_vim_regex_highlighting = { 'ruby' }, -- Keep if needed - }, - indent = { - enable = true, - -- disable = { 'ruby' }, -- Keep if needed - }, - }, - config = function(_, opts) - require('nvim-treesitter.configs').setup(opts) - end, - -- If kickstart used a config function for treesitter and you need to replicate - -- parts of it that aren't handled by opts, add it here. - -- config = function(_, opts) - -- require('nvim-treesitter.configs').setup(opts) - -- end, - }, -} diff --git a/lua/custom/utils.lua b/lua/custom/utils.lua deleted file mode 100644 index b45ac58e4d5..00000000000 --- a/lua/custom/utils.lua +++ /dev/null @@ -1,69 +0,0 @@ --- local async = require 'plenary.async' --- local pickers = require 'telescope.pickers' --- local finders = require 'telescope.finders' --- local sorters = require('telescope.config').values --- local actions = require 'telescope.actions' --- local action_state = require 'telescope.actions.state' --- --- local function collect_executables(start_dir) --- local results = {} --- --- -- Add '.', start_dir so it works with your fd version --- local fd = vim.fn.systemlist { --- 'fd', --- '.', --- start_dir, --- '--exec', --- 'file', --- '{}', --- } --- --- for _, line in ipairs(fd) do --- local path, typeinfo = line:match '^(.-):%s*(.+)$' --- if path and not path:match 'CMakeFiles' and typeinfo and (typeinfo:match 'Mach%-O' or typeinfo:match 'ELF') then --- table.insert(results, path) --- end --- end --- --- return results --- end --- --- local function pick_executable(start_dir) --- return async.wrap(function(_start_dir, on_choice) --- local executables = collect_executables(_start_dir) --- --- if #executables == 0 then --- vim.notify('No executables found in ' .. _start_dir, vim.log.levels.WARN) --- on_choice(nil) --- return --- end --- --- pickers --- .new({}, { --- prompt_title = 'Select Executable', --- finder = finders.new_table { results = executables }, --- sorter = sorters.generic_sorter {}, --- attach_mappings = function(_, map) --- actions.select_default:replace(function(prompt_bufnr) --- local entry = action_state.get_selected_entry() --- actions.close(prompt_bufnr) --- on_choice(entry.value) --- end) --- map('i', '', function(bufnr) --- actions.close(bufnr) --- on_choice(nil) --- end) --- map('n', 'q', function(bufnr) --- actions.close(bufnr) --- on_choice(nil) --- end) --- return true --- end, --- }) --- :find() --- end, 2)(start_dir) --- end --- --- return { --- pick_executable = pick_executable, --- } diff --git a/lua/kickstart/health.lua b/lua/kickstart/health.lua deleted file mode 100644 index b59d08649af..00000000000 --- a/lua/kickstart/health.lua +++ /dev/null @@ -1,52 +0,0 @@ ---[[ --- --- This file is not required for your own configuration, --- but helps people determine if their system is setup correctly. --- ---]] - -local check_version = function() - local verstr = tostring(vim.version()) - if not vim.version.ge then - vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) - return - end - - if vim.version.ge(vim.version(), '0.10-dev') then - vim.health.ok(string.format("Neovim version is: '%s'", verstr)) - else - vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) - end -end - -local check_external_reqs = function() - -- Basic utils: `git`, `make`, `unzip` - for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do - local is_executable = vim.fn.executable(exe) == 1 - if is_executable then - vim.health.ok(string.format("Found executable: '%s'", exe)) - else - vim.health.warn(string.format("Could not find executable: '%s'", exe)) - end - end - - return true -end - -return { - check = function() - vim.health.start 'kickstart.nvim' - - vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth` - - Fix only warnings for plugins and languages you intend to use. - Mason will give warnings for languages that are not installed. - You do not need to install, unless you want to use those languages!]] - - local uv = vim.uv or vim.loop - vim.health.info('System Information: ' .. vim.inspect(uv.os_uname())) - - check_version() - check_external_reqs() - end, -} diff --git a/lua/kickstart/plugins/autopairs.lua b/lua/kickstart/plugins/autopairs.lua deleted file mode 100644 index 386d392e7ad..00000000000 --- a/lua/kickstart/plugins/autopairs.lua +++ /dev/null @@ -1,8 +0,0 @@ --- autopairs --- https://github.com/windwp/nvim-autopairs - -return { - 'windwp/nvim-autopairs', - event = 'InsertEnter', - opts = {}, -} diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua deleted file mode 100644 index 77880880eda..00000000000 --- a/lua/kickstart/plugins/debug.lua +++ /dev/null @@ -1,127 +0,0 @@ --- debug.lua --- --- Shows how to use the DAP plugin to debug your code. --- --- Primarily focused on configuring the debugger for Go, but can --- be extended to other languages as well. That's why it's called --- kickstart.nvim and not kitchen-sink.nvim ;) - -return { - -- NOTE: Yes, you can install new plugins here! - 'mfussenegger/nvim-dap', - -- NOTE: And you can specify dependencies as well - dependencies = { - -- Creates a beautiful debugger UI - 'rcarriga/nvim-dap-ui', - - -- Required dependency for nvim-dap-ui - 'nvim-neotest/nvim-nio', - - -- Add your own debuggers here - 'leoluz/nvim-dap-go', - }, - keys = { - -- Basic debugging keymaps, feel free to change to your liking! - { - '', - function() - require('dap').continue() - end, - desc = 'Debug: Start/Continue', - }, - { - '', - function() - require('dap').step_into() - end, - desc = 'Debug: Step Into', - }, - { - '', - function() - require('dap').step_over() - end, - desc = 'Debug: Step Over', - }, - { - '', - function() - require('dap').step_out() - end, - desc = 'Debug: Step Out', - }, - { - 'b', - function() - require('dap').toggle_breakpoint() - end, - desc = 'Debug: Toggle Breakpoint', - }, - { - 'B', - function() - require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') - end, - desc = 'Debug: Set Breakpoint', - }, - -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. - { - '', - function() - require('dapui').toggle() - end, - desc = 'Debug: See last session result.', - }, - }, - config = function() - local dap = require 'dap' - local dapui = require 'dapui' - - -- Dap UI setup - -- For more information, see |:help nvim-dap-ui| - dapui.setup { - -- Set icons to characters that are more likely to work in every terminal. - -- Feel free to remove or use ones that you like more! :) - -- Don't feel like these are good choices. - icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, - controls = { - icons = { - pause = '⏸', - play = '▶', - step_into = '⏎', - step_over = '⏭', - step_out = '⏮', - step_back = 'b', - run_last = '▶▶', - terminate = '⏹', - disconnect = '⏏', - }, - }, - } - - -- Change breakpoint icons - -- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' }) - -- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' }) - -- local breakpoint_icons = vim.g.have_nerd_font - -- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' } - -- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' } - -- for type, icon in pairs(breakpoint_icons) do - -- local tp = 'Dap' .. type - -- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak' - -- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl }) - -- end - - dap.listeners.after.event_initialized['dapui_config'] = dapui.open - dap.listeners.before.event_terminated['dapui_config'] = dapui.close - dap.listeners.before.event_exited['dapui_config'] = dapui.close - - -- Install golang specific config - require('dap-go').setup { - delve = { - -- On Windows delve must be run attached or it crashes. - -- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring - detached = vim.fn.has 'win32' == 0, - }, - } - end, -} diff --git a/lua/kickstart/plugins/gitsigns.lua b/lua/kickstart/plugins/gitsigns.lua deleted file mode 100644 index cbbd22d24fc..00000000000 --- a/lua/kickstart/plugins/gitsigns.lua +++ /dev/null @@ -1,61 +0,0 @@ --- Adds git related signs to the gutter, as well as utilities for managing changes --- NOTE: gitsigns is already included in init.lua but contains only the base --- config. This will add also the recommended keymaps. - -return { - { - 'lewis6991/gitsigns.nvim', - opts = { - on_attach = function(bufnr) - local gitsigns = require 'gitsigns' - - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end - - -- Navigation - map('n', ']c', function() - if vim.wo.diff then - vim.cmd.normal { ']c', bang = true } - else - gitsigns.nav_hunk 'next' - end - end, { desc = 'Jump to next git [c]hange' }) - - map('n', '[c', function() - if vim.wo.diff then - vim.cmd.normal { '[c', bang = true } - else - gitsigns.nav_hunk 'prev' - end - end, { desc = 'Jump to previous git [c]hange' }) - - -- Actions - -- visual mode - map('v', 'hs', function() - gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'git [s]tage hunk' }) - map('v', 'hr', function() - gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'git [r]eset hunk' }) - -- normal mode - map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) - map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) - map('n', 'hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) - map('n', 'hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' }) - map('n', 'hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) - map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) - map('n', 'hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) - map('n', 'hd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) - map('n', 'hD', function() - gitsigns.diffthis '@' - end, { desc = 'git [D]iff against last commit' }) - -- Toggles - map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) - map('n', 'tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' }) - end, - }, - }, -} diff --git a/lua/kickstart/plugins/indent_line.lua b/lua/kickstart/plugins/indent_line.lua deleted file mode 100644 index ed7f269399f..00000000000 --- a/lua/kickstart/plugins/indent_line.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - { -- Add indentation guides even on blank lines - 'lukas-reineke/indent-blankline.nvim', - -- Enable `lukas-reineke/indent-blankline.nvim` - -- See `:help ibl` - main = 'ibl', - opts = {}, - }, -} diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua deleted file mode 100644 index dec42f097c6..00000000000 --- a/lua/kickstart/plugins/lint.lua +++ /dev/null @@ -1,60 +0,0 @@ -return { - - { -- Linting - 'mfussenegger/nvim-lint', - event = { 'BufReadPre', 'BufNewFile' }, - config = function() - local lint = require 'lint' - lint.linters_by_ft = { - markdown = { 'markdownlint' }, - } - - -- To allow other plugins to add linters to require('lint').linters_by_ft, - -- instead set linters_by_ft like this: - -- lint.linters_by_ft = lint.linters_by_ft or {} - -- lint.linters_by_ft['markdown'] = { 'markdownlint' } - -- - -- However, note that this will enable a set of default linters, - -- which will cause errors unless these tools are available: - -- { - -- clojure = { "clj-kondo" }, - -- dockerfile = { "hadolint" }, - -- inko = { "inko" }, - -- janet = { "janet" }, - -- json = { "jsonlint" }, - -- markdown = { "vale" }, - -- rst = { "vale" }, - -- ruby = { "ruby" }, - -- terraform = { "tflint" }, - -- text = { "vale" } - -- } - -- - -- You can disable the default linters by setting their filetypes to nil: - -- lint.linters_by_ft['clojure'] = nil - -- lint.linters_by_ft['dockerfile'] = nil - -- lint.linters_by_ft['inko'] = nil - -- lint.linters_by_ft['janet'] = nil - -- lint.linters_by_ft['json'] = nil - -- lint.linters_by_ft['markdown'] = nil - -- lint.linters_by_ft['rst'] = nil - -- lint.linters_by_ft['ruby'] = nil - -- lint.linters_by_ft['terraform'] = nil - -- lint.linters_by_ft['text'] = nil - - -- Create autocommand which carries out the actual linting - -- on the specified events. - local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true }) - vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { - group = lint_augroup, - callback = function() - -- Only run the linter in buffers that you can modify in order to - -- avoid superfluous noise, notably within the handy LSP pop-ups that - -- describe the hovered symbol using Markdown. - if vim.bo.modifiable then - lint.try_lint() - end - end, - }) - end, - }, -} diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua deleted file mode 100644 index c7067891df0..00000000000 --- a/lua/kickstart/plugins/neo-tree.lua +++ /dev/null @@ -1,25 +0,0 @@ --- Neo-tree is a Neovim plugin to browse the file system --- https://github.com/nvim-neo-tree/neo-tree.nvim - -return { - 'nvim-neo-tree/neo-tree.nvim', - version = '*', - dependencies = { - 'nvim-lua/plenary.nvim', - 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended - 'MunifTanjim/nui.nvim', - }, - lazy = false, - keys = { - { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, - }, - opts = { - filesystem = { - window = { - mappings = { - ['\\'] = 'close_window', - }, - }, - }, - }, -} diff --git a/lua/plugins/config/blink.lua b/lua/plugins/config/blink.lua new file mode 100644 index 00000000000..bf8311a18bc --- /dev/null +++ b/lua/plugins/config/blink.lua @@ -0,0 +1,126 @@ +-- Blink.cmp Configuration +local M = {} + +function M.setup() + require('blink.cmp').setup({ + -- Keymap configuration + keymap = { + preset = 'default', + [''] = { 'show', 'show_documentation', 'hide_documentation' }, + [''] = { 'hide' }, + [''] = { 'select_and_accept' }, + + [''] = { 'select_prev', 'fallback' }, + [''] = { 'select_next', 'fallback' }, + + [''] = { 'scroll_documentation_up', 'fallback' }, + [''] = { 'scroll_documentation_down', 'fallback' }, + + [''] = { 'snippet_forward', 'fallback' }, + [''] = { 'snippet_backward', 'fallback' }, + }, + + -- Appearance configuration + appearance = { + use_nvim_cmp_as_default = true, + nerd_font_variant = 'mono', + }, + + -- Sources configuration with Copilot integration + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer', 'copilot' }, + providers = { + copilot = { + name = 'copilot', + module = 'blink-cmp-copilot', + score_offset = 100, + async = true, + transform_items = function(_, items) + -- Add copilot icon to copilot suggestions + for _, item in ipairs(items) do + item.kind = 'Copilot' + end + return items + end, + }, + }, + }, + + -- Command line configuration (new API) + cmdline = { + enabled = false, -- Disable cmdline completion for now + }, + + -- Signature help configuration + signature = { + enabled = true, + window = { + border = 'rounded', + }, + }, + + -- Completion configuration + completion = { + accept = { + -- Auto-insert brackets for functions + auto_brackets = { + enabled = true, + }, + }, + menu = { + draw = { + columns = { + { 'label', 'label_description', gap = 1 }, + { 'kind_icon', 'kind' } + }, + }, + border = 'rounded', + winblend = 0, + }, + documentation = { + auto_show = true, + auto_show_delay_ms = 200, + window = { + border = 'rounded', + }, + }, + ghost_text = { + enabled = true, + }, + }, + + -- Fuzzy matching configuration + fuzzy = { + -- Use Rust implementation for better performance + implementation = 'prefer_rust_with_warning', + -- Allow typos based on keyword length + max_typos = function(keyword) + return math.floor(#keyword / 4) + end, + -- Track frequently/recently used items + use_frecency = true, + -- Boost items matching nearby words + use_proximity = true, + -- Prebuilt binaries configuration + prebuilt_binaries = { + download = true, + }, + }, + + -- Snippet configuration + snippets = { + expand = function(snippet) + -- Use native snippet expansion if available + if vim.snippet then + vim.snippet.expand(snippet) + else + -- Fallback to basic expansion + local insert = string.gsub(snippet, '%$%d+', '') + vim.api.nvim_put({ insert }, 'c', true, true) + end + end, + }, + }) +end + +return M \ No newline at end of file diff --git a/lua/plugins/config/debug/adapters.lua b/lua/plugins/config/debug/adapters.lua new file mode 100644 index 00000000000..1d83b55b252 --- /dev/null +++ b/lua/plugins/config/debug/adapters.lua @@ -0,0 +1,158 @@ +-- Debug Adapters Configuration +local M = {} + +-- Helper function to find Python executable +-- In Nix environments, use whatever Python is in PATH +local function get_python_path() + -- Use the Python from current environment (Nix or system) + if vim.fn.executable('python3') == 1 then + return vim.fn.exepath('python3') + elseif vim.fn.executable('python') == 1 then + return vim.fn.exepath('python') + else + -- Fallback to system Python + return '/usr/bin/python3' + end +end + +function M.setup() + local dap = require('dap') + + -- Setup all language-specific adapters + M.setup_python(dap) + M.setup_cpp(dap) + + -- Add more adapters as needed + -- M.setup_rust(dap) + -- M.setup_go(dap) + -- M.setup_javascript(dap) +end + +-- Python debugger configuration +function M.setup_python(dap) + dap.adapters.python = { + type = 'executable', + command = vim.fn.exepath('python3') ~= '' and vim.fn.exepath('python3') or 'python', + args = { '-m', 'debugpy.adapter' }, + } + + dap.configurations.python = { + { + type = 'python', + request = 'launch', + name = 'Launch file', + program = '${file}', + pythonPath = get_python_path, + }, + { + type = 'python', + request = 'launch', + name = 'Launch file with arguments', + program = '${file}', + args = function() + local args_string = vim.fn.input('Arguments: ') + return vim.split(args_string, ' ') + end, + pythonPath = get_python_path, + }, + { + type = 'python', + request = 'attach', + name = 'Attach to running process', + processId = require('dap.utils').pick_process, + pythonPath = get_python_path, + }, + } +end + +-- C/C++/Rust debugger configuration (using codelldb) +function M.setup_cpp(dap) + -- CodeLLDB adapter + dap.adapters.codelldb = { + type = 'server', + port = '${port}', + executable = { + command = 'codelldb', + args = { '--port', '${port}' }, + }, + } + + -- Alternative: Use lldb-vscode if codelldb is not available + dap.adapters.lldb = { + type = 'executable', + command = '/usr/bin/lldb-vscode', -- Adjust path as needed + name = 'lldb', + } + + -- C++ configuration + dap.configurations.cpp = { + { + name = 'Launch', + type = 'codelldb', + request = 'launch', + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + args = {}, + runInTerminal = false, + }, + { + name = 'Launch with arguments', + type = 'codelldb', + request = 'launch', + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + args = function() + local args_string = vim.fn.input('Arguments: ') + return vim.split(args_string, ' ') + end, + runInTerminal = false, + }, + { + name = 'Attach to process', + type = 'codelldb', + request = 'attach', + pid = require('dap.utils').pick_process, + args = {}, + }, + } + + -- Share C++ configuration with C and Rust + dap.configurations.c = dap.configurations.cpp + dap.configurations.rust = dap.configurations.cpp +end + +-- Example: Go debugger configuration (commented out) +-- function M.setup_go(dap) +-- dap.adapters.delve = { +-- type = 'server', +-- port = '${port}', +-- executable = { +-- command = 'dlv', +-- args = { 'dap', '-l', '127.0.0.1:${port}' }, +-- }, +-- } +-- +-- dap.configurations.go = { +-- { +-- type = 'delve', +-- name = 'Debug', +-- request = 'launch', +-- program = '${file}', +-- }, +-- { +-- type = 'delve', +-- name = 'Debug test', +-- request = 'launch', +-- mode = 'test', +-- program = '${file}', +-- }, +-- } +-- end + +return M \ No newline at end of file diff --git a/lua/plugins/config/debug/init.lua b/lua/plugins/config/debug/init.lua new file mode 100644 index 00000000000..69fbcd2b588 --- /dev/null +++ b/lua/plugins/config/debug/init.lua @@ -0,0 +1,38 @@ +-- Debug Configuration (DAP) +local M = {} + +function M.setup() + local dap = require('dap') + local dapui = require('dapui') + + -- Setup DAP UI with icons and controls + dapui.setup({ + icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, + controls = { + icons = { + pause = '⏸', + play = '▶', + step_into = '⏎', + step_over = '⏭', + step_out = '⏮', + step_back = 'b', + run_last = '▶▶', + terminate = '⏹', + disconnect = '⏏', + }, + }, + }) + + -- Automatically open/close DAP UI on debug events + dap.listeners.after.event_initialized['dapui_config'] = dapui.open + dap.listeners.before.event_terminated['dapui_config'] = dapui.close + dap.listeners.before.event_exited['dapui_config'] = dapui.close + + -- Configure debug adapters for different languages + require('plugins.config.debug.adapters').setup() + + -- Setup debug keymaps + require('plugins.config.debug.keymaps').setup() +end + +return M \ No newline at end of file diff --git a/lua/plugins/config/debug/keymaps.lua b/lua/plugins/config/debug/keymaps.lua new file mode 100644 index 00000000000..7c55b282b20 --- /dev/null +++ b/lua/plugins/config/debug/keymaps.lua @@ -0,0 +1,59 @@ +-- Debug Keymaps Configuration +local M = {} + +function M.setup() + local dap = require('dap') + local dapui = require('dapui') + + -- Function key mappings for common debug operations + vim.keymap.set('n', '', dap.continue, { desc = 'Debug: Start/Continue' }) + vim.keymap.set('n', '', dap.step_over, { desc = 'Debug: Step Over' }) + vim.keymap.set('n', '', dap.step_into, { desc = 'Debug: Step Into' }) + vim.keymap.set('n', '', dap.step_out, { desc = 'Debug: Step Out' }) + + -- Breakpoint management + vim.keymap.set('n', 'db', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) + vim.keymap.set('n', 'dB', function() + dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') + end, { desc = 'Debug: Set Conditional Breakpoint' }) + vim.keymap.set('n', 'lp', function() + dap.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) + end, { desc = 'Debug: Set Log Point' }) + + -- DAP UI controls + vim.keymap.set('n', '', dapui.toggle, { desc = 'Debug: Toggle UI' }) + vim.keymap.set('n', 'de', dapui.eval, { desc = 'Debug: Eval under cursor' }) + vim.keymap.set('v', 'de', dapui.eval, { desc = 'Debug: Eval selection' }) + + -- REPL and additional features + vim.keymap.set('n', 'dr', dap.repl.open, { desc = 'Debug: Open REPL' }) + vim.keymap.set('n', 'dl', dap.run_last, { desc = 'Debug: Run Last' }) + + -- Widget-based inspections + vim.keymap.set('n', 'dh', function() + require('dap.ui.widgets').hover() + end, { desc = 'Debug: Hover Variables' }) + + vim.keymap.set('n', 'ds', function() + local widgets = require('dap.ui.widgets') + widgets.centered_float(widgets.scopes) + end, { desc = 'Debug: View Scopes' }) + + vim.keymap.set('n', 'df', function() + local widgets = require('dap.ui.widgets') + widgets.centered_float(widgets.frames) + end, { desc = 'Debug: View Frames' }) + + -- Session management + vim.keymap.set('n', 'dt', dap.terminate, { desc = 'Debug: Terminate Session' }) + vim.keymap.set('n', 'dc', dap.run_to_cursor, { desc = 'Debug: Continue to Cursor' }) + + -- Create visual indicators for breakpoints + vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = 'DapBreakpoint', linehl = '', numhl = '' }) + vim.fn.sign_define('DapBreakpointCondition', { text = '🟡', texthl = 'DapBreakpoint', linehl = '', numhl = '' }) + vim.fn.sign_define('DapBreakpointRejected', { text = '⭕', texthl = 'DapBreakpoint', linehl = '', numhl = '' }) + vim.fn.sign_define('DapLogPoint', { text = '📝', texthl = 'DapLogPoint', linehl = '', numhl = '' }) + vim.fn.sign_define('DapStopped', { text = '▶️', texthl = 'DapStopped', linehl = 'DapStopped', numhl = 'DapStopped' }) +end + +return M \ No newline at end of file diff --git a/lua/plugins/config/editor.lua b/lua/plugins/config/editor.lua new file mode 100644 index 00000000000..f905e914c0b --- /dev/null +++ b/lua/plugins/config/editor.lua @@ -0,0 +1,59 @@ +-- Editor Enhancement Configuration +local M = {} + +function M.setup_mini() + -- Better Around/Inside textobjects + require('mini.ai').setup { n_lines = 500 } + + -- Add/delete/replace surroundings (brackets, quotes, etc.) + require('mini.surround').setup() + + -- Simple and easy statusline + local statusline = require 'mini.statusline' + statusline.setup { use_icons = vim.g.have_nerd_font } + + -- Custom statusline location section + ---@diagnostic disable-next-line: duplicate-set-field + statusline.section_location = function() + return '%2l:%-2v' + end +end + +function M.setup_illuminate() + require('illuminate').configure({ + delay = 200, + large_file_cutoff = 2000, + large_file_overrides = { + providers = { 'lsp' }, + }, + providers = { + 'lsp', + 'treesitter', + 'regex', + }, + filetypes_denylist = { + 'dirbuf', + 'dirvish', + 'fugitive', + 'alpha', + 'NvimTree', + 'lazy', + 'neogitstatus', + 'Trouble', + 'lir', + 'Outline', + 'spectre_panel', + 'toggleterm', + 'DressingSelect', + 'TelescopePrompt', + }, + under_cursor = true, + }) +end + +function M.setup() + M.setup_mini() + M.setup_illuminate() +end + +return M \ No newline at end of file diff --git a/lua/plugins/config/git.lua b/lua/plugins/config/git.lua new file mode 100644 index 00000000000..166cf725220 --- /dev/null +++ b/lua/plugins/config/git.lua @@ -0,0 +1,69 @@ +-- Git Configuration +local M = {} + +function M.setup_gitsigns() + require('gitsigns').setup({ + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + on_attach = function(bufnr) + local gitsigns = require('gitsigns') + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map('n', ']c', function() + if vim.wo.diff then + vim.cmd.normal({']c', bang = true}) + else + gitsigns.nav_hunk('next') + end + end, { desc = 'Jump to next git [c]hange' }) + + map('n', '[c', function() + if vim.wo.diff then + vim.cmd.normal({'[c', bang = true}) + else + gitsigns.nav_hunk('prev') + end + end, { desc = 'Jump to previous git [c]hange' }) + + -- Actions + map('n', 'hs', gitsigns.stage_hunk, { desc = 'Git [s]tage hunk' }) + map('n', 'hr', gitsigns.reset_hunk, { desc = 'Git [r]eset hunk' }) + map('v', 'hs', function() + gitsigns.stage_hunk({vim.fn.line('.'), vim.fn.line('v')}) + end, { desc = 'Git [s]tage hunk' }) + map('v', 'hr', function() + gitsigns.reset_hunk({vim.fn.line('.'), vim.fn.line('v')}) + end, { desc = 'Git [r]eset hunk' }) + + map('n', 'hS', gitsigns.stage_buffer, { desc = 'Git [S]tage buffer' }) + map('n', 'hu', gitsigns.undo_stage_hunk, { desc = 'Git [u]ndo stage hunk' }) + map('n', 'hR', gitsigns.reset_buffer, { desc = 'Git [R]eset buffer' }) + map('n', 'hp', gitsigns.preview_hunk, { desc = 'Git [p]review hunk' }) + map('n', 'hb', gitsigns.blame_line, { desc = 'Git [b]lame line' }) + map('n', 'hd', gitsigns.diffthis, { desc = 'Git [d]iff against index' }) + map('n', 'hD', function() + gitsigns.diffthis('@') + end, { desc = 'Git [D]iff against last commit' }) + + -- Toggles + map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) + map('n', 'tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' }) + + -- Text object + map({'o', 'x'}, 'ih', ':Gitsigns select_hunk', { desc = 'Select git hunk' }) + end, + }) +end + +return M \ No newline at end of file diff --git a/lua/plugins/config/lsp/init.lua b/lua/plugins/config/lsp/init.lua new file mode 100644 index 00000000000..930dd4a45ad --- /dev/null +++ b/lua/plugins/config/lsp/init.lua @@ -0,0 +1,26 @@ +-- LSP Configuration Module +local M = {} + +function M.setup() + local lspconfig = require 'lspconfig' + + -- Get capabilities from blink.cmp if available + local capabilities = {} + pcall(function() + capabilities = require('blink.cmp').get_lsp_capabilities() + end) + + -- Load server configurations + local servers = require('plugins.config.lsp.servers').get_servers() + + -- Setup each server with capabilities + for name, config in pairs(servers) do + config.capabilities = vim.tbl_deep_extend('force', {}, capabilities, config.capabilities or {}) + lspconfig[name].setup(config) + end + + -- Setup LSP keymaps + require('plugins.config.lsp.keymaps').setup() +end + +return M \ No newline at end of file diff --git a/lua/plugins/config/lsp/keymaps.lua b/lua/plugins/config/lsp/keymaps.lua new file mode 100644 index 00000000000..aac80735ad9 --- /dev/null +++ b/lua/plugins/config/lsp/keymaps.lua @@ -0,0 +1,57 @@ +-- LSP Keymaps Configuration +local M = {} + +function M.setup() + -- Setup keymaps when LSP attaches to a buffer + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('lsp-attach-keymaps', { clear = true }), + callback = function(event) + -- Helper function to define keymaps + local map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end + + -- Navigation keymaps (using kickstart.nvim patterns) + map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype definition') + map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + + -- Symbol operations + map('grn', vim.lsp.buf.rename, '[G]oto [R]e[n]ame') + map('gra', vim.lsp.buf.code_action, '[G]oto code [A]ction', { 'n', 'x' }) + map('gO', require('telescope.builtin').lsp_document_symbols, '[G]oto [O]pen document symbols') + map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[G]oto [W]orkspace symbols') + + -- Documentation + map('K', vim.lsp.buf.hover, 'Hover Documentation') + + -- Formatting + map('f', function() + vim.lsp.buf.format { async = true } + end, '[F]ormat buffer') + + -- The following keymaps are available but not mapped by default: + -- vim.lsp.buf.signature_help - Show function signature help + -- vim.lsp.buf.add_workspace_folder - Add workspace folder + -- vim.lsp.buf.remove_workspace_folder - Remove workspace folder + -- vim.lsp.buf.list_workspace_folders - List workspace folders + + -- Optional: Add a message when LSP attaches + local client = vim.lsp.get_client_by_id(event.data.client_id) + if client then + vim.notify('LSP attached: ' .. client.name, vim.log.levels.INFO) + end + end, + }) + + -- Diagnostic keymaps (available globally, not just when LSP attaches) + vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' }) + vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' }) + vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' }) + vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) +end + +return M \ No newline at end of file diff --git a/lua/plugins/config/lsp/servers.lua b/lua/plugins/config/lsp/servers.lua new file mode 100644 index 00000000000..fb97501b791 --- /dev/null +++ b/lua/plugins/config/lsp/servers.lua @@ -0,0 +1,88 @@ +-- LSP Server Configurations +local M = {} + +local util = require 'lspconfig.util' + +-- Query driver for clangd to find compilers in various locations +local function get_clangd_query_driver() + return table.concat({ + '/nix/store/*/bin/clang*', + '/opt/homebrew/opt/llvm/bin/clang*', + '/usr/bin/clang*', + }, ';') +end + +-- Get clang resource directory +local function get_clang_resource_dir() + local ok, result = pcall(vim.fn.systemlist, { 'clang++', '--print-resource-dir' }) + if ok and result and result[1] then + return result[1] + else + return '/usr/lib/clang/19/include' -- fallback + end +end + +function M.get_servers() + return { + -- C/C++ Language Server + clangd = { + cmd = { + 'clangd', + '--background-index', + '--clang-tidy', + '--header-insertion=never', + '--query-driver=' .. get_clangd_query_driver(), + '--compile-commands-dir=build', + '--resource-dir=' .. get_clang_resource_dir(), + }, + filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, + root_dir = util.root_pattern('CMakeLists.txt', '.git'), + single_file_support = true, + }, + + -- Python Language Server + pyright = { + settings = { + python = { + analysis = { + autoSearchPaths = true, + diagnosticMode = 'openFilesOnly', + useLibraryCodeForTypes = true, + typeCheckingMode = 'basic', + }, + }, + }, + positionEncoding = 'utf-8', + }, + + -- Python Linter/Formatter + ruff = {}, + + -- Nix Language Server + nixd = {}, + + -- LaTeX Language Server + texlab = {}, + + -- CMake Language Server + cmake = { + cmd = { 'cmake-language-server' }, + filetypes = { 'cmake' }, + root_dir = util.root_pattern('CMakeLists.txt', '.git'), + }, + + -- Add more servers here as needed + -- Example: + -- rust_analyzer = { + -- settings = { + -- ['rust-analyzer'] = { + -- checkOnSave = { + -- command = 'clippy', + -- }, + -- }, + -- }, + -- }, + } +end + +return M \ No newline at end of file diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua new file mode 100644 index 00000000000..119919b0634 --- /dev/null +++ b/lua/plugins/config/telescope.lua @@ -0,0 +1,84 @@ +-- Telescope Configuration +local M = {} + +function M.setup() + local telescope = require('telescope') + local builtin = require('telescope.builtin') + + telescope.setup({ + defaults = { + prompt_prefix = '> ', + selection_caret = '> ', + path_display = { 'truncate' }, + sorting_strategy = 'ascending', + layout_config = { + horizontal = { + prompt_position = 'top', + preview_width = 0.55, + }, + vertical = { + mirror = false, + }, + width = 0.87, + height = 0.80, + preview_cutoff = 120, + }, + }, + pickers = { + find_files = { + -- Use rg for finding files (ensure rg is installed via Nix/Home Manager) + find_command = { 'rg', '--files', '--hidden', '-g', '!.git' }, + }, + }, + extensions = { + ['ui-select'] = { + require('telescope.themes').get_dropdown(), + }, + fzf = { + fuzzy = true, + override_generic_sorter = true, + override_file_sorter = true, + case_mode = 'smart_case', + }, + }, + }) + + -- Load extensions + pcall(telescope.load_extension, 'fzf') + pcall(telescope.load_extension, 'ui-select') + + -- Setup keymaps + vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) + vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) + vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) + vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) + vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) + vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) + vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) + vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) + vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) + vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + + -- Fuzzy search in current buffer + vim.keymap.set('n', '/', function() + builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) + end, { desc = '[/] Fuzzily search in current buffer' }) + + -- Search in open files + vim.keymap.set('n', 's/', function() + builtin.live_grep { + grep_open_files = true, + prompt_title = 'Live Grep in Open Files', + } + end, { desc = '[S]earch [/] in Open Files' }) + + -- Search in neovim config + vim.keymap.set('n', 'sn', function() + builtin.find_files { cwd = vim.fn.stdpath 'config' } + end, { desc = '[S]earch [N]eovim files' }) +end + +return M \ No newline at end of file diff --git a/lua/plugins/config/ui.lua b/lua/plugins/config/ui.lua new file mode 100644 index 00000000000..1e16b2cf0e6 --- /dev/null +++ b/lua/plugins/config/ui.lua @@ -0,0 +1,57 @@ +-- UI Configuration +local M = {} + +function M.setup_which_key() + local wk = require 'which-key' + + wk.setup({ + delay = 0, + icons = { + mappings = vim.g.have_nerd_font, + keys = vim.g.have_nerd_font and {} or { + Up = ' ', + Down = ' ', + Left = ' ', + Right = ' ', + C = ' ', + M = ' ', + D = ' ', + S = ' ', + CR = ' ', + Esc = ' ', + ScrollWheelDown = ' ', + ScrollWheelUp = ' ', + NL = ' ', + BS = ' ', + Space = ' ', + Tab = ' ', + F1 = '', + F2 = '', + F3 = '', + F4 = '', + F5 = '', + F6 = '', + F7 = '', + F8 = '', + F9 = '', + F10 = '', + F11 = '', + F12 = '', + }, + }, + }) + + -- Document existing key chains + wk.add { + { 'c', group = '[C]ode' }, + { 'd', group = '[D]ocument/[D]ebug' }, + { 'r', group = '[R]ename' }, + { 's', group = '[S]earch' }, + { 'w', group = '[W]orkspace' }, + { 't', group = '[T]oggle' }, + { 'g', group = '[G]it' }, + { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + } +end + +return M \ No newline at end of file diff --git a/lua/plugins/spec/autopairs.lua b/lua/plugins/spec/autopairs.lua new file mode 100644 index 00000000000..c11d19d1bc5 --- /dev/null +++ b/lua/plugins/spec/autopairs.lua @@ -0,0 +1,24 @@ +-- Auto-pairs - Automatically close brackets, quotes, etc. +return { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + opts = { + check_ts = true, + ts_config = { + lua = { 'string', 'source' }, + javascript = { 'string', 'template_string' }, + }, + disable_filetype = { 'TelescopePrompt', 'spectre_panel' }, + fast_wrap = { + map = '', + chars = { '{', '[', '(', '"', "'" }, + pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], '%s+', ''), + offset = 0, + end_key = '$', + keys = 'qwertyuiopzxcvbnmasdfghjkl', + check_comma = true, + highlight = 'PmenuSel', + highlight_grey = 'LineNr', + }, + }, +} \ No newline at end of file diff --git a/lua/plugins/spec/blink.lua b/lua/plugins/spec/blink.lua new file mode 100644 index 00000000000..0c3acd86b32 --- /dev/null +++ b/lua/plugins/spec/blink.lua @@ -0,0 +1,12 @@ +-- Blink.cmp - Modern completion plugin +return { + 'saghen/blink.cmp', + lazy = false, -- Lazy loading handled internally + dependencies = { + 'giuxtaposition/blink-cmp-copilot', + }, + version = 'v0.*', -- Use stable releases + config = function() + require('plugins.config.blink').setup() + end, +} \ No newline at end of file diff --git a/lua/plugins/spec/copilot.lua b/lua/plugins/spec/copilot.lua new file mode 100644 index 00000000000..2f54b453510 --- /dev/null +++ b/lua/plugins/spec/copilot.lua @@ -0,0 +1,21 @@ +-- GitHub Copilot integration +return { + 'zbirenbaum/copilot.lua', + cmd = 'Copilot', + event = 'InsertEnter', + opts = { + suggestion = { enabled = false }, -- Disable inline ghost text (handled by blink.cmp) + panel = { enabled = false }, -- Disable panel view + filetypes = { + yaml = false, + markdown = false, + help = false, + gitcommit = false, + gitrebase = false, + hgcommit = false, + svn = false, + cvs = false, + ['.'] = false, + }, + }, +} \ No newline at end of file diff --git a/lua/plugins/spec/debug.lua b/lua/plugins/spec/debug.lua new file mode 100644 index 00000000000..77f6e70eac8 --- /dev/null +++ b/lua/plugins/spec/debug.lua @@ -0,0 +1,20 @@ +-- Debug Adapter Protocol (DAP) support +return { + 'mfussenegger/nvim-dap', + dependencies = { + -- DAP UI + { + 'rcarriga/nvim-dap-ui', + dependencies = { 'nvim-neotest/nvim-nio' }, + }, + + -- Virtual text for debugging + { + 'theHamsta/nvim-dap-virtual-text', + opts = {}, + }, + }, + config = function() + require('plugins.config.debug').setup() + end, +} \ No newline at end of file diff --git a/lua/plugins/spec/editor.lua b/lua/plugins/spec/editor.lua new file mode 100644 index 00000000000..0a3cd5c310b --- /dev/null +++ b/lua/plugins/spec/editor.lua @@ -0,0 +1,36 @@ +-- Editor enhancement plugins +return { + -- Collection of various small independent plugins/modules + { + 'echasnovski/mini.nvim', + config = function() + require('plugins.config.editor').setup_mini() + end, + }, + + -- Highlight, edit, and navigate code + { + 'nvim-treesitter/nvim-treesitter-textobjects', + event = 'VeryLazy', + dependencies = { 'nvim-treesitter/nvim-treesitter' }, + }, + + -- Detect tabstop and shiftwidth automatically + { 'tpope/vim-sleuth' }, + + -- Comment plugin + { + 'numToStr/Comment.nvim', + event = 'VeryLazy', + opts = {}, + }, + + -- Highlight word under cursor + { + 'RRethy/vim-illuminate', + event = { 'BufReadPost', 'BufNewFile' }, + config = function() + require('plugins.config.editor').setup_illuminate() + end, + }, +} \ No newline at end of file diff --git a/lua/custom/plugins/formatting.lua b/lua/plugins/spec/formatting.lua similarity index 100% rename from lua/custom/plugins/formatting.lua rename to lua/plugins/spec/formatting.lua diff --git a/lua/plugins/spec/git.lua b/lua/plugins/spec/git.lua new file mode 100644 index 00000000000..f362cdba948 --- /dev/null +++ b/lua/plugins/spec/git.lua @@ -0,0 +1,26 @@ +-- Git integration plugins +return { + -- Fugitive - Git integration + { + 'tpope/vim-fugitive', + cmd = { 'Git', 'G', 'Gdiff', 'Gread', 'Gwrite', 'Ggrep', 'GMove', 'GDelete', 'GBrowse', 'GRemove' }, + keys = { + { 'gs', 'Git', desc = 'Git status' }, + { 'gd', 'Gdiff', desc = 'Git diff' }, + { 'gc', 'Git commit', desc = 'Git commit' }, + { 'gb', 'Git blame', desc = 'Git blame' }, + { 'gl', 'Git log', desc = 'Git log' }, + { 'gp', 'Git push', desc = 'Git push' }, + { 'gf', 'Git fetch', desc = 'Git fetch' }, + }, + }, + + -- Gitsigns - Git gutter and hunk operations + { + 'lewis6991/gitsigns.nvim', + event = 'VeryLazy', + config = function() + require('plugins.config.git').setup_gitsigns() + end, + }, +} \ No newline at end of file diff --git a/lua/plugins/spec/indent-line.lua b/lua/plugins/spec/indent-line.lua new file mode 100644 index 00000000000..d594e1b0d10 --- /dev/null +++ b/lua/plugins/spec/indent-line.lua @@ -0,0 +1,33 @@ +-- Indent guides - Show vertical lines at indentation levels +return { + 'lukas-reineke/indent-blankline.nvim', + event = { 'BufReadPost', 'BufNewFile' }, + main = 'ibl', + opts = { + indent = { + char = '│', + tab_char = '│', + }, + scope = { + enabled = true, + show_start = true, + show_end = false, + injected_languages = false, + highlight = { 'Function', 'Label' }, + }, + exclude = { + filetypes = { + 'help', + 'alpha', + 'dashboard', + 'neo-tree', + 'Trouble', + 'lazy', + 'mason', + 'notify', + 'toggleterm', + 'lazyterm', + }, + }, + }, +} \ No newline at end of file diff --git a/lua/plugins/spec/init.lua b/lua/plugins/spec/init.lua new file mode 100644 index 00000000000..ae57ac1c719 --- /dev/null +++ b/lua/plugins/spec/init.lua @@ -0,0 +1,25 @@ +-- Main plugin loader - imports all plugin specifications +return { + -- UI and Theme + { import = 'plugins.spec.ui' }, + { import = 'plugins.spec.editor' }, + { import = 'plugins.spec.autopairs' }, + { import = 'plugins.spec.indent-line' }, + + -- Core functionality + { import = 'plugins.spec.lsp' }, + { import = 'plugins.spec.treesitter' }, + { import = 'plugins.spec.telescope' }, + { import = 'plugins.spec.blink' }, + + -- Git integration + { import = 'plugins.spec.git' }, + + -- Development tools + { import = 'plugins.spec.copilot' }, + { import = 'plugins.spec.debug' }, + { import = 'plugins.spec.formatting' }, + + -- Navigation + { import = 'plugins.spec.nvim-tmux-navigator' }, +} \ No newline at end of file diff --git a/lua/plugins/spec/lsp.lua b/lua/plugins/spec/lsp.lua new file mode 100644 index 00000000000..b83a20989d6 --- /dev/null +++ b/lua/plugins/spec/lsp.lua @@ -0,0 +1,26 @@ +-- LSP Plugin Specification +return { + { + 'neovim/nvim-lspconfig', + event = { 'BufReadPost', 'BufNewFile' }, + dependencies = { + { 'j-hui/fidget.nvim', opts = {} }, + 'folke/lazydev.nvim', + }, + config = function() + require('plugins.config.lsp').setup() + end, + }, + + -- LazyDev for better Neovim Lua development + { + 'folke/lazydev.nvim', + ft = 'lua', + opts = { + library = { + { path = 'luvit-meta/library', words = { 'vim%.uv' } }, + }, + }, + }, +} + diff --git a/lua/plugins/spec/nvim-tmux-navigator.lua b/lua/plugins/spec/nvim-tmux-navigator.lua new file mode 100644 index 00000000000..653ae519b93 --- /dev/null +++ b/lua/plugins/spec/nvim-tmux-navigator.lua @@ -0,0 +1,11 @@ +-- Tmux navigation integration +return { + 'christoomey/vim-tmux-navigator', + keys = { + { '', ':TmuxNavigateLeft', desc = 'Navigate to left tmux pane' }, + { '', ':TmuxNavigateDown', desc = 'Navigate to down tmux pane' }, + { '', ':TmuxNavigateUp', desc = 'Navigate to up tmux pane' }, + { '', ':TmuxNavigateRight', desc = 'Navigate to right tmux pane' }, + { '', ':TmuxNavigatePrevious', desc = 'Navigate to previous tmux pane' }, + }, +} \ No newline at end of file diff --git a/lua/plugins/spec/telescope.lua b/lua/plugins/spec/telescope.lua new file mode 100644 index 00000000000..383c5e84340 --- /dev/null +++ b/lua/plugins/spec/telescope.lua @@ -0,0 +1,21 @@ +-- Telescope - Fuzzy finder +return { + 'nvim-telescope/telescope.nvim', + event = 'VimEnter', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + { + 'nvim-telescope/telescope-fzf-native.nvim', + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, + { 'nvim-telescope/telescope-ui-select.nvim' }, + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + }, + config = function() + require('plugins.config.telescope').setup() + end, +} \ No newline at end of file diff --git a/lua/plugins/spec/treesitter.lua b/lua/plugins/spec/treesitter.lua new file mode 100644 index 00000000000..0c3cf5de506 --- /dev/null +++ b/lua/plugins/spec/treesitter.lua @@ -0,0 +1,45 @@ +-- Treesitter - Syntax highlighting and text objects +return { + 'nvim-treesitter/nvim-treesitter', + event = { 'BufReadPost', 'BufNewFile' }, + build = ':TSUpdate', + main = 'nvim-treesitter.configs', + opts = { + ensure_installed = { + 'bash', + 'c', + 'cmake', + 'cpp', + 'diff', + 'html', + 'lua', + 'luadoc', + 'make', + 'markdown', + 'markdown_inline', + 'nix', + 'python', + 'query', + 'vim', + 'vimdoc', + 'yaml', + }, + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + indent = { + enable = true, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + scope_incremental = false, + node_decremental = '', + }, + }, + }, +} \ No newline at end of file diff --git a/lua/plugins/spec/ui.lua b/lua/plugins/spec/ui.lua new file mode 100644 index 00000000000..479c72f12b8 --- /dev/null +++ b/lua/plugins/spec/ui.lua @@ -0,0 +1,29 @@ +-- UI and Theme plugins +return { + -- Color scheme + { + 'folke/tokyonight.nvim', + priority = 1000, + init = function() + vim.cmd.colorscheme 'tokyonight-night' + vim.cmd.hi 'Comment gui=none' + end, + }, + + -- Which-key for keybind hints + { + 'folke/which-key.nvim', + event = 'VimEnter', + config = function() + require('plugins.config.ui').setup_which_key() + end, + }, + + -- Todo comments highlighting + { + 'folke/todo-comments.nvim', + event = 'VimEnter', + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = { signs = false } + }, +} \ No newline at end of file From 780563cbe7114743f020522ca4fdb73774c5b9a2 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 27 Aug 2025 14:44:03 +1200 Subject: [PATCH 454/480] Integrate Copilot with Blink.cmp - Switch from copilot.vim to zbirenbaum/copilot.lua - Add blink-cmp-copilot for completion integration - Configure Blink to show Copilot in completion menu - Fix plugin import issues Testing in progress - can be reverted if needed --- .envrc | 10 ---------- lua/custom/plugins/blink.lua | 0 lua/custom/plugins/copilot.lua | 0 3 files changed, 10 deletions(-) create mode 100644 lua/custom/plugins/blink.lua create mode 100644 lua/custom/plugins/copilot.lua diff --git a/.envrc b/.envrc index a87ac425a74..281accf5adf 100644 --- a/.envrc +++ b/.envrc @@ -1,11 +1 @@ export PROJECT=$(basename $(pwd)) - -# Get the git project root -export PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd) - -# Set Lua paths for Neovim to find our modules -export LUA_PATH="$PROJECT_ROOT/lua/?.lua;$PROJECT_ROOT/lua/?/init.lua;;" -export LUA_CPATH="$PROJECT_ROOT/lua/?.so;;" - -# Optional: Set NVIM_APPNAME for isolated testing -export NVIM_APPNAME="nvim-$PROJECT" \ No newline at end of file diff --git a/lua/custom/plugins/blink.lua b/lua/custom/plugins/blink.lua new file mode 100644 index 00000000000..e69de29bb2d diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua new file mode 100644 index 00000000000..e69de29bb2d From 70d0ccef7f51cfe4b7539abc73c1ad9b7c2c3a47 Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 2 Sep 2025 13:21:18 +1200 Subject: [PATCH 455/480] refactor: Complete modular migration from kickstart.nvim Major architectural overhaul to transform the flat kickstart.nvim structure into a maintainable, modular configuration while preserving upstream sync capability. ## Structure Changes - Migrated from flat `lua/custom/` to organized `lua/core/` and `lua/plugins/` - Separated plugin specs from configs: `lua/plugins/spec/` and `lua/plugins/config/` - Complex configs (LSP, Debug) now use directory structure with sub-modules: - `lsp/init.lua`, `lsp/servers.lua`, `lsp/keymaps.lua` - `debug/init.lua`, `debug/adapters.lua`, `debug/keymaps.lua` ## Core Improvements - Created dedicated core modules: options, keymaps, autocmds, bootstrap, health - Added comprehensive health check (`lua/core/health.lua`) for diagnostics - Simplified init.lua to just orchestrate module loading - Better separation of concerns throughout ## Plugin Updates - Fixed Blink.cmp configuration (removed invalid fuzzy options) - Integrated Copilot with Blink.cmp for unified completion experience - Added autopairs and indent-line from kickstart examples - Optimized for Nix development environments (removed venv assumptions) ## Documentation - Updated README with modular structure and kickstart sync instructions - Created comprehensive KEYBIND_ANALYSIS.md with all mappings - Added modular.txt help documentation - Created TODO_TEST.md checklist for testing ## Benefits - Easier to maintain and extend - Clean separation allows upstream kickstart merges without conflicts - Scalable architecture for adding new languages/tools - Better code organization and discoverability All kickstart functionality preserved while gaining modularity and maintainability. --- .envrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.envrc b/.envrc index 281accf5adf..4f62431e4e9 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,2 @@ export PROJECT=$(basename $(pwd)) + From 5a94646a7a2be153bf35d11da82fba97c543d0d2 Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 2 Sep 2025 16:27:11 +1200 Subject: [PATCH 456/480] =?UTF-8?q?claude=20bugs=20=F0=9F=A4=A6?= =?UTF-8?q?=F0=9F=8F=BE=E2=80=8D=E2=99=82=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KEYBIND_ANALYSIS.md | 12 ++++++- lua/core/autocmds.lua | 13 ++++++++ lua/core/bootstrap.lua | 2 +- lua/core/keymaps.lua | 12 +++++++ lua/core/options.lua | 72 ++++++++++++++++++++++++++++++++++-------- 5 files changed, 96 insertions(+), 15 deletions(-) diff --git a/KEYBIND_ANALYSIS.md b/KEYBIND_ANALYSIS.md index 0bd1b49ecd9..baebc632541 100644 --- a/KEYBIND_ANALYSIS.md +++ b/KEYBIND_ANALYSIS.md @@ -3,7 +3,7 @@ ## Current Active Keybindings (Modular Config) ### Leader Key -- **Leader**: `` +- **Leader**: `` (Fixed: was missing from config!) ### Core Navigation & Editing - `` - Clear search highlights (in normal mode) @@ -170,6 +170,16 @@ Navigation between occurrences: - `` or `]]` - Next occurrence (if configured) - `` or `[[` - Previous occurrence (if configured) +### Visual Feedback +- **Yank Highlighting** - Text flashes when yanked/copied (automatic) +- **Cursor Line** - Current line is highlighted +- **Search Highlighting** - Search results are highlighted (clear with ``) + +### System Integration +- **Clipboard** - System clipboard integration enabled (yank/paste works with OS) +- **Mouse** - Full mouse support in all modes +- **Undo** - Persistent undo history across sessions + ### Which-Key Groups Groups that organize keybindings: - `c` - **[C]ode** operations diff --git a/lua/core/autocmds.lua b/lua/core/autocmds.lua index e69de29bb2d..ec36a675bb8 100644 --- a/lua/core/autocmds.lua +++ b/lua/core/autocmds.lua @@ -0,0 +1,13 @@ +-- [[ Basic Autocommands ]] +-- See `:help lua-guide-autocommands` + +-- Highlight when yanking (copying) text +-- Try it with `yap` in normal mode +-- See `:help vim.hl.on_yank()` +vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }), + callback = function() + vim.hl.on_yank() + end, +}) \ No newline at end of file diff --git a/lua/core/bootstrap.lua b/lua/core/bootstrap.lua index 7420e268604..e21b1f46afc 100644 --- a/lua/core/bootstrap.lua +++ b/lua/core/bootstrap.lua @@ -1,6 +1,6 @@ -- Lazy.nvim installation local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' -if not vim.loop.fs_stat(lazypath) then +if not (vim.uv or vim.loop).fs_stat(lazypath) then vim.fn.system { 'git', 'clone', diff --git a/lua/core/keymaps.lua b/lua/core/keymaps.lua index f32998b0e9b..495d79f0898 100644 --- a/lua/core/keymaps.lua +++ b/lua/core/keymaps.lua @@ -1,6 +1,18 @@ -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` +-- Clear search highlights with Escape in normal mode +vim.keymap.set('n', '', 'nohlsearch') + +-- Diagnostic keymaps +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) + +-- Exit terminal mode with double Escape +vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) + +-- NOTE: Window navigation is handled by nvim-tmux-navigator plugin +-- which provides seamless navigation between vim splits and tmux panes + -- LSP reload function local function reload_lsp() local clients = vim.lsp.get_clients() diff --git a/lua/core/options.lua b/lua/core/options.lua index b3b15566d3a..169b8309c32 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -1,22 +1,68 @@ +-- Set as the leader key +-- See `:help mapleader` +-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + -- Place custom vim options here -- Set based on your font installation vim.g.have_nerd_font = true +-- [[ Essential Options from Kickstart ]] +-- These MUST be set since we're not loading kickstart's defaults + +-- Line numbers +vim.opt.number = true +vim.opt.relativenumber = true + +-- Mouse and interaction +vim.opt.mouse = 'a' -- Enable mouse mode +vim.opt.showmode = false -- Don't show mode since we have a statusline + +-- Clipboard - sync with system clipboard +vim.opt.clipboard = 'unnamedplus' + -- Indentation settings -vim.o.smartindent = true -vim.o.autoindent = true -vim.o.expandtab = true -vim.o.tabstop = 2 -vim.o.shiftwidth = 2 -vim.o.softtabstop = 2 - --- Add any other custom vim.o or vim.g settings from your old config here --- For example, if you changed defaults for: --- vim.opt.number = true -- (Already default in kickstart) --- vim.opt.mouse = 'a' -- (Already default in kickstart) --- etc... Review the options section of your old init.lua and add any *changed* values here. --- The kickstart defaults are generally sensible, so you might not need many overrides. +vim.opt.breakindent = true -- Enable break indent +vim.opt.smartindent = true +vim.opt.autoindent = true +vim.opt.expandtab = true +vim.opt.tabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.softtabstop = 2 + +-- Save undo history +vim.opt.undofile = true + +-- Search settings +vim.opt.ignorecase = true -- Case insensitive searching +vim.opt.smartcase = true -- Unless capital in search +vim.opt.hlsearch = true -- Highlight search results + +-- Keep signcolumn on by default +vim.opt.signcolumn = 'yes' + +-- Decrease update time +vim.opt.updatetime = 250 +vim.opt.timeoutlen = 300 -- Time to wait for mapped sequence + +-- Configure how new splits should be opened +vim.opt.splitright = true +vim.opt.splitbelow = true + +-- Sets how neovim will display certain whitespace characters +vim.opt.list = true +vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } + +-- Preview substitutions live +vim.opt.inccommand = 'split' + +-- Show which line your cursor is on +vim.opt.cursorline = true + +-- Minimal number of screen lines to keep above and below the cursor +vim.opt.scrolloff = 10 -- Function to check if running in a shared tmux session local function is_shared_tmux_session() From 406d368d33666ff1bf133c52a5d4ad55178aa02d Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 2 Sep 2025 16:40:14 +1200 Subject: [PATCH 457/480] bugs --- lua/plugins/config/lsp/servers.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lua/plugins/config/lsp/servers.lua b/lua/plugins/config/lsp/servers.lua index fb97501b791..28d717d3396 100644 --- a/lua/plugins/config/lsp/servers.lua +++ b/lua/plugins/config/lsp/servers.lua @@ -32,11 +32,23 @@ function M.get_servers() '--clang-tidy', '--header-insertion=never', '--query-driver=' .. get_clangd_query_driver(), - '--compile-commands-dir=build', + -- Remove hardcoded build dir - clangd will search for compile_commands.json + -- in the current directory and all parent directories by default '--resource-dir=' .. get_clang_resource_dir(), + -- Help clangd find system headers + '--fallback-style=llvm', }, filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, - root_dir = util.root_pattern('CMakeLists.txt', '.git'), + -- First check for compile_commands.json in build/, then at root, then other markers + root_dir = function(fname) + -- Look for compile_commands.json in build/ first + local build_dir = util.root_pattern('build/compile_commands.json')(fname) + if build_dir then + return build_dir + end + -- Then look for it at project root or other markers + return util.root_pattern('compile_commands.json', 'compile_flags.txt', '.clangd', 'CMakeLists.txt', '.git')(fname) + end, single_file_support = true, }, From 8802b654c9ddfa8ad84217663c8e3c158b0600ed Mon Sep 17 00:00:00 2001 From: dlond Date: Tue, 2 Sep 2025 19:24:05 +1200 Subject: [PATCH 458/480] fix: clangd config --- KEYBIND_ANALYSIS.md | 227 ----------------------------- lua/custom/plugins/blink.lua | 0 lua/custom/plugins/copilot.lua | 0 lua/plugins/config/lsp/servers.lua | 49 ++++--- 4 files changed, 27 insertions(+), 249 deletions(-) delete mode 100644 KEYBIND_ANALYSIS.md delete mode 100644 lua/custom/plugins/blink.lua delete mode 100644 lua/custom/plugins/copilot.lua diff --git a/KEYBIND_ANALYSIS.md b/KEYBIND_ANALYSIS.md deleted file mode 100644 index baebc632541..00000000000 --- a/KEYBIND_ANALYSIS.md +++ /dev/null @@ -1,227 +0,0 @@ -# Neovim Keybind Analysis - -## Current Active Keybindings (Modular Config) - -### Leader Key -- **Leader**: `` (Fixed: was missing from config!) - -### Core Navigation & Editing -- `` - Clear search highlights (in normal mode) -- `q` - Open diagnostic quickfix list -- `` - Exit terminal mode (in terminal) - -### Window/Tmux Navigation -- `` - Navigate to left window/tmux pane -- `` - Navigate to down window/tmux pane -- `` - Navigate to up window/tmux pane -- `` - Navigate to right window/tmux pane -- `` - Navigate to previous tmux pane - -### Search & Files (`s*`) -- `sf` - **[S]earch [F]iles** - Find files in project -- `sg` - **[S]earch by [G]rep** - Live grep search -- `sh` - **[S]earch [H]elp** - Search help documentation -- `sk` - **[S]earch [K]eymaps** - Browse all keymaps -- `ss` - **[S]earch [S]elect Telescope** - Telescope picker -- `sw` - **[S]earch current [W]ord** - Search word under cursor -- `sd` - **[S]earch [D]iagnostics** - Browse diagnostics -- `sr` - **[S]earch [R]esume** - Resume last search -- `s.` - **[S]earch Recent Files** - Recently opened files -- `s/` - **[S]earch in Open Files** - Grep in open buffers -- `sn` - **[S]earch [N]eovim files** - Browse config files -- `/` - **Fuzzy search in current buffer** -- `` - **Find existing buffers** - -### LSP Operations -- `gd` - **[G]oto [D]efinition** -- `grr` - **[G]oto [R]eferences** -- `gri` - **[G]oto [I]mplementation** -- `grD` - **[G]oto [D]eclaration** -- `grt` - **[G]oto [T]ype definition** -- `grn` - **[G]oto [R]e[n]ame** - Rename symbol -- `gra` - **[G]oto code [A]ction** (also works in visual mode) -- `gO` - **[G]oto [O]pen document symbols** -- `gW` - **[G]oto [W]orkspace symbols** -- `K` - **Hover Documentation** -- `f` - **[F]ormat buffer** -- `lr` - **[L]SP [R]eload** all servers - -### Diagnostics -- `[d` - Previous diagnostic message -- `]d` - Next diagnostic message -- `e` - Show diagnostic error messages (float) -- `q` - Open diagnostic quickfix list - -### Git Operations (`g*`) -#### Fugitive Commands -- `gs` - **[G]it [S]tatus** - Open Git status -- `gd` - **[G]it [D]iff** - Show diff -- `gc` - **[G]it [C]ommit** - Create commit -- `gb` - **[G]it [B]lame** - Show blame -- `gl` - **[G]it [L]og** - View log -- `gp` - **[G]it [P]ush** - Push changes -- `gf` - **[G]it [F]etch** - Fetch from remote - -#### Gitsigns Hunks (`h*`) -- `]c` - Jump to next git change -- `[c` - Jump to previous git change -- `hs` - **[H]unk [S]tage** - Stage current hunk -- `hr` - **[H]unk [R]eset** - Reset current hunk -- `hS` - **[H]unk [S]tage buffer** - Stage entire buffer -- `hu` - **[H]unk [U]ndo stage** - Undo stage hunk -- `hR` - **[H]unk [R]eset buffer** - Reset entire buffer -- `hp` - **[H]unk [P]review** - Preview hunk changes -- `hb` - **[H]unk [B]lame line** - Show blame for line -- `hd` - **[H]unk [D]iff** - Diff against index -- `hD` - **[H]unk [D]iff** - Diff against last commit -- `tb` - **[T]oggle [B]lame line** - Toggle inline blame -- `tD` - **[T]oggle [D]eleted** - Toggle deleted lines - -### Debug Operations (DAP) -- `` - **Start/Continue** debugging -- `` - **Step Over** -- `` - **Step Into** -- `` - **Step Out** -- `` - **Toggle Debug UI** -- `db` - **[D]ebug [B]reakpoint** - Toggle breakpoint -- `dB` - **[D]ebug [B]reakpoint** - Set conditional -- `lp` - **[L]og [P]oint** - Set log point message -- `de` - **[D]ebug [E]val** - Evaluate expression -- `dr` - **[D]ebug [R]EPL** - Open REPL -- `dl` - **[D]ebug [L]ast** - Run last debug session -- `dh` - **[D]ebug [H]over** - Hover variables -- `ds` - **[D]ebug [S]copes** - View scopes -- `df` - **[D]ebug [F]rames** - View call frames -- `dt` - **[D]ebug [T]erminate** - Terminate session -- `dc` - **[D]ebug [C]ontinue** - Continue to cursor - -### Completion (Blink.cmp) -- `` - Trigger/Show completion -- `` - Accept completion -- `` - Cancel/Hide completion -- `` - Select next item -- `` - Select previous item -- `` - Scroll documentation up -- `` - Scroll documentation down -- `` - Next snippet placeholder -- `` - Previous snippet placeholder - -### GitHub Copilot -**Integration**: Copilot is installed (`zbirenbaum/copilot.lua`) and integrated with Blink.cmp. -- Copilot suggestions appear automatically in the completion menu -- Inline ghost text is disabled (handled by Blink.cmp instead) -- Use standard Blink.cmp keybindings to accept Copilot suggestions - -Copilot commands: -- `:Copilot auth` - Authenticate with GitHub -- `:Copilot status` - Check Copilot status -- `:Copilot disable` - Disable Copilot -- `:Copilot enable` - Enable Copilot - -### Text Objects (Mini.ai) -Enhanced text objects for better selection: -- `a` - Around (e.g., `daw` = delete around word) -- `i` - Inside (e.g., `ci"` = change inside quotes) -Common targets: -- `w` - Word -- `W` - WORD (includes punctuation) -- `p` - Paragraph -- `s` - Sentence -- `(`, `)`, `[`, `]`, `{`, `}` - Brackets -- `'`, `"`, `` ` `` - Quotes -- `<`, `>` - Angle brackets -- `t` - Tag (HTML/XML) - -### Surround Operations (Mini.surround) -Default mappings: -- `sa` - Add surrounding (e.g., `saiw"` = surround word with quotes) -- `sd` - Delete surrounding (e.g., `sd"` = delete surrounding quotes) -- `sr` - Replace surrounding (e.g., `sr"'` = replace " with ') -- `sf` - Find surrounding -- `sF` - Find surrounding (left) -- `sh` - Highlight surrounding -- `sn` - Update MiniSurround.config.n_lines - -### Comments (Comment.nvim) -- `gcc` - Toggle comment on current line -- `gc` - Toggle comment (motion/visual mode) -- `gbc` - Toggle block comment on current line -- `gb` - Toggle block comment (motion/visual mode) -Examples: -- `gcap` - Comment a paragraph -- `gc3j` - Comment current line and 3 lines below -- Visual mode: Select lines then `gc` to toggle - -### Autopairs (nvim-autopairs) -Automatic bracket/quote pairing: -- When typing `(`, `[`, `{`, `'`, `"`, or `` ` ``, the closing pair is automatically inserted -- Pressing `` between pairs expands them properly -- Backspace removes both opening and closing pairs - -### Indent Line (indent-blankline.nvim) -Visual indent guides are automatically shown - no keybindings needed - -### Vim Sleuth -Automatically detects and sets indentation settings - no keybindings needed - -### Illuminate (vim-illuminate) -Automatically highlights other occurrences of word under cursor - no keybindings needed -Navigation between occurrences: -- `` or `]]` - Next occurrence (if configured) -- `` or `[[` - Previous occurrence (if configured) - -### Visual Feedback -- **Yank Highlighting** - Text flashes when yanked/copied (automatic) -- **Cursor Line** - Current line is highlighted -- **Search Highlighting** - Search results are highlighted (clear with ``) - -### System Integration -- **Clipboard** - System clipboard integration enabled (yank/paste works with OS) -- **Mouse** - Full mouse support in all modes -- **Undo** - Persistent undo history across sessions - -### Which-Key Groups -Groups that organize keybindings: -- `c` - **[C]ode** operations -- `d` - **[D]ocument/[D]ebug** operations -- `g` - **[G]it** operations -- `h` - **Git [H]unk** operations -- `r` - **[R]ename** operations -- `s` - **[S]earch** operations -- `t` - **[T]oggle** operations -- `w` - **[W]orkspace** operations - -## Keybinding Architecture - -### Organization Pattern -1. **Leader-based commands** - Most actions use `` (Space) -2. **Mnemonic prefixes** - First letter usually matches action (s=search, g=git, d=debug) -3. **LSP shortcuts** - Use `g` prefix for goto operations -4. **Function keys** - Reserved for debugging (F5, F7, F10-F12) -5. **Control combos** - Navigation and completion - -### Configuration Locations -- **Core keymaps**: `lua/core/keymaps.lua` (custom LSP reload) -- **Kickstart defaults**: Built into respective plugin configurations -- **LSP keymaps**: `lua/plugins/config/lsp/keymaps.lua` -- **Telescope keymaps**: `lua/plugins/config/telescope.lua` -- **Git keymaps**: `lua/plugins/config/git.lua` -- **Debug keymaps**: `lua/plugins/config/debug/keymaps.lua` -- **Tmux navigation**: `lua/plugins/spec/nvim-tmux-navigator.lua` -- **Blink.cmp keymaps**: `lua/plugins/config/blink.lua` -- **Editor enhancements**: `lua/plugins/config/editor.lua` (Mini.nvim modules) -- **Which-key groups**: `lua/plugins/config/ui.lua` - -## Tips for Learning Keybindings - -1. **Use Which-key**: Press `` and wait to see available options -2. **Search keymaps**: Use `sk` to search all keybindings -3. **Mnemonic patterns**: Most bindings follow logical patterns (s=search, g=git, etc.) -4. **Check `:checkhealth core`**: Verify all features are working - -## Customization Guide - -To add new keybindings: -1. For general keymaps: Edit `lua/core/keymaps.lua` -2. For plugin-specific: Add to the relevant config file in `lua/plugins/config/` -3. Update Which-key groups in `lua/plugins/config/ui.lua` if adding new categories \ No newline at end of file diff --git a/lua/custom/plugins/blink.lua b/lua/custom/plugins/blink.lua deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/lua/plugins/config/lsp/servers.lua b/lua/plugins/config/lsp/servers.lua index 28d717d3396..3f761eb5670 100644 --- a/lua/plugins/config/lsp/servers.lua +++ b/lua/plugins/config/lsp/servers.lua @@ -28,27 +28,31 @@ function M.get_servers() clangd = { cmd = { 'clangd', + '--query-driver=' .. get_clangd_query_driver(), '--background-index', '--clang-tidy', - '--header-insertion=never', - '--query-driver=' .. get_clangd_query_driver(), - -- Remove hardcoded build dir - clangd will search for compile_commands.json - -- in the current directory and all parent directories by default - '--resource-dir=' .. get_clang_resource_dir(), - -- Help clangd find system headers + '--enable-config', '--fallback-style=llvm', + '--function-arg-placeholders', + '--header-insertion-decorators', + '--header-insertion=iwyu', }, filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, - -- First check for compile_commands.json in build/, then at root, then other markers - root_dir = function(fname) - -- Look for compile_commands.json in build/ first - local build_dir = util.root_pattern('build/compile_commands.json')(fname) - if build_dir then - return build_dir - end - -- Then look for it at project root or other markers - return util.root_pattern('compile_commands.json', 'compile_flags.txt', '.clangd', 'CMakeLists.txt', '.git')(fname) - end, + -- Look for project markers - clangd will find compile_commands.json itself + root_dir = util.root_pattern( + -- First check for any compile_commands.json anywhere + 'compile_commands.json', + -- Then check common build directories + 'build/compile_commands.json', + 'Debug/compile_commands.json', + 'Release/compile_commands.json', + -- Project markers + '.clangd', + 'compile_flags.txt', + 'CMakeLists.txt', + 'Makefile', + '.git' + ), single_file_support = true, }, @@ -66,23 +70,23 @@ function M.get_servers() }, positionEncoding = 'utf-8', }, - + -- Python Linter/Formatter ruff = {}, - + -- Nix Language Server nixd = {}, - + -- LaTeX Language Server texlab = {}, - + -- CMake Language Server cmake = { cmd = { 'cmake-language-server' }, filetypes = { 'cmake' }, root_dir = util.root_pattern('CMakeLists.txt', '.git'), }, - + -- Add more servers here as needed -- Example: -- rust_analyzer = { @@ -97,4 +101,5 @@ function M.get_servers() } end -return M \ No newline at end of file +return M + From fef576fbde5e01d023ea3cda6e5d2f8bb951d8f5 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 3 Sep 2025 07:18:27 +1200 Subject: [PATCH 459/480] feat: first attempt at compile-commands-picker --- .../config/compile-commands-picker.lua | 137 ++++++++++++++++++ lua/plugins/config/lsp/init.lua | 3 + lua/plugins/config/lsp/servers.lua | 2 +- lua/plugins/config/telescope.lua | 4 + 4 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 lua/plugins/config/compile-commands-picker.lua diff --git a/lua/plugins/config/compile-commands-picker.lua b/lua/plugins/config/compile-commands-picker.lua new file mode 100644 index 00000000000..bc7c5c86682 --- /dev/null +++ b/lua/plugins/config/compile-commands-picker.lua @@ -0,0 +1,137 @@ +-- Telescope picker for selecting compile_commands.json +local M = {} + +local function find_compile_commands() + local root = vim.fn.getcwd() + local cmd = string.format('find "%s" -name compile_commands.json -type f 2>/dev/null', root) + local handle = io.popen(cmd) + if not handle then + return {} + end + + local result = handle:read('*a') + handle:close() + + local files = {} + for line in result:gmatch('[^\n]+') do + -- Get relative path for display + local relative = line:gsub('^' .. vim.pesc(root) .. '/', '') + table.insert(files, { + path = line, + display = relative, + dir = vim.fn.fnamemodify(line, ':h'), + relative_dir = vim.fn.fnamemodify(relative, ':h'), + }) + end + + return files +end + +function M.pick_compile_commands() + local files = find_compile_commands() + + if #files == 0 then + vim.notify('No compile_commands.json files found', vim.log.levels.WARN) + return + elseif #files == 1 then + vim.notify('Using: ' .. files[1].display, vim.log.levels.INFO) + M.set_compile_commands(files[1]) + return + end + + -- Multiple files found, show picker + local pickers = require('telescope.pickers') + local finders = require('telescope.finders') + local conf = require('telescope.config').values + local actions = require('telescope.actions') + local action_state = require('telescope.actions.state') + + pickers.new({}, { + prompt_title = 'Select compile_commands.json', + finder = finders.new_table { + results = files, + entry_maker = function(entry) + return { + value = entry, + display = entry.display, + ordinal = entry.display, + } + end, + }, + sorter = conf.generic_sorter{}, + attach_mappings = function(prompt_bufnr, map) + actions.select_default:replace(function() + actions.close(prompt_bufnr) + local selection = action_state.get_selected_entry() + if selection then + M.set_compile_commands(selection.value) + end + end) + return true + end, + }):find() +end + +function M.set_compile_commands(file_info) + local clangd_config = string.format([[ +CompileFlags: + CompilationDatabase: %s +]], file_info.relative_dir) + + -- Write .clangd file + local clangd_file = vim.fn.getcwd() .. '/.clangd' + local file = io.open(clangd_file, 'w') + if file then + file:write(clangd_config) + file:close() + vim.notify('Created .clangd pointing to: ' .. file_info.relative_dir, vim.log.levels.INFO) + + -- Restart LSP if clangd is running + local clients = vim.lsp.get_active_clients({ name = 'clangd' }) + if #clients > 0 then + vim.notify('Restarting clangd...', vim.log.levels.INFO) + vim.cmd('LspRestart clangd') + end + else + vim.notify('Failed to create .clangd file', vim.log.levels.ERROR) + end +end + +-- Auto-detect multiple compile_commands.json on startup +function M.auto_detect() + local files = find_compile_commands() + + if #files > 1 then + -- Check if .clangd already exists + local clangd_file = vim.fn.getcwd() .. '/.clangd' + if vim.fn.filereadable(clangd_file) == 0 then + vim.notify( + string.format('Found %d compile_commands.json files. Use :CompileCommandsPicker to select one.', #files), + vim.log.levels.INFO + ) + end + end +end + +-- Setup function to create command +function M.setup() + vim.api.nvim_create_user_command('CompileCommandsPicker', function() + M.pick_compile_commands() + end, { desc = 'Select compile_commands.json for clangd' }) + + -- Auto-detect on entering a C/C++ file + vim.api.nvim_create_autocmd('FileType', { + pattern = { 'c', 'cpp', 'objc', 'objcpp' }, + callback = function() + -- Only run once per session + if not vim.g.compile_commands_detected then + vim.g.compile_commands_detected = true + vim.defer_fn(function() + M.auto_detect() + end, 100) + end + end, + }) +end + +return M \ No newline at end of file diff --git a/lua/plugins/config/lsp/init.lua b/lua/plugins/config/lsp/init.lua index 930dd4a45ad..fab3e1d8da5 100644 --- a/lua/plugins/config/lsp/init.lua +++ b/lua/plugins/config/lsp/init.lua @@ -21,6 +21,9 @@ function M.setup() -- Setup LSP keymaps require('plugins.config.lsp.keymaps').setup() + + -- Setup compile_commands.json picker for C/C++ projects + require('plugins.config.compile-commands-picker').setup() end return M \ No newline at end of file diff --git a/lua/plugins/config/lsp/servers.lua b/lua/plugins/config/lsp/servers.lua index 3f761eb5670..f416dc02bd7 100644 --- a/lua/plugins/config/lsp/servers.lua +++ b/lua/plugins/config/lsp/servers.lua @@ -9,7 +9,7 @@ local function get_clangd_query_driver() '/nix/store/*/bin/clang*', '/opt/homebrew/opt/llvm/bin/clang*', '/usr/bin/clang*', - }, ';') + }, ':') end -- Get clang resource directory diff --git a/lua/plugins/config/telescope.lua b/lua/plugins/config/telescope.lua index 119919b0634..60275b80e23 100644 --- a/lua/plugins/config/telescope.lua +++ b/lua/plugins/config/telescope.lua @@ -79,6 +79,10 @@ function M.setup() vim.keymap.set('n', 'sn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[S]earch [N]eovim files' }) + + -- C/C++ compile_commands.json picker + vim.keymap.set('n', 'sc', 'CompileCommandsPicker', + { desc = '[S]earch [C]ompile commands.json' }) end return M \ No newline at end of file From 220864faf2a407534f4987f037b459c1cf3f79b8 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 3 Sep 2025 08:05:56 +1200 Subject: [PATCH 460/480] fix: testing revealed errors --- lua/plugins/config/compile-commands-picker.lua | 9 ++++++++- lua/plugins/config/lsp/init.lua | 3 --- lua/plugins/spec/telescope.lua | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lua/plugins/config/compile-commands-picker.lua b/lua/plugins/config/compile-commands-picker.lua index bc7c5c86682..cabe87c17e3 100644 --- a/lua/plugins/config/compile-commands-picker.lua +++ b/lua/plugins/config/compile-commands-picker.lua @@ -90,7 +90,14 @@ CompileFlags: local clients = vim.lsp.get_active_clients({ name = 'clangd' }) if #clients > 0 then vim.notify('Restarting clangd...', vim.log.levels.INFO) - vim.cmd('LspRestart clangd') + -- Stop and start clangd to pick up new config + for _, client in ipairs(clients) do + client.stop() + end + vim.defer_fn(function() + vim.cmd('LspStart clangd') + vim.notify('Clangd restarted with new configuration', vim.log.levels.INFO) + end, 100) end else vim.notify('Failed to create .clangd file', vim.log.levels.ERROR) diff --git a/lua/plugins/config/lsp/init.lua b/lua/plugins/config/lsp/init.lua index fab3e1d8da5..930dd4a45ad 100644 --- a/lua/plugins/config/lsp/init.lua +++ b/lua/plugins/config/lsp/init.lua @@ -21,9 +21,6 @@ function M.setup() -- Setup LSP keymaps require('plugins.config.lsp.keymaps').setup() - - -- Setup compile_commands.json picker for C/C++ projects - require('plugins.config.compile-commands-picker').setup() end return M \ No newline at end of file diff --git a/lua/plugins/spec/telescope.lua b/lua/plugins/spec/telescope.lua index 383c5e84340..e6759e6d0c4 100644 --- a/lua/plugins/spec/telescope.lua +++ b/lua/plugins/spec/telescope.lua @@ -17,5 +17,7 @@ return { }, config = function() require('plugins.config.telescope').setup() + -- Setup compile_commands.json picker for C/C++ projects + require('plugins.config.compile-commands-picker').setup() end, } \ No newline at end of file From b668a18cc8f576cc167578edd066327f39b62c50 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 3 Sep 2025 08:09:00 +1200 Subject: [PATCH 461/480] fix: get_active_clients() is deprecated --- lua/plugins/config/compile-commands-picker.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/compile-commands-picker.lua b/lua/plugins/config/compile-commands-picker.lua index cabe87c17e3..affd1a182a7 100644 --- a/lua/plugins/config/compile-commands-picker.lua +++ b/lua/plugins/config/compile-commands-picker.lua @@ -87,7 +87,7 @@ CompileFlags: vim.notify('Created .clangd pointing to: ' .. file_info.relative_dir, vim.log.levels.INFO) -- Restart LSP if clangd is running - local clients = vim.lsp.get_active_clients({ name = 'clangd' }) + local clients = vim.lsp.get_clients({ name = 'clangd' }) if #clients > 0 then vim.notify('Restarting clangd...', vim.log.levels.INFO) -- Stop and start clangd to pick up new config From cf55cd58386d3673a2698924ecea5103f0b4ff1b Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 3 Sep 2025 08:59:25 +1200 Subject: [PATCH 462/480] feat: add preview for compile commands picker --- lua/plugins/config/compile-commands-picker.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/plugins/config/compile-commands-picker.lua b/lua/plugins/config/compile-commands-picker.lua index affd1a182a7..758800064d7 100644 --- a/lua/plugins/config/compile-commands-picker.lua +++ b/lua/plugins/config/compile-commands-picker.lua @@ -55,10 +55,12 @@ function M.pick_compile_commands() value = entry, display = entry.display, ordinal = entry.display, + path = entry.path, -- Add path for previewer } end, }, sorter = conf.generic_sorter{}, + previewer = conf.file_previewer{}, -- Add file previewer attach_mappings = function(prompt_bufnr, map) actions.select_default:replace(function() actions.close(prompt_bufnr) From 4992df685d50f841035caa8c05a6c6d4478160a3 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 3 Sep 2025 09:03:16 +1200 Subject: [PATCH 463/480] bug: fix preview --- lua/plugins/config/compile-commands-picker.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/plugins/config/compile-commands-picker.lua b/lua/plugins/config/compile-commands-picker.lua index 758800064d7..4e44dec60f8 100644 --- a/lua/plugins/config/compile-commands-picker.lua +++ b/lua/plugins/config/compile-commands-picker.lua @@ -45,6 +45,7 @@ function M.pick_compile_commands() local conf = require('telescope.config').values local actions = require('telescope.actions') local action_state = require('telescope.actions.state') + local previewers = require('telescope.previewers') pickers.new({}, { prompt_title = 'Select compile_commands.json', @@ -55,12 +56,13 @@ function M.pick_compile_commands() value = entry, display = entry.display, ordinal = entry.display, - path = entry.path, -- Add path for previewer + filename = entry.path, -- Use filename for previewer + path = entry.path, } end, }, sorter = conf.generic_sorter{}, - previewer = conf.file_previewer{}, -- Add file previewer + previewer = previewers.vim_buffer_cat.new{}, -- Use vim_buffer_cat previewer attach_mappings = function(prompt_bufnr, map) actions.select_default:replace(function() actions.close(prompt_bufnr) From 369887becb44acbf75d01596fc4f3f5ab289a835 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 3 Sep 2025 09:07:52 +1200 Subject: [PATCH 464/480] fix: missing ',' --- lua/plugins/config/compile-commands-picker.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lua/plugins/config/compile-commands-picker.lua b/lua/plugins/config/compile-commands-picker.lua index 4e44dec60f8..88c5bb00cbe 100644 --- a/lua/plugins/config/compile-commands-picker.lua +++ b/lua/plugins/config/compile-commands-picker.lua @@ -45,8 +45,8 @@ function M.pick_compile_commands() local conf = require('telescope.config').values local actions = require('telescope.actions') local action_state = require('telescope.actions.state') - local previewers = require('telescope.previewers') + -- Use Telescope's built-in file picker configuration pickers.new({}, { prompt_title = 'Select compile_commands.json', finder = finders.new_table { @@ -56,13 +56,14 @@ function M.pick_compile_commands() value = entry, display = entry.display, ordinal = entry.display, - filename = entry.path, -- Use filename for previewer + filename = entry.path, path = entry.path, + cwd = vim.fn.getcwd(), } end, }, - sorter = conf.generic_sorter{}, - previewer = previewers.vim_buffer_cat.new{}, -- Use vim_buffer_cat previewer + sorter = conf.file_sorter{}, + previewer = conf.file_previewer{}, attach_mappings = function(prompt_bufnr, map) actions.select_default:replace(function() actions.close(prompt_bufnr) From 829e0c4bc534a535e57fe667924ec486401fc966 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 3 Sep 2025 09:17:35 +1200 Subject: [PATCH 465/480] fix: glad this stuff gets squashed --- .../config/compile-commands-picker.lua | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lua/plugins/config/compile-commands-picker.lua b/lua/plugins/config/compile-commands-picker.lua index 88c5bb00cbe..2df60fac7e0 100644 --- a/lua/plugins/config/compile-commands-picker.lua +++ b/lua/plugins/config/compile-commands-picker.lua @@ -46,23 +46,29 @@ function M.pick_compile_commands() local actions = require('telescope.actions') local action_state = require('telescope.actions.state') - -- Use Telescope's built-in file picker configuration + -- Create a simple path array for the finder + local paths = {} + local path_to_info = {} + for _, file in ipairs(files) do + table.insert(paths, file.path) + path_to_info[file.path] = file + end + pickers.new({}, { prompt_title = 'Select compile_commands.json', finder = finders.new_table { - results = files, - entry_maker = function(entry) + results = paths, -- Pass simple path strings + entry_maker = function(path) + local info = path_to_info[path] return { - value = entry, - display = entry.display, - ordinal = entry.display, - filename = entry.path, - path = entry.path, - cwd = vim.fn.getcwd(), + value = info, + display = info.display, + ordinal = info.display, + path = path, -- This is what the previewer needs } end, }, - sorter = conf.file_sorter{}, + sorter = conf.generic_sorter{}, previewer = conf.file_previewer{}, attach_mappings = function(prompt_bufnr, map) actions.select_default:replace(function() From d214e73407a5f20eb639e8ab264cb9c8247295da Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 3 Sep 2025 09:20:23 +1200 Subject: [PATCH 466/480] fix: sigh --- .../config/compile-commands-picker.lua | 45 +++++++------------ 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/lua/plugins/config/compile-commands-picker.lua b/lua/plugins/config/compile-commands-picker.lua index 2df60fac7e0..ecd095d3b89 100644 --- a/lua/plugins/config/compile-commands-picker.lua +++ b/lua/plugins/config/compile-commands-picker.lua @@ -39,48 +39,35 @@ function M.pick_compile_commands() return end - -- Multiple files found, show picker - local pickers = require('telescope.pickers') - local finders = require('telescope.finders') - local conf = require('telescope.config').values + -- Use Telescope's built-in find_files with custom settings + local builtin = require('telescope.builtin') local actions = require('telescope.actions') local action_state = require('telescope.actions.state') - -- Create a simple path array for the finder - local paths = {} - local path_to_info = {} - for _, file in ipairs(files) do - table.insert(paths, file.path) - path_to_info[file.path] = file - end - - pickers.new({}, { + builtin.find_files({ prompt_title = 'Select compile_commands.json', - finder = finders.new_table { - results = paths, -- Pass simple path strings - entry_maker = function(path) - local info = path_to_info[path] - return { - value = info, - display = info.display, - ordinal = info.display, - path = path, -- This is what the previewer needs - } - end, - }, - sorter = conf.generic_sorter{}, - previewer = conf.file_previewer{}, + cwd = vim.fn.getcwd(), + find_command = { 'find', '.', '-name', 'compile_commands.json', '-type', 'f' }, attach_mappings = function(prompt_bufnr, map) actions.select_default:replace(function() actions.close(prompt_bufnr) local selection = action_state.get_selected_entry() if selection then - M.set_compile_commands(selection.value) + -- Convert the selection to our file_info format + local path = selection[1] + local relative = path:gsub('^%./', '') + local file_info = { + path = vim.fn.getcwd() .. '/' .. relative, + display = relative, + dir = vim.fn.fnamemodify(path, ':h'), + relative_dir = vim.fn.fnamemodify(relative, ':h'), + } + M.set_compile_commands(file_info) end end) return true end, - }):find() + }) end function M.set_compile_commands(file_info) From d8b586a55ae80c3562eb19ca1ed42afed50dcc04 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 3 Sep 2025 09:38:32 +1200 Subject: [PATCH 467/480] =?UTF-8?q?fix:=20$400/mth=20for=20this=20trash=3F?= =?UTF-8?q?=20=F0=9F=A4=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/config/compile-commands-picker.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/plugins/config/compile-commands-picker.lua b/lua/plugins/config/compile-commands-picker.lua index ecd095d3b89..527c436e7cc 100644 --- a/lua/plugins/config/compile-commands-picker.lua +++ b/lua/plugins/config/compile-commands-picker.lua @@ -48,6 +48,7 @@ function M.pick_compile_commands() prompt_title = 'Select compile_commands.json', cwd = vim.fn.getcwd(), find_command = { 'find', '.', '-name', 'compile_commands.json', '-type', 'f' }, + previewer = require('telescope.config').values.file_previewer, attach_mappings = function(prompt_bufnr, map) actions.select_default:replace(function() actions.close(prompt_bufnr) From 85ee398810cb06e033724a3ee2ad75966882ae71 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 3 Sep 2025 09:56:24 +1200 Subject: [PATCH 468/480] =?UTF-8?q?fix:=20last=20fix=20=F0=9F=A4=B7?= =?UTF-8?q?=F0=9F=8F=BE=E2=80=8D=E2=99=82=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/compile-commands-picker.lua | 1 - lua/plugins/config/lsp/servers.lua | 22 +------------------ 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/lua/plugins/config/compile-commands-picker.lua b/lua/plugins/config/compile-commands-picker.lua index 527c436e7cc..ecd095d3b89 100644 --- a/lua/plugins/config/compile-commands-picker.lua +++ b/lua/plugins/config/compile-commands-picker.lua @@ -48,7 +48,6 @@ function M.pick_compile_commands() prompt_title = 'Select compile_commands.json', cwd = vim.fn.getcwd(), find_command = { 'find', '.', '-name', 'compile_commands.json', '-type', 'f' }, - previewer = require('telescope.config').values.file_previewer, attach_mappings = function(prompt_bufnr, map) actions.select_default:replace(function() actions.close(prompt_bufnr) diff --git a/lua/plugins/config/lsp/servers.lua b/lua/plugins/config/lsp/servers.lua index f416dc02bd7..4d8fb69cc27 100644 --- a/lua/plugins/config/lsp/servers.lua +++ b/lua/plugins/config/lsp/servers.lua @@ -3,35 +3,15 @@ local M = {} local util = require 'lspconfig.util' --- Query driver for clangd to find compilers in various locations -local function get_clangd_query_driver() - return table.concat({ - '/nix/store/*/bin/clang*', - '/opt/homebrew/opt/llvm/bin/clang*', - '/usr/bin/clang*', - }, ':') -end - --- Get clang resource directory -local function get_clang_resource_dir() - local ok, result = pcall(vim.fn.systemlist, { 'clang++', '--print-resource-dir' }) - if ok and result and result[1] then - return result[1] - else - return '/usr/lib/clang/19/include' -- fallback - end -end - function M.get_servers() return { -- C/C++ Language Server + -- The clangd from dev-shells is already wrapped with --query-driver and --enable-config clangd = { cmd = { 'clangd', - '--query-driver=' .. get_clangd_query_driver(), '--background-index', '--clang-tidy', - '--enable-config', '--fallback-style=llvm', '--function-arg-placeholders', '--header-insertion-decorators', From 2f5b161f71100d2f89282951ab60ecb064a759ee Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 3 Sep 2025 10:58:59 +1200 Subject: [PATCH 469/480] fix: maybe? who knows --- lua/plugins/config/lsp/servers.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/plugins/config/lsp/servers.lua b/lua/plugins/config/lsp/servers.lua index 4d8fb69cc27..a38951e5c92 100644 --- a/lua/plugins/config/lsp/servers.lua +++ b/lua/plugins/config/lsp/servers.lua @@ -6,12 +6,13 @@ local util = require 'lspconfig.util' function M.get_servers() return { -- C/C++ Language Server - -- The clangd from dev-shells is already wrapped with --query-driver and --enable-config clangd = { cmd = { 'clangd', + '--query-driver=/nix/store/*/bin/clang*', '--background-index', '--clang-tidy', + '--enable-config', '--fallback-style=llvm', '--function-arg-placeholders', '--header-insertion-decorators', From 9e6b01e176f3b8b50de157a66ffe3e1690b0f6e1 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 3 Sep 2025 11:16:05 +1200 Subject: [PATCH 470/480] =?UTF-8?q?fix:=20=F0=9F=A5=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/config/lsp/servers.lua | 45 ++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/lua/plugins/config/lsp/servers.lua b/lua/plugins/config/lsp/servers.lua index a38951e5c92..66158188f97 100644 --- a/lua/plugins/config/lsp/servers.lua +++ b/lua/plugins/config/lsp/servers.lua @@ -3,21 +3,44 @@ local M = {} local util = require 'lspconfig.util' +-- Get clang-wrapper resource-root for Nix environments +local function get_clang_resource_dir() + -- Try to find clang-wrapper's resource-root + local handle = io.popen('ls -d /nix/store/*clang-wrapper*/resource-root 2>/dev/null | head -1') + if handle then + local resource_root = handle:read('*l') + handle:close() + if resource_root and resource_root ~= '' then + return resource_root + end + end + return nil -- Let clangd use its default +end + function M.get_servers() + -- Build clangd command + local clangd_cmd = { + 'clangd', + '--query-driver=/nix/store/*/bin/clang*', + '--background-index', + '--clang-tidy', + '--enable-config', + '--fallback-style=llvm', + '--function-arg-placeholders', + '--header-insertion-decorators', + '--header-insertion=iwyu', + } + + -- Add resource-dir if in Nix environment + local resource_dir = get_clang_resource_dir() + if resource_dir then + table.insert(clangd_cmd, '--resource-dir=' .. resource_dir) + end + return { -- C/C++ Language Server clangd = { - cmd = { - 'clangd', - '--query-driver=/nix/store/*/bin/clang*', - '--background-index', - '--clang-tidy', - '--enable-config', - '--fallback-style=llvm', - '--function-arg-placeholders', - '--header-insertion-decorators', - '--header-insertion=iwyu', - }, + cmd = clangd_cmd, filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, -- Look for project markers - clangd will find compile_commands.json itself root_dir = util.root_pattern( From 161310a072c872ad65a7cf83b0956f7234630c2e Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 5 Sep 2025 18:18:51 +1200 Subject: [PATCH 471/480] feat: add Harpoon and Training mode plugins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add Harpoon for quick file navigation - Add Training mode for learning vim motions without crutches - Configure keymaps for both plugins - Add Nix integration for training mode toggle 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- lua/core/keymaps.lua | 30 ++++ lua/core/options.lua | 3 + lua/plugins/config/harpoon.lua | 106 ++++++++++++ lua/plugins/config/training.lua | 278 ++++++++++++++++++++++++++++++++ lua/plugins/spec/harpoon.lua | 10 ++ lua/plugins/spec/training.lua | 19 +++ 6 files changed, 446 insertions(+) create mode 100644 lua/plugins/config/harpoon.lua create mode 100644 lua/plugins/config/training.lua create mode 100644 lua/plugins/spec/harpoon.lua create mode 100644 lua/plugins/spec/training.lua diff --git a/lua/core/keymaps.lua b/lua/core/keymaps.lua index 495d79f0898..a77f4763bba 100644 --- a/lua/core/keymaps.lua +++ b/lua/core/keymaps.lua @@ -34,5 +34,35 @@ end -- Reload LSP keybind vim.keymap.set('n', 'lr', reload_lsp, { desc = '[L]SP [R]eload all servers' }) +-- Buffer management keymaps +vim.keymap.set('n', 'bb', 'Telescope buffers', { desc = '[B]rowse [B]uffers' }) +vim.keymap.set('n', '[b', 'bprevious', { desc = 'Previous buffer' }) +vim.keymap.set('n', ']b', 'bnext', { desc = 'Next buffer' }) +vim.keymap.set('n', 'bd', 'bdelete', { desc = '[B]uffer [D]elete' }) +vim.keymap.set('n', 'ba', '%bd|e#', { desc = '[B]uffers close [A]ll but current' }) +vim.keymap.set('n', 'bn', 'enew', { desc = '[B]uffer [N]ew' }) + +-- Quick buffer switching with numbers +for i = 1, 9 do + vim.keymap.set('n', '' .. i, 'buffer ' .. i .. '', { desc = 'Switch to buffer ' .. i }) +end + +-- Alternate file (toggle between two most recent files) +vim.keymap.set('n', '', '', { desc = 'Toggle alternate file' }) + +-- Window management keymaps +vim.keymap.set('n', 'ws', 'split', { desc = '[W]indow [S]plit horizontal' }) +vim.keymap.set('n', 'wv', 'vsplit', { desc = '[W]indow [V]ertical split' }) +vim.keymap.set('n', 'wc', 'close', { desc = '[W]indow [C]lose' }) +vim.keymap.set('n', 'wo', 'only', { desc = '[W]indow [O]nly (close others)' }) +vim.keymap.set('n', 'ww', 'w', { desc = '[W]indow cycle' }) +vim.keymap.set('n', 'w=', '=', { desc = '[W]indow balance sizes' }) + +-- Window resizing with arrow keys +vim.keymap.set('n', '', 'resize +2', { desc = 'Increase window height' }) +vim.keymap.set('n', '', 'resize -2', { desc = 'Decrease window height' }) +vim.keymap.set('n', '', 'vertical resize -2', { desc = 'Decrease window width' }) +vim.keymap.set('n', '', 'vertical resize +2', { desc = 'Increase window width' }) + -- Standard practice for Lua modules that don't need to return complex data return {} diff --git a/lua/core/options.lua b/lua/core/options.lua index 169b8309c32..8325e768203 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -4,6 +4,9 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' +-- Load Nix-controlled settings if available +pcall(require, 'nix-settings') + -- Place custom vim options here -- Set based on your font installation diff --git a/lua/plugins/config/harpoon.lua b/lua/plugins/config/harpoon.lua new file mode 100644 index 00000000000..1a7efb631df --- /dev/null +++ b/lua/plugins/config/harpoon.lua @@ -0,0 +1,106 @@ +local M = {} + +function M.setup() + local harpoon = require 'harpoon' + harpoon:setup { + settings = { + save_on_toggle = false, + sync_on_ui_close = false, + key = function() + return vim.loop.cwd() + end, + }, + } + + -- Add current file to list + vim.keymap.set('n', 'ma', function() + harpoon:list():add() + vim.notify('Added to Harpoon', vim.log.levels.INFO) + end, { desc = '[M]ark [A]dd file (Harpoon)' }) + + -- Toggle quick menu + vim.keymap.set('n', '', function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, { desc = 'Toggle Harpoon menu' }) + + -- Quick navigation to files 1-4 using leader+m prefix + vim.keymap.set('n', 'm1', function() + harpoon:list():select(1) + end, { desc = 'Jump to mark 1' }) + + vim.keymap.set('n', 'm2', function() + harpoon:list():select(2) + end, { desc = 'Jump to mark 2' }) + + vim.keymap.set('n', 'm3', function() + harpoon:list():select(3) + end, { desc = 'Jump to mark 3' }) + + vim.keymap.set('n', 'm4', function() + harpoon:list():select(4) + end, { desc = 'Jump to mark 4' }) + + -- Alternative quick access with Alt/Option key (doesn't conflict) + vim.keymap.set('n', '', function() + harpoon:list():select(1) + end, { desc = 'Harpoon file 1' }) + + vim.keymap.set('n', '', function() + harpoon:list():select(2) + end, { desc = 'Harpoon file 2' }) + + vim.keymap.set('n', '', function() + harpoon:list():select(3) + end, { desc = 'Harpoon file 3' }) + + vim.keymap.set('n', '', function() + harpoon:list():select(4) + end, { desc = 'Harpoon file 4' }) + + -- Navigate between harpoon files + vim.keymap.set('n', '[m', function() + harpoon:list():prev() + end, { desc = 'Previous marked file' }) + + vim.keymap.set('n', ']m', function() + harpoon:list():next() + end, { desc = 'Next marked file' }) + + -- Show harpoon files in Telescope + local conf = require('telescope.config').values + local function toggle_telescope(harpoon_files) + local file_paths = {} + for _, item in ipairs(harpoon_files.items) do + table.insert(file_paths, item.value) + end + + require('telescope.pickers') + .new({}, { + prompt_title = 'Harpoon', + finder = require('telescope.finders').new_table { + results = file_paths, + }, + previewer = conf.file_previewer {}, + sorter = conf.generic_sorter {}, + }) + :find() + end + + vim.keymap.set('n', 'mm', function() + toggle_telescope(harpoon:list()) + end, { desc = '[M]arked files in Telescope' }) + + -- Clear all marks + vim.keymap.set('n', 'mc', function() + harpoon:list():clear() + vim.notify('Cleared all Harpoon marks', vim.log.levels.INFO) + end, { desc = '[M]arks [C]lear all' }) + + -- Remove current file from harpoon + vim.keymap.set('n', 'mr', function() + harpoon:list():remove() + vim.notify('Removed from Harpoon', vim.log.levels.INFO) + end, { desc = '[M]ark [R]emove current file' }) +end + +return M \ No newline at end of file diff --git a/lua/plugins/config/training.lua b/lua/plugins/config/training.lua new file mode 100644 index 00000000000..598e61becb1 --- /dev/null +++ b/lua/plugins/config/training.lua @@ -0,0 +1,278 @@ +local M = {} + +-- Statistics tracking +local stats = { + inefficient_moves = 0, + efficient_moves = 0, + start_time = os.time(), +} + +-- Training mode state +local training_enabled = false + +-- Movement key counters for spam detection +local key_counts = { h = 0, j = 0, k = 0, l = 0 } + +-- Hard mode: Disable inefficient keys +local function setup_hard_mode() + -- Disable arrow keys completely + vim.keymap.set({ 'n', 'v', 'i' }, '', '', { desc = 'Use k instead!' }) + vim.keymap.set({ 'n', 'v', 'i' }, '', '', { desc = 'Use j instead!' }) + vim.keymap.set({ 'n', 'v', 'i' }, '', '', { desc = 'Use h instead!' }) + vim.keymap.set({ 'n', 'v', 'i' }, '', '', { desc = 'Use l instead!' }) + + -- Make holding j/k/h/l painful (warns after 5 repeats) + for _, key in ipairs { 'h', 'j', 'k', 'l' } do + vim.keymap.set('n', key, function() + key_counts[key] = key_counts[key] + 1 + if key_counts[key] > 5 then + vim.notify(string.format('Stop spamming %s! Use counts (5%s) or better navigation!', key, key), vim.log.levels.WARN) + key_counts[key] = 0 + end + return key + end, { expr = true }) + end + + -- Reset counter when using other movements + for _, good_move in ipairs { '', '', '}', '{', 'gg', 'G' } do + vim.keymap.set('n', good_move, function() + key_counts = { h = 0, j = 0, k = 0, l = 0 } + stats.efficient_moves = stats.efficient_moves + 1 + return good_move + end, { expr = true }) + end +end + +-- Smart search helpers +local function setup_smart_search() + -- Search word under cursor + vim.keymap.set('n', '*', '*N', { desc = 'Search word under cursor' }) + + -- Search selected text + vim.keymap.set('v', '//', [[y/\V=escape(@",'/\')]], { desc = 'Search selection' }) + + -- Replace word under cursor (the smart way) + vim.keymap.set('n', 'R', function() + local word = vim.fn.expand '' + vim.ui.input({ prompt = 'Replace "' .. word .. '" with: ' }, function(replacement) + if replacement then + vim.cmd(':%s/\\<' .. word .. '\\>/' .. replacement .. '/g') + vim.notify(string.format('Replaced all instances of "%s" with "%s"', word, replacement)) + end + end) + end, { desc = 'Replace word under cursor globally' }) + + -- cgn workflow helper + vim.keymap.set('n', 'C', '*Ncgn', { desc = 'Change word under cursor (cgn workflow)' }) +end + +-- Efficiency helpers +local function setup_efficiency_helpers() + -- Movement reminder + vim.keymap.set('n', 'tm', function() + local hints = { + '=== VERTICAL MOVEMENT ===', + 'gg/G - Top/bottom of file', + '50G or 50% - Go to line 50', + '{ } - Paragraph jumps', + '[[ ]] - Function/section jumps', + 'H M L - High/Middle/Low of screen', + '', + '=== HORIZONTAL MOVEMENT ===', + 'f / F - Find forward/backward', + 't / T - Till forward/backward', + '; , - Repeat f/t forward/backward', + '0 $ - Start/end of line', + '^ g_ - First/last non-blank', + '', + '=== WORD MOVEMENT ===', + 'w/W - Next word/WORD', + 'b/B - Back word/WORD', + 'e/E - End of word/WORD', + 'ge/gE - End of previous word/WORD', + '', + '=== SEARCH MOVEMENT ===', + '* # - Search word forward/backward', + 'g* g# - Search partial word', + 'n N - Next/previous match', + } + vim.notify(table.concat(hints, '\n'), vim.log.levels.INFO) + end, { desc = '[T]raining [M]ovement hints' }) + + -- Text object practice + vim.keymap.set('n', 'ti', function() + local hints = { + '=== TEXT OBJECTS ===', + 'ciw - Change inside word', + 'ci" - Change inside quotes', + 'ci( or cib - Change inside parentheses', + 'ci{ or ciB - Change inside braces', + 'cit - Change inside tags', + 'cip - Change inside paragraph', + '', + '=== VARIATIONS ===', + 'c - Change', + 'd - Delete', + 'y - Yank', + 'v - Visual select', + '', + 'i - Inside (excludes delimiters)', + 'a - Around (includes delimiters)', + } + vim.notify(table.concat(hints, '\n'), vim.log.levels.INFO) + end, { desc = '[T]ext object [I]nfo' }) +end + +-- Track statistics +local function setup_statistics() + -- Track efficient movements + local efficient_patterns = { '*', '#', 'cgn', 'ciw', 'ci"', "ci'", 'cib', 'ciB', 'f', 'F', 't', 'T', '}', '{', ']]', '[[' } + + for _, pattern in ipairs(efficient_patterns) do + vim.keymap.set('n', pattern, function() + stats.efficient_moves = stats.efficient_moves + 1 + return pattern + end, { expr = true, silent = true }) + end +end + +-- Visual feedback for good movements +local function setup_visual_feedback() + vim.api.nvim_create_autocmd('CursorMoved', { + group = vim.api.nvim_create_augroup('TrainingMode', { clear = true }), + callback = function() + if not training_enabled then + return + end + + local col = vim.fn.col '.' + local line = vim.fn.line '.' + + -- Check if cursor moved significantly (likely used good navigation) + if math.abs(line - (vim.b.last_line or line)) > 5 then + -- Don't notify, just track it + stats.efficient_moves = stats.efficient_moves + 1 + end + + vim.b.last_line = line + end, + }) +end + +-- Disable hard mode +local function disable_hard_mode() + -- Remove hard mode restrictions + pcall(vim.keymap.del, { 'n', 'v', 'i' }, '') + pcall(vim.keymap.del, { 'n', 'v', 'i' }, '') + pcall(vim.keymap.del, { 'n', 'v', 'i' }, '') + pcall(vim.keymap.del, { 'n', 'v', 'i' }, '') + + -- Remove hjkl spam detection + for _, key in ipairs { 'h', 'j', 'k', 'l' } do + pcall(vim.keymap.del, 'n', key) + end +end + +-- Main setup function +function M.setup() + -- Always setup smart search helpers (they're just helpful) + setup_smart_search() + setup_efficiency_helpers() + setup_visual_feedback() + + vim.notify('Training mode available! Press tt to toggle', vim.log.levels.INFO) +end + +-- Toggle training mode +function M.toggle() + training_enabled = not training_enabled + + if training_enabled then + setup_hard_mode() + setup_statistics() + stats.start_time = os.time() -- Reset timer + vim.notify('Training mode ENABLED! 💪\nArrows disabled, hjkl spam detection on!', vim.log.levels.INFO) + else + disable_hard_mode() + vim.notify('Training mode DISABLED. Keep practicing those efficient movements!', vim.log.levels.INFO) + end +end + +-- Show statistics +function M.show_stats() + local time_elapsed = os.time() - stats.start_time + local total_moves = stats.efficient_moves + stats.inefficient_moves + local efficiency = total_moves > 0 and (stats.efficient_moves / total_moves * 100) or 0 + + vim.notify( + string.format( + '📊 Session Statistics:\n' .. + 'Time: %d min\n' .. + 'Efficient moves: %d\n' .. + 'Inefficient moves: %d\n' .. + 'Efficiency: %.1f%%\n\n' .. + 'Keep practicing! 🎯', + time_elapsed / 60, + stats.efficient_moves, + stats.inefficient_moves, + efficiency + ), + vim.log.levels.INFO + ) +end + +-- Random challenge +function M.challenge() + local challenges = { + 'Jump to line 50 without counting lines (use 50G)', + 'Find the next "function" (use /function)', + 'Change the word in quotes (use ci")', + 'Delete until the next comma (use dt,)', + 'Jump to matching bracket (use %)', + 'Select entire paragraph (use vap)', + 'Change word and repeat with . (use *cgn)', + 'Jump to next blank line (use })', + 'Delete entire function (use dap or di{)', + 'Find and change next "TODO" (use /TODOcgn)', + } + + local challenge = challenges[math.random(#challenges)] + vim.notify('🎮 Challenge: ' .. challenge, vim.log.levels.INFO) +end + +-- Show cheatsheet +function M.cheatsheet() + local cheatsheet = [[ +=== STOP DOING === | === START DOING === +jjjjjjjj | 10j, }, +wwwww | 3w, f +manually typing search | *, viw/, sg +:%s/old/new/g | *cgn then . +:q then git | :Git (Fugitive) +arrow keys | hjkl with counts + +=== POWER MOVES === +cgn - Change next occurrence (use with *) +. - Repeat last change +* - Search word under cursor +ciw - Change inside word +f/t - Find/till character +% - Jump to matching bracket + - Half page down + - Half page up + +=== TRAINING COMMANDS === +tt - Toggle training mode +ts - Show statistics +tg - Get random challenge +tm - Movement hints +ti - Text object info +* - Search word under cursor +R - Replace word globally +C - Start cgn workflow +]] + + vim.notify(cheatsheet, vim.log.levels.INFO) +end + +return M \ No newline at end of file diff --git a/lua/plugins/spec/harpoon.lua b/lua/plugins/spec/harpoon.lua new file mode 100644 index 00000000000..0e0871be911 --- /dev/null +++ b/lua/plugins/spec/harpoon.lua @@ -0,0 +1,10 @@ +-- Harpoon - Quick file navigation +return { + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + dependencies = { 'nvim-lua/plenary.nvim' }, + event = 'VeryLazy', + config = function() + require('plugins.config.harpoon').setup() + end, +} \ No newline at end of file diff --git a/lua/plugins/spec/training.lua b/lua/plugins/spec/training.lua new file mode 100644 index 00000000000..13e4767facc --- /dev/null +++ b/lua/plugins/spec/training.lua @@ -0,0 +1,19 @@ +-- Neovim Training Wheels - Build better vim habits +-- Load nix settings if available +pcall(require, 'nix-settings') + +return { + 'dlond/training.nvim', + enabled = vim.g.training_mode_enabled or false, -- Controlled by Nix + lazy = false, + dir = vim.fn.stdpath('config') .. '/lua/plugins/training', -- Local "plugin" + config = function() + require('plugins.config.training').setup() + end, + keys = { + { 'tt', function() require('plugins.config.training').toggle() end, desc = '[T]raining [T]oggle' }, + { 'ts', function() require('plugins.config.training').show_stats() end, desc = '[T]raining [S]tats' }, + { 'tg', function() require('plugins.config.training').challenge() end, desc = '[T]raining [G]ame' }, + { '?', function() require('plugins.config.training').cheatsheet() end, desc = 'Show efficiency cheatsheet' }, + }, +} \ No newline at end of file From 49581942c7bdb42cf8a5603270ed9b6461a8b6d2 Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 6 Sep 2025 12:55:48 +1200 Subject: [PATCH 472/480] fix: added global position encoding --- lua/plugins/config/lsp/init.lua | 14 +++++++++----- lua/plugins/config/lsp/servers.lua | 10 ++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lua/plugins/config/lsp/init.lua b/lua/plugins/config/lsp/init.lua index 930dd4a45ad..912cbbcb1f0 100644 --- a/lua/plugins/config/lsp/init.lua +++ b/lua/plugins/config/lsp/init.lua @@ -3,24 +3,28 @@ local M = {} function M.setup() local lspconfig = require 'lspconfig' - + -- Get capabilities from blink.cmp if available local capabilities = {} pcall(function() capabilities = require('blink.cmp').get_lsp_capabilities() end) - + -- + -- Set global position encoding preference + capabilities.offsetEncoding = { 'utf-8', 'utf-16' } + -- Load server configurations local servers = require('plugins.config.lsp.servers').get_servers() - + -- Setup each server with capabilities for name, config in pairs(servers) do config.capabilities = vim.tbl_deep_extend('force', {}, capabilities, config.capabilities or {}) lspconfig[name].setup(config) end - + -- Setup LSP keymaps require('plugins.config.lsp.keymaps').setup() end -return M \ No newline at end of file +return M + diff --git a/lua/plugins/config/lsp/servers.lua b/lua/plugins/config/lsp/servers.lua index 66158188f97..94126d2c722 100644 --- a/lua/plugins/config/lsp/servers.lua +++ b/lua/plugins/config/lsp/servers.lua @@ -6,15 +6,15 @@ local util = require 'lspconfig.util' -- Get clang-wrapper resource-root for Nix environments local function get_clang_resource_dir() -- Try to find clang-wrapper's resource-root - local handle = io.popen('ls -d /nix/store/*clang-wrapper*/resource-root 2>/dev/null | head -1') + local handle = io.popen 'ls -d /nix/store/*clang-wrapper*/resource-root 2>/dev/null | head -1' if handle then - local resource_root = handle:read('*l') + local resource_root = handle:read '*l' handle:close() if resource_root and resource_root ~= '' then return resource_root end end - return nil -- Let clangd use its default + return nil -- Let clangd use its default end function M.get_servers() @@ -30,7 +30,7 @@ function M.get_servers() '--header-insertion-decorators', '--header-insertion=iwyu', } - + -- Add resource-dir if in Nix environment local resource_dir = get_clang_resource_dir() if resource_dir then @@ -72,7 +72,6 @@ function M.get_servers() }, }, }, - positionEncoding = 'utf-8', }, -- Python Linter/Formatter @@ -106,4 +105,3 @@ function M.get_servers() end return M - From 425be18a9461d6291da11c715be064ceab9cb144 Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 6 Sep 2025 13:10:01 +1200 Subject: [PATCH 473/480] fix: wrong parameter --- lua/plugins/config/lsp/init.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/plugins/config/lsp/init.lua b/lua/plugins/config/lsp/init.lua index 912cbbcb1f0..d8210a0db9c 100644 --- a/lua/plugins/config/lsp/init.lua +++ b/lua/plugins/config/lsp/init.lua @@ -11,7 +11,7 @@ function M.setup() end) -- -- Set global position encoding preference - capabilities.offsetEncoding = { 'utf-8', 'utf-16' } + capabilities.positionEncoding = { 'utf-8', 'utf-16' } -- Load server configurations local servers = require('plugins.config.lsp.servers').get_servers() @@ -27,4 +27,3 @@ function M.setup() end return M - From 2162ffa87ae234d2b5ec2a4b4d16b99977e18543 Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 6 Sep 2025 13:22:45 +1200 Subject: [PATCH 474/480] =?UTF-8?q?fix:=20give=20me=20compile=20errors=20a?= =?UTF-8?q?ny=20day=20=F0=9F=A4=A6=F0=9F=8F=BE=E2=80=8D=E2=99=82=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/config/lsp/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/config/lsp/init.lua b/lua/plugins/config/lsp/init.lua index d8210a0db9c..60766fc3e39 100644 --- a/lua/plugins/config/lsp/init.lua +++ b/lua/plugins/config/lsp/init.lua @@ -11,7 +11,7 @@ function M.setup() end) -- -- Set global position encoding preference - capabilities.positionEncoding = { 'utf-8', 'utf-16' } + capabilities.positionEncodings = { 'utf-8', 'utf-16' } -- Load server configurations local servers = require('plugins.config.lsp.servers').get_servers() From 08b39f61140ad985a8ed3218ae1c6ef7be683044 Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 6 Sep 2025 13:43:05 +1200 Subject: [PATCH 475/480] fix: one more time --- lua/plugins/config/lsp/init.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lua/plugins/config/lsp/init.lua b/lua/plugins/config/lsp/init.lua index 60766fc3e39..5a723471d53 100644 --- a/lua/plugins/config/lsp/init.lua +++ b/lua/plugins/config/lsp/init.lua @@ -5,13 +5,15 @@ function M.setup() local lspconfig = require 'lspconfig' -- Get capabilities from blink.cmp if available - local capabilities = {} - pcall(function() - capabilities = require('blink.cmp').get_lsp_capabilities() - end) + local capabilities = vim.lsp.protocol.make_client_capabilities() + + local ok, blink_cmp = pcall(require, 'blink.cmp') + if ok then + capabilities = blink_cmp.get_lsp_capabilities(capabilities) + end -- -- Set global position encoding preference - capabilities.positionEncodings = { 'utf-8', 'utf-16' } + capabilities.general.positionEncodings = { 'utf-16' } -- Load server configurations local servers = require('plugins.config.lsp.servers').get_servers() From b39a9a1b72ff76581abeb22f11e85df076358abf Mon Sep 17 00:00:00 2001 From: dlond Date: Sat, 6 Sep 2025 20:19:30 +1200 Subject: [PATCH 476/480] trying basedpyright --- lua/plugins/config/lsp/servers.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lua/plugins/config/lsp/servers.lua b/lua/plugins/config/lsp/servers.lua index 94126d2c722..3502e0bc3c9 100644 --- a/lua/plugins/config/lsp/servers.lua +++ b/lua/plugins/config/lsp/servers.lua @@ -61,14 +61,23 @@ function M.get_servers() }, -- Python Language Server - pyright = { + basedpyright = { settings = { - python = { + basedpyright = { analysis = { autoSearchPaths = true, diagnosticMode = 'openFilesOnly', + typeCheckingMode = 'standard', useLibraryCodeForTypes = true, - typeCheckingMode = 'basic', + + diagnosticSeverityOverrides = { + reportOptionalCall = 'none', + reportOptionalSubscript = 'none', + reportAttributeAccessIssue = 'none', + reportUnknownMemberType = 'warning', + reportUnknownVariableType = 'warning', + reportUnknownAssignmentType = 'warning', + }, }, }, }, From f07d0fe5b6aae63e82958a26636ed047cf1f62da Mon Sep 17 00:00:00 2001 From: dlond Date: Mon, 8 Sep 2025 13:08:39 +1200 Subject: [PATCH 477/480] fix: moved to lldb --- lua/plugins/config/debug/adapters.lua | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/lua/plugins/config/debug/adapters.lua b/lua/plugins/config/debug/adapters.lua index 1d83b55b252..93629e5d113 100644 --- a/lua/plugins/config/debug/adapters.lua +++ b/lua/plugins/config/debug/adapters.lua @@ -65,22 +65,12 @@ function M.setup_python(dap) } end --- C/C++/Rust debugger configuration (using codelldb) +-- C/C++/Rust debugger configuration (using lldb-dap) function M.setup_cpp(dap) - -- CodeLLDB adapter - dap.adapters.codelldb = { - type = 'server', - port = '${port}', - executable = { - command = 'codelldb', - args = { '--port', '${port}' }, - }, - } - - -- Alternative: Use lldb-vscode if codelldb is not available + -- LLDB-DAP adapter (modern LLDB with DAP support) dap.adapters.lldb = { type = 'executable', - command = '/usr/bin/lldb-vscode', -- Adjust path as needed + command = 'lldb-dap', -- Will use lldb-dap from PATH (Nix environment) name = 'lldb', } @@ -88,7 +78,7 @@ function M.setup_cpp(dap) dap.configurations.cpp = { { name = 'Launch', - type = 'codelldb', + type = 'lldb', request = 'launch', program = function() return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') @@ -100,7 +90,7 @@ function M.setup_cpp(dap) }, { name = 'Launch with arguments', - type = 'codelldb', + type = 'lldb', request = 'launch', program = function() return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') @@ -115,7 +105,7 @@ function M.setup_cpp(dap) }, { name = 'Attach to process', - type = 'codelldb', + type = 'lldb', request = 'attach', pid = require('dap.utils').pick_process, args = {}, From 62a5fd5014fabfefbd176c9c042f498fa3aacac5 Mon Sep 17 00:00:00 2001 From: dlond Date: Thu, 11 Sep 2025 21:53:31 +1200 Subject: [PATCH 478/480] refactor: moved close shared warning to autocmds --- lua/core/autocmds.lua | 38 +++++++++++++++++++++++++++++++- lua/core/options.lua | 50 ------------------------------------------- 2 files changed, 37 insertions(+), 51 deletions(-) diff --git a/lua/core/autocmds.lua b/lua/core/autocmds.lua index ec36a675bb8..cbde0b66f66 100644 --- a/lua/core/autocmds.lua +++ b/lua/core/autocmds.lua @@ -10,4 +10,40 @@ vim.api.nvim_create_autocmd('TextYankPost', { callback = function() vim.hl.on_yank() end, -}) \ No newline at end of file +}) + +-- Warn when trying to quit a shared tmux session +local function is_shared_session() + local tmux = vim.env.TMUX + if not tmux or tmux == '' then + return false + end + + -- Check if session name contains "-nvim-shared" + local handle = io.popen "tmux display-message -p '#{session_name}' 2>/dev/null" + if handle then + local session_name = handle:read('*a'):gsub('\n', '') + handle:close() + return session_name:match '%-nvim%-shared$' ~= nil + end + return false +end + +-- Override quit commands for shared sessions +vim.api.nvim_create_autocmd('VimLeavePre', { + group = augroup 'shared_session_warning', + callback = function() + if is_shared_session() then + vim.ui.input({ + prompt = '⚠️ Are you sure you want to close a shared session? ', + }, function(input) + if not input or input:lower() ~= 'y' then + -- Cancel the quit + vim.fn.feedkeys(vim.api.nvim_replace_termcodes('', true, false, true), 'n', false) + error 'Quit cancelled' + end + end) + end + end, +}) + diff --git a/lua/core/options.lua b/lua/core/options.lua index 8325e768203..2047b71fd73 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -66,53 +66,3 @@ vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor vim.opt.scrolloff = 10 - --- Function to check if running in a shared tmux session -local function is_shared_tmux_session() - if not vim.env.TMUX then - return false - end - - local handle = io.popen('tmux list-sessions -F "#{session_name}:#{session_attached}" 2>/dev/null') - if not handle then - return false - end - - local current_session = vim.fn.system('tmux display-message -p "#S"'):gsub('\n', '') - local output = handle:read('*a') - handle:close() - - -- Check if session name contains "shared" (case insensitive) - if current_session:lower():find('shared') then - return true - end - - -- Also check if multiple users are attached - for line in output:gmatch('[^\r\n]+') do - local session_name, attached_count = line:match('([^:]+):(%d+)') - if session_name == current_session and tonumber(attached_count) > 1 then - return true - end - end - - return false -end - --- Warn before quitting if in a shared tmux session -vim.api.nvim_create_autocmd('VimLeavePre', { - callback = function() - if is_shared_tmux_session() then - local choice = vim.fn.confirm( - 'You are in a shared tmux session. Other users may be affected.\nDo you really want to quit?', - '&Yes\n&No', - 2 -- Default to No - ) - -- vim.fn.confirm returns 1 for Yes, 2 for No, 0 for Esc - -- The & makes Y/y and N/n work as shortcuts (case-insensitive) - if choice ~= 1 then - return -- Prevent quit unless explicitly choosing Yes - end - end - end, -}) - From 611ed89f33e301547c2420dfcbc04d77ecf90b0f Mon Sep 17 00:00:00 2001 From: dlond Date: Thu, 11 Sep 2025 22:12:48 +1200 Subject: [PATCH 479/480] fix --- lua/core/autocmds.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lua/core/autocmds.lua b/lua/core/autocmds.lua index cbde0b66f66..5a0f38c7ca0 100644 --- a/lua/core/autocmds.lua +++ b/lua/core/autocmds.lua @@ -29,20 +29,20 @@ local function is_shared_session() return false end +-- Create an autocommand group for shared session warning +local shared_session_group = vim.api.nvim_create_augroup("SharedSessionWarning", { clear = true }) + + -- Override quit commands for shared sessions vim.api.nvim_create_autocmd('VimLeavePre', { - group = augroup 'shared_session_warning', + group = shared_session_group, callback = function() if is_shared_session() then - vim.ui.input({ - prompt = '⚠️ Are you sure you want to close a shared session? ', - }, function(input) - if not input or input:lower() ~= 'y' then - -- Cancel the quit - vim.fn.feedkeys(vim.api.nvim_replace_termcodes('', true, false, true), 'n', false) - error 'Quit cancelled' - end - end) + local response = vim.fn.input("⚠️ Closing shared nvim session! Confirm with y/Y: ") + if response:lower() ~= "y" then + -- Cancel the quit by throwing an error + error("Quit cancelled") + end end end, }) From 647b352970c4b2935e3f643fbc89c3d0d8ed0f65 Mon Sep 17 00:00:00 2001 From: dlond Date: Wed, 8 Oct 2025 23:10:35 +1300 Subject: [PATCH 480/480] feat: complete LSP and formatter configuration - Add missing LSPs: lua_ls, bashls, yamlls, jsonls, marksman, taplo, sqls - Add missing formatters: prettier, shfmt, sqlfluff, cmake_format - Configure ruff with import organization and auto-fixes - Tune basedpyright to reduce diagnostic noise (basic mode) All LSPs verified attaching and formatters working correctly. --- .tmuxp.nvim.half.json | 14 ++++++ lua/plugins/config/lsp/servers.lua | 48 ++++++++++++++++++-- lua/plugins/spec/formatting.lua | 70 +++++++++++++++--------------- 3 files changed, 93 insertions(+), 39 deletions(-) create mode 100644 .tmuxp.nvim.half.json diff --git a/.tmuxp.nvim.half.json b/.tmuxp.nvim.half.json new file mode 100644 index 00000000000..bc7ab91f65b --- /dev/null +++ b/.tmuxp.nvim.half.json @@ -0,0 +1,14 @@ +{ + "session_name": "nvim", + "tmux_options": "-f /Users/dlond/.config/tmux/tmux.conf", + "windows": [ + { + "window_name": "editor", + "layout": "even-vertical", + "panes": [ + { "shell_command": ["nvim ."] }, + { "shell_command": [] } + ] + } + ] +} diff --git a/lua/plugins/config/lsp/servers.lua b/lua/plugins/config/lsp/servers.lua index 3502e0bc3c9..a64c21c139a 100644 --- a/lua/plugins/config/lsp/servers.lua +++ b/lua/plugins/config/lsp/servers.lua @@ -67,16 +67,21 @@ function M.get_servers() analysis = { autoSearchPaths = true, diagnosticMode = 'openFilesOnly', - typeCheckingMode = 'standard', + typeCheckingMode = 'basic', useLibraryCodeForTypes = true, diagnosticSeverityOverrides = { reportOptionalCall = 'none', reportOptionalSubscript = 'none', + reportOptionalMemberAccess = 'none', + reportOptionalIterable = 'none', reportAttributeAccessIssue = 'none', - reportUnknownMemberType = 'warning', - reportUnknownVariableType = 'warning', - reportUnknownAssignmentType = 'warning', + reportUnknownMemberType = 'none', + reportUnknownVariableType = 'none', + reportUnknownArgumentType = 'none', + reportUnknownParameterType = 'none', + reportUnknownAssignmentType = 'none', + reportMissingTypeStubs = 'none', }, }, }, @@ -99,6 +104,41 @@ function M.get_servers() root_dir = util.root_pattern('CMakeLists.txt', '.git'), }, + -- Lua Language Server + lua_ls = { + settings = { + Lua = { + runtime = { version = 'LuaJIT' }, + diagnostics = { + globals = { 'vim' }, + }, + workspace = { + library = vim.api.nvim_get_runtime_file('', true), + checkThirdParty = false, + }, + telemetry = { enable = false }, + }, + }, + }, + + -- Bash Language Server + bashls = {}, + + -- YAML Language Server + yamlls = {}, + + -- JSON Language Server + jsonls = {}, + + -- Markdown Language Server + marksman = {}, + + -- TOML Language Server + taplo = {}, + + -- SQL Language Server + sqls = {}, + -- Add more servers here as needed -- Example: -- rust_analyzer = { diff --git a/lua/plugins/spec/formatting.lua b/lua/plugins/spec/formatting.lua index 047980de013..3bbc7eacbc4 100644 --- a/lua/plugins/spec/formatting.lua +++ b/lua/plugins/spec/formatting.lua @@ -1,40 +1,40 @@ -- Formatter configuration return { - -- ======================================== - -- Formatter Configuration (conform.nvim) - -- ======================================== - { - 'stevearc/conform.nvim', - event = 'BufWritePre', -- Format on save - -- cmd = { 'ConformInfo' }, -- Optional: If you want the command available - -- keys = { ... } -- Optional: Define keys if needed - opts = { - formatters_by_ft = { - lua = { 'stylua' }, - c = { 'clang_format' }, - cpp = { 'clang_format' }, - -- Use ruff for Python formatting (includes isort and is faster than black - -- Ensure 'ruff' is installed via Home Manager (pkgs.ruff) - python = { 'ruff_format', 'ruff_fix' }, - -- python = { 'isort', 'black' }, - nix = { 'alejandra' }, -- Add nix formatter - -- Add other filetypes and formatters, e.g.: - -- javascript = { "prettier" }, - -- typescript = { "prettier" }, - -- css = { "prettier" }, - -- html = { "prettier" }, - -- json = { "prettier" }, - -- yaml = { "prettier" }, - -- markdown = { "prettier" }, - -- bash = { "shfmt" }, - }, - -- Configure format_on_save behavior - format_on_save = { - -- I recommend these options, but adjust to your liking - timeout_ms = 500, -- Stop formatting if it takes too long - lsp_fallback = true, -- Fallback to LSP formatting if conform fails - }, - }, + -- ======================================== + -- Formatter Configuration (conform.nvim) + -- ======================================== + { + 'stevearc/conform.nvim', + event = 'BufWritePre', -- Format on save + -- cmd = { 'ConformInfo' }, -- Optional: If you want the command available + -- keys = { ... } -- Optional: Define keys if needed + opts = { + formatters_by_ft = { + lua = { 'stylua' }, + c = { 'clang_format' }, + cpp = { 'clang_format' }, + python = { 'ruff_organize_imports', 'ruff_format', 'ruff_fix' }, + nix = { 'alejandra' }, -- Add nix formatter + -- Add other filetypes and formatters, e.g.: + javascript = { 'prettier' }, + typescript = { 'prettier' }, + css = { 'prettier' }, + html = { 'prettier' }, + json = { 'prettier' }, + yaml = { 'prettier' }, + markdown = { 'prettier' }, + bash = { 'shfmt' }, + sh = { 'shfmt' }, + cmake = { 'cmake_format' }, + sql = { 'sqlfluff' }, + }, + -- Configure format_on_save behavior + format_on_save = { + -- I recommend these options, but adjust to your liking + timeout_ms = 500, -- Stop formatting if it takes too long + lsp_fallback = true, -- Fallback to LSP formatting if conform fails + }, }, + }, }