Skip to content

Commit

Permalink
fix(vimtex): update which-key.nvim to new syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Aug 12, 2024
1 parent 5dac4da commit 1e93b21
Showing 1 changed file with 75 additions and 89 deletions.
164 changes: 75 additions & 89 deletions lua/astrocommunity/markdown-and-latex/vimtex/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,98 +13,84 @@ return {
callback = function(event)
local wk_avail, wk = pcall(require, "which-key")
if not wk_avail then return end
local opts = {
mode = "n", -- NORMAL mode
buffer = event.buf, -- Specify a buffer number for buffer local mappings to show only in tex buffers
}
local mappings = {
["<localleader>l"] = {
name = "+VimTeX",
a = "Show Context Menu",
C = "Full Clean",
c = "Clean",
e = "Show Errors",
G = "Show Status for All",
g = "Show Status",
i = "Show Info",
I = "Show Full Info",
k = "Stop VimTeX",
K = "Stop All VimTeX",
L = "Compile Selection",
l = "Compile",
m = "Show Imaps",
o = "Show Compiler Output",
q = "Show VimTeX Log",
s = "Toggle Main",
t = "Open Table of Contents",
T = "Toggle Table of Contents",
v = "View Compiled Document",
X = "Reload VimTeX State",
x = "Reload VimTeX",
},
["ts"] = {
name = "VimTeX Toggles & Cycles", -- optional group name
["$"] = "Cycle inline, display & numbered equation",
c = "Toggle star of command",
d = "Cycle (), \\left(\\right) [,...]",
D = "Reverse Cycle (), \\left(\\right) [, ...]",
e = "Toggle star of environment",
f = "Toggle a/b vs \\frac{a}{b}",
},
["[/"] = "Previous start of a LaTeX comment",
["[*"] = "Previous end of a LaTeX comment",
["[["] = "Previous beginning of a section",
["[]"] = "Previous end of a section",
["[m"] = "Previous \\begin",
["[M"] = "Previous \\end",
["[n"] = "Previous start of a math zone",
["[N"] = "Previous end of a math zone",
["[r"] = "Previous \\begin{frame}",
["[R"] = "Previous \\end{frame}",
["]/"] = "Next start of a LaTeX comment %",
["]*"] = "Next end of a LaTeX comment %",
["]["] = "Next beginning of a section",
["]]"] = "Next end of a section",
["]m"] = "Next \\begin",
["]M"] = "Next \\end",
["]n"] = "Next start of a math zone",
["]N"] = "Next end of a math zone",
["]r"] = "Next \\begin{frame}",
["]R"] = "Next \\end{frame}",
["cs"] = {
c = "Change surrounding command",
e = "Change surrounding environment",
["$"] = "Change surrounding math zone",
d = "Change surrounding delimiter",
wk.add {
buffer = event.buf,
{
mode = "n",
{ "<localleader>l", group = "VimTeX" },
{ "<localleader>la", desc = "Show Context Menu" },
{ "<localleader>lC", desc = "Full Clean" },
{ "<localleader>lc", desc = "Clean" },
{ "<localleader>le", desc = "Show Errors" },
{ "<localleader>lG", desc = "Show Status for All" },
{ "<localleader>lg", desc = "Show Status" },
{ "<localleader>li", desc = "Show Info" },
{ "<localleader>lI", desc = "Show Full Info" },
{ "<localleader>lk", desc = "Stop VimTeX" },
{ "<localleader>lK", desc = "Stop All VimTeX" },
{ "<localleader>lL", desc = "Compile Selection" },
{ "<localleader>ll", desc = "Compile" },
{ "<localleader>lm", desc = "Show Imaps" },
{ "<localleader>lo", desc = "Show Compiler Output" },
{ "<localleader>lq", desc = "Show VimTeX Log" },
{ "<localleader>ls", desc = "Toggle Main" },
{ "<localleader>lt", desc = "Open Table of Contents" },
{ "<localleader>lT", desc = "Toggle Table of Contents" },
{ "<localleader>lv", desc = "View Compiled Document" },
{ "<localleader>lX", desc = "Reload VimTeX State" },
{ "<localleader>lx", desc = "Reload VimTeX" },
{ "ts", group = "VimTeX Toggles & Cycles" },
{ "ts$", desc = "Cycle inline, display & numbered equation" },
{ "tsc", desc = "Toggle star of command" },
{ "tsd", desc = "Cycle (), \\left(\\right) [,...]" },
{ "tsD", desc = "Reverse Cycle (), \\left(\\right) [, ...]" },
{ "tse", desc = "Toggle star of environment" },
{ "tsf", desc = "Toggle a/b vs \\frac{a}{b}" },
{ "[/", desc = "Previous start of a LaTeX comment" },
{ "[*", desc = "Previous end of a LaTeX comment" },
{ "[[", desc = "Previous beginning of a section" },
{ "[]", desc = "Previous end of a section" },
{ "[m", desc = "Previous \\begin" },
{ "[M", desc = "Previous \\end" },
{ "[n", desc = "Previous start of a math zone" },
{ "[N", desc = "Previous end of a math zone" },
{ "[r", desc = "Previous \\begin{frame}" },
{ "[R", desc = "Previous \\end{frame}" },
{ "]/", desc = "Next start of a LaTeX comment %" },
{ "]*", desc = "Next end of a LaTeX comment %" },
{ "][", desc = "Next beginning of a section" },
{ "]]", desc = "Next end of a section" },
{ "]m", desc = "Next \\begin" },
{ "]M", desc = "Next \\end" },
{ "]n", desc = "Next start of a math zone" },
{ "]N", desc = "Next end of a math zone" },
{ "]r", desc = "Next \\begin{frame}" },
{ "]R", desc = "Next \\end{frame}" },
{ "csc", desc = "Change surrounding command" },
{ "cse", desc = "Change surrounding environment" },
{ "cs$", desc = "Change surrounding math zone" },
{ "csd", desc = "Change surrounding delimiter" },
{ "dsc", desc = "Delete surrounding command" },
{ "dse", desc = "Delete surrounding environment" },
{ "ds$", desc = "Delete surrounding math zone" },
{ "dsd", desc = "Delete surrounding delimiter" },
},
["ds"] = {
c = "Delete surrounding command",
e = "Delete surrounding environment",
["$"] = "Delete surrounding math zone",
d = "Delete surrounding delimiter",
{
mode = "o",
{ "ic", desc = "LaTeX Command" },
{ "ac", desc = "LaTeX Command" },
{ "id", desc = "LaTeX Math Delimiter" },
{ "ad", desc = "LaTeX Math Delimiter" },
{ "ie", desc = "LaTeX Environment" },
{ "ae", desc = "LaTeX Environment" },
{ "i$", desc = "LaTeX Math Zone" },
{ "a$", desc = "LaTeX Math Zone" },
{ "iP", desc = "LaTeX Section, Paragraph, ..." },
{ "aP", desc = "LaTeX Section, Paragraph, ..." },
{ "im", desc = "LaTeX Item" },
{ "am", desc = "LaTeX Item" },
},
}
wk.register(mappings, opts)
-- VimTeX Text Objects without variants with targets.vim
opts = {
mode = "o", -- Operator pending mode
buffer = event.buf,
}
local objects = {
["ic"] = [[LaTeX Command]],
["ac"] = [[LaTeX Command]],
["id"] = [[LaTeX Math Delimiter]],
["ad"] = [[LaTeX Math Delimiter]],
["ie"] = [[LaTeX Environment]],
["ae"] = [[LaTeX Environment]],
["i$"] = [[LaTeX Math Zone]],
["a$"] = [[LaTeX Math Zone]],
["iP"] = [[LaTeX Section, Paragraph, ...]],
["aP"] = [[LaTeX Section, Paragraph, ...]],
["im"] = [[LaTeX Item]],
["am"] = [[LaTeX Item]],
}
wk.register(objects, opts)
end,
},
},
Expand Down

0 comments on commit 1e93b21

Please sign in to comment.