我刚刚部署了一些 14.04 系统,我注意到无论何时我vim
做某事,vim 已经处于替换模式。
由于我习惯于在启动时处于命令模式,所以这相当令人困惑。
知道为什么吗?我没有发现任何明显的罪魁祸首/etc/vim/vimrc
,但系统上每个用户都会发生这种情况。
安装相关软件包:
$ aptitude search vim | grep ^i
i vim - Vi IMproved - enhanced vi editor
i vim-common - Vi IMproved - Common files
i vim-nox - Vi IMproved - enhanced vi editor - with sc
i vim-runtime - Vi IMproved - Runtime files
i vim-tiny - Vi IMproved - enhanced vi editor - compact
vim -V
输出:
# vim -V
chdir(/usr/share/vim)
fchdir() to previous dir
sourcing "$VIM/vimrc"
Searching for "debian.vim" in "/root/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/root/.vim/after"
Searching for "/root/.vim/debian.vim"
Searching for "/usr/share/vim/vimfiles/debian.vim"
Searching for "/usr/share/vim/vim74/debian.vim"
chdir(/usr/share/vim/vim74)
fchdir() to previous dir
line 10: sourcing "/usr/share/vim/vim74/debian.vim"
finished sourcing /usr/share/vim/vim74/debian.vim
continuing in /usr/share/vim/vimrc
Searching for "/usr/share/vim/vimfiles/after/debian.vim"
Searching for "/root/.vim/after/debian.vim"
chdir(/usr/share/vim/vim74/syntax)
fchdir() to previous dir
line 20: sourcing "/usr/share/vim/vim74/syntax/syntax.vim"
Searching for "syntax/synload.vim" in "/root/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/root/.vim/after"
Searching for "/root/.vim/syntax/synload.vim"
Searching for "/var/lib/vim/addons/syntax/synload.vim"
Searching for "/usr/share/vim/vimfiles/syntax/synload.vim"
Searching for "/usr/share/vim/vim74/syntax/synload.vim"
chdir(/usr/share/vim/vim74/syntax)
fchdir() to previous dir
line 19: sourcing "/usr/share/vim/vim74/syntax/synload.vim"
Searching for "syntax/syncolor.vim" in "/root/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/root/.vim/after"
Searching for "/root/.vim/syntax/syncolor.vim"
Searching for "/var/lib/vim/addons/syntax/syncolor.vim"
Searching for "/usr/share/vim/vimfiles/syntax/syncolor.vim"
Searching for "/usr/share/vim/vim74/syntax/syncolor.vim"
chdir(/usr/share/vim/vim74/syntax)
fchdir() to previous dir
line 21: sourcing "/usr/share/vim/vim74/syntax/syncolor.vim"
finished sourcing /usr/share/vim/vim74/syntax/syncolor.vim
continuing in /usr/share/vim/vim74/syntax/synload.vim
Searching for "/usr/share/vim/vimfiles/after/syntax/syncolor.vim"
Searching for "/var/lib/vim/addons/after/syntax/syncolor.vim"
Searching for "/root/.vim/after/syntax/syncolor.vim"
finished sourcing /usr/share/vim/vim74/syntax/synload.vim
continuing in /usr/share/vim/vim74/syntax/syntax.vim
Searching for "filetype.vim" in "/root/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/root/.vim/after"
Searching for "/root/.vim/filetype.vim"
Searching for "/var/lib/vim/addons/filetype.vim"
Searching for "/usr/share/vim/vimfiles/filetype.vim"
Searching for "/usr/share/vim/vim74/filetype.vim"
chdir(/usr/share/vim/vim74)
fchdir() to previous dir
line 25: sourcing "/usr/share/vim/vim74/filetype.vim"
Searching for "ftdetect/*.vim" in "/root/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/root/.vim/after"
Searching for "/root/.vim/ftdetect/*.vim"
Searching for "/var/lib/vim/addons/ftdetect/*.vim"
Searching for "/usr/share/vim/vimfiles/ftdetect/*.vim"
Searching for "/usr/share/vim/vim74/ftdetect/*.vim"
Searching for "/usr/share/vim/vimfiles/after/ftdetect/*.vim"
Searching for "/var/lib/vim/addons/after/ftdetect/*.vim"
Searching for "/root/.vim/after/ftdetect/*.vim"
not found in 'runtimepath': "ftdetect/*.vim"
finished sourcing /usr/share/vim/vim74/filetype.vim
continuing in /usr/share/vim/vim74/syntax/syntax.vim
Searching for "/usr/share/vim/vimfiles/after/filetype.vim"
Searching for "/var/lib/vim/addons/after/filetype.vim"
Searching for "/root/.vim/after/filetype.vim"
finished sourcing /usr/share/vim/vim74/syntax/syntax.vim
continuing in /usr/share/vim/vimrc
Searching for "syntax/syncolor.vim" in "/root/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/root/.vim/after"
Searching for "/root/.vim/syntax/syncolor.vim"
Searching for "/var/lib/vim/addons/syntax/syncolor.vim"
Searching for "/usr/share/vim/vimfiles/syntax/syncolor.vim"
Searching for "/usr/share/vim/vim74/syntax/syncolor.vim"
chdir(/usr/share/vim/vim74/syntax)
fchdir() to previous dir
line 25: sourcing "/usr/share/vim/vim74/syntax/syncolor.vim"
finished sourcing /usr/share/vim/vim74/syntax/syncolor.vim
continuing in /usr/share/vim/vimrc
Searching for "/usr/share/vim/vimfiles/after/syntax/syncolor.vim"
Searching for "/var/lib/vim/addons/after/syntax/syncolor.vim"
Searching for "/root/.vim/after/syntax/syncolor.vim"
Searching for "filetype.vim" in "/root/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/root/.vim/after"
Searching for "/root/.vim/filetype.vim"
Searching for "/var/lib/vim/addons/filetype.vim"
Searching for "/usr/share/vim/vimfiles/filetype.vim"
Searching for "/usr/share/vim/vim74/filetype.vim"
chdir(/usr/share/vim/vim74)
fchdir() to previous dir
line 36: sourcing "/usr/share/vim/vim74/filetype.vim"
finished sourcing /usr/share/vim/vim74/filetype.vim
continuing in /usr/share/vim/vimrc
Searching for "/usr/share/vim/vimfiles/after/filetype.vim"
Searching for "/var/lib/vim/addons/after/filetype.vim"
Searching for "/root/.vim/after/filetype.vim"
Searching for "ftplugin.vim" in "/root/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/root/.vim/after"
Searching for "/root/.vim/ftplugin.vim"
Searching for "/var/lib/vim/addons/ftplugin.vim"
Searching for "/usr/share/vim/vimfiles/ftplugin.vim"
Searching for "/usr/share/vim/vim74/ftplugin.vim"
chdir(/usr/share/vim/vim74)
fchdir() to previous dir
line 36: sourcing "/usr/share/vim/vim74/ftplugin.vim"
finished sourcing /usr/share/vim/vim74/ftplugin.vim
continuing in /usr/share/vim/vimrc
Searching for "/usr/share/vim/vimfiles/after/ftplugin.vim"
Searching for "/var/lib/vim/addons/after/ftplugin.vim"
Searching for "/root/.vim/after/ftplugin.vim"
Searching for "indent.vim" in "/root/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/root/.vim/after"
Searching for "/root/.vim/indent.vim"
Searching for "/var/lib/vim/addons/indent.vim"
Searching for "/usr/share/vim/vimfiles/indent.vim"
Searching for "/usr/share/vim/vim74/indent.vim"
chdir(/usr/share/vim/vim74)
fchdir() to previous dir
line 36: sourcing "/usr/share/vim/vim74/indent.vim"
finished sourcing /usr/share/vim/vim74/indent.vim
continuing in /usr/share/vim/vimrc
Searching for "/usr/share/vim/vimfiles/after/indent.vim"
Searching for "/var/lib/vim/addons/after/indent.vim"
Searching for "/root/.vim/after/indent.vim"
finished sourcing $VIM/vimrc
chdir(/root)
fchdir() to previous dir
could not source "$HOME/.vimrc"
chdir(/root/.vim)
fchdir() to previous dir
could not source "~/.vim/vimrc"
chdir(/root)
fchdir() to previous dir
could not source "$HOME/.exrc"
Searching for "plugin/**/*.vim" in "/root/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/root/.vim/after"
Searching for "/root/.vim/plugin/**/*.vim"
Searching for "/var/lib/vim/addons/plugin/**/*.vim"
Searching for "/usr/share/vim/vimfiles/plugin/**/*.vim"
Searching for "/usr/share/vim/vim74/plugin/**/*.vim"
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/getscriptPlugin.vim"
finished sourcing /usr/share/vim/vim74/plugin/getscriptPlugin.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/gzip.vim"
finished sourcing /usr/share/vim/vim74/plugin/gzip.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/matchparen.vim"
finished sourcing /usr/share/vim/vim74/plugin/matchparen.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/netrwPlugin.vim"
finished sourcing /usr/share/vim/vim74/plugin/netrwPlugin.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/rrhelper.vim"
finished sourcing /usr/share/vim/vim74/plugin/rrhelper.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/spellfile.vim"
finished sourcing /usr/share/vim/vim74/plugin/spellfile.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/tarPlugin.vim"
finished sourcing /usr/share/vim/vim74/plugin/tarPlugin.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/tohtml.vim"
finished sourcing /usr/share/vim/vim74/plugin/tohtml.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/vimballPlugin.vim"
finished sourcing /usr/share/vim/vim74/plugin/vimballPlugin.vim
chdir(/usr/share/vim/vim74/plugin)
fchdir() to previous dir
sourcing "/usr/share/vim/vim74/plugin/zipPlugin.vim"
finished sourcing /usr/share/vim/vim74/plugin/zipPlugin.vim
Searching for "/usr/share/vim/vimfiles/after/plugin/**/*.vim"
Searching for "/var/lib/vim/addons/after/plugin/**/*.vim"
Searching for "/root/.vim/after/plugin/**/*.vim"
Reading viminfo file "/root/.viminfo" info oldfiles
Press ENTER or type command to continue
答案1
您的语言环境设置正确吗?
几分钟前我就遇到了这个问题,最终我将其追溯到错误配置的区域设置。
修复配置文件并运行locale-gen
,然后source /etc/profile
(或者更好的是,重新启动)vim 就可以正常运行。不再以替换模式启动。
我使用的是 Arch Linux,所以我不会发布具体的步骤,但也许你遇到了同样的问题。
答案2
尝试使用此命令
$ sudo apt-get remove vim
$ sudo apt-get install vim-gnome
即使你使用的是不同版本的 ubunutu,这个版本的 vim 也是最适合 ubuntu 的