{pkgs, ...}: { programs.nixvim = { enable = true; viAlias = true; vimAlias = true; withNodeJs = true; withRuby = true; extraPackages = with pkgs; [alejandra black stylua codespell nodePackages.prettier]; luaLoader.enable = true; performance = { combinePlugins.enable = true; byteCompileLua.enable = true; }; colorschemes.rose-pine.enable = true; opts = { laststatus = 3; relativenumber = true; }; globals = { mapleader = " "; }; extraConfigLua = '' require("telescope").load_extension("yank_history") ''; keymaps = [ { # Unmap space (leader) action = ""; key = ""; options = { noremap = true; silent = true; }; mode = "n"; } { action = "spj"; key = "-"; options.silent = true; options.desc = "Split window horizontally"; } { action = "vspl"; key = "\\"; options.silent = true; options.desc = "Split window vertically"; } { action = "ZenMode"; key = "wz"; options = { silent = true; noremap = true; desc = "Zen mode"; }; } { action = "h"; key = ""; options = { silent = true; noremap = true; desc = "Move to left window"; }; } { action = "j"; key = ""; options = { silent = true; noremap = true; desc = "Move to lower window"; }; } { action = "k"; key = ""; options = { silent = true; noremap = true; desc = "Move to upper window"; }; } { action = "l"; key = ""; options = { silent = true; noremap = true; desc = "Move to right window"; }; } { action = "close"; key = "wd"; options = { silent = true; noremap = true; desc = "Close current window"; }; } { action = "Telescope find_files"; key = "ff"; options = { silent = true; noremap = true; desc = "Find files"; }; } { action = "Telescope live_grep"; key = "/"; options = { silent = true; noremap = true; desc = "Live grep"; }; } { action = "Telescope buffers"; key = "fb"; options = { silent = true; noremap = true; desc = "List buffers"; }; } { action = "Telescope help_tags"; key = "fh"; options = { silent = true; noremap = true; desc = "Help tags"; }; } { action = "lua require'telescope.builtin'.lsp_definitions{}"; key = "gd"; options = { silent = true; noremap = true; desc = "Go to definition"; }; } { action = "lua require'telescope.builtin'.git_files{}"; key = " "; options = { silent = true; noremap = true; desc = "List Git files"; }; } { action = "lua require'telescope.builtin'.find_files{}"; key = "ff"; options = { silent = true; noremap = true; desc = "List all files"; }; } { action = ""; key = ""; options = { silent = true; noremap = true; desc = "Go to normal mode in built-in terminal."; }; mode = "t"; } { action = ":resize +4"; key = "w="; options = { silent = true; noremap = true; desc = "Increase window height."; }; } { action = ":resize -4"; key = "w-"; options = { silent = true; noremap = true; desc = "Decrease window height."; }; } { action = ":vertical resize +4"; key = "w]"; options = { silent = true; noremap = true; desc = "Increase window width."; }; } { action = ":vertical resize -4"; key = "w["; options = { silent = true; noremap = true; desc = "Decrease window width."; }; } { action = ":Bdelete!"; key = "bd"; options = { silent = true; noremap = true; desc = "Close buffer"; }; } { action = ":bprev"; key = "H"; options = { silent = true; noremap = true; desc = "Move to the previous buffer."; }; } { action = ":bnext"; key = "L"; options = { silent = true; noremap = true; desc = "Move to the next buffer."; }; } { action = ":LazyGit"; key = "gg"; options = { silent = true; noremap = true; desc = "Open LazyGit"; }; } { action = ":split | wincmd j | resize 15 | term"; key = "tt"; options = { silent = true; noremap = true; desc = "Open a half-size horizontal terminal split"; }; mode = "n"; } { action = ":split | wincmd j | term"; key = "te"; options = { silent = true; noremap = true; desc = "Open a horizontal terminal split"; }; mode = "n"; } { action = ":vsplit | wincmd l | term"; key = "tv"; options = { silent = true; noremap = true; desc = "Open a vertical terminal split"; }; mode = "n"; } { action = ":Trouble diagnostics"; key = "xx"; options = { silent = true; noremap = true; desc = "View trouble diagnostics"; }; mode = "n"; } { action = ":Trouble symbols"; key = "xs"; options = { silent = true; noremap = true; desc = "View symbols"; }; mode = "n"; } { action = "(YankyPutAfter)"; key = "p"; mode = ["n" "x"]; } { action = "(YankyPutBefore)"; key = "P"; mode = ["n" "x"]; } { action = "(YankyGPutAfter)"; key = "gp"; mode = ["n" "x"]; } { action = "(YankyGPutBefore)"; key = "gP"; mode = ["n" "x"]; } { action = ":Telescope yank_history"; key = "p"; mode = "n"; } { action = '':lua require("yazi").yazi()''; key = "mm"; options = { desc = "Open Yazi current nvim working directory"; noremap = true; silent = true; }; } # { # action = ":Yazi"; # key = "mf"; # options = { # desc = "Open Yazi at current file"; # noremap = true; # silent = true; # }; # } # { # action = "lua require'conform'.format({ bufnr = args.bf })"; # key = "cf"; # options = { # silent = true; # noremap = true; # desc = "Format buffer"; # }; # } ]; plugins = { lsp = { enable = true; inlayHints = true; servers = { bashls.enable = true; clangd.enable = true; pyright.enable = true; nixd.enable = true; nushell.enable = true; svelte.enable = true; tailwindcss.enable = true; typst-lsp.enable = true; rust-analyzer = { enable = true; installCargo = true; installRustc = true; }; marksman.enable = true; }; }; typescript-tools.enable = true; presence-nvim = { enable = true; editingText = "Hacking %s"; workspaceText = "The One True Text Editor"; buttons = [ { label = "GitHub"; url = "https://github.com/youwen5"; } { label = "Code Forge"; url = "https://code.youwen.dev/"; } ]; }; treesitter = { enable = true; settings = { highlight.enable = true; indent.enable = true; }; }; treesitter-context.enable = true; wakatime.enable = true; lazygit.enable = true; gitsigns.enable = true; intellitab.enable = true; guess-indent.enable = true; vim-bbye.enable = true; indent-blankline.enable = true; which-key.enable = true; zen-mode.enable = true; markdown-preview.enable = true; yanky = { enable = true; enableTelescope = true; }; telescope = { enable = true; }; mini = { enable = true; modules = { surround = {}; pairs = {}; ai = {}; hipatterns = {}; notify = {}; tabline = {}; trailspace = {}; comment = {}; }; }; trouble.enable = true; direnv.enable = true; # cmp = { # enable = true; # settings = { # mapping = { # "" = "cmp.mapping.complete()"; # "" = "cmp.mapping.scroll_docs(-4)"; # "" = "cmp.mapping.close()"; # "" = "cmp.mapping.scroll_docs(4)"; # "" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; # "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; # "" = "cmp.mapping.confirm({ select = true })"; # }; # completion.autocomplete = [ # "require('cmp.types').cmp.TriggerEvent.TextChanged" # ]; # }; # }; cmp-async-path.enable = true; cmp = { enable = true; settings = { autoEnableSources = true; experimental = {ghost_text = true;}; performance = { debounce = 60; fetchingTimeout = 200; maxViewEntries = 30; }; snippet = {expand = "luasnip";}; formatting = {fields = ["kind" "abbr" "menu"];}; sources = [ {name = "nvim_lsp";} {name = "emoji";} { name = "buffer"; # text within current buffer option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; keywordLength = 3; } # { name = "copilot"; } # enable/disable copilot { name = "path"; # file system paths keywordLength = 3; } { name = "luasnip"; # snippets keywordLength = 3; } ]; window = { completion = {border = "solid";}; documentation = {border = "solid";}; }; mapping = { "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; "" = "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.complete()"; "" = "cmp.mapping.confirm({ select = true })"; "" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })"; }; }; }; cmp-nvim-lsp = { enable = true; # LSP }; cmp-buffer = { enable = true; }; cmp-path = { enable = true; # file system paths }; cmp-cmdline = { enable = true; # autocomplete for cmdline }; crates-nvim.enable = true; conform-nvim = { enable = true; formatOnSave = { timeoutMs = 500; lspFallback = true; }; formattersByFt = { lua = ["stylua"]; python = ["black"]; nix = ["alejandra"]; svelte = ["prettier"]; rust = ["rust-analyzer"]; "*" = ["codespell"]; "_" = ["trim_whitespace"]; }; }; yazi = { enable = true; settings = { open_for_directories = true; }; }; }; extraPlugins = [ (pkgs.vimUtils.buildVimPlugin { name = "satellite.nvim"; src = pkgs.fetchFromGitHub { owner = "lewis6991"; repo = "satellite.nvim"; rev = "777ed56e1ef45ec808df701730b6597fc4fb0fbc"; hash = "sha256-04Js+9SB4VuCq/ACbNh5BZcolu8i8vlGU72qo5xxfpk="; }; }) (pkgs.vimUtils.buildVimPlugin { name = "render-markdown.nvim"; src = pkgs.fetchFromGitHub { owner = "MeanderingProgrammer"; repo = "render-markdown.nvim"; rev = "7986be47531d652e950776536987e01dd5b55b94"; hash = "sha256-lc++IrXzEA3M2iUFZACAZOcH2EwVqX4p0fhET+en37o="; }; }) (pkgs.vimUtils.buildVimPlugin { name = "haskell-tools-nvim"; src = pkgs.fetchFromGitHub { owner = "mrcjkb"; repo = "haskell-tools.nvim"; rev = "959eac0fadbdd27442904a8cb363f39afb528027"; hash = "sha256-5CS5kvUSqQJe7iFFpicinBjCQXgFPL0ElGgnrZHTT+Y="; }; }) ]; }; programs.yazi = { enable = true; enableBashIntegration = true; enableFishIntegration = true; }; }