Compare commits

..

11 Commits

Author SHA1 Message Date
a07f128628 current good 2026-05-20 09:39:20 -06:00
Ori Perry
cfdc17be3a Merge pull request #1982 from nathanzeng/jump-diagnostic
fix: deprecated diagnostic jumping config
2026-05-07 00:10:03 +03:00
Nathan Zeng
a5d4d12c8c fix: deprecated diagnostic jumping config 2026-05-07 00:03:18 +03:00
Ori Perry
174b5fa2b1 Merge pull request #2005 from nvim-lua/refactor/vim.pack
Refactor/vim.pack
2026-05-06 23:48:20 +03:00
orip
2fccee4349 Split the vim.pack.add call and move each part to the relevant sections 2026-05-05 01:25:21 +03:00
orip
2e8d5b17cb Split into sections 2026-05-05 01:24:17 +03:00
orip
a42ed30a09 Update the explanations and docs 2026-05-05 01:22:42 +03:00
orip
716d7465c0 Enable vim.loader for faster loading time 2026-05-05 01:18:15 +03:00
orip
c4605421e5 Migrate to vim.pack 2026-05-05 01:18:15 +03:00
orip
cd7adee3ce Refactor and update some of the comments 2026-05-05 01:17:59 +03:00
orip
4b065ad2f7 Fix mini.ai example 2026-04-22 17:59:57 +03:00
15 changed files with 1561 additions and 1169 deletions

4
.gitignore vendored
View File

@@ -6,9 +6,9 @@ nvim
spell/
# In your personal fork, you likely want to comment this, since it's recommended to track
# lazy-lock.json in version control - see https://lazy.folke.io/usage/lockfile
# nvim-pack-lock.json in version control - see :help vim.pack-lockfile
# For the official `nvim-lua/kickstart.nvim` git repository, we leave it ignored to avoid unneeded
# merge conflicts.
lazy-lock.json
nvim-pack-lock.json
.DS_Store

View File

@@ -69,9 +69,9 @@ 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.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
[recommended to track it in version control](https://lazy.folke.io/usage/lockfile).
You likely want to remove `nvim-pack-lock.json` from your fork's `.gitignore`
file too - it's ignored in the kickstart repo to make maintenance easier, but
it's recommended to track it in version control (see `:help vim.pack-lockfile`).
#### Clone kickstart.nvim
@@ -111,8 +111,10 @@ Start Neovim
nvim
```
That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
the current plugin status. Hit `q` to close the window.
That's it! `vim.pack` will install all the plugins from your config. Use
`:lua vim.pack.update(nil, { offline = true })` to inspect plugin state and
`:lua vim.pack.update()` to fetch updates (`:write` applies updates, `:quit`
cancels them).
#### Read The Friendly Documentation
@@ -146,7 +148,8 @@ 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://lazy.folke.io/usage#-uninstalling) information
* Remove your config directory and local data directory (for example,
`~/.config/nvim` and `~/.local/share/nvim`).
* 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.
@@ -167,17 +170,36 @@ After installing all the dependencies continue with the [Install Kickstart](#ins
#### Windows Installation
<details><summary>Windows with Microsoft C++ Build Tools and CMake</summary>
Installation may require installing build tools and updating the run command for `telescope-fzf-native`
Kickstart's default config is make-only for `telescope-fzf-native.nvim`.
If `make` is unavailable, the plugin is skipped.
See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)
Recommended: install `make` (see the chocolatey section below).
This requires:
If you want a CMake-only setup, customize `init.lua` in two places:
- Install CMake and the Microsoft C++ Build Tools on Windows
1. Include `telescope-fzf-native.nvim` when `cmake` is available:
```lua
{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
if vim.fn.executable 'make' == 1 or vim.fn.executable 'cmake' == 1 then
table.insert(plugins, gh 'nvim-telescope/telescope-fzf-native.nvim')
end
```
2. In the `PackChanged` hook, use CMake when `make` is unavailable:
```lua
if name == 'telescope-fzf-native.nvim' then
if vim.fn.executable 'make' == 1 then
run_build(name, { 'make' }, ev.data.path)
elseif vim.fn.executable 'cmake' == 1 then
run_build(name, { 'cmake', '-S.', '-Bbuild', '-DCMAKE_BUILD_TYPE=Release' }, ev.data.path)
run_build(name, { 'cmake', '--build', 'build', '--config', 'Release', '--target', 'install' }, ev.data.path)
end
return
end
```
See `telescope-fzf-native` documentation for [build details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation).
</details>
<details><summary>Windows with gcc/make using chocolatey</summary>
Alternatively, one can install gcc and make which don't require changing the config,

912
init.lua

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,122 @@
-- ============================================================
-- BUFFERLINE
-- Buffer tabs
-- ============================================================
local plugins = {
{
src = 'https://github.com/akinsho/bufferline.nvim',
version = vim.version.range '*',
},
}
if vim.g.have_nerd_font then table.insert(plugins, 'https://github.com/nvim-tree/nvim-web-devicons') end
vim.pack.add(plugins)
-- ============================================================
-- SETUP
-- ============================================================
require('bufferline').setup {
options = {
mode = 'buffers',
numbers = 'none',
close_command = 'bdelete! %d',
right_mouse_command = 'bdelete! %d',
left_mouse_command = 'buffer %d',
middle_mouse_command = nil,
indicator = {
style = 'underline',
},
buffer_close_icon = '󰅖',
modified_icon = '',
close_icon = '',
left_trunc_marker = '',
right_trunc_marker = '',
max_name_length = 24,
max_prefix_length = 18,
tab_size = 20,
diagnostics = 'nvim_lsp',
diagnostics_indicator = function(_, _, diagnostics_dict)
local s = ' '
for e, n in pairs(diagnostics_dict) do
local sym = e == 'error' and '' or (e == 'warning' and '') or ''
s = s .. n .. sym
end
return s
end,
offsets = {
{
filetype = 'neo-tree',
text = 'File Explorer',
highlight = 'Directory',
text_align = 'left',
},
},
show_buffer_icons = true,
show_buffer_close_icons = false,
show_close_icon = false,
show_tab_indicators = true,
persist_buffer_sort = true,
separator_style = 'slant',
enforce_regular_tabs = false,
always_show_bufferline = true,
hover = {
enabled = true,
delay = 200,
reveal = { 'close' },
},
},
}
-- ============================================================
-- KEYMAPS
-- ============================================================
-- Next buffer
vim.keymap.set('n', '<Tab>', '<Cmd>BufferLineCycleNext<CR>', {
desc = 'Next Buffer',
silent = true,
})
-- Previous buffer
vim.keymap.set('n', '<S-Tab>', '<Cmd>BufferLineCyclePrev<CR>', {
desc = 'Previous Buffer',
silent = true,
})
-- Pin buffer
vim.keymap.set('n', '<leader>bp', '<Cmd>BufferLineTogglePin<CR>', {
desc = 'Pin Buffer',
silent = true,
})
-- Close buffer
vim.keymap.set('n', '<leader>bc', '<Cmd>bdelete<CR>', {
desc = 'Close Buffer',
silent = true,
})
-- Go to buffer by number
for i = 1, 9 do
vim.keymap.set('n', '<leader>' .. i, function() require('bufferline').go_to(i, true) end, {
desc = 'Go to buffer ' .. i,
silent = true,
})
end

View File

@@ -3,6 +3,11 @@
--
-- See the kickstart.nvim README for more information
---@module 'lazy'
---@type LazySpec
return {}
-- Iterate over all Lua files in the plugins directory and load them
local plugins_dir = vim.fs.joinpath(vim.fn.stdpath 'config', 'lua', 'custom', 'plugins')
for file_name, type in vim.fs.dir(plugins_dir) do
if type == 'file' and file_name:match '%.lua$' and file_name ~= 'init.lua' then
local module = file_name:gsub('%.lua$', '')
require('custom.plugins.' .. module)
end
end

View File

@@ -0,0 +1,104 @@
-- ============================================================
-- LUALINE
-- Statusline
-- ============================================================
vim.pack.add {
{
src = 'https://github.com/nvim-lualine/lualine.nvim',
},
{
src = 'https://github.com/nvim-tree/nvim-web-devicons',
},
}
require('lualine').setup {
options = {
theme = 'onedark',
icons_enabled = true,
component_separators = {
left = '',
right = '',
},
section_separators = {
left = '',
right = '',
},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = true,
refresh = {
statusline = 100,
tabline = 100,
winbar = 100,
},
},
sections = {
lualine_a = { {
'mode',
upper = true,
} },
lualine_b = {
'branch',
'diff',
'diagnostics',
},
lualine_c = {
{
'filename',
path = 1,
},
},
lualine_x = {
{
'encoding',
show_bomb = true,
},
'fileformat',
'filetype',
},
lualine_y = {
'progress',
},
lualine_z = {
'location',
},
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_y = {},
lualine_z = {},
},
extensions = {
'trouble',
'quickfix',
'fzf',
'lazy',
'mason',
},
}

View File

@@ -0,0 +1,65 @@
-- ============================================================
-- TOGGLETERM
-- Floating terminal
-- ============================================================
vim.pack.add {
{
src = 'https://github.com/akinsho/toggleterm.nvim',
version = vim.version.range '*',
},
}
require('toggleterm').setup {
size = 20,
open_mapping = [[<leader>tt]],
hide_numbers = true,
shade_filetypes = {},
shade_terminals = true,
start_in_insert = true,
insert_mappings = true,
terminal_mappings = true,
persist_size = true,
persist_mode = true,
direction = 'float',
close_on_exit = true,
shell = vim.o.shell,
float_opts = {
border = 'rounded',
winblend = 0,
},
}
-- ============================================================
-- TERMINAL KEYMAPS
-- ============================================================
vim.api.nvim_create_autocmd('TermOpen', {
pattern = 'term://*',
callback = function()
local opts = { buffer = 0 }
-- ESC exits terminal insert mode
vim.keymap.set('t', '<Esc>', [[<C-\><C-n>]], opts)
-- Better window navigation
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
end,
})

View File

@@ -0,0 +1,67 @@
-- ============================================================
-- TROUBLE.NVIM
-- Better diagnostics / references / quickfix UI
-- ============================================================
vim.pack.add {
{
src = 'https://github.com/folke/trouble.nvim',
},
}
require('trouble').setup {
auto_close = false,
auto_open = false,
auto_preview = true,
focus = true,
modes = {
diagnostics = {
auto_open = false,
},
},
icons = {
indent = {
top = '',
middle = '├╴',
last = '└╴',
fold_open = '',
fold_closed = '',
ws = ' ',
},
},
}
local trouble = require 'trouble'
-- ============================================================
-- KEYMAPS
-- ============================================================
-- General diagnostics
vim.keymap.set('n', '<leader>xx', function() trouble.toggle 'diagnostics' end, { desc = 'Trouble: Diagnostics' })
-- Workspace diagnostics
vim.keymap.set('n', '<leader>xw', function() trouble.toggle 'workspace_diagnostics' end, { desc = 'Trouble: Workspace Diagnostics' })
-- Current buffer diagnostics
vim.keymap.set('n', '<leader>xd', function() trouble.toggle 'document_diagnostics' end, { desc = 'Trouble: Document Diagnostics' })
-- Quickfix
vim.keymap.set('n', '<leader>xq', function() trouble.toggle 'quickfix' end, { desc = 'Trouble: Quickfix' })
-- Location list
vim.keymap.set('n', '<leader>xl', function() trouble.toggle 'loclist' end, { desc = 'Trouble: Location List' })
-- LSP references
vim.keymap.set('n', 'gr', function() trouble.toggle 'lsp_references' end, { desc = 'Trouble: References' })
-- Symbols
vim.keymap.set('n', '<leader>xs', function() trouble.toggle 'symbols' end, { desc = 'Trouble: Symbols' })
-- Toggle previous/next diagnostics
vim.keymap.set('n', '[x', function() trouble.prev { skip_groups = true, jump = true } end, { desc = 'Previous Trouble Item' })
vim.keymap.set('n', ']x', function() trouble.next { skip_groups = true, jump = true } end, { desc = 'Next Trouble Item' })

View File

@@ -12,7 +12,7 @@ local check_version = function()
return
end
if vim.version.ge(vim.version(), '0.11') then
if vim.version.ge(vim.version(), '0.12') 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))

View File

@@ -1,10 +1,5 @@
-- autopairs
-- https://github.com/windwp/nvim-autopairs
---@module 'lazy'
---@type LazySpec
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
opts = {},
}
vim.pack.add { 'https://github.com/windwp/nvim-autopairs' }
require('nvim-autopairs').setup {}

View File

@@ -6,38 +6,25 @@
-- 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',
-- NOTE: And you can specify dependencies as well
dependencies = {
-- Creates a beautiful debugger UI
'rcarriga/nvim-dap-ui',
vim.pack.add {
'https://github.com/mfussenegger/nvim-dap',
'https://github.com/rcarriga/nvim-dap-ui',
'https://github.com/nvim-neotest/nvim-nio',
'https://github.com/mason-org/mason.nvim',
'https://github.com/jay-babu/mason-nvim-dap.nvim',
'https://github.com/leoluz/nvim-dap-go',
}
-- Required dependency for nvim-dap-ui
'nvim-neotest/nvim-nio',
-- Installs the debug adapters for you
'mason-org/mason.nvim',
'jay-babu/mason-nvim-dap.nvim',
-- 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' },
vim.keymap.set('n', '<F5>', function() require('dap').continue() end, { desc = 'Debug: Start/Continue' })
vim.keymap.set('n', '<F1>', function() require('dap').step_into() end, { desc = 'Debug: Step Into' })
vim.keymap.set('n', '<F2>', function() require('dap').step_over() end, { desc = 'Debug: Step Over' })
vim.keymap.set('n', '<F3>', function() require('dap').step_out() end, { desc = 'Debug: Step Out' })
vim.keymap.set('n', '<leader>b', function() require('dap').toggle_breakpoint() end, { desc = 'Debug: Toggle Breakpoint' })
vim.keymap.set('n', '<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()
vim.keymap.set('n', '<F7>', function() require('dapui').toggle() end, { desc = 'Debug: See last session result.' })
local dap = require 'dap'
local dapui = require 'dapui'
@@ -106,5 +93,3 @@ return {
detached = vim.fn.has 'win32' == 0,
},
}
end,
}

View File

@@ -2,14 +2,9 @@
-- 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 = {
vim.pack.add { 'https://github.com/lewis6991/gitsigns.nvim' }
require('gitsigns').setup {
on_attach = function(bufnr)
local gitsigns = require 'gitsigns'
@@ -59,5 +54,4 @@ return {
-- Text object
map({ 'o', 'x' }, 'ih', gitsigns.select_hunk)
end,
},
}

View File

@@ -1,13 +1,6 @@
-- Add indentation guides even on blank lines
---@module 'lazy'
---@type LazySpec
return {
'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help ibl`
main = 'ibl',
---@module 'ibl'
---@type ibl.config
opts = {},
}
vim.pack.add { 'https://github.com/lukas-reineke/indent-blankline.nvim' }
require('ibl').setup {}

View File

@@ -1,11 +1,7 @@
-- Linting
---@module 'lazy'
---@type LazySpec
return {
'mfussenegger/nvim-lint',
event = { 'BufReadPre', 'BufNewFile' },
config = function()
vim.pack.add { 'https://github.com/mfussenegger/nvim-lint' }
local lint = require 'lint'
lint.linters_by_ft = {
markdown = { 'markdownlint' }, -- Make sure to install `markdownlint` via mason / npm
@@ -55,5 +51,3 @@ return {
if vim.bo.modifiable then lint.try_lint() end
end,
})
end,
}

View File

@@ -1,28 +1,82 @@
-- Neo-tree is a Neovim plugin to browse the file system
-- https://github.com/nvim-neo-tree/neo-tree.nvim
-- ============================================================
-- NEO-TREE
-- File explorer
-- ============================================================
---@module 'lazy'
---@type LazySpec
return {
'nvim-neo-tree/neo-tree.nvim',
version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim',
local plugins = {
{
src = 'https://github.com/nvim-neo-tree/neo-tree.nvim',
version = vim.version.range '*',
},
lazy = false,
keys = {
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
},
---@module 'neo-tree'
---@type neotree.Config
opts = {
'https://github.com/nvim-lua/plenary.nvim',
'https://github.com/MunifTanjim/nui.nvim',
}
if vim.g.have_nerd_font then table.insert(plugins, 'https://github.com/nvim-tree/nvim-web-devicons') end
vim.pack.add(plugins)
-- ============================================================
-- KEYMAPS
-- ============================================================
vim.keymap.set('n', '<leader>e', '<Cmd>Neotree toggle<CR>', {
desc = 'Toggle NeoTree',
silent = true,
})
-- ============================================================
-- SETUP
-- ============================================================
require('neo-tree').setup {
close_if_last_window = true,
popup_border_style = 'rounded',
enable_git_status = true,
enable_diagnostics = true,
filesystem = {
window = {
mappings = {
['\\'] = 'close_window',
filtered_items = {
visible = false,
hide_dotfiles = false,
hide_gitignored = false,
},
follow_current_file = {
enabled = true,
},
use_libuv_file_watcher = true,
window = {
width = 32,
mappings = {
['<leader>e'] = 'close_window',
},
},
},
default_component_configs = {
indent = {
with_markers = true,
indent_size = 2,
},
git_status = {
symbols = {
added = '',
modified = '',
deleted = '',
renamed = '󰁕',
untracked = '',
ignored = '',
unstaged = '󰄱',
staged = '',
conflict = '',
},
},
},