Bug#529087: vim: please implement a --drop-empty option

Francesco Poli (t1000) frx at firenze.linux.it
Sun May 17 17:09:49 UTC 2009

Package: vim
Version: 2:7.2.148-2
Severity: wishlist

Hi and thanks for maintaining this very important package in Debian!

I use VIM for many tasks.

Among other things, I often use View as a pager, that is to say:
I pipe the output of a command to it.

  $ some_command | view -

It works great in all cases, but one.
When the output is empty, View starts with an empty buffer and the
splash screen.
This is not really useful, since it just shows me that the output
was empty and I have to issue the :q command to exit.

A typical example is with diff:

  $ diff my_file your_file | view -

It would be useful if VIM had an option that made it automatically
close new empty buffers.
This option could be named "--drop-empty" or something like that.
It would work as follows: when vim (or view, or ...) is started with
this option, any newly created buffer is checked and automatically
closed if found to be empty.

This way, my use of View as a pager would automatically exit (with
0 exit status, of course, because nothing went wrong) when the output
of some_command is empty:

  $ some_command | view --drop-empty -

Another nice use of this option could be opening many files, but
only editing already existing ones:

  $ ls
  foo.txt bar.txt baz.txt
  $ vim --drop-empty foo.txt bar.txt unreal.txt baz.txt never_born.txt

In this case, VIM would allow me to edit foo.txt, bar.txt, and baz.txt,
but not waste my time in allowing me to create the non-existent
unreal.txt and never_born.txt.
This could be useful when you want to edit already existing files,
without creating new ones, and you do *not* know in advance which
files exist (among the ones of a given list).

Could this new feature be implemented?
Please forward this feature request to upstream, if appropriate.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (800, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages vim depends on:
ii  libacl1                   2.2.47-2       Access control list shared library
ii  libc6                     2.9-4          GNU C Library: Shared libraries
ii  libgpm2                   1.20.4-3.2     General Purpose Mouse - shared lib
ii  libncurses5               5.7+20090404-1 shared libraries for terminal hand
ii  libselinux1               2.0.71-1       SELinux shared libraries
ii  vim-common                2:7.2.148-2    Vi IMproved - Common files
ii  vim-runtime               2:7.2.148-2    Vi IMproved - Runtime files

vim recommends no packages.

Versions of packages vim suggests:
pn  ctags                         <none>     (no description available)
pn  vim-doc                       <none>     (no description available)
ii  vim-scripts                   20081206-1 plugins for vim, adding bells and 

-- no debconf information

More information about the pkg-vim-maintainers mailing list