在正常模式下如何在vim中换行? [英] How to break a line in vim in normal mode?
问题描述
我想在不离开普通模式(进入插入或命令行模式)的情况下将一行(在光标所在的位置)分成两行.这可能吗?
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"进入插入模式,按"enter"将行换成两行,然后按"esc"返回正常模式.
I currently get to the location I want and hit 'i' to enter insert mode, 'enter' to break the line in two, then 'esc' to return to normal mode.
我没有试图设置最大行长,也没有做任何语法或类似的事情.我只想在不离开普通模式的情况下将一行分成两行. "J"将光标所在的行连接到其下方的行,这很方便.我想相反-用一个命令将一行分成两行.
I am not trying to set a maximum line length or do any syntax or anything like that. I just want to break one line into two lines without leaving normal mode. 'J' joins the line the cursor is on to the line below it, which is handy. I want the opposite -- to break one line into two with a single command.
推荐答案
尝试一下:
:nnoremap <NL> i<CR><ESC>
然后只要您想分割线就按Ctrl-J.
then just press Ctrl-J whenever you want to split a line.
这篇关于在正常模式下如何在vim中换行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!