Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The following code is taken from the superfish module for websites:

(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))

And once upon a time when editing this kind of file, I once accidentally hit a shortcut key that restructured the code:

 var cfg={sensitivity:7,interval:100,timeout:0};
 var cX,cY,pX,pY;
 var track=function(ev){cX=ev.pageX;cY=ev.pageY;};
 var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);

I want to know what that shortcut is o.0

It's like the formatting already exists but VI didn't render it?

share|improve this question
[I realize this is an ancient question]: Could you clarify, is this actually vi or do you mean vim? – derobert Oct 20 '14 at 20:38

The vim command to format source code is gg=G, it always worked for me with java or c source code; it does not work with your snippet probably because it only works with syntactically correct files.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.