What: Installing Vim one every machine you work with
Why: Avoid complicated setup of the favourite IDE each time on a new (virtual) machine
How: Using Ansible to install and pimp Vim
Vim is a great IDE, but with some plugins it is even better. I regularly use and want to have the following plugins available:
- air-line for status information
- syntastic for syntax checking
- Zenburn as color scheme
- vim markdown for markdown
- nerd tree for directory browsing
- ctrl p for search and opening files in the workspace
- Jedi vim for auto completion
Install vim on multiple machines is quite simple with Ansible. See my other blog entry for installing ansible and a first toy example of ansible in action.
Install and pimp Vim
Install Ansible on your system and clone my blog repository. It contains the playbook (vim.yml) and a helper file (installVim.sh).
Note: If you use the playbook to install and pimp Vim on the same machine like ansible is running: Clone to a different location than /tmp/blog. Use /tmp/bloginstall for example.
1 | git clone https://github.com/frankdressel/blog.git /tmp/bloginstall |
In the blog/ansible directory you will find the playbook file vim.yml. By default, it is configured to install Vim on a test remote machine (if you are using Vagrant, you can find the Vagrantfile here). If you don’t want this, change the following line and replace ansibletest with your remote machines name.
hosts: ansibletest |
hosts: your_machine_name |
Afterwards, run the playbook with the following command (password based authentication is used here with the option –ask-pass, see here):
1 2 | cd /tmp/bloginstall/ansible ansible-playbook vim.yml -u --ask-pass --ask-become-pass |
If you want to run it on your local machine use the following instead:
ansible-playbook -i "localhost," -c local vim.yml
Ansible will produce some output which should end with something like:
1 2 | PLAY RECAP ********************************************************************* 10.0.2.2 : ok=17 changed=0 unreachable=0 failed=0 |
If you are a linux user: Done! If you are using Windows and putty, there is one last step to be done to have a nice user experience with power line: Change the font used on your vim terminal. See this blog for the setup. It is done in less than 5 minutes. By default, the Vim instance presented here is using the DejaVu Sans Mono for Powerline font as described in the tutorial.