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_log_ignore = [
39 "Underfull"
40 "Overfull"
41 "specifier changed to"
42 "Token not allowed in a PDF string"
43 ];
44 vimtex_quickfix_ignore_filters = [
45 "Underfull"
46 "Overfull"
47 ];
48 };
49
50 autocomplete.blink-cmp = {
51 sourcePlugins = {
52 "blink.compat" = {
53 enable = true;
54 package = "blink-compat";
55 module = "blink.compat.source";
56 };
57 };
58 setupOpts = {
59 sources = {
60 default = [ "vimtex" ];
61 providers = {
62 vimtex = {
63 name = "vimtex";
64 module = "blink.compat.source";
65 score_offset = 100;
66 };
67 };
68 };
69 };
70 };
71
72 augroups = [
73 {
74 name = "VimTeX Events";
75 }
76 ];
77 autocmds = [
78 {
79 pattern = [ "VimtexEventViewReverse" ];
80 event = [ "User" ];
81 desc = "Return to nvim after reverse search";
82 command = "call b:vimtex.viewer.xdo_focus_vim()";
83 group = "VimTeX Events";
84 }
85 {
86 pattern = [ "VimtexEventQuit" ];
87 event = [ "User" ];
88 desc = "Close pdf after exiting nvim";
89 command = "VimtexClean";
90 group = "VimTeX Events";
91 }
92
93 {
94 pattern = [ "VimtexEventInitPost" ];
95 event = [ "User" ];
96 desc = "Start compiling when opening nvim to a tex file";
97 command = "VimtexCompile";
98 group = "VimTeX Events";
99 }
100
101 ];
102
103 lsp = {
104 servers = {
105 texlab = {
106 enable = true;
107 cmd = [ "${pkgs.texlab}/bin/texlab" ];
108 filetypes = [ "tex" ];
109 };
110 };
111 };
112 treesitter = {
113 grammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
114 latex
115 ];
116 };
117 };
118}