Hi Clark,
Here is what I wrote for the macro
#include "slick.sh"
_command vimcomma() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL)
{
if (find(',',"+-")) stop();
vi_cursor_right();
vi_toggle_char_visual();
if (find(',',"+")) stop();
vi_visual_select_left();
vi_visual_change();
}
I bound this to Alt-C key. It mostly works as intended.
void foo(int a, int b, int c, int d)
If I place my cursor say anywhere on 'int c' and press Alt-C, it will delete the text 'int c' and put my cursor in insert mode and I can type the new word.
Where I see an issue is that from the current cursor position, if there is no comma to the left or to the right, it keep searching backwards till it finds a comma and then keeps searching forward till it finds a comma and then deletes that many lines of code.
How I modify the above macro such that the find is restricted to the current line and if it does not find a comma to the left for the cursor or to the right of the cursor, the macro does not do anything.