diff --git a/flake.lock b/flake.lock index 070d329..3048962 100644 --- a/flake.lock +++ b/flake.lock @@ -337,11 +337,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1698410321, - "narHash": "sha256-MphuSlgpmKwtJncGMohryHiK55J1n6WzVQ/OAfmfoMc=", + "lastModified": 1700815693, + "narHash": "sha256-JtKZEQUzosrCwDsLgm+g6aqbP1aseUl1334OShEAS3s=", "owner": "numtide", "repo": "devshell", - "rev": "1aed986e3c81a4f6698e85a7452cbfcc4b31a36e", + "rev": "7ad1c417c87e98e56dcef7ecd0e0a2f2e5669d51", "type": "github" }, "original": { @@ -687,11 +687,11 @@ ] }, "locked": { - "lastModified": 1699783872, - "narHash": "sha256-4zTwLT2LL45Nmo6iwKB3ls3hWodVP9DiSWxki/oewWE=", + "lastModified": 1700847865, + "narHash": "sha256-uWaOIemGl9LF813MW0AEgCBpKwFo2t1Wv3BZc6e5Frw=", "owner": "nix-community", "repo": "home-manager", - "rev": "280721186ab75a76537713ec310306f0eba3e407", + "rev": "8cedd63eede4c22deb192f1721dd67e7460e1ebe", "type": "github" }, "original": { @@ -721,11 +721,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1699790908, - "narHash": "sha256-8CO4KQhiEyO7rce4KVOq8arpk9802fVwxtN/oLeRFag=", + "lastModified": 1700395747, + "narHash": "sha256-pzLYZGK34vhAFfyAJjcZYX3BK0Ap/QY/rd8B6Q30tHo=", "owner": "nix-community", "repo": "lib-aggregate", - "rev": "6c60a229fa422698325b2788e93dfeeba3f11391", + "rev": "474538707da35589543af5a1c8c31f9978841add", "type": "github" }, "original": { @@ -757,11 +757,11 @@ ] }, "locked": { - "lastModified": 1699214123, - "narHash": "sha256-0vo6if/3dDTia6NJJT5zFjBuXFnMfPFUJxgjaWZRH24=", + "lastModified": 1700320345, + "narHash": "sha256-HDBVj9gEOG2ZBGc+UGtjqDsOIvYOQtDxDRGrbiWOXl0=", "owner": "astro", "repo": "microvm.nix", - "rev": "4caeec0f24d416ce19c76754cae572f1e1882ffe", + "rev": "b16e6261ad2f0bca6ac2a4b7a4d3377cf5e3d95d", "type": "github" }, "original": { @@ -778,11 +778,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1699952346, - "narHash": "sha256-l+8awD7Gq5iIZSbzC7BNO3e5sFBgm1Ivea8WyawRMlQ=", + "lastModified": 1700459485, + "narHash": "sha256-vHE+wNz3o0ygEY/XIC4XrQq18DlC6Ek7zu8tSdUbVzk=", "owner": "nix-community", "repo": "nix-eval-jobs", - "rev": "333af7cb0f3dc54e893d2032e4032821bc90e145", + "rev": "575ca7a957cfd49f3e82c5434ac8029e2e6519d3", "type": "github" }, "original": { @@ -820,11 +820,11 @@ ] }, "locked": { - "lastModified": 1699760693, - "narHash": "sha256-u/gkNUHQR/q23voqE5J4xmEWQIAqR+g3lUnCtzn0k7Y=", + "lastModified": 1700363379, + "narHash": "sha256-fBEVPFwSZ6AmBE1s1oT7E9WVuqRghruxTnSQ8UUlMkw=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "8aff4ca3dee60d1422489fe8d52c2f837b3ad113", + "rev": "27920146e671a0d565aaa7452907383be14d8d82", "type": "github" }, "original": { @@ -871,11 +871,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1699954245, - "narHash": "sha256-CSnfeOHc/wco8amdA0j268OaLrMcI5gGtK6Zm+y3lT0=", + "lastModified": 1700559156, + "narHash": "sha256-gL4epO/qf+wo30JjC3g+b5Bs8UrpxzkhNBBsUYxpw2g=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "df9bb8a436607da124e8cfa0fd19e70e9d9e0b7b", + "rev": "c3abafb01cd7045dba522af29b625bd1e170c2fb", "type": "github" }, "original": { @@ -908,11 +908,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1699781429, - "narHash": "sha256-UYefjidASiLORAjIvVsUHG6WBtRhM67kTjEY4XfZOFs=", + "lastModified": 1700612854, + "narHash": "sha256-yrQ8osMD+vDLGFX7pcwsY/Qr5PUd6OmDMYJZzZi0+zc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e44462d6021bfe23dfb24b775cc7c390844f773d", + "rev": "19cbff58383a4ae384dea4d1d0c823d72b49d614", "type": "github" }, "original": { @@ -924,11 +924,11 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1699750082, - "narHash": "sha256-4Vx6Vr975vPGzGACyu4u6JfWo2Auwy0AeC6sTSOXdTQ=", + "lastModified": 1700354803, + "narHash": "sha256-kJYhswYp1XMdpI2p/2oRcZxvwW83e64r1av/9zypFLU=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "55682344eae38a1975ccd2cfac0dcb4197faedf8", + "rev": "07e160fb6ad2c4bcabecd43425ebaaa4336c5da2", "type": "github" }, "original": { @@ -995,11 +995,11 @@ ] }, "locked": { - "lastModified": 1699957017, - "narHash": "sha256-KNhfptCyWg7+ztI9ChFCPgkCTh5qTOVtfN9UlMt9t10=", + "lastModified": 1700910721, + "narHash": "sha256-FRsgqTA3s4CEbKqiWMhhg5g70HW319d2YoXJ/DclON4=", "owner": "nix-community", "repo": "nixpkgs-wayland", - "rev": "ef494dc47eb77867fef9b71c74dc6f2ea0f9bc87", + "rev": "cb8cd2609efa3cb07c5ce9516bfa8eed9a9856c1", "type": "github" }, "original": { @@ -1010,11 +1010,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1699839047, - "narHash": "sha256-FAoWKSDZ9vpd8sLeJYeVGUnSlOCqkSochTEvOA7+qeM=", + "lastModified": 1700444282, + "narHash": "sha256-s/+tgT+Iz0LZO+nBvSms+xsMqvHt2LqYniG9r+CYyJc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8423b2dff7b10463eb97f9242bd62a1ff8d2ee3e", + "rev": "3f21a22b5aafefa1845dec6f4a378a8f53d8681c", "type": "github" }, "original": { @@ -1061,11 +1061,11 @@ ] }, "locked": { - "lastModified": 1699958608, - "narHash": "sha256-CZ8VtcpiReFsaCTfd8jjBP4wef2OUwT0aiIzsDe+l2c=", + "lastModified": 1700831612, + "narHash": "sha256-4rjt03g847UpPYshwItJqFqxHJ6l4aoXqDVT9CNOCu4=", "owner": "nix-community", "repo": "nixvim", - "rev": "a742bd1fc4e33b1dd1fdcafc914c5da601ba7b27", + "rev": "bacdae2c508defccdff1af8511e4d639d26d3d47", "type": "github" }, "original": { @@ -1170,11 +1170,11 @@ "nixpkgs-stable": "nixpkgs-stable_3" }, "locked": { - "lastModified": 1699271226, - "narHash": "sha256-8Jt1KW3xTjolD6c6OjJm9USx/jmL+VVmbooADCkdDfU=", + "lastModified": 1700064067, + "narHash": "sha256-1ZWNDzhu8UlVCK7+DUN9dVQfiHX1bv6OQP9VxstY/gs=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "ea758da1a6dcde6dc36db348ed690d09b9864128", + "rev": "e558068cba67b23b4fbc5537173dbb43748a17e8", "type": "github" }, "original": { @@ -1255,11 +1255,11 @@ ] }, "locked": { - "lastModified": 1699477454, - "narHash": "sha256-PueVBJDRM+q/ONSwMptLH4i6cny7BnNcuBpjI2e5rYo=", + "lastModified": 1700302760, + "narHash": "sha256-JpOJf9Nj260rTrVuYonP9CiGzj+43AGPOfhF72XkQvU=", "owner": "danth", "repo": "stylix", - "rev": "5c6f7fd709be441505998fc51a25b645a44d359e", + "rev": "a15c3196c1d620c18cbee8229092598384a89fef", "type": "github" }, "original": { diff --git a/modules/config/home-manager.nix b/modules/config/home-manager.nix index 4528cf7..b9faa44 100644 --- a/modules/config/home-manager.nix +++ b/modules/config/home-manager.nix @@ -11,6 +11,7 @@ sharedModules = [ inputs.nix-index-database.hmModules.nix-index inputs.wired-notify.homeManagerModules.default + inputs.nixvim.homeManagerModules.nixvim { home.stateVersion = config.system.stateVersion; } diff --git a/modules/config/users.nix b/modules/config/users.nix index 50e08bb..6cea17e 100644 --- a/modules/config/users.nix +++ b/modules/config/users.nix @@ -27,5 +27,6 @@ redis-paperless = uidGid 982; nixseparatedebuginfod = uidGid 981; msr = uidGid 980; + fwupd-refresh = uidGid 979; }; } diff --git a/users/myuser/neovim/aaa/init.lua b/users/myuser/neovim/aaa/init.lua deleted file mode 100644 index 1c454c5..0000000 --- a/users/myuser/neovim/aaa/init.lua +++ /dev/null @@ -1,72 +0,0 @@ -local opt = vim.opt -local g = vim.g - -g.mapleader = "," - ----------------------------------------------------------------------------------------------------- --- General ----------------------------------------------------------------------------------------------------- - -opt.undolevels = 1000000 -- Set maximum undo levels -opt.undofile = true -- Enable persistent undo which persists undo history across vim sessions -opt.updatetime = 300 -- Save swap file after 300ms -opt.mouse = "a" -- Enable full mouse support - ----------------------------------------------------------------------------------------------------- --- Editor visuals ----------------------------------------------------------------------------------------------------- - -opt.termguicolors = true -- Enable true color in terminals - -opt.splitkeep = "screen" -- Try not to move text when opening/closing splits -opt.wrap = false -- Do not wrap text longer than the window's width -opt.scrolloff = 2 -- Keep 2 lines above and below the cursor. -opt.sidescrolloff = 2 -- Keep 2 lines left and right of the cursor. - -opt.number = true -- Show line numbers -opt.cursorline = true -- Enable cursorline, colorscheme only shows this in number column -opt.wildmode = { "list", "full" } -- Only complete the longest common prefix and list all results -opt.fillchars = { stlnc = "─" } -- Show separators in inactive window statuslines - --- FIXME: disabled because this really fucks everything up in the terminal. -opt.title = false -- Sets the window title ---opt.titlestring = "%t%( %M%)%( (%{expand(\"%:~:.:h\")})%) - nvim" -- The format for the window title - --- Hide line numbers in terminal windows -vim.api.nvim_create_autocmd("BufEnter", { - pattern = "term://*", - callback = function() - vim.bo.number = false - end, -}) - ----------------------------------------------------------------------------------------------------- --- Editing behavior ----------------------------------------------------------------------------------------------------- - -opt.whichwrap = "" -- Never let the curser switch to the next line when reaching line end -opt.ignorecase = true -- Ignore case in search by default -opt.smartcase = true -- Be case sensitive when an upper-case character is included - -opt.expandtab = false -opt.tabstop = 4 -- Set indentation of tabs to be equal to 4 spaces. -opt.shiftwidth = 4 -opt.softtabstop = 4 -opt.shiftround = true -- Round indentation commands to next multiple of shiftwidth - --- r = insert comment leader when hitting in insert mode --- q = allow explicit formatting with gq --- j = remove comment leaders when joining lines if it makes sense -opt.formatoptions = "rqj" - -opt.virtualedit = "all" -- Allow the curser to be positioned on cells that have no actual character; --- Like moving beyond EOL or on any visual 'space' of a tab character -opt.selection = "old" -- Do not include line ends in past the-line selections -opt.smartindent = true -- Use smart auto indenting for all file types - -opt.timeoutlen = 20 -- Only wait 20 milliseconds for characters to arrive (see :help timeout) -opt.ttimeoutlen = 20 -opt.timeout = false -- Disable timeout, but enable ttimeout (only timeout on keycodes) -opt.ttimeout = true - -opt.grepprg = "rg --vimgrep --smart-case --follow" -- Replace grep with ripgrep diff --git a/users/myuser/neovim/alpha.nix b/users/myuser/neovim/alpha.nix new file mode 100644 index 0000000..9d84326 --- /dev/null +++ b/users/myuser/neovim/alpha.nix @@ -0,0 +1,45 @@ +{ + programs.nixvim.plugins.alpha = { + enable = true; + layout = let + padding = val: { + type = "padding"; + inherit val; + }; + in [ + (padding 2) + { + opts = { + hl = "Type"; + position = "center"; + }; + type = "text"; + val = [ + " ███╗ ██╗██╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ " + " ████╗ ██║██║╚██╗██╔╝██║ ██║██║████╗ ████║ " + " ██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║██╔████╔██║ " + " ██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║ " + " ██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║ " + " ╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ " + ]; + } + (padding 2) + { + type = "group"; + opts.spacing = 1; + val = [ + { + command = ":enew"; + desc = " New file"; + shortcut = "e"; + } + { + command = ":qa"; + desc = "󰅙 Quit Neovim"; + shortcut = "q"; + } + ]; + } + ]; + }; +} diff --git a/users/myuser/neovim/appearance.nix b/users/myuser/neovim/appearance.nix new file mode 100644 index 0000000..95f46a8 --- /dev/null +++ b/users/myuser/neovim/appearance.nix @@ -0,0 +1,44 @@ +{ + programs.nixvim.plugins = { + # Statusline + lualine = { + enable = true; + extensions = ["fzf" "nvim-dap-ui" "symbols-outline" "trouble" "neo-tree" "quickfix" "fugitive"]; + componentSeparators = null; + # componentSeparators.left = "|"; + # componentSeparators.right = "|"; + # sectionSeparators.left = ""; + # sectionSeparators.right = ""; + sections = { + lualine_a = ["mode"]; + lualine_b = ["branch" "filename"]; + lualine_c = ["diff" "diagnostics"]; + lualine_x = ["encoding" "fileformat" "filetype"]; + lualine_y = ["progress"]; + lualine_z = ["location"]; + }; + inactiveSections = { + lualine_a = ["filename"]; + lualine_b = []; + lualine_c = ["diagnostics"]; + lualine_x = []; + lualine_y = []; + lualine_z = ["location"]; + }; + }; + + # Line indentation markers + indent-blankline.enable = true; + + # Rainbow parentheses + rainbow-delimiters.enable = true; + + # Status updates for LSP progress in right bottom corner. + fidget.enable = true; + # Show colors + nvim-colorizer.enable = true; + + # Breadcrumbs + # TODO navic.enable = true; or dropbar? + }; +} diff --git a/users/myuser/neovim/completion.nix b/users/myuser/neovim/completion.nix new file mode 100644 index 0000000..52ec611 --- /dev/null +++ b/users/myuser/neovim/completion.nix @@ -0,0 +1,149 @@ +{ + programs.nixvim = { + plugins = { + luasnip = { + enable = true; + extraConfig = { + history = true; + # Update dynamic snippets while typing + updateevents = "TextChanged,TextChangedI"; + enable_autosnippets = true; + }; + }; + + cmp_luasnip.enable = true; + cmp-cmdline.enable = true; + cmp-cmdline-history.enable = true; + cmp-path.enable = true; + cmp-emoji.enable = true; + cmp-treesitter.enable = true; + cmp-nvim-lsp.enable = true; + cmp-nvim-lsp-document-symbol.enable = true; + cmp-nvim-lsp-signature-help.enable = true; + nvim-cmp = { + enable = true; + sources = [ + {name = "nvim_lsp_signature_help";} + {name = "nvim_lsp";} + {name = "nvim_lsp_document_symbol";} + {name = "path";} + {name = "treesitter";} + {name = "luasnip";} + {name = "emoji";} + ]; + mappingPresets = ["insert"]; + mapping = { + "" = '' + cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }) + ''; + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.scroll_docs(4)"; + "" = "cmp.mapping.abort()"; + "" = { + modes = ["i" "s"]; + action = '' + function(fallback) + local has_words_before = function() + local line, col = table.unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil + end + + if cmp.visible() then + cmp.select_next_item() + elseif require("luasnip").expandable() then + require("luasnip").expand() + elseif require("luasnip").expand_or_locally_jumpable() then + require("luasnip").expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end + ''; + }; + "" = { + modes = ["i" "s"]; + action = '' + function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end + ''; + }; + }; + formatting.fields = ["abbr" "kind" "menu"]; + formatting.format = '' + function(_, vim_item) + local icons = { + Namespace = "󰌗", + Text = "󰉿", + Method = "󰆧", + Function = "󰆧", + Constructor = "", + Field = "󰜢", + Variable = "󰀫", + Class = "󰠱", + Interface = "", + Module = "", + Property = "󰜢", + Unit = "󰑭", + Value = "󰎠", + Enum = "", + Keyword = "󰌋", + Snippet = "", + Color = "󰏘", + File = "󰈚", + Reference = "󰈇", + Folder = "󰉋", + EnumMember = "", + Constant = "󰏿", + Struct = "󰙅", + Event = "", + Operator = "󰆕", + TypeParameter = "󰊄", + Table = "", + Object = "󰅩", + Tag = "", + Array = "󰅪", + Boolean = "", + Number = "", + Null = "󰟢", + String = "󰉿", + Calendar = "", + Watch = "󰥔", + Package = "", + Copilot = "", + Codeium = "", + TabNine = "", + } + vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind) + return vim_item + end + ''; + snippet.expand = "luasnip"; + }; + + # TODO use "ray-x/lsp_signature.nvim" + }; + + extraConfigLuaPost = '' + local cmp = require "cmp" + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "cmdline" }, + { name = "cmp-cmdline-history" }, + }, + }) + ''; + }; +} diff --git a/users/myuser/neovim/default.nix b/users/myuser/neovim/default.nix index d292279..7cfed49 100644 --- a/users/myuser/neovim/default.nix +++ b/users/myuser/neovim/default.nix @@ -1,22 +1,28 @@ -# TODO whichkey # TODO vim illuminate # TODO keybinds # TODO dap dapui -# TODO neotree left darker # TODO neotree focsed shows lualine wrongly (full instead of nothing) # TODO lualine inactive ------ is ugly # TODO move lines. gomove again? # TODO vim-wordmotion vs https://github.com/chrisgrieser/nvim-various-textobjs # TODO blankline cur indent too bright { - lib, - pkgs, - ... -}: { - # TODO use programs.nixvim? and split stuff a little. - home.shellAliases.nixvim = lib.getExe (pkgs.nixvim.makeNixvim { - # TODO away once we are ready to switch (prevents shada and undohist currently) - package = pkgs.neovim-clean; + imports = [ + ./alpha.nix + ./appearance.nix + ./completion.nix + ./git.nix + ./globals.nix + ./languages.nix + ./lsp.nix + ./misc.nix + ./neo-tree.nix + ./onedark.nix + ./web-devicons.nix + ]; + + programs.nixvim = { + enable = true; # TODO for wayland: # clipboard.providers.wl-copy.enable = true; @@ -68,72 +74,7 @@ } ]; - options = { - # ------------------------------------------------------------------------------------------------- - # General - # ------------------------------------------------------------------------------------------------- - - undolevels = 1000000; # Set maximum undo levels - undofile = true; # Enable persistent undo which persists undo history across vim sessions - updatetime = 300; # Save swap file after 300ms - mouse = "a"; # Enable full mouse support - - # ------------------------------------------------------------------------------------------------- - # Editor visuals - # ------------------------------------------------------------------------------------------------- - - termguicolors = true; # Enable true color in terminals - - splitkeep = "screen"; # Try not to move text when opening/closing splits - wrap = false; # Do not wrap text longer than the window's width - scrolloff = 2; # Keep 2 lines above and below the cursor. - sidescrolloff = 2; # Keep 2 lines left and right of the cursor. - - number = true; # Show line numbers - cursorline = true; # Enable cursorline, colorscheme only shows this in number column - wildmode = ["list" "full"]; # Only complete the longest common prefix and list all results - fillchars = {stlnc = "─";}; # Show separators in inactive window statuslines - - # FIXME: disabled because this really fucks everything up in the terminal. - title = false; # Sets the window title - # titlestring = "%t%( %M%)%( (%{expand(\"%:~:.:h\")})%) - nvim"; # The format for the window title - - # ------------------------------------------------------------------------------------------------- - # Editing behavior - # ------------------------------------------------------------------------------------------------- - - whichwrap = ""; # Never let the curser switch to the next line when reaching line end - ignorecase = true; # Ignore case in search by default - smartcase = true; # Be case sensitive when an upper-case character is included - - expandtab = false; - tabstop = 4; # Set indentation of tabs to be equal to 4 spaces. - shiftwidth = 4; - softtabstop = 4; - shiftround = true; # Round indentation commands to next multiple of shiftwidth - - # r = insert comment leader when hitting in insert mode - # q = allow explicit formatting with gq - # j = remove comment leaders when joining lines if it makes sense - formatoptions = "rqj"; - - # Allow the curser to be positioned on cells that have no actual character; - # Like moving beyond EOL or on any visual 'space' of a tab character - virtualedit = "all"; - selection = "old"; # Do not include line ends in past the-line selections - smartindent = true; # Use smart auto indenting for all file types - - # Wait 500 milliseconds for characters to arrive in a mapped sequence. - # Afterwards, which-key will be opened - timeout = true; - timeoutlen = 500; - # Wait 20 (instead of 50) milliseconds for characters to arrive in the TUI. - ttimeout = true; - ttimeoutlen = 20; - - grepprg = "rg --vimgrep --smart-case --follow"; # Replace grep with ripgrep - }; - + # TODO split into files keymaps = let keymap = mode: key: action: desc: { inherit action key mode; @@ -262,677 +203,8 @@ # TODO: ... keybinds + telescope integration ]; - - plugins = { - # ------------------------------------------------------------------------------------------------- - # Library plugins - # ------------------------------------------------------------------------------------------------- - - notify = { - enable = true; - stages = "static"; - render.__raw = ''"compact"''; - icons = { - debug = ""; - error = "󰅙"; - info = ""; - trace = "󰰥"; - warn = ""; - }; - }; - - # ------------------------------------------------------------------------------------------------- - # Appearance - # ------------------------------------------------------------------------------------------------- - - # Statusline - lualine = { - enable = true; - extensions = ["fzf" "nvim-dap-ui" "symbols-outline" "trouble" "neo-tree" "quickfix" "fugitive"]; - componentSeparators = null; - # componentSeparators.left = "|"; - # componentSeparators.right = "|"; - # sectionSeparators.left = ""; - # sectionSeparators.right = ""; - sections = { - lualine_a = ["mode"]; - lualine_b = ["branch" "filename"]; - lualine_c = ["diff" "diagnostics"]; - lualine_x = ["encoding" "fileformat" "filetype"]; - lualine_y = ["progress"]; - lualine_z = ["location"]; - }; - inactiveSections = { - lualine_a = ["filename"]; - lualine_b = []; - lualine_c = ["diagnostics"]; - lualine_x = []; - lualine_y = []; - lualine_z = ["location"]; - }; - }; - - # Line indentation markers - indent-blankline.enable = true; - - # Rainbow parentheses - rainbow-delimiters.enable = true; - - # Status updates for LSP progress in right bottom corner. - fidget.enable = true; - # Show colors - nvim-colorizer.enable = true; - - # Breadcrumbs - # TODO navic.enable = true; or dropbar? - - # ------------------------------------------------------------------------------------------------- - # Language support - # ------------------------------------------------------------------------------------------------- - - treesitter = { - enable = true; - # TODO (autocmd * zR needed) folding = true; - indent = true; - - incrementalSelection = { - enable = true; - keymaps = { - initSelection = ""; - nodeIncremental = ""; - scopeIncremental = ""; - nodeDecremental = ""; - }; - }; - - nixvimInjections = true; - }; - - # Show the current function / context in topmost line - treesitter-context.enable = true; - - # Cargo.toml dependency completion - crates-nvim = { - enable = true; - extraOptions = { - src.cmp.enabled = true; - }; - }; - - # Rust specific LSP tools - rust-tools = { - enable = true; - server.check.command = "clippy"; - }; - - # ------------------------------------------------------------------------------------------------- - # Editing - # ------------------------------------------------------------------------------------------------- - - # Commenting - comment-nvim.enable = true; - # Extend vim's "%" key - vim-matchup.enable = true; - - # ---------------------------------------------------------------------------------------------------- - # Functionality - # ---------------------------------------------------------------------------------------------------- - - # Fzf picker for arbitrary stuff - telescope = { - enable = true; - enabledExtensions = ["fzf" "notify" "ui-select"]; - extensions.fzf-native.enable = true; - }; - - # Startup screen - alpha = { - enable = true; - layout = let - padding = val: { - type = "padding"; - inherit val; - }; - in [ - (padding 2) - { - opts = { - hl = "Type"; - position = "center"; - }; - type = "text"; - val = [ - " ███╗ ██╗██╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ " - " ████╗ ██║██║╚██╗██╔╝██║ ██║██║████╗ ████║ " - " ██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║██╔████╔██║ " - " ██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║ " - " ██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║ " - " ╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ " - ]; - } - (padding 2) - { - type = "group"; - opts.spacing = 1; - val = [ - { - command = ":enew"; - desc = " New file"; - shortcut = "e"; - } - { - command = ":qa"; - desc = "󰅙 Quit Neovim"; - shortcut = "q"; - } - ]; - } - ]; - }; - - # Filebrowser - neo-tree = { - enable = true; - sortCaseInsensitive = true; - usePopupsForInput = false; - popupBorderStyle = "rounded"; - # TODO window_opts.winblend = 0; - window = { - width = 34; - position = "left"; - mappings = { - "" = "open_with_window_picker"; - "s" = "split_with_window_picker"; - "v" = "vsplit_with_window_picker"; - "t" = "open_tabnew"; - "z" = "close_all_nodes"; - "Z" = "expand_all_nodes"; - "a".__raw = ''{ "add", config = { show_path = "relative" } }''; - "A".__raw = ''{ "add_directory", config = { show_path = "relative" } }''; - "c".__raw = ''{ "copy", config = { show_path = "relative" } }''; - "m".__raw = ''{ "move", config = { show_path = "relative" } }''; - }; - }; - defaultComponentConfigs = { - modified.symbol = "~ "; - indent.withExpanders = true; - name.trailingSlash = true; - gitStatus.symbols = { - added = "+"; - deleted = "✖"; - modified = ""; - renamed = "➜"; - untracked = "?"; - ignored = "󰛑"; - unstaged = ""; # 󰄱 - staged = "󰄵"; - conflict = ""; - }; - }; - filesystem = { - window.mappings = { - "gA" = "git_add_all"; - "ga" = "git_add_file"; - "gu" = "git_unstage_file"; - }; - groupEmptyDirs = true; - followCurrentFile.enabled = true; - useLibuvFileWatcher = true; - filteredItems = { - hideDotfiles = false; - hideByName = [".git"]; - }; - }; - }; - - # Undo tree - undotree = { - enable = true; - focusOnToggle = true; - windowLayout = 4; - }; - - # ------------------------------------------------------------------------------------------------- - # Git - # ------------------------------------------------------------------------------------------------- - - # Git status in signcolumn - gitsigns.enable = true; - - # Git commands - fugitive.enable = true; - - diffview.enable = true; - - # Manage git from within neovim - neogit = { - enable = true; - disableBuiltinNotifications = true; - }; - - # ------------------------------------------------------------------------------------------------- - # Completion - # ------------------------------------------------------------------------------------------------- - - lsp = { - enable = true; - preConfig = '' - local lsp_symbol = function(name, icon) - vim.fn.sign_define( - "DiagnosticSign" .. name, - { text = icon, numhl = "Diagnostic" .. name, texthl = "Diagnostic" .. name } - ) - end - - lsp_symbol("Error", "󰅙") - lsp_symbol("Info", "") - lsp_symbol("Hint", "󰌵") - lsp_symbol("Warn", "") - ''; - servers = { - bashls.enable = true; - cssls.enable = true; - html.enable = true; - lua-ls.enable = true; - rust-analyzer = { - enable = true; - settings = { - checkOnSave = true; - check.command = "clippy"; - }; - }; - nil_ls = { - enable = true; - settings = { - formatting.command = [(lib.getExe pkgs.alejandra) "--quiet"]; - }; - }; - nixd.enable = true; - }; - - #keymaps = { - # diagnostic = { - # "k" = "goto_prev"; - # "j" = "goto_next"; - # }; - # lspBuf = { - # "gd" = "definition"; - # "gD" = "references"; - # "lt" = "type_definition"; - # "gi" = "implementation"; - # "K" = "hover"; - # "k" = "hover"; - # "r" = "rename"; - # }; - #}; - }; - - none-ls = { - enable = true; - sources = { - code_actions = { - # gitsigns.enable = true; - shellcheck.enable = true; - }; - diagnostics = { - deadnix.enable = true; - gitlint.enable = true; - luacheck.enable = true; - protolint.enable = true; - shellcheck.enable = true; - }; - formatting = { - alejandra.enable = true; - jq.enable = true; - markdownlint.enable = true; - rustfmt.enable = true; - sqlfluff.enable = true; - shfmt.enable = true; - stylua.enable = true; - }; - }; - }; - - luasnip = { - enable = true; - extraConfig = { - history = true; - # Update dynamic snippets while typing - updateevents = "TextChanged,TextChangedI"; - enable_autosnippets = true; - }; - }; - - cmp_luasnip.enable = true; - cmp-cmdline.enable = true; - cmp-cmdline-history.enable = true; - cmp-path.enable = true; - cmp-emoji.enable = true; - cmp-treesitter.enable = true; - cmp-nvim-lsp.enable = true; - cmp-nvim-lsp-document-symbol.enable = true; - cmp-nvim-lsp-signature-help.enable = true; - nvim-cmp = { - enable = true; - sources = [ - {name = "nvim_lsp_signature_help";} - {name = "nvim_lsp";} - {name = "nvim_lsp_document_symbol";} - {name = "path";} - {name = "treesitter";} - {name = "luasnip";} - {name = "emoji";} - ]; - mappingPresets = ["insert"]; - mapping = { - "" = '' - cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = false, - }) - ''; - "" = "cmp.mapping.scroll_docs(-4)"; - "" = "cmp.mapping.scroll_docs(4)"; - "" = "cmp.mapping.abort()"; - "" = { - modes = ["i" "s"]; - action = '' - function(fallback) - local has_words_before = function() - local line, col = table.unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil - end - - if cmp.visible() then - cmp.select_next_item() - elseif require("luasnip").expandable() then - require("luasnip").expand() - elseif require("luasnip").expand_or_locally_jumpable() then - require("luasnip").expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end - ''; - }; - "" = { - modes = ["i" "s"]; - action = '' - function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end - ''; - }; - }; - formatting.fields = ["abbr" "kind" "menu"]; - formatting.format = '' - function(_, vim_item) - local icons = { - Namespace = "󰌗", - Text = "󰉿", - Method = "󰆧", - Function = "󰆧", - Constructor = "", - Field = "󰜢", - Variable = "󰀫", - Class = "󰠱", - Interface = "", - Module = "", - Property = "󰜢", - Unit = "󰑭", - Value = "󰎠", - Enum = "", - Keyword = "󰌋", - Snippet = "", - Color = "󰏘", - File = "󰈚", - Reference = "󰈇", - Folder = "󰉋", - EnumMember = "", - Constant = "󰏿", - Struct = "󰙅", - Event = "", - Operator = "󰆕", - TypeParameter = "󰊄", - Table = "", - Object = "󰅩", - Tag = "", - Array = "󰅪", - Boolean = "", - Number = "", - Null = "󰟢", - String = "󰉿", - Calendar = "", - Watch = "󰥔", - Package = "", - Copilot = "", - Codeium = "", - TabNine = "", - } - vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind) - return vim_item - end - ''; - snippet.expand = "luasnip"; - }; - - # TODO use "ray-x/lsp_signature.nvim" - - # TODO dap.enable = true; - - # ------------------------------------------------------------------------------------------------- - # Miscellaneous - # ------------------------------------------------------------------------------------------------- - - # Quickfix menu - trouble.enable = true; - # Highlight certain keywords - todo-comments.enable = true; - # TODO use { "liuchengxu/vista.vim", cmd = "Vista" } - which-key.enable = true; - }; - - extraPlugins = with pkgs.vimPlugins; [ - # navarasu's one dark - onedark-nvim - telescope-ui-select-nvim - nvim-web-devicons - nvim-window-picker - # Replace built-in LSP prompts and windows - dressing-nvim - # Multicursor - vim-visual-multi - # Show invalid whitespace - vim-better-whitespace - # Show latex math equations - nabla-nvim - # Modify Surrounding things like parenthesis and quotes - vim-sandwich - # TODO mini.align better? - vim-easy-align - # Case changer - text-case-nvim - # camelcase (and similar) word motions and textobjects - vim-wordmotion - # Gpg integration - vim-gnupg - # TODO temporary - vim-startuptime - ]; - - extraConfigLuaPre = '' - vim.g.operator_sandwich_no_default_key_mappings = 1 - vim.g.textobj_sandwich_no_default_key_mappings = 1 - - vim.g.wordmotion_nomap = 1 - ''; - - extraConfigLua = '' - local onedark = require "onedark" - onedark.setup { - toggle_style_key = "", - colors = { - fg = "#abb2bf", - black = "#181a1f", - bg0 = "#1e222a", - bg1 = "#252931", - bg2 = "#282c34", - bg3 = "#353b45", - bg_d = "#191c21", - bg_blue = "#73b8f1", - bg_yellow = "#ebd09c", - - dark_cyan = "#2b6f77", - dark_red = "#993939", - dark_yellow = "#93691d", - - grey = "#42464e", - grey_fg = "#565c64", - grey_fg2 = "#6f737b", - light_grey = "#6f737b", - baby_pink = "#de8c92", - pink = "#ff75a0", - nord_blue = "#81a1c1", - sun = "#ebcb8b", - light_purple = "#de98fd", - dark_purple = "#c882e7", - teal = "#519aba", - dark_pink = "#fca2aa", - light_blue = "#a3b8ef", - vibrant_green = "#7eca9c", - - red = "#e06c75", - orange = "#d19a66", - yellow = "#e5c07b", - green = "#98c379", - cyan = "#56b6c2", - blue = "#61afef", - purple = "#c678dd", - - diff_add = "#31392b", - diff_delete = "#382b2c", - diff_change = "#1c3448", - diff_text = "#2c5372", - }, - highlights = { - CursorLine = { bg = "$bg0" }, - FloatBorder = { fg = "$blue" }, - NeoTreeTabActive = { fg = "$fg", bg = "$bg_d" }, - NeoTreeTabInactive = { fg = "$grey", bg = "$black" }, - NeoTreeTabSeparatorActive = { fg = "$black", bg = "$black" }, - NeoTreeTabSeparatorInactive = { fg = "$black", bg = "$black" }, - NeoTreeWinSeparator = { fg = "$bg_d", bg = "$bg_d" }, - NeoTreeVertSplit = { fg = "$bg_d", bg = "$bg_d" }, - VisualMultiMono = { fg = "$purple", bg = "$diff_change" }, - VisualMultiExtend = { bg = "$diff_change" }, - VisualMultiCursor = { fg = "$purple", bg = "$diff_change" }, - VisualMultiInsert = { fg = "$blue", bg = "$diff_change" }, - }, - } - vim.g.VM_Mono_hl = "VisualMultiMono" - vim.g.VM_Extend_hl = "VisualMultiExtend" - vim.g.VM_Cursor_hl = "VisualMultiCursor" - vim.g.VM_Insert_hl = "VisualMultiInsert" - onedark.load() - ''; - - extraConfigLuaPost = '' - require("nvim-web-devicons").setup { - override = { - default_icon = { icon = "󰈚", name = "Default", }, - c = { icon = "", name = "c", }, - css = { icon = "", name = "css", }, - dart = { icon = "", name = "dart", }, - deb = { icon = "", name = "deb", }, - Dockerfile = { icon = "", name = "Dockerfile", }, - html = { icon = "", name = "html", }, - jpeg = { icon = "󰉏", name = "jpeg", }, - jpg = { icon = "󰉏", name = "jpg", }, - js = { icon = "󰌞", name = "js", }, - kt = { icon = "󱈙", name = "kt", }, - lock = { icon = "󰌾", name = "lock", }, - lua = { icon = "", name = "lua", }, - mp3 = { icon = "󰎆", name = "mp3", }, - mp4 = { icon = "", name = "mp4", }, - out = { icon = "", name = "out", }, - png = { icon = "󰉏", name = "png", }, - py = { icon = "", name = "py", }, - ["robots.txt"] = { icon = "󰚩", name = "robots", }, - toml = { icon = "", name = "toml", }, - ts = { icon = "󰛦", name = "ts", }, - ttf = { icon = "", name = "TrueTypeFont", }, - rb = { icon = "", name = "rb", }, - rpm = { icon = "", name = "rpm", }, - vue = { icon = "󰡄", name = "vue", }, - woff = { icon = "", name = "WebOpenFontFormat", }, - woff2 = { icon = "", name = "WebOpenFontFormat2", }, - xz = { icon = "", name = "xz", }, - zip = { icon = "", name = "zip", }, - }, - default = true, - } - - local cmp = require "cmp" - cmp.setup.cmdline(":", { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = "cmdline" }, - { name = "cmp-cmdline-history" }, - }, - }) - - require("window-picker").setup { - hint = "floating-big-letter", - filter_rules = { - bo = { - filetype = { "neo-tree", "neo-tree-popup", "notify", "quickfix" }, - buftype = { "terminal", "quickfix", "prompt" }, - }, - }, - floating_big_letter = { - font = "ansi-shadow", - }, - selection_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - show_prompt = false, - } - - require("dressing").setup { - input = { - prefer_width = 80, - max_width = { 140, 0.9 }, - min_width = { 80, 0.6 }, - win_options = { - winblend = 0, - }, - }, - } - ''; - }); - - home.packages = let - nvimConfig = pkgs.neovimUtils.makeNeovimConfig { - wrapRc = false; - withPython3 = true; - withRuby = true; - withNodeJs = true; - extraPython3Packages = p: with p; [openai]; - }; - in [(pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped nvimConfig)]; + }; home.sessionVariables.EDITOR = "nvim"; home.shellAliases.vimdiff = "nvim -d"; - - xdg.configFile = { - "nvim/ftplugin".source = ./ftplugin; - "nvim/init.lua".source = ./init.lua; - "nvim/lua".source = ./lua; - }; } diff --git a/users/myuser/neovim/ftplugin/nix.lua b/users/myuser/neovim/ftplugin/nix.lua deleted file mode 100644 index 61d6fcf..0000000 --- a/users/myuser/neovim/ftplugin/nix.lua +++ /dev/null @@ -1,4 +0,0 @@ -vim.opt_local.expandtab = true -vim.opt_local.tabstop = 2 -vim.opt_local.shiftwidth = 2 -vim.opt_local.softtabstop = 2 diff --git a/users/myuser/neovim/git.nix b/users/myuser/neovim/git.nix new file mode 100644 index 0000000..8589de8 --- /dev/null +++ b/users/myuser/neovim/git.nix @@ -0,0 +1,17 @@ +{ + programs.nixvim.plugins = { + # Git status in signcolumn + gitsigns.enable = true; + + # Git commands + fugitive.enable = true; + + diffview.enable = true; + + # Manage git from within neovim + neogit = { + enable = true; + disableBuiltinNotifications = true; + }; + }; +} diff --git a/users/myuser/neovim/globals.nix b/users/myuser/neovim/globals.nix new file mode 100644 index 0000000..ba591e3 --- /dev/null +++ b/users/myuser/neovim/globals.nix @@ -0,0 +1,67 @@ +{ + programs.nixvim.options = { + # ------------------------------------------------------------------------------------------------- + # General + # ------------------------------------------------------------------------------------------------- + + undolevels = 1000000; # Set maximum undo levels + undofile = true; # Enable persistent undo which persists undo history across vim sessions + updatetime = 300; # Save swap file after 300ms + mouse = "a"; # Enable full mouse support + + # ------------------------------------------------------------------------------------------------- + # Editor visuals + # ------------------------------------------------------------------------------------------------- + + termguicolors = true; # Enable true color in terminals + + splitkeep = "screen"; # Try not to move text when opening/closing splits + wrap = false; # Do not wrap text longer than the window's width + scrolloff = 2; # Keep 2 lines above and below the cursor. + sidescrolloff = 2; # Keep 2 lines left and right of the cursor. + + number = true; # Show line numbers + cursorline = true; # Enable cursorline, colorscheme only shows this in number column + wildmode = ["list" "full"]; # Only complete the longest common prefix and list all results + fillchars = {stlnc = "─";}; # Show separators in inactive window statuslines + + # FIXME: disabled because this really fucks everything up in the terminal. + title = false; # Sets the window title + # titlestring = "%t%( %M%)%( (%{expand(\"%:~:.:h\")})%) - nvim"; # The format for the window title + + # ------------------------------------------------------------------------------------------------- + # Editing behavior + # ------------------------------------------------------------------------------------------------- + + whichwrap = ""; # Never let the curser switch to the next line when reaching line end + ignorecase = true; # Ignore case in search by default + smartcase = true; # Be case sensitive when an upper-case character is included + + expandtab = false; + tabstop = 4; # Set indentation of tabs to be equal to 4 spaces. + shiftwidth = 4; + softtabstop = 4; + shiftround = true; # Round indentation commands to next multiple of shiftwidth + + # r = insert comment leader when hitting in insert mode + # q = allow explicit formatting with gq + # j = remove comment leaders when joining lines if it makes sense + formatoptions = "rqj"; + + # Allow the curser to be positioned on cells that have no actual character; + # Like moving beyond EOL or on any visual 'space' of a tab character + virtualedit = "all"; + selection = "old"; # Do not include line ends in past the-line selections + smartindent = true; # Use smart auto indenting for all file types + + # Wait 500 milliseconds for characters to arrive in a mapped sequence. + # Afterwards, which-key will be opened + timeout = true; + timeoutlen = 500; + # Wait 20 (instead of 50) milliseconds for characters to arrive in the TUI. + ttimeout = true; + ttimeoutlen = 20; + + grepprg = "rg --vimgrep --smart-case --follow"; # Replace grep with ripgrep + }; +} diff --git a/users/myuser/neovim/init.lua b/users/myuser/neovim/init.lua deleted file mode 100644 index 8e2bcbf..0000000 --- a/users/myuser/neovim/init.lua +++ /dev/null @@ -1,175 +0,0 @@ -pcall(require, "impatient") -require "options" -require "keymaps" - --- TODO: this should be in treesitter.lua, but it doesn't work there. --- Something is overriding it. --- Use treesitter to determine folds, and always start unfolded. --- FIXME: disabled because extremely slow. apparently called for each line. ---vim.opt.foldlevelstart = 99 ---vim.opt.foldmethod = 'expr' ---vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' - -local function conf_module(module) - return "require('plugins." .. module .. "')" -end -local function conf_setup(module) - return "require('" .. module .. "').setup(require('plugins.others')['" .. module .. "'] or {})" -end -local function conf_fn(module) - return "require('plugins.others')['" .. module .. "']()" -end -local bootstrap = require "utils.bootstrap" -local packer_bootstrap = bootstrap.ensure_packer() -local packer = require "packer" - -return packer.startup(function(use) - use "wbthomason/packer.nvim" -- Packer can manage itself - use "lewis6991/impatient.nvim" -- Lua module cache - - ---------------------------------------------------------------------------------------------------- - -- Library plugins - ---------------------------------------------------------------------------------------------------- - - -- Utility functions - use "nvim-lua/plenary.nvim" - use "nvim-lua/popup.nvim" - use "MunifTanjim/nui.nvim" - -- Notifications (should be early) - use { "rcarriga/nvim-notify", config = conf_fn "notify" } - -- Icon definitions for use in other plugins - use { "kyazdani42/nvim-web-devicons", config = conf_fn "nvim-web-devicons" } - - ---------------------------------------------------------------------------------------------------- - -- Appearance - ---------------------------------------------------------------------------------------------------- - - -- Colorscheme - use { "navarasu/onedark.nvim", config = conf_fn "onedark" } - -- Statusline - use { "nvim-lualine/lualine.nvim", config = conf_fn "lualine", after = "onedark.nvim" } - -- Colored parentheses - use "p00f/nvim-ts-rainbow" - -- Line indentation markers - use { "lukas-reineke/indent-blankline.nvim", config = conf_setup "indent_blankline" } - -- Show invalid whitespace - use { "ntpeters/vim-better-whitespace", config = conf_fn "better-whitespace" } - -- Git status in signcolumn - use { "lewis6991/gitsigns.nvim", config = conf_module "gitsigns" } - -- Replace built-in LSP prompts and windows - use { "stevearc/dressing.nvim", config = conf_setup "dressing" } - -- Status updates for LSP progress in right bottom corner. - use { "j-hui/fidget.nvim", after = "nvim-lspconfig", config = conf_setup "fidget", tag = "legacy" } - -- Show latex math equations - use { "jbyuki/nabla.nvim", config = conf_fn "nabla" } - -- Show colors - use { "norcalli/nvim-colorizer.lua", config = conf_setup "colorizer" } - - ---------------------------------------------------------------------------------------------------- - -- Language support - ---------------------------------------------------------------------------------------------------- - - -- Syntax parsing - use { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate", config = conf_module "treesitter" } - use { "nvim-treesitter/playground", after = "nvim-treesitter" } - -- Rust specific tools - use { "simrat39/rust-tools.nvim", before = "nvim-lspconfig" } - -- Language server configurations - use { "neovim/nvim-lspconfig", config = conf_module "lspconfig" } - -- Neovim as an additional language server - use { "jose-elias-alvarez/null-ls.nvim", config = conf_fn "null-ls" } - -- Nushell syntax via treesitter - use { - "LhKipp/nvim-nu", - run = ":TSInstall nu", - config = function() - require("nu").setup {} - end, - } - - ---------------------------------------------------------------------------------------------------- - -- Editing - ---------------------------------------------------------------------------------------------------- - - -- Multicursor - use { "mg979/vim-visual-multi" } - -- Commenting - use { "numToStr/Comment.nvim", config = conf_setup "Comment" } - -- Modify Surrounding things like parenthesis and quotes - use { "machakann/vim-sandwich", config = conf_fn "sandwich" } - -- Extend vim's "%" key - use "andymass/vim-matchup" - -- Align - use "junegunn/vim-easy-align" - -- Move blocks - use { "booperlv/nvim-gomove", config = conf_setup "gomove" } - -- Case changer - use "johmsalas/text-case.nvim" - -- camelcase (and similar) word motions and textobjects - use { "chaoren/vim-wordmotion", config = conf_fn "wordmotion" } - -- Respect editor-config files - use { "gpanders/editorconfig.nvim" } - - ---------------------------------------------------------------------------------------------------- - -- Functionality - ---------------------------------------------------------------------------------------------------- - - -- Startup screen - use { "goolord/alpha-nvim", config = conf_module "alpha" } - -- Window Picker - use { "s1n7ax/nvim-window-picker", tag = "v1.*", config = conf_setup "window-picker" } - -- Filebrowser - use { "nvim-neo-tree/neo-tree.nvim", branch = "main", config = conf_module "neo-tree" } - -- Telescope fzf native - use { "nvim-telescope/telescope-fzf-native.nvim", run = "make" } - -- Anything Picker - use { - "nvim-telescope/telescope.nvim", - config = conf_module "telescope", - after = { "telescope-fzf-native.nvim", "nvim-notify" }, - } - -- Git integration - use "tpope/vim-fugitive" - use "sindrets/diffview.nvim" - use { "TimUntersberger/neogit", config = conf_setup "neogit" } - -- Undo tree - use { "mbbill/undotree", config = conf_fn "undotree" } - -- Gpg integration - use "jamessan/vim-gnupg" - - ---------------------------------------------------------------------------------------------------- - -- Completion - ---------------------------------------------------------------------------------------------------- - - -- Snippet engine - use { "L3MON4D3/LuaSnip", tag = "v1.*" } - -- Completion engine - use { "hrsh7th/nvim-cmp", config = conf_module "cmp", after = "LuaSnip" } - -- Luasnip completion source - use { "saadparwaiz1/cmp_luasnip", after = "nvim-cmp" } - -- Internal LSP completion source - use { "hrsh7th/cmp-nvim-lsp", after = "cmp_luasnip" } - -- Buffer words completion source - use { "hrsh7th/cmp-buffer", after = "cmp_luasnip" } - -- Cmdline completion source - use { "hrsh7th/cmp-cmdline", after = "cmp_luasnip" } - -- path completion source - use { "hrsh7th/cmp-path", after = "cmp_luasnip" } - -- emoji completion source - use { "hrsh7th/cmp-emoji", after = "cmp_luasnip" } - -- Shows function signatures on hover - use "ray-x/lsp_signature.nvim" - - ---------------------------------------------------------------------------------------------------- - -- Miscellaneous - ---------------------------------------------------------------------------------------------------- - - use { "folke/trouble.nvim", config = conf_setup "trouble" } - use { "folke/todo-comments.nvim", config = conf_setup "todo-comments" } - use { "liuchengxu/vista.vim", cmd = "Vista" } - - -- Automatically sync after installing for the first time - if packer_bootstrap then - packer.sync() - end -end) diff --git a/users/myuser/neovim/languages.nix b/users/myuser/neovim/languages.nix new file mode 100644 index 0000000..bf91dc3 --- /dev/null +++ b/users/myuser/neovim/languages.nix @@ -0,0 +1,47 @@ +{ + programs.nixvim = { + files."ftplugin/nix.lua".extraConfigLua = '' + vim.opt_local.expandtab = true + vim.opt_local.tabstop = 2 + vim.opt_local.shiftwidth = 2 + vim.opt_local.softtabstop = 2 + ''; + + plugins = { + treesitter = { + enable = true; + # TODO (autocmd * zR needed) folding = true; + indent = true; + + incrementalSelection = { + enable = true; + keymaps = { + initSelection = ""; + nodeIncremental = ""; + scopeIncremental = ""; + nodeDecremental = ""; + }; + }; + + nixvimInjections = true; + }; + + # Show the current function / context in topmost line + treesitter-context.enable = true; + + # Cargo.toml dependency completion + crates-nvim = { + enable = true; + extraOptions = { + src.cmp.enabled = true; + }; + }; + + # Rust specific LSP tools + rust-tools = { + enable = true; + server.check.command = "clippy"; + }; + }; + }; +} diff --git a/users/myuser/neovim/lsp.nix b/users/myuser/neovim/lsp.nix new file mode 100644 index 0000000..876ac88 --- /dev/null +++ b/users/myuser/neovim/lsp.nix @@ -0,0 +1,91 @@ +{ + lib, + pkgs, + ... +}: { + programs.nixvim.plugins = { + lsp = { + enable = true; + preConfig = '' + local lsp_symbol = function(name, icon) + vim.fn.sign_define( + "DiagnosticSign" .. name, + { text = icon, numhl = "Diagnostic" .. name, texthl = "Diagnostic" .. name } + ) + end + + lsp_symbol("Error", "󰅙") + lsp_symbol("Info", "") + lsp_symbol("Hint", "󰌵") + lsp_symbol("Warn", "") + ''; + servers = { + bashls.enable = true; + cssls.enable = true; + html.enable = true; + lua-ls.enable = true; + rust-analyzer = { + enable = true; + settings = { + checkOnSave = true; + check.command = "clippy"; + }; + # cargo and rustc are managed per project with their own flakes. + installCargo = false; + installRustc = false; + }; + nil_ls = { + enable = true; + settings = { + formatting.command = [(lib.getExe pkgs.alejandra) "--quiet"]; + }; + }; + nixd.enable = true; + }; + + #keymaps = { + # diagnostic = { + # "k" = "goto_prev"; + # "j" = "goto_next"; + # }; + # lspBuf = { + # "gd" = "definition"; + # "gD" = "references"; + # "lt" = "type_definition"; + # "gi" = "implementation"; + # "K" = "hover"; + # "k" = "hover"; + # "r" = "rename"; + # }; + #}; + }; + + none-ls = { + enable = true; + sources = { + code_actions = { + # gitsigns.enable = true; + shellcheck.enable = true; + }; + diagnostics = { + deadnix.enable = true; + gitlint.enable = true; + luacheck.enable = true; + protolint.enable = true; + shellcheck.enable = true; + }; + formatting = { + alejandra.enable = true; + jq.enable = true; + markdownlint.enable = true; + rustfmt.enable = true; + sqlfluff.enable = true; + shfmt.enable = true; + stylua.enable = true; + }; + }; + }; + + # TODO dap.enable = true; + }; +} diff --git a/users/myuser/neovim/lua/keymaps.lua b/users/myuser/neovim/lua/keymaps.lua deleted file mode 100644 index a4f4985..0000000 --- a/users/myuser/neovim/lua/keymaps.lua +++ /dev/null @@ -1,125 +0,0 @@ -local default_opts = { noremap = true, silent = true } -local function map(mode, lhs, rhs, opts) - for c in mode:gmatch "." do - vim.api.nvim_set_keymap(c, lhs, rhs, opts or default_opts) - end -end - ----------------------------------------------------------------------------------------------------- --- General ----------------------------------------------------------------------------------------------------- - --- Shift + scroll with cursor locked to position -map("", "", "") -map("", "", "") -map("i", "", "a") -map("i", "", "a") - --- Shift + Alt + change the current window size -map("n", "", ":resize -2") -map("n", "", ":resize +2") -map("n", "", ":vertical resize -2") -map("n", "", ":vertical resize +2") - --- Allow exiting terminal mode -map("t", "", "") --- Allow C-w in terminal mode -map("t", "", "") - --- Open fixed size terminal window at the bottom -map("n", "", ":belowright new | setlocal wfh | resize 10 | terminal") - ----------------------------------------------------------------------------------------------------- --- Language server ----------------------------------------------------------------------------------------------------- - -map("n", "gD", "lua vim.lsp.buf.declaration()") -map("n", "gd", "lua require('telescope.builtin').lsp_definitions()") -map("n", "K", "lua vim.lsp.buf.hover()") -map("n", "gi", "lua require('telescope.builtin').lsp_implementations()") -map("n", "", "lua vim.lsp.buf.signature_help()") -map("n", "wa", "lua vim.lsp.buf.add_workspace_folder()") -map("n", "wr", "lua vim.lsp.buf.remove_workspace_folder()") -map("n", "wl", "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))") -map("n", "gt", "lua require('telescope.builtin').lsp_type_definitions()") -map("n", "r", "lua vim.lsp.buf.rename()") -map("n", "a", "lua vim.lsp.buf.code_action()") -map("n", "gr", "lua require('telescope.builtin').lsp_references()") -map("n", "gl", "lua vim.diagnostic.open_float()") -map("n", "[d", "lua vim.diagnostic.goto_prev()") -map("n", "]d", "lua vim.diagnostic.goto_next()") -map("n", "q", "lua vim.diagnostic.setloclist()") -map("n", "f", "lua vim.lsp.buf.format { async = true }") - ----------------------------------------------------------------------------------------------------- --- Plugin: Easy Align ----------------------------------------------------------------------------------------------------- - -map("n", "A", "(EasyAlign)") -map("v", "A", "(EasyAlign)") - ----------------------------------------------------------------------------------------------------- --- Plugin: Undotree ---[[ ---------------------------------------------------------------------------------------------------- -]] -map("n", "u", ":UndotreeToggle") - ----------------------------------------------------------------------------------------------------- --- Plugin: Better Whitespace ----------------------------------------------------------------------------------------------------- - -map("n", "$", ":StripWhitespace") - ----------------------------------------------------------------------------------------------------- --- Plugin: Neotree ----------------------------------------------------------------------------------------------------- - --- Mappings to open the tree / find the current file -map("n", "t", ":Neotree toggle") -map("n", "T", ":Neotree reveal") -map("n", "G", ":Neotree float git_status") -map("n", "b", ":Neotree float buffers") - ----------------------------------------------------------------------------------------------------- --- Plugin: Sandwich ----------------------------------------------------------------------------------------------------- - -map("nv", "m", "(operator-sandwich-add)") -map("nv", "M", "(operator-sandwich-delete)") -map("nv", "C-m", "(operator-sandwich-replace)") - ----------------------------------------------------------------------------------------------------- --- Plugin: gomove ----------------------------------------------------------------------------------------------------- - ---map("n", "", "GoNSMLeft") ---map("n", "", "GoNSMDown") ---map("n", "", "GoNSMUp") ---map("n", "", "GoNSMRight") - -map("x", "", "GoVSMLeft") -map("x", "", "GoVSMDown") -map("x", "", "GoVSMUp") -map("x", "", "GoVSMRight") - ---map("n", "", "GoNSDLeft") ---map("n", "", "GoNSDDown") ---map("n", "", "GoNSDUp") ---map("n", "", "GoNSDRight") - -map("x", "", "GoVSDLeft") -map("x", "", "GoVSDDown") -map("x", "", "GoVSDUp") -map("x", "", "GoVSDRight") - ----------------------------------------------------------------------------------------------------- --- Plugin: wordmotion ----------------------------------------------------------------------------------------------------- - -map("xo", "ie", "WordMotion_iw") - ----------------------------------------------------------------------------------------------------- --- Plugin: textcase ----------------------------------------------------------------------------------------------------- - --- TODO: ... keybinds + telescope integration diff --git a/users/myuser/neovim/lua/options.lua b/users/myuser/neovim/lua/options.lua deleted file mode 100644 index 0f36eb2..0000000 --- a/users/myuser/neovim/lua/options.lua +++ /dev/null @@ -1,66 +0,0 @@ -local opt = vim.opt -local g = vim.g - -g.mapleader = "," - ----------------------------------------------------------------------------------------------------- --- General ----------------------------------------------------------------------------------------------------- - -opt.undolevels = 1000000 -- Set maximum undo levels -opt.undofile = true -- Enable persistent undo which persists undo history across vim sessions -opt.updatetime = 300 -- Save swap file after 300ms -opt.mouse = "a" -- Enable full mouse support - ----------------------------------------------------------------------------------------------------- --- Editor visuals ----------------------------------------------------------------------------------------------------- - -opt.termguicolors = true -- Enable true color in terminals - -opt.splitkeep = "screen" -- Try not to move text when opening/closing splits -opt.wrap = false -- Do not wrap text longer than the window's width -opt.scrolloff = 2 -- Keep 2 lines above and below the cursor. -opt.sidescrolloff = 2 -- Keep 2 lines left and right of the cursor. - -opt.number = true -- Show line numbers -opt.cursorline = true -- Enable cursorline, colorscheme only shows this in number column -opt.wildmode = { "list", "full" } -- Only complete the longest common prefix and list all results -opt.fillchars = { stlnc = "─" } -- Show separators in inactive window statuslines - --- FIXME: disabled because this really fucks everything up in the terminal. -opt.title = false -- Sets the window title ---opt.titlestring = "%t%( %M%)%( (%{expand(\"%:~:.:h\")})%) - nvim" -- The format for the window title - --- Hide line numbers in terminal windows -vim.api.nvim_exec([[au BufEnter term://* setlocal nonumber]], false) - ----------------------------------------------------------------------------------------------------- --- Editing behavior ----------------------------------------------------------------------------------------------------- - -opt.whichwrap = "" -- Never let the curser switch to the next line when reaching line end -opt.ignorecase = true -- Ignore case in search by default -opt.smartcase = true -- Be case sensitive when an upper-case character is included - -opt.expandtab = false -opt.tabstop = 4 -- Set indentation of tabs to be equal to 4 spaces. -opt.shiftwidth = 4 -opt.softtabstop = 4 -opt.shiftround = true -- Round indentation commands to next multiple of shiftwidth - -opt.formatoptions = "rqj" -- r = insert comment leader when hitting in insert mode --- q = allow explicit formatting with gq --- j = remove comment leaders when joining lines if it makes sense - -opt.virtualedit = "all" -- Allow the curser to be positioned on cells that have no actual character; --- Like moving beyond EOL or on any visual 'space' of a tab character -opt.selection = "old" -- Do not include line ends in past the-line selections -opt.smartindent = true -- Use smart auto indenting for all file types - -opt.timeoutlen = 20 -- Only wait 20 milliseconds for characters to arrive (see :help timeout) -opt.ttimeoutlen = 20 -opt.timeout = false -- Disable timeout, but enable ttimeout (only timeout on keycodes) -opt.ttimeout = true - -opt.grepprg = "rg --vimgrep --smart-case --follow" -- Replace grep with ripgrep diff --git a/users/myuser/neovim/lua/plugins/alpha.lua b/users/myuser/neovim/lua/plugins/alpha.lua deleted file mode 100644 index f6b634a..0000000 --- a/users/myuser/neovim/lua/plugins/alpha.lua +++ /dev/null @@ -1,86 +0,0 @@ -local function button(shortcut, txt, keybind, keybind_opts) - local opts = { - position = "center", - shortcut = shortcut, - cursor = 5, - width = 50, - align_shortcut = "right", - hl_shortcut = "Keyword", - } - - if keybind then - keybind_opts = vim.F.if_nil(keybind_opts, { noremap = true, silent = true }) - opts.keymap = { "n", shortcut, keybind, keybind_opts } - end - - local function on_press() - local key = vim.api.nvim_replace_termcodes(shortcut .. "", true, false, true) - vim.api.nvim_feedkeys(key, "normal", false) - end - - return { - type = "button", - val = txt, - on_press = on_press, - opts = opts, - } -end - -local function buttons(xs, spacing) - return { - type = "group", - val = xs, - opts = { spacing = vim.F.if_nil(spacing, 1) }, - } -end - -local function text(value, hl) - return { - type = "text", - val = value, - opts = { - position = "center", - hl = hl, - }, - } -end - -local function pad(lines) - return { type = "padding", val = lines } -end - -local header = { - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣶⣶⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⢸⣄⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⠛⠀⠀⠹⣧⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⠀⠀⣿⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⢠⠀⡄⠀⣿⠀⢀⣤⣤⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⢰⡏⠚⠀⠃⠀⣿⣴⠞⠉⢹⠀⠀", - "⠀⣀⡀⠀⠀⠀⠀⢀⣸⠇⠀⠀⠀⠀⠈⠀⠀⣀⡿⠀⠀", - "⢸⣟⠛⢳⣤⣤⡶⠛⠃⠀⣠⠀⠀⠀⠚⣶⡾⠟⠀⠀⠀", - "⠀⠉⢷⣤⣀⣀⣀⣀⣠⡾⠻⣧⡀⠀⠀⢘⣷⣄⣀⣤⣄", - "⠀⠀⠀⠈⠉⠉⠉⠉⠉⠀⠀⠘⠻⣦⣤⣈⣁⣀⣠⣾⠋", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠉⠉⠀⠀", -} - -require("alpha").setup { - layout = { - pad(2), - text(header, "Type"), - --pad(2), text(separator, 'Number'), - pad(2), - buttons { - button("e", " New file", ":enew"), - --button("f", " Find file", ":Telescope find_files"), - --button("w", " Find word", ":Telescope grep_string"), - }, - pad(2), - buttons { - button("u", " Update plugins", ":PackerSync"), - button("h", " Check health", ":checkhealth"), - button("q", " Quit", ":qa"), - }, - --text(separator, 'Number'), - }, - opts = { margin = 5 }, -} diff --git a/users/myuser/neovim/lua/plugins/cmp.lua b/users/myuser/neovim/lua/plugins/cmp.lua deleted file mode 100644 index 377c94c..0000000 --- a/users/myuser/neovim/lua/plugins/cmp.lua +++ /dev/null @@ -1,97 +0,0 @@ --- TODO: lspconfig keymappings --- TODO: a inserts literal tab instead of completing when in a word with characters ahead --- TODO: some way to search fuzzy in completion window --- TODO: completion should be repeatable with . -local cmp = require "cmp" -if cmp == nil then - return -end - -local icons = require("utils.icons").lspkind -local luasnip = require "luasnip" -local compare = cmp.config.compare - --- Show completion menu also if only one item is available (for context) -vim.opt.completeopt = { "menu", "menuone", "preview" } - -local has_words_before = function() - local line, col = table.unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil -end - -cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - formatting = { - format = function(_, vim_item) - vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind) - return vim_item - end, - }, - mapping = cmp.mapping.preset.insert { - [""] = cmp.config.disable, - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.close(), - [""] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = false, - }, - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s", "c" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s", "c" }), - }, - sorting = { - priority_weight = 2, - comparators = { - compare.locality, - compare.recently_used, - compare.offset, - compare.exact, - -- compare.scopes, - compare.score, - compare.kind, - compare.sort_text, - compare.length, - compare.order, - }, - }, - sources = cmp.config.sources({ - { name = "path", priority_weight = 105 }, - { name = "luasnip", priority_weight = 103 }, - { name = "nvim_lsp", priority_weight = 100 }, - { name = "nvim_lsp_signature_help", priority_weight = 99 }, - { name = "nvim_lua", priority_weight = 60 }, - { name = "buffer", priority_weight = 50 }, - { name = "emoji", priority_weight = 50 }, - }, { - { name = "buffer", priority_weight = 50 }, - }), -} - -cmp.setup.cmdline(":", { - sources = { - { name = "cmdline" }, - }, -}) diff --git a/users/myuser/neovim/lua/plugins/gitsigns.lua b/users/myuser/neovim/lua/plugins/gitsigns.lua deleted file mode 100644 index e96e93b..0000000 --- a/users/myuser/neovim/lua/plugins/gitsigns.lua +++ /dev/null @@ -1 +0,0 @@ -require("gitsigns").setup {} diff --git a/users/myuser/neovim/lua/plugins/lspconfig.lua b/users/myuser/neovim/lua/plugins/lspconfig.lua deleted file mode 100644 index 2428f07..0000000 --- a/users/myuser/neovim/lua/plugins/lspconfig.lua +++ /dev/null @@ -1,78 +0,0 @@ -local lsp_symbol = function(name, icon) - vim.fn.sign_define( - "DiagnosticSign" .. name, - { text = icon, numhl = "Diagnostic" .. name, texthl = "Diagnostic" .. name } - ) -end - -lsp_symbol("Error", "") -lsp_symbol("Info", "") -lsp_symbol("Hint", "") -lsp_symbol("Warn", "") - -vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - border = "single", -}) - -vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { - border = "single", - focusable = false, - relative = "cursor", -}) - --- Borders for LspInfo winodw -local win = require "lspconfig.ui.windows" -local _default_opts = win.default_opts - -win.default_opts = function(options) - local opts = _default_opts(options) - opts.border = "single" - return opts -end - -local lspconfig = require "lspconfig" - --- lua: https://github.com/sumneko/lua-language-server -lspconfig.sumneko_lua.setup { - settings = { - Lua = { - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { "vim" }, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { enable = false }, - }, - }, -} - -lspconfig.clangd.setup {} -lspconfig.bashls.setup {} -lspconfig.cmake.setup {} -lspconfig.html.setup {} -lspconfig.jdtls.setup {} -lspconfig.pyright.setup {} -lspconfig.texlab.setup {} - -local rt = require "rust-tools" -rt.setup { - server = { - on_attach = function(_, bufnr) - -- Hover actions - vim.keymap.set("n", "", rt.hover_actions.hover_actions, { buffer = bufnr }) - end, - settings = { - ["rust-analyzer"] = { - checkOnSave = { - command = "clippy", - }, - }, - }, - }, -} - -require("lsp_signature").setup() diff --git a/users/myuser/neovim/lua/plugins/neo-tree.lua b/users/myuser/neovim/lua/plugins/neo-tree.lua deleted file mode 100644 index 2cbc8b7..0000000 --- a/users/myuser/neovim/lua/plugins/neo-tree.lua +++ /dev/null @@ -1,101 +0,0 @@ -vim.cmd [[let g:neo_tree_remove_legacy_commands = 1]] --- local notify = function(message, level) --- vim.notify(message, level, { title = "NeoTree" }) --- end - -require("neo-tree").setup { - sort_case_insensitive = true, - use_popups_for_input = false, - popup_border_style = "rounded", - -- source_selector = { - -- winbar = true, - -- separator = { left = "", right= "" }, - -- }, - win_options = { - winblend = 0, - }, - default_component_configs = { - modified = { - symbol = "~ ", - }, - indent = { - with_expanders = true, - }, - name = { - trailing_slash = true, - }, - git_status = { - symbols = { - added = "+", - deleted = "✖", - modified = "", - renamed = "➜", - untracked = "?", - ignored = "", - unstaged = "", - staged = "", - conflict = "", - }, - }, - }, - window = { - width = 34, - position = "left", - mappings = { - [""] = "open_with_window_picker", - ["s"] = "split_with_window_picker", - ["v"] = "vsplit_with_window_picker", - ["t"] = "open_tabnew", - ["z"] = "close_all_nodes", - ["Z"] = "expand_all_nodes", - ["a"] = { "add", config = { show_path = "relative" } }, - ["A"] = { "add_directory", config = { show_path = "relative" } }, - ["c"] = { "copy", config = { show_path = "relative" } }, - ["m"] = { "move", config = { show_path = "relative" } }, - }, - }, - filesystem = { - window = { - mappings = { - ["gA"] = "git_add_all", - ["ga"] = "git_add_file", - ["gu"] = "git_unstage_file", - }, - }, - group_empty_dirs = true, - follow_current_file = { - enabled = true, - }, - use_libuv_file_watcher = true, - filtered_items = { - hide_dotfiles = false, - hide_by_name = { ".git" }, - }, - }, - -- event_handlers = { - -- { - -- event = "file_added", - -- handler = function(arg) - -- notify("Added: " .. arg, "info") - -- end, - -- }, - -- { - -- event = "file_deleted", - -- handler = function(arg) - -- notify("Deleted: " .. arg, "info") - -- end, - -- }, - -- { - -- event = "file_renamed", - -- handler = function(args) - -- notify("Renamed: " .. args.source .. " -> " .. args.destination, "info") - -- end, - -- }, - -- { - -- event = "file_moved", - -- handler = function(args) - -- notify("Moved: " .. args.source .. " -> " .. args.destination, "info") - -- end, - -- }, - -- }, -} diff --git a/users/myuser/neovim/lua/plugins/others.lua b/users/myuser/neovim/lua/plugins/others.lua deleted file mode 100644 index b4b42d9..0000000 --- a/users/myuser/neovim/lua/plugins/others.lua +++ /dev/null @@ -1,205 +0,0 @@ -local configs = { - ["dressing"] = { - input = { - prefer_width = 80, - max_width = { 140, 0.9 }, - min_width = { 80, 0.6 }, - win_options = { - winblend = 0, - }, - }, - }, - ["null-ls"] = function() - local null_ls = require "null-ls" - null_ls.setup { - sources = { - null_ls.builtins.code_actions.shellcheck, - null_ls.builtins.formatting.stylua, - --null_ls.builtins.diagnostics.eslint, - null_ls.builtins.completion.spell, - }, - } - end, - ["lualine"] = function() - local c = require "onedark.colors" - local theme = { - inactive = { - a = { fg = c.fg, bg = c.bg2, gui = "bold" }, - b = { fg = c.fg, bg = c.bg2 }, - c = { fg = c.bg2, bg = c.bg0 }, - }, - normal = { - a = { fg = c.bg0, bg = c.green, gui = "bold" }, - b = { fg = c.fg, bg = c.bg2 }, - c = { fg = c.fg, bg = c.bg0 }, - }, - visual = { a = { fg = c.bg0, bg = c.purple, gui = "bold" } }, - replace = { a = { fg = c.bg0, bg = c.red, gui = "bold" } }, - insert = { a = { fg = c.bg0, bg = c.blue, gui = "bold" } }, - command = { a = { fg = c.bg0, bg = c.yellow, gui = "bold" } }, - terminal = { a = { fg = c.bg0, bg = c.cyan, gui = "bold" } }, - } - - require("lualine").setup { - options = { - theme = theme, - component_separators = "", - section_separators = { left = "", right = "" }, - }, - sections = { - lualine_a = { "mode" }, - lualine_b = { "branch", "filename" }, - lualine_c = { "diff", "diagnostics" }, - lualine_x = { "encoding", "fileformat", "filetype" }, - lualine_y = { "progress" }, - lualine_z = { "location" }, - }, - inactive_sections = { - lualine_a = { "filename" }, - lualine_b = {}, - lualine_c = { "diagnostics" }, - lualine_x = {}, - lualine_y = {}, - lualine_z = { "location" }, - }, - extensions = { "quickfix", "fugitive", "fzf", "nvim-dap-ui", "neo-tree" }, - } - end, - ["neogit"] = { - disable_builtin_notifications = true, - }, - ["window-picker"] = { - selection_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - filter_rules = { - bo = { - filetype = { "neo-tree", "neo-tree-popup", "notify", "quickfix" }, - buftype = { "terminal", "quickfix", "prompt" }, - }, - }, - other_win_hl_color = "#4493c8", - }, - ["gomove"] = { - map_defaults = false, - undojoin = true, - move_past_end_col = true, - }, - ["better-whitespace"] = function() - function _G.whitespace_visibility() - pcall(function() - if vim.bo.buftype == "nofile" or vim.bo.buftype == "help" then - vim.cmd "DisableWhitespace" - else - vim.cmd "EnableWhitespace" - end - end) - end - - vim.cmd [[autocmd WinEnter * lua whitespace_visibility()]] - end, - ["onedark"] = function() - local onedark = require "onedark" - onedark.setup { - toggle_style_key = "", - colors = { - fg = "#abb2bf", - black = "#181a1f", - bg0 = "#1e222a", - bg1 = "#252931", - bg2 = "#282c34", - bg3 = "#353b45", - bg_d = "#191c21", - bg_blue = "#73b8f1", - bg_yellow = "#ebd09c", - - dark_cyan = "#2b6f77", - dark_red = "#993939", - dark_yellow = "#93691d", - - grey = "#42464e", - grey_fg = "#565c64", - grey_fg2 = "#6f737b", - light_grey = "#6f737b", - baby_pink = "#de8c92", - pink = "#ff75a0", - nord_blue = "#81a1c1", - sun = "#ebcb8b", - light_purple = "#de98fd", - dark_purple = "#c882e7", - teal = "#519aba", - dark_pink = "#fca2aa", - light_blue = "#a3b8ef", - vibrant_green = "#7eca9c", - - red = "#e06c75", - orange = "#d19a66", - yellow = "#e5c07b", - green = "#98c379", - cyan = "#56b6c2", - blue = "#61afef", - purple = "#c678dd", - - diff_add = "#31392b", - diff_delete = "#382b2c", - diff_change = "#1c3448", - diff_text = "#2c5372", - }, - highlights = { - CursorLine = { bg = "$bg0" }, - FloatBorder = { fg = "$blue" }, - NeoTreeTabActive = { fg = "$fg", bg = "$bg_d" }, - NeoTreeTabInactive = { fg = "$grey", bg = "$black" }, - NeoTreeTabSeparatorActive = { fg = "$black", bg = "$black" }, - NeoTreeTabSeparatorInactive = { fg = "$black", bg = "$black" }, - NeoTreeWinSeparator = { fg = "$bg_d", bg = "$bg_d" }, - NeoTreeVertSplit = { fg = "$bg_d", bg = "$bg_d" }, - VisualMultiMono = { fg = "$purple", bg = "$diff_change" }, - VisualMultiExtend = { bg = "$diff_change" }, - VisualMultiCursor = { fg = "$purple", bg = "$diff_change" }, - VisualMultiInsert = { fg = "$blue", bg = "$diff_change" }, - }, - } - vim.g.VM_Mono_hl = "VisualMultiMono" - vim.g.VM_Extend_hl = "VisualMultiExtend" - vim.g.VM_Cursor_hl = "VisualMultiCursor" - vim.g.VM_Insert_hl = "VisualMultiInsert" - onedark.load() - end, - ["sandwich"] = function() - vim.g.operator_sandwich_no_default_key_mappings = 1 - vim.g.textobj_sandwich_no_default_key_mappings = 1 - end, - ["undotree"] = function() - vim.g.undotree_SetFocusWhenToggle = 1 - vim.g.undotree_WindowLayout = 4 - end, - ["wordmotion"] = function() - vim.g.wordmotion_nomap = 1 - end, - ["nvim-web-devicons"] = function() - local devicons = require "nvim-web-devicons" - devicons.setup { - override = require("utils.icons").devicons, - default = true, - } - end, - ["notify"] = function() - local notify = require "notify" - notify.setup { - fps = 60, - icons = { - DEBUG = "", - ERROR = "", - INFO = "", - TRACE = "✎", - WARN = "", - }, - max_width = 120, - } - vim.notify = notify - end, - ["nabla"] = function() - require("nabla").enable_virt() - end, -} - -return configs diff --git a/users/myuser/neovim/lua/plugins/telescope.lua b/users/myuser/neovim/lua/plugins/telescope.lua deleted file mode 100644 index 2e0f553..0000000 --- a/users/myuser/neovim/lua/plugins/telescope.lua +++ /dev/null @@ -1,31 +0,0 @@ --- TODO: files and content in the searchable area should be split into two window portions, --- TODO: Ctrl+Up in telescope fucks up spacing --- or maybe only that the file just takes small amount of space - -local telescope = require "telescope" - -telescope.setup { - defaults = { - -- Default configuration for telescope goes here: - -- config_key = value, - mappings = { - i = { - [""] = "which_key", - [""] = require("telescope.actions").cycle_history_next, - [""] = require("telescope.actions").cycle_history_prev, - }, - }, - prompt_prefix = " ", - selection_caret = " ", - }, -} - -local function load_ext(ext) - local ok, _ = pcall(telescope.load_extension, ext) - if not ok then - vim.notify("Could not load telescope extension: " .. ext, "error") - end -end - -load_ext "fzf" -load_ext "notify" diff --git a/users/myuser/neovim/lua/plugins/treesitter.lua b/users/myuser/neovim/lua/plugins/treesitter.lua deleted file mode 100644 index 4a6b263..0000000 --- a/users/myuser/neovim/lua/plugins/treesitter.lua +++ /dev/null @@ -1,16 +0,0 @@ -require("nvim-treesitter.configs").setup { - ensure_installed = "all", - highlight = { - enable = true, - use_languagetree = true, - }, - rainbow = { - enable = true, - extended_mode = true, - -- colors = { }, - -- termcolors = { } - }, - matchup = { - enable = true, - }, -} diff --git a/users/myuser/neovim/lua/todo b/users/myuser/neovim/lua/todo deleted file mode 100644 index ee639d8..0000000 --- a/users/myuser/neovim/lua/todo +++ /dev/null @@ -1,57 +0,0 @@ -keybinds: -- comment.nvim -- smarter keybinds for surround, e.g. "" on word --> "word", same for '', maybe others. -- lsp keybinds -- move block of lines -- m to surround -- dressing make larger - - - -- maybe install pynvim and npm neovim on update -- nice wrapping behavior g g, setlocal linebreak, setlocal wrap, setlocal showbreak=\| \ \ \ , setlocal breakindent -- when set wrap, have an alternative V and ctrlV that behave like the text was actually that way. - - -- mundo -- easyalign - -- nvim dap (some kind of debugger pls) - -- (link still applise= nvim cmp can kill nvim by completing /dev/ and going over stdin whoops. -- long opening times when opening paper.jar -- remove ZZ shortcut -- converter: number <-> hex <-> oct <-> ...; camelcase pascalcase snakecase -- gJ but delete every trailing and leading space, maybe gdJ -- button to jump to end of match under cursor NOT in visual mode -- visual mode f --> vf" should mark to next " -- v......s sometimes jumps back some characters which makes inital cursor movement strange. subst shouldnt move cursor from beginning if characters are deleted or ever like noooooop -- multi search highlight with different color. -- make ctrl-shift-cv copy/insert things from * buffer -- maybe an IDE init button like . before that only minimal plugins loaded, e.g. no completion no tabnine nothing too obstrusive and nothing that is slow on large arbitarary files. -- textobject for "current functino parameter like ciw -> cip -- multuple cursors on each line, then trigger completion, but allow two modes. either only first cursor gets completion, others get same completion, - or all cursors complete separately and take the first completion by themselves. -- key for Crtl+[] for jump back and select in help -- indent blankline error: when searching for a word, and a indentline begins in the next line such that it is under the first char of the marked word, the blankline will be visually marked too. -- automacros: always record a macro when esc is pressed until esc is pressed again. Begin recording only on first actual action i.e. movement doesnt count before recording, only after starting -> things like Js will become a repeat sequence yay. -- after nvimcmp replaced text, goto end of this text. -- search and replace "popup" or maybe just prefilled cmdline with interactive search visuals -- whitespace -- indentline -- tabline for TABS not buffer :/ -- nvim-tree: a = create new in (selected folder if cursor is hovering over one, else current folder), A = create new in current folder regardless of cursor pos -- lsp -- colored parens -- git -- whitespace marker lines also in NvoimTree -- show bad whitespace -- markdown? latex? -- highlight current line in more lighter cola -- Create a virtualenv specifically for Nvim and use `g:python3_host_prog`. This will avoid the need to install the pynvim module in each virtualenv. - - -fast: -- delete ; at end of each line -- align on = -- align function arguments diff --git a/users/myuser/neovim/lua/utils/bootstrap.lua b/users/myuser/neovim/lua/utils/bootstrap.lua deleted file mode 100644 index f1c648f..0000000 --- a/users/myuser/neovim/lua/utils/bootstrap.lua +++ /dev/null @@ -1,14 +0,0 @@ -local M = {} - -M.ensure_packer = function() - local fn = vim.fn - local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim" - if fn.empty(fn.glob(install_path)) > 0 then - fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path } - vim.cmd [[packadd packer.nvim]] - return true - end - return false -end - -return M diff --git a/users/myuser/neovim/lua/utils/icons.lua b/users/myuser/neovim/lua/utils/icons.lua deleted file mode 100644 index a3275ea..0000000 --- a/users/myuser/neovim/lua/utils/icons.lua +++ /dev/null @@ -1,215 +0,0 @@ -local M = {} - -M.lspkind = { - Namespace = "󰌗", - Text = "󰉿", - Method = "󰆧", - Function = "󰆧", - Constructor = "", - Field = "󰜢", - Variable = "󰀫", - Class = "󰠱", - Interface = "", - Module = "", - Property = "󰜢", - Unit = "󰑭", - Value = "󰎠", - Enum = "", - Keyword = "󰌋", - Snippet = "", - Color = "󰏘", - File = "󰈚", - Reference = "󰈇", - Folder = "󰉋", - EnumMember = "", - Constant = "󰏿", - Struct = "󰙅", - Event = "", - Operator = "󰆕", - TypeParameter = "󰊄", - Table = "", - Object = "󰅩", - Tag = "", - Array = "[]", - Boolean = "", - Number = "", - Null = "󰟢", - String = "󰉿", - Calendar = "", - Watch = "󰥔", - Package = "", - Copilot = "", - Codeium = "", - TabNine = "", -} - -M.statusline_separators = { - default = { - left = "", - right = " ", - }, - - round = { - left = "", - right = "", - }, - - block = { - left = "█", - right = "█", - }, - - arrow = { - left = "", - right = "", - }, -} - -M.devicons = { - default_icon = { - icon = "󰈚", - name = "Default", - }, - - c = { - icon = "", - name = "c", - }, - - css = { - icon = "", - name = "css", - }, - - dart = { - icon = "", - name = "dart", - }, - - deb = { - icon = "", - name = "deb", - }, - - Dockerfile = { - icon = "", - name = "Dockerfile", - }, - - html = { - icon = "", - name = "html", - }, - - jpeg = { - icon = "󰉏", - name = "jpeg", - }, - - jpg = { - icon = "󰉏", - name = "jpg", - }, - - js = { - icon = "󰌞", - name = "js", - }, - - kt = { - icon = "󱈙", - name = "kt", - }, - - lock = { - icon = "󰌾", - name = "lock", - }, - - lua = { - icon = "", - name = "lua", - }, - - mp3 = { - icon = "󰎆", - name = "mp3", - }, - - mp4 = { - icon = "", - name = "mp4", - }, - - out = { - icon = "", - name = "out", - }, - - png = { - icon = "󰉏", - name = "png", - }, - - py = { - icon = "", - name = "py", - }, - - ["robots.txt"] = { - icon = "󰚩", - name = "robots", - }, - - toml = { - icon = "", - name = "toml", - }, - - ts = { - icon = "󰛦", - name = "ts", - }, - - ttf = { - icon = "", - name = "TrueTypeFont", - }, - - rb = { - icon = "", - name = "rb", - }, - - rpm = { - icon = "", - name = "rpm", - }, - - vue = { - icon = "󰡄", - name = "vue", - }, - - woff = { - icon = "", - name = "WebOpenFontFormat", - }, - - woff2 = { - icon = "", - name = "WebOpenFontFormat2", - }, - - xz = { - icon = "", - name = "xz", - }, - - zip = { - icon = "", - name = "zip", - }, -} - -return M diff --git a/users/myuser/neovim/misc.nix b/users/myuser/neovim/misc.nix new file mode 100644 index 0000000..86fa5ec --- /dev/null +++ b/users/myuser/neovim/misc.nix @@ -0,0 +1,104 @@ +{pkgs, ...}: { + programs.nixvim = { + plugins = { + notify = { + enable = true; + stages = "static"; + render.__raw = ''"compact"''; + icons = { + debug = ""; + error = "󰅙"; + info = ""; + trace = "󰰥"; + warn = ""; + }; + }; + + # Commenting + comment-nvim.enable = true; + # Extend vim's "%" key + vim-matchup.enable = true; + + # Fzf picker for arbitrary stuff + telescope = { + enable = true; + enabledExtensions = ["fzf" "notify" "ui-select"]; + extensions.fzf-native.enable = true; + }; + + # Undo tree + undotree = { + enable = true; + focusOnToggle = true; + windowLayout = 4; + }; + + # Quickfix menu + trouble.enable = true; + # Highlight certain keywords + todo-comments.enable = true; + # TODO use { "liuchengxu/vista.vim", cmd = "Vista" } + which-key.enable = true; + }; + + extraPlugins = with pkgs.vimPlugins; [ + telescope-ui-select-nvim + nvim-window-picker + # Replace built-in LSP prompts and windows + dressing-nvim + # Multicursor + vim-visual-multi + # Show invalid whitespace + vim-better-whitespace + # Show latex math equations + nabla-nvim + # Modify Surrounding things like parenthesis and quotes + vim-sandwich + # TODO mini.align better? + vim-easy-align + # Case changer + text-case-nvim + # camelcase (and similar) word motions and textobjects + vim-wordmotion + # Gpg integration + vim-gnupg + # TODO temporary + vim-startuptime + ]; + + extraConfigLuaPre = '' + vim.g.operator_sandwich_no_default_key_mappings = 1 + vim.g.textobj_sandwich_no_default_key_mappings = 1 + + vim.g.wordmotion_nomap = 1 + ''; + + extraConfigLuaPost = '' + require("window-picker").setup { + hint = "floating-big-letter", + filter_rules = { + bo = { + filetype = { "neo-tree", "neo-tree-popup", "notify", "quickfix" }, + buftype = { "terminal", "quickfix", "prompt" }, + }, + }, + floating_big_letter = { + font = "ansi-shadow", + }, + selection_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", + show_prompt = false, + } + + require("dressing").setup { + input = { + prefer_width = 80, + max_width = { 140, 0.9 }, + min_width = { 80, 0.6 }, + win_options = { + winblend = 0, + }, + }, + } + ''; + }; +} diff --git a/users/myuser/neovim/neo-tree.nix b/users/myuser/neovim/neo-tree.nix new file mode 100644 index 0000000..12721ab --- /dev/null +++ b/users/myuser/neovim/neo-tree.nix @@ -0,0 +1,55 @@ +{ + programs.nixvim.plugins.neo-tree = { + enable = true; + sortCaseInsensitive = true; + usePopupsForInput = false; + popupBorderStyle = "rounded"; + # TODO window_opts.winblend = 0; + window = { + width = 34; + position = "left"; + mappings = { + "" = "open_with_window_picker"; + "s" = "split_with_window_picker"; + "v" = "vsplit_with_window_picker"; + "t" = "open_tabnew"; + "z" = "close_all_nodes"; + "Z" = "expand_all_nodes"; + "a".__raw = ''{ "add", config = { show_path = "relative" } }''; + "A".__raw = ''{ "add_directory", config = { show_path = "relative" } }''; + "c".__raw = ''{ "copy", config = { show_path = "relative" } }''; + "m".__raw = ''{ "move", config = { show_path = "relative" } }''; + }; + }; + defaultComponentConfigs = { + modified.symbol = "~ "; + indent.withExpanders = true; + name.trailingSlash = true; + gitStatus.symbols = { + added = "+"; + deleted = "✖"; + modified = ""; + renamed = "➜"; + untracked = "?"; + ignored = "󰛑"; + unstaged = ""; # 󰄱 + staged = "󰄵"; + conflict = ""; + }; + }; + filesystem = { + window.mappings = { + "gA" = "git_add_all"; + "ga" = "git_add_file"; + "gu" = "git_unstage_file"; + }; + groupEmptyDirs = true; + followCurrentFile.enabled = true; + useLibuvFileWatcher = true; + filteredItems = { + hideDotfiles = false; + hideByName = [".git"]; + }; + }; + }; +} diff --git a/users/myuser/neovim/onedark.nix b/users/myuser/neovim/onedark.nix new file mode 100644 index 0000000..b2b63eb --- /dev/null +++ b/users/myuser/neovim/onedark.nix @@ -0,0 +1,81 @@ +{ + lib, + pkgs, + ... +}: { + programs.nixvim = { + extraPlugins = with pkgs.vimPlugins; [ + # navarasu's one dark + onedark-nvim + ]; + + extraConfigLua = lib.mkBefore '' + local onedark = require "onedark" + onedark.setup { + toggle_style_key = "", + colors = { + fg = "#abb2bf", + black = "#181a1f", + bg0 = "#1e222a", + bg1 = "#252931", + bg2 = "#282c34", + bg3 = "#353b45", + bg_d = "#191c21", + bg_blue = "#73b8f1", + bg_yellow = "#ebd09c", + + dark_cyan = "#2b6f77", + dark_red = "#993939", + dark_yellow = "#93691d", + + grey = "#42464e", + grey_fg = "#565c64", + grey_fg2 = "#6f737b", + light_grey = "#6f737b", + baby_pink = "#de8c92", + pink = "#ff75a0", + nord_blue = "#81a1c1", + sun = "#ebcb8b", + light_purple = "#de98fd", + dark_purple = "#c882e7", + teal = "#519aba", + dark_pink = "#fca2aa", + light_blue = "#a3b8ef", + vibrant_green = "#7eca9c", + + red = "#e06c75", + orange = "#d19a66", + yellow = "#e5c07b", + green = "#98c379", + cyan = "#56b6c2", + blue = "#61afef", + purple = "#c678dd", + + diff_add = "#31392b", + diff_delete = "#382b2c", + diff_change = "#1c3448", + diff_text = "#2c5372", + }, + highlights = { + CursorLine = { bg = "$bg0" }, + FloatBorder = { fg = "$blue" }, + NeoTreeTabActive = { fg = "$fg", bg = "$bg_d" }, + NeoTreeTabInactive = { fg = "$grey", bg = "$black" }, + NeoTreeTabSeparatorActive = { fg = "$black", bg = "$black" }, + NeoTreeTabSeparatorInactive = { fg = "$black", bg = "$black" }, + NeoTreeWinSeparator = { fg = "$bg_d", bg = "$bg_d" }, + NeoTreeVertSplit = { fg = "$bg_d", bg = "$bg_d" }, + VisualMultiMono = { fg = "$purple", bg = "$diff_change" }, + VisualMultiExtend = { bg = "$diff_change" }, + VisualMultiCursor = { fg = "$purple", bg = "$diff_change" }, + VisualMultiInsert = { fg = "$blue", bg = "$diff_change" }, + }, + } + vim.g.VM_Mono_hl = "VisualMultiMono" + vim.g.VM_Extend_hl = "VisualMultiExtend" + vim.g.VM_Cursor_hl = "VisualMultiCursor" + vim.g.VM_Insert_hl = "VisualMultiInsert" + onedark.load() + ''; + }; +} diff --git a/users/myuser/neovim/web-devicons.nix b/users/myuser/neovim/web-devicons.nix new file mode 100644 index 0000000..6526244 --- /dev/null +++ b/users/myuser/neovim/web-devicons.nix @@ -0,0 +1,44 @@ +{pkgs, ...}: { + programs.nixvim = { + extraPlugins = with pkgs.vimPlugins; [ + nvim-web-devicons + ]; + + extraConfigLuaPost = '' + require("nvim-web-devicons").setup { + override = { + default_icon = { icon = "󰈚", name = "Default", }, + c = { icon = "", name = "c", }, + css = { icon = "", name = "css", }, + dart = { icon = "", name = "dart", }, + deb = { icon = "", name = "deb", }, + Dockerfile = { icon = "", name = "Dockerfile", }, + html = { icon = "", name = "html", }, + jpeg = { icon = "󰉏", name = "jpeg", }, + jpg = { icon = "󰉏", name = "jpg", }, + js = { icon = "󰌞", name = "js", }, + kt = { icon = "󱈙", name = "kt", }, + lock = { icon = "󰌾", name = "lock", }, + lua = { icon = "", name = "lua", }, + mp3 = { icon = "󰎆", name = "mp3", }, + mp4 = { icon = "", name = "mp4", }, + out = { icon = "", name = "out", }, + png = { icon = "󰉏", name = "png", }, + py = { icon = "", name = "py", }, + ["robots.txt"] = { icon = "󰚩", name = "robots", }, + toml = { icon = "", name = "toml", }, + ts = { icon = "󰛦", name = "ts", }, + ttf = { icon = "", name = "TrueTypeFont", }, + rb = { icon = "", name = "rb", }, + rpm = { icon = "", name = "rpm", }, + vue = { icon = "󰡄", name = "vue", }, + woff = { icon = "", name = "WebOpenFontFormat", }, + woff2 = { icon = "", name = "WebOpenFontFormat2", }, + xz = { icon = "", name = "xz", }, + zip = { icon = "", name = "zip", }, + }, + default = true, + } + ''; + }; +}