Mercurial > nixos
diff modules/neovim.nix @ 0:face7f4d84f7
Initial commit
| author | Yasuri <yasuri@charliesmp.net> |
|---|---|
| date | Mon, 28 Sep 2026 13:10:19 -0500 |
| parents | |
| children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/neovim.nix Mon Sep 28 13:10:19 2026 -0500 @@ -0,0 +1,112 @@ +{ pkgs, ... }: + +{ + programs.neovim = { + enable = true; + defaultEditor = true; + viAlias = true; + vimAlias = true; + + plugins = with pkgs.vimPlugins; [ + nvim-treesitter.withAllGrammars + telescope-nvim + plenary-nvim + lualine-nvim + gitsigns-nvim + ]; + + extraLuaConfig = '' + -- options + local o = vim.opt + o.number = true + o.relativenumber = true + o.termguicolors = true + o.expandtab = true + o.shiftwidth = 2 + o.tabstop = 2 + o.smartindent = true + o.ignorecase = true + o.smartcase = true + o.cursorline = true + o.scrolloff = 8 + o.signcolumn = "yes" + o.undofile = true + o.mouse = "a" + o.clipboard = "unnamedplus" + + vim.g.mapleader = " " + local map = vim.keymap.set + local tb = require("telescope.builtin") + map("n", "<leader>ff", tb.find_files) + map("n", "<leader>fg", tb.live_grep) + map("n", "<leader>fb", tb.buffers) + map("n", "<leader>w", "<cmd>w<cr>") + map("n", "<esc>", "<cmd>nohlsearch<cr>") + + -- colorscheme from the wallpaper + local c = { + bg = "#1c1a2b", fg = "#e8e0f0", sel = "#2f2b47", gray = "#4a4668", + dim = "#7a769a", pink = "#f5b0d8", rose = "#f28fad", mint = "#8fe3c8", + peach = "#f5d5b8", blue = "#79a6f5", mag = "#e9a0e6", cyan = "#7fd6f5", + } + vim.cmd("highlight clear") + vim.g.colors_name = "wall" + local function hl(g, v) vim.api.nvim_set_hl(0, g, v) end + + -- transparent bg so st shows the wallpaper through + hl("Normal", { fg = c.fg }) + hl("NormalFloat", { fg = c.fg, bg = c.sel }) + hl("SignColumn", {}) + hl("CursorLine", { bg = c.sel }) + hl("Visual", { bg = c.gray }) + hl("LineNr", { fg = c.gray }) + hl("CursorLineNr", { fg = c.pink, bold = true }) + hl("WinSeparator", { fg = c.gray }) + hl("MatchParen", { fg = c.cyan, bold = true }) + hl("Search", { fg = c.bg, bg = c.peach }) + hl("IncSearch", { fg = c.bg, bg = c.pink }) + hl("Pmenu", { fg = c.fg, bg = c.sel }) + hl("PmenuSel", { fg = c.bg, bg = c.pink }) + hl("Directory", { fg = c.blue }) + hl("Comment", { fg = c.dim, italic = true }) + hl("Constant", { fg = c.peach }) + hl("String", { fg = c.mint }) + hl("Number", { fg = c.peach }) + hl("Identifier", { fg = c.fg }) + hl("Function", { fg = c.blue }) + hl("Statement", { fg = c.pink }) + hl("Type", { fg = c.cyan }) + hl("PreProc", { fg = c.mag }) + hl("Special", { fg = c.mag }) + hl("Error", { fg = c.rose }) + hl("DiagnosticError", { fg = c.rose }) + hl("DiagnosticWarn", { fg = c.peach }) + hl("DiagnosticInfo", { fg = c.cyan }) + hl("DiagnosticHint", { fg = c.mint }) + + -- statusline + local function mode(bg) + return { + a = { fg = c.bg, bg = bg, gui = "bold" }, + b = { fg = c.fg, bg = c.sel }, + c = { fg = c.dim }, + } + end + require("lualine").setup({ + options = { + theme = { + normal = mode(c.pink), insert = mode(c.mint), visual = mode(c.blue), + replace = mode(c.rose), command = mode(c.peach), inactive = mode(c.gray), + }, + section_separators = "", + component_separators = "|", + }, + }) + + require("gitsigns").setup() + vim.api.nvim_create_autocmd("FileType", { + callback = function(args) pcall(vim.treesitter.start, args.buf) end, +}) + ''; + }; +}
