2013-04-02 73 views
1

於是我打開VIM:VIM中沒有緩衝區3?

$ vim 

然後我打開3個文件:

:e file1.txt 
:e file2.txt 
:e file3.txt 

正如預期的那樣,有3個緩衝區,但它們的編號如下:

  • 1 :FILE1.TXT
  • 2:FILE2.TXT
  • 4:file4.txt

任何想法?


$ vim --version 
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Mar 25 2013 19:55:22) 
Included patches: 1-875 
Compiled by ArchLinux 
Huge version with GTK2 GUI. Features included (+) or not (-): 
+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   +viminfo 
+cscope   +lispindent  -python3   +vreplace 
+cursorbind  +listcmds  +quickfix  +wildignore 
+cursorshape  +localmap  +reltime   +wildmenu 
+dialog_con_gui +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_interact 
+eval   +mouse_dec  +startuptime  +xterm_clipboard 
+ex_extra  +mouse_gpm  +statusline  -xterm_save 
+extra_search -mouse_jsbterm -sun_workshop  
+farsi   +mouse_netterm +syntax   
    system vimrc file: "/etc/vimrc" 
    user vimrc file: "$HOME/.vimrc" 
     user exrc file: "$HOME/.exrc" 
    system gvimrc file: "/etc/gvimrc" 
    user gvimrc file: "$HOME/.gvimrc" 
    system menu file: "$VIMRUNTIME/menu.vim" 
    fall-back for $VIM: "/usr/share/vim" 
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/libpng15 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng15 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/local/include -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1  
Linking: gcc -L. -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -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 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfreetype -lfontconfig -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE -lm -lncurses -lnsl -lacl -lattr -lgpm -ldl -L/usr/lib -llua -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 -L/usr/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -lruby -lpthread -lrt -ldl -lcrypt -lm -L/usr/lib 

和:

$ cat ~/.vimrc 
syntax on 
set number 
set mouse=a 
call pathogen#infect() 
filetype plugin indent on 

在VIM:

:ls! 
    1  "file1.txt"     line 1 
    2 # "file2.txt"     line 1 
    3u a- "-MiniBufExplorer-"   line 0 
    4 %a "file3.txt"     line 1 
Press ENTER or type command to continue 

原因:這個 「問題」 是由MiniBufExplorer引起:e file2.txt之後被打開。

當vim啓動時,MiniBufExplorer沒有打開,也不是當我:e file1.txt。但顯然,當打開2個或更多文件時,會自動打開,佔用下一個緩衝區(因此緩衝區3被佔用)。


解決方案:使用不會佔用緩衝區設置不同的插件。

+0

不是粗魯,但它有關係嗎? –

+0

@PeterRincker,有點(讓我再輸入一個緩衝區而不必爲':b'添加一個2-3位數字) – MiJyn

+0

如果任何使用都可以使用':b'命令來使用部分緩衝區名稱。將它與製表符完成和通配符組合在一起,你可以使用緩衝區號來獲得很大的優勢。 –

回答

0

所以你打開緩衝區,關閉了3號,問爲什麼得到3個緩衝區,沒有緩衝區號3?

緩衝器在他們的創作編號,這些數字從未變化:如果你創建緩衝區1,2,3和4,並刪除緩衝區3你3個緩衝區:1,2和4

現在看來成爲閱讀:h buffers的最佳時機。

+0

不,我沒有打開4個緩衝區,只有3個緩衝區,而且是的,我知道當你關閉一個緩衝區時,它不允許你再次使用該緩衝區ID直到重新啓動。 – MiJyn