[英]vim: .vimrc doesn't load properly with python files
Everytime I load a .py file, my plugins takes long to load and my vimrc
seem to not load properly and shows weird behaviour. 每次我加载一个.py文件时,我的插件都需要很长时间才能加载,而我的vimrc
似乎无法正确加载,并显示出奇怪的行为。 For example if I check my tabstop length with :set tabstop
it says tabstop=2 as it should but when I insert one it have a length of 4. 例如,如果我用:set tabstop
检查我的tabstop长度,它会说应该是tabstop = 2,但是当我插入一个时它的长度是4。
If I reload the vimrc with :source $MYVIM
it works fine, but i have to reload it everytime I open a .py file with a fresh vim instance 如果我用:source $MYVIM
重新加载vimrc,它可以正常工作,但是每次我用新的vim实例打开.py文件时,都必须重新加载它。
This behaviour startet after recompiling vim with python support enter code here. 在使用python支持重新编译vim之后,此行为startet在此处输入代码。
Here my vim --version :
这是我的vim --version :
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 3 2014 04:36:01)
included patches: 1-86
Compiled by Arch Linux
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +syntax
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
-balloon_eval +float +mouse_urxvt -tag_any_white
-browse +folding +mouse_xterm -tcl
++builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent +gettext -mzscheme +textobjects
-clientserver -hangul_input -netbeans_intg +title
-clipboard +iconv +path_extra -toolbar
+cmdline_compl +insert_expand +perl +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info +keymap +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak +python/dyn +viminfo
+cscope +lispindent +python3/dyn +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con -lua +rightleft +windows
+diff +menu -ruby +writebackup
+digraphs +mksession +scrollbind -X11
-dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent -xim
+emacs_tags -mouseshape -sniff -xsmp
+eval +mouse_dec +startuptime -xterm_clipboard
+ex_extra +mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop -xpm
system vimrc file: "/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -D_FORTIFY_SOURCE=2 -march=x86-64
-mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -U_FORTIFY_SOURCE
-D_FORTIFY_SOURCE=1
Linking: gcc -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro -L/usr/local/lib -Wl,--as-needed -o vim -lm -lncurses -lelf -lacl -lattr -lgpm -ldl -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -L/usr/local/lib -L/usr/lib/perl5/core_perl/CORE -lperl -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
If loading a Python file within an existing vim session overrides settings from your .vimrc, that's almost certainly because you have an autocommand triggered to run on FileType detection. 如果在现有的vim会话中加载Python文件会覆盖.vimrc中的设置,那几乎可以肯定是因为您触发了一个自动命令来运行FileType检测。 For instance, I have this in my .vimrc: 例如,我的.vimrc中有这个:
au FileType python set shiftwidth=2
which resets the soft tab value to 2 spaces when I open a Python file. 当我打开Python文件时,它将软标签值重置为2个空格。
You might have something similar either in your .vimrc, or even in a file in your vim/ftplugin directory. 您可能在.vimrc中甚至在vim / ftplugin目录中的文件中都有类似的内容。
I see that you have compiled Vim with Python and with Python3. 我看到您已经使用Python和Python3编译了Vim。 I have seen warnings about this elsewhere. 我在其他地方看到过有关此的警告。 Perhaps you should reinstall Vim with either Python or Python 3 but not both. 也许您应该使用Python或Python 3重新安装Vim,但不要同时安装两者。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.