Vim 插入模式不允许编辑文件中现有的行,只能编辑新添加的行

发布于 2025-01-06 06:40:10 字数 2573 浏览 2 评论 0原文

过去,当我进入现有文件的插入模式时,我可以点击“删除”,这样就可以了。现在我仍然可以删除和修改新添加到文件中的内容,但是如果打开文件后其中存在现有内容,我将无法删除它。我只能删除和修改新的东西。然而,在插入模式之外,我仍然可以使用常规的 dd 类型命令删除内容。我的 .vimrc 非常简单,我唯一的插件是 SuperTab。

这是我的 .vimrc 如果有帮助的话:

set tags=./tags,~/kent/src/tags,~/kent/src/lib/tags,~/kent/src/inc/tags,~/kent/src/hg/lib/tags,~/kent/src/hg/inc/tags,~/kent/src/jkOwnLib/tags  
syntax on
filetype indent plugin on
set modeline
au FileType python setlocal tabstop=8 expandtab shiftwidth=4 softtabstop=4
set background=dark
set wildmode=longest,list,full
set wildmenu

这是 vim --version 的输出:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Feb  8 2012 10:41:54)
Included patches: 1-434
Compiled by John St. John
Normal version without GUI.  Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent 
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs 
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path 
+find_in_path +float +folding -footer +fork() +gettext -hangul_input +iconv 
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent 
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape 
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse 
+mouse_xterm -mouse_urxvt +multi_byte +multi_lang -mzscheme +netbeans_intg 
+path_extra -perl +persistent_undo +postscript +printer -profile +python 
-python3 +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent 
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary 
+tag_old_static -tag_any_white +tcl +terminfo +termresponse +textobjects +title
 -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo 
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
 -xterm_clipboard -xterm_save 
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/cluster/home/jstjohn/share/vim"
Compilation: gcc44 -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1     -I/usr/include  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_LARGEFILE64_SOURCE=1  
Linking: gcc44   -L/usr/local/lib -Wl,--as-needed -o vim       -lm -lncurses -lnsl  -lselinux      -L/hive/groups/recon/local/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic  -L/usr/lib -ltcl8.4 -ldl -lpthread -lieee -lm    

It used to be that when I went into insert mode on an existing file, I could hit "delete" and that would work. Now I can still delete and modify things that I newly add to a file, but if there is existing stuff there once I open a file, I do not have the ability to delete that. I can only delete and modify new stuff. Out of insert mode however I still have the ability to delete things with the regular dd type commands. My .vimrc is pretty simple, and my only addon is SuperTab.

Here is my .vimrc if that helps:

set tags=./tags,~/kent/src/tags,~/kent/src/lib/tags,~/kent/src/inc/tags,~/kent/src/hg/lib/tags,~/kent/src/hg/inc/tags,~/kent/src/jkOwnLib/tags  
syntax on
filetype indent plugin on
set modeline
au FileType python setlocal tabstop=8 expandtab shiftwidth=4 softtabstop=4
set background=dark
set wildmode=longest,list,full
set wildmenu

And here is the output from vim --version:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Feb  8 2012 10:41:54)
Included patches: 1-434
Compiled by John St. John
Normal version without GUI.  Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent 
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs 
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path 
+find_in_path +float +folding -footer +fork() +gettext -hangul_input +iconv 
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent 
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape 
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse 
+mouse_xterm -mouse_urxvt +multi_byte +multi_lang -mzscheme +netbeans_intg 
+path_extra -perl +persistent_undo +postscript +printer -profile +python 
-python3 +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent 
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary 
+tag_old_static -tag_any_white +tcl +terminfo +termresponse +textobjects +title
 -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo 
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
 -xterm_clipboard -xterm_save 
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/cluster/home/jstjohn/share/vim"
Compilation: gcc44 -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1     -I/usr/include  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_LARGEFILE64_SOURCE=1  
Linking: gcc44   -L/usr/local/lib -Wl,--as-needed -o vim       -lm -lncurses -lnsl  -lselinux      -L/hive/groups/recon/local/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic  -L/usr/lib -ltcl8.4 -ldl -lpthread -lieee -lm    

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱你不解释 2025-01-13 06:40:10

您很可能需要设置 backspace+=start。一般来说,您可能需要set backspace=indent,eol,start,但只需“start”就可以专门解决这个问题。

有关其他选项的更多信息,请参阅 :help 'backspace'

You most likely need to set backspace+=start. Generally you probably want set backspace=indent,eol,start, but just "start" should solve this problem specifically.

See :help 'backspace' for more information on the other options.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文