Can a macro be executed while in insert mode?
Let file equal:
---------------start file-----------------
wordword word word 1
wordword word word 2
wordword word word 3
wordword word word 4
wordword word word 5
wordword word word 6
wordword word word 7
---------------end file-------------------
Let edit goal equal:
---------------start file-----------------
IF "$foo1"<>"" wordword word word 1
IF "$foo2"<>"" wordword word word 2
IF "$foo3"<>"" wordword word word 3
IF "$foo4"<>"" wordword word word 4
IF "$foo5"<>"" wordword word word 5
IF "$foo6"<>"" wordword word word 6
IF "$foo7"<>"" wordword word word 7
---------------end file-------------------
Let MACRO (@r) have resulting action that
can be represented by this kind of:
^{IF "$foo[Number adjacent to EOL]"<>"" } or
"insert the desired additional text on each line with the number that
is on the
end of each line being appended to the second word on each line"
Let X equal location of cursor at end of the sequence
shown beneath the "file"
(step 1)
---------------start file-----------------
>Xordword word word 1
wordword word word 2
wordword word word 3
wordword word word 4
wordword word word 5
wordword word word 6
wordword word word 7
---------------end file-------------------
^v "Control+v" Mode is
command.
____________________________
-VISUAL BLOCK-
(step 2)
---------------start file-----------------
wordword word word 1
wordword word word 2
wordword word word 3
wordword word word 4
wordword word word 5
wordword word word 6
>Xordword word word 7
---------------end file-------------------
G "shift+g""Mode remains
command
----------------------------------------------
-VISUAL BLOCK-
(step 3)
---------------start file-----------------
>Xordword word word 1
wordword word word 2
wordword word word 3
wordword word word 4
wordword word word 5
wordword word word 6
wordword word word 7
---------------end file-------------------
I "Shift+i" Mode becomes
insert
----------------------------------------------
-INSERT-
Now what? How do I indicate that I want to execute
the macro stored in @r without having to press <ESC>?
^vGI{@r}
I apologise for asking a question instead of doing the necessary
research.
But, asking has the benefit of creating more material for the body of
research material in general.
I am sure others have begun using a macro instead of using a
"substitute regex"
because it is easier and or quicker but then find that the free-form
"off the hip" method is a dead end. Other solutions come to mind.
But, is it really a dead end? is there an alternate way to execute a
macro?
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php