The documentation for :put
says that the command accepts a line. That is, it puts the content after the line specified. Is it possible to put the content at a particular mark?
For example, say I am in the middle of refactoring an anonymous JavaScript function into a named JavaScript function. I have the following in-process code (mid-refactoring), and I want to move the anonymous function to before the semi-colon on line 2.
function createClickListener(element) {
return ;
}
var listener = createClickListener(element);
element.addEventListener('click', function() {
alert("You clicked the element!");
}, false);
In normal mode, I can place my cursor at the beginning of f
in the anonymous function, type "fc/}/e
(followed by the <enter>
key) to cut the anonymous function into the named register f
and enter insert mode, and then type listener
.
However, in order to put the code on line 2, I have to move the cursor to the semi-colon then type "fp
. If I were to do this with the :put
command (e.g., :2put f
) the anonymous function would be placed after line 2.
Is it possible to use the :put
command to put content mid-line or at a mark? Or is there an alternative (or better) way of doing this (I guess I could jump using marks more...)?