diff --git a/flake.lock b/flake.lock index aa6fb61..fc3a1d3 100644 --- a/flake.lock +++ b/flake.lock @@ -72,6 +72,22 @@ "type": "github" } }, + "cmp-vimtex": { + "flake": false, + "locked": { + "lastModified": 1716040164, + "narHash": "sha256-CO70M+l/9c4vqNm0XloOTzGQTmogHbSwvUFKQxYGsuw=", + "owner": "micangl", + "repo": "cmp-vimtex", + "rev": "a64b1b5eec0460144c91c4f20a45c74b8ded48ae", + "type": "github" + }, + "original": { + "owner": "micangl", + "repo": "cmp-vimtex", + "type": "github" + } + }, "darwin": { "inputs": { "nixpkgs": [ @@ -1164,6 +1180,7 @@ "agenix": "agenix", "arkenfox-userjs": "arkenfox-userjs", "asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver", + "cmp-vimtex": "cmp-vimtex", "devshell": "devshell", "disko": "disko", "flake-parts": "flake-parts", diff --git a/flake.nix b/flake.nix index 7aff358..9a5bdc5 100644 --- a/flake.nix +++ b/flake.nix @@ -45,6 +45,8 @@ hawtkeys-nvim.url = "github:tris203/hawtkeys.nvim"; none-ls-shellcheck-nvim.flake = false; none-ls-shellcheck-nvim.url = "github:gbprod/none-ls-shellcheck.nvim"; + cmp-vimtex.flake = false; + cmp-vimtex.url = "github:micangl/cmp-vimtex"; # river river.url = "git+https://github.com/riverwm/river?submodules=1"; diff --git a/modules/programs/nvim/default.nix b/modules/programs/nvim/default.nix index 92f795e..fb17e09 100644 --- a/modules/programs/nvim/default.nix +++ b/modules/programs/nvim/default.nix @@ -16,6 +16,11 @@ in source = ./plugins/snippets; }; + home.packages = with pkgs; [ + xdotool + ]; + + programs.neovim = { enable = true; package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default; diff --git a/modules/programs/nvim/plugins/coding.nix b/modules/programs/nvim/plugins/coding.nix index c8700e9..f9e38d9 100644 --- a/modules/programs/nvim/plugins/coding.nix +++ b/modules/programs/nvim/plugins/coding.nix @@ -36,10 +36,17 @@ in { plugin = pkgs.vimPlugins.cmp-async-path; } { plugin = pkgs.vimPlugins.cmp-buffer; } { plugin = pkgs.vimPlugins.cmp-cmdline; } - { plugin = pkgs.vimPlugins.cmp-nvim-lsp; } - { plugin = pkgs.vimPlugins.cmp_luasnip; } - { plugin = pkgs.vimPlugins.cmp-spell; } { plugin = pkgs.vimPlugins.cmp-nvim-lsp-signature-help; } + { plugin = pkgs.vimPlugins.cmp-nvim-lsp; } + { plugin = pkgs.vimPlugins.cmp-spell; } + { + plugin = pkgs.vimUtils.buildVimPlugin { + pname = "cmp-vimtex"; + version = lib.my.mkVersionInput inputs.cmp-vimtex; + src = inputs.cmp-vimtex; + }; + } + { plugin = pkgs.vimPlugins.cmp_luasnip; } { plugin = pkgs.vimPlugins.copilot-cmp; opts = { }; @@ -211,5 +218,17 @@ in conf = readFile ./lua/conform.lua; } { plugin = pkgs.vimPlugins.plantuml-syntax; } + { + plugin = pkgs.vimPlugins.vimtex; + lazy = false; + conf = /* lua */ '' + vim.g.vimtex_view_method = "zathura" + vim.g.vimtex_mappings_disable = vim.fn.executable("texlab") == 1 and { ["n"] = { "K" } } or {} -- disable `K` as it conflicts with LSP hover + vim.g.vimtex_quickfix_method = vim.fn.executable("pplatex") == 1 and "pplatex" or "latexlog" + ''; + keys = [ + { key = "l"; cmd = ""; desc = "+vimtex"; } + ]; + } ]; } diff --git a/modules/programs/nvim/plugins/lua/nvim-cmp.lua b/modules/programs/nvim/plugins/lua/nvim-cmp.lua index 4da693c..69cf040 100644 --- a/modules/programs/nvim/plugins/lua/nvim-cmp.lua +++ b/modules/programs/nvim/plugins/lua/nvim-cmp.lua @@ -69,6 +69,7 @@ cmp.setup({ { priority = 3, name = "copilot" }, { priority = 3, name = "nvim_lsp_signature_help" }, { priority = 4, name = "luasnip" }, + { priority = 4, name = "vimtex" }, }), }) diff --git a/modules/programs/nvim/plugins/treesitter.nix b/modules/programs/nvim/plugins/treesitter.nix index 2ba777c..a7d473b 100644 --- a/modules/programs/nvim/plugins/treesitter.nix +++ b/modules/programs/nvim/plugins/treesitter.nix @@ -1,8 +1,7 @@ { pkgs, ... }: -with builtins; { - config.home-manager.users.moritz.programs.neovim.lazy.plugins = with pkgs.vimPlugins; [ + config.home-manager.users.moritz.programs.neovim.lazy.plugins = [ ( let parserDir = pkgs.symlinkJoin { @@ -11,13 +10,14 @@ with builtins; }; in { - plugin = nvim-treesitter; + plugin = pkgs.vimPlugins.nvim-treesitter; event = [ "BufReadPost" "BufNewFile" ]; opts = { sync_install = false; auto_install = false; highlight = { enable = true; + disable = [ "latex" ]; }; textobjects = { @@ -60,8 +60,8 @@ with builtins; ''; priority = 100; dependencies = [ - { plugin = nvim-treesitter-textobjects; } - { plugin = nvim-ts-context-commentstring; opts = { }; } + { plugin = pkgs.vimPlugins.nvim-treesitter-textobjects; } + { plugin = pkgs.vimPlugins.nvim-ts-context-commentstring; opts = { }; } ]; } )