diff options
author | Damjan 9000 <damjan.9000@gmail.com> | 2024-07-22 20:25:55 +0200 |
---|---|---|
committer | Damjan 9000 <damjan.9000@gmail.com> | 2024-07-22 20:25:55 +0200 |
commit | e1d6094136efb6f0c1f5a9f303fb8cbbe32b5976 (patch) | |
tree | 76ca861005d8c361e86696cd7cc0870fb5cd2178 | |
parent | a6442e80813b40238066676b7ac97951c1bd1822 (diff) | |
parent | 56b9114bf29cdc0c0f5de78b5deae1fe0ab65db1 (diff) |
Merge 'upstream' Neovim 0.10 updates and more
Merged commits from upstream:
Update comment about the toggle inlay hints keymap
lint: fix lsp warning in `vim.lsp.inlay_hint.is_enabled`
Update lazydev config to fix "Undefined field `fs_stat`" LSP error
Neovim 0.10 updates
Fix comment about mini.ai example
Make conform.nvim be lazy-loadable again
Update README.md | %userprofile%\appdata\local -> %localappdata%
Make debug lazy loadable
Remove redundant require
Fix neo-tree keymap description
fix: add required parsers from nvim-treesitter
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | lua/keymaps.lua | 3 | ||||
-rw-r--r-- | lua/kickstart/health.lua | 6 | ||||
-rw-r--r-- | lua/kickstart/plugins/cmp.lua | 5 | ||||
-rw-r--r-- | lua/kickstart/plugins/conform.lua | 3 | ||||
-rw-r--r-- | lua/kickstart/plugins/debug.lua | 35 | ||||
-rw-r--r-- | lua/kickstart/plugins/lint.lua | 2 | ||||
-rw-r--r-- | lua/kickstart/plugins/lspconfig.lua | 26 | ||||
-rw-r--r-- | lua/kickstart/plugins/mini.lua | 2 | ||||
-rw-r--r-- | lua/kickstart/plugins/neo-tree.lua | 2 | ||||
-rw-r--r-- | lua/kickstart/plugins/treesitter.lua | 2 | ||||
-rw-r--r-- | lua/lazy-bootstrap.lua | 2 | ||||
-rw-r--r-- | lua/lazy-plugins.lua | 4 |
13 files changed, 57 insertions, 43 deletions
@@ -48,8 +48,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 @@ -79,13 +79,13 @@ git clone https://github.com/dam9000/kickstart-modular.nvim.git "${XDG_CONFIG_HO If you're using `cmd.exe`: ``` -git clone https://github.com/dam9000/kickstart-modular.nvim.git %userprofile%\AppData\Local\nvim\ +git clone https://github.com/dam9000/kickstart.nvim.git %localappdata%\nvim\ ``` If you're using `powershell.exe` ``` -git clone https://github.com/dam9000/kickstart-modular.nvim.git $env:USERPROFILE\AppData\Local\nvim\ +git clone https://github.com/dam9000/kickstart.nvim.git $env:LOCALAPPDATA\nvim\ ``` </details> diff --git a/lua/keymaps.lua b/lua/keymaps.lua index c6c87b1..46e815c 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -6,9 +6,6 @@ vim.opt.hlsearch = true vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>') -- 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', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' }) vim.keymap.set('n', '<leader>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 diff --git a/lua/kickstart/health.lua b/lua/kickstart/health.lua index 04df77b..b59d086 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)) diff --git a/lua/kickstart/plugins/cmp.lua b/lua/kickstart/plugins/cmp.lua index de63086..e9ed483 100644 --- a/lua/kickstart/plugins/cmp.lua +++ b/lua/kickstart/plugins/cmp.lua @@ -102,6 +102,11 @@ return { -- 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/plugins/conform.lua b/lua/kickstart/plugins/conform.lua index 5057737..4f280f7 100644 --- a/lua/kickstart/plugins/conform.lua +++ b/lua/kickstart/plugins/conform.lua @@ -1,7 +1,8 @@ return { { -- Autoformat 'stevearc/conform.nvim', - lazy = false, + event = { 'BufWritePre' }, + cmd = { 'ConformInfo' }, keys = { { '<leader>f', diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 31dfecf..196f2c6 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! + { '<F5>', dap.continue, desc = 'Debug: Start/Continue' }, + { '<F1>', dap.step_into, desc = 'Debug: Step Into' }, + { '<F2>', dap.step_over, desc = 'Debug: Step Over' }, + { '<F3>', dap.step_out, desc = 'Debug: Step Out' }, + { '<leader>b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' }, + { + '<leader>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. + { '<F7>', 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', '<F5>', dap.continue, { desc = 'Debug: Start/Continue' }) - vim.keymap.set('n', '<F1>', dap.step_into, { desc = 'Debug: Step Into' }) - vim.keymap.set('n', '<F2>', dap.step_over, { desc = 'Debug: Step Over' }) - vim.keymap.set('n', '<F3>', dap.step_out, { desc = 'Debug: Step Out' }) - vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) - vim.keymap.set('n', '<leader>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', '<F7>', 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 diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index 7f0dc42..ca9bc23 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, diff --git a/lua/kickstart/plugins/lspconfig.lua b/lua/kickstart/plugins/lspconfig.lua index 5f9220b..e5944e5 100644 --- a/lua/kickstart/plugins/lspconfig.lua +++ b/lua/kickstart/plugins/lspconfig.lua @@ -11,9 +11,19 @@ return { -- 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 = { + 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?** @@ -90,10 +100,6 @@ return { -- or a suggestion from your LSP for this to activate. map('<leader>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') @@ -104,7 +110,7 @@ return { -- -- 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, @@ -127,13 +133,13 @@ return { }) 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 - 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('<leader>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, diff --git a/lua/kickstart/plugins/mini.lua b/lua/kickstart/plugins/mini.lua index 3e924a8..3a9bdc3 100644 --- a/lua/kickstart/plugins/mini.lua +++ b/lua/kickstart/plugins/mini.lua @@ -6,7 +6,7 @@ return { -- -- 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 } diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua index c793b88..f126d68 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<CR>', { desc = 'NeoTree reveal' } }, + { '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal' }, }, opts = { filesystem = { diff --git a/lua/kickstart/plugins/treesitter.lua b/lua/kickstart/plugins/treesitter.lua index 3e67507..4db3b2c 100644 --- a/lua/kickstart/plugins/treesitter.lua +++ b/lua/kickstart/plugins/treesitter.lua @@ -3,7 +3,7 @@ return { '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 = { diff --git a/lua/lazy-bootstrap.lua b/lua/lazy-bootstrap.lua index ede966a..37c768f 100644 --- a/lua/lazy-bootstrap.lua +++ b/lua/lazy-bootstrap.lua @@ -1,7 +1,7 @@ -- [[ 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 diff --git a/lua/lazy-plugins.lua b/lua/lazy-plugins.lua index e93e193..f601d39 100644 --- a/lua/lazy-plugins.lua +++ b/lua/lazy-plugins.lua @@ -19,11 +19,7 @@ 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 = {} }, -- modular approach: using `require 'path/name'` will -- include a plugin definition from file lua/path/name.lua |