我是一个相当新的 Vim 用户,我遇到了一些非常烦人的事情,而且我在网上找不到很多东西。当我在 Vim 中进入插入模式并开始输入时,我正在编辑的单词将换行,而不是保留在其原始位置。我可以检查哪些地方来解决这个问题?我将通过我的 .vimrc,但我没有在其中看到任何可能导致问题的内容。
1 " Turn on line numbers on the side
2 :set number
3
4 " Adjust <Tab> button to be 4 chars long
5 set softtabstop=4
6 set shiftwidth=4
7 set textwidth=4
8 set expandtab
9
10 " Turning on syntax highlighting as adding a filetypes
11 syntax on
12 filetype on
13
14 " Remappings
15 inoremap jk <ESC>
16
17 set scrolloff=5
18
19
最佳答案
你的文本宽度真的很低。
set textwidth=4
这应该设置为更高的值。将它设置为 4 后,在 vim 尝试自动换行之前,该行的大小最多为 4 个字符。
来自 :help 'textwidth'
'textwidth' 'tw' 'textwidth' 'tw' number (default 0) local to buffer {not in Vi} Maximum width of text that is being inserted. A longer line will be broken after white space to get this width. A zero value disables this. 'textwidth' is set to 0 when the 'paste' option is set. When 'textwidth' is zero, 'wrapmargin' may be used. See also 'formatoptions' and ins-textwidth. When 'formatexpr' is set it will be used to break the line. NOTE: This option is set to 0 when 'compatible' is set.
From the context of the other settings being set did you mean 'tabstop'
. (The size of a tab?)
set tabstop=4
关于Vim 在插入模式下随机添加新行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32030124/