development environment setup

How to setup Vim, Tmux, Docker for high productivity (Part II)

The second article in the series, this time we are going to install all of the tools used in this tutorial on Ubuntu 14.04. If you are running any other flavor of Debian, you should be just fine (with small adjustments of course). In any other case, you will need to dig it up yourself which should not be too difficult honestly. If something is unclear, feel free to check previous article.

The shell – Zsh

Working with pure Zsh is a lot of fun. However, combining it with Oh-my-zsh brings a shit load of new possibilities thanks to themes, plugins and configuration options. In order to install everything execute following commands in your shell:

sudo apt-get install zsh
sudo apt-get install git-core
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
chsh -s `which zsh`
sudo shutdown -r 0

I use `git` plugin together with default theme `robbyrussell`. For more configuration options visit – ohmyzsh.sh. Most of the themes have screenshots so it’s easy to select the one that suits you the best.

The editor – Vim

We will be using Vim 7.4 compiled with Python. Thankfully, it is shipped in most recent versions of Ubuntu, so all you need to do it to apt-get install it.

sudo apt-get install vim
vim --version | grep python
+cryptv          +linebreak       +python/dyn      +viminfo
+cscope          +lispindent      -python3         +vreplace

If you see +python on the list, you are good to go. Don’t worry about configuration, we will get to it in the next post.

Windows and sessions – Tmux

In order to effectively work with Vim, any shell editor actually, there must be a way to quickly switch between tabs, windows, and sessions. Tmux is a modern solution to that problem.

sudo apt-get install -y python-software-properties software-properties-common
sudo add-apt-repository -y ppa:pi-rho/dev
sudo apt-get update
sudo apt-get install -y tmux
tmux -V

Don’t forget to alias it to get full 256 color support.

alias tmux='TERM=xterm-256color tmux'

Setup – Tmuxp

Launching of Tmux and then opening all of the directories by hand quickly becomes a tedious task. One way to avoid it is by suspending your PC. But that’s a dirty solution. For better approach is to preconfigure sessions so that everything will be brought up automatically with few keystrokes. Likely, we need only one python library for that. Tmuxp.

sudo pip install tmuxp

As for Vim, the configuration of Tmuxp is yet another topic for a separate post. Stay tuned!

Services – Docker

In the old days I used to install all services on my machines by hand, this includes databases, queueing systems, caches etc. It worked pretty well, but I had one problem with it. The amount of mess created over time was beyond any control. Since I work on my private laptop, that was the last thing I wanted to have. Then I found Docker. By applying naive solution – ports binding – one can simulate fact of having everything installed locally when in reality it’s in containers.

The installation procedure is pretty lengthy that’s why I’m going to redirect you to the source.

  • visit this link to install Docker
  • visit this link to install Docker-compose
  • visit this link to configure docker group to run it without sudo

Summary

That’s pretty it. In the next two posts, we will focus on Vim and Tmuxp configuration which usually confuses people the most. Next, we are going to move to workflow description and general productivity tips.



RELATED POSTS


COMMENTS5

  1. Thanks for the post!

    What do you think about Vagrant? And what IDE for Python do you use?

    • We used Vagrant in few projects, but Vim, Tmux, Docker setup turned out to be so much better that we never looked back. Once you get it, it’s pretty easy to add new components or build it from scratch.

      For Python, and actually most of the languages, I use Vim. In next post (tomorrow), I’m going to talk about how to configure it so that one can get the most out of it.

      • Thank you for the answer, Marcin.

        Will wait your new post about vim. I tried it few times as an IDE and things didn’t go well enough = )


LEAVE A COMMENT