From 0568118b618b3af8d352e1ded2a1ec3ef1ac8734 Mon Sep 17 00:00:00 2001 From: brian tan Date: Fri, 11 Apr 2025 23:43:51 -0400 Subject: [PATCH 01/16] feat(diagnostics): Add `virtual_lines` for discoverability --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 776c6873..f94f669f 100644 --- a/init.lua +++ b/init.lua @@ -645,6 +645,8 @@ require('lazy').setup({ return diagnostic_message[diagnostic.severity] end, }, + -- Display multiline diagnostics as virtual lines + -- virtual_lines = true, } -- LSP servers and clients are able to communicate to each other what features they support. From de21fefd4d169708c21e521c78247db8338ea546 Mon Sep 17 00:00:00 2001 From: Arvin Verain Date: Tue, 13 May 2025 00:03:53 +0800 Subject: [PATCH 02/16] fix: Load guess-indent.nvim --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index b98ffc61..979b5935 100644 --- a/init.lua +++ b/init.lua @@ -247,7 +247,7 @@ 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). - 'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically + { 'NMAC427/guess-indent.nvim', opts = {} }, -- 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 ad50cccc280c92fa2bbf72e293b190a3dbc1ea3e Mon Sep 17 00:00:00 2001 From: Arvin Verain Date: Mon, 2 Jun 2025 11:21:51 +0800 Subject: [PATCH 03/16] docs: Add documentation for lazy's `init` key Guide users towards lazy's `init` key for plugins written in VimScript. --- init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init.lua b/init.lua index b98ffc61..03eb54aa 100644 --- a/init.lua +++ b/init.lua @@ -267,6 +267,10 @@ require('lazy').setup({ -- end, -- } -- + -- For plugins written in VimScript, use `init = function() ... end` to set + -- configuration options, usually in the format `vim.g.*`. This can also + -- contain conditionals or any other setup logic you need for the plugin. + -- -- Here is a more advanced example where we pass configuration -- options to `gitsigns.nvim`. -- From 0028a33e0ade897d207b4d03ed079c31187c779f Mon Sep 17 00:00:00 2001 From: Kartik Vashistha Date: Sat, 7 Jun 2025 20:02:03 +0100 Subject: [PATCH 04/16] feat: improved lsp setup for nvim > 0.11 --- init.lua | 127 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 81 insertions(+), 46 deletions(-) diff --git a/init.lua b/init.lua index b98ffc61..1927768d 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,4 @@ --[[ - ===================================================================== ==================== READ THIS BEFORE CONTINUING ==================== ===================================================================== @@ -659,45 +658,59 @@ require('lazy').setup({ -- 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() + -- NOTE: The following line is now commented as blink.cmp extends capabilites by default from its internal code: + -- https://github.com/Saghen/blink.cmp/blob/102db2f5996a46818661845cf283484870b60450/plugin/blink-cmp.lua + -- It has been left here as a comment for educational purposes (as the predecessor completion plugin required this explicit step). + -- + -- 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. + -- Language servers can broadly be installed in the following ways: + -- 1) via the mason package manager; or + -- 2) via your system's package manager; or + -- 3) via a release binary from a language server's repo that's accessible somewhere on your system. -- - -- 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 + -- Add any additional override configuration in any of 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/ -- - -- But for many setups, the LSP (`ts_ls`) will work just fine - -- ts_ls = {}, - -- - - lua_ls = { - -- cmd = { ... }, - -- filetypes = { ... }, - -- capabilities = {}, - settings = { - Lua = { - completion = { - callSnippet = 'Replace', + -- Feel free to add/remove any LSPs here that you want to install via Mason. They will automatically be installed and setup. + mason = { + -- 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 = { ... }, + -- capabilities = {}, + settings = { + Lua = { + completion = { + callSnippet = 'Replace', + }, + -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings + -- diagnostics = { disable = { 'missing-fields' } }, }, - -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings - -- diagnostics = { disable = { 'missing-fields' } }, }, }, }, + -- This table contains config for all language servers that are *not* installed via Mason. + -- Structure is identical to the mason table from above. + others = { + -- dartls = {}, + }, } -- Ensure the servers and tools above are installed @@ -713,26 +726,31 @@ require('lazy').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 {}) + local ensure_installed = vim.tbl_keys(servers.mason or {}) vim.list_extend(ensure_installed, { 'stylua', -- Used to format Lua code }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } + -- Either merge all additional server configs from the `servers.mason` and `servers.others` tables + -- to the default language server configs as provided by nvim-lspconfig or + -- define a custom server config that's unavailable on nvim-lspconfig. + for server, config in pairs(vim.tbl_extend('keep', servers.mason, servers.others)) do + if vim.fn.empty(config) ~= 1 then + vim.lsp.config(server, config) + end + end + + -- After configuring our language servers, we now enable them 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, - }, + automatic_enable = true, -- automatically run vim.lsp.enable() for all servers that are installed via Mason } + + -- Manually run vim.lsp.enable for all language servers that are *not* installed via Mason + if vim.fn.empty(servers.others) ~= 1 then + vim.lsp.enable(vim.tbl_keys(servers.others)) + end end, }, @@ -899,7 +917,12 @@ require('lazy').setup({ }, -- Highlight todo, notes, etc in comments - { 'folke/todo-comments.nvim', event = 'VimEnter', 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', @@ -944,7 +967,19 @@ require('lazy').setup({ 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' }, + 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 9ff021faa4fad0cdaa674408e6c763c293cd6d81 Mon Sep 17 00:00:00 2001 From: Kartik Vashistha Date: Sun, 8 Jun 2025 01:33:25 +0100 Subject: [PATCH 05/16] refactor: based on pr comments Add lua_ls annotations for improved hover experience and replace vim.fn.empty() with vim.tbl_isempty() --- init.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 1927768d..a68a4b2d 100644 --- a/init.lua +++ b/init.lua @@ -668,7 +668,15 @@ require('lazy').setup({ -- 1) via the mason package manager; or -- 2) via your system's package manager; or -- 3) via a release binary from a language server's repo that's accessible somewhere on your system. - -- + + -- The servers table comprises of the following sub-tables: + -- 1. mason + -- 2. others + -- Both these tables have an identical structure of language server names as keys and + -- a table of language server configuration as values. + ---@class LspServersConfig + ---@field mason table + ---@field others table local servers = { -- Add any additional override configuration in any of the following tables. Available keys are: -- - cmd (table): Override the default command used to start the server @@ -736,7 +744,7 @@ require('lazy').setup({ -- to the default language server configs as provided by nvim-lspconfig or -- define a custom server config that's unavailable on nvim-lspconfig. for server, config in pairs(vim.tbl_extend('keep', servers.mason, servers.others)) do - if vim.fn.empty(config) ~= 1 then + if not vim.tbl_isempty(config) then vim.lsp.config(server, config) end end @@ -748,7 +756,7 @@ require('lazy').setup({ } -- Manually run vim.lsp.enable for all language servers that are *not* installed via Mason - if vim.fn.empty(servers.others) ~= 1 then + if not vim.tbl_isempty(servers.others) then vim.lsp.enable(vim.tbl_keys(servers.others)) end end, From b4c8a78d45a5b314de5dfc8ba9fb0c16af582abe Mon Sep 17 00:00:00 2001 From: Francesc Elies Date: Mon, 16 Jun 2025 23:45:57 +0200 Subject: [PATCH 06/16] feat(grep-string): works with visual selection too --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index b98ffc61..2057fe83 100644 --- a/init.lua +++ b/init.lua @@ -344,7 +344,7 @@ require('lazy').setup({ -- Document existing key chains spec = { - { 's', group = '[S]earch' }, + { 's', group = '[S]earch', mode = { 'n', 'v' } }, { 't', group = '[T]oggle' }, { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, }, @@ -430,7 +430,7 @@ require('lazy').setup({ 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', 'v' }, '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' }) From 7c31d2ccf8b35e2cb5a7a7c8ee29c39ec73747c5 Mon Sep 17 00:00:00 2001 From: Ronan Dalton <86718942+ronandalton@users.noreply.github.com> Date: Sun, 18 May 2025 13:20:27 +1200 Subject: [PATCH 07/16] fix(diagnostic): remove unnecessary config lines The following lines do nothing and can be removed: 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, The following line causes diagnostics which aren't of severity level error to not have the specific text area underlined. This is less useful than the default of showing underlines for all diagnostic levels, so remove this line as well: underline = { severity = vim.diagnostic.severity.ERROR }, --- init.lua | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/init.lua b/init.lua index b98ffc61..1de8e757 100644 --- a/init.lua +++ b/init.lua @@ -631,7 +631,6 @@ require('lazy').setup({ 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] = '󰅚 ', @@ -643,15 +642,6 @@ require('lazy').setup({ 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, }, } From 488feb585364c2639c251e4d20e1a36283cc0bac Mon Sep 17 00:00:00 2001 From: Sangho Lee Date: Tue, 24 Jun 2025 22:26:42 +0900 Subject: [PATCH 08/16] feat: add toggle to show/hide diagnostics --- init.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/init.lua b/init.lua index b98ffc61..da718424 100644 --- a/init.lua +++ b/init.lua @@ -572,6 +572,11 @@ require('lazy').setup({ -- the definition of its *type*, not where it was *defined*. map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') + -- Toggle to show/hide diagnostic messages + map('td', function() + vim.diagnostic.enable(not vim.diagnostic.is_enabled()) + end, '[T]oggle [D]iagnostics') + -- 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 From e7f3e1c196bb48002b6d446ec3d7611a0d8ac71e Mon Sep 17 00:00:00 2001 From: Mithrandir2k18 Date: Fri, 4 Jul 2025 00:57:12 +0200 Subject: [PATCH 09/16] docs: Document methods to get the latest neovim --- README.md | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 41139505..2b9e52da 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,14 @@ 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. +If you are experiencing issues, please make sure you have at least the latest +stable version. Most likely, you want to install neovim via a [package +manager](https://github.com/neovim/neovim/blob/master/INSTALL.md#install-from-package). +To check your neovim version, run `nvim --version` and make sure it is not +below the latest +['stable'](https://github.com/neovim/neovim/releases/tag/stable) version. If +your chosen install method only gives you an outdated version of neovim, find +alternative [installation methods below](#alternative-neovim-installation-methods). ### Install External Dependencies @@ -154,7 +161,7 @@ examples of adding popularly requested plugins. 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. +After installing all the dependencies continue with the [Install Kickstart](#install-kickstart) step. #### Windows Installation @@ -239,3 +246,77 @@ sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim ``` +### Alternative neovim installation methods + +For some systems it is not unexpected that the [package manager installation +method](https://github.com/neovim/neovim/blob/master/INSTALL.md#install-from-package) +recommended by neovim is significantly behind. If that is the case for you, +pick one of the following methods that are known to deliver fresh neovim versions very quickly. +They have been picked for their popularity and because they make installing and updating +neovim to the latest versions easy. You can also find more detail about the +available methods being discussed +[here](https://github.com/nvim-lua/kickstart.nvim/issues/1583). + + +
Bob + +[Bob](https://github.com/MordechaiHadad/bob) is a Neovim version manager for +all plattforms. Simply install +[rustup](https://rust-lang.github.io/rustup/installation/other.html), +and run the following commands: + +```bash +rustup default stable +rustup update stable +cargo install bob-nvim +bob use stable +``` + +
+ +
Homebrew + +[Homebrew](https://brew.sh) is a package manager popular on Mac and Linux. +Simply install using [`brew install`](https://formulae.brew.sh/formula/neovim). + +
+ +
Flatpak + +Flatpak is a package manager for applications that allows developers to package their applications +just once to make it available on all Linux systems. Simply [install flatpak](https://flatpak.org/setup/) +and setup [flathub](https://flathub.org/setup) to [install neovim](https://flathub.org/apps/io.neovim.nvim). + +
+ +
asdf and mise-en-place + +[asdf](https://asdf-vm.com/) and [mise](https://mise.jdx.dev/) are tool version managers, +mostly aimed towards project-specific tool versioning. However both support managing tools +globally in the user-space as well: + +
mise + +[Install mise](https://mise.jdx.dev/getting-started.html), then run: + +```bash +mise plugins install neovim +mise use neovim@stable +``` + +
+ +
asdf + +[Install asdf](https://asdf-vm.com/guide/getting-started.html), then run: + +```bash +asdf plugin add neovim +asdf install neovim stable +asdf set neovim stable --home +asdf reshim neovim +``` + +
+ +
From 5ad57de208f3a9320a91f295ab31755098138b45 Mon Sep 17 00:00:00 2001 From: orip Date: Fri, 18 Apr 2025 19:18:57 +0300 Subject: [PATCH 10/16] Collapse small functions when formatting This would allow to write more concise and easy to understands keybinds in the following commit --- .stylua.toml | 1 + init.lua | 45 ++++++++++-------------- lua/kickstart/plugins/debug.lua | 56 ++++-------------------------- lua/kickstart/plugins/gitsigns.lua | 12 ++----- 4 files changed, 29 insertions(+), 85 deletions(-) diff --git a/.stylua.toml b/.stylua.toml index 139e9397..aa6f4b6a 100644 --- a/.stylua.toml +++ b/.stylua.toml @@ -4,3 +4,4 @@ indent_type = "Spaces" indent_width = 2 quote_style = "AutoPreferSingle" call_parentheses = "None" +collapse_simple_statement = "FunctionOnly" diff --git a/init.lua b/init.lua index b98ffc61..f6b29bf0 100644 --- a/init.lua +++ b/init.lua @@ -114,9 +114,7 @@ vim.o.showmode = false -- 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) +vim.schedule(function() vim.o.clipboard = 'unnamedplus' end) -- Enable break indent vim.o.breakindent = true @@ -214,9 +212,7 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the upper win 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, + callback = function() vim.hl.on_yank() end, }) -- [[ Install `lazy.nvim` plugin manager ]] @@ -372,9 +368,7 @@ require('lazy').setup({ -- `cond` is a condition used to determine whether this plugin should be -- installed and loaded. - cond = function() - return vim.fn.executable 'make' == 1 - end, + cond = function() return vim.fn.executable 'make' == 1 end, }, { 'nvim-telescope/telescope-ui-select.nvim' }, @@ -448,17 +442,20 @@ require('lazy').setup({ -- 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' }) + 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' }) + vim.keymap.set('n', 'sn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[S]earch [N]eovim files' }) end, }, @@ -619,9 +616,7 @@ require('lazy').setup({ -- -- 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') + 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, }) @@ -743,9 +738,7 @@ require('lazy').setup({ keys = { { 'f', - function() - require('conform').format { async = true, lsp_format = 'fallback' } - end, + function() require('conform').format { async = true, lsp_format = 'fallback' } end, mode = '', desc = '[F]ormat buffer', }, @@ -930,9 +923,7 @@ require('lazy').setup({ -- 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 + statusline.section_location = function() return '%2l:%-2v' end -- ... and there is more! -- Check out: https://github.com/echasnovski/mini.nvim diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 8e332bf2..44dfed5f 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -26,56 +26,14 @@ return { }, 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', - }, + { '', 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.', - }, + { '', function() require('dapui').toggle() end, desc = 'Debug: See last session result.' }, }, config = function() local dap = require 'dap' diff --git a/lua/kickstart/plugins/gitsigns.lua b/lua/kickstart/plugins/gitsigns.lua index cbbd22d2..777e470a 100644 --- a/lua/kickstart/plugins/gitsigns.lua +++ b/lua/kickstart/plugins/gitsigns.lua @@ -34,12 +34,8 @@ return { -- 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' }) + 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' }) @@ -49,9 +45,7 @@ return { 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' }) + 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' }) From 48e36d1ca973d04fc2d04d2d30478f1a7d6ac233 Mon Sep 17 00:00:00 2001 From: orip Date: Fri, 18 Apr 2025 19:41:55 +0300 Subject: [PATCH 11/16] Update the github workflow --- .github/workflows/stylua.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stylua.yml b/.github/workflows/stylua.yml index 75db6c33..d8e78df4 100644 --- a/.github/workflows/stylua.yml +++ b/.github/workflows/stylua.yml @@ -9,11 +9,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} - name: Stylua Check - uses: JohnnyMorganz/stylua-action@v3 + uses: JohnnyMorganz/stylua-action@v4 with: token: ${{ secrets.GITHUB_TOKEN }} version: latest From 59620642551b1725a77fc8e3a953a71e160a66d6 Mon Sep 17 00:00:00 2001 From: orip Date: Sat, 26 Apr 2025 14:35:04 +0300 Subject: [PATCH 12/16] Add type hints to plugin options where possible This could help beginners to get autocompletion, catch mistakes earlier, and allow them to skip the docs for simple configs. This is not perfect because a lot of the plugins type all of their keys as required, even though they have defaults, but this is good enough. --- init.lua | 48 +++++++++++++++++++++------ lua/custom/plugins/init.lua | 3 ++ lua/kickstart/plugins/autopairs.lua | 2 ++ lua/kickstart/plugins/debug.lua | 4 +++ lua/kickstart/plugins/gitsigns.lua | 5 +++ lua/kickstart/plugins/indent_line.lua | 4 +++ lua/kickstart/plugins/lint.lua | 2 ++ lua/kickstart/plugins/neo-tree.lua | 4 +++ 8 files changed, 62 insertions(+), 10 deletions(-) diff --git a/init.lua b/init.lua index b98ffc61..33878b9c 100644 --- a/init.lua +++ b/init.lua @@ -273,13 +273,16 @@ require('lazy').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', + ---@module 'gitsigns' + ---@type Gitsigns.Config + ---@diagnostic disable-next-line: missing-fields opts = { signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, + add = { text = '+' }, ---@diagnostic disable-line: missing-fields + change = { text = '~' }, ---@diagnostic disable-line: missing-fields + delete = { text = '_' }, ---@diagnostic disable-line: missing-fields + topdelete = { text = '‾' }, ---@diagnostic disable-line: missing-fields + changedelete = { text = '~' }, ---@diagnostic disable-line: missing-fields }, }, }, @@ -301,6 +304,9 @@ require('lazy').setup({ { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' + ---@module 'which-key' + ---@type wk.Opts + ---@diagnostic disable-next-line: missing-fields opts = { -- delay between pressing a key and opening which-key (milliseconds) -- this setting is independent of vim.o.timeoutlen @@ -468,6 +474,9 @@ require('lazy').setup({ -- used for completion, annotations and signatures of Neovim apis 'folke/lazydev.nvim', ft = 'lua', + ---@module 'lazydev' + ---@type lazydev.Config + ---@diagnostic disable-next-line: missing-fields opts = { library = { -- Load luvit types when the `vim.uv` word is found @@ -482,7 +491,13 @@ 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({})` - { 'mason-org/mason.nvim', opts = {} }, + { + 'mason-org/mason.nvim', + ---@module 'mason.settings' + ---@type MasonSettings + ---@diagnostic disable-next-line: missing-fields + opts = {}, + }, 'mason-org/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', @@ -750,6 +765,8 @@ require('lazy').setup({ desc = '[F]ormat buffer', }, }, + ---@module 'conform' + ---@type conform.setupOpts opts = { notify_on_error = false, format_on_save = function(bufnr) @@ -810,8 +827,8 @@ require('lazy').setup({ }, 'folke/lazydev.nvim', }, - --- @module 'blink.cmp' - --- @type blink.cmp.Config + ---@module 'blink.cmp' + ---@type blink.cmp.Config opts = { keymap = { -- 'default' (recommended) for mappings similar to built-in completions @@ -899,7 +916,15 @@ require('lazy').setup({ }, -- Highlight todo, notes, etc in comments - { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, + { + 'folke/todo-comments.nvim', + event = 'VimEnter', + dependencies = { 'nvim-lua/plenary.nvim' }, + ---@module 'todo-comments' + ---@type TodoOptions + ---@diagnostic disable-next-line: missing-fields + opts = { signs = false }, + }, { -- Collection of various small independent plugins/modules 'echasnovski/mini.nvim', @@ -943,6 +968,9 @@ require('lazy').setup({ build = ':TSUpdate', main = 'nvim-treesitter.configs', -- Sets main module to use for opts -- [[ Configure Treesitter ]] See `:help nvim-treesitter` + ---@module 'nvim-treesitter' + ---@type TSConfig + ---@diagnostic disable-next-line: missing-fields opts = { ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, -- Autoinstall languages that are not installed @@ -990,7 +1018,7 @@ require('lazy').setup({ -- 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 -}, { +}, { ---@diagnostic disable-line: missing-fields 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/init.lua b/lua/custom/plugins/init.lua index be0eb9d8..b3ddcfdd 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,7 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information + +---@module 'lazy' +---@type LazySpec return {} diff --git a/lua/kickstart/plugins/autopairs.lua b/lua/kickstart/plugins/autopairs.lua index 386d392e..351dad86 100644 --- a/lua/kickstart/plugins/autopairs.lua +++ b/lua/kickstart/plugins/autopairs.lua @@ -1,6 +1,8 @@ -- autopairs -- https://github.com/windwp/nvim-autopairs +---@module 'lazy' +---@type LazySpec return { 'windwp/nvim-autopairs', event = 'InsertEnter', diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 8e332bf2..481c6fbb 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -6,6 +6,8 @@ -- be extended to other languages as well. That's why it's called -- kickstart.nvim and not kitchen-sink.nvim ;) +---@module 'lazy' +---@type LazySpec return { -- NOTE: Yes, you can install new plugins here! 'mfussenegger/nvim-dap', @@ -100,11 +102,13 @@ return { -- Dap UI setup -- For more information, see |:help nvim-dap-ui| + ---@diagnostic disable-next-line: missing-fields 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 = '*' }, + ---@diagnostic disable-next-line: missing-fields controls = { icons = { pause = '⏸', diff --git a/lua/kickstart/plugins/gitsigns.lua b/lua/kickstart/plugins/gitsigns.lua index cbbd22d2..3913d189 100644 --- a/lua/kickstart/plugins/gitsigns.lua +++ b/lua/kickstart/plugins/gitsigns.lua @@ -2,9 +2,14 @@ -- NOTE: gitsigns is already included in init.lua but contains only the base -- config. This will add also the recommended keymaps. +---@module 'lazy' +---@type LazySpec return { { 'lewis6991/gitsigns.nvim', + ---@module 'gitsigns' + ---@type Gitsigns.Config + ---@diagnostic disable-next-line: missing-fields opts = { on_attach = function(bufnr) local gitsigns = require 'gitsigns' diff --git a/lua/kickstart/plugins/indent_line.lua b/lua/kickstart/plugins/indent_line.lua index ed7f2693..6a95da80 100644 --- a/lua/kickstart/plugins/indent_line.lua +++ b/lua/kickstart/plugins/indent_line.lua @@ -1,9 +1,13 @@ +---@module 'lazy' +---@type LazySpec return { { -- Add indentation guides even on blank lines 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` -- See `:help ibl` main = 'ibl', + ---@module 'ibl' + ---@type ibl.config opts = {}, }, } diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index dec42f09..5ff8e34b 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -1,3 +1,5 @@ +---@module 'lazy' +---@type LazySpec return { { -- Linting diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua index c7067891..af8d4495 100644 --- a/lua/kickstart/plugins/neo-tree.lua +++ b/lua/kickstart/plugins/neo-tree.lua @@ -1,6 +1,8 @@ -- Neo-tree is a Neovim plugin to browse the file system -- https://github.com/nvim-neo-tree/neo-tree.nvim +---@module 'lazy' +---@type LazySpec return { 'nvim-neo-tree/neo-tree.nvim', version = '*', @@ -13,6 +15,8 @@ return { keys = { { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, }, + ---@module 'neo-tree' + ---@type neotree.Config opts = { filesystem = { window = { From f5f085f9c86a935b1ee1e4d67f7af91696e3de99 Mon Sep 17 00:00:00 2001 From: orip Date: Fri, 4 Jul 2025 17:11:10 +0300 Subject: [PATCH 13/16] Undo the formatting changes from https://github.com/oriori1703/kickstart-modular.nvim/pull/7 --- init.lua | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/init.lua b/init.lua index 387563c3..cd03ba9f 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,5 @@ --[[ + ===================================================================== ==================== READ THIS BEFORE CONTINUING ==================== ===================================================================== @@ -922,12 +923,7 @@ require('lazy').setup({ }, -- Highlight todo, notes, etc in comments - { - 'folke/todo-comments.nvim', - event = 'VimEnter', - 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', @@ -972,19 +968,7 @@ require('lazy').setup({ 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', - }, + 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 1b3bb132784e355188a9cc330a6dbbb26bcdee71 Mon Sep 17 00:00:00 2001 From: orip Date: Fri, 4 Jul 2025 17:32:28 +0300 Subject: [PATCH 14/16] Fix formatting --- init.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/init.lua b/init.lua index d133009a..507b2ee2 100644 --- a/init.lua +++ b/init.lua @@ -585,9 +585,7 @@ require('lazy').setup({ map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') -- Toggle to show/hide diagnostic messages - map('td', function() - vim.diagnostic.enable(not vim.diagnostic.is_enabled()) - end, '[T]oggle [D]iagnostics') + map('td', function() vim.diagnostic.enable(not vim.diagnostic.is_enabled()) end, '[T]oggle [D]iagnostics') -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) ---@param client vim.lsp.Client From 200e0e6e24cb0b02ed8ff462fd2d8a97ab10424f Mon Sep 17 00:00:00 2001 From: Ori Perry <48057913+oriori1703@users.noreply.github.com> Date: Fri, 4 Jul 2025 17:44:18 +0300 Subject: [PATCH 15/16] Breakpoint editing (#10) feat: Enhances breakpoint editing The keymapping `B` is now configured to guide users through the process of adding a `condition`, `hitCondition`, and `logMessage` to a breakpoint. --------- Co-authored-by: Brian Lehrer <661570+blehrer@users.noreply.github.com> --- lua/kickstart/plugins/debug.lua | 71 ++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 7e58905e..a0d1a1b2 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -33,7 +33,76 @@ return { { '', 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' }, + { + 'B', + function() + require 'dap.protocol' + local dap = require 'dap' + -- Search for an existing breakpoint on this line in this buffer + ---@return dap.SourceBreakpoint bp that was either found, or an empty placeholder + local function find_bp() + local buf_bps = require('dap.breakpoints').get(vim.fn.bufnr())[vim.fn.bufnr()] + ---@type dap.SourceBreakpoint + for _, candidate in ipairs(buf_bps) do + if candidate.line and candidate.line == vim.fn.line '.' then + return candidate + end + end + return { condition = '', logMessage = '', hitCondition = '', line = vim.fn.line '.' } + end + + -- Elicit customization via a UI prompt + ---@param bp dap.SourceBreakpoint a breakpoint + local function customize_bp(bp) + local props = { + ['Condition'] = { + value = bp.condition, + setter = function(v) + bp.condition = v + end, + }, + ['Hit Condition'] = { + value = bp.hitCondition, + setter = function(v) + bp.hitCondition = v + end, + }, + ['Log Message'] = { + value = bp.logMessage, + setter = function(v) + bp.logMessage = v + end, + }, + } + local menu_options = {} + for k, _ in pairs(props) do + table.insert(menu_options, k) + end + vim.ui.select(menu_options, { + prompt = 'Edit Breakpoint', + format_item = function(item) + return ('%s: %s'):format(item, props[item].value) + end, + }, function(choice) + if choice == nil then + -- User cancelled the selection + return + end + + props[choice].setter(vim.fn.input { + prompt = ('[%s] '):format(choice), + default = props[choice].value, + }) + + -- Set breakpoint for current line, with customizations (see h:dap.set_breakpoint()) + dap.set_breakpoint(bp.condition, bp.hitCondition, bp.logMessage) + end) + end + + customize_bp(find_bp()) + end, + desc = 'Debug: Edit 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.' }, }, From 222769ba31460b7164dfce47f8a8f46bf99ababb Mon Sep 17 00:00:00 2001 From: orip Date: Fri, 4 Jul 2025 17:51:56 +0300 Subject: [PATCH 16/16] Fix formatting for https://github.com/oriori1703/kickstart-modular.nvim/pull/10 --- lua/kickstart/plugins/debug.lua | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index a0d1a1b2..ecfb28fb 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -57,21 +57,15 @@ return { local props = { ['Condition'] = { value = bp.condition, - setter = function(v) - bp.condition = v - end, + setter = function(v) bp.condition = v end, }, ['Hit Condition'] = { value = bp.hitCondition, - setter = function(v) - bp.hitCondition = v - end, + setter = function(v) bp.hitCondition = v end, }, ['Log Message'] = { value = bp.logMessage, - setter = function(v) - bp.logMessage = v - end, + setter = function(v) bp.logMessage = v end, }, } local menu_options = {} @@ -80,9 +74,7 @@ return { end vim.ui.select(menu_options, { prompt = 'Edit Breakpoint', - format_item = function(item) - return ('%s: %s'):format(item, props[item].value) - end, + format_item = function(item) return ('%s: %s'):format(item, props[item].value) end, }, function(choice) if choice == nil then -- User cancelled the selection