{ config, pkgs, lib, vimplugin-easytables-src, ... }: let inherit (config.vars) neovimIde; inherit (pkgs) vimPlugins; buildPlugin = pname: src: pkgs.vimUtils.buildVimPlugin { inherit pname src; version = src.shortRev; }; in lib.mkIf neovimIde { programs = { neovim = { extraPackages = [ pkgs.pandoc # LaTeX packages pkgs.texlab pkgs.texliveFull pkgs.rubber ]; extraLuaConfig = /* lua */ '' local lsp = require('lspconfig'); local coq = require('coq'); lsp.texlab.setup(coq.lsp_ensure_capabilities({ settings = { texlab = { formatterLineLength = 100, latexFormatter = 'latexindent', latexindent = { modifyLineBreaks = false, ["local"] = '.indentconfig.yaml'; }, }, }, })); ''; plugins = [ { plugin = buildPlugin "easytables-nvim" vimplugin-easytables-src; type = "lua"; config = /* lua */ '' require('easytables').setup(); ''; } { plugin = vimPlugins.knap; type = "lua"; config = /* lua */ '' vim.api.nvim_create_autocmd('FileType', { pattern = 'tex', command = 'setlocal ts=4 sw=4 sts=0 expandtab', }); vim.g.knap_settings = { -- HTML htmloutputext = 'html', htmltohtml = 'none', htmltohtmlviewerlaunch = "", htmltohtmlviewerrefresh = 'none', -- Markdown mdoutputext = 'html', markdownoutputext = 'html', -- Markdown to PDF mdtopdf = 'pandoc %docroot% -o /tmp/%outputfile%', markdowntopdf = 'pandoc %docroot% -o /tmp/%outputfile%', mdtopdfviewerlaunch = 'sioyek /tmp/%outputfile%', markdowntopdfviewerlaunch = 'sioyek /tmp/%outputfile%', mdtopdfviewerrefresh = 'none', markdowntopdfviewerrefresh = "none", -- Markdown to HTML mdtohtml = 'pandoc --standalone %docroot% -o /tmp/%outputfile%', markdowntohtml = 'pandoc --standalone %docroot% -o /tmp/%outputfile%', mdtohtmlviewerlaunch = 'firefox -new-window /tmp/%outputfile%', markdowntohtmlviewerlaunch = 'firefox -new-window /tmp/%outputfile%', mdtohtmlviewerrefresh = 'none', markdowntohtmlviewerrefresh = 'none', -- LaTeX -- TODO: stop from polluting workspace }; -- F4 processes the document once, and refreshes the view vim.keymap.set({ 'n', 'v', 'i' }, '', function() require('knap').process_once(); end); -- F5 closes the viewer application, and -- allows settings to be reset vim.keymap.set({ 'n', 'v', 'i' }, '', function() require('knap').close_viewer(); end); -- F6 toggles the auto-processing on and off vim.keymap.set({ 'n', 'v', 'i' }, '', function() require('knap').toggle_autopreviewing(); end); -- F7 invokes a SyncTeX forward search, or similar, -- where appropriate vim.keymap.set({ 'n', 'v', 'i' }, '', function() require('knap').forward_jump(); end); ''; } ]; }; }; }