From 1bdcd32bcc9287e4b86942ae65e5c7b5e120c946 Mon Sep 17 00:00:00 2001 From: Arastoo Khajehee Date: Fri, 20 Mar 2026 23:27:48 +0900 Subject: [PATCH 01/12] remaps --- init.lua | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) diff --git a/init.lua b/init.lua index ed50b69d7f3..a4e36a387d4 100644 --- a/init.lua +++ b/init.lua @@ -950,3 +950,132 @@ require('lazy').setup({ -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et +local map = vim.keymap.set + +local function with_telescope(callback) + local ok, builtin = pcall(require, 'telescope.builtin') + if ok and builtin then + callback(builtin) + return true + end + return false +end + +local function vscode_like_find_in_buffer() vim.api.nvim_feedkeys('/', 'n', false) end + +local function set_mark(is_global) + local label = is_global and 'Global mark (A-Z): ' or 'Local mark (a-z): ' + local mark = vim.fn.input(label) + if mark == '' then return end + mark = mark:sub(1, 1) + mark = is_global and mark:upper() or mark:lower() + if not mark:match(is_global and '[A-Z]' or '[a-z]') then + vim.notify('Invalid mark', vim.log.levels.WARN) + return + end + vim.cmd('mark ' .. mark) + vim.notify('Set mark ' .. mark) +end + +map('n', '', 'nohlsearch') +map('n', 'U', '') +map('n', 'j', 'gj') +map('n', 'k', 'gk') + +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true +vim.opt.smartindent = true +vim.opt.wrap = false +vim.opt.incsearch = true +vim.opt.ignorecase = true +vim.opt.smartcase = true +vim.opt.scrolloff = 8 +vim.opt.signcolumn = 'yes' +vim.opt.isfname:append '@-@' +vim.opt.colorcolumn = '100,120' +vim.opt.clipboard = 'unnamedplus' + +map({ 'n', 'v' }, 'y', '"+y', { noremap = true, silent = true }) +map('n', 'Y', '"+yy', { noremap = true, silent = true }) +map({ 'n', 'v' }, 'd', '"_d', { noremap = true, silent = true }) +map({ 'n', 'v' }, 'c', '"_c', { noremap = true, silent = true }) +map({ 'n', 'v' }, 'x', '"_x', { noremap = true, silent = true }) +map({ 'n', 'v' }, 'D', '"_D', { noremap = true, silent = true }) +map({ 'n', 'v' }, 'C', '"_C', { noremap = true, silent = true }) +map({ 'n', 'v' }, 's', '"_s', { noremap = true, silent = true }) +map({ 'n', 'v' }, 'S', '"_S', { noremap = true, silent = true }) +map('n', 'X', '"+x', { noremap = true, silent = true }) +map('v', 'X', '"+d', { noremap = true, silent = true }) +map('v', 'p', '"_dP', { noremap = true, silent = true }) +map('v', 'P', '"_dP', { noremap = true, silent = true }) + +map('v', 'J', ":m '>+1gv=gv") +map('v', 'K', ":m '<-2gv=gv") +map('n', 'J', 'mzJ`z') +map('n', '', 'zz') +map('n', '', 'zz') +map('n', 'n', 'nzzzv') +map('n', 'N', 'Nzzzv') +map('n', 'zig', 'LspRestart') + +map('i', '', function() return vim.fn.pumvisible() == 1 and '' or '' end, { expr = true }) +map('i', 'jj', '') + +map('n', 'f', vscode_like_find_in_buffer, { desc = 'Find in buffer' }) +map('n', 'r', [[:%s/\<\>//gc]], { desc = 'Replace current word' }) +map('x', 'r', [[:s/\%V//gc]], { desc = 'Replace in selection' }) + +map('n', 'd', function() + if vim.bo.filetype == 'markdown' then + local target = vim.fn.expand '' + if target ~= '' and vim.ui and vim.ui.open then + vim.ui.open(target) + return + end + end + vim.lsp.buf.definition() +end, { desc = 'Go to definition' }) + +map('n', 'D', function() vim.lsp.buf.references() end, { desc = 'Go to references' }) + +map('n', 'h', function() vim.lsp.buf.hover() end, { desc = 'Hover docs' }) + +map({ 'n', 'x' }, 'H', function() vim.lsp.buf.code_action() end, { desc = 'Code action' }) + +map('n', 'g', function() + if with_telescope(function(builtin) builtin.live_grep() end) then return end + vscode_like_find_in_buffer() +end, { desc = 'Search text' }) + +map('n', 'z', function() + if with_telescope(function(builtin) builtin.live_grep() end) then return end + vscode_like_find_in_buffer() +end, { desc = 'Global fuzzy search' }) + +map('n', 'o', function() + if with_telescope(function(builtin) builtin.find_files() end) then return end + vim.cmd 'edit .' +end, { desc = 'Find files' }) + +map('n', 'p', function() + if with_telescope(function(builtin) builtin.find_files() end) then return end + vim.cmd 'edit .' +end, { desc = 'Quick open' }) + +map('n', 's', function() + if with_telescope(function(builtin) builtin.lsp_document_symbols() end) then return end + vim.lsp.buf.document_symbol() +end, { desc = 'Document symbols' }) + +map('n', 'w', 'write', { desc = 'Save file' }) + +map('n', 'm', function() set_mark(false) end, { desc = 'Set local mark' }) + +map('n', 'M', function() set_mark(true) end, { desc = 'Set global mark' }) + +map('n', "'", 'marks', { desc = 'List marks' }) +map('n', '"', 'marks', { desc = 'List all marks' }) From fbdd010cc8f3c909a062f64ec75613b81c23b47b Mon Sep 17 00:00:00 2001 From: Arastoo Khajehee Date: Sun, 22 Mar 2026 00:48:23 +0900 Subject: [PATCH 02/12] added csharp lsp support --- init.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index a4e36a387d4..1f525a58826 100644 --- a/init.lua +++ b/init.lua @@ -602,7 +602,8 @@ require('lazy').setup({ local servers = { -- clangd = {}, -- gopls = {}, - -- pyright = {}, + pyright = {}, + omnisharp = {}, -- rust_analyzer = {}, -- -- Some languages (like typescript) have entire language plugins that can be useful: @@ -900,6 +901,17 @@ require('lazy').setup({ end, }, + -- inline markdown + { + 'MeanderingProgrammer/render-markdown.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-mini/mini.nvim' }, -- if you use the mini.nvim suite + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-mini/mini.icons' }, -- if you use standalone mini plugins + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons + ---@module 'render-markdown' + ---@type render.md.UserConfig + opts = {}, + }, + -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the -- init.lua. If you want these files, they are in the repository, so you can just download them and -- place them in the correct locations. From d92b2e58f169a1c8cbf7f53c24d447093df0fd8d Mon Sep 17 00:00:00 2001 From: Arastoo Khajehee Date: Sun, 22 Mar 2026 12:20:02 +0900 Subject: [PATCH 03/12] added csharp lsp --- init.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 1f525a58826..eeb8dd61718 100644 --- a/init.lua +++ b/init.lua @@ -603,7 +603,16 @@ require('lazy').setup({ -- clangd = {}, -- gopls = {}, pyright = {}, - omnisharp = {}, + csharp_ls = { + root_dir = function(bufnr, on_dir) + local util = require 'lspconfig.util' + local fname = vim.api.nvim_buf_get_name(bufnr) + on_dir( + util.root_pattern('*.sln', '*.slnx', '*.csproj', 'global.json')(fname) + or vim.fs.root(fname, function(name) return vim.tbl_contains({ '*.sln', '*.slnx' }, name) end) + ) + end, + }, -- omnisharp = {}, -- rust_analyzer = {}, -- -- Some languages (like typescript) have entire language plugins that can be useful: From 9b28947752966a8d1a01823b3a9fb99f9e786ec0 Mon Sep 17 00:00:00 2001 From: Arastoo Khajehee Date: Mon, 30 Mar 2026 15:43:05 +0900 Subject: [PATCH 04/12] added image rendering for markdown --- init.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/init.lua b/init.lua index eeb8dd61718..92ad695142b 100644 --- a/init.lua +++ b/init.lua @@ -921,6 +921,26 @@ require('lazy').setup({ opts = {}, }, + { + '3rd/image.nvim', + config = function() + require('image').setup { + integrations = { + markdown = { + resolve_image_path = function(document_path, image_path, fallback) + -- document_path is the path to the file that contains the image + -- image_path is the potentially relative path to the image. for + -- markdown it's `![](this text)` + + -- you can call the fallback function to get the default behavior + return fallback(document_path, image_path) + end, + }, + }, + } + end, + }, + -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the -- init.lua. If you want these files, they are in the repository, so you can just download them and -- place them in the correct locations. From b1e353c5a47aca6a86887ce620b6007f24983881 Mon Sep 17 00:00:00 2001 From: Arastoo Khajehee Date: Mon, 30 Mar 2026 17:40:20 +0900 Subject: [PATCH 05/12] uuid plugin --- init.lua | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 92ad695142b..27c8e93f2cf 100644 --- a/init.lua +++ b/init.lua @@ -770,7 +770,7 @@ require('lazy').setup({ -- : Toggle signature help -- -- See :h blink-cmp-config-keymap for defining your own keymap - preset = 'default', + preset = 'super-tab', -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps @@ -921,6 +921,7 @@ require('lazy').setup({ opts = {}, }, + -- image render { '3rd/image.nvim', config = function() @@ -941,6 +942,17 @@ require('lazy').setup({ end, }, + { + 'TrevorS/uuid-nvim', + lazy = true, + config = function() + -- optional configuration + require('uuid-nvim').setup { + case = 'upper', + } + end, + }, + -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the -- init.lua. If you want these files, they are in the repository, so you can just download them and -- place them in the correct locations. @@ -1120,3 +1132,12 @@ map('n', 'M', function() set_mark(true) end, { desc = 'Set global mark' map('n', "'", 'marks', { desc = 'List marks' }) map('n', '"', 'marks', { desc = 'List all marks' }) + +local uuid = require 'uuid-nvim' +uuid.setup { + case = 'lower', + quotes = 'single', +} + +-- vim.keymap.set('n', 'ut', uuid.toggle_highlighting) +vim.keymap.set('n', 'uu', uuid.insert_v4) From c4bbcf9d253fc2250c72bb449a1d4a70e85907b7 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 1 Apr 2026 06:32:39 +0000 Subject: [PATCH 06/12] better markdown --- init.lua | 195 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 189 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 27c8e93f2cf..d562af7e8c2 100644 --- a/init.lua +++ b/init.lua @@ -913,12 +913,195 @@ require('lazy').setup({ -- inline markdown { 'MeanderingProgrammer/render-markdown.nvim', - dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-mini/mini.nvim' }, -- if you use the mini.nvim suite - -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-mini/mini.icons' }, -- if you use standalone mini plugins - -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons - ---@module 'render-markdown' - ---@type render.md.UserConfig - opts = {}, + dependencies = { 'nvim-treesitter/nvim-treesitter' }, + config = function() + local function get_hl(name) + local ok, hl = pcall(vim.api.nvim_get_hl, 0, { name = name, link = false }) + if ok then return hl end + return {} + end + + local function apply_highlights() + local normal = get_hl 'Normal' + local normal_float = get_hl 'NormalFloat' + local color_column = get_hl 'ColorColumn' + local comment = get_hl 'Comment' + + local code_bg = color_column.bg or normal_float.bg or normal.bg + local quote_fg = comment.fg or normal.fg + + for i = 1, 6 do + vim.api.nvim_set_hl(0, 'RenderMarkdownH' .. i, { + fg = 'fg', + bold = true, + }) + + vim.api.nvim_set_hl(0, 'RenderMarkdownH' .. i .. 'Bg', { + fg = 'fg', + bg = 'NONE', + bold = true, + }) + end + + vim.api.nvim_set_hl(0, 'RenderMarkdownBullet', { + fg = 'fg', + }) + + vim.api.nvim_set_hl(0, 'RenderMarkdownUnchecked', { + fg = 'fg', + }) + + vim.api.nvim_set_hl(0, 'RenderMarkdownChecked', { + fg = 'fg', + }) + + for i = 1, 6 do + vim.api.nvim_set_hl(0, 'RenderMarkdownQuote' .. i, { + fg = quote_fg or 'fg', + }) + end + + if code_bg then + vim.api.nvim_set_hl(0, 'RenderMarkdownCode', { + bg = code_bg, + }) + + vim.api.nvim_set_hl(0, 'RenderMarkdownCodeBorder', { + bg = code_bg, + }) + + vim.api.nvim_set_hl(0, 'RenderMarkdownCodeInline', { + bg = code_bg, + }) + else + vim.api.nvim_set_hl(0, 'RenderMarkdownCode', { + bg = 'NONE', + }) + + vim.api.nvim_set_hl(0, 'RenderMarkdownCodeBorder', { + bg = 'NONE', + }) + + vim.api.nvim_set_hl(0, 'RenderMarkdownCodeInline', { + bg = 'NONE', + }) + end + end + + apply_highlights() + + vim.api.nvim_create_autocmd('ColorScheme', { + callback = apply_highlights, + }) + + require('render-markdown').setup { + sign = { + enabled = false, + }, + + heading = { + sign = false, + icons = { '', '', '', '', '', '' }, + position = 'inline', + width = 'block', + left_margin = 0, + left_pad = 0, + right_pad = 0, + border = { true, true, false, false, false, false }, + above = ' ', + below = '━', + foregrounds = { + 'RenderMarkdownH1', + 'RenderMarkdownH2', + 'RenderMarkdownH3', + 'RenderMarkdownH4', + 'RenderMarkdownH5', + 'RenderMarkdownH6', + }, + backgrounds = { + 'RenderMarkdownH1Bg', + 'RenderMarkdownH2Bg', + 'RenderMarkdownH3Bg', + 'RenderMarkdownH4Bg', + 'RenderMarkdownH5Bg', + 'RenderMarkdownH6Bg', + }, + }, + + paragraph = { + left_margin = 0, + indent = 0, + }, + + bullet = { + icons = { '•', '◦', '▪' }, + left_pad = 0, + right_pad = 1, + highlight = 'RenderMarkdownBullet', + }, + + checkbox = { + bullet = false, + left_pad = 0, + right_pad = 1, + unchecked = { + icon = '☐ ', + highlight = 'RenderMarkdownUnchecked', + }, + checked = { + icon = '☑ ', + highlight = 'RenderMarkdownChecked', + }, + }, + + quote = { + icon = '│', + repeat_linebreak = false, + highlight = { + 'RenderMarkdownQuote1', + 'RenderMarkdownQuote2', + 'RenderMarkdownQuote3', + 'RenderMarkdownQuote4', + 'RenderMarkdownQuote5', + 'RenderMarkdownQuote6', + }, + }, + + code = { + style = 'normal', + border = 'none', + width = 'full', + left_margin = 0, + left_pad = 0, + right_pad = 0, + inline = true, + inline_left = '', + inline_right = '', + inline_pad = 0, + highlight = 'RenderMarkdownCode', + highlight_border = 'RenderMarkdownCodeBorder', + highlight_inline = 'RenderMarkdownCodeInline', + }, + + pipe_table = { + preset = 'none', + cell = 'padded', + padding = 1, + border_enabled = true, + style = 'full', + }, + + link = { + hyperlink = '', + email = '', + image = '', + wiki = { + enabled = false, + }, + custom = {}, + }, + } + end, }, -- image render From 45c688cc12ae3c3f1888a0912cf267a9c0bfcce9 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 2 Apr 2026 07:07:05 +0000 Subject: [PATCH 07/12] diagrams --- init.lua | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index d562af7e8c2..f11bfc5d39e 100644 --- a/init.lua +++ b/init.lua @@ -921,13 +921,28 @@ require('lazy').setup({ return {} end + local function lighten(color, amount) + if type(color) ~= 'number' then return color end + + local r = math.floor(color / 0x10000) % 0x100 + local g = math.floor(color / 0x100) % 0x100 + local b = color % 0x100 + + r = math.min(255, math.floor(r + (255 - r) * amount + 0.5)) + g = math.min(255, math.floor(g + (255 - g) * amount + 0.5)) + b = math.min(255, math.floor(b + (255 - b) * amount + 0.5)) + + return r * 0x10000 + g * 0x100 + b + end + local function apply_highlights() local normal = get_hl 'Normal' local normal_float = get_hl 'NormalFloat' local color_column = get_hl 'ColorColumn' local comment = get_hl 'Comment' - local code_bg = color_column.bg or normal_float.bg or normal.bg + local code_bg_base = color_column.bg or normal_float.bg or normal.bg + local code_bg = lighten(code_bg_base, 0.10) local quote_fg = comment.fg or normal.fg for i = 1, 6 do @@ -1009,7 +1024,7 @@ require('lazy').setup({ right_pad = 0, border = { true, true, false, false, false, false }, above = ' ', - below = '━', + below = '.', foregrounds = { 'RenderMarkdownH1', 'RenderMarkdownH2', @@ -1124,6 +1139,48 @@ require('lazy').setup({ } end, }, + +{ + "3rd/diagram.nvim", + dependencies = { + { "3rd/image.nvim", opts = {} }, -- you'd probably want to configure image.nvim manually instead of doing this + }, + opts = { -- you can just pass {}, defaults below + events = { + render_buffer = { "InsertLeave", "BufWinEnter", "TextChanged" }, + clear_buffer = {"BufLeave"}, + }, + renderer_options = { + mermaid = { + background = nil, -- nil | "transparent" | "white" | "#hex" + theme = nil, -- nil | "default" | "dark" | "forest" | "neutral" + scale = 1, -- nil | 1 (default) | 2 | 3 | ... + width = nil, -- nil | 800 | 400 | ... + height = nil, -- nil | 600 | 300 | ... + cli_args = nil, -- nil | { "--no-sandbox" } | { "-p", "/path/to/puppeteer" } | ... + }, + plantuml = { + charset = nil, + cli_args = nil, -- nil | { "-Djava.awt.headless=true" } | ... + }, + d2 = { + theme_id = nil, + dark_theme_id = nil, + scale = nil, + layout = nil, + sketch = nil, + cli_args = nil, -- nil | { "--pad", "0" } | ... + }, + gnuplot = { + size = nil, -- nil | "800,600" | ... + font = nil, -- nil | "Arial,12" | ... + theme = nil, -- nil | "light" | "dark" | custom theme string + cli_args = nil, -- nil | { "-p" } | { "-c", "config.plt" } | ... + }, + } + }, +}, + { 'TrevorS/uuid-nvim', @@ -1225,7 +1282,7 @@ vim.opt.softtabstop = 4 vim.opt.shiftwidth = 4 vim.opt.expandtab = true vim.opt.smartindent = true -vim.opt.wrap = false +vim.opt.wrap = true vim.opt.incsearch = true vim.opt.ignorecase = true vim.opt.smartcase = true From 068177ebebc0918165e3839740dea08a4293e4e0 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 2 Apr 2026 22:16:31 +0000 Subject: [PATCH 08/12] removed diagrams --- init.lua | 81 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/init.lua b/init.lua index f11bfc5d39e..c9a23ffb5dc 100644 --- a/init.lua +++ b/init.lua @@ -1139,48 +1139,47 @@ require('lazy').setup({ } end, }, - -{ - "3rd/diagram.nvim", - dependencies = { - { "3rd/image.nvim", opts = {} }, -- you'd probably want to configure image.nvim manually instead of doing this - }, - opts = { -- you can just pass {}, defaults below - events = { - render_buffer = { "InsertLeave", "BufWinEnter", "TextChanged" }, - clear_buffer = {"BufLeave"}, - }, - renderer_options = { - mermaid = { - background = nil, -- nil | "transparent" | "white" | "#hex" - theme = nil, -- nil | "default" | "dark" | "forest" | "neutral" - scale = 1, -- nil | 1 (default) | 2 | 3 | ... - width = nil, -- nil | 800 | 400 | ... - height = nil, -- nil | 600 | 300 | ... - cli_args = nil, -- nil | { "--no-sandbox" } | { "-p", "/path/to/puppeteer" } | ... - }, - plantuml = { - charset = nil, - cli_args = nil, -- nil | { "-Djava.awt.headless=true" } | ... - }, - d2 = { - theme_id = nil, - dark_theme_id = nil, - scale = nil, - layout = nil, - sketch = nil, - cli_args = nil, -- nil | { "--pad", "0" } | ... - }, - gnuplot = { - size = nil, -- nil | "800,600" | ... - font = nil, -- nil | "Arial,12" | ... - theme = nil, -- nil | "light" | "dark" | custom theme string - cli_args = nil, -- nil | { "-p" } | { "-c", "config.plt" } | ... - }, - } - }, -}, + -- { + -- "3rd/diagram.nvim", + -- dependencies = { + -- { "3rd/image.nvim", opts = {} }, -- you'd probably want to configure image.nvim manually instead of doing this + -- }, + -- opts = { -- you can just pass {}, defaults below + -- events = { + -- render_buffer = { "InsertLeave", "BufWinEnter", "TextChanged" }, + -- clear_buffer = {"BufLeave"}, + -- }, + -- renderer_options = { + -- mermaid = { + -- background = nil, -- nil | "transparent" | "white" | "#hex" + -- theme = nil, -- nil | "default" | "dark" | "forest" | "neutral" + -- scale = 1, -- nil | 1 (default) | 2 | 3 | ... + -- width = nil, -- nil | 800 | 400 | ... + -- height = nil, -- nil | 600 | 300 | ... + -- cli_args = nil, -- nil | { "--no-sandbox" } | { "-p", "/path/to/puppeteer" } | ... + -- }, + -- plantuml = { + -- charset = nil, + -- cli_args = nil, -- nil | { "-Djava.awt.headless=true" } | ... + -- }, + -- d2 = { + -- theme_id = nil, + -- dark_theme_id = nil, + -- scale = nil, + -- layout = nil, + -- sketch = nil, + -- cli_args = nil, -- nil | { "--pad", "0" } | ... + -- }, + -- gnuplot = { + -- size = nil, -- nil | "800,600" | ... + -- font = nil, -- nil | "Arial,12" | ... + -- theme = nil, -- nil | "light" | "dark" | custom theme string + -- cli_args = nil, -- nil | { "-p" } | { "-c", "config.plt" } | ... + -- }, + -- } + -- }, + -- }, { 'TrevorS/uuid-nvim', From 27fb42c854e8599ed74a553a1fdcef7278eea77b Mon Sep 17 00:00:00 2001 From: Ori Perry Date: Fri, 20 Mar 2026 21:59:19 +0200 Subject: [PATCH 09/12] Refactor treesitter attach code --- init.lua | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index c9a23ffb5dc..8280674b57c 100644 --- a/init.lua +++ b/init.lua @@ -884,8 +884,28 @@ require('lazy').setup({ branch = 'main', -- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro` config = function() + -- ensure basic parser are installed local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' } require('nvim-treesitter').install(parsers) + + ---@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' + + -- enables treesitter based indentation + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + end + + local available_parsers = require('nvim-treesitter').get_available() vim.api.nvim_create_autocmd('FileType', { callback = function(args) local buf, filetype = args.buf, args.match @@ -893,18 +913,7 @@ require('lazy').setup({ local language = vim.treesitter.language.get_lang(filetype) if not language then return end - -- 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' - - -- enables treesitter based indentation - vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + treesitter_try_attach(buf, language) end, }) end, From 0c66cdaaf0d7323d4d70d42a5c9e6c700cffe445 Mon Sep 17 00:00:00 2001 From: Ori Perry Date: Fri, 20 Mar 2026 22:02:36 +0200 Subject: [PATCH 10/12] Auto install treesitter parsers when opening a file closes #1951 --- init.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 8280674b57c..a157f250aed 100644 --- a/init.lua +++ b/init.lua @@ -913,7 +913,18 @@ require('lazy').setup({ local language = vim.treesitter.language.get_lang(filetype) if not language then return end - treesitter_try_attach(buf, language) + local installed_parsers = require('nvim-treesitter').get_installed 'parsers' + + 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, }) end, From 2a49cccf8ebf2bc3916af5118cc411bdb15b962e Mon Sep 17 00:00:00 2001 From: Ori Perry Date: Tue, 31 Mar 2026 23:41:27 +0300 Subject: [PATCH 11/12] Update the recommanded gitsigns keybinds closes #1459 --- lua/kickstart/plugins/gitsigns.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lua/kickstart/plugins/gitsigns.lua b/lua/kickstart/plugins/gitsigns.lua index 5f5652f9249..1d8c50c37db 100644 --- a/lua/kickstart/plugins/gitsigns.lua +++ b/lua/kickstart/plugins/gitsigns.lua @@ -44,15 +44,20 @@ return { map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) map('n', 'hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) - map('n', 'hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' }) map('n', 'hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) - map('n', 'hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) + map('n', 'hi', gitsigns.preview_hunk_inline, { desc = 'git preview hunk [i]nline' }) + map('n', 'hb', function() gitsigns.blame_line { full = true } end, { desc = 'git [b]lame line' }) map('n', 'hd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) map('n', 'hD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' }) + map('n', 'hQ', function() gitsigns.setqflist 'all' end) + map('n', 'hq', gitsigns.setqflist) -- Toggles map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) - map('n', 'tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' }) + map('n', 'tw', gitsigns.toggle_word_diff) + + -- Text object + map({ 'o', 'x' }, 'ih', gitsigns.select_hunk) end, }, } From 31f404dd5d0abe296900e5d0c32fcafe317c5c14 Mon Sep 17 00:00:00 2001 From: Ori Perry Date: Tue, 31 Mar 2026 23:49:19 +0300 Subject: [PATCH 12/12] Add a comment to the line plugin about installing markdownlint --- lua/kickstart/plugins/lint.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index 326fc3f6a3a..556f3178811 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -8,7 +8,7 @@ return { config = function() local lint = require 'lint' lint.linters_by_ft = { - markdown = { 'markdownlint' }, + markdown = { 'markdownlint' }, -- Make sure to install `markdownlint` via mason / npm } -- To allow other plugins to add linters to require('lint').linters_by_ft,