I'll try to explain by example..
If we have a piece of code like this in vim:
if ($feck == true && $drink == false)
{
echo 'They lie in wait like wolves..';
}
And I go to visual mode and select "$drink
" for example, is there a way to:
- detect whether the current selection is one of vim's text-objects (word, WORD, inner {, etc.)
- do a lookup on both sides of the selection to check for the next available vim text-object (again, word, WORD, a block, inner ", etc..)
Please note that I'm thinking of vim scripting not just plain editing, so both of these "actions" would be in a function, sourced in my .vimrc
Also, I would need to do this without breaking the visual selection or moving the cursor (or, if it really can't be avoided, restore both the selection and cursor position).