{ config, pkgs, ... }: let c = config.theme.colors; in { programs.neovim = { enable = true; viAlias = true; vimAlias = true; extraPackages = with pkgs; [ lua-language-server nil nixfmt ripgrep fd ]; plugins = with pkgs.vimPlugins; [ # Gruvbox theme gruvbox-nvim # Treesitter — better syntax highlighting { plugin = nvim-treesitter.withAllGrammars; type = "lua"; config = '' require("nvim-treesitter").setup({ highlight = { enable = true }, indent = { enable = true }, }) ''; } # File explorer { plugin = nvim-tree-lua; type = "lua"; config = '' require("nvim-tree").setup() vim.keymap.set("n", "e", "NvimTreeToggle") ''; } # Statusline { plugin = lualine-nvim; type = "lua"; config = '' require("lualine").setup({ options = { theme = "gruvbox-material", }, }) ''; } # Icons (needed by nvim-tree and lualine) nvim-web-devicons # Fuzzy finder { plugin = telescope-nvim; type = "lua"; config = '' local builtin = require("telescope.builtin") vim.keymap.set("n", "ff", builtin.find_files) vim.keymap.set("n", "fg", builtin.live_grep) vim.keymap.set("n", "fb", builtin.buffers) ''; } # Comment toggling { plugin = comment-nvim; type = "lua"; config = ''require("Comment").setup()''; } # Show indentation guides { plugin = indent-blankline-nvim; type = "lua"; config = ''require("ibl").setup()''; } ]; initLua = '' -- Leader key vim.g.mapleader = " " -- Colorscheme require("gruvbox").setup({ contrast = "medium", transparent_mode = false, }) vim.cmd("colorscheme gruvbox") -- Line numbers vim.opt.number = true vim.opt.relativenumber = true -- Indentation vim.opt.tabstop = 2 vim.opt.shiftwidth = 2 vim.opt.expandtab = true vim.opt.smartindent = true -- Search vim.opt.ignorecase = true vim.opt.smartcase = true vim.opt.hlsearch = false -- UI vim.opt.termguicolors = true vim.opt.signcolumn = "yes" vim.opt.cursorline = true vim.opt.scrolloff = 8 vim.opt.wrap = false vim.opt.splitright = true vim.opt.splitbelow = true -- System clipboard vim.opt.clipboard = "unnamedplus" -- Keymaps local map = vim.keymap.set -- Better window navigation map("n", "", "h") map("n", "", "j") map("n", "", "k") map("n", "", "l") -- Move lines up/down in visual mode map("v", "J", ":m '>+1gv=gv") map("v", "K", ":m '<-2gv=gv") -- Keep cursor centered when scrolling map("n", "", "zz") map("n", "", "zz") -- Save and quit map("n", "w", "w") map("n", "q", "q") ''; }; }