In a fortran code, I have lines like
c write(6,*) "something"
write(6,*) "something_else"
I would like to insert the first character of the previous line when I open a new line with o in normal mode or enter in insert mode.
In the example given, if I open a new line under the 1st
line, the line should open with a c
and when I open new line under the 2nd
, the new line should start with a whitespace. How would I do that in vim?
P.S. Kindly add appropriate tags if you find any. I could only find vimscript
and vimrc
which might even be not so appropriate.
nnoremap o o<c-y>
c
is the character for commenting.nnoremap o o<c-u><c-y>