Blog - Bloglines - Jaiku - Ports - Wiki


(J)ack (O)f (A)ll (T)rades
Mostly Security, Some
Blogging, Misc. Admin,
and Bits of My Life.









August 2007
Sun Mon Tue Wed Thu Fri Sat
     
 

Recent Comments

Wiki RSS

Blog Search

Categories

Archives

























Del.icio.us


Fri, 21 Apr 2006

Vi 21 Apr
I haven't evangelized on the advantages of using Vi in a long time. People who know it well enough cannot cannot function without it. (Though they often curse the people who forced them to learn it.) In any case, here is the U. of H.'s Vi Tutorial.

Damn you Bob Acosta! (heh)

joat: 20:30:00 21 Apr 2006


Sun, 14 Mar 2004

Vi templates 14 Mar
Deadman has some interesting scripts and templates, including PHP programming templates for Vi.

joat: 02:41:00 14 Mar 2004


Tue, 02 Dec 2003

More Vi Tips 02 Dec
Found "Vi Tips for Developers" while jumping around inside the System Administrator's Webring.

joat: 02:40:00 2 Dec 2003


Sat, 29 Nov 2003

Vi Keys 29 Nov
Got this one from 0xDECAFBAD: a pointer to Harvard's "vi Complete Key Binding List".

joat: 04:35:00 29 Nov 2003


Tue, 28 Oct 2003

Vi tutorial 28 Oct
0xDECAFBAD had a quick-pointer to a Vi/Vim tutorial on Harvard University's site.

joat: 11:37:00 28 Oct 2003


Mon, 27 Oct 2003

Vi and XML 27 Oct
PinkJuice has an online tutorial (Warning! Default page contains art in bubble-gum pink!) which covers various valuable tweaks if you use Vi to edit XML. It also has a whole slew of valuable tips for general use of Vi.

Note: this guide is also available on PDF form from the same site.

joat: 11:55:00 27 Oct 2003


Thu, 20 Mar 2003

Removing ^M's from text 20 Mar

(Using Vi) The only hard part about this is figuring out the proper key combination to generate the regular expression. To remove the ^M's, type:

:1,$s/^M//g

or

:%s/^M//g

where:

  • "1,$" or "%" designates "do the following to the whole file"
  • "^M" is generated by hitting "Control-V Control-M" (that's a capital V and M)
  • "g" signifies "perform the substitution with every matching instance in each line"

Source: alt.unix.wizards newsgroup

joat: 01:32:00 20 Mar 2003


Sat, 15 Mar 2003

Swapping two adjacent characters 15 Mar
Say, like me, you occasionally type with your feet (or it looks like you do). You get going so fast that you accidentally type "owrk" rather than "work". To quickly fix it, go back to the first wrong character (in this case, you can hit "B" to jump back to the start of the word) and hit "xp". This will effectively swap the two transposed characters.

joat: 11:22:00 15 Mar 2003


Fri, 14 Mar 2003

Shell escape to AWK 14 Mar
Yep, <shudder/> I use Vi as an editor and am always looking for new tricks. As such, I'll include them here unless I notice sudden upswing in sales of pitchforks and torches to the villagers.

Following is a neat trick for pulling a document through awk from inside of Vi. Say you generate a file by typing:

   ls -l > myfile

"myfile" then contains like:

   -rw-rw-r-- 1 joat joat 610 Oct 29 10:28 whois

You can then generate a list of shell commands by typing:

   :1,.!awk '{print "cp",$9,$9 ".bak"}'

An alternative to this is:

   :%!awk '{print "cp",$9,$9".bak"}'

This takes the ninth field in each row and inserts it into an output line with the format of

   cp whois whois.bak

Source: UNIX IN THE ENTERPRISE newsletter for 13 March 2003.

joat: 13:14:00 14 Mar 2003


robtex