
Build an IDE with tmux and vim - ahalan
http://alexyoung.org/2011/12/19/build-an-ide-with-tmux-and-vim/
======
briandoll
One nit: "considering the loss of the convenience of mouse input"

You can get full mouse support in tmux/vim.

I recently read the tmux book by the pragmatic programmers and highly
recommend it: <http://pragprog.com/book/bhtmux/tmux>

It's short, well written and contains lots of essential configuration tips to
get not only mouse support but also system copy/paste on a mac. Here's my
tmux.conf if you're curious:
<https://github.com/briandoll/dotfiles/blob/master/tmux.conf>

~~~
jasonlotito
I can second the recommendation for Brian Hogan's tmux book. I have a feeling
it will become _the_ tmux book to get for some time. It's short enough that
you can get through it without a major investment, and long enough that covers
everything (and more) to become productive with tmux.

~~~
bphogan
Wow, that's really humbling. Thanks so much for the kind words.

~~~
jxi
Please make your book available via Google Books if possible! I'd really love
to purchase it, but I like to read in between devices and Google Books is the
only platform that supports this well right now. Also, I like to keep it
attached to a single account instead of having to spread my credit card
details everywhere.

~~~
bphogan
The book is available in DRM-free epub, mobi, and PDF, and PragProg.com can
deliver your books to a Kindle or Dropbox automatically. That's how I read
books across my devices.

------
exDM69
I do something similar but instead of tmux in a terminal, I use a tiling
window manager (called awesome) to achieve a similar user experience but with
all GUI windows instead of only terminal windows. (it's not a daemon like
tmux, though).

This way, I can also get a browser window in the mix too, or any other
windowed application. I also prefer using gvim and not console vim, because I
can have a different coding font and drag and drop files from my version
control GUI (an enterprise VCS with a really crappy CLI, guess which one).

Switching to a tiling window manager is perhaps the best productivity booster
I've had. It even allowed me to start working comfortably with one display
only or a laptop display, I've always used multiple displays before.

~~~
oneofthose
I do exactly the same thing. It works really great for me. An additional plus
if you go this route is the tagging feature of tiling window managers. This
allows you to have multiple views. I use for example one e-mail/web view, one
development view (vim in multiple consoles), one server view (consoles
connected to various remote systems) one Matlab view and of course one music
player view.

------
luser001
I do this. Vim + tmux rocks.

One tip that Works For Me (tm) is to map the rarely-used function keys to pane
and window selection commands (I hate multi-key commands :))

I've got F1/F2 mapped to cycle through panes, and F3/F4 to cycle through
windows, F5/F6 to split windows, F7/F8 to resize panes, and F9 to open a new
window.

Also, I always run my tmux terminal fullscreen and without the menubar.

YMMV.

~~~
Ecio78
Can you post/pastebin your config for this function keys mapping? thanks!

P.S. dont you have problems using tools like "top" and so on?

~~~
luser001
Hope this helps. It's nothing fancy. No, no probs with 'top'.

    
    
        # use ^K instead of default ^B.
        set-option -g prefix C-k
        unbind-key C-b
        bind-key C-k send-prefix
        
        # F1, F2 to cycle between windows within a "workspace".
        # what tmux calls "windows" are like workspaces in WindowMaker.
        # and what it calls "panes" are like individual xterm windows in a workspace.
        bind-key -n F2 select-pane -t:.+
        bind-key -n F1 select-pane -t:.-
        
        # F3, F4 to cycle between workspaces.
        bind-key -n F3 previous-window
        bind-key -n F4 next-window
        
        # F5 split a workspace horizontally and F6 to split vertically.
        bind-key -n F5 split-window
        bind-key -n F6 split-window -h
        
        # F9 new workspace
        bind-key -n F9 new-window
        
        # to disconnect from tmux do: ^K+d
        # or exit all the windows you created.
        bind-key -n F7 resize-pane -L
        bind-key -n F8 resize-pane -R

~~~
Ecio78
Thank you, unfortunately I dont know why but F1-F4 are not working, while
F5,F6,F9 works. I'm using putty, dont know if this matters. When i press
F1,F2,F3,F4 i got ~ on the shell

~~~
luser001
Sorry, I just saw this. And I'm right now on Linux so I can't confirm, so I
might be slightly off here.

There's a setting under keyboard (or terminal, I forget). You might need to
change it to 'X11R6'.

Look at section 4.4.3 here:
[http://the.earth.li/~sgtatham/putty/0.62/htmldoc/Chapter4.ht...](http://the.earth.li/~sgtatham/putty/0.62/htmldoc/Chapter4.html#config-
keyboard)

I hope that fixes it for you. Good luck.

------
sikhnerd
I have been using tmux + vim as my primary mode of work for quite some time
now, and as time has gone on my productivity has markedly increased as a
result. I don't think I could ever go back to a workflow that required me to
use a mouse or be away from all of the standard linux utilities and pipes.

------
jeybalachandran
I used to do the same, recently I switched to MacVim. I found using Vim in
Terminal/iTerm2 slowed down drastically after I worked with it for 10-15
minutes. Opening a file would take 1-1.5s, compared to MacVim which was
instantaneous. I thought it was tied to a plugin, tried going barebones and
still the same problem. (Although removing vim-rails sped it up a tiny bit.)
Unable to diagnose it any further, I had to switch to MacVim.

Anyone else had similar problems and managed to resolve? Here is my dotfiles
if you're curious <https://github.com/jeyb/dotfiles>.

------
adam_albrecht
This is an honest question from someone with 0 experience with TMux. What
benefit does it give me over using split windows within iTerm?

~~~
SkyMarshal
I've never used iTerm, but does iTerm run from a daemon and remember your
window config even when you close the window?

The main use case for that in tmux is when you ssh into a server, start tmux
and vim, do some work, then log out without shutting down the tmux daemon. You
can then log back in the next day, reattach to the tmux daemon, and continue
with your tmux layout the way it was when you logged out the previous day.

~~~
superchink
No, but they maintain a fork of tmux that integrates into the iTerm UI to
provide that type of functionality. It's a work in progress, but it's coming
along nicely.

<http://code.google.com/p/iterm2/wiki/TmuxIntegration>

------
momo-reina
honest question... but how is this different from running an emacs server with
split windows/buffers plus a console emulator that supports multiple sessions?

ex. i use yakuake (KDE) with three sessions. one with an emacs buffer and the
CLI, one session dedicated to wanderlust, and one running erc. if i do some
dev work i just add another session and fire up emacsclient to connect to the
running emacs instance. this can be adopted for use in a server environment,
you just ssh in and hit 'emacsclient' to connect to emacs instance.
screenshots:
[https://plus.google.com/photos/111355179120790769944/albums/...](https://plus.google.com/photos/111355179120790769944/albums/5721561914598066785?authkey=CPvdxZiGxuavGg)

~~~
nevinera
It's.. vim?

Posts about using vim and tmux are pretty obviously not pointed at emacs
users.

~~~
momo-reina
vim can split windows as well, and most terminal emulators support split
sessions... my real question is what is the real benefit of tmux?

i'm not trying to start a flame war here, i used to use vim until i got into
lisp. i'm always interested in looking into different workflows.

~~~
johncoltrane
It's a different way to do more or less the same thing.

The differences:

* The editor is Vim not Emacs.

* Vim is not able (without unconvincing plugins/hacks) to run a shell in a window so if you need one you are pretty much forced to run it somewhere else. Be it another terminal emulator instance, another terminal emulator window, another terminal emulator split window (like you do), in the same terminal emulator window (juggling with Ctrl+z/fg), another window in tmux/screen, another pane in tmux/screen, etc.

* Yaquake is a GUI app that you can't __realistically __run on a remote server while tmux is CLI-based. When SSHing, tmux is possibly the closest thing there is to Yaquake.

* Tmux and screen both allow you to attach/detach sessions which makes these tools very useful on remote machines where they are commonly used to launch servers or long running tasks.

* Probably many more…

Note that these are DIFFERENCES. They CAN be benefits, depending on your
workflow and needs.

Totally OT. I know about Yaquake since years. I know about Quake since much
longer. I know that Yaquake "top-sliding" UX is based on Quake's console since
all those years. Yet I've just realized, now, that the "quake" in Yaquake is
actually "Quake" and that, for all those years I've pronounced it in a kind of
japanese-style "Yakuake". Oh well…

------
swah
If you run them in Putty fullscreen folks don't even have to know you use
Windows!

------
petepete
I've been using tmux for the last year or so, and feel lost developing without
it; I use tmuxinator and have it open tabs called editor, shell, vm, db, logs,
scm (with a slightly different setup per project) and it works fantastically.

<https://github.com/aziz/tmuxinator>

------
jakejake
Two things that I really like about my IDE is the project file explorer and
working on multiple files using tabs. Part of that is not just the quick
access, but visually seeing what I have open. Are there equivalents for those
things with the tmux/vim setup?

~~~
jasonlotito
vim supports tabs (as well as windows). tmux also supports "tabs" as well,
which you can rename. I currently have about 6 tmux tabs open, each split with
various windows. Some will have vim inside, and vim will have it's own windows
and tabs separate from tmux. It sounds confusing, but it's actually very
simple to keep everything straight.

My tmux tabs are all named for their purpose. So, if I'm working on different
areas in a project, I can easily move to that area and focus on that.

tmux also supports having different sessions. So, I can open one session, and
if I have to move to a completely different project, I can open up a session
for that.

As for file access, their are numerous plugins for vim that accomplish that. I
think they are NerdTree and something else I can't remember? Not sure, I don't
use them. With tmux, I can have a pane opened up and just use the command line
to see everything.

But as for seeing what you have open, tmux and vim give you numerous ways to
do this, as well as move through all those screens, easily in many different
ways, far easier than any IDE I've ever seen.

~~~
SkyMarshal
_> As for file access, their are numerous plugins for vim that accomplish
that. I think they are NerdTree and something else I can't remember?_

Command-T probably.

<https://wincent.com/products/command-t>

~~~
jasonlotito
That's it. I knew if I mentioned it, someone would pop in to help. =)

------
hm8
I might be attracting a lot of heat towards me but can somebody post something
similar about emacs as well. I had seen one of my friend doing it once but it
didn't work very well and I was pretty unfamiliar to linux at that point of
time.

------
AjithAntony
Other than the vertical split, does tmux do anything that GNU screen can't do?
I find screen is more readily available on a wide variety of systems.

~~~
irahul
Configuring tmux is easier than configuring screen. And you can patch screen
to do vertical splits. The patched screen has been the one that installs in
Ubuntu for some time now.

~~~
eshvk
For some reason the vertical split patch (available on Macports) stopped
working once I upgraded to OSX Lion and I find myself depending on terminal
"tabs" to mimic it (which is slow and painful). Well, maybe it's time to make
the move to tmux!

