How can I remove the default empty buffer from vim?
Whenever I work with multiple buffers, there is always one empty. I would like to not have that if I open a file with vim from the command line (i.e. I don't want to create a new file, or choose to create a new file by naming it first and starting vim with that name). How can I do this?
Edit:
I'm launching gvim the following way:
I have an alias in my bashrc: alias g="gvim --remote-silent"
I open files from the command line with: g name-of-file
At this point (if I didn't already have an instance of gvim open), I have two buffers:
Edit2:
Platform is Linux Mint, version is: VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Mar 24 2011 07:07:39).
I updated my NERDTree plugin as David suggested, but it didn't help. Other plugins I use: Pathogen, a, doxygentoolkit, nerdtree, snipmate, vim-rails, ack_plugin, easymotion, protobuf, sparkup, yankring, bufexplorer, matchit, rainbow, surround, clang_co开发者_开发技巧mplete, nerdcommenter, repeat
I don't have your problem on
- linux, gvim - Vi IMproved 7.3 (2010 Aug 15, compiled Mar 24 2011 07:07:34) Included patches: 1-35
- windows gvim - Vi IMproved 7.2 (2008 Aug 9, compiled Aug 9 2008 18:46:22) MS-Windows 32-bit GUI version with OLE support
You are probably looking at a bug.
You might be able to debug things by cleaning your $MYVIMRC (temporarily) and running gvim --noplugin
.
Alternatively inspect all settings (like bufhidden
and other suspect parties)
:set
:setglobal
and see from which script/plugin they are being set (bufhidden
as an example only here):
:verbose set bufhidden
:verbose setglobal bufhidden
You might also inspect autocommands (that might prevent buffers from being wiped)
:verbose au
To avoid this I changed my alias:
g() { [ -z "$(command gvim --serverlist)" ] && command gvim "$@" || command gvim --remote-silent "$@" ; }
If the list of server is empty: launch plain gvim, otherwise launch with remote-silent option.
精彩评论