This commit is contained in:
Jeff Lance 2023-08-15 18:37:39 +02:00
parent 1fafdb6196
commit 75b59fd36e
3 changed files with 108 additions and 31 deletions

View File

@ -96,6 +96,8 @@ lvim.builtin.which_key.mappings["l"] = {}
lvim.builtin.which_key.mappings["L"] = {
name = "LSP, Lunar"
}
lvim.builtin.which_key.mappings["Lve"] = lvim.builtin.which_key.mappings["Lvc"]
lvim.builtin.which_key.mappings["Lvc"] = {}
lvim.builtin.which_key.mappings["n"] = {
name = "Notes",
@ -151,6 +153,7 @@ lvim.builtin.treesitter.ensure_installed = {
lvim.builtin.treesitter.ignore_install = { "comment" }
lvim.builtin.treesitter.highlight.enable = true
lvim.builtin.treesitter.highlight.disable( "latex" )
lvim.builtin.treesitter.rainbow.enable = true

View File

@ -2,7 +2,7 @@
File : conf.d/lvim/ftplugin/tex.lua
Author : Jeff Lance <email@jefflance.me>
Date : 06.08.2023 11:07:22
Last Modified Date: 08.08.2023 19:23:36
Last Modified Date: 15.08.2023 00:46:47
Last Modified By : Jeff Lance <email@jefflance.me>
--]]
--
@ -18,48 +18,42 @@ end
-- Shortcuts
--
-- vim.g.maplocalleader = " "
whk.register {
["<leader>l"] = {
["<leader>L"] = {
name = "LSP, Lunar, LaTeX", -- we edit the title of the L shortcut
}
}
whk.register {
["<leader>Lx"] = {
name = "LaTeX",
m = { "<cmd>VimtexContextMenu<CR>", "Open Context Menu" },
u = { "<cmd>VimtexCountLetters<CR>", "Count Letters" },
w = { "<cmd>VimtexCountWords<CR>", "Count Words" },
d = { "<cmd>VimtexDocPackage<CR>", "Open Doc for package" },
e = { "<cmd>VimtexErrors<CR>", "Look at the errors" },
s = { "<cmd>VimtexStatus<CR>", "Look at the status" },
a = { "<cmd>VimtexToggleMain<CR>", "Toggle Main" },
v = { "<cmd>VimtexView<CR>", "View pdf" },
i = { "<cmd>VimtexInfo<CR>", "Vimtex Info" },
l = {
c = { "<cmd>VimtexCompileSS<CR>", "Single-shot compile project" },
C = { "<cmd>VimtexCompileSelected<CR>", "Compile Selected" },
D = { "<cmd>VimtexDocPackage<CR>", "Open Doc for package" },
e = { "<CMD>edit /home/jeff/.config/lvim/luasnippets/tex.lua<CR>", "Edit snippets" },
E = { "<cmd>VimtexErrors<CR>", "Look at the errors" },
I = { "<cmd>VimtexInfo<CR>", "Vimtex Info" },
K = {
name = "Clean",
l = { "<cmd>VimtexClean<CR>", "Clean Project" },
p = { "<cmd>VimtexClean<CR>", "Clean Project" },
c = { "<cmd>VimtexClean<CR>", "Clean Cache" },
},
c = {
name = "Compile",
c = { "<cmd>VimtexCompile<CR>", "Continuous compile project" },
o = {
"<cmd>VimtexCompileOutput<CR>",
"Compile Project and Show Output",
},
s = { "<cmd>VimtexCompileSS<CR>", "Single-shot compile project" },
e = { "<cmd>VimtexCompileSelected<CR>", "Compile Selected" },
},
r = {
m = { "<cmd>VimtexToggleMain<CR>", "Toggle Main" },
R = {
name = "Reload",
r = { "<cmd>VimtexReload<CR>", "Reload" },
s = { "<cmd>VimtexReloadState<CR>", "Reload State" },
},
o = {
name = "Stop",
p = { "<cmd>VimtexStop<CR>", "Stop" },
a = { "<cmd>VimtexStopAll<CR>", "Stop All" },
},
t = {
s = { "<cmd>VimtexStop<CR>", "Stop compile" },
S = { "<cmd>VimtexStatus<CR>", "Look at the status" },
T = {
name = "TOC",
o = { "<cmd>VimtexTocOpen<CR>", "Open TOC" },
t = { "<cmd>VimtexTocToggle<CR>", "Toggle TOC" },
},
v = { "<cmd>VimtexView<CR>", "View pdf" },
}
}

View File

@ -8,8 +8,64 @@ Last Modified By : Jeff Lance <email@jefflance.me>
--
--
-- Helpers functions
--
local line_begin = require("luasnip.extras.expand_conditions").line_begin
local in_mathzone = function()
-- The `in_mathzone` function requires the VimTeX plugin
return vim.fn['vimtex#syntax#in_mathzone']() == 1
end
local in_text = function()
return not in_mathzone()
end
--
-- Snippets
--
return {
--
-- text commands
--
s({ trig = "#", dscr = "Partie"},
fmta(
[[
\partie{<>}
]],
{
i(1),
}
),
{ condition = line_begin }
),
s({ trig = "##", dscr = "Sous-partie"},
fmta(
[[
\sspartie{<>}
]],
{
i(1),
}
),
{ condition = line_begin }
),
s({ trig = "###", dscr = "Sous-sous-partie"},
fmta(
[[
\ssspartie{<>}
]],
{
i(1),
}
),
{ condition = line_begin }
),
--
-- maths commands
--
s({ trig = "lim", dscr = "Limit" },
@ -21,7 +77,8 @@ return {
i(1),
i(2),
}
)
),
{condition = in_text}
),
s({ trig = "xto", dscr = "Limit" },
fmta(
@ -45,6 +102,29 @@ return {
)
),
--
-- sets
--
s({ trig = '([^%w])R', regTrig = true, wordTrig = false, dscr = "Set R" },
fmta(
[[
\mathbb{R}
]],
{
}
),
{ condition = in_mathzone }
),
-- s({ trig = '([^%w])R', regTrig = true, wordTrig = false, dscr = "Set R" },
-- fmta(
-- [[
-- $ \mathbb{R} $
-- ]],
-- {
-- }
-- ),
-- { condition = in_text }
-- ),
--
-- environments
--
s({ trig = "env", dscr = "A LaTeX empty environment" },