diff options
| author | Natasha Moongrave <natasha@256phi.eu> | 2026-03-06 17:37:53 +0100 |
|---|---|---|
| committer | Natasha Moongrave <natasha@256phi.eu> | 2026-03-06 17:37:53 +0100 |
| commit | e84c421e6f28cf3309adece93710cb98df1df819 (patch) | |
| tree | dab79ceb8e819b70e556e211966fdcaefb7928b5 | |
| parent | 74504f3fbd9ad6fff91c195fd296a877c68d85d6 (diff) | |
fixed some things
| -rw-r--r-- | modules/home/i3wm/nord-blue/nvim.nix | 246 |
1 files changed, 88 insertions, 158 deletions
diff --git a/modules/home/i3wm/nord-blue/nvim.nix b/modules/home/i3wm/nord-blue/nvim.nix index 95ad476..71a548e 100644 --- a/modules/home/i3wm/nord-blue/nvim.nix +++ b/modules/home/i3wm/nord-blue/nvim.nix @@ -37,13 +37,13 @@ ################################################# plugins = with pkgs.vimPlugins; [ - # UI / Theme + # UI catppuccin-nvim nvim-web-devicons which-key-nvim gitsigns-nvim - # Syntax (IDE-style highlighting) + # Syntax (nvim-treesitter.withPlugins (p: [ p.lua p.nix @@ -53,17 +53,29 @@ p.latex p.c ])) + + # LSP nvim-lspconfig - # File Navigation + # Completion / snippets + nvim-cmp + cmp-nvim-lsp + cmp_luasnip + luasnip + friendly-snippets + + # Formatting + conform-nvim + + # Navigation telescope-nvim plenary-nvim nvim-tree-lua - # Terminal / Git + # Terminal toggleterm-nvim - # Writing / LaTeX + # Writing vimtex orgmode @@ -72,16 +84,6 @@ plugin = vim-startify; config = "let g:startify_change_to_vcs_root = 0"; } - - # Snippets - luasnip - friendly-snippets - nvim-cmp - cmp-nvim-lsp - cmp_luasnip - - # Formatting - conform-nvim ]; ################################################# @@ -100,7 +102,6 @@ vim.opt.relativenumber = true vim.opt.clipboard = "unnamedplus" vim.opt.showtabline = 2 - vim.o.timeout = true vim.o.timeoutlen = 300 @@ -109,75 +110,91 @@ ------------------------------------------------- require("catppuccin").setup({ flavour = "mocha", - transparent_background = false, }) vim.cmd.colorscheme("catppuccin") ------------------------------------------------- - -- GIT SIGNS + -- GITSIGNS ------------------------------------------------- - require("gitsigns").setup{ - signs = { - add = { text = '┃' }, - change = { text = '┃' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - untracked = { text = '┆' }, - }, - } + require("gitsigns").setup() + ------------------------------------------------- - -- TREESITTER (IDE-style syntax highlighting) + -- TREESITTER ------------------------------------------------- require("nvim-treesitter.configs").setup({ - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, + highlight = { enable = true }, indent = { enable = true }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "<C-space>", - node_incremental = "<C-space>", - node_decremental = "<bs>", - }, + }) + + ------------------------------------------------- + -- 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({ + ["<C-Space>"] = cmp.mapping.complete(), + ["<CR>"] = cmp.mapping.confirm({ select = true }), + }), + + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, }, }) ------------------------------------------------- -- LSP ------------------------------------------------- - vim.lsp.enable("lua_ls", {}) - vim.lsp.enable("nil_ls", {}) - vim.lsp.enable("rust_analyzer", {}) - vim.lsp.enable("pyright", {}) - vim.lsp.enable("bashls", {}) - vim.lsp.enable("texlab", {}) - - ------------------------------------------------- - -- FORMATTER - ------------------------------------------------- - require("conform").setup({ - format_on_save = { - -- These options will be passed to conform.format() - timeout_ms = 500, - lsp_format = "fallback", - }, - - formatters_by_ft = { - lua = { "stylua" }, - nix = { "alejandra" }, - rust = { "rustfmt" }, - python = { "black" }, - bash = { "shfmt" }, - }, - }) + 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 ------------------------------------------------- - -- SNIPPETS + -- FORMATTER ------------------------------------------------- - require("luasnip.loaders.from_vscode").lazy_load() + 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" }, + }, + }) + ------------------------------------------------- -- TELESCOPE ------------------------------------------------- @@ -186,96 +203,30 @@ require("telescope").setup({ defaults = { layout_strategy = "horizontal", - layout_config = { prompt_position = "top" }, sorting_strategy = "ascending", }, }) vim.keymap.set("n", "<leader><leader>", builtin.find_files) - vim.keymap.set("n", "<leader>ff", builtin.find_files) vim.keymap.set("n", "<leader>fg", builtin.live_grep) vim.keymap.set("n", "<leader>fb", builtin.buffers) - vim.keymap.set("n", "<leader>fh", builtin.help_tags) ------------------------------------------------- - -- WHICH-KEY + -- WHICH KEY ------------------------------------------------- require("which-key").setup({}) ------------------------------------------------- - -- TABS - ------------------------------------------------- - vim.keymap.set("n", "gt", "<cmd>tabnew<CR>") - vim.keymap.set("n", "gc", "<cmd>tabclose<CR>") - vim.keymap.set("n", "gn", "<cmd>tabnext<CR>") - vim.keymap.set("n", "gp", "<cmd>tabprevious<CR>") - vim.keymap.set("n", "g0", "<cmd>tabfirst<CR>") - vim.keymap.set("n", "g$", "<cmd>tablast<CR>") - - ------------------------------------------------- - -- NVIM-TREE + -- NVIM TREE ------------------------------------------------- - require("nvim-tree").setup({ - view = { - width = 30, - side = "left", - }, - - renderer = { - group_empty = true, - highlight_git = true, -- git highlighting - }, - - filters = { - dotfiles = false, - git_ignored = true, -- hide .gitignore files - }, - - git = { - enable = true, - ignore = true, -- respect .gitignore - }, - - update_focused_file = { - enable = true, - update_cwd = true, - }, - - respect_buf_cwd = true, -- relative to project root - - on_attach = function(bufnr) - local api = require("nvim-tree.api") - - local function opts(desc) - return { - desc = "nvim-tree: " .. desc, - buffer = bufnr, - noremap = true, - silent = true, - nowait = true, - } - end - - api.config.mappings.default_on_attach(bufnr) - - -- open file in new tab - vim.keymap.set("n", "t", function() - local node = api.tree.get_node_under_cursor() - if node and node.type == "file" then - vim.cmd("tabnew " .. node.absolute_path) - end - end, opts("Open in new tab")) - end, - }) - + require("nvim-tree").setup({}) vim.keymap.set("n", "<leader>e", "<cmd>NvimTreeToggle<CR>") ------------------------------------------------- - -- TOGGLETERM + LAZYGIT + -- TERMINAL ------------------------------------------------- require("toggleterm").setup({ direction = "float", - float_opts = { border = "rounded" }, }) local Terminal = require("toggleterm.terminal").Terminal @@ -284,7 +235,6 @@ cmd = "lazygit", hidden = true, direction = "float", - float_opts = { border = "rounded" }, }) vim.keymap.set("n", "<leader>gg", function() @@ -303,26 +253,6 @@ -- VIMTEX ------------------------------------------------- vim.g.vimtex_view_method = "zathura" - vim.g.vimtex_compiler_latexmk = { - executable = "latexmk", - options = { - "-pdf", - "-interaction=nonstopmode", - "-synctex=1", - "-file-line-error", - }, - } - vim.g.vimtex_syntax_enabled = 0 - - vim.api.nvim_create_autocmd("FileType", { - pattern = "tex", - callback = function() - vim.opt_local.wrap = true - vim.opt_local.linebreak = true - vim.opt_local.breakindent = true - vim.opt_local.textwidth = 0 - end, - }) ''; }; } |
