Last Updated: February 25, 2016
·
838
· tacahiroy

Vim: Chef's attribute notation converter

Are you tired of typing thousands of brackets like node["foo"]["bar"]?
Here is the answer. You can convert node.foo.bar to node[:foo][:bar] Vim easily.

You can use 3 styles of the Chef's attribute notation.

node[:mysql][:user]
node["mysql"]["user"]
node.mysql.user

It's pretty hard to type characters like node[:foo][:bar] or node["foo"]["bar"],
so the your little finger will must be broken.
Too much brackets!

Though you must hate this style, it's unavoidable probably.

However, you can convert node.foo.bar into node[:foo][:bar] very easy if you're a Vimmer.

Please copy the code in the link below to your .vimrc.

https://gist.github.com/tacahiroy/4961768

After that, if you type node.foo.bar and <C-y>x, you will get node[:foo][:bar].

Enjoy!