move the text after the cursor to a new line
I am Vim newbie, and I'm using MacVim on OSX Snow Leopard. One of the most common actions I have to take is to move the cursor to a new line but also move the text after the cursor to the new line. I know that pressing 'o' in normal or visual mode moves the cursor to a new line and switches the mode to insert.
What I'd like to do is move the cursor to a new line, and move the text after the cursor to that new line as well, preferably staying in the normal mode? Is this possible? How can I accomplish this task?
:map <F2> i<CR>
这在插入模式下保持vi。
If the cursor is on a <space>
as in ( []
marks the cursor):
lorem ipsum[ ]dolor sit amet
the simplest is to do r<CR>
, that is "replace the current character with a linebreak".
Otherwise, use @knittl's solution.
So you want to move everything in the current line, which comes after the cursor to the next line? Read: insert a line break??
(move cursor)
i (or a)
<return>
<esc> (or ^C)
To map this sequence of keystrokes to a single key, follow @thb's suggestion and use the :map
command:
:map <F2> i<CR><ESC>
链接地址: http://www.djcxy.com/p/49502.html
上一篇: 多个:g和:v命令在一个语句中
下一篇: 将光标后的文本移动到新行