- Interpreted, not compiled
- Case-sensitve
- Whitespace insensitive except within quotes
Answer by Jim Dennis on Stack Overflow question http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118
Your problem with Vim is that you don't grok vi.
You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).
The "Zen" of vi is that you're speaking a language. The initial y is a verb. The statement yy is a simple statement which is, essentially, an abbreviation for 0 y$:
0 go to the beginning of this line. y yank from here (up to where?)
Local docs using BASH
ri upcase # documents for upcase method
function sieve(max) { | |
var D = [], primes = []; | |
for (var q=2; q<max; q++) { | |
if (D[q]) { | |
for (var i=0; i<D[q].length; i++) { | |
var p = D[q][i]; | |
if (D[p+q]) D[p+q].push(p); | |
else D[p+q]=[p]; | |
} | |
delete D[q]; |
development: &defaults | |
adapter: postgresql | |
encoding: utf8 | |
database: surveys_development | |
pool: 5 | |
username: john | |
password: appleseed | |
test: &test | |
<<: *defaults |
for (i = 1; i <= 20; i++) { | |
if (i % 3 === 0) { | |
if (i % 5 === 0) { | |
console.log("FizzBuzz"); | |
} else { | |
console.log("Fizz"); | |
} | |
} else if (i % 5 === 0) { | |
console.log("Buzz"); | |
} else { |
<!--- | |
Name: qbAPI.cfc | |
Author: Gernot Bartels | |
Description: Methods to interact with QuickBase | |
History: Migrated from CF8 to Railo 2010-04-02. | |
Created: 2009-03-25 | |
Updated: 2010-04-02 | |
---> | |
<cfcomponent output="false"> | |
<!--- Login ---> |
<!--- | |
Name: record.cfm | |
Author: Gernot Bartels | |
Description: Queries QB for record object. | |
If record ID exists, update; | |
Otherwise create new record. | |
History: Created | |
Added logic | |
Usage: Surveys, Intake, | |
Created: 2011-08-05 |
<!--- | |
Name: intake_xml.cfm | |
Author: Gernot Bartels | |
Description: Intake Application cfsavecontent object | |
Returns new record or update data. | |
History: Created | |
Usage: Surveys, Intake, | |
Created: 2012-09-05 | |
Updated: 2012-10-15 | |
---> |
And yes, new
has one crucial disadvantage, ably described by other answers: if you forget to use it, your code will break without warning. Fortunately, that disadvantage is easily mitigated - simply add a bit of code to the function itself:
function foo()
{
// if user accidentally omits the new keyword, this will
// silently correct the problem...
if ( !(this instanceof foo) )
return new foo();
// constructor logic follows...