Merge branch 'master' of https://github.com/nvim-lua/kickstart.nvim into sync_from_upstream

This commit is contained in:
Abdulrahman Sheikho 2026-04-25 16:54:03 +03:00
commit b97232e6f9
9 changed files with 96 additions and 39 deletions

7
.gitignore vendored
View File

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

View File

@ -262,7 +262,7 @@ available methods being discussed
<details><summary>Bob</summary> <details><summary>Bob</summary>
[Bob](https://github.com/MordechaiHadad/bob) is a Neovim version manager for [Bob](https://github.com/MordechaiHadad/bob) is a Neovim version manager for
all plattforms. Simply install all platforms. Simply install
[rustup](https://rust-lang.github.io/rustup/installation/other.html), [rustup](https://rust-lang.github.io/rustup/installation/other.html),
and run the following commands: and run the following commands:

View File

@ -1,5 +1,7 @@
return { return {
on_init = function(client) on_init = function(client)
client.server_capabilities.documentFormattingProvider = false -- Disable formatting (formatting is done by stylua)
if client.workspace_folders then if client.workspace_folders then
local path = client.workspace_folders[1].name local path = client.workspace_folders[1].name
if if
@ -32,7 +34,10 @@ return {
}, },
}) })
end, end,
---@type lspconfig.settings.lua_ls
settings = { settings = {
Lua = {}, Lua = {
format = { enable = false }, -- Disable formatting (formatting is done by stylua)
},
}, },
} }

View File

@ -63,7 +63,7 @@ Langs = {
}, },
fmt = { fmt = {
lua = { 'stylua' }, -- lua = { 'stylua' }, -- see [Use stylua as an lsp formatter instead of an external formatter · nvim-lua/kickstart.nvim@459b868](https://github.com/nvim-lua/kickstart.nvim/commit/459b86865e9e81235c9db3be553d107adac5f72f)
sh = { 'shfmt' }, sh = { 'shfmt' },
bash = { 'shfmt' }, bash = { 'shfmt' },
python = { 'ruff_format' }, python = { 'ruff_format' },

View File

@ -7,7 +7,7 @@ return {
{ {
'<leader>F', '<leader>F',
function() function()
require('conform').format { async = true, lsp_format = 'fallback' } require('conform').format { async = true }
end, end,
mode = '', mode = '',
desc = '[F]ormat buffer', desc = '[F]ormat buffer',
@ -18,20 +18,28 @@ return {
opts = { opts = {
notify_on_error = true, notify_on_error = true,
format_on_save = function(bufnr) format_on_save = function(bufnr)
-- Disable "format_on_save lsp_fallback" for languages that don't -- NOTE:
-- have a well standardized coding style. You can add additional -- See:
-- languages here or re-enable it for the disabled ones. -- - [Change format_on_save to a whitelist instead of a blacklist · nvim-lua/kickstart.nvim@ce353a9](https://github.com/nvim-lua/kickstart.nvim/commit/ce353a9b0e3c47d27784509217200818f522329e)
local disable_filetypes = { c = true, cpp = true } -- - [please disable autoformat on save in default configuration · Issue #1819 · nvim-lua/kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim/issues/1819)
if disable_filetypes[vim.bo[bufnr].filetype] then
return nil -- You can specify filetypes to autoformat on save here:
else local enabled_filetypes = {
return { lua = true,
timeout_ms = 500, -- python = true,
lsp_format = 'fallback', }
} if enabled_filetypes[vim.bo[bufnr].filetype] then
return { timeout_ms = 500 }
end end
return nil
end, end,
default_format_opts = {
lsp_format = 'fallback', -- Use external formatters if configured below, otherwise use LSP formatting. Set to `false` to disable LSP formatting entirely.
},
-- You can also specify external formatters in here.
formatters_by_ft = Langs.fmt, formatters_by_ft = Langs.fmt,
-- Example
-- rust = { 'rustfmt' },
-- Conform can also run multiple formatters sequentially -- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" }, -- python = { "isort", "black" },
-- --

View File

@ -1,4 +1,7 @@
-- Adds git related signs to the gutter, as well as utilities for managing changes -- Adds git related signs to the gutter, as well as utilities for managing changes
---@module 'lazy'
---@type LazySpec
return { return {
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
---@module 'gitsigns' ---@module 'gitsigns'
@ -50,17 +53,26 @@ return {
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
map('n', '<leader>hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' })
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) map('n', '<leader>hi', gitsigns.preview_hunk_inline, { desc = 'git preview hunk [i]nline' })
map('n', '<leader>hb', function()
gitsigns.blame_line { full = true }
end, { desc = 'git [b]lame line' })
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
map('n', '<leader>hD', function() map('n', '<leader>hD', function()
gitsigns.diffthis '@' gitsigns.diffthis '@'
end, { desc = 'git [D]iff against last commit' }) end, { desc = 'git [D]iff against last commit' })
map('n', '<leader>hQ', function()
gitsigns.setqflist 'all'
end, { desc = 'git hunk [Q]uickfix list (all files in repo)' })
map('n', '<leader>hq', gitsigns.setqflist, { desc = 'git hunk [q]uickfix list (all changes in this file)' })
-- Toggles -- Toggles
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' }) map('n', '<leader>tW', gitsigns.toggle_word_diff, { desc = '[T]oggle git intra-line [w]ord diff' })
-- Text object
map({ 'o', 'x' }, 'ih', gitsigns.select_hunk)
end, end,
}, },
} }

View File

@ -6,9 +6,16 @@ return {
-- --
-- Examples: -- Examples:
-- - va) - [V]isually select [A]round [)]paren -- - va) - [V]isually select [A]round [)]paren
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote -- - yiiq - [Y]ank [I]nside [I]next [Q]uote
-- - ci' - [C]hange [I]nside [']quote -- - ci' - [C]hange [I]nside [']quote
require('mini.ai').setup { n_lines = 500 } require('mini.ai').setup {
-- NOTE: Avoid conflicts with the built-in incremental selection mappings on Neovim>=0.12 (see `:help treesitter-incremental-selection`)
mappings = {
around_next = 'aa',
inside_next = 'ii',
},
n_lines = 500,
}
-- Add/delete/replace surroundings (brackets, quotes, etc.) -- Add/delete/replace surroundings (brackets, quotes, etc.)
-- --

View File

@ -24,9 +24,6 @@ return {
-- Useful status updates for LSP. -- Useful status updates for LSP.
{ 'j-hui/fidget.nvim', opts = {} }, { 'j-hui/fidget.nvim', opts = {} },
-- Allows extra capabilities provided by blink.cmp
'saghen/blink.cmp',
}, },
config = function() config = function()
-- Brief aside: **What is LSP?** -- Brief aside: **What is LSP?**

View File

@ -7,6 +7,33 @@ return {
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro` -- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
config = function() config = function()
require('nvim-treesitter').install(Langs.treesitter) require('nvim-treesitter').install(Langs.treesitter)
---@param buf integer
---@param language string
local function treesitter_try_attach(buf, language)
-- check if parser exists and load it
if not vim.treesitter.language.add(language) then
return
end
-- enables syntax highlighting and other treesitter features
vim.treesitter.start(buf, language)
-- enables treesitter based folds
-- for more info on folds see `:help folds`
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
-- vim.wo.foldmethod = 'expr'
-- check if treesitter indentation is available for this language, and if so enable it
-- in case there is no indent query, the indentexpr will fallback to the vim's built in one
local has_indent_query = vim.treesitter.query.get(language, 'indents') ~= nil
-- enables treesitter based indentation
if has_indent_query then
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end
end
local available_parsers = require('nvim-treesitter').get_available()
vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', {
callback = function(args) callback = function(args)
local buf, filetype = args.buf, args.match local buf, filetype = args.buf, args.match
@ -16,20 +43,20 @@ return {
return return
end end
-- check if parser exists and load it local installed_parsers = require('nvim-treesitter').get_installed 'parsers'
if not vim.treesitter.language.add(language) then
return if vim.tbl_contains(installed_parsers, language) then
-- enable the parser if it is installed
treesitter_try_attach(buf, language)
elseif vim.tbl_contains(available_parsers, language) then
-- if a parser is available in `nvim-treesitter` auto install it, and enable it after the installation is done
require('nvim-treesitter').install(language):await(function()
treesitter_try_attach(buf, language)
end)
else
-- try to enable treesitter features in case the parser exists but is not available from `nvim-treesitter`
treesitter_try_attach(buf, language)
end end
-- enables syntax highlighting and other treesitter features
vim.treesitter.start(buf, language)
-- enables treesitter based folds
-- for more info on folds see `:help folds`
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
-- vim.wo.foldmethod = 'expr'
-- enables treesitter based indentation
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end, end,
}) })
end, end,