From bfe5ef76b95725451707f6061d5dfa5e3b024c61 Mon Sep 17 00:00:00 2001 From: "beeb5k (Vivek Tiwari)" Date: Thu, 4 Jun 2026 20:25:23 +0530 Subject: Use better Plugins - codediff - neogit - nvim-surround - hlchunk - fff.nvim - gitsigns --- colors/matugen.lua | 97 +++++++------- flake.lock | 41 ++++-- flake.nix | 4 + init.lua | 42 +++--- lua/bee/LSPs/init.lua | 325 +++++++++++++++++++++++++-------------------- lua/bee/LSPs/on_attach.lua | 80 +++++------ lua/bee/init.lua | 53 ++++++-- lua/bee/plugins/blink.lua | 290 ++++++++++++++++++++-------------------- lua/bee/plugins/git.lua | 99 ++++++++++++++ lua/bee/plugins/init.lua | 11 +- lua/bee/plugins/oil.lua | 138 ++++++++++--------- lua/bee/plugins/picker.lua | 62 +++++++++ lua/bee/plugins/ui.lua | 51 +++++++ module.nix | 52 ++++---- plugin/keymaps.lua | 27 ++-- plugin/opts.lua | 13 +- 16 files changed, 846 insertions(+), 539 deletions(-) create mode 100644 lua/bee/plugins/picker.lua diff --git a/colors/matugen.lua b/colors/matugen.lua index 241bdf2..73493a1 100644 --- a/colors/matugen.lua +++ b/colors/matugen.lua @@ -1,77 +1,80 @@ local present, base46 = pcall(require, "base46") if not present or not base46._DMS_SUPPORT then - vim.notify( - "base46 plugin not found or incorrect, make sure to install AvengeMedia/base46", - vim.log.levels.ERROR, - { title = "matugen integration" } - ) - return + vim.notify( + "base46 plugin not found or incorrect, make sure to install AvengeMedia/base46", + vim.log.levels.ERROR, + { title = "matugen integration" } + ) + return end local config_home = vim.env.XDG_CONFIG_HOME if config_home == nil or #config_home == 0 then - config_home = vim.fs.joinpath(vim.env.HOME, ".config") + config_home = vim.fs.joinpath(vim.env.HOME, ".config") end -local colors_file_path = vim.fs.joinpath(config_home, "nvim", "colors.json") +local colors_file_path = vim.fs.joinpath(config_home, "beestuff", "nvim-colors.json") local colors_file = io.open(colors_file_path, "r") if colors_file == nil then - vim.notify( - "cannnot read matugen colors file at '" .. colors_file_path .. "'", - vim.log.levels.ERROR, - { title = "matugen integration" } - ) - return + vim.notify( + "cannnot read matugen colors file at '" .. colors_file_path .. "'", + vim.log.levels.ERROR, + { title = "matugen integration" } + ) + return end local colors = vim.json.decode(colors_file:read("*a")) colors_file:close() local mode = colors.mode -if mode ~= nil then - if mode:match("light") then - vim.o.background = "light" - elseif mode:match("dark") then - vim.o.background = "dark" - end -end local settings = { matugenTemplateNeovimSetBackground = true } local theme_base = ("github_" .. vim.o.background) -local harmony = 0.5 +local harmony = 0.2 local theme_name = "matugen" +if mode ~= nil then + if mode:match("light") then + vim.o.background = "light" + theme_base = "flex-light" + elseif mode:match("dark") then + vim.o.background = "dark" + theme_base = "ashes" + end +end + if not _G._matugen_theme_watcher then - local uv = vim.uv or vim.loop - _G._matugen_theme_watcher = { uv.new_fs_event(), reload_timer = uv.new_timer() } + local uv = vim.uv or vim.loop + _G._matugen_theme_watcher = { uv.new_fs_event(), reload_timer = uv.new_timer() } - local debounce_time = 100 -- ms - local function handler() - _G._matugen_theme_watcher.reload_timer:stop() - _G._matugen_theme_watcher.reload_timer:start( - debounce_time, - 0, - vim.schedule_wrap(function() - base46.theme_tables[theme_name] = nil - if vim.g.colors_name == theme_name then - vim.cmd.colorscheme(theme_name) - end - _G._matugen_theme_watcher[1]:stop() - _G._matugen_theme_watcher[1]:start(colors_file_path, {}, handler) - end) - ) - end - _G._matugen_theme_watcher[1]:start(colors_file_path, {}, handler) + local debounce_time = 100 -- ms + local function handler() + _G._matugen_theme_watcher.reload_timer:stop() + _G._matugen_theme_watcher.reload_timer:start( + debounce_time, + 0, + vim.schedule_wrap(function() + base46.theme_tables[theme_name] = nil + if vim.g.colors_name == theme_name then + vim.cmd.colorscheme(theme_name) + end + _G._matugen_theme_watcher[1]:stop() + _G._matugen_theme_watcher[1]:start(colors_file_path, {}, handler) + end) + ) + end + _G._matugen_theme_watcher[1]:start(colors_file_path, {}, handler) end if not base46.theme_tables[theme_name] or base46.theme_tables[theme_name].type ~= vim.o.background then - local builtin = vim.deepcopy(assert(base46.get_builtin_theme(theme_base))) - local harmonized = base46.theme_harmonize(builtin, colors.source_color, harmony) - if settings.matugenTemplateNeovimSetBackground ~= false then - harmonized = base46.theme_set_bg(harmonized, colors.background) - end + local builtin = vim.deepcopy(assert(base46.get_builtin_theme(theme_base))) + local harmonized = base46.theme_harmonize(builtin, colors.source_color, harmony) + if settings.matugenTemplateNeovimSetBackground ~= false then + harmonized = base46.theme_set_bg(harmonized, colors.background) + end - base46.theme_tables[theme_name] = harmonized + base46.theme_tables[theme_name] = harmonized end base46.load(theme_name) diff --git a/flake.lock b/flake.lock index c12511b..cff205d 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1777826146, - "narHash": "sha256-wQ/iN5Zp5VIa3ebBibijPnLyKhor+xEbDy4d0goa9Zs=", + "lastModified": 1780336545, + "narHash": "sha256-vhVhuXzFrIOfcssC/9hDHx7MHzDKjF3keHuREOQqQiQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "73c703c22422b8951895a960959dbbaca7296492", + "rev": "4df1b885d76a54e1aa1a318f8d16fd6005b6401f", "type": "github" }, "original": { @@ -35,11 +35,11 @@ "plugins-lze": { "flake": false, "locked": { - "lastModified": 1777332925, - "narHash": "sha256-jKADsx+893AjFfua++A/Py0Z5bZC6M8HJuXPVJdi+pA=", + "lastModified": 1779886623, + "narHash": "sha256-KcOvY87Js1q0YrB2g7Y+ZvXVkzAlQko582qoQemzN2M=", "owner": "BirdeeHub", "repo": "lze", - "rev": "d9425d09fc66f9529b29689852ec21d6aadf9fbc", + "rev": "37daa89a10a60bd153fa80e9041d6137f077d6fb", "type": "github" }, "original": { @@ -51,11 +51,11 @@ "plugins-lzextras": { "flake": false, "locked": { - "lastModified": 1777352146, - "narHash": "sha256-lPGTL68ghRgX9eKOgLjAc9rkhmhACVzwD/pxPaG+dAw=", + "lastModified": 1779886599, + "narHash": "sha256-RFAkctVRrbIK0fcalSvKnJMzlZoeUlVs4gHoxaDZksE=", "owner": "BirdeeHub", "repo": "lzextras", - "rev": "844c3e5c5b9ab857db948941c8c7dba4e8ddd0e3", + "rev": "dd1d43c0e2337a1a9643a1b78fbc6736d90c14c1", "type": "github" }, "original": { @@ -64,12 +64,29 @@ "type": "github" } }, + "plugins-neogit": { + "flake": false, + "locked": { + "lastModified": 1778668243, + "narHash": "sha256-ZKK4JbeuMGYvUjG1B6vLZTeSMeQTXQGFQAlIMqqN660=", + "owner": "NeogitOrg", + "repo": "neogit", + "rev": "99326a1310fb2d616b455d2fd16d01bf00682f06", + "type": "github" + }, + "original": { + "owner": "NeogitOrg", + "repo": "neogit", + "type": "github" + } + }, "root": { "inputs": { "nixpkgs": "nixpkgs", "plugins-base46": "plugins-base46", "plugins-lze": "plugins-lze", "plugins-lzextras": "plugins-lzextras", + "plugins-neogit": "plugins-neogit", "wrappers": "wrappers" } }, @@ -80,11 +97,11 @@ ] }, "locked": { - "lastModified": 1777827587, - "narHash": "sha256-Tz3QSgl1wwWH1jf0BngEkNhoWDIIWSBDE/RI+RpVemc=", + "lastModified": 1780449413, + "narHash": "sha256-ZsjnJ85CrTxI7+VaOWzkOB1u/+d4CM9AxBazXfsYXuA=", "owner": "BirdeeHub", "repo": "nix-wrapper-modules", - "rev": "b1308b562306f59c7732357655d19cedb292d5e1", + "rev": "e72bd9cf5fbc57e620912b773bed42b4e278bdc0", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 0faaab2..7ea5aeb 100644 --- a/flake.nix +++ b/flake.nix @@ -16,6 +16,10 @@ url = "github:AvengeMedia/base46"; flake = false; }; + plugins-neogit = { + url = "github:NeogitOrg/neogit"; + flake = false; + }; }; outputs = { diff --git a/init.lua b/init.lua index 596c4ed..71fcc9d 100644 --- a/init.lua +++ b/init.lua @@ -1,27 +1,27 @@ string.relpath = function(str, sub, n) - local result = {} - n = type(sub) == "string" and n or sub - if type(n) == "number" and n > 0 then - for match in (str .. "."):gmatch("(.-)%.") do - table.insert(result, match) - end - while n > 0 do - table.remove(result) - n = n - 1 - end - else - table.insert(result, str) - end - if type(sub) == "string" then - table.insert(result, sub) - end - return #result == 1 and result[1] or table.concat(result, ".") + local result = {} + n = type(sub) == "string" and n or sub + if type(n) == "number" and n > 0 then + for match in (str .. "."):gmatch("(.-)%.") do + table.insert(result, match) + end + while n > 0 do + table.remove(result) + n = n - 1 + end + else + table.insert(result, str) + end + if type(sub) == "string" then + table.insert(result, sub) + end + return #result == 1 and result[1] or table.concat(result, ".") end if not table.pack then - table.pack = function(...) - return { n = select("#", ...), ... } - end + table.pack = function(...) + return { n = select("#", ...), ... } + end end vim.loader.enable() @@ -32,5 +32,5 @@ vim.g.netrw_liststyle = 0 vim.g.netrw_banner = 0 if vim.g.vscode == nil then - require("bee") + require("bee") end diff --git a/lua/bee/LSPs/init.lua b/lua/bee/LSPs/init.lua index 3bc86a5..69f34cf 100644 --- a/lua/bee/LSPs/init.lua +++ b/lua/bee/LSPs/init.lua @@ -1,148 +1,185 @@ local MP = ... local get_nixd_opts = nixInfo(nil, "info", "nixdExtras", "get_configs") return { - { - "mason.nvim", - auto_enable = true, - priority = 55, - on_plugin = { "nvim-lspconfig" }, - lsp = function(plugin) - vim.cmd.MasonInstall(plugin.name) - end, - }, - { - "nvim-lspconfig", - auto_enable = true, - priority = 50, - lsp = function(plugin) - vim.lsp.config(plugin.name, plugin.lsp or {}) - vim.lsp.enable(plugin.name) - end, - before = function(_) - vim.lsp.config("*", { - on_attach = require(MP:relpath("on_attach")), - }) - end, - }, - { - "lua_ls", - for_cat = "lua", - lsp = { - filetypes = { "lua" }, - settings = { - Lua = { - runtime = { version = "LuaJIT" }, - formatters = { - ignoreComments = true, - }, - signatureHelp = { enabled = true }, - diagnostics = { - globals = { "vim", "make_test" }, - disable = {}, - }, - workspace = { - checkThirdParty = false, - library = { - -- '${3rd}/luv/library', - -- unpack(vim.api.nvim_get_runtime_file('', true)), - }, - }, - completion = { - callSnippet = "Replace", - }, - telemetry = { enabled = false }, - }, - }, - }, - }, - { - "nixd", - for_cat = "nix", - after = function(_) - vim.api.nvim_create_user_command("StartNilLSP", function() - vim.lsp.start(vim.lsp.config.nil_ls) - end, { desc = "Run nil-ls (when you really need docs for the builtins and nixd refuse)" }) - end, - lsp = { - filetypes = { "nix" }, - settings = { - nixd = { - nixpkgs = { - expr = nixInfo("import {}", "info", "nixdExtras", "nixpkgs"), - }, - formatting = { - command = { "nixfmt" }, - }, - options = { - -- (builtins.getFlake "path:${builtins.toString }").legacyPackages..nixosConfigurations."".options - nixos = { - expr = get_nixd_opts - and get_nixd_opts("nixos", nixInfo(nil, "info", "nixdExtras", "flake-path")), - }, - -- (builtins.getFlake "path:${builtins.toString }").legacyPackages..homeConfigurations."".options - ["home-manager"] = { - expr = get_nixd_opts - and get_nixd_opts("home-manager", nixInfo(nil, "info", "nixdExtras", "flake-path")), -- <- if flake-path is nil it will be lsp root dir - }, - }, - diagnostic = { - suppress = { - "sema-escaping-with", - }, - }, - }, - }, - }, - }, - { - "clangd", - for_cat = "C", - lsp = { - filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto" }, - on_attach = function(client, bufnr) - require(MP:relpath("on_attach"))(client, bufnr) - -- the stuff they were adding that was overriding my on_attach - dofile(nixInfo.utils.get_nix_plugin_path("nvim-lspconfig") .. "/lsp/clangd.lua").on_attach( - client, - bufnr - ) - end, - -- unneded thanks to clangd_extensions-nvim I think - -- settings = { - -- clangd_config = { - -- init_options = { - -- compilationDatabasePath="./build", - -- }, - -- } - -- } - }, - }, - { - "gopls", - for_cat = "go", - lsp = { - filetypes = { "go", "gomod", "gowork", "gotmpl", "templ" }, - }, - }, - { - "zls", - for_cat = "zig", - lsp = { - filetypes = { "zig", "zir" }, - }, - }, - { - "rust_analyzer", - for_cat = "rust", - lsp = { - filetypes = { "rust" }, - }, - }, - { - "bashls", - for_cat = "bash", - lsp = { - filetypes = { "bash", "sh" }, - }, - }, + { + "mason.nvim", + auto_enable = true, + priority = 55, + on_plugin = { "nvim-lspconfig" }, + lsp = function(plugin) + vim.cmd.MasonInstall(plugin.name) + end, + }, + { + "nvim-lspconfig", + auto_enable = true, + priority = 50, + lsp = function(plugin) + vim.lsp.config(plugin.name, plugin.lsp or {}) + vim.lsp.enable(plugin.name) + end, + before = function(_) + vim.lsp.config("*", { + on_attach = require(MP:relpath("on_attach")), + }) + end, + }, + { + "rustaceanvim", + auto_enable = true, + lazy = false, -- lazy loaded by default + before = function(_) + local RustLsp = function(mode, keymap, action, bufnr) + vim.keymap.set(mode, keymap, function() + vim.cmd.RustLsp(action) + end, { silent = true, buffer = bufnr }) + end + + vim.g.rustaceanvim = { + tools = {}, + server = { + on_attach = function(client, bufnr) + RustLsp({ "n", "x" }, "ca", "codeAction", bufnr) + RustLsp("n", "ee", "explainError", bufnr) + RustLsp("n", "K", { "hover", "actions" }, bufnr) + RustLsp("n", "L", { "hover", "range" }, bufnr) + RustLsp("n", "", "debuggables", bufnr) + end, + default_settings = { + ["rust-analyzer"] = { + checkOnSave = { + enable = true, + command = "clippy", + }, + procMacro = { + enable = true, + }, + }, + }, + }, + -- dap = {}, + } + end, + }, + { + "lua_ls", + for_cat = "lua", + lsp = { + filetypes = { "lua" }, + settings = { + Lua = { + runtime = { version = "LuaJIT" }, + formatters = { + ignoreComments = true, + }, + signatureHelp = { enabled = true }, + diagnostics = { + globals = { "vim", "make_test" }, + disable = {}, + }, + workspace = { + checkThirdParty = false, + library = { + -- '${3rd}/luv/library', + -- unpack(vim.api.nvim_get_runtime_file('', true)), + }, + }, + completion = { + callSnippet = "Replace", + }, + telemetry = { enabled = false }, + }, + }, + }, + }, + { + "nixd", + for_cat = "nix", + after = function(_) + vim.api.nvim_create_user_command("StartNilLSP", function() + vim.lsp.start(vim.lsp.config.nil_ls) + end, { desc = "Run nil-ls (when you really need docs for the builtins and nixd refuse)" }) + end, + lsp = { + filetypes = { "nix" }, + settings = { + nixd = { + nixpkgs = { + expr = nixInfo("import {}", "info", "nixdExtras", "nixpkgs"), + }, + formatting = { + command = { "nixfmt" }, + }, + options = { + -- (builtins.getFlake "path:${builtins.toString }").legacyPackages..nixosConfigurations."".options + nixos = { + expr = get_nixd_opts + and get_nixd_opts("nixos", nixInfo(nil, "info", "nixdExtras", "flake-path")), + }, + -- (builtins.getFlake "path:${builtins.toString }").legacyPackages..homeConfigurations."".options + ["home-manager"] = { + expr = get_nixd_opts + and get_nixd_opts("home-manager", nixInfo(nil, "info", "nixdExtras", "flake-path")), -- <- if flake-path is nil it will be lsp root dir + }, + }, + diagnostic = { + suppress = { + "sema-escaping-with", + }, + }, + }, + }, + }, + }, + { + "clangd", + for_cat = "C", + lsp = { + filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto" }, + on_attach = function(client, bufnr) + require(MP:relpath("on_attach"))(client, bufnr) + -- the stuff they were adding that was overriding my on_attach + dofile(nixInfo.utils.get_nix_plugin_path("nvim-lspconfig") .. "/lsp/clangd.lua").on_attach( + client, + bufnr + ) + end, + -- unneded thanks to clangd_extensions-nvim I think + -- settings = { + -- clangd_config = { + -- init_options = { + -- compilationDatabasePath="./build", + -- }, + -- } + -- } + }, + }, + { + "gopls", + for_cat = "go", + lsp = { + filetypes = { "go", "gomod", "gowork", "gotmpl", "templ" }, + }, + }, + { + "zls", + for_cat = "zig", + lsp = { + filetypes = { "zig", "zir" }, + }, + }, + -- { + -- "rust_analyzer", + -- for_cat = "rust", + -- lsp = { + -- filetypes = { "rust" }, + -- }, + -- }, + { + "bashls", + for_cat = "bash", + lsp = { + filetypes = { "bash", "sh" }, + }, + }, } diff --git a/lua/bee/LSPs/on_attach.lua b/lua/bee/LSPs/on_attach.lua index d4d69e4..8199fb1 100644 --- a/lua/bee/LSPs/on_attach.lua +++ b/lua/bee/LSPs/on_attach.lua @@ -5,50 +5,50 @@ -- end, -- }) return function(_, bufnr) - -- 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. + -- 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, mode) - if desc then - desc = "LSP: " .. desc - end - vim.keymap.set(mode or "n", keys, func, { buffer = bufnr, desc = desc }) - end + local map = function(keys, func, desc, mode) + if desc then + desc = "LSP: " .. desc + end + vim.keymap.set(mode or "n", keys, func, { buffer = bufnr, desc = desc }) + end - map("rn", vim.lsp.buf.rename, "[R]e[n]ame") - map("la", vim.lsp.buf.code_action, "[L]sp [A]ction") + map("rn", vim.lsp.buf.rename, "[R]e[n]ame") + map("la", vim.lsp.buf.code_action, "[L]sp [A]ction") - -- See `:help K` for why this keymap - map("K", vim.lsp.buf.hover, "Hover Documentation") - map("", vim.lsp.buf.signature_help, "Signature Documentation") + -- See `:help K` for why this keymap + map("K", vim.lsp.buf.hover, "Hover Documentation") + map("", vim.lsp.buf.signature_help, "Signature Documentation") - -- Lesser used LSP functionality - map("wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder") - map("wr", vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder") - map("wl", function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, "[W]orkspace [L]ist Folders") + -- Lesser used LSP functionality + map("wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder") + map("wr", vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder") + map("wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, "[W]orkspace [L]ist Folders") - -- Create a command `:Format` local to the LSP buffer - vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_) - vim.lsp.buf.format() - end, { desc = "Format current buffer with LSP" }) - map("Fl", ":Format", "[F]ormat with [l]sp") - map("FL", ":Format", "[F]ormat with [L]SP") - -- The following two autocommands are used to highlight references of the - -- word under your cursor when your cursor rests there for a little while. - -- See `:help CursorHold` for information about when this is executed - -- 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 - -- vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - -- buffer = event.buf, - -- callback = vim.lsp.buf.document_highlight, - -- }) + -- Create a command `:Format` local to the LSP buffer + vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_) + vim.lsp.buf.format() + end, { desc = "Format current buffer with LSP" }) + map("Fl", ":Format", "[F]ormat with [l]sp") + map("FL", ":Format", "[F]ormat with [L]SP") + -- The following two autocommands are used to highlight references of the + -- word under your cursor when your cursor rests there for a little while. + -- See `:help CursorHold` for information about when this is executed + -- 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 + -- vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + -- buffer = event.buf, + -- callback = vim.lsp.buf.document_highlight, + -- }) - -- vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { - -- buffer = event.buf, - -- callback = vim.lsp.buf.clear_references, - -- }) - -- end + -- vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + -- buffer = event.buf, + -- callback = vim.lsp.buf.clear_references, + -- }) + -- end end diff --git a/lua/bee/init.lua b/lua/bee/init.lua index 23991ef..2b71bc4 100644 --- a/lua/bee/init.lua +++ b/lua/bee/init.lua @@ -57,21 +57,48 @@ nixInfo.lze.load({ end, }, { - "mini.pick", - lazy = true, + "nvim-surround", auto_enable = true, - keys = { - { "ff", desc = "File finder" }, - { "bb", desc = "List open buffers" }, - { "sg", desc = "Live grep" }, - { "/", desc = "Grep" }, - }, + event = "DeferredUIEnter", + before = function(_) + vim.g.nvim_surround_no_mappings = true + end, after = function(_) - require("mini.pick").setup({ - vim.keymap.set("n", "ff", "Pick files", { desc = "File finder" }), - vim.keymap.set("n", "bb", "Pick buffers", { desc = "List open buffers" }), - vim.keymap.set("n", "sg", "Pick grep_live", { desc = "live grep" }), - vim.keymap.set("n", "/", "Pick grep", { desc = "Grep" }), + require("nvim-surround").setup({ + keymaps = false, + }) + vim.keymap.set("i", "s", "(nvim-surround-insert)", { + desc = "Add a surrounding pair around the cursor (insert mode)", + }) + vim.keymap.set("i", "S", "(nvim-surround-insert-line)", { + desc = "Add a surrounding pair around the cursor, on new lines (insert mode)", + }) + vim.keymap.set("n", "sa", "(nvim-surround-normal)", { + desc = "Add a surrounding pair around a motion (normal mode)", + }) + vim.keymap.set("n", "saa", "(nvim-surround-normal-cur)", { + desc = "Add a surrounding pair around the current line (normal mode)", + }) + vim.keymap.set("n", "sA", "(nvim-surround-normal-line)", { + desc = "Add a surrounding pair around a motion, on new lines (normal mode)", + }) + vim.keymap.set("n", "sAA", "(nvim-surround-normal-cur-line)", { + desc = "Add a surrounding pair around the current line, on new lines (normal mode)", + }) + vim.keymap.set("x", "S", "(nvim-surround-visual)", { + desc = "Add a surrounding pair around a visual selection", + }) + vim.keymap.set("x", "gS", "(nvim-surround-visual-line)", { + desc = "Add a surrounding pair around a visual selection, on new lines", + }) + vim.keymap.set("n", "sd", "(nvim-surround-delete)", { + desc = "Delete a surrounding pair", + }) + vim.keymap.set("n", "cs", "(nvim-surround-change)", { + desc = "Change a surrounding pair", + }) + vim.keymap.set("n", "cS", "(nvim-surround-change-line)", { + desc = "Change a surrounding pair, putting replacements on new lines", }) end, }, diff --git a/lua/bee/plugins/blink.lua b/lua/bee/plugins/blink.lua index 7fd147b..2dae119 100644 --- a/lua/bee/plugins/blink.lua +++ b/lua/bee/plugins/blink.lua @@ -1,150 +1,150 @@ local MP = ... return { - { - "luasnip", - auto_enable = true, - dep_of = { "blink.cmp" }, - after = function(_) - local luasnip = require("luasnip") - require("luasnip.loaders.from_vscode").lazy_load() - luasnip.config.setup({}) + { + "luasnip", + auto_enable = true, + dep_of = { "blink.cmp" }, + after = function(_) + local luasnip = require("luasnip") + require("luasnip.loaders.from_vscode").lazy_load() + luasnip.config.setup({}) - local ls = require("luasnip") - local s = ls.snippet - local t = ls.text_node - local i = ls.insert_node - local extras = require("luasnip.extras") - local rep = extras.rep - local fmta = require("luasnip.extras.fmt").fmta - local c = ls.choice_node - local f = ls.function_node - local d = ls.dynamic_node - local sn = ls.snippet_node + local ls = require("luasnip") + local s = ls.snippet + local t = ls.text_node + local i = ls.insert_node + local extras = require("luasnip.extras") + local rep = extras.rep + local fmta = require("luasnip.extras.fmt").fmta + local c = ls.choice_node + local f = ls.function_node + local d = ls.dynamic_node + local sn = ls.snippet_node - vim.keymap.set({ "i", "s" }, "", function() - if ls.choice_active() then - ls.change_choice(1) - end - end) - end, - }, - { - "colorful-menu.nvim", - auto_enable = true, - on_plugin = { "blink.cmp" }, - }, - { - "blink.cmp", - auto_enable = true, - event = { "InsertEnter", "CmdlineEnter" }, - after = function(_) - require("blink.cmp").setup({ - keymap = { preset = "default" }, - cmdline = { - enabled = true, - completion = { - menu = { - auto_show = true, - }, - }, - sources = function() - local type = vim.fn.getcmdtype() - -- Search forward and backward - if type == "/" or type == "?" then - return { "buffer" } - end - -- Commands - if type == ":" or type == "@" then - return { "cmdline" } - end - return {} - end, - }, - term = { - enabled = false, - }, - fuzzy = { - sorts = { - "exact", - "score", - "sort_text", - }, - }, - appearance = { - nerd_font_variant = "mono", - }, - signature = { - enabled = true, - window = { - show_documentation = true, - }, - }, - completion = { - menu = { - draw = { - columns = { - { "label", "label_description", gap = 1 }, - { "srckind" }, - }, - treesitter = { "lsp" }, - components = { - srckind = { - ellipsis = false, - width = { fill = true }, - text = function(ctx) - return ctx.kind - end, - highlight = function(ctx) - return ctx.kind_hl - end, - }, - label = { - text = function(ctx) - return require("colorful-menu").blink_components_text(ctx) - end, - highlight = function(ctx) - return require("colorful-menu").blink_components_highlight(ctx) - end, - }, - }, - }, - }, - documentation = { - auto_show = true, - }, - }, - ---@type blink.cmp.SnippetsConfig - snippets = { - preset = "luasnip", - active = function(filter) - local snippet = require("luasnip") - local blink = require("blink.cmp") - if snippet.in_snippet() and not blink.is_visible() then - return true - else - if not snippet.in_snippet() and vim.fn.mode() == "n" then - snippet.unlink_current() - vim.snippet.stop() - end - return false - end - end, - }, - sources = { - default = { "lsp", "path", "snippets", "buffer", "omni" }, - providers = { - path = { - score_offset = 50, - }, - lsp = { - score_offset = 40, - }, - snippets = { - score_offset = 40, - }, - }, - }, - }) - end, - }, + vim.keymap.set({ "i", "s" }, "", function() + if ls.choice_active() then + ls.change_choice(1) + end + end) + end, + }, + { + "colorful-menu.nvim", + auto_enable = true, + on_plugin = { "blink.cmp" }, + }, + { + "blink.cmp", + auto_enable = true, + event = { "InsertEnter", "CmdlineEnter" }, + after = function(_) + require("blink.cmp").setup({ + keymap = { preset = "default" }, + cmdline = { + enabled = true, + completion = { + menu = { + auto_show = true, + }, + }, + sources = function() + local type = vim.fn.getcmdtype() + -- Search forward and backward + if type == "/" or type == "?" then + return { "buffer" } + end + -- Commands + if type == ":" or type == "@" then + return { "cmdline" } + end + return {} + end, + }, + term = { + enabled = false, + }, + fuzzy = { + sorts = { + "exact", + "score", + "sort_text", + }, + }, + appearance = { + nerd_font_variant = "mono", + }, + signature = { + enabled = true, + window = { + show_documentation = true, + }, + }, + completion = { + menu = { + draw = { + columns = { + { "label", "label_description", gap = 1 }, + { "srckind" }, + }, + treesitter = { "lsp" }, + components = { + srckind = { + ellipsis = false, + width = { fill = true }, + text = function(ctx) + return ctx.kind + end, + highlight = function(ctx) + return ctx.kind_hl + end, + }, + label = { + text = function(ctx) + return require("colorful-menu").blink_components_text(ctx) + end, + highlight = function(ctx) + return require("colorful-menu").blink_components_highlight(ctx) + end, + }, + }, + }, + }, + documentation = { + auto_show = true, + }, + }, + ---@type blink.cmp.SnippetsConfig + snippets = { + preset = "luasnip", + active = function(filter) + local snippet = require("luasnip") + local blink = require("blink.cmp") + if snippet.in_snippet() and not blink.is_visible() then + return true + else + if not snippet.in_snippet() and vim.fn.mode() == "n" then + snippet.unlink_current() + vim.snippet.stop() + end + return false + end + end, + }, + sources = { + default = { "lsp", "path", "snippets", "buffer", "omni" }, + providers = { + path = { + score_offset = 50, + }, + lsp = { + score_offset = 40, + }, + snippets = { + score_offset = 40, + }, + }, + }, + }) + end, + }, } diff --git a/lua/bee/plugins/git.lua b/lua/bee/plugins/git.lua index 78be9b4..ed696cf 100644 --- a/lua/bee/plugins/git.lua +++ b/lua/bee/plugins/git.lua @@ -36,6 +36,25 @@ return { }) end, }, + { + "neogit", + auto_enable = true, + keys = { { "gg", "Neogit", desc = "Open git" } }, + cmd = { "Neogit" }, + after = function(_) + require("neogit").setup() + end, + }, + { + "codediff.nvim", + auto_enable = true, + dep_of = { "neogit" }, + cmd = "CodeDiff", + after = function() + require("codediff").setup() + end, + }, + { "mini.diff", auto_enable = true, @@ -59,4 +78,84 @@ return { }) end, }, + { + "gitsigns.nvim", + auto_enable = true, + event = "DeferredUIEnter", + after = function(_) + require("gitsigns").setup({ + -- See `:help gitsigns.txt` + signs = { + add = { text = "+" }, + change = { text = "~" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + }, + on_attach = function(bufnr) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map({ "n", "v" }, "]c", function() + if vim.wo.diff then + return "]c" + end + vim.schedule(function() + gs.next_hunk() + end) + return "" + end, { expr = true, desc = "Jump to next hunk" }) + + map({ "n", "v" }, "[c", function() + if vim.wo.diff then + return "[c" + end + vim.schedule(function() + gs.prev_hunk() + end) + return "" + end, { expr = true, desc = "Jump to previous hunk" }) + + -- Actions + -- visual mode + map("v", "hs", function() + gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end, { desc = "stage git hunk" }) + map("v", "hr", function() + gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end, { desc = "reset git hunk" }) + -- normal mode + map("n", "gs", gs.stage_hunk, { desc = "git stage hunk" }) + map("n", "gr", gs.reset_hunk, { desc = "git reset hunk" }) + map("n", "gS", gs.stage_buffer, { desc = "git Stage buffer" }) + map("n", "gu", gs.undo_stage_hunk, { desc = "undo stage hunk" }) + map("n", "gR", gs.reset_buffer, { desc = "git Reset buffer" }) + map("n", "gp", gs.preview_hunk, { desc = "preview git hunk" }) + map("n", "gb", function() + gs.blame_line({ full = false }) + end, { desc = "git blame line" }) + -- map('n', 'gd', gs.diffthis, { desc = 'git diff against index' }) + map("n", "gD", function() + gs.diffthis("~") + end, { desc = "git diff against last commit" }) + + -- Toggles + map("n", "gtb", gs.toggle_current_line_blame, { desc = "toggle git blame line" }) + map("n", "gtd", gs.toggle_deleted, { desc = "toggle git show deleted" }) + + -- Text object + map({ "o", "x" }, "ih", ":Gitsigns select_hunk", { desc = "select git hunk" }) + end, + }) + -- vim.cmd([[hi GitSignsAdd guifg=#04de21]]) + -- vim.cmd([[hi GitSignsChange guifg=#83fce6]]) + -- vim.cmd([[hi GitSignsDelete guifg=#fa2525]]) + end, + }, } diff --git a/lua/bee/plugins/init.lua b/lua/bee/plugins/init.lua index 59e0a41..43d69e0 100644 --- a/lua/bee/plugins/init.lua +++ b/lua/bee/plugins/init.lua @@ -1,9 +1,10 @@ local MP = ... return { - { import = MP:relpath("ui") }, - { import = MP:relpath("oil") }, - { import = MP:relpath("git") }, - { import = MP:relpath("blink") }, - { import = MP:relpath("treesitter") }, + { import = MP:relpath("ui") }, + { import = MP:relpath("oil") }, + { import = MP:relpath("git") }, + { import = MP:relpath("blink") }, + { import = MP:relpath("picker") }, + { import = MP:relpath("treesitter") }, } diff --git a/lua/bee/plugins/oil.lua b/lua/bee/plugins/oil.lua index 5f8c6d6..6a5e69b 100644 --- a/lua/bee/plugins/oil.lua +++ b/lua/bee/plugins/oil.lua @@ -1,72 +1,70 @@ return { - { - "oil.nvim", - lazy = true, - keys = { { "o", "Oil", desc = "Open oil" } }, - auto_enable = true, - after = function() - vim.g.loaded_netrwPlugin = 1 - vim.keymap.set("n", "o", "Oil .", { noremap = true, desc = "Open nvim root directory" }) - require("oil").setup({ - keymaps = { - ["-"] = "actions.parent", - [""] = "actions.select", - [""] = "actions.select_vsplit", - [""] = "actions.select_split", - }, - vim.keymap.set("n", "o", "Oil", { desc = "Open Oil" }), - - -- Oil will take over directory buffers (e.g. `vim .` or `:e src/`) - -- Set to false if you still want to use netrw. - default_file_explorer = true, - -- Id is automatically added at the beginning, and name at the end - -- See :help oil-columns - columns = { - "icon", - "permissions", - "size", - -- "mtime", - }, - -- Buffer-local options to use for oil buffers - buf_options = { - buflisted = false, - bufhidden = "hide", - }, - -- Window-local options to use for oil buffers - win_options = { - wrap = false, - signcolumn = "no", - cursorcolumn = false, - foldcolumn = "0", - spell = false, - list = false, - conceallevel = 3, - concealcursor = "nvic", - }, - -- Send deleted files to the trash instead of permanently deleting them (:help oil-trash) - delete_to_trash = false, - -- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits) - skip_confirm_for_simple_edits = false, - -- Selecting a new/moved/renamed file or directory will prompt you to save changes first - -- (:help prompt_save_on_select_new_entry) - prompt_save_on_select_new_entry = true, - -- Oil will automatically delete hidden buffers after this delay - -- You can set the delay to false to disable cleanup entirely - -- Note that the cleanup process only starts when none of the oil buffers are currently displayed - cleanup_delay_ms = 2000, - lsp_file_methods = { - -- Time to wait for LSP file operations to complete before skipping - timeout_ms = 1000, - -- Set to true to autosave buffers that are updated with LSP willRenameFiles - -- Set to "unmodified" to only save unmodified buffers - autosave_changes = false, - }, - -- Constrain the cursor to the editable parts of the oil buffer - -- Set to `false` to disable, or "name" to keep it on the file names - constrain_cursor = "editable", - -- Set to true to watch the filesystem for changes and reload oil - experimental_watch_for_changes = false, - }) - end, - }, + { + "oil.nvim", + lazy = false, + keys = { { "o", "Oil", desc = "Open oil" } }, + cmd = "Oil", + auto_enable = true, + after = function() + vim.g.loaded_netrwPlugin = 1 + require("oil").setup({ + keymaps = { + ["-"] = "actions.parent", + [""] = "actions.select", + [""] = "actions.select_vsplit", + [""] = "actions.select_split", + }, + -- Oil will take over directory buffers (e.g. `vim .` or `:e src/`) + -- Set to false if you still want to use netrw. + default_file_explorer = true, + -- Id is automatically added at the beginning, and name at the end + -- See :help oil-columns + columns = { + "icon", + "permissions", + "size", + -- "mtime", + }, + -- Buffer-local options to use for oil buffers + buf_options = { + buflisted = false, + bufhidden = "hide", + }, + -- Window-local options to use for oil buffers + win_options = { + wrap = false, + signcolumn = "no", + cursorcolumn = false, + foldcolumn = "0", + spell = false, + list = false, + conceallevel = 3, + concealcursor = "nvic", + }, + -- Send deleted files to the trash instead of permanently deleting them (:help oil-trash) + delete_to_trash = false, + -- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits) + skip_confirm_for_simple_edits = false, + -- Selecting a new/moved/renamed file or directory will prompt you to save changes first + -- (:help prompt_save_on_select_new_entry) + prompt_save_on_select_new_entry = true, + -- Oil will automatically delete hidden buffers after this delay + -- You can set the delay to false to disable cleanup entirely + -- Note that the cleanup process only starts when none of the oil buffers are currently displayed + cleanup_delay_ms = 2000, + lsp_file_methods = { + -- Time to wait for LSP file operations to complete before skipping + timeout_ms = 1000, + -- Set to true to autosave buffers that are updated with LSP willRenameFiles + -- Set to "unmodified" to only save unmodified buffers + autosave_changes = false, + }, + -- Constrain the cursor to the editable parts of the oil buffer + -- Set to `false` to disable, or "name" to keep it on the file names + constrain_cursor = "editable", + -- Set to true to watch the filesystem for changes and reload oil + experimental_watch_for_changes = false, + }) + end, + }, } diff --git a/lua/bee/plugins/picker.lua b/lua/bee/plugins/picker.lua new file mode 100644 index 0000000..9d23faa --- /dev/null +++ b/lua/bee/plugins/picker.lua @@ -0,0 +1,62 @@ +return { + { + "fff.nvim", + auto_enable = true, + lazy = false, -- the plugin lazy-initialises itself + before = function(_) + vim.g.fff = { + lazy_sync = true, + debug = { enabled = false, show_scores = false }, + } + end, + keys = { + { + "ff", + function() + require("fff").find_files() + end, + desc = "Find files", + }, + { + "fg", + function() + require("fff").live_grep() + end, + desc = "Live grep", + }, + { + "fz", + function() + require("fff").live_grep({ grep = { modes = { "fuzzy", "plain" } } }) + end, + desc = "Live fuzy grep", + }, + { + "fc", + function() + require("fff").live_grep({ query = vim.fn.expand("") }) + end, + desc = "Search current word", + }, + }, + }, + { + "mini.pick", + lazy = true, + auto_enable = true, + keys = { + { "ff", desc = "File finder" }, + { "bb", desc = "List open buffers" }, + { "fg", desc = "Live grep" }, + { "/", desc = "Grep" }, + }, + after = function(_) + require("mini.pick").setup({ + vim.keymap.set("n", "ff", "Pick files", { desc = "File finder" }), + vim.keymap.set("n", "bb", "Pick buffers", { desc = "List open buffers" }), + vim.keymap.set("n", "sg", "Pick grep_live", { desc = "live grep" }), + vim.keymap.set("n", "/", "Pick grep", { desc = "Grep" }), + }) + end, + }, +} diff --git a/lua/bee/plugins/ui.lua b/lua/bee/plugins/ui.lua index 8ce2a3c..2a5a4fc 100644 --- a/lua/bee/plugins/ui.lua +++ b/lua/bee/plugins/ui.lua @@ -1,6 +1,7 @@ return { { "lualine.nvim", + event = "DeferredUIEnter", auto_enable = true, after = function(_) require("lualine").setup({ @@ -66,4 +67,54 @@ return { }) end, }, + { + "hlchunk.nvim", + auto_enable = false, + event = "DeferredUIEnter", + after = function() + local ignored_filetypes = { + gitcommit = true, + oil = true, + Neogitstatus = true, + TelescopePrompt = true, + NvimTree = true, + help = true, + -- nix = true, + } + + require("hlchunk").setup({ + chunk = { + enable = true, + priority = 15, + -- use_treesitter = true, + chars = { + horizontal_line = "─", + vertical_line = "│", + left_top = "┌", + left_bottom = "└", + right_arrow = "─", + }, + textobject = "", + exclude_filetypes = ignored_filetypes, + max_file_size = 1024 * 1024, + error_sign = false, + straight = true, + use_treesitter = true, + -- animation related + duration = 0, + delay = 200, + }, + indent = { + enable = true, + priority = 10, + style = { vim.api.nvim_get_hl(0, { name = "Whitespace" }) }, + use_treesitter = true, + exclude_filetypes = ignored_filetypes, + chars = { "│" }, + ahead_lines = 5, + delay = 100, + }, + }) + end, + }, } diff --git a/module.nix b/module.nix index 56ca58d..096cacc 100644 --- a/module.nix +++ b/module.nix @@ -72,7 +72,7 @@ inputs: config.specs.nix = { lazy = true; data = null; - extraPackages = with pkgs; [ + runtimePkgs = with pkgs; [ nixd nixfmt ]; @@ -83,7 +83,7 @@ inputs: data = with pkgs.vimPlugins; [ lazydev-nvim ]; - extraPackages = with pkgs; [ + runtimePkgs = with pkgs; [ lua-language-server stylua ]; @@ -92,31 +92,28 @@ inputs: lazy = true; enable = false; data = null; - extraPackages = with pkgs; [ + runtimePkgs = with pkgs; [ bash-language-server ]; }; config.specs.C = { lazy = true; data = null; - extraPackages = with pkgs; [ - clang-tools - ]; + runtimePkgs = with pkgs; [ ]; }; config.specs.rust = { # enable = false; lazy = true; - data = null; - extraPackages = with pkgs; [ - rust-analyzer - rustfmt + data = with pkgs.vimPlugins; [ + rustaceanvim ]; + runtimePkgs = with pkgs; [ ]; }; config.specs.zig = { enable = false; lazy = true; data = null; - extraPackages = with pkgs; [ + runtimePkgs = with pkgs; [ zls ]; }; @@ -126,7 +123,7 @@ inputs: # If we provided any from within either spec, anyway after = [ "lze" ]; # note we didn't have to specify the `lze` specs name, because it was a top level spec - extraPackages = with pkgs; [ + runtimePkgs = with pkgs; [ tree-sitter ]; # this `lazy = true` definition will transfer to specs in the contained DAL, if there is one. @@ -137,26 +134,33 @@ inputs: # here we chose a DAL of plugins, but we can also pass a single plugin, or null # plugins are of type wlib.types.stringable data = with pkgs.vimPlugins; [ - vim-sleuth + { + data = vim-sleuth; + lazy = false; + } + { + data = nvim-web-devicons; + lazy = false; + } + config.nvim-lib.neovimPlugins.base46 + config.nvim-lib.neovimPlugins.neogit + codediff-nvim nvim-lspconfig oil-nvim vim-startuptime blink-cmp + nvim-surround colorful-menu-nvim luasnip + fff-nvim lualine-nvim nvim-lint conform-nvim + gitsigns-nvim nvim-treesitter-textobjects - mini-pick - mini-diff - mini-surround - mini-indentscope nvim-ts-autotag - vim-fugitive - vim-rhubarb - diffview-nvim + hlchunk-nvim (nvim-treesitter.withPlugins ( plugins: with plugins; [ nix @@ -196,16 +200,16 @@ inputs: # config.runtimeDeps = lib.mkDefault (parentSpec.runtimeDeps or false); # config.pluginDeps = lib.mkDefault (parentSpec.pluginDeps or false); # or something more interesting like: - # add an extraPackages field to the specs themselves - options.extraPackages = lib.mkOption { + # add an runtimePkgs field to the specs themselves + options.runtimePkgs = lib.mkOption { type = lib.types.listOf wlib.types.stringable; default = [ ]; - description = "a extraPackages spec field to put packages to suffix to the PATH"; + description = "a runtimePkgs spec field to put packages to suffix to the PATH"; }; # You could do this too # config.before = lib.mkDefault [ "INIT_MAIN" ]; }; - config.extraPackages = config.specCollect (acc: v: acc ++ (v.extraPackages or [ ])) [ ]; + config.runtimePkgs = config.specCollect (acc: v: acc ++ (v.runtimePkgs or [ ])) [ ]; # Inform our lua of which top level specs are enabled options.settings.cats = lib.mkOption { diff --git a/plugin/keymaps.lua b/plugin/keymaps.lua index c22f149..bb623e4 100644 --- a/plugin/keymaps.lua +++ b/plugin/keymaps.lua @@ -9,32 +9,31 @@ vim.keymap.set("n", "[", "bprev", { desc = "Previous bu vim.keymap.set("n", "]", "bnext", { desc = "Next buffer" }) vim.keymap.set("n", "l", "b#", { desc = "Last buffer" }) vim.keymap.set("n", "d", "bdelete", { desc = "delete buffer" }) +vim.keymap.set("n", "cx", "!chmod +x %", { desc = "Make executable" }) --- Remap for dealing with word wrap vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) --- Diagnostic keymaps vim.keymap.set("n", "e", vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) vim.keymap.set("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) vim.keymap.set({ "v", "x", "n" }, "y", '"+y', { noremap = true, silent = true, desc = "Yank to clipboard" }) vim.keymap.set( - { "n", "v", "x" }, - "Y", - '"+yy', - { noremap = true, silent = true, desc = "Yank line to clipboard" } + { "n", "v", "x" }, + "Y", + '"+yy', + { noremap = true, silent = true, desc = "Yank line to clipboard" } ) vim.keymap.set({ "n", "v", "x" }, "p", '"+p', { noremap = true, silent = true, desc = "Paste from clipboard" }) vim.keymap.set( - "i", - "", - "+", - { noremap = true, silent = true, desc = "Paste from clipboard from within insert mode" } + "i", + "", + "+", + { noremap = true, silent = true, desc = "Paste from clipboard from within insert mode" } ) vim.keymap.set( - "x", - "P", - '"_dP', - { noremap = true, silent = true, desc = "Paste over selection without erasing unnamed register" } + "x", + "P", + '"_dP', + { noremap = true, silent = true, desc = "Paste over selection without erasing unnamed register" } ) diff --git a/plugin/opts.lua b/plugin/opts.lua index 39de789..2bad394 100644 --- a/plugin/opts.lua +++ b/plugin/opts.lua @@ -16,9 +16,10 @@ vim.wo.number = true vim.o.cursorline = true vim.o.mouse = "" +vim.opt.spell = false vim.o.smarttab = true --- vim.o.smartindent = true +vim.o.smartindent = true -- vim.o.indentexpr = true vim.o.autoindent = true vim.opt.cpoptions:append("I") @@ -61,9 +62,6 @@ vim.api.nvim_create_autocmd("TextYankPost", { }) local augroup = vim.api.nvim_create_augroup("UserConfig", {}) - --- [[ Disable auto comment on enter ]] --- See :help formatoptions vim.api.nvim_create_autocmd("FileType", { desc = "remove formatoptions", group = augroup, @@ -81,6 +79,13 @@ vim.api.nvim_create_autocmd("FileType", { end, }) +vim.api.nvim_create_autocmd("FileType", { + pattern = "rust", + callback = function(args) + vim.lsp.inlay_hint.enable(true, { bufnr = args.buf }) + end, +}) + -- -- Create directories when saving files -- vim.api.nvim_create_autocmd("BufWritePre", { -- group = augroup, -- cgit v1.3.1