July 26, 2007

July 19, 2007

Eating Place

Curry House: Katella & Knott
Z-Pizza: Los Alamitos & 405
macaroni grill: Los Alamitos & 405
美食林: Alondra, 牛肉饼,木须肉
大肚鱼:South & Pinoeer

July 17, 2007

vim multiple repeat command

:g/PATTERN/,/$/-1d
Or simpler:
:g/PATTERN/-1d
or even more simpler
:g/PATTERN/d
can be used to delete all lines that match PATTERN

See help :g for more

Another post from VIM TIP #227
:v/./,/./-j

I'll break down this incredible collapse-multiple-blank-lines command for everyone, now that I finally figured out how it works.

First, however, I'll rewrite it this way to illustrate that some of those slashes have totally different meaning than others:

:v_._,/./-1join

Note that to delimit expressions like these, just about any symbol can be used in place of the typical slashes... in this case, I used underscores. What we have is an inverse search (:v, same as :g!) for a dot ('.') which means anything except a newline. So this will match empty lines and proceed to execute [command] on each of them.

:v_._[command]

The remaining [command] is this, which is a fancy join command, abbreviated earlier as just 'j'.

,/./-1join

The comma tells it to work with a range of lines:

:help :,

With nothing before the comma, the range begins at the cursor, which is where that first blank line was. The end of the range is specified by a search, which to my knowledge actually does require slashes. The slash and dot mean to search for anything (again), which matches the nearest non-empty line and offsets by {offset} lines.

/./{offset}

The {offset} here is -1, meaning one line above. In the original command we just saw a minus sign, to which vim assumes a count of 1 by default, so it did the same thing as how I've rewritten it, but simply with one character fewer to type.

/./-1

There is a caveat about join that makes this trick possible. If you specify a range of only one line to "join", it will do nothing. For example, this command tells vim to join into one line all lines from 5 to 5, which does nothing:

:5,5join

In this case, any time you have more than one empty line (the case of interest), the join will see a range greater than one and join them together. For all single empty lines, join will leave it alone.

There's no good way use a delete command with :v/./ because you have to delete one line for every empty line you find. Join turned out to be the answer.

This command only merges truly "empty" lines... if any lines contain spaces and/or tabs, they will not be collapsed. To make sure you kill those lines, try this:

:v/^[^ \t]\+$/,/^[^ \t]\+$/-j

Or, to just clean such lines up first,

:%s/^[ \t]\+$//g

July 3, 2007

Air Ticket Agent

纳美旅行社 (Oriental Tour & Travel)800-951-3391
866-783-1688

Bravo travel1-626-280-9988

中旅国际洛杉矶 (China Travel Service LA Office)888-664-5678
626-576-9688

美国亚洲旅行社626-350-6376

泉威旅行Champion Travel Service (626)854-1808



一帆国际旅游 ( Vanguard Int'l Travel)866-882-6888
718-886-8868

加州阳光626-5882818

丽来1-909-594-6899

JNC626-573-8888


polo tours800-822-7656


J&C Travel, Inc.626-573-8888


捷胜国际旅游 ( Sunlight International Travel)866-838-6898
718-762-1800

来来213-626-6118


蓝天800-644-3615

Software

Resource Hacker: http://angusj.com/resourcehacker/
PDFTK: free PDF tools
PDFTK GUI: http://angusj.com/pdftkb/
PDF Viewer with comment capability: http://www.docu-track.com/home/prod_user/pdfx_viewer/