VIM – Toggle Ruby Hash Syntax

Ruby 1.9 introduced a new json style ruby hash syntax. Although we can use this to define static hash objects and puts a limitation on the key we can use, it’s a fairly neat syntax nevertheless. However I work on several projects, both new and old and hence the new syntax is not always readily available.

To demonstrate the sheer power of regular expressions & VIM, here’s a tiny snippet that allows you to quickly toggle a ruby hash syntax from one form to other.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

VIM for Multiple Projects in separate Tmux windows

My development environment setup consists of several tools, however the 2 most used and essential tools that have a great impact on my workflow are tmux & vim. Since I often work on several projects, I find it best to work on different vim sessions in separate tmux windows.

However tmux by default only shows the name of the currently running process in the title and that can often lead to confusion as to which tmux window is which project. To solve this issue I came up with a very simple vim script that utilizes tmux’s powerful API to automatically rename the tmux window appropriately and hence make it incredibly easy for me to know which tmux window is for which project.

Here is the vimscript, that you can put anywhere within your ~/.vimrc :

Here’s a screenshot of the same :
VIM for multiple projects within tmux

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)