Home > html, Tip, vim > A couple of plugins that make web developing life easier.

A couple of plugins that make web developing life easier.

matchit
The plugin basically extends the functionality of % in vim, it cycles between opening and closing tags, very handy if you love coding htmls by hand.
Steps to make it work: { windows users pls unzip the files to the vim home directory }
1) download the zip file from the above link
2) unzip matchit.zip -d ~/.vim
3) add the following line to your .vimrc
filetype plugin on
if filetype plugin is set to off [ default setting ]
4) open an existing .html file or create a new one, under normal mode, pressing % will cycle between html tags, v% will select text between opening and closing tags (with the opening tag name selected)

jsbeatify
This is yet another handy and powerful vim plugin. As its name suggests it does one thing and it does really well – beatifies javascript files. Steps to make it work:
1) Download it and save it to ~/.vim/plugin
2) Open an existing .js file or create a new one, under normal mode, press \ff and the code is formatted

There’s one thing that this plug in is not able to do – format the selected js code – in other words you can’t beautify the embedded js code in html or php files.

[ Edit 9/18/2011: Actually I just found another better solution to format javascript code – what I like the best is that this indenter formats all javascript code either in stand-alone file or embedded code. Just put the file html.vim from http://www.vim.org/scripts/download_script.php?src_id=6885 to ~/.vim/indent and use gg=G to format the whole file or = to format selected code. ]

Advertisements
Categories: html, Tip, vim
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: