2024-05-07 22:49:00 -04:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
2024-08-05 16:40:32 -04:00
|
|
|
pkgs,
|
|
|
|
self,
|
2024-05-07 22:49:00 -04:00
|
|
|
vimplugin-easytables-src,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit (config.vars) neovimIde;
|
|
|
|
inherit (pkgs) vimPlugins;
|
|
|
|
|
2024-08-05 16:40:32 -04:00
|
|
|
inherit (import "${self}/lib.nix" {inherit pkgs;}) buildPlugin;
|
2024-05-07 22:49:00 -04:00
|
|
|
in
|
|
|
|
lib.mkIf neovimIde {
|
|
|
|
programs = {
|
|
|
|
neovim = {
|
2024-06-01 17:41:48 -04:00
|
|
|
extraPackages = [
|
|
|
|
pkgs.pandoc
|
|
|
|
|
|
|
|
# LaTeX packages
|
|
|
|
pkgs.texlab
|
|
|
|
pkgs.texliveFull
|
|
|
|
pkgs.rubber
|
|
|
|
];
|
|
|
|
|
|
|
|
extraLuaConfig =
|
2024-06-09 22:49:30 -04:00
|
|
|
# lua
|
2024-06-01 17:41:48 -04:00
|
|
|
''
|
|
|
|
local lsp = require('lspconfig');
|
2024-05-11 20:10:45 -04:00
|
|
|
|
2024-07-28 02:54:34 -04:00
|
|
|
lsp.texlab.setup({
|
|
|
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
|
|
|
|
2024-06-02 00:04:59 -04:00
|
|
|
settings = {
|
|
|
|
texlab = {
|
|
|
|
formatterLineLength = 100,
|
|
|
|
latexFormatter = 'latexindent',
|
|
|
|
latexindent = {
|
|
|
|
modifyLineBreaks = false,
|
|
|
|
["local"] = '.indentconfig.yaml';
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-07-28 02:54:34 -04:00
|
|
|
});
|
2024-06-01 17:41:48 -04:00
|
|
|
'';
|
|
|
|
|
|
|
|
plugins = [
|
2024-05-07 22:49:00 -04:00
|
|
|
{
|
|
|
|
plugin = buildPlugin "easytables-nvim" vimplugin-easytables-src;
|
|
|
|
type = "lua";
|
|
|
|
config =
|
2024-06-09 22:49:30 -04:00
|
|
|
# lua
|
2024-05-07 22:49:00 -04:00
|
|
|
''
|
|
|
|
require('easytables').setup();
|
|
|
|
'';
|
|
|
|
}
|
2024-06-01 17:41:48 -04:00
|
|
|
|
|
|
|
{
|
|
|
|
plugin = vimPlugins.knap;
|
|
|
|
type = "lua";
|
|
|
|
config =
|
2024-06-09 22:49:30 -04:00
|
|
|
# lua
|
2024-06-01 17:41:48 -04:00
|
|
|
''
|
2024-06-09 22:49:30 -04:00
|
|
|
--
|
2024-06-02 00:04:59 -04:00
|
|
|
vim.api.nvim_create_autocmd('FileType', {
|
|
|
|
pattern = 'tex',
|
|
|
|
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
|
|
|
});
|
|
|
|
|
2024-06-08 21:30:44 -04:00
|
|
|
vim.g.knap_settings = {
|
2024-06-01 17:41:48 -04:00
|
|
|
-- HTML
|
2024-06-08 21:30:44 -04:00
|
|
|
htmloutputext = 'html',
|
|
|
|
htmltohtml = 'none',
|
2024-06-01 17:41:48 -04:00
|
|
|
htmltohtmlviewerlaunch = "",
|
2024-06-08 21:30:44 -04:00
|
|
|
htmltohtmlviewerrefresh = 'none',
|
2024-06-01 17:41:48 -04:00
|
|
|
|
|
|
|
-- Markdown
|
2024-06-08 21:30:44 -04:00
|
|
|
mdoutputext = 'html',
|
|
|
|
markdownoutputext = 'html',
|
|
|
|
|
|
|
|
-- Markdown to PDF
|
2024-06-01 17:41:48 -04:00
|
|
|
mdtopdf = 'pandoc %docroot% -o /tmp/%outputfile%',
|
2024-06-08 21:30:44 -04:00
|
|
|
markdowntopdf = 'pandoc %docroot% -o /tmp/%outputfile%',
|
2024-06-01 17:41:48 -04:00
|
|
|
mdtopdfviewerlaunch = 'sioyek /tmp/%outputfile%',
|
2024-06-08 21:30:44 -04:00
|
|
|
markdowntopdfviewerlaunch = 'sioyek /tmp/%outputfile%',
|
2024-06-01 17:41:48 -04:00
|
|
|
mdtopdfviewerrefresh = 'none',
|
|
|
|
markdowntopdfviewerrefresh = "none",
|
2024-06-08 21:30:44 -04:00
|
|
|
|
|
|
|
-- 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%',
|
2024-06-01 17:41:48 -04:00
|
|
|
mdtohtmlviewerrefresh = 'none',
|
|
|
|
markdowntohtmlviewerrefresh = 'none',
|
|
|
|
|
|
|
|
-- LaTeX
|
|
|
|
-- TODO: stop from polluting workspace
|
|
|
|
};
|
|
|
|
|
|
|
|
-- F4 processes the document once, and refreshes the view
|
2024-06-08 21:30:44 -04:00
|
|
|
vim.keymap.set({ 'n', 'v', 'i' }, '<F4>', function()
|
2024-06-01 17:41:48 -04:00
|
|
|
require('knap').process_once();
|
|
|
|
end);
|
|
|
|
|
|
|
|
-- F5 closes the viewer application, and
|
|
|
|
-- allows settings to be reset
|
2024-06-08 21:30:44 -04:00
|
|
|
vim.keymap.set({ 'n', 'v', 'i' }, '<F5>', function()
|
2024-06-01 17:41:48 -04:00
|
|
|
require('knap').close_viewer();
|
|
|
|
end);
|
|
|
|
|
|
|
|
-- F6 toggles the auto-processing on and off
|
2024-06-08 21:30:44 -04:00
|
|
|
vim.keymap.set({ 'n', 'v', 'i' }, '<F6>', function()
|
2024-06-01 17:41:48 -04:00
|
|
|
require('knap').toggle_autopreviewing();
|
|
|
|
end);
|
|
|
|
|
|
|
|
-- F7 invokes a SyncTeX forward search, or similar,
|
|
|
|
-- where appropriate
|
2024-06-08 21:30:44 -04:00
|
|
|
vim.keymap.set({ 'n', 'v', 'i' }, '<F7>', function()
|
2024-06-01 17:41:48 -04:00
|
|
|
require('knap').forward_jump();
|
|
|
|
end);
|
|
|
|
'';
|
|
|
|
}
|
2024-05-07 22:49:00 -04:00
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|