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
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/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
+```
+
+
+
+
diff --git a/init.lua b/init.lua
index b98ffc61..d6e9adbe 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 ]]
@@ -247,7 +243,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
@@ -267,19 +263,26 @@ 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`.
--
-- 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
@@ -344,7 +350,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' } },
},
@@ -372,9 +378,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' },
@@ -430,7 +434,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' })
@@ -448,17 +452,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,
},
@@ -468,6 +475,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 +492,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',
@@ -572,6 +588,9 @@ 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
@@ -619,9 +638,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,
})
@@ -631,7 +648,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,61 +659,76 @@ 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,
},
+ -- Display multiline diagnostics as virtual lines
+ -- virtual_lines = true,
}
-- 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.
+ -- 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).
--
- -- 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 capabilities = require("blink.cmp").get_lsp_capabilities()
+
+ -- 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.
+
+ -- 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 = {
- -- 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 = {},
+ -- 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/
--
-
- 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 +744,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 not vim.tbl_isempty(config) 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 not vim.tbl_isempty(servers.others) then
+ vim.lsp.enable(vim.tbl_keys(servers.others))
+ end
end,
},
@@ -743,13 +779,13 @@ 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',
},
},
+ ---@module 'conform'
+ ---@type conform.setupOpts
opts = {
notify_on_error = false,
format_on_save = function(bufnr)
@@ -810,8 +846,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 +935,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',
@@ -930,9 +974,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
@@ -943,6 +985,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 +1035,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..ecfb28fb 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',
@@ -26,56 +28,75 @@ 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',
- },
+ { '', 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: ')
+ 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: Set Breakpoint',
+ 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.',
- },
+ { '', function() require('dapui').toggle() end, desc = 'Debug: See last session result.' },
},
config = function()
local dap = require 'dap'
@@ -100,11 +121,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..f0137084 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'
@@ -34,12 +39,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 +50,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' })
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 = {