How to break a line in vim in normal mode?

后端 未结 8 758
梦谈多话
梦谈多话 2021-01-31 08:08

I would like to break a line (at the location of the cursor) in to two lines without leaving normal mode (entering insert or command-line mode). Is this possible?

I curr

8条回答
  •  忘掉有多难
    2021-01-31 08:17

    You can use recording.

    1. Place your cursor where you would like to insert a line break.
    2. Type qa to start recording into register a (you can use another register other than a if you want.)
    3. Then type i (switch to insert mode), Return (insert newline), escape (exit insert mode), q (ends recording.)

    Now you can invoke this sequence of keys by typing @a (where a is the register number you used when you started the recording), just keep moving the cursor where you want to insert a newline and type @a.

提交回复
热议问题