I am trying to achieve the same as here, but in Vim.
Duplicate the line and comment on it
Basically, I want to align the line, comment on the old one, insert a new one and hold the cursor at the beginning of a new line and end in insert mode.
For instance:
def func (param)
will change to:
def func (param)
I wrote a macro for it, put it in .vimrc, and I use it through@y
" copy-and-comment-line macro
" yank line, comment out original line, move cursor at the begining
" of copied line and end in insert mode
let @y='yypkui//kdklkl'
(I'm not sure if this will work for you, as it contains non-printable characters ~@that will not be displayed in the code block)
The macro works, but is there a built-in command in vim with which I can achieve the same?
source
share