← Back to Upcase

Integrating terminal into Vim

(Acandael Acandael) #1

Hi Josh,

I just started the Test-Driven Rails Workshop and following along the development of the Todo app.

I really like how your terminal is integrated into you Vim editor. How do you manage to type terminal commands, like bundle and git add . etc, … from within your Vim editor ?



(Jon Seidel) #2

I’m pretty sure he’s using tmux… well, I’m just guessing, but you can do a lot of great things just like that with tmux. I just recently set up and started using tmux and it is, in a word - AWESOME! Once I saw Josh and others moving around so quickly, I purchaed the PragProg book on tmux: http://pragprog.com/book/bhtmux/tmux which really made for a quick start.

How it works: you start a “session” and can then define multiple “panes” inside the window. I define the top pane as vim and the bottom pane as termina. Each pane is a fully functioning terminal or console application. Then, tmux has a “prefix” or “leader” key combination which drops you into tmux-mode (my term) where you can move around the window to your heart’s content, all without any mousing around.

I re-mapped my Ctrl key to the CapsLock key and the tmus prefix key-combo to Ctrl-A (from Ctrl-B) so now getting into tmux mode is effortless. Furthermore, I’ve re-mapped the tmux shortcut keys to mirror the corresponding vim keys, so now {Ctrl-A} followed by h,j,k,l operate just like vim but move me between different panes on the window. So now, a simple keystroke takes me from vim to terminal, execute a command, then another keystroke takes me back to vim.

The book got me started very quickly and almost effortlessly, as it is structured to make the whole things is vim-ish as possible.

Highly recommended!

(Acandael Acandael) #3

Hi JESii, thanks a lot for your answer. I know about tmux, but didn’t dive in it for now. But after seeing how Josh has his terminal and Vim, all in one window. I’ll definetly check it out. I also heard tmux is a great solution for Pair Programming.

Thanks also for the books reference, as I’m a kind of book person I’ll defenitly check it out.



(Acandael Acandael) #4

I just purchased the PragProg book on tmux and it’s a very handy resource for getting started with tmux. Very well explained and the exercises are easy to follow along.

(Kwasi Appiah) #5

Hi Anthony,

It would also be worthwhile checking out Thoughtbot’s screencast covering tmux (& Josh’s setup) - https://learn.thoughtbot.com/products/4-humans-present-tmux

(Acandael Acandael) #6

thanks kappiah, watching the video right know. Apparantly Josh also wrote a blogpost on tmux:
a tmux crash course