feat: neovim plugins update
This commit is contained in:
parent
6e8014e0b5
commit
eaf110c96f
13 changed files with 1195 additions and 6 deletions
21
home-manager/modules/neovim/autocommands.nix
Normal file
21
home-manager/modules/neovim/autocommands.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
{...}: {
|
||||||
|
programs.nixvim = {
|
||||||
|
autoCmd = [
|
||||||
|
# Remove trailing whitespace on save
|
||||||
|
{
|
||||||
|
event = "BufWrite";
|
||||||
|
command = "%s/\\s\\+$//e";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
event = "FileType";
|
||||||
|
pattern = [
|
||||||
|
"tex"
|
||||||
|
"latex"
|
||||||
|
"markdown"
|
||||||
|
];
|
||||||
|
command = "setlocal spell spelllang=en_us";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
inputs.nixvim.homeManagerModules.nixvim
|
inputs.nixvim.homeManagerModules.nixvim
|
||||||
./options.nix
|
./options.nix
|
||||||
./plugins
|
./plugins
|
||||||
|
./autocommands.nix
|
||||||
|
./keymappings.nix
|
||||||
];
|
];
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
387
home-manager/modules/neovim/keymappings.nix
Normal file
387
home-manager/modules/neovim/keymappings.nix
Normal file
|
|
@ -0,0 +1,387 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
programs.nixvim = {
|
||||||
|
extraConfigLuaPre = ''
|
||||||
|
function bool2str(bool) return bool and "on" or "off" end
|
||||||
|
'';
|
||||||
|
|
||||||
|
keymaps = let
|
||||||
|
helpers = config.lib.nixvim;
|
||||||
|
normal =
|
||||||
|
lib.mapAttrsToList
|
||||||
|
(
|
||||||
|
key: {action, ...} @ attrs: {
|
||||||
|
mode = "n";
|
||||||
|
inherit action key;
|
||||||
|
options = attrs.options or {};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
"<Space>" = {
|
||||||
|
action = "<NOP>";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Esc to clear search results
|
||||||
|
"<esc>" = {
|
||||||
|
action = "<cmd>noh<CR>";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Backspace delete in normal
|
||||||
|
"<BS>" = {
|
||||||
|
action = "<BS>x";
|
||||||
|
};
|
||||||
|
|
||||||
|
# fix Y behaviour
|
||||||
|
"Y" = {
|
||||||
|
action = "y$";
|
||||||
|
};
|
||||||
|
|
||||||
|
# back and fourth between the two most recent files
|
||||||
|
"<C-c>" = {
|
||||||
|
action = "<cmd>b#<CR>";
|
||||||
|
};
|
||||||
|
|
||||||
|
# navigate to left/right window
|
||||||
|
"<leader>[" = {
|
||||||
|
action = "<C-w>h";
|
||||||
|
options = {
|
||||||
|
desc = "Left window";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"<leader>]" = {
|
||||||
|
action = "<C-w>l";
|
||||||
|
options = {
|
||||||
|
desc = "Right window";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"<leader>." = {
|
||||||
|
action = "<C-w>j";
|
||||||
|
options = {
|
||||||
|
desc = "Up window";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"<leader>," = {
|
||||||
|
action = "<C-w>k";
|
||||||
|
options = {
|
||||||
|
desc = "Down window";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# navigate quickfix list
|
||||||
|
"<C-[>" = {
|
||||||
|
action = "<cmd>cnext<CR>";
|
||||||
|
};
|
||||||
|
"<C-]>" = {
|
||||||
|
action = "<cmd>cprev<CR>";
|
||||||
|
};
|
||||||
|
|
||||||
|
# resize with arrows
|
||||||
|
"<C-Up>" = {
|
||||||
|
action = "<cmd>resize -2<CR>";
|
||||||
|
};
|
||||||
|
"<C-Down>" = {
|
||||||
|
action = "<cmd>resize +2<CR>";
|
||||||
|
};
|
||||||
|
"<C-Left>" = {
|
||||||
|
action = "<cmd>vertical resize +2<CR>";
|
||||||
|
};
|
||||||
|
"<C-Right>" = {
|
||||||
|
action = "<cmd>vertical resize -2<CR>";
|
||||||
|
};
|
||||||
|
|
||||||
|
# move current line up/down
|
||||||
|
# M = Alt key
|
||||||
|
"<M-k>" = {
|
||||||
|
action = "<cmd>move-2<CR>";
|
||||||
|
};
|
||||||
|
"<M-j>" = {
|
||||||
|
action = "<cmd>move+<CR>";
|
||||||
|
};
|
||||||
|
|
||||||
|
"<Leader>w" = {
|
||||||
|
action = "<Cmd>w<CR>"; # Action to perform (save the file in this case)
|
||||||
|
options = {
|
||||||
|
desc = "Save";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"j" = {
|
||||||
|
action = "v:count == 0 ? 'gj' : 'j'";
|
||||||
|
options = {
|
||||||
|
desc = "Move cursor down";
|
||||||
|
expr = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"k" = {
|
||||||
|
action = "v:count == 0 ? 'gk' : 'k'";
|
||||||
|
options = {
|
||||||
|
desc = "Move cursor up";
|
||||||
|
expr = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"<Leader>q" = {
|
||||||
|
action = "<Cmd>confirm q<CR>";
|
||||||
|
options = {
|
||||||
|
desc = "Quit";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"<C-n>" = {
|
||||||
|
action = "<Cmd>enew<CR>";
|
||||||
|
options = {
|
||||||
|
desc = "New file";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"<leader>W" = {
|
||||||
|
action = "<Cmd>w!<CR>";
|
||||||
|
options = {
|
||||||
|
desc = "Force write";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"<leader>Q" = {
|
||||||
|
action = "<Cmd>q!<CR>";
|
||||||
|
options = {
|
||||||
|
desc = "Force quit";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"|" = {
|
||||||
|
action = "<Cmd>vsplit<CR>";
|
||||||
|
options = {
|
||||||
|
desc = "Vertical split";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"\\" = {
|
||||||
|
action = "<Cmd>split<CR>";
|
||||||
|
options = {
|
||||||
|
desc = "Horizontal split";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>bC" = {
|
||||||
|
action = "<cmd>%bd!<CR>";
|
||||||
|
options = {
|
||||||
|
desc = "Close all buffers";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"<leader>b]" = {
|
||||||
|
action = "<cmd>bnext<CR>";
|
||||||
|
options = {
|
||||||
|
desc = "Next buffer";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"<TAB>" = {
|
||||||
|
action = "<cmd>bnext<CR>";
|
||||||
|
options = {
|
||||||
|
desc = "Next buffer (default)";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"<leader>b[" = {
|
||||||
|
action = "<cmd>bprevious<CR>";
|
||||||
|
options = {
|
||||||
|
desc = "Previous buffer";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"<S-TAB>" = {
|
||||||
|
action = "<cmd>bprevious<CR>";
|
||||||
|
options = {
|
||||||
|
desc = "Previous buffer";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>ud" = {
|
||||||
|
action.__raw = ''
|
||||||
|
function ()
|
||||||
|
vim.b.disable_diagnostics = not vim.b.disable_diagnostics
|
||||||
|
if vim.b.disable_diagnostics then
|
||||||
|
vim.diagnostic.disable(0)
|
||||||
|
else
|
||||||
|
vim.diagnostic.enable(0)
|
||||||
|
end
|
||||||
|
vim.notify(string.format("Buffer Diagnostics %s", bool2str(not vim.b.disable_diagnostics), "info"))
|
||||||
|
end'';
|
||||||
|
options = {
|
||||||
|
desc = "Buffer Diagnostics toggle";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>uD" = {
|
||||||
|
action.__raw = ''
|
||||||
|
function ()
|
||||||
|
vim.g.disable_diagnostics = not vim.g.disable_diagnostics
|
||||||
|
if vim.g.disable_diagnostics then
|
||||||
|
vim.diagnostic.disable()
|
||||||
|
else
|
||||||
|
vim.diagnostic.enable()
|
||||||
|
end
|
||||||
|
vim.notify(string.format("Global Diagnostics %s", bool2str(not vim.g.disable_diagnostics), "info"))
|
||||||
|
end'';
|
||||||
|
options = {
|
||||||
|
desc = "Global Diagnostics toggle";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>uf" = {
|
||||||
|
action.__raw = ''
|
||||||
|
function ()
|
||||||
|
-- vim.g.disable_autoformat = not vim.g.disable_autoformat
|
||||||
|
vim.cmd('FormatToggle!')
|
||||||
|
vim.notify(string.format("Buffer Autoformatting %s", bool2str(not vim.b[0].disable_autoformat), "info"))
|
||||||
|
end'';
|
||||||
|
options = {
|
||||||
|
desc = "Buffer Autoformatting toggle";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>uF" = {
|
||||||
|
action.__raw = ''
|
||||||
|
function ()
|
||||||
|
-- vim.g.disable_autoformat = not vim.g.disable_autoformat
|
||||||
|
vim.cmd('FormatToggle')
|
||||||
|
vim.notify(string.format("Global Autoformatting %s", bool2str(not vim.g.disable_autoformat), "info"))
|
||||||
|
end'';
|
||||||
|
options = {
|
||||||
|
desc = "Global Autoformatting toggle";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>uS" = {
|
||||||
|
action.__raw = ''
|
||||||
|
function ()
|
||||||
|
if vim.g.spell_enabled then vim.cmd('setlocal nospell') end
|
||||||
|
if not vim.g.spell_enabled then vim.cmd('setlocal spell') end
|
||||||
|
vim.g.spell_enabled = not vim.g.spell_enabled
|
||||||
|
vim.notify(string.format("Spell %s", bool2str(vim.g.spell_enabled), "info"))
|
||||||
|
end'';
|
||||||
|
options = {
|
||||||
|
desc = "Spell toggle";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>uw" = {
|
||||||
|
action.__raw = ''
|
||||||
|
function ()
|
||||||
|
vim.wo.wrap = not vim.wo.wrap
|
||||||
|
vim.notify(string.format("Wrap %s", bool2str(vim.wo.wrap), "info"))
|
||||||
|
end'';
|
||||||
|
options = {
|
||||||
|
desc = "Word Wrap toggle";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>uh" = {
|
||||||
|
action.__raw = ''
|
||||||
|
function ()
|
||||||
|
local curr_foldcolumn = vim.wo.foldcolumn
|
||||||
|
if curr_foldcolumn ~= "0" then vim.g.last_active_foldcolumn = curr_foldcolumn end
|
||||||
|
vim.wo.foldcolumn = curr_foldcolumn == "0" and (vim.g.last_active_foldcolumn or "1") or "0"
|
||||||
|
vim.notify(string.format("Fold Column %s", bool2str(vim.wo.foldcolumn), "info"))
|
||||||
|
end'';
|
||||||
|
options = {
|
||||||
|
desc = "Fold Column toggle";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>uc" = {
|
||||||
|
action.__raw = ''
|
||||||
|
function ()
|
||||||
|
vim.g.cmp_enabled = not vim.g.cmp_enabled
|
||||||
|
vim.notify(string.format("Completions %s", bool2str(vim.g.cmp_enabled), "info"))
|
||||||
|
end'';
|
||||||
|
options = {
|
||||||
|
desc = "Completions toggle";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
visual =
|
||||||
|
lib.mapAttrsToList
|
||||||
|
(
|
||||||
|
key: {action, ...} @ attrs: {
|
||||||
|
mode = "v";
|
||||||
|
inherit action key;
|
||||||
|
options = attrs.options or {};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
# Better indenting
|
||||||
|
"<S-Tab>" = {
|
||||||
|
action = "<gv";
|
||||||
|
options = {
|
||||||
|
desc = "Unindent line";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"<" = {
|
||||||
|
action = "<gv";
|
||||||
|
options = {
|
||||||
|
desc = "Unindent line";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"<Tab>" = {
|
||||||
|
action = ">gv";
|
||||||
|
options = {
|
||||||
|
desc = "Indent line";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
">" = {
|
||||||
|
action = ">gv";
|
||||||
|
options = {
|
||||||
|
desc = "Indent line";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Move selected line/block in visual mode
|
||||||
|
"K" = {
|
||||||
|
action = "<cmd>m '<-2<CR>gv=gv<cr>";
|
||||||
|
};
|
||||||
|
"J" = {
|
||||||
|
action = "<cmd>m '>+1<CR>gv=gv<cr>";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Backspace delete in visual
|
||||||
|
"<BS>" = {
|
||||||
|
action = "x";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
insert =
|
||||||
|
lib.mapAttrsToList
|
||||||
|
(
|
||||||
|
key: {action, ...} @ attrs: {
|
||||||
|
mode = "i";
|
||||||
|
inherit action key;
|
||||||
|
options = attrs.options or {};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
# Move selected line/block in insert mode
|
||||||
|
"<C-k>" = {
|
||||||
|
action = "<C-o>gk";
|
||||||
|
};
|
||||||
|
"<C-h>" = {
|
||||||
|
action = "<Left>";
|
||||||
|
};
|
||||||
|
"<C-l>" = {
|
||||||
|
action = "<Right>";
|
||||||
|
};
|
||||||
|
"<C-j>" = {
|
||||||
|
action = "<C-o>gj";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
helpers.keymaps.mkKeymaps {options.silent = true;} (normal ++ visual ++ insert);
|
||||||
|
plugins.which-key.settings.spec = [
|
||||||
|
{
|
||||||
|
__unkeyed = "<leader>w";
|
||||||
|
icon = "";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
__unkeyed = "<leader>W";
|
||||||
|
icon = "";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
__unkeyed = "<leader>/";
|
||||||
|
icon = "";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -16,9 +16,12 @@ _: {
|
||||||
./illuminate.nix
|
./illuminate.nix
|
||||||
./lightbulb.nix
|
./lightbulb.nix
|
||||||
./lualine.nix
|
./lualine.nix
|
||||||
|
./luasnip.nix
|
||||||
./lean.nix
|
./lean.nix
|
||||||
./lsp.nix
|
./lsp.nix
|
||||||
./mini-bufremove.nix
|
./mini-bufremove.nix
|
||||||
|
./mini-surround.nix
|
||||||
|
./mini-indentscope.nix
|
||||||
./navic.nix
|
./navic.nix
|
||||||
./nix.nix
|
./nix.nix
|
||||||
./noice.nix
|
./noice.nix
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,32 @@
|
||||||
leanls.enable = true;
|
leanls.enable = true;
|
||||||
texlab.enable = true;
|
texlab.enable = true;
|
||||||
html.enable = true;
|
html.enable = true;
|
||||||
|
|
||||||
|
cmake = {
|
||||||
|
enable = true;
|
||||||
|
filetypes = ["cmake"];
|
||||||
|
};
|
||||||
|
|
||||||
|
# ccls = {
|
||||||
|
# enable = true;
|
||||||
|
# filetypes = [
|
||||||
|
# "c"
|
||||||
|
# "cpp"
|
||||||
|
# "objc"
|
||||||
|
# "objcpp"
|
||||||
|
# ];
|
||||||
|
#
|
||||||
|
# initOptions.compilationDatabaseDirectory = "build";
|
||||||
|
# };
|
||||||
|
clangd = {
|
||||||
|
enable = true;
|
||||||
|
filetypes = [
|
||||||
|
"c"
|
||||||
|
"cpp"
|
||||||
|
"objc"
|
||||||
|
"objcpp"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
which-key.settings.spec = [
|
which-key.settings.spec = [
|
||||||
|
|
|
||||||
41
home-manager/modules/neovim/plugins/luasnip.nix
Normal file
41
home-manager/modules/neovim/plugins/luasnip.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
{pkgs, ...}: {
|
||||||
|
programs.nixvim = {
|
||||||
|
plugins.luasnip = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
enable_autosnippets = true;
|
||||||
|
store_selection_keys = "<Tab>";
|
||||||
|
};
|
||||||
|
fromVscode = [
|
||||||
|
{
|
||||||
|
lazyLoad = true;
|
||||||
|
paths = "${pkgs.vimPlugins.friendly-snippets}";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
fromLua = [{paths = [../snippets];}];
|
||||||
|
};
|
||||||
|
extraFiles = {
|
||||||
|
"personal/luasnip-helper-funcs.lua".text = ''
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local ls = require("luasnip")
|
||||||
|
local sn = ls.snippet_node
|
||||||
|
local i = ls.insert_node
|
||||||
|
|
||||||
|
function M.get_ISO_8601_date()
|
||||||
|
return os.date("%Y-%m-%d")
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.get_visual(args, parent)
|
||||||
|
if (#parent.snippet.env.LS_SELECT_RAW > 0) then
|
||||||
|
return sn(nil, i(1, parent.snippet.env.LS_SELECT_RAW))
|
||||||
|
else
|
||||||
|
return sn(nil, i(1, '''))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
37
home-manager/modules/neovim/plugins/mini-indentscope.nix
Normal file
37
home-manager/modules/neovim/plugins/mini-indentscope.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
{...}: {
|
||||||
|
programs.nixvim = {
|
||||||
|
autoCmd = [
|
||||||
|
{
|
||||||
|
event = ["FileType"];
|
||||||
|
pattern = [
|
||||||
|
"help"
|
||||||
|
"alpha"
|
||||||
|
"dashboard"
|
||||||
|
"neo-tree"
|
||||||
|
"Trouble"
|
||||||
|
"trouble"
|
||||||
|
"lazy"
|
||||||
|
"mason"
|
||||||
|
"notify"
|
||||||
|
"toggleterm"
|
||||||
|
"lazyterm"
|
||||||
|
];
|
||||||
|
callback.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.b.miniindentscope_disable = true
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
plugins = {
|
||||||
|
mini = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
modules = {
|
||||||
|
indentscope = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
23
home-manager/modules/neovim/plugins/mini-surround.nix
Normal file
23
home-manager/modules/neovim/plugins/mini-surround.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
{...}: {
|
||||||
|
programs.nixvim = {
|
||||||
|
plugins = {
|
||||||
|
mini = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
modules = {
|
||||||
|
surround = {
|
||||||
|
mappings = {
|
||||||
|
add = "gsa"; # -- Add surrounding in Normal and Visual modes
|
||||||
|
delete = "gsd"; # -- Delete surrounding
|
||||||
|
find = "gsf"; # -- Find surrounding (to the right)
|
||||||
|
find_left = "gsF"; # -- Find surrounding (to the left)
|
||||||
|
highlight = "gsh"; # -- Highlight surrounding
|
||||||
|
replace = "gsr"; # -- Replace surrounding
|
||||||
|
update_n_lines = "gsn"; # -- Update `n_lines`
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -9,6 +9,56 @@
|
||||||
keywords = "TODO,FIX,HACK";
|
keywords = "TODO,FIX,HACK";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
keywords = {
|
||||||
|
FIX = {
|
||||||
|
alt = [
|
||||||
|
"FIXME"
|
||||||
|
"BUG"
|
||||||
|
"FIXIT"
|
||||||
|
"ISSUE"
|
||||||
|
];
|
||||||
|
color = "error";
|
||||||
|
icon = " ";
|
||||||
|
};
|
||||||
|
HACK = {
|
||||||
|
color = "warning";
|
||||||
|
icon = " ";
|
||||||
|
};
|
||||||
|
NOTE = {
|
||||||
|
alt = ["INFO"];
|
||||||
|
color = "hint";
|
||||||
|
icon = " ";
|
||||||
|
};
|
||||||
|
PERF = {
|
||||||
|
alt = [
|
||||||
|
"OPTIM"
|
||||||
|
"PERFORMANCE"
|
||||||
|
"OPTIMIZE"
|
||||||
|
];
|
||||||
|
icon = " ";
|
||||||
|
};
|
||||||
|
TEST = {
|
||||||
|
alt = [
|
||||||
|
"TESTING"
|
||||||
|
"PASSED"
|
||||||
|
"FAILED"
|
||||||
|
];
|
||||||
|
color = "test";
|
||||||
|
icon = "⏲ ";
|
||||||
|
};
|
||||||
|
TODO = {
|
||||||
|
color = "info";
|
||||||
|
icon = " ";
|
||||||
|
};
|
||||||
|
WARN = {
|
||||||
|
alt = [
|
||||||
|
"WARNING"
|
||||||
|
"XXX"
|
||||||
|
];
|
||||||
|
color = "warning";
|
||||||
|
icon = " ";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
105
home-manager/modules/neovim/snippets/tex/greek.lua
Normal file
105
home-manager/modules/neovim/snippets/tex/greek.lua
Normal file
|
|
@ -0,0 +1,105 @@
|
||||||
|
-- Return snippet tables
|
||||||
|
return {
|
||||||
|
s({ trig = ";a", snippetType = "autosnippet" }, {
|
||||||
|
t("\\alpha"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";b", snippetType = "autosnippet" }, {
|
||||||
|
t("\\beta"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";g", snippetType = "autosnippet" }, {
|
||||||
|
t("\\gamma"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";G", snippetType = "autosnippet" }, {
|
||||||
|
t("\\Gamma"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";d", snippetType = "autosnippet" }, {
|
||||||
|
t("\\delta"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";D", snippetType = "autosnippet" }, {
|
||||||
|
t("\\Delta"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";e", snippetType = "autosnippet" }, {
|
||||||
|
t("\\epsilon"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";ve", snippetType = "autosnippet" }, {
|
||||||
|
t("\\varepsilon"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";z", snippetType = "autosnippet" }, {
|
||||||
|
t("\\zeta"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";h", snippetType = "autosnippet" }, {
|
||||||
|
t("\\eta"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";o", snippetType = "autosnippet" }, {
|
||||||
|
t("\\theta"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";vo", snippetType = "autosnippet" }, {
|
||||||
|
t("\\vartheta"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";O", snippetType = "autosnippet" }, {
|
||||||
|
t("\\Theta"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";k", snippetType = "autosnippet" }, {
|
||||||
|
t("\\kappa"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";l", snippetType = "autosnippet" }, {
|
||||||
|
t("\\lambda"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";L", snippetType = "autosnippet" }, {
|
||||||
|
t("\\Lambda"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";m", snippetType = "autosnippet" }, {
|
||||||
|
t("\\mu"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";n", snippetType = "autosnippet" }, {
|
||||||
|
t("\\nu"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";x", snippetType = "autosnippet" }, {
|
||||||
|
t("\\xi"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";X", snippetType = "autosnippet" }, {
|
||||||
|
t("\\Xi"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";i", snippetType = "autosnippet" }, {
|
||||||
|
t("\\pi"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";I", snippetType = "autosnippet" }, {
|
||||||
|
t("\\Pi"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";r", snippetType = "autosnippet" }, {
|
||||||
|
t("\\rho"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";s", snippetType = "autosnippet" }, {
|
||||||
|
t("\\sigma"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";S", snippetType = "autosnippet" }, {
|
||||||
|
t("\\Sigma"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";t", snippetType = "autosnippet" }, {
|
||||||
|
t("\\tau"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";f", snippetType = "autosnippet" }, {
|
||||||
|
t("\\phi"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";vf", snippetType = "autosnippet" }, {
|
||||||
|
t("\\varphi"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";F", snippetType = "autosnippet" }, {
|
||||||
|
t("\\Phi"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";c", snippetType = "autosnippet" }, {
|
||||||
|
t("\\chi"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";p", snippetType = "autosnippet" }, {
|
||||||
|
t("\\psi"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";P", snippetType = "autosnippet" }, {
|
||||||
|
t("\\Psi"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";w", snippetType = "autosnippet" }, {
|
||||||
|
t("\\omega"),
|
||||||
|
}),
|
||||||
|
s({ trig = ";W", snippetType = "autosnippet" }, {
|
||||||
|
t("\\Omega"),
|
||||||
|
}),
|
||||||
|
}
|
||||||
492
home-manager/modules/neovim/snippets/tex/math.lua
Normal file
492
home-manager/modules/neovim/snippets/tex/math.lua
Normal file
|
|
@ -0,0 +1,492 @@
|
||||||
|
local helpers = require("personal.luasnip-helper-funcs")
|
||||||
|
local get_visual = helpers.get_visual
|
||||||
|
|
||||||
|
-- Math context detection
|
||||||
|
local tex = {}
|
||||||
|
tex.in_mathzone = function()
|
||||||
|
return vim.fn["vimtex#syntax#in_mathzone"]() == 1
|
||||||
|
end
|
||||||
|
tex.in_text = function()
|
||||||
|
return not tex.in_mathzone()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Return snippet tables
|
||||||
|
return {
|
||||||
|
-- SUPERSCRIPT
|
||||||
|
s(
|
||||||
|
{ trig = "([%w%)%]%}])'", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>^{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
d(1, get_visual),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- SUBSCRIPT
|
||||||
|
s(
|
||||||
|
{ trig = "([%w%)%]%}]);", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>_{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
d(1, get_visual),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- SUBSCRIPT AND SUPERSCRIPT
|
||||||
|
s(
|
||||||
|
{ trig = "([%w%)%]%}])__", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>^{<>}_{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
i(1),
|
||||||
|
i(2),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- TEXT SUBSCRIPT
|
||||||
|
s(
|
||||||
|
{ trig = "sd", snippetType = "autosnippet", wordTrig = false },
|
||||||
|
fmta("_{\\mathrm{<>}}", { d(1, get_visual) }),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- SUPERSCRIPT SHORTCUT
|
||||||
|
-- Places the first alphanumeric character after the trigger into a superscript.
|
||||||
|
s(
|
||||||
|
{ trig = '([%w%)%]%}])"([%w])', regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||||
|
fmta("<>^{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[2]
|
||||||
|
end),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- SUBSCRIPT SHORTCUT
|
||||||
|
-- Places the first alphanumeric character after the trigger into a subscript.
|
||||||
|
s(
|
||||||
|
{ trig = "([%w%)%]%}]):([%w])", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||||
|
fmta("<>_{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[2]
|
||||||
|
end),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- EULER'S NUMBER SUPERSCRIPT SHORTCUT
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])ee", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||||
|
fmta("<>e^{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
d(1, get_visual),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- ZERO SUBSCRIPT SHORTCUT
|
||||||
|
s(
|
||||||
|
{ trig = "([%a%)%]%}])00", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||||
|
fmta("<>_{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
t("0"),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- MINUS ONE SUPERSCRIPT SHORTCUT
|
||||||
|
s(
|
||||||
|
{ trig = "([%a%)%]%}])11", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||||
|
fmta("<>_{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
t("-1"),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- J SUBSCRIPT SHORTCUT (since jk triggers snippet jump forward)
|
||||||
|
s(
|
||||||
|
{ trig = "([%a%)%]%}])JJ", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>_{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
t("j"),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- PLUS SUPERSCRIPT SHORTCUT
|
||||||
|
s(
|
||||||
|
{ trig = "([%a%)%]%}])%+%+", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||||
|
fmta("<>^{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
t("+"),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- COMPLEMENT SUPERSCRIPT
|
||||||
|
s(
|
||||||
|
{ trig = "([%a%)%]%}])CC", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||||
|
fmta("<>^{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
t("\\complement"),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- CONJUGATE (STAR) SUPERSCRIPT SHORTCUT
|
||||||
|
s(
|
||||||
|
{ trig = "([%a%)%]%}])%*%*", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||||
|
fmta("<>^{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
t("*"),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- VECTOR, i.e. \vec
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])vv", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\vec{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
d(1, get_visual),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- DEFAULT UNIT VECTOR WITH SUBSCRIPT, i.e. \unitvector_{}
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])ue", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\unitvector_{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
d(1, get_visual),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- UNIT VECTOR WITH HAT, i.e. \uvec{}
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])uv", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\uvec{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
d(1, get_visual),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- MATRIX, i.e. \vec
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])mt", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\mat{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
d(1, get_visual),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- FRACTION
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])ff", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\frac{<>}{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
d(1, get_visual),
|
||||||
|
i(2),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- ANGLE
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])gg", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\ang{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
d(1, get_visual),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- ABSOLUTE VALUE
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])aa", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\abs{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
d(1, get_visual),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- SQUARE ROOT
|
||||||
|
s(
|
||||||
|
{ trig = "([^%\\])sq", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\sqrt{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
d(1, get_visual),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- BINOMIAL SYMBOL
|
||||||
|
s(
|
||||||
|
{ trig = "([^%\\])bnn", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\binom{<>}{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
i(1),
|
||||||
|
i(2),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- LOGARITHM WITH BASE SUBSCRIPT
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a%\\])ll", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\log_{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
i(1),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- DERIVATIVE with denominator only
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])dV", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\dvOne{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
d(1, get_visual),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- DERIVATIVE with numerator and denominator
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])dvv", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\dv{<>}{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
i(1),
|
||||||
|
i(2),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- DERIVATIVE with numerator, denominator, and higher-order argument
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])ddv", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\dvN{<>}{<>}{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
i(1),
|
||||||
|
i(2),
|
||||||
|
i(3),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- PARTIAL DERIVATIVE with denominator only
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])pV", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\pdvOne{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
d(1, get_visual),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- PARTIAL DERIVATIVE with numerator and denominator
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])pvv", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\pdv{<>}{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
i(1),
|
||||||
|
i(2),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- PARTIAL DERIVATIVE with numerator, denominator, and higher-order argument
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])ppv", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\pdvN{<>}{<>}{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
i(1),
|
||||||
|
i(2),
|
||||||
|
i(3),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- SUM with lower limit
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])sM", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\sum_{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
i(1),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- SUM with upper and lower limit
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])smm", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\sum_{<>}^{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
i(1),
|
||||||
|
i(2),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- INTEGRAL with upper and lower limit
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])intt", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\int_{<>}^{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
i(1),
|
||||||
|
i(2),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- INTEGRAL from positive to negative infinity
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])intf", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\int_{\\infty}^{\\infty}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
-- BOXED command
|
||||||
|
s(
|
||||||
|
{ trig = "([^%a])bb", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||||
|
fmta("<>\\boxed{<>}", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return snip.captures[1]
|
||||||
|
end),
|
||||||
|
d(1, get_visual),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
--
|
||||||
|
-- BEGIN STATIC SNIPPETS
|
||||||
|
--
|
||||||
|
|
||||||
|
-- DIFFERENTIAL, i.e. \diff
|
||||||
|
s({ trig = "df", snippetType = "autosnippet", priority = 2000, snippetType = "autosnippet" }, {
|
||||||
|
t("\\diff"),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
|
-- BASIC INTEGRAL SYMBOL, i.e. \int
|
||||||
|
s({ trig = "in1", snippetType = "autosnippet" }, {
|
||||||
|
t("\\int"),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
|
-- DOUBLE INTEGRAL, i.e. \iint
|
||||||
|
s({ trig = "in2", snippetType = "autosnippet" }, {
|
||||||
|
t("\\iint"),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
|
-- TRIPLE INTEGRAL, i.e. \iiint
|
||||||
|
s({ trig = "in3", snippetType = "autosnippet" }, {
|
||||||
|
t("\\iiint"),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
|
-- CLOSED SINGLE INTEGRAL, i.e. \oint
|
||||||
|
s({ trig = "oi1", snippetType = "autosnippet" }, {
|
||||||
|
t("\\oint"),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
|
-- CLOSED DOUBLE INTEGRAL, i.e. \oiint
|
||||||
|
s({ trig = "oi2", snippetType = "autosnippet" }, {
|
||||||
|
t("\\oiint"),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
|
-- GRADIENT OPERATOR, i.e. \grad
|
||||||
|
s({ trig = "gdd", snippetType = "autosnippet" }, {
|
||||||
|
t("\\grad "),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
|
-- CURL OPERATOR, i.e. \curl
|
||||||
|
s({ trig = "cll", snippetType = "autosnippet" }, {
|
||||||
|
t("\\curl "),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
|
-- DIVERGENCE OPERATOR, i.e. \divergence
|
||||||
|
s({ trig = "DI", snippetType = "autosnippet" }, {
|
||||||
|
t("\\div "),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
|
-- LAPLACIAN OPERATOR, i.e. \laplacian
|
||||||
|
s({ trig = "laa", snippetType = "autosnippet" }, {
|
||||||
|
t("\\laplacian "),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
|
-- PARALLEL SYMBOL, i.e. \parallel
|
||||||
|
s({ trig = "||", snippetType = "autosnippet" }, {
|
||||||
|
t("\\parallel"),
|
||||||
|
}),
|
||||||
|
-- CDOTS, i.e. \cdots
|
||||||
|
s({ trig = "cdd", snippetType = "autosnippet" }, {
|
||||||
|
t("\\cdots"),
|
||||||
|
}),
|
||||||
|
-- LDOTS, i.e. \ldots
|
||||||
|
s({ trig = "ldd", snippetType = "autosnippet" }, {
|
||||||
|
t("\\ldots"),
|
||||||
|
}),
|
||||||
|
-- EQUIV, i.e. \equiv
|
||||||
|
s({ trig = "eqq", snippetType = "autosnippet" }, {
|
||||||
|
t("\\equiv "),
|
||||||
|
}),
|
||||||
|
-- SETMINUS, i.e. \setminus
|
||||||
|
s({ trig = "stm", snippetType = "autosnippet" }, {
|
||||||
|
t("\\setminus "),
|
||||||
|
}),
|
||||||
|
-- SUBSET, i.e. \subset
|
||||||
|
s({ trig = "sbb", snippetType = "autosnippet" }, {
|
||||||
|
t("\\subset "),
|
||||||
|
}),
|
||||||
|
-- APPROX, i.e. \approx
|
||||||
|
s({ trig = "px", snippetType = "autosnippet" }, {
|
||||||
|
t("\\approx "),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
|
-- PROPTO, i.e. \propto
|
||||||
|
s({ trig = "pt", snippetType = "autosnippet" }, {
|
||||||
|
t("\\propto "),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
|
-- COLON, i.e. \colon
|
||||||
|
s({ trig = "::", snippetType = "autosnippet" }, {
|
||||||
|
t("\\colon "),
|
||||||
|
}),
|
||||||
|
-- IMPLIES, i.e. \implies
|
||||||
|
s({ trig = ">>", snippetType = "autosnippet" }, {
|
||||||
|
t("\\implies "),
|
||||||
|
}),
|
||||||
|
-- DOT PRODUCT, i.e. \cdot
|
||||||
|
s({ trig = ",.", snippetType = "autosnippet" }, {
|
||||||
|
t("\\cdot "),
|
||||||
|
}),
|
||||||
|
-- CROSS PRODUCT, i.e. \times
|
||||||
|
s({ trig = "xx", snippetType = "autosnippet" }, {
|
||||||
|
t("\\times "),
|
||||||
|
}),
|
||||||
|
}
|
||||||
5
home-manager/modules/neovim/snippets/tex/test.tex
Normal file
5
home-manager/modules/neovim/snippets/tex/test.tex
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
|
\begin{align*}
|
||||||
|
|
||||||
|
\end{align*}
|
||||||
|
|
@ -14,19 +14,15 @@
|
||||||
# If you want to use modules your own flake exports (from modules/nixos):
|
# If you want to use modules your own flake exports (from modules/nixos):
|
||||||
# outputs.nixosModules.example
|
# outputs.nixosModules.example
|
||||||
../../common/nixos/common.nix
|
../../common/nixos/common.nix
|
||||||
../../common/nixos/bluetooth.nix
|
|
||||||
../../common/nixos/restic.nix
|
../../common/nixos/restic.nix
|
||||||
../../common/nixos/ssh/default.nix
|
|
||||||
../../common/gui/hyprland.nix
|
../../common/gui/hyprland.nix
|
||||||
../../common/gui/steam.nix
|
../../common/gui/steam.nix
|
||||||
../../common/gui/thunar.nix
|
../../common/gui/thunar.nix
|
||||||
../../common/style/stylix.nix
|
../../common/style/stylix.nix
|
||||||
../../common/virtualization/podman.nix
|
../../common/nixos/sysctl
|
||||||
../../common/virtualization/kubernetes.nix
|
|
||||||
../../common/virtualization/libvirt.nix
|
|
||||||
../../common/nixos/sysctl/default.nix
|
|
||||||
|
|
||||||
../../common/networking
|
../../common/networking
|
||||||
|
../../common/virtualization
|
||||||
|
|
||||||
./syncthing.nix
|
./syncthing.nix
|
||||||
./auditd.nix
|
./auditd.nix
|
||||||
|
|
@ -49,6 +45,7 @@
|
||||||
|
|
||||||
ssh.enable = true;
|
ssh.enable = true;
|
||||||
ssh_guard.enable = true;
|
ssh_guard.enable = true;
|
||||||
|
nfs.enable = true;
|
||||||
|
|
||||||
# Bootloader.
|
# Bootloader.
|
||||||
boot = {
|
boot = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue