diff --git a/conf.d/lvim/config.lua b/conf.d/lvim/config.lua index 5af3d78..a8e34f6 100644 --- a/conf.d/lvim/config.lua +++ b/conf.d/lvim/config.lua @@ -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 diff --git a/conf.d/lvim/ftplugin/tex.lua b/conf.d/lvim/ftplugin/tex.lua index 78158b9..cbbaeba 100644 --- a/conf.d/lvim/ftplugin/tex.lua +++ b/conf.d/lvim/ftplugin/tex.lua @@ -2,7 +2,7 @@ File : conf.d/lvim/ftplugin/tex.lua Author : Jeff Lance 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 --]] -- @@ -18,48 +18,42 @@ end -- Shortcuts -- +-- vim.g.maplocalleader = " " + whk.register { - ["l"] = { + ["L"] = { + name = "LSP, Lunar, LaTeX", -- we edit the title of the L shortcut + } +} + +whk.register { + ["Lx"] = { name = "LaTeX", - m = { "VimtexContextMenu", "Open Context Menu" }, - u = { "VimtexCountLetters", "Count Letters" }, - w = { "VimtexCountWords", "Count Words" }, - d = { "VimtexDocPackage", "Open Doc for package" }, - e = { "VimtexErrors", "Look at the errors" }, - s = { "VimtexStatus", "Look at the status" }, - a = { "VimtexToggleMain", "Toggle Main" }, - v = { "VimtexView", "View pdf" }, - i = { "VimtexInfo", "Vimtex Info" }, - l = { + c = { "VimtexCompileSS", "Single-shot compile project" }, + C = { "VimtexCompileSelected", "Compile Selected" }, + D = { "VimtexDocPackage", "Open Doc for package" }, + e = { "edit /home/jeff/.config/lvim/luasnippets/tex.lua", "Edit snippets" }, + E = { "VimtexErrors", "Look at the errors" }, + I = { "VimtexInfo", "Vimtex Info" }, + K = { name = "Clean", - l = { "VimtexClean", "Clean Project" }, + p = { "VimtexClean", "Clean Project" }, c = { "VimtexClean", "Clean Cache" }, }, - c = { - name = "Compile", - c = { "VimtexCompile", "Continuous compile project" }, - o = { - "VimtexCompileOutput", - "Compile Project and Show Output", - }, - s = { "VimtexCompileSS", "Single-shot compile project" }, - e = { "VimtexCompileSelected", "Compile Selected" }, - }, - r = { + m = { "VimtexToggleMain", "Toggle Main" }, + R = { name = "Reload", r = { "VimtexReload", "Reload" }, s = { "VimtexReloadState", "Reload State" }, }, - o = { - name = "Stop", - p = { "VimtexStop", "Stop" }, - a = { "VimtexStopAll", "Stop All" }, - }, - t = { + s = { "VimtexStop", "Stop compile" }, + S = { "VimtexStatus", "Look at the status" }, + T = { name = "TOC", o = { "VimtexTocOpen", "Open TOC" }, t = { "VimtexTocToggle", "Toggle TOC" }, }, + v = { "VimtexView", "View pdf" }, } } diff --git a/conf.d/lvim/luasnippets/tex.lua b/conf.d/lvim/luasnippets/tex.lua index 156beff..2f51ffd 100644 --- a/conf.d/lvim/luasnippets/tex.lua +++ b/conf.d/lvim/luasnippets/tex.lua @@ -8,8 +8,64 @@ Last Modified By : Jeff Lance -- +-- +-- 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" },