Saturday, December 24, 2011

jslint config in sublime-jslint

I'm new to Sublime Text but I'm quickly becoming a fan. Based on Kelly's recommendation, I installed Sublime Text 2 and Sublime Package Control.

After doing some basic editing I decided to go get a jslint package. I installed sublime-jslint and ran it. Easy peasy but I got warnings because I like 2 space indents instead of 4 in my code and some node-specific stuff.


jslint:mystuff.js:5:12:'require' was used before it was defined.
jslint:mystuff.js:6:3:Expected 'winston' at column 5, not column 3.
jslint:mystuff.js:7:3:Expected 'service' at column 5, not column 3.
jslint:mystuff.js:9:1:'exports' was used before it was defined.
jslint:mystuff.js:10:3:Expected 'use strict' at column 5, not column 3.
jslint:mystuff.js:11:3:Expected 'var' at column 5, not column 3.
jslint:mystuff.js:12:5:Expected 'server' at column 9, not column 5.
jslint:mystuff.js:13:7:Expected 'winston' at column 13, not column 7.
...


I changed my user settings in the jslint package to add configuration options. The documentation from sublime-jslint had the info on how to configure it but it wasn't totally clear so took me a couple tries to get it right.



Here are the entire contents of my sublime-jslint.sublime-settings file:

{
// https://github.com/fbzhong/sublime-jslint/wiki/Available-jslint4java-options
"jslint_options": "--indent 2 --node"
}


Now when I use jslint (by clicking ctrl-j) I get nice results.


mystuff.js lint free!
jslint: ignored 0 errors.

Friday, December 09, 2011

Remap fn on MacBook Pro in VirtualBox

I use LinuxMint 12 in VirtualBox on my MBP for non-work projects. I think that OS X is an excellent environment for software development but I am also mighty pleased with LinuxMint. I use a VM for non-work projects just to make sure that everything stays very separate. I decided today that I'll never get used to where the Control key is so I went looking for a way to swap the fn and Control keys. I saw a couple separate sites reviewing KeyRemap4MacBook so I decided to try it even though most forums said that you can't remap the fn key.

I use Lion so I downloaded version 7.5.0 for Lion. The zip file drops a pkg. I installed that and got a System Preference added to my system. (I did have to reboot.) The new preference is KeyRemap4MacBook: at the center of the bottom row.



I opened the widget and was immediately dazzled! Fn to Control_L (only in virtual machine, RDC) I enabled that, fired up VirtualBox (I'm using v4.1.6), and booted my VM.



I could hardly wait to try it...



Woohoo!