Hacker News new | ask | show | jobs
by thristian 5408 days ago
I've always been a little puzzled by people who use a file-drawer or file-list or similar addon with Vim, and I now I think I know why: I'm guessing most of these people have Vim open as their One Tool, much like another programmer might have Xcode or Visual Studio open as their One Tool, and they want to get everything done in it.

At work, I usually have at least two windows open at all times: Vim full-screen on one monitor, a terminal full-screen on the other—or sometimes one terminal taking up most of the screen and another smaller terminal tailing a logfile. The Vim window gets used for editing (of course), the terminal is used for running test suites and exploring the codebase and finding and opening files in Vim. The reason I've never felt the need for a file-browser plugin in Vim is because I've always used Vim with an external file-browser. :)

If anyone's interested in opening files in an existing gvim window from the terminal, here's the script I use in Linux:

    gvim -f --remote-tab-silent "$@" &
(I believe MacVim comes with a similar 'mvim' script you can use on OS X) If you don't want files to open in tabs, change "remote-tab-silent" to "remote-silent". If you call the script and there's no existing gvim window, a new one will be created.
5 comments

I do literally the exact same, I rock MacVim in fullscreen surrounded by Terminal sessions on the left and right, left for building/opening files, the right for tailing the syslog.

If only Lion supported multiple monitor full screen.. :S

If you want the "old" MacVim fullscreen mode back (which supports multiple monitor full screen), just throw this into your terminal:

    defaults write org.vim.MacVim MMNativeFullScreen 0
Unfortunately, the remote features require a GUI version of vim. Personally, I prefer to run vim in a tab of my terminal.
The remote features require a version of Vim with GUI features compiled in, but you don't have to run vim in GUI mode to use them. The only difference is that when started in console mode, Vim won't register itself as a server unless it's explicitly told to use a particular server name:

    vim --servername FOO
If you start vim in another tab with the same servername, you can open files in the first Vim, no problem:

    vim --servername FOO --remote-tab ~/.bashrc
> The remote features require a version of Vim with GUI features compiled in, but you don't have to run vim in GUI mode to use them.

You do have to have an X server available though; the client/server communication occurs via X.

Under Linux I always run vim in a terminal. Part of this is habit because I (in the past) often edit files on remote computers and I like the consistency.

On my mac I end up using MacVim mostly so that my Vim and Terminal apps can be considered separate apps for the purpose of things like spaces, and it just seemed to integrate a little better with the Mac infrastructure.

But in general I haven't found a reason to prefer a GUI version over a terminal version when a sufficiently capable terminal is available.

The reasons I run gvim rather than terminal vim are basically all because sufficiently capable terminals do not exist:

- The excellent "solarized" colour scheme only works properly with 24-bit color unless you're willing to mess with the terminal palette and break all your other terminal apps. No terminal I know of supports 24-bit color.

- I have a handy keybinding that cycles through open windows and tabs, I find it makes the most sense bound to Ctrl-Tab and Ctrl-Shift-Tab. Neither key can be bound in any terminal I know of.

I've been using urxvt for a few years now. It supports a full color range and I adopted Solarized for a while, but went back to Tango.

I haven't had any trouble binding <ctrl>-based combinations. All my window-manager commands are based on <super>, leaving <alt> and <ctrl> open for other things. I assume <ctrl-tab> is conflicting with tab swapping in gnome-terminal or something similar.

No, it's just the way that terminals work: "Tab" is transmitted as "Ctrl-I", and there's no way to encode "Ctrl" twice in the input stream.
I'm using xterm with Solarized and it works pretty well. gvim is indistinguishable from vim in a terminal. I haven't observed any broken apps.
Or even

alias vimtab="gvim -f --remote-tab-silent"

in your .bashrc, .zshrc or equivalent

The Mac OS X command open allows this directly:

  $ open -a macvim filename.ext
which permits:

  $ alias mvim="open -a macvim"
as a shortcut.
I have found issue with this recently. When I have multiple tabs open, and then attempt to open multiple files after that, it opens them all in a split view :/

    :help 'tabpagemax'
Ah, but if I set it up as an alias, I can't use it with other apps that have a configurable "Send to editor" function. :)
zsh `vimtab ~/.zshrc`
Thanks that will help a lot(although I mostly use eclipse these days) but for smaller tasks having to reopen gvim with more files or opening new files can get annoying(also the lack of project/file groups checking).
I'm not a Vim user, but like you, I prefer to use several programs, which I lovingly call my disintegrated development environment.