--[[ -- Contains fixes for mappings created by plugins -- Useful because of bépo --]] -- Comments.nvim adds `gbc` command, which conflicts with `gb/gé` to move -- between tabs if vim.fn.maparg("gbc") ~= "" then vim.keymap.del("n", "gbc") vim.keymap.set('n', 'gBc', function() return vim.api.nvim_get_vvar('count') == 0 and '(comment_toggle_blockwise_current)' or '(comment_toggle_blockwise_count)' end, { expr = true, desc = 'Comment toggle current block' }) end -- [[ vimtex ]] -- Some BÉPO mappings for vimtex local texgroup = vim.api.nvim_create_augroup("latex-after", { clear = true }) vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { pattern = { "*.tex", "*.bib", "*.cls", "*.tikz", }, group = texgroup, callback = function() local vimtex_remaps = { -- c <-> t { mode = "n", source = "csd", target = "lsd", command = "(vimtex-delim-change-math)" }, { mode = "n", source = "csc", target = "lsc", command = "(vimtex-cmd-change)" }, { mode = "n", source = "cse", target = "lse", command = "(vimtex-env-change)" }, { mode = "n", source = "cs$", target = "ls$", command = "(vimtex-env-change-math))" }, -- t <-> j { mode = { "x", "n" }, source = "tsD", target = "jsD", command = "(vimtex-delim-toggle-modifier-reverse)" }, { mode = { "x", "n" }, source = "tsd", target = "jsd", command = "(vimtex-delim-toggle-modifier)" }, { mode = { "x", "n" }, source = "tsf", target = "jsf", command = "(vimtex-cmd-toggle-frac)" }, { mode = "n", source = "tsc", target = "jsc", command = "(vimtex-cmd-toggle-star)" }, { mode = "n", source = "ts$", target = "js$", command = "(vimtex-env-toggle-math)" }, { mode = "n", source = "tse", target = "jse", command = "(vimtex-env-toggle-star)" }, } for _, remap in pairs(vimtex_remaps) do if vim.fn.maparg(remap.source) ~= "" then vim.keymap.del(remap.mode, remap.source, { buffer = true }) vim.keymap.set(remap.mode, remap.target, remap.command, { silent = true, noremap = true, buffer = true }) end end end, })