diff options
| author | Nanderty <psopka@sopka.ch> | 2023-03-26 16:04:40 +0200 |
|---|---|---|
| committer | Nanderty <psopka@sopka.ch> | 2023-03-26 16:04:40 +0200 |
| commit | ef44657937474145403c2b441b862035914d6a44 (patch) | |
| tree | cefeca8f30c2b8b16dd7b7ed877310a0f181fba0 /lua/Snippets/luasniphelperslatex.lua | |
| parent | 063c2d97218cdabe0634054a8038cd6b5c9a9a12 (diff) | |
| download | neovim-config-ef44657937474145403c2b441b862035914d6a44.tar.gz neovim-config-ef44657937474145403c2b441b862035914d6a44.tar.bz2 neovim-config-ef44657937474145403c2b441b862035914d6a44.zip | |
Snippets
Diffstat (limited to 'lua/Snippets/luasniphelperslatex.lua')
| -rw-r--r-- | lua/Snippets/luasniphelperslatex.lua | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lua/Snippets/luasniphelperslatex.lua b/lua/Snippets/luasniphelperslatex.lua new file mode 100644 index 0000000..a31e714 --- /dev/null +++ b/lua/Snippets/luasniphelperslatex.lua @@ -0,0 +1,26 @@ +local M = {} + +M.in_mathzone = function() + return vim.fn['vimtex#syntax#in_mathzone']() == 1 +end +M.in_text = function() + return not tex_utils.in_mathzone() +end +M.in_comment = function() + return vim.fn['vimtex#syntax#in_comment']() == 1 +end +M.in_env = function(name) + local is_inside = vim.fn['vimtex#env#is_inside'](name) + return (is_inside[1] > 0 and is_inside[2] > 0) +end +M.in_equation = function() + return tex_utils.in_env('equation') +end +M.in_itemize = function() + return tex_utils.in_env('itemize') +end +M.in_tikz = function() + return tex_utils.in_env('tikzpicture') +end + +return M |
