From 05f6c1129b5a31a2d5527ed808d670e6eee96eef Mon Sep 17 00:00:00 2001 From: Aria Nolan Date: Sat, 23 Mar 2024 11:56:39 -0400 Subject: [PATCH] flake and neovim --- flake.lock | 48 ++++++++-------- users/tacocat/neovim/cmp.nix | 49 ++++++++++++++++ users/tacocat/neovim/default.nix | 99 +++----------------------------- users/tacocat/neovim/lsp.nix | 60 +++++++++++++++++++ users/tacocat/neovim/plugins.nix | 37 ++++++++++++ 5 files changed, 179 insertions(+), 114 deletions(-) create mode 100644 users/tacocat/neovim/cmp.nix create mode 100644 users/tacocat/neovim/lsp.nix create mode 100644 users/tacocat/neovim/plugins.nix diff --git a/flake.lock b/flake.lock index 9158c6b..ff82a2a 100644 --- a/flake.lock +++ b/flake.lock @@ -52,11 +52,11 @@ ] }, "locked": { - "lastModified": 1710156081, - "narHash": "sha256-4PMY6aumJi5dLFjBzF5O4flKXmadMNq3AGUHKYfchh0=", + "lastModified": 1711099426, + "narHash": "sha256-HzpgM/wc3aqpnHJJ2oDqPBkNsqWbW0WfWUO8lKu8nGk=", "owner": "numtide", "repo": "devshell", - "rev": "bc68b058dc7e6d4d6befc4ec6c60082b6e844b7d", + "rev": "2d45b54ca4a183f2fdcf4b19c895b64fbf620ee8", "type": "github" }, "original": { @@ -218,11 +218,11 @@ ] }, "locked": { - "lastModified": 1710974515, - "narHash": "sha256-jZpdsypecYTOO9l12Vy77otGmh9uz8tGzcguifA30Vs=", + "lastModified": 1711133180, + "narHash": "sha256-WJOahf+6115+GMl3wUfURu8fszuNeJLv9qAWFQl3Vmo=", "owner": "nix-community", "repo": "home-manager", - "rev": "1c2acec99933f9835cc7ad47e35303de92d923a4", + "rev": "1c2c5e4cabba4c43504ef0f8cc3f3dfa284e2dbb", "type": "github" }, "original": { @@ -239,11 +239,11 @@ ] }, "locked": { - "lastModified": 1710820906, - "narHash": "sha256-2bNMraoRB4pdw/HtxgYTFeMhEekBZeQ53/a8xkqpbZc=", + "lastModified": 1711133180, + "narHash": "sha256-WJOahf+6115+GMl3wUfURu8fszuNeJLv9qAWFQl3Vmo=", "owner": "nix-community", "repo": "home-manager", - "rev": "022464438a85450abb23d93b91aa82e0addd71fb", + "rev": "1c2c5e4cabba4c43504ef0f8cc3f3dfa284e2dbb", "type": "github" }, "original": { @@ -281,11 +281,11 @@ ] }, "locked": { - "lastModified": 1710946911, - "narHash": "sha256-qV20Q7Ejpec200oBwUAgVYQjKt5BLPMLCm5EaRX3qgQ=", + "lastModified": 1711206119, + "narHash": "sha256-CrFfwkwtLM5ASfDR2pdZjVfEMIcNaMQVIjoDaI1ZPEY=", "owner": "doronbehar", "repo": "nix-matlab", - "rev": "034a198d09ed872331c910c6acdca1577ff30ba7", + "rev": "ad0bf07c4e4a43edd50253b9e9e6dfc4712ba73a", "type": "gitlab" }, "original": { @@ -328,11 +328,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1710806803, - "narHash": "sha256-qrxvLS888pNJFwJdK+hf1wpRCSQcqA6W5+Ox202NDa0=", + "lastModified": 1711001935, + "narHash": "sha256-URtGpHue7HHZK0mrHnSf8wJ6OmMKYSsoLmJybrOLFSQ=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b06025f1533a1e07b6db3e75151caa155d1c7eb3", + "rev": "20f77aa09916374aa3141cbc605c955626762c9a", "type": "github" }, "original": { @@ -355,11 +355,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1710936779, - "narHash": "sha256-ecYnUzSWqRae10pp7J6ZE2BznTPJ9f8sLiIoDBQtRBw=", + "lastModified": 1711199922, + "narHash": "sha256-Oz5WNOPp95K4JLyoNQKyEdaUM5JzliC62jwTpGPqYNE=", "owner": "nix-community", "repo": "nixvim", - "rev": "4f6e90212c7ec56d7c03611fb86befa313e7f61f", + "rev": "7170aad28139cd3629b2b6ce4c9272bf41c2ad45", "type": "github" }, "original": { @@ -370,11 +370,11 @@ }, "nur": { "locked": { - "lastModified": 1711052752, - "narHash": "sha256-wHgyWnWvjG7P+8PX3E2PZrtpsnIsmzodXt/7r+SyhBk=", + "lastModified": 1711204334, + "narHash": "sha256-Wzdv/we5OmxDHx9qxwO9b6XKRm6IS4jwoVbV65g8LxI=", "owner": "nix-community", "repo": "nur", - "rev": "a01b1fe8e4253ca176ece6733d4e71ab8e65fa9f", + "rev": "676b81c589e5389344eb5c8f5e3fcf321e1dd87d", "type": "github" }, "original": { @@ -398,11 +398,11 @@ ] }, "locked": { - "lastModified": 1710843117, - "narHash": "sha256-b6iKQeHegzpc697rxTPA3bpwGN3m50eLCgdQOmceFuE=", + "lastModified": 1710923068, + "narHash": "sha256-6hOpUiuxuwpXXc/xfJsBUJeqqgGI+JMJuLo45aG3cKc=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "e8dc1b4fe80c6fcededde7700e6a23bcdf7f3347", + "rev": "e611897ddfdde3ed3eaac4758635d7177ff78673", "type": "github" }, "original": { diff --git a/users/tacocat/neovim/cmp.nix b/users/tacocat/neovim/cmp.nix new file mode 100644 index 0000000..fb035cf --- /dev/null +++ b/users/tacocat/neovim/cmp.nix @@ -0,0 +1,49 @@ +{...}: { + programs.nixvim.plugins.cmp = { + enable = true; + filetype = { + tex = { + sources = [ + {name = "latex_symbols";} + ]; + }; + }; + settings = { + sources = [ + { + name = "nvim_lsp"; + priority = 10; + } + { + name = "treesitter"; + priority = 6; + } + { + name = "luasnip"; + priority = 8; + } + { + name = "path"; + priority = 0; + } + { + name = "buffer"; + priority = 0; + } + ]; + snippet.expand = "luasnip"; + completion = { + autocomplete = false; + }; + mapping = { + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.close()"; + "" = "cmp.mapping.confirm({ select = true })"; + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.scroll_docs(4)"; + "" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; + "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; + }; + }; + }; +} diff --git a/users/tacocat/neovim/default.nix b/users/tacocat/neovim/default.nix index bdb08ae..948251b 100644 --- a/users/tacocat/neovim/default.nix +++ b/users/tacocat/neovim/default.nix @@ -1,7 +1,9 @@ -{ - pkgs, - ... -}: { +{pkgs, ...}: { + imports = [ + ./lsp.nix + ./plugins.nix + ./cmp.nix + ]; programs.nixvim = { enable = true; colorschemes.ayu = { @@ -9,7 +11,7 @@ settings = { mirage = true; overrides = { - LineNr = { fg = "#707A8C"; }; + LineNr = {fg = "#707A8C";}; }; }; }; @@ -18,7 +20,8 @@ register = "unnamedplus"; }; extraPackages = with pkgs; [ - latexrun + tectonic + texliveMedium zathura ]; options = { @@ -35,90 +38,6 @@ cursorline = true; showmode = false; }; - plugins = { - telescope = { - enable = true; - }; - comment-nvim = { - enable = true; - }; - markdown-preview = { - enable = true; - settings.browser = "firefox"; - }; - lualine = { - enable = true; - sectionSeparators = { - left = ""; - right = ""; - }; - componentSeparators = { - left = "•"; - right = "•"; - }; - }; - lsp = { - enable = true; - servers = { - nil_ls = { - enable = true; - }; - }; - }; - cmp = { - enable = true; - settings = { - sources = [ - { name = "nvim_lsp"; } - { name = "treesitter"; } - { name = "luasnip"; } - { name = "latex_symbols"; } - { name = "path"; } - { name = "buffer"; } - ]; - snippet.expand = "luasnip"; - completion = { - autocomplete = false; - }; - mapping = { - "" = "cmp.mapping.complete()"; - "" = "cmp.mapping.close()"; - "" = "cmp.mapping.confirm({ select = true })"; - "" = "cmp.mapping.scroll_docs(-4)"; - "" = "cmp.mapping.scroll_docs(4)"; - "" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; - "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; - }; - }; - }; - luasnip = { - enable = true; - }; - friendly-snippets.enable = true; - gitsigns = { - enable = true; - }; - treesitter = { - enable = true; - nixvimInjections = true; - indent = true; - disabledLanguages = [ - "latex" - ]; - ignoreInstall = [ - "latex" - ]; - }; - vimtex = { - enable = true; - texlivePackage = pkgs.texliveFull; - settings = { - compiler_method = "latexrun"; - view_method = "zathura"; - compiler_latexrun.out_dir = "build"; - }; - }; - }; files = { "ftplugin/nix.lua" = { options = { diff --git a/users/tacocat/neovim/lsp.nix b/users/tacocat/neovim/lsp.nix new file mode 100644 index 0000000..5c107e5 --- /dev/null +++ b/users/tacocat/neovim/lsp.nix @@ -0,0 +1,60 @@ +{...}: { + programs.nixvim.plugins = { + lsp-format = { + enable = true; + }; + lsp = { + enable = true; + keymaps.lspBuf = { + K = "hover"; + gD = "references"; + gd = "definition"; + gi = "implementation"; + gt = "type_definition"; + }; + servers = { + nil_ls.enable = true; + lua-ls.enable = true; + bashls.enable = true; + pylsp.enable = true; + html.enable = true; + cssls.enable = true; + texlab = { + enable = true; + extraOptions.settings.texlab = { + build = { + executable = "tectonic"; + args = [ + "-X" + "compile" + "%f" + "--outdir" + "build/" + "--synctex" + "--keep-logs" + "--keep-intermediates" + ]; + auxDirectory = "build/"; + logDirectory = "build/"; + pdfDirectory = "build/"; + forwardSearchAfter = true; + onSave = false; + }; + forwardSearch = { + executable = "zathura"; + args = [ + "--synctex-forward" + "%l:1:%f" + "%p" + ]; + }; + chktex = { + onOpenAndSave = true; + onEdit = true; + }; + }; + }; + }; + }; + }; +} diff --git a/users/tacocat/neovim/plugins.nix b/users/tacocat/neovim/plugins.nix new file mode 100644 index 0000000..06a68ba --- /dev/null +++ b/users/tacocat/neovim/plugins.nix @@ -0,0 +1,37 @@ +{...}: { + programs.nixvim.plugins = { + telescope = { + enable = true; + }; + comment-nvim = { + enable = true; + }; + markdown-preview = { + enable = true; + settings.browser = "firefox"; + }; + lualine = { + enable = true; + sectionSeparators = { + left = ""; + right = ""; + }; + componentSeparators = { + left = "•"; + right = "•"; + }; + }; + luasnip = { + enable = true; + }; + friendly-snippets.enable = true; + gitsigns = { + enable = true; + }; + treesitter = { + enable = true; + nixvimInjections = true; + indent = true; + }; + }; +}