No idea if I would have the time to do it, patch is welcomed. Hopefully this one also teaches you a trick or two, especially if you work a lot with JavaScript code. The last one was about the project plugin, which is surprisingly still quite popular. It’s been a while since I blogged about vim. Also, if you need different jslint options, simply edit the invocation to suit your needs. Note that since this is dynamic JavaScript, rather than matching errorformat, technically I just tweaked the tool to spit something similar to what a C/C++ compiler would do. All in all, you may want to map mostly used commands to some shortcuts for faster access. Check the quickfix documentation for details. Ctrl+W W to switch to quickfix pane again. After a while, use :cope to open the quickfix little window, move up and down, and press Enter to bring you back to the main editor and set the cursor at the specified problem. Now open a JavaScript file and run :make (or whatever shortcut you map this into), which will launch jslint with the current file. vimrc: au FileType javascript set makeprg=jslint % First of all, associate *.js with the tool by putting this line in your personal. If you use vim, jslint can be combined with Quickfix. That’s it! If you also store this shell script in your PATH, then you just need to run: jslint source-code.js Create a simple shell script, which contains one line filejs /path/to/filejs/jslint.js $1 and make it executable. First build filejs (follow the instructions in the included README), then place the executable in your PATH. Of course, the twist is: use filejs to drive a command-line jslint. If you write more examples, feel free to pass them to me! There are two examples so far, ROT-13 and line counter. Find it in the usual X2 repository under the javascript/filejs. With API loosely modelled after CommonJS, filejs was born. Then I realized, let’s just extend it to be generic. After I did the V8-based jsbeautify, I was doing V8-based jslint as well. Somehow, it’s also fun to use JavaScript instead. Perl/Python/whatever, to manipulate file contents. Usually, you would want to use scripting solution, e.g. Ariya.io About Talks Articles V8 + jslint + vim
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |