neovim stuffs, tex, esp32
This commit is contained in:
parent
044ebe7bff
commit
bd4d79f7f3
61
init.lua
61
init.lua
|
|
@ -462,7 +462,7 @@ require('lazy').setup({
|
||||||
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
|
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
|
||||||
{ 'williamboman/mason.nvim', opts = {} },
|
{ 'williamboman/mason.nvim', opts = {} },
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/mason-lspconfig.nvim',
|
||||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
-- 'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||||
|
|
||||||
-- Useful status updates for LSP.
|
-- Useful status updates for LSP.
|
||||||
{ 'j-hui/fidget.nvim', opts = {} },
|
{ 'j-hui/fidget.nvim', opts = {} },
|
||||||
|
|
@ -471,6 +471,16 @@ require('lazy').setup({
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
|
vim.lsp.config('clangd', {
|
||||||
|
cmd = { 'clangd' },
|
||||||
|
filetypes = { 'c', 'cpp', 'objc', 'objcpp' },
|
||||||
|
autostart = true,
|
||||||
|
})
|
||||||
|
vim.lsp.enable 'clangd'
|
||||||
|
if os.getenv 'NVIM_ESP32_ENV' then
|
||||||
|
local esp32 = require 'esp32'
|
||||||
|
vim.lsp.config('clangd', esp32.lsp_config())
|
||||||
|
end
|
||||||
-- Brief aside: **What is LSP?**
|
-- Brief aside: **What is LSP?**
|
||||||
--
|
--
|
||||||
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
||||||
|
|
@ -625,7 +635,6 @@ require('lazy').setup({
|
||||||
-- - settings (table): Override the default settings passed when initializing the server.
|
-- - settings (table): Override the default settings passed when initializing the server.
|
||||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||||
local servers = {
|
local servers = {
|
||||||
clangd = {},
|
|
||||||
-- gopls = {},
|
-- gopls = {},
|
||||||
rust_analyzer = {},
|
rust_analyzer = {},
|
||||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||||
|
|
@ -666,11 +675,11 @@ require('lazy').setup({
|
||||||
--
|
--
|
||||||
-- You can add other tools here that you want Mason to install
|
-- You can add other tools here that you want Mason to install
|
||||||
-- for you, so that they are available from within Neovim.
|
-- for you, so that they are available from within Neovim.
|
||||||
local ensure_installed = vim.tbl_keys(servers or {})
|
-- local ensure_installed = vim.tbl_keys(servers or {})
|
||||||
vim.list_extend(ensure_installed, {
|
-- vim.list_extend(ensure_installed, {
|
||||||
'stylua', -- Used to format Lua code
|
-- 'stylua', -- Used to format Lua code
|
||||||
})
|
-- })
|
||||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
-- require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||||
|
|
||||||
require('mason-lspconfig').setup {
|
require('mason-lspconfig').setup {
|
||||||
handlers = {
|
handlers = {
|
||||||
|
|
@ -683,7 +692,7 @@ require('lazy').setup({
|
||||||
require('lspconfig')[server_name].setup(server)
|
require('lspconfig')[server_name].setup(server)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
automatic_installation = true,
|
-- automatic_installation = true,
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
@ -723,6 +732,7 @@ require('lazy').setup({
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { 'stylua' },
|
lua = { 'stylua' },
|
||||||
markdown = { 'markdownlint' },
|
markdown = { 'markdownlint' },
|
||||||
|
json = { 'fixjson', 'jq' },
|
||||||
-- Conform can also run multiple formatters sequentially
|
-- Conform can also run multiple formatters sequentially
|
||||||
-- python = { "isort", "black" },
|
-- python = { "isort", "black" },
|
||||||
--
|
--
|
||||||
|
|
@ -850,6 +860,7 @@ require('lazy').setup({
|
||||||
name = 'luasnip',
|
name = 'luasnip',
|
||||||
option = {
|
option = {
|
||||||
show_autosnippets = true,
|
show_autosnippets = true,
|
||||||
|
use_show_condition = false,
|
||||||
-- label_aliases = {
|
-- label_aliases = {
|
||||||
-- ['(?<!\\\\)(sec)'] = 'sec',
|
-- ['(?<!\\\\)(sec)'] = 'sec',
|
||||||
-- ['(?<!\\\\)(sec*)'] = 'sec*',
|
-- ['(?<!\\\\)(sec*)'] = 'sec*',
|
||||||
|
|
@ -862,21 +873,29 @@ require('lazy').setup({
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- You can easily change to a different colorscheme.
|
-- { -- You can easily change to a different colorscheme.
|
||||||
-- Change the name of the colorscheme plugin below, and then
|
-- -- Change the name of the colorscheme plugin below, and then
|
||||||
-- change the command in the config to whatever the name of that colorscheme is.
|
-- -- change the command in the config to whatever the name of that colorscheme is.
|
||||||
|
-- --
|
||||||
|
-- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
||||||
|
-- 'folke/tokyonight.nvim',
|
||||||
|
-- priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||||
|
-- init = function()
|
||||||
|
-- -- Load the colorscheme here.
|
||||||
|
-- -- Like many other themes, this one has different styles, and you could load
|
||||||
|
-- -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||||
|
-- vim.cmd.colorscheme 'tokyonight-night'
|
||||||
--
|
--
|
||||||
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
-- -- You can configure highlights by doing something like:
|
||||||
'folke/tokyonight.nvim',
|
-- vim.cmd.hi 'Comment gui=none'
|
||||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
-- end,
|
||||||
|
-- },
|
||||||
|
{
|
||||||
|
'ellisonleao/gruvbox.nvim',
|
||||||
|
priority = 1000,
|
||||||
init = function()
|
init = function()
|
||||||
-- Load the colorscheme here.
|
vim.o.background = 'dark'
|
||||||
-- Like many other themes, this one has different styles, and you could load
|
vim.cmd.colorscheme 'gruvbox'
|
||||||
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
|
||||||
vim.cmd.colorscheme 'tokyonight-night'
|
|
||||||
|
|
||||||
-- You can configure highlights by doing something like:
|
|
||||||
vim.cmd.hi 'Comment gui=none'
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,38 @@
|
||||||
{
|
{
|
||||||
"LuaSnip": { "branch": "master", "commit": "73813308abc2eaeff2bc0d3f2f79270c491be9d7" },
|
"LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" },
|
||||||
|
"ccc.nvim": { "branch": "main", "commit": "9d1a256e006decc574789dfc7d628ca11644d4c2" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
|
||||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "56a88e217fc8c5a7a9e79e163e5259fa129d3027" },
|
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||||
"conform.nvim": { "branch": "master", "commit": "fbcb4fa7f34bfea9be702ffff481a8e336ebf6ed" },
|
"conform.nvim": { "branch": "master", "commit": "cde4da5c1083d3527776fee69536107d98dae6c9" },
|
||||||
"fidget.nvim": { "branch": "main", "commit": "3f5475949679953af6d78654db29b944fa826e6a" },
|
"esp32.nvim": { "branch": "main", "commit": "7b929bd908ba7358b073d1923832cd8d2e682503" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "1ee5c1fd068c81f9dd06483e639c2aa4587dc197" },
|
"fidget.nvim": { "branch": "main", "commit": "e32b672d8fd343f9d6a76944fedb8c61d7d8111a" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" },
|
"gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" },
|
||||||
"lazydev.nvim": { "branch": "main", "commit": "e28ce52fc7ff79fcb76f0e79ee6fb6182fca90b9" },
|
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "e6a8824858757ca9cd4f5ae1a72d845fa5c46a39" },
|
||||||
|
"lazydev.nvim": { "branch": "main", "commit": "371cd7434cbf95606f1969c2c744da31b77fcfa6" },
|
||||||
"leetcode.nvim": { "branch": "master", "commit": "fdd3f91800b3983e27bc9fcfb99cfa7293d7f11a" },
|
"leetcode.nvim": { "branch": "master", "commit": "fdd3f91800b3983e27bc9fcfb99cfa7293d7f11a" },
|
||||||
"luasnip-latex-snippets.nvim": { "branch": "main", "commit": "071c942fed3444d469634e19021138e74d77143c" },
|
"luasnip-latex-snippets.nvim": { "branch": "main", "commit": "57e4330f967da6ac64bf9b05b06ecb3c4a120ec3" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "6bdb14f230de0904229ec367b410fb817e59b072" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "d7b5feb6e769e995f7fcf44d92f49f811c51d10c" },
|
||||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
|
|
||||||
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
|
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
|
||||||
"mini.nvim": { "branch": "main", "commit": "ef89bb115244297ed440441faa61759ddcf4a970" },
|
"mini.nvim": { "branch": "main", "commit": "7d6fcfd879fe520aba187fe2bd25078fa2367d03" },
|
||||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "0c29e3795b9105d68390d2fdfd430409ef8c5d65" },
|
"neo-tree.nvim": { "branch": "v3.x", "commit": "8cdd6b1940f333c1dd085526a9c45b30fb2dbf50" },
|
||||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||||
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
|
"nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
"nvim-cmp": { "branch": "main", "commit": "106c4bcc053a5da783bf4a9d907b6f22485c2ea0" },
|
||||||
"nvim-lint": { "branch": "master", "commit": "9da1fb942dd0668d5182f9c8dee801b9c190e2bb" },
|
"nvim-lint": { "branch": "master", "commit": "8c694e1a1ee2ac14df931679cd54e6b8d402c2c2" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "e688b486fe9291f151eae7e5c0b5a5c4ef980847" },
|
"nvim-lspconfig": { "branch": "master", "commit": "2010fc6ec03e2da552b4886fceb2f7bc0fc2e9c0" },
|
||||||
|
"nvim-surround": { "branch": "main", "commit": "fcfa7e02323d57bfacc3a141f8a74498e1522064" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||||
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
|
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" },
|
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||||
|
"snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" },
|
||||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||||
"telescope-undo.nvim": { "branch": "main", "commit": "928d0c2dc9606e01e2cc547196f48d2eaecf58e5" },
|
"telescope-undo.nvim": { "branch": "main", "commit": "928d0c2dc9606e01e2cc547196f48d2eaecf58e5" },
|
||||||
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||||
"todo-comments.nvim": { "branch": "main", "commit": "19d461ddd543e938eb22505fb03fa878800270b6" },
|
"todo-comments.nvim": { "branch": "main", "commit": "411503d3bedeff88484de572f2509c248e499b38" },
|
||||||
"tokyonight.nvim": { "branch": "main", "commit": "00d92e6009671493fceeb0e4baf644f5b983e6e4" },
|
|
||||||
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
||||||
"vimtex": { "branch": "master", "commit": "5c457a8a4dd57ca942260ff843a5482b064d9d9b" },
|
"vimtex": { "branch": "master", "commit": "be9deac3a23eeb145ccf11dd09080795838496ce" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" }
|
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,33 @@ return {
|
||||||
{
|
{
|
||||||
'windwp/nvim-ts-autotag',
|
'windwp/nvim-ts-autotag',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'uga-rosa/ccc.nvim',
|
||||||
|
config = function()
|
||||||
|
local ccc = require 'ccc'
|
||||||
|
|
||||||
|
ccc.setup {
|
||||||
|
highlighter = {
|
||||||
|
auto_enable = true,
|
||||||
|
lsp = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'kylechui/nvim-surround',
|
||||||
|
version = '^3.0.0', -- Use for stability; omit to use `main` branch for the latest features
|
||||||
|
event = 'VeryLazy',
|
||||||
|
config = function()
|
||||||
|
require('nvim-surround').setup {
|
||||||
|
-- Configuration here, or leave empty to use defaults
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'Aietes/esp32.nvim',
|
||||||
|
opts = {
|
||||||
|
build_dir = 'build',
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,19 @@ return {
|
||||||
vim.g.vimtex_compiler_latexmk = { ['out_dir'] = '/home/flima/Notes/build' }
|
vim.g.vimtex_compiler_latexmk = { ['out_dir'] = '/home/flima/Notes/build' }
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
-- {
|
||||||
|
-- 'franchioping/luasnip-latex-snippets.nvim',
|
||||||
|
-- dev = true,
|
||||||
|
-- },
|
||||||
{
|
{
|
||||||
'franchioping/luasnip-latex-snippets.nvim',
|
'iurimateus/luasnip-latex-snippets.nvim',
|
||||||
dev = true,
|
-- vimtex isn't required if using treesitter
|
||||||
|
requires = { 'L3MON4D3/LuaSnip', 'lervag/vimtex' },
|
||||||
|
config = function()
|
||||||
|
require('luasnip-latex-snippets').setup()
|
||||||
|
-- or setup({ use_treesitter = true })
|
||||||
|
require('luasnip').config.setup { enable_autosnippets = true }
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
-- {
|
-- {
|
||||||
-- 'iurimateus/luasnip-latex-snippets.nvim',
|
-- 'iurimateus/luasnip-latex-snippets.nvim',
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
--[
|
||||||
|
-- LuaSnip Conditions
|
||||||
|
--]
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
-- math / not math zones
|
||||||
|
|
||||||
|
function M.in_math()
|
||||||
|
return vim.api.nvim_eval 'vimtex#syntax#in_mathzone()' == 1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- comment detection
|
||||||
|
function M.in_comment()
|
||||||
|
return vim.fn['vimtex#syntax#in_comment']() == 1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- document class
|
||||||
|
function M.in_beamer()
|
||||||
|
return vim.b.vimtex['documentclass'] == 'beamer'
|
||||||
|
end
|
||||||
|
|
||||||
|
-- general env function
|
||||||
|
local function env(name)
|
||||||
|
local is_inside = vim.fn['vimtex#env#is_inside'](name)
|
||||||
|
return (is_inside[1] > 0 and is_inside[2] > 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.in_preamble()
|
||||||
|
return not env 'document'
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.in_text()
|
||||||
|
return env 'document' and not M.in_math()
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.in_tikz()
|
||||||
|
return env 'tikzpicture'
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.in_bullets()
|
||||||
|
return env 'itemize' or env 'enumerate'
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.in_align()
|
||||||
|
return env 'align' or env 'align*' or env 'aligned'
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -26,8 +26,8 @@ local parse = require('luasnip.util.parser').parse_snippet
|
||||||
local ms = ls.multi_snippet
|
local ms = ls.multi_snippet
|
||||||
local k = require('luasnip.nodes.key_indexer').new_key
|
local k = require('luasnip.nodes.key_indexer').new_key
|
||||||
|
|
||||||
local utils = require 'luasnip-latex-snippets.luasnippets.tex.utils'
|
local conditions = require 'luasnippets.tex.conditions'
|
||||||
local is_math = utils.conditions.is_math
|
local is_math = conditions.is_math
|
||||||
|
|
||||||
local as = require('luasnip').extend_decorator.apply(s, { snippetType = 'autosnippet' })
|
local as = require('luasnip').extend_decorator.apply(s, { snippetType = 'autosnippet' })
|
||||||
|
|
||||||
|
|
@ -36,6 +36,7 @@ local ret = {}
|
||||||
-- dynamic node
|
-- dynamic node
|
||||||
-- generally, postfix comes in the form PRE-CAPTURE-POST, so in this case, arg1 is the "pre" text, arg2 the "post" text
|
-- generally, postfix comes in the form PRE-CAPTURE-POST, so in this case, arg1 is the "pre" text, arg2 the "post" text
|
||||||
local dynamic_postfix = function(_, parent, _, user_arg1, user_arg2)
|
local dynamic_postfix = function(_, parent, _, user_arg1, user_arg2)
|
||||||
|
print(table.concat(parent.snippet, '\n'))
|
||||||
local capture = parent.snippet.env.POSTFIX_MATCH
|
local capture = parent.snippet.env.POSTFIX_MATCH
|
||||||
if #capture > 0 then
|
if #capture > 0 then
|
||||||
return sn(
|
return sn(
|
||||||
|
|
@ -64,17 +65,29 @@ local dynamic_postfix = function(_, parent, _, user_arg1, user_arg2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function postfix_std(trig, result_start, result_end)
|
-- local function postfix_std(trig, result_start, result_end)
|
||||||
return postfix(
|
-- return postfix(
|
||||||
{ trig = trig, snippetType = 'autosnippet' },
|
-- { trig = trig, snippetType = 'autosnippet' },
|
||||||
{ d(1, dynamic_postfix, {}, { user_args = { result_start, result_end } }) },
|
-- { d(1, dynamic_postfix, {}, { user_args = { result_start, result_end } }) },
|
||||||
{ condition = is_math, show_condition = is_math }
|
-- { condition = is_math, show_condition = is_math }
|
||||||
|
-- )
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- Helper: creates a regex-triggered snippet that wraps the next character(s)
|
||||||
|
-- after <prefix> in <before> ... <after>
|
||||||
|
local function postfix_std(prefix, before, after)
|
||||||
|
return s(
|
||||||
|
{ trig = prefix .. '(%a)', regTrig = true, wordTrig = false, snippetType = 'autosnippet' },
|
||||||
|
f(function(_, snip)
|
||||||
|
local captured = snip.captures[1]
|
||||||
|
return before .. captured .. after
|
||||||
|
end)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- table.insert(ret, postfix_std('vec', '\\vec{', '}'))
|
table.insert(ret, postfix_std('vec', '\\vec{', '}'))
|
||||||
-- table.insert(ret, postfix_std('hat', '\\hat{', '}'))
|
table.insert(ret, postfix_std('hat', '\\hat{', '}'))
|
||||||
-- table.insert(ret, postfix_std('dot', '\\dot{', '}'))
|
table.insert(ret, postfix_std('dot', '\\dot{', '}'))
|
||||||
-- table.insert(ret, postfix_std('bar', '\\bar{', '}'))
|
table.insert(ret, postfix_std('bar', '\\bar{', '}'))
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@ local parse = require('luasnip.util.parser').parse_snippet
|
||||||
local ms = ls.multi_snippet
|
local ms = ls.multi_snippet
|
||||||
local k = require('luasnip.nodes.key_indexer').new_key
|
local k = require('luasnip.nodes.key_indexer').new_key
|
||||||
|
|
||||||
local utils = require 'luasnip-latex-snippets.luasnippets.tex.utils'
|
local conditions = require 'luasnippets.tex.conditions'
|
||||||
|
|
||||||
local is_math = utils.conditions.is_math
|
local is_math = conditions.is_math
|
||||||
local as = require('luasnip').extend_decorator.apply(s, { snippetType = 'autosnippet' })
|
local as = require('luasnip').extend_decorator.apply(s, { snippetType = 'autosnippet' })
|
||||||
|
|
||||||
local ret = {}
|
local ret = {}
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,9 @@ local parse = require('luasnip.util.parser').parse_snippet
|
||||||
local ms = ls.multi_snippet
|
local ms = ls.multi_snippet
|
||||||
local k = require('luasnip.nodes.key_indexer').new_key
|
local k = require('luasnip.nodes.key_indexer').new_key
|
||||||
|
|
||||||
local utils = require 'luasnip-latex-snippets.luasnippets.tex.utils'
|
local conditions = require 'luasnippets.tex.conditions'
|
||||||
|
|
||||||
local is_math = utils.conditions.is_math
|
|
||||||
|
|
||||||
|
local is_math = conditions.is_math
|
||||||
local as = require('luasnip').extend_decorator.apply(s, { snippetType = 'autosnippet' })
|
local as = require('luasnip').extend_decorator.apply(s, { snippetType = 'autosnippet' })
|
||||||
|
|
||||||
local ret = {
|
local ret = {
|
||||||
|
|
@ -50,4 +49,4 @@ local ret = {
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
return {}
|
return ret
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue