Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream update #3

Merged
merged 55 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
f5c9195
which-key v3 update (#1022)
VlaDexa Jul 16, 2024
3e55ff1
fix(lazy): added error handling for bootstrap (#1001)
folke Jul 16, 2024
64597b0
Merge 'upstream' which-key v3 update
dam9000 Jul 17, 2024
a6442e8
Merge 'upstream' fix(lazy): added error handling for bootstrap
dam9000 Jul 17, 2024
2df5137
fix: add required parsers from nvim-treesitter
tjdevries Jul 18, 2024
202910d
Fix neo-tree keymap description (#932)
dam9000 Jul 21, 2024
1cdf6fb
Remove redundant require (#959)
tjkuson Jul 21, 2024
4bbca64
Make debug lazy loadable (#978)
VlaDexa Jul 21, 2024
c405d3f
Update README.md | %userprofile%\appdata\local -> %localappdata% (#963)
MZhuvka Jul 21, 2024
b36d84d
Make conform.nvim be lazy-loadable again (#977)
VlaDexa Jul 21, 2024
07a9f44
Fix comment about mini.ai example (#985)
rmacklin Jul 21, 2024
7513ec8
Neovim 0.10 updates (#936)
VlaDexa Jul 22, 2024
6207327
Update lazydev config to fix "Undefined field `fs_stat`" LSP error (#…
rmacklin Jul 22, 2024
6f3fe35
lint: fix lsp warning in `vim.lsp.inlay_hint.is_enabled` (#947)
srdtrk Jul 22, 2024
56b9114
Update comment about the toggle inlay hints keymap (#1041)
rmacklin Jul 22, 2024
e1d6094
Merge 'upstream' Neovim 0.10 updates and more
dam9000 Jul 22, 2024
f00b286
Remove redundant hlsearch option (#1058)
rivenirvana Jul 28, 2024
1cef232
Modify conform comments to prevent deprecation warning when used (#1057)
igniscyan Jul 28, 2024
5a2930f
Merge 'upstream' conform warning, redundant hlsearch
dam9000 Jul 28, 2024
fd66454
refactor: remove lazydev and luvit-meta as lsp dependencies (#1047)
iton0 Jul 28, 2024
84cc123
performance: defer clipboard because xsel and pbcopy can be slow (#1049)
abeldekat Jul 28, 2024
0a274ab
Merge 'upstream' refactor lazydev, defer clipboard
dam9000 Jul 29, 2024
bb9f84c
Remove treesitter prefer_git option (#1061)
jstrot Jul 30, 2024
1860184
Add explicit dependency of nvim-lspconfig on cmp-nvim-lsp (#1042)
jstrot Jul 30, 2024
198460c
Merge 'upstream' nvim-lspconfig cmp-nvim-lsp, treesitter prefer_git
dam9000 Jul 31, 2024
c1ae909
Update README.md (#1091)
theoboldalex Aug 22, 2024
554a054
Add note in README about lazy-lock.json (#1090)
mattgallagher92 Aug 22, 2024
ce0c734
Check for loop or uv for lazypath (#1095)
mike-jl Aug 22, 2024
ac78e7d
refactor: update treesitter and which-key config (#1068)
iton0 Aug 23, 2024
e921346
Merge 'upstream' refactor treesitter, which-key, uv/loop, update README
dam9000 Aug 23, 2024
d452633
Include visual mode in LSP code action keymap (#1060) (#1064)
bayramkzk Aug 24, 2024
0692979
Merge 'upstream' Include visual mode in LSP code action keymap
dam9000 Aug 25, 2024
f49cc6c
Enable silent option for default neo-tree plugin keybinding (#1108)
bayramkzk Aug 26, 2024
e4a5300
Fix: updated the windows installation commands (#1101)
pantharshit007 Aug 26, 2024
c76c323
fix: remove deprecated opt for conform.nvim (#1070)
iton0 Aug 26, 2024
7d83a27
Merge 'upstream' conform, readme, neo-tree silent
dam9000 Aug 26, 2024
24d368f
cleanup: refactor which-key configuration for cleaner setup (#1102)
iton0 Aug 26, 2024
7e11e8a
Merge 'upstream' cleanup: refactor which-key configuration
dam9000 Aug 26, 2024
a229761
Fix the which-key spec issue caused by recent cleanup (#1113)
dam9000 Aug 26, 2024
3a01797
Merge 'upstream' Fix the which-key spec issue caused by recent cleanup
dam9000 Aug 26, 2024
7201dc4
feat: update references of tsserver to ts_ls (#1131)
Cheveniko Sep 10, 2024
1695a1d
Merge 'upstream' feat: update references of tsserver to ts_ls
dam9000 Sep 10, 2024
4120893
fix: update lazy uninstall information link (#1148)
neitsab Sep 24, 2024
c0a254f
Merge 'upstream' fix: update lazy uninstall information link
dam9000 Sep 24, 2024
5ed1bc3
Disable linting autocmd for readonly buffers (#1202)
ccjmne Oct 30, 2024
fb7f6a1
samarth-nagar fix: lazy help tag on line 931 (#1167)
samarth-na Oct 30, 2024
d09d9bc
Change diagnostic symbols if vim.g.have_nerd_font is true (#1195)
glmlm Oct 30, 2024
be678aa
Set breakpoint icons and their highlight colors (#1194)
glmlm Oct 30, 2024
2ba39c6
Remove two because there are more than two. (#1213)
winder Oct 30, 2024
ee40a0e
Merge 'upstream' 5 changes from 2024-10-30
dam9000 Oct 31, 2024
e5dc5f6
feat: Change to prepare for upcoming deprecation of configuring diagn…
glmlm Nov 20, 2024
9dfb1b2
Fix nvim-dap not lazy loading (#1216)
kaezrr Nov 20, 2024
8d1ef97
fix: which-key comment typo (#1227)
mihasket Nov 20, 2024
46093fe
Merge 'upstream': diagnostic-signs, nvim-dap lazy, which-key typo
dam9000 Nov 20, 2024
e5a655b
Resolves merge conflicts.
Dec 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ External Requirements:
- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
- if you have it set `vim.g.have_nerd_font` in `init.lua` to true
- Language Setup:
- If want to write Typescript, you need `npm`
- If want to write Golang, you will need `go`
- If you want to write Typescript, you need `npm`
- If you want to write Golang, you will need `go`
- etc.

> **NOTE**
Expand All @@ -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

Expand All @@ -61,6 +61,10 @@ fork to your machine using one of the commands below, depending on your OS.
> Your fork's url will be something like this:
> `https://github.com/<your_github_username>/kickstart-modular.nvim.git`

You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file
too - it's ignored in the kickstart repo to make maintenance easier, but it's
[recommmended to track it in version control](https://lazy.folke.io/usage/lockfile).

#### Clone kickstart.nvim
> **NOTE**
> If following the recommended step above (i.e., forking the repo), replace
Expand All @@ -79,13 +83,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>
Expand Down Expand Up @@ -128,7 +132,7 @@ examples of adding popularly requested plugins.
`~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim
distribution that you would like to try out.
* What if I want to "uninstall" this configuration:
* See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information
* See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information
* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files?
* The main purpose of kickstart is to serve as a teaching tool and a reference
configuration that someone can easily use to `git clone` as a basis for their own.
Expand Down
7 changes: 2 additions & 5 deletions lua/keymaps.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
-- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()`

-- Set highlight on search, but clear on pressing <Esc> in normal mode
vim.opt.hlsearch = true
-- Clear highlights on search when pressing <Esc> in normal mode
-- See `:help hlsearch`
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
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
5 changes: 5 additions & 0 deletions lua/kickstart/plugins/cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,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' },
Expand Down
18 changes: 12 additions & 6 deletions lua/kickstart/plugins/conform.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
return {
{ -- Autoformat
'stevearc/conform.nvim',
lazy = false,
event = { 'BufWritePre' },
cmd = { 'ConformInfo' },
keys = {
{
'<leader>f',
function()
require('conform').format { async = true, lsp_fallback = true }
require('conform').format { async = true, lsp_format = 'fallback' }
end,
mode = '',
desc = '[F]ormat buffer',
Expand All @@ -19,19 +20,24 @@ return {
-- have a well standardized coding style. You can add additional
-- languages here or re-enable it for the disabled ones.
local disable_filetypes = { c = true, cpp = true }
local lsp_format_opt
if disable_filetypes[vim.bo[bufnr].filetype] then
lsp_format_opt = 'never'
else
lsp_format_opt = 'fallback'
end
return {
timeout_ms = 500,
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
lsp_format = lsp_format_opt,
}
end,
formatters_by_ft = {
lua = { 'stylua' },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
-- You can use a sub-list to tell conform to run *until* a formatter
-- is found.
-- javascript = { { "prettierd", "prettier" } },
-- You can use 'stop_after_first' to run the first available formatter from the list
-- javascript = { "prettierd", "prettier", stop_after_first = true },
},
},
},
Expand Down
76 changes: 64 additions & 12 deletions lua/kickstart/plugins/debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,59 @@ return {
-- Add your own debuggers here
'leoluz/nvim-dap-go',
},
keys = {
-- Basic debugging keymaps, feel free to change to your liking!
{
'<F5>',
function()
require('dap').continue()
end,
desc = 'Debug: Start/Continue',
},
{
'<F1>',
function()
require('dap').step_into()
end,
desc = 'Debug: Step Into',
},
{
'<F2>',
function()
require('dap').step_over()
end,
desc = 'Debug: Step Over',
},
{
'<F3>',
function()
require('dap').step_out()
end,
desc = 'Debug: Step Out',
},
{
'<leader>b',
function()
require('dap').toggle_breakpoint()
end,
desc = 'Debug: Toggle Breakpoint',
},
{
'<leader>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.
{
'<F7>',
function()
require('dapui').toggle()
end,
desc = 'Debug: See last session result.',
},
},
config = function()
local dap = require 'dap'
local dapui = require 'dapui'
Expand All @@ -45,16 +98,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,8 +120,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.' })
-- Change breakpoint icons
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
-- local breakpoint_icons = vim.g.have_nerd_font
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
-- for type, icon in pairs(breakpoint_icons) do
-- local tp = 'Dap' .. type
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
-- end

dap.listeners.after.event_initialized['dapui_config'] = dapui.open
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
Expand Down
7 changes: 6 additions & 1 deletion lua/kickstart/plugins/lint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ return {
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
group = lint_augroup,
callback = function()
require('lint').try_lint()
-- Only run the linter in buffers that you can modify in order to
-- avoid superfluous noise, notably within the handy LSP pop-ups that
-- describe the hovered symbol using Markdown.
if vim.opt_local.modifiable:get() then
lint.try_lint()
end
end,
})
end,
Expand Down
57 changes: 39 additions & 18 deletions lua/kickstart/plugins/lspconfig.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
-- LSP Plugins
return {
{ -- LSP Configuration & Plugins
{
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
-- used for completion, annotations and signatures of Neovim apis
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
-- Load luvit types when the `vim.uv` word is found
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
},
},
},
{ 'Bilal2453/luvit-meta', lazy = true },
{
-- Main LSP Configuration
'neovim/nvim-lspconfig',
dependencies = {
-- Automatically install LSPs and related tools to stdpath for Neovim
Expand All @@ -11,9 +26,8 @@ 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
-- used for completion, annotations and signatures of Neovim apis
{ 'folke/neodev.nvim', opts = {} },
-- Allows extra capabilities provided by nvim-cmp
'hrsh7th/cmp-nvim-lsp',
},
config = function()
-- Brief aside: **What is LSP?**
Expand Down Expand Up @@ -53,8 +67,9 @@ return {
--
-- In this case, we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
local map = function(keys, func, desc)
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
local map = function(keys, func, desc, mode)
mode = mode or 'n'
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end

-- Jump to the definition of the word under your cursor.
Expand Down Expand Up @@ -88,11 +103,7 @@ return {

-- Execute a code action, usually your cursor needs to be on top of an error
-- or a suggestion from your LSP for this to activate.
map('<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')
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })

-- WARN: This is not Goto Definition, this is Goto Declaration.
-- For example, in C this would take you to the header.
Expand All @@ -104,7 +115,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,
Expand All @@ -127,18 +138,28 @@ 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,
})

-- Change diagnostic symbols in the sign column (gutter)
-- if vim.g.have_nerd_font then
-- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
-- local diagnostic_signs = {}
-- for type, icon in pairs(signs) do
-- diagnostic_signs[vim.diagnostic.severity[type]] = icon
-- end
-- vim.diagnostic.config { signs = { text = diagnostic_signs } }
-- end

-- LSP servers and clients are able to communicate to each other what features they support.
-- By default, Neovim doesn't support everything that is in the LSP specification.
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
Expand All @@ -165,8 +186,8 @@ return {
-- Some languages (like typescript) have entire language plugins that can be useful:
-- https://github.com/pmizio/typescript-tools.nvim
--
-- But for many setups, the LSP (`tsserver`) will work just fine
-- tsserver = {},
-- But for many setups, the LSP (`ts_ls`) will work just fine
-- ts_ls = {},
--

lua_ls = {
Expand Down Expand Up @@ -207,7 +228,7 @@ return {
local server = servers[server_name] or {}
-- This handles overriding only values explicitly passed
-- by the server configuration above. Useful when disabling
-- certain features of an LSP (for example, turning off formatting for tsserver)
-- certain features of an LSP (for example, turning off formatting for ts_ls)
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
require('lspconfig')[server_name].setup(server)
end,
Expand Down
2 changes: 1 addition & 1 deletion lua/kickstart/plugins/mini.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

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 @@ -12,7 +12,7 @@ return {
},
cmd = 'Neotree',
keys = {
{ '\\', ':Neotree reveal<CR>', { desc = 'NeoTree reveal' } },
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
},
opts = {
filesystem = {
Expand Down
Loading