1{ pkgs, host, ... }:
2{
3 vim = {
4 extraPackages = with pkgs; [
5 texliveFull
6 ];
7 lazy.plugins.cmp-vimtex = {
8 enabled = true;
9 package = pkgs.vimPlugins.cmp-vimtex;
10 lazy = false;
11
12 };
13 lazy.plugins.vimtex = {
14 enabled = true;
15 package = pkgs.vimPlugins.vimtex;
16 lazy = false;
17 };
18
19 globals = {
20 tex_flavor = "latex";
21 maplocalleader = "\\";
22 vimtex_compiler_method = "latexmk";
23 vimtex_view_method = if host.darwin then "skim" else "zathura";
24 vimtex_view_automatic = 1;
25 vimtex_compiler_latexmk = {
26 callback = 1;
27 continuous = 1;
28 executable = "latexmk";
29 hooks = [ ];
30 options = [
31 "-verbose"
32 "-file-line-error"
33 "-synctex=1"
34 "-interaction=nonstopmode"
35 "-shell-escape"
36 ];
37 };
38 vimtex_compiler_latexmk_engines = {
39 "_" = "-lualatex";
40 };
41 vimtex_log_ignore = [
42 "Underfull"
43 "Overfull"
44 "specifier changed to"
45 "Token not allowed in a PDF string"
46 ];
47 vimtex_quickfix_ignore_filters = [
48 "Underfull"
49 "Overfull"
50 ];
51 };
52
53 autocomplete.blink-cmp = {
54 sourcePlugins = {
55 "blink.compat" = {
56 enable = true;
57 package = "blink-compat";
58 module = "blink.compat.source";
59 };
60 };
61 setupOpts = {
62 sources = {
63 default = [
64 "vimtex"
65 ];
66 providers = {
67 vimtex = {
68 name = "vimtex";
69 module = "blink.compat.source";
70 score_offset = 100;
71 };
72 };
73 };
74 };
75 };
76
77 augroups = [
78 {
79 name = "VimTeX Events";
80 }
81 ];
82 autocmds = [
83 {
84 pattern = [ "VimtexEventViewReverse" ];
85 event = [ "User" ];
86 desc = "Return to nvim after reverse search";
87 command = "call b:vimtex.viewer.xdo_focus_vim()";
88 group = "VimTeX Events";
89 }
90 {
91 pattern = [ "VimtexEventQuit" ];
92 event = [ "User" ];
93 desc = "Close pdf after exiting nvim";
94 command = "VimtexClean";
95 group = "VimTeX Events";
96 }
97
98 {
99 pattern = [ "VimtexEventInitPost" ];
100 event = [ "User" ];
101 desc = "Start compiling when opening nvim to a tex file";
102 command = "VimtexCompile";
103 group = "VimTeX Events";
104 }
105
106 ];
107
108 lsp = {
109 servers = {
110 texlab = {
111 enable = true;
112 cmd = [ "${pkgs.texlab}/bin/texlab" ];
113 filetypes = [ "tex" ];
114 };
115 };
116 };
117 treesitter = {
118 grammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
119 latex
120 ];
121 };
122 };
123}