From 4488f8549adb2f75ae36a8511b1ad3217584538b Mon Sep 17 00:00:00 2001 From: Albin Chaboissier Date: Sat, 11 Apr 2026 10:05:15 +0200 Subject: [PATCH] heheheha --- lua/config.lua | 2 +- lua/plugins/flash.lua | 11 +++++----- lua/plugins/git.lua | 51 +++++++++++++++++++++++++++++++++++++++++++ lua/plugins/init.lua | 1 + lua/plugins/lsp.lua | 23 +++++++------------ lua/plugins/mini.lua | 27 ++++++++++++++++++++--- nvim-pack-lock.json | 4 ++++ 7 files changed, 95 insertions(+), 24 deletions(-) create mode 100644 lua/plugins/git.lua diff --git a/lua/config.lua b/lua/config.lua index 1e23a0b..14925f8 100644 --- a/lua/config.lua +++ b/lua/config.lua @@ -5,7 +5,7 @@ vim.g.maplocalleader = "\\" vim.opt.shortmess:append("c") -- Sets the height of the command line area at the bottom -vim.opt.cmdheight = 2 +vim.opt.cmdheight = 1 -- Displays the line number for the current line vim.opt.number = true diff --git a/lua/plugins/flash.lua b/lua/plugins/flash.lua index d80ca5d..aaffd8d 100644 --- a/lua/plugins/flash.lua +++ b/lua/plugins/flash.lua @@ -10,10 +10,11 @@ require("flash").setup({ } }) -vim.keymap.set({ "n", "x", "o" }, "s", function() require("flash").jump() end) -vim.keymap.set({ "n", "x", "o" }, "S", function() require("flash").treesitter() end) -vim.keymap.set({ "o" }, "r", function() require("flash").remote() end) -vim.keymap.set({ "o", "x" }, "R", function() require("flash").treesitter_search() end) -vim.keymap.set({ "c" }, "", function() require("flash").toggle() end) +Flash = require("flash") +vim.keymap.set({ "n", "x", "o" }, "s", function() Flash.jump() end) +vim.keymap.set({ "n", "x", "o" }, "S", function() Flash.treesitter() end) +vim.keymap.set({ "o" }, "r", function() Flash.remote() end) +vim.keymap.set({ "o", "x" }, "R", function() Flash.treesitter_search() end) +vim.keymap.set({ "c" }, "", function() Flash.toggle() end) diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua new file mode 100644 index 0000000..60438b4 --- /dev/null +++ b/lua/plugins/git.lua @@ -0,0 +1,51 @@ +vim.pack.add({ "https://github.com/lewis6991/gitsigns.nvim" }) + +require('gitsigns').setup { + signs = { + add = { text = '┃' }, + change = { text = '┃' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + untracked = { text = '┆' }, + }, + signs_staged = { + add = { text = '┃' }, + change = { text = '┃' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + untracked = { text = '┆' }, + }, + signs_staged_enable = true, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + follow_files = true + }, + auto_attach = true, + attach_to_untracked = false, + current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + ignore_whitespace = false, + virt_text_priority = 100, + use_focus = true, + }, + current_line_blame_formatter = ', - ', + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, -- Disable if file is longer than this (in lines) + preview_config = { + -- Options passed to nvim_open_win + style = 'minimal', + relative = 'cursor', + row = 0, + col = 1 + }, +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 5eae876..cde5d66 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -8,3 +8,4 @@ require("plugins.multicursor") require("plugins.lsplines") require("plugins.mini") require("plugins.flash") +require("plugins.git") diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 98ff23d..905036d 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,4 +1,5 @@ vim.pack.add({ 'https://github.com/neovim/nvim-lspconfig' }) + vim.lsp.enable({ 'lua_ls' }) vim.lsp.enable({ 'clangd' }) @@ -7,25 +8,17 @@ vim.lsp.config("rust_analyzer", { ["rust-analyzer"] = { completion = { - postfix = { enable = false, }, + postfix = { enable = true, }, }, - } - }, -}) -vim.lsp.enable('rust_analyzer', { - settings = { - ['rust-analyzer'] = { - completion = { - postfix = { - enable = true, -- Postfix snippets + ['rust-analyzer'] = { + check = { + command = "clippy", }, - }, - check = { - command = "clippy", - }, + } }, - }, + } }) +vim.lsp.enable('rust_analyzer') vim.keymap.set("n", "t", vim.diagnostic.open_float) vim.keymap.set("n", "sr", vim.lsp.buf.rename) diff --git a/lua/plugins/mini.lua b/lua/plugins/mini.lua index d693289..b77bcb4 100644 --- a/lua/plugins/mini.lua +++ b/lua/plugins/mini.lua @@ -1,6 +1,27 @@ -vim.pack.add({"https://github.com/nvim-mini/mini.surround"}) -require('mini.surround').setup() +vim.pack.add({ "https://github.com/nvim-mini/mini.surround" }) +require('mini.surround').setup({ + mappings = { + add = 'ma', -- Add surrounding in Normal and Visual modes + delete = 'md', -- Delete surrounding + find = 'mf', -- Find surrounding (to the right) + find_left = 'mF', -- Find surrounding (to the left) + highlight = 'mh', -- Highlight surrounding + replace = 'mr', -- Replace surrounding + + suffix_last = 'l', -- Suffix to search with "prev" method + suffix_next = 'n', -- Suffix to search with "next" method + }, + + -- To remove default spaces that are added by default + custom_surroundings = { + ['('] = { input = { '%b()', '^.().*().$' }, output = { left = '(', right = ')' } }, + ['['] = { input = { '%b[]', '^.().*().$' }, output = { left = '[', right = ']' } }, + ['{'] = { input = { '%b{}', '^.().*().$' }, output = { left = '{', right = '}' } }, + ['<'] = { input = { '%b<>', '^.().*().$' }, output = { left = '<', right = '>' } }, + }, + +}) -- Comments -vim.pack.add({"https://github.com/nvim-mini/mini.comment"}) +vim.pack.add({ "https://github.com/nvim-mini/mini.comment" }) require('mini.comment').setup() diff --git a/nvim-pack-lock.json b/nvim-pack-lock.json index 753c35a..848b5b6 100644 --- a/nvim-pack-lock.json +++ b/nvim-pack-lock.json @@ -16,6 +16,10 @@ "rev": "fcea7ff883235d9024dc41e638f164a450c14ca2", "src": "https://github.com/folke/flash.nvim" }, + "gitsigns.nvim": { + "rev": "8d82c240f190fc33723d48c308ccc1ed8baad69d", + "src": "https://github.com/lewis6991/gitsigns.nvim" + }, "lsp_lines.nvim": { "rev": "a92c755f182b89ea91bd8a6a2227208026f27b4d", "src": "https://git.sr.ht/~whynothugo/lsp_lines.nvim"