summaryrefslogtreecommitdiff
path: root/after/ftplugin/tex.lua
blob: 5a51d9181d5d42a2c4a65f075b9cfa5a9f823d89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
vim.cmd([[setlocal shiftwidth=2 tabstop=2]])

vim.fn.call("vimtex#imaps#add_map", {
    {
        lhs = "++",
        rhs = "\\item ",
        leader = "",
        wrapper = "vimtex#imaps#wrap_environment",
        context = { "itemize", "enumerate", "description" },
    },
})

vim.fn.call("vimtex#imaps#add_map", {
    {
        lhs = "e",
        rhs = "\\eps",
        wrapper = "vimtex#imaps#wrap_math",
    },
})

vim.b.surround_101 = "\\begin{\1environment: \1}\r\\end{\1\1}" -- surround with e (environment)
vim.b.surround_99 = "\\\1command: \1{\r}" -- surround with c (command)

vim.keymap.set("v", "<C-i>", function()
    local key = vim.api.nvim_replace_termcodes("Scemph<CR>", true, false, true)
    vim.api.nvim_feedkeys(key, "v", false)
end, { desc = "Latex: Emphasize text" })

vim.keymap.set("v", "<C-b>", function()
    local key =
        vim.api.nvim_replace_termcodes("Sctextbf<CR>", true, false, true)
    vim.api.nvim_feedkeys(key, "v", false)
end, { desc = "Latex: Make text bold" })