How to remove empty default buffer from vim?

When I work with several buffers, always one is empty. I would like this not to happen if I open a file with vim from the command line (i.e. I don’t want to create a new file or do you want to create a new file by calling it first and starting vim with that name). How can i do this?

Edit

I run gvim as follows:

I have an alias in my bashrc: alias g="gvim --remote-silent"

I open files from the command line: g name-of-file

At this point (if I did not already have a gvim open instance), I have two buffers:

enter image description here

Edit2

The platform is Linux Mint, version: VIM - Vi IMproved 7.3 (2010 August 15, compiled March 24, 2011 07:07:39).

I updated my NERDTree plugin as David suggested, but that didn't help. Other plugins that I use: Pathogen, a, doxygentoolkit, nerdtree, snipmate, vim-rails, ack_plugin, easymotion, protobuf, sparkup, yankring, bufexplorer, matchit, rainbow, surround, clang_complete, nerdcommenter, repeat

+6
source share
2 answers

I do not have your problem on

  • linux, gvim - Vi IMproved 7.3 (2010 Aug 15, 2003-03-24 07:07:34) Patches included: 1-35
  • windows gvim - Vi IMproved 7.2 (August 9, compiled on August 9, 2008 6:46:22 p.m.) MS-Windows 32-bit version of the graphical interface with OLE support.

You are probably looking at a mistake.

You may be able to debug things by clearing your MYVIMRC (temporarily) and running gvim --noplugin .

Alternatively check all settings (e.g. bufhidden and other suspicious parties)

  :set :setglobal 

and see which script / plugin they are installed from ( bufhidden as an example only here ):

  :verbose set bufhidden :verbose setglobal bufhidden 

You can also check auto-commands (which can prevent buffer erasure)

  :verbose au 
+2
source

To avoid this, I changed my alias:

 g() { [ -z "$(command gvim --serverlist)" ] && command gvim " $@ " || command gvim --remote-silent " $@ " ; } 

If the server list is empty: start plain gvim, otherwise start using the remote silent option.

+2
source

Source: https://habr.com/ru/post/897108/


All Articles