Skip to content

Commit

Permalink
update with upstream (#12)
Browse files Browse the repository at this point in the history
* Add diff to treesitter's ensure_installed languages (nvim-lua#908)

* fix: debug.lua (nvim-lua#918)

* Automatically set detached state as needed. (nvim-lua#925)

* Automatically set detached state as needed.

* Use vim.fn.has instead.

* Fix int vs bool.

* which-key v3 update (nvim-lua#1022)

* which-key v3 update

* remove unneeded brackets from which-key registration

* fix(lazy): added error handling for bootstrap (nvim-lua#1001)

* fix: add required parsers from nvim-treesitter

* Fix neo-tree keymap description (nvim-lua#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

* Remove redundant require (nvim-lua#959)

* Make debug lazy loadable (nvim-lua#978)

* Update README.md | %userprofile%\appdata\local -> %localappdata% (nvim-lua#963)

- Replace `%userprofile%\AppData\Local\nvim\` and `$env:USERPROFILE\AppData\Local\nvim` to `%localappdata%\nvim` and `$env:LOCALAPPDATA\nvim respectfully`

* Make conform.nvim be lazy-loadable again (nvim-lua#977)

The PR that disabled lazy loading (nvim-lua#818) was to fix plugin not being
loaded before write. This sets up lazy to load conform before write.

* Fix comment about mini.ai example (nvim-lua#985)

This example wasn't using `'` so this makes more sense

* Neovim 0.10 updates (nvim-lua#936)

* Neovim 0.10 updates

Provide the buffer for which to enable inlay hints

Co-authored-by: Matt Mirus <matt@mattmirus.com>

* 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 <matt@mattmirus.com>
Co-authored-by: mrr11k <me+github@mrr11k.dev>
Co-authored-by: Seb Tomasini <sebt@qgates.com>

* Update lazydev config to fix "Undefined field `fs_stat`" LSP error (nvim-lua#1040)

7513ec8 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.

* lint: fix lsp warning in `vim.lsp.inlay_hint.is_enabled` (nvim-lua#947)

* fix: lsp warning

* review suggestion

Co-authored-by: Tom Kuson <mail@tjkuson.me>

---------

Co-authored-by: Tom Kuson <mail@tjkuson.me>

* Update comment about the toggle inlay hints keymap (nvim-lua#1041)

* Remove hint toggle in favor of default

---------

Co-authored-by: Richard Macklin <1863540+rmacklin@users.noreply.github.com>
Co-authored-by: Smig <89040888+smiggiddy@users.noreply.github.com>
Co-authored-by: Per Malmberg <PerMalmberg@users.noreply.github.com>
Co-authored-by: Vladislav Grechannik <52157081+VlaDexa@users.noreply.github.com>
Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
Co-authored-by: TJ DeVries <devries.timothyj@gmail.com>
Co-authored-by: Damjan 9000 <damjan.9000@gmail.com>
Co-authored-by: Tom Kuson <mail@tjkuson.me>
Co-authored-by: Artyom <84637383+MZhuvka@users.noreply.github.com>
Co-authored-by: Matt Mirus <matt@mattmirus.com>
Co-authored-by: mrr11k <me+github@mrr11k.dev>
Co-authored-by: Seb Tomasini <sebt@qgates.com>
Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com>
  • Loading branch information
14 people authored Jul 27, 2024
1 parent 5ef5842 commit c97a82e
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 60 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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\
```

</details>
Expand Down
74 changes: 38 additions & 36 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,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
Expand Down Expand Up @@ -209,9 +206,12 @@ 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'
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)

Expand All @@ -236,11 +236,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:
Expand Down Expand Up @@ -289,16 +284,15 @@ require('lazy').setup({
require('which-key').setup()

-- Document existing key chains
require('which-key').register {
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
require('which-key').add {
{ '<leader>c', group = '[C]ode' },
{ '<leader>d', group = '[D]ocument' },
{ '<leader>r', group = '[R]ename' },
{ '<leader>s', group = '[S]earch' },
{ '<leader>w', group = '[W]orkspace' },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
}
-- visual mode
require('which-key').register({
['<leader>h'] = { 'Git [H]unk' },
}, { mode = 'v' })
end,
},

Expand Down Expand Up @@ -426,9 +420,19 @@ 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 = {
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?**
Expand Down Expand Up @@ -505,10 +509,6 @@ require('lazy').setup({
-- 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')
Expand All @@ -519,7 +519,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,
Expand All @@ -542,13 +542,13 @@ 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
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,
Expand Down Expand Up @@ -639,7 +639,8 @@ require('lazy').setup({

{ -- Autoformat
'stevearc/conform.nvim',
lazy = false,
event = { 'BufWritePre' },
cmd = { 'ConformInfo' },
keys = {
{
'<leader>f',
Expand Down Expand Up @@ -795,6 +796,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' },
Expand All @@ -813,7 +819,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 }

Expand Down Expand Up @@ -850,7 +856,7 @@ require('lazy').setup({
},
build = ':TSUpdate',
opts = {
ensure_installed = { 'bash', 'c', '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 = {
Expand Down Expand Up @@ -1062,10 +1068,6 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnos
vim.keymap.set('n', '<leader>ld', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
vim.o.shellcmdflag = '-ic'

vim.keymap.set('n', '<leader>h', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end)

-- toggle hidden file searching in telescope
function _G.toggle_hidden_file_searching()
_G.hidden_files = not _G.hidden_files
Expand Down
6 changes: 3 additions & 3 deletions lua/kickstart/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
45 changes: 30 additions & 15 deletions lua/kickstart/plugins/debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,36 @@ 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'

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
Expand All @@ -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 {
Expand All @@ -77,14 +89,17 @@ 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

-- 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,
}
2 changes: 1 addition & 1 deletion lua/kickstart/plugins/lint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lua/kickstart/plugins/neo-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ return {
},
cmd = 'Neotree',
keys = {
{ '\\', ':Neotree reveal<CR>', { desc = 'NeoTree reveal' } },
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal' },
},
opts = {
filesystem = {
Expand Down

0 comments on commit c97a82e

Please sign in to comment.