You can define your own text objects in Vim.
The easiest way to create custom text objects is to define :vmap (or :xmap ) for the visual mode part and :omap for the operator standby part. For example, the following displays
xnoremap aC F:o, onoremap aC :normal! F:v,<CR>
allows you to select a bit of text enclosed in a colon. Try vaP or daP above the word "colon" below:
Some text :in-colon-text: more of the same.
See :h omap-info for another short example :omap .
If you don't mind depending on the plugin , however, textobj-user . This is a universal framework for custom text objects written by Kana Natsuno. There are already great text objects for this structure, such as textobj-indent , which I find indispensable.
Using this, you can easily implement objects that depend on the file type for variables. And make it accessible to everyone!
source share