Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I like vim, but I don't like its buffers. Is there any way to launch a separate gvim whenever you would normally open a file in a new buffer? I could probably alias :edit to some other launch command, but is that the right approach?

share|improve this question
Could you explain what you don't like about Vim's buffers? – romainl Jan 21 '13 at 13:14
I use a tiling window manager, so when I have different buffers open it's like a nested tiling layout. I have to remember two different sets of shortcuts to move around, and it's hard to arrange things. – Jeff Jan 21 '13 at 22:20
You are loosing a lot for a very small benefit IMO. Also the nested tiling layout is because you are confusing "buffer" and "window". You can perfectly have many dozens of buffers open at the sam time without having them displayed in windows. – romainl Jan 21 '13 at 22:26
Yeah I tend to lose track of buffers open in the background, then I try to open the same file again somewhere else and vim complains about swap files. So I tend to just use :ball a lot. I suppose that's another version of the same problem though, because it wouldn't happen with everything in one monolithic vim window. – Jeff Jan 21 '13 at 22:44
That swapfile problem will only get bigger if you use multiple Vim instances to work on the same project. Try this: :nnoremap gb :buffers<CR>:b<space> – romainl Jan 21 '13 at 22:57
up vote 0 down vote accepted

GVim does not support multiple "toplevel" windows (see Using Vim/Gvim with multiple GUI windows). But you could hack around it by creating a user command that launches a new gVim process. Something like this:

:command -nargs=* -complete=file New :call system('gvim ' . shellescape(<f-args>))

This command may fail in interesting ways with "creative" filenames. I tried to make it robust without making it complex, but I have not extensively tested it.

There are a number of drawbacks to insisting on using Vim this way. You may not like Vim's buffer handling, but it can be quite useful if you can learn to use it.

share|improve this answer
Thanks, that works! – Jeff Jan 21 '13 at 20:19

For me, window splits and the ability to quickly switch, yank and paste between them are essential to effectively working with Vim. Of course, you can develop your own idiosyncratic workflow, but I'd recommend against it. Instead, make every effort to follow what a vast army of Vi(m) users have found very useful. Despite the sometimes steep learning curve, it's important to know the difference between files, buffers, windows, and tab pages.

As a sort of middle ground, you can try experimenting with opening new files in tab pages (i.e. use :tabedit instead of :edit) as an alternative to launching a full separate Vim instance. The feeling is like in web browsers, and you keep the benefit of shared registers and marks.

share|improve this answer

The "buffer way" has many benefits: all the buffers you work with share registers, for example, or one global mapping or option defined in one window is available for all the others, or you get copy/paste and multiple registers without a window manager, or you can reference parts of other buffers in Ex commands…

Anyway, you could probably do something like :!gvim filename. But, in absence of a reasonable list of benefits of this method and drawbacks of the "buffer way") there's really no point in doing that.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .