Vim 只是没有应用一些配置语句。在我为它安装插件并更新 MacOS(这不应该相互关联!?)后,这种行为就开始了。
一个例子是 textwidth。我在 vimrc 中将其设置为 60,显然它在其他地方没有被覆盖。
:verbose set textwidth?
返回
textwidth=60
Last set from ~/.vimrc line 10
所以是设置。但是,无论行有多长,它都不会中断行。还有更多示例,例如某些语言的自动缩进,但您已经看到了问题。但它不会忽略所有内容。例如,行号、laststatus 可以正常工作。
以下是我所看到的:
1 sfsldjflsjd klfsjd lfsdj fklsdj flksd jflksdj fklsdj fklsd df
2 sdfjskdl jffjsldkj lskdj fklsdjf slkdj slkdj glkdj gkldfj glkdfj
3
4 ! It should wrap the line about here ^
5 ! Instead a line goes on forerver like below, unless I manually break it
6
7 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequ at massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputa te eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, fe ugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curab itur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, s it amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tinci dunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis le o. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc,sd jfsjflsd
我卸载了所有插件,重新安装了 vim。还是一样。有人知道如何修复这个问题吗?
Vim 版本:9.0
$ vim --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Dec 19 2022 00:34:58)
macOS version - x86_64
Included patches: 1-1023
Compiled by [email protected]
Normal version without GUI. Features included (+) or not (-):
+acl +file_in_path +mouse_urxvt -tag_any_white
-arabic +find_in_path +mouse_xterm -tcl
+autocmd +float +multi_byte +termguicolors
+autochdir +folding +multi_lang +terminal
-autoservername -footer -mzscheme +terminfo
-balloon_eval +fork() +netbeans_intg +termresponse
-balloon_eval_term -gettext +num64 +textobjects
-browse -hangul_input +packages +textprop
++builtin_terms +iconv +path_extra +timers
+byte_offset +insert_expand -perl +title
+channel +ipv6 +persistent_undo -toolbar
+cindent +job +popupwin +user_commands
-clientserver +jumplist +postscript -vartabs
+clipboard -keymap +printer +vertsplit
+cmdline_compl +lambda -profile +vim9script
+cmdline_hist -langmap +python/dyn +viminfo
+cmdline_info +libcall -python3 +virtualedit
+comments +linebreak +quickfix +visual
+conceal +lispindent +reltime +visualextra
+cryptv +listcmds -rightleft +vreplace
+cscope +localmap +ruby/dyn +wildignore
+cursorbind -lua +scrollbind +wildmenu
+cursorshape +menu +signs +windows
+dialog_con +mksession +smartindent +writebackup
+diff +modify_fname -sodium -X11
+digraphs +mouse -sound -xfontset
-dnd -mouseshape +spell -xim
-ebcdic +mouse_dec +startuptime -xpm
-emacs_tags -mouse_gpm +statusline -xsmp
+eval -mouse_jsbterm -sun_workshop -xterm_clipboard
+ex_extra +mouse_netterm +syntax -xterm_save
+extra_search +mouse_sgr +tag_binary
-farsi -mouse_sysmouse -tag_old_static
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -o vim -lm -lncurses -liconv -framework Cocoa
MacOS 版本:BigSur 11.7.4
$ uname -a
Darwin my-host 20.6.0 Darwin Kernel Version 20.6.0: Fri Dec 16 00:35:00 PST 2022; root:xnu-7195.141.49~1/RELEASE_X86_64 x86_64
答案1
因此:Vim 忽略了 textwidth 设置,因为set paste
已设置。设置set paste
禁用了对行宽的检查。但是,我不明白为什么。set paste
从我的配置中删除它解决了这个问题。
该行为与正在使用的操作系统无关。