mini.ai: creating a mapping for 'anybracket' which excludes the spaces like i(
would
#1519
-
Contributing guidelines
Module(s)mini.ai QuestionI'm experimenting with creating aliases for brackets in a way that a lowercase letter is normal and uppercase variant one that excludes the spaces, for example:
But I'm not sure how to do this for:
Would be grateful for any tips :) Also if there is a less wordy way to define these bracket alias keymaps:
( |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I'd suggest doing that through If I correctly understood what you're trying to achieve, the following setup should be all you need: require('mini.ai').setup({
custom_textobjects = {
['c'] = { '%b()', '^.().*().$' },
['C'] = { '%b()', '^.%s*().-()%s*.$' },
['B'] = { { '%b()', '%b[]', '%b{}' }, '^.%s*().-()%s*.$' },
},
}) |
Beta Was this translation helpful? Give feedback.
I'd suggest doing that through
config.custom_textobjects
and not via custom mappings. This way it is defined once per texotjbect id, no need for separate 'a'/'i'/'al'/'il'/'an'/'in' mappings. Custom textobjects should follow specification, but looking at how built-in textobjects are implemented should get 95% there for this case.If I correctly understood what you're trying to achieve, the following setup should be all you need: