From 67e324107e05f3245ddac034607afd0e1dea478f Mon Sep 17 00:00:00 2001 From: Natasha Moongrave Date: Mon, 30 Mar 2026 20:46:26 +0200 Subject: Refactored the entire configuration --- home/rices/nord-blue/nvim.nix | 279 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 279 insertions(+) create mode 100644 home/rices/nord-blue/nvim.nix (limited to 'home/rices/nord-blue/nvim.nix') diff --git a/home/rices/nord-blue/nvim.nix b/home/rices/nord-blue/nvim.nix new file mode 100644 index 0000000..9677c57 --- /dev/null +++ b/home/rices/nord-blue/nvim.nix @@ -0,0 +1,279 @@ +{pkgs, ...}: { + home.packages = with pkgs; [ + zathura + ripgrep + fd + lazygit + stylua + alejandra + black + shfmt + + # Language servers + lua-language-server + nil + rust-analyzer + pyright + bash-language-server + texlab + ]; + + programs.neovim = { + enable = true; + defaultEditor = true; + viAlias = true; + vimAlias = true; + + plugins = with pkgs.vimPlugins; [ + # UI + catppuccin-nvim + nvim-web-devicons + which-key-nvim + gitsigns-nvim + + # Syntax + (nvim-treesitter.withPlugins (p: [ + p.lua + p.nix + p.rust + p.python + p.bash + p.latex + p.c + ])) + + # LSP + nvim-lspconfig + + # Completion / snippets + nvim-cmp + cmp-nvim-lsp + cmp_luasnip + luasnip + friendly-snippets + nvim-autopairs + + # Formatting + conform-nvim + comment-nvim + + # Navigation + telescope-nvim + plenary-nvim + nvim-tree-lua + + # Terminal + toggleterm-nvim + + # Writing + vimtex + orgmode + + # Start screen + { + plugin = vim-startify; + config = "let g:startify_change_to_vcs_root = 0"; + } + ]; + + extraLuaConfig = '' + ------------------------------------------------- + -- LEADER + ------------------------------------------------- + vim.g.mapleader = " " + + ------------------------------------------------- + -- BASIC OPTIONS + ------------------------------------------------- + vim.opt.number = true + vim.opt.relativenumber = true + vim.opt.clipboard = "unnamedplus" + vim.opt.showtabline = 2 + vim.o.timeout = true + vim.o.timeoutlen = 300 + + ------------------------------------------------- + -- THEME + ------------------------------------------------- + require("catppuccin").setup({ + flavour = "mocha", + }) + vim.cmd.colorscheme("catppuccin") + + ------------------------------------------------- + -- GITSIGNS + ------------------------------------------------- + require("gitsigns").setup() + + ------------------------------------------------- + -- TREESITTER + ------------------------------------------------- + require("nvim-treesitter.configs").setup({ + highlight = { enable = true }, + indent = { enable = true }, + }) + + vim.opt.foldmethod = "expr" + vim.opt.foldexpr = "nvim_treesitter#foldexpr()" + vim.opt.foldenable = false + + ------------------------------------------------- + -- SNIPPETS + ------------------------------------------------- + require("luasnip.loaders.from_vscode").lazy_load() + + ------------------------------------------------- + -- COMPLETION + ------------------------------------------------- + local cmp = require("cmp") + local luasnip = require("luasnip") + + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.confirm({ select = true }), + }), + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + }, + }) + + require("nvim-autopairs").setup({}) + + ------------------------------------------------- + -- LSP + ------------------------------------------------- + local capabilities = require("cmp_nvim_lsp").default_capabilities() + + local servers = { + "lua_ls", + "nil_ls", + "rust_analyzer", + "pyright", + "bashls", + "texlab", + } + + for _, server in ipairs(servers) do + vim.lsp.config(server, { + capabilities = capabilities + }) + vim.lsp.enable(server) + end + + ------------------------------------------------- + -- LSP KEYMAPS + ------------------------------------------------- + vim.keymap.set("n", "ld", vim.lsp.buf.definition) + vim.keymap.set("n", "lD", vim.lsp.buf.declaration) + vim.keymap.set("n", "li", vim.lsp.buf.implementation) + vim.keymap.set("n", "lr", vim.lsp.buf.references) + vim.keymap.set("n", "lh", vim.lsp.buf.hover) + vim.keymap.set("n", "ln", vim.lsp.buf.rename) + vim.keymap.set("n", "la", vim.lsp.buf.code_action) + vim.keymap.set("n", "lf", function() vim.lsp.buf.format() end) + + ------------------------------------------------- + -- DIAGNOSTICS + ------------------------------------------------- + vim.keymap.set("n", "lj", vim.diagnostic.goto_next) + vim.keymap.set("n", "lk", vim.diagnostic.goto_prev) + vim.keymap.set("n", "le", vim.diagnostic.open_float) + + ------------------------------------------------- + -- FORMATTER + ------------------------------------------------- + require("conform").setup({ + format_on_save = { + timeout_ms = 500, + lsp_format = "fallback", + }, + formatters_by_ft = { + lua = { "stylua" }, + nix = { "alejandra" }, + rust = { "rustfmt" }, + python = { "black" }, + bash = { "shfmt" }, + }, + }) + + require("Comment").setup() + + ------------------------------------------------- + -- TELESCOPE + ------------------------------------------------- + local builtin = require("telescope.builtin") + + require("telescope").setup({ + defaults = { + layout_strategy = "horizontal", + sorting_strategy = "ascending", + file_ignore_patterns = { "node_modules", ".git/" }, + }, + }) + + vim.keymap.set("n", "", builtin.find_files) + vim.keymap.set("n", "fg", builtin.live_grep) + vim.keymap.set("n", "fb", builtin.buffers) + + ------------------------------------------------- + -- WHICH KEY + ------------------------------------------------- + local wk = require("which-key") + wk.add({ + { "l", desc = "LSP" } + }) + + ------------------------------------------------- + -- NVIM TREE + ------------------------------------------------- + require("nvim-tree").setup({}) + vim.keymap.set("n", "e", "NvimTreeToggle") + + ------------------------------------------------- + -- TERMINAL + ------------------------------------------------- + require("toggleterm").setup({ + direction = "float", + }) + + local Terminal = require("toggleterm.terminal").Terminal + + local lazygit = Terminal:new({ + cmd = "lazygit", + hidden = true, + direction = "float", + }) + + vim.keymap.set("n", "gg", function() + lazygit:toggle() + end) + + ------------------------------------------------- + -- ORGMODE + ------------------------------------------------- + local projects = { + "~/Documents/2_Writing/0_SOC/**/*.org", + "~/Documents/2_Writing/2_Notes/**/*.org", + "~/Documents/1_Projects/6_CRC-Altura/**/*.org", + "~/ORG/**/*.org" + } + + require("orgmode").setup({ + org_agenda_files = projects, + org_default_notes_file = "~/INBOX.org" + }) + + ------------------------------------------------- + -- VIMTEX + ------------------------------------------------- + vim.g.vimtex_view_method = "zathura" + ''; + }; +} -- cgit v1.2.3