[mini.clue] vim-submode translation #466
-
With https://github.com/kana/vim-submode , I can enter into a mode from different submode trigger that has more than one possible vim.fn["submode#enter_with"]("changetab", "n", "", "gt", "gt")
vim.fn["submode#enter_with"]("changetab", "n", "", "gT", "gT")
vim.fn["submode#enter_with"]("changetab", "n", "", "<A-Right>", "gt")
vim.fn["submode#enter_with"]("changetab", "n", "", "<A-Left>", "gT")
vim.fn["submode#map"]("changetab", "n", "", "t", "gt")
vim.fn["submode#map"]("changetab", "n", "", "T", "gT")
vim.fn["submode#map"]("changetab", "n", "", "<Right>", "gt")
vim.fn["submode#map"]("changetab", "n", "", "<Left>", "gT")
vim.fn["submode#map"]("changetab", "n", "", "<A-Right>", "gt")
vim.fn["submode#map"]("changetab", "n", "", "<A-Left>", "gT") Is that possible to achieve with mini.clue or planned as a feature if not so? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Submodes in 'mini.clue' work better if there is a common prefix that initiates it. For example, something like Also 'mini.clue' doesn't create any mappings for user (by design), so you'd need to create them manually. However, something like you describe seems possible. Try something like this: require('mini.clue').setup({
clues = {
{ mode = 'n', keys = 'gt', desc = 'Next tab', postkeys = 'g' },
{ mode = 'n', keys = 'g<Right>', desc = 'Next tab', postkeys = 'g' },
{ mode = 'n', keys = 'g<A-right>', desc = 'Next tab', postkeys = 'g' },
{ mode = 'n', keys = 'gT', desc = 'Prev tab', postkeys = 'g' },
{ mode = 'n', keys = 'g<Left>', desc = 'Prev tab', postkeys = 'g' },
{ mode = 'n', keys = 'g<A-left>', desc = 'Prev tab', postkeys = 'g' },
},
triggers = {
{ mode = 'n', keys = 'g' },
},
})
local remap = function(lhs, rhs, desc)
vim.keymap.set('n', lhs, rhs, { remap = true, desc = desc })
end
remap('<A-right>', 'gt', 'Next tab')
remap('g<A-right>', 'gt', 'Next tab')
remap('g<Right>', 'gt', 'Next tab')
remap('<A-left>', 'gT', 'Prev tab')
remap('g<A-left>', 'gT', 'Prev tab')
remap('g<Left>', 'gT', 'Prev tab') Does this answer your question? |
Beta Was this translation helpful? Give feedback.
-
Perfectly. Thank you! |
Beta Was this translation helpful? Give feedback.
Submodes in 'mini.clue' work better if there is a common prefix that initiates it. For example, something like
<Leader>t
for tabpages. This is mostly to have clues shown only for that particular submode.Also 'mini.clue' doesn't create any mappings for user (by design), so you'd need to create them manually.
However, something like you describe seems possible. Try something like this: