{ inputs, ... }: { perSystem = { system, pkgs, ... }: { packages.nvim = inputs.nixvim.legacyPackages.${system}.makeNixvim { vimAlias = true; colorschemes = { ayu = { enable = true; settings.overrides = { EoLSpace = { bg = "#883333"; }; }; }; everforest = { enable = true; settings.overrides = { EoLSpace = { bg = "#FF2222"; # doesn't work }; }; }; }; globals = { mapleader = " "; lumen_light_colorscheme = "everforest"; lumen_dark_colorscheme = "ayu"; }; opts = { mouse = "a"; number = true; shiftwidth = 2; clipboard = "unnamedplus"; # undo stuff undofile = true; undolevels = 10000; undoreload = 10000; listchars = "tab:⇥ ,extends:❯,precedes:❮,nbsp:␣,trail:·,eol:↲"; }; extraConfigVim = '' set et " show special characters set list " match trailing whitespace match EoLSpace /\s\+$/ " need to use lua to expand $HOME lua vim.o.undodir = vim.fs.normalize('$HOME/.vim/undodir') ''; extraPackages = [ pkgs.glib # for vim-lumen ]; extraPlugins = [ pkgs.vimPlugins.vim-fetch (pkgs.vimUtils.buildVimPlugin { name = "vim-lumen"; src = pkgs.fetchFromGitHub { owner = "vimpostor"; repo = "vim-lumen"; rev = "ac13c32c3e309f6c6a84ff6cad8dbb135e75f0e4"; hash = "sha256-rsDUDI9lh4CEX1upMBjeyBOm99GAXWGPQ9vSCN8cmFo="; }; }) ]; # not ready yet, we are waiting for none-ls to get updated # extraConfigLua = '' # local null_ls = require("null-ls") # null_ls.register(null_ls.builtins.formatting.nix_flake_fmt) # ''; keymaps = [ { mode = "i"; key = ""; action = ""; } { mode = "i"; key = ""; action = ""; } { mode = "n"; key = ""; action = ":q"; } { mode = "n"; key = ""; action = ""; } { mode = "n"; key = "sd"; action = ":colorscheme ayu-dark"; } { mode = "n"; key = "sw"; action = ":colorscheme ayu-light"; } { mode = [ "n" "v" ]; key = "cc"; action = ":CopilotChatOpen"; } { mode = [ "n" "v" ]; key = "ce"; action = ":CopilotChatExplain"; } { mode = [ "n" "v" ]; key = "cr"; action = ":CopilotChatReview"; } { mode = [ "n" "v" ]; key = "cf"; action = ":CopilotChatFix"; } { mode = [ "n" "v" ]; key = "cd"; action = ":CopilotChatDocs"; } { mode = [ "n" "x" ]; key = "p"; action = "(YankyPutAfter)"; } { mode = [ "n" "x" ]; key = "P"; action = "(YankyPutBefore)"; } { mode = [ "c" "i" "n" "x" ]; key = ""; action = ":lua vim.lsp.buf.code_action()"; } { mode = [ "n" ]; key = "gd"; action = ":lua vim.lsp.buf.definition()"; } { mode = [ "n" ]; key = "gD"; action = ":lua vim.lsp.buf.declaration()"; } ]; # autoCmd = [ # { # event = "BufWritePost"; # desc = "run treefmt on save"; # # https://stackoverflow.com/questions/77466697/how-to-automatically-format-on-save # callback.__raw = '' # function() # vim.cmd("silent !treefmt %") # vim.cmd("edit") # end # ''; # } # ]; plugins.none-ls = { enable = true; # sources.formatting.treefmt = { # enable = true; # package = pkgs.emptyDirectory; # }; # package = pkgs.vimPlugins.none-ls-nvim.overrideAttrs (_old: { # src = pkgs.fetchFromGitHub { # owner = "lassulus"; # repo = "none-ls.nvim"; # rev = "292c2b5eadea0a097b9a01804aea70f5c8125200"; # sha256 = "sha256-nbzqXsxmYfxngdJH3NXMLmGgygh6reSEnruoc6l8t/s="; # }; # }); sources.formatting.nix_flake_fmt.enable = true; }; plugins.web-devicons.enable = true; plugins.telescope.extensions.undo.enable = true; plugins.telescope = { enable = true; keymaps = { "b" = "buffers"; "u" = "undo"; "ff" = "find_files"; "fg" = "live_grep"; "fh" = "help_tags"; "fp" = "yank_history"; }; }; plugins.lsp-format.enable = true; plugins.lsp-lines.enable = true; plugins.lsp = { enable = true; servers = { bashls.enable = true; # bash nixd = { enable = true; # nix extraOptions.offset_encoding = "utf-8"; # workaround https://github.com/nix-community/nixvim/issues/2390#issuecomment-2408101568 }; ruff.enable = true; # python pyright.enable = true; # python jsonls.enable = true; # json }; }; plugins.treesitter.enable = true; plugins.copilot-cmp.enable = true; plugins.copilot-lua.settings.panel.enabled = false; plugins.copilot-lua.settings.suggestion.enabled = false; plugins.cmp_yanky.enable = true; plugins.cmp = { enable = true; autoEnableSources = true; settings = { experimental = { ghost_text = true; }; sources = [ { name = "nvim_lsp"; } { name = "emoji"; } { name = "buffer"; # text within current buffer option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; keywordLength = 2; } { name = "copilot"; # enable copilot } { name = "path"; # file system paths keywordLength = 3; } { name = "cmp_yanky"; } ]; mapping = { "" = "cmp.mapping.select_next_item()"; "" = "cmp.mapping.select_prev_item()"; "" = "cmp.mapping.select_next_item()"; "" = "cmp.mapping.select_prev_item()"; "" = "cmp.mapping.abort()"; "" = "cmp.mapping.scroll_docs(-4)"; "" = "cmp.mapping.scroll_docs(4)"; "" = '' cmp.mapping({ i = function(fallback) if cmp.visible() and cmp.get_active_entry() then cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }) else fallback() end end, s = cmp.mapping.confirm({ select = true }), c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), }) ''; }; }; }; plugins.bufferline.enable = true; plugins.which-key.enable = true; plugins.yanky = { enable = true; enableTelescope = true; }; plugins.comment.enable = true; plugins.copilot-chat.enable = true; plugins.undotree.enable = true; # seems to be needed for undo history in telescope plugins.gitsigns.enable = true; }; }; }