{ pkgs, lib, ... }: let inherit (lib.generators) mkLuaInline; suda-nvim = pkgs.vimUtils.buildVimPlugin { name = "vim-suda"; src = pkgs.fetchFromGitHub { owner = "lambdalisue"; repo = "vim-suda"; rev = "9adda7d195222d4e2854efb2a88005a120296c47"; hash = "sha256-46sy3rAdOCULVt1RkIoGdweoV3MqQaB33Et9MrxI6Lk="; }; }; in { programs.nvf = { enable = true; settings = { vim = { enableLuaLoader = true; clipboard = { enable = true; providers = { wl-copy.enable = true; }; registers = "unnamedplus"; }; extraPlugins = with pkgs.vimPlugins; { transparent = { package = transparent-nvim; setup = # lua '' require("transparent").setup({ extra_groups = { "NormalFloat", "NvimTreeNormal", "TreesitterContext", "FloatBorder", "FoldColumn", "Folded", "BlinkCmpMenu", "BlinkCmpBorder", "BlinkCmpKind", "WarningMsg", "ErrorMsg", "BlinkCmpMenuBorder", "FzfLuaBackdrop", "VertSplit", "Pmenu", "PmenuSbar", "DiffText", "DiffViewNormal", "CursorColumn", "ColorColumn", "QuickFixLine", "Error", "NoiceScrollbar" }, }) require("transparent").clear_prefix("NeoTree") require("transparent").clear_prefix("GitGutter") ''; }; suda = { package = suda-nvim; }; }; keymaps = [ # === Files === # # Explorer { key = "e"; mode = ["n"]; action = ":Neotree toggle"; silent = true; desc = "Toggle file explorer"; } # Fzf lua { key = ""; silent = true; mode = ["n"]; action = ":FzfLua files"; nowait = true; unique = true; desc = "Find file"; } { key = "/"; mode = ["n"]; action = ":FzfLua live_grep"; nowait = true; unique = true; desc = "Live grep"; } # Lsp symbol document { key = "ss"; silent = true; mode = ["n"]; action = ":FzfLua lsp_document_symbols"; nowait = true; unique = true; desc = "Find symbols (document)"; } # Lsp symbol workspace { key = "sS"; silent = true; mode = ["n"]; action = ":FzfLua lsp_workspace_symbols"; unique = true; nowait = true; desc = "Find symbols (workspace)"; } # === Buffer === # { key = "bo"; mode = ["n"]; action = ":BufferLineCloseOther"; desc = "Close other buffer"; } { key = "bS"; mode = ["n"]; action = ":SudaWrite"; desc = "Save file as root"; } # === General Control === # # Save file { key = ""; mode = [ "n" "i" "v" ]; action = ":w"; desc = "Save file"; } { key = ""; mode = ["i"]; action = ""; desc = "Shift left"; } { key = "gd"; mode = ["n"]; action = ":FzfLua lsp_definitions"; nowait = true; desc = "Go to definition"; } { key = "gD"; mode = ["n"]; action = ":FzfLua lsp_declarations"; nowait = true; desc = "Go to declaration"; } { key = "gi"; mode = ["n"]; action = ":FzfLua lsp_implementations"; nowait = true; desc = "Go to implementation"; } { key = "gr"; mode = ["n"]; action = ":FzfLua lsp_references"; nowait = true; desc = "List references"; } { key = "n"; mode = ["n"]; action = ":NoiceAll"; nowait = true; desc = "Notifications"; } { key = ""; mode = ["n"]; action = ":noh"; desc = "Clear highlight"; } # === Tab === # { key = ">"; mode = ["v"]; action = ">gv"; silent = true; desc = "Shift right"; } { key = "<"; mode = ["v"]; action = " curWidth + chunkWidth then table.insert(newVirtText, chunk) else chunkText = truncate(chunkText, targetWidth - curWidth) local hlGroup = chunk[2] table.insert(newVirtText, {chunkText, hlGroup}) chunkWidth = vim.fn.strdisplaywidth(chunkText) -- str width returned from truncate() may less than 2nd argument, need padding if curWidth + chunkWidth < targetWidth then suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth) end break end curWidth = curWidth + chunkWidth end table.insert(newVirtText, {suffix, 'MoreMsg'}) return newVirtText end ''; provider_selector = mkLuaInline # lua '' function(bufnr, filetype, buftype) return {'treesitter', 'indent'} end ''; }; }; borders = { enable = true; plugins = { lspsaga.enable = true; fastaction.enable = true; lsp-signature.enable = true; which-key.enable = true; }; }; }; }; }; }; }