views:

27

answers:

1

I downloaded jsbeautify.vim from http://www.vim.org/scripts/script.php?script_id=2727

So where do I put jsbeautify.vim ? In ~/.vim/ or ~/.vim/ftplugin/ ?

After I position the plugin file, I will vim somefile.js containing javascript code without any newlines (difficult to read).

How do I invoke the plugin to pretty the code make it readable (exactly what key sequence).

How do others read/edit large crunched javascript code files (like firefox or chrome extensions)?

Fyi: this is a chrome extension so the files are overly large to cut-paste into an web-based tool. I really just want to edit the file in-place to fix a bug, test theories.

Thanks, - Greg

+1  A: 

figured it out.

The file jsbeautify.vim must be placed in the ~/.vim/plugin/ directory.

To invoke, do:

vim somefile.js

\ff

where the \ char is your char. The default is backslash.

also, you can run it by using:

:call g:Jsbeautify()

Then you can edit and save the javascript file.

Gregor