Vim Tutorial: How to Use Windows v2.0

Linux, Vim

I had to start over from scratch (my video camera lied to me about its ability to do widescreen, so I recorded everything in the wrong resolution), but this video is definitely better.

The next video will be about text folding, then I’ll cover sessions.

Shell Command Prompt Shirt
shell_prompt_shirt

Other useful windows commands I didn’t mention in the video:

:qa (quit all windows)
:wa (write all windows)
:wqa (write and quit all windows)

CTRL W > (increase window width one line at at time)
CTRL W < (decrease window width one line at at time)
CTRL W | (maximize the width of the current window)

For more information see:
windows.txt
usr_08.txt
Multi-window commands

2 Comments

New Vim Video Intro

Uncategorized

I haven’t fixed the problems with the second video yet, but I did make this new intro.

No Comments

Honestly People, Who Steals a Broken Wheel Cover?

Cars

Four years ago I bought my Toyota Corolla. It was a sexy little black car, so I thought it could use some nice rims . . . unfortunately I couldn’t afford nice rims, so I bought a cheep $20 set of wheel-covers.

Two weeks later we had a huge hail storm which dented my car, ruining the paint, and poked holes through my new wheel covers.

Sorry about the grainy picture. I had to blow up a picture of my car so you could see one of the cracks in the wheel cover. There are several other cracks, but the image quality is too bad to see them.

Sorry about the grainy picture. I had to blow up a picture of my car so you could see one of the cracks in the wheel cover. There are several other cracks, but the image quality is too bad to see them.

(By the way, this isn’t my first case of bad luck with wheel covers. On a previous car, I went to Sears to buy new tires. The mechanics broke one of my wheel covers, then tried to hide it by putting it on my rear-passenger-side tire. I guess they were hoping I wouldn’t walk around my car and look at my new tires. Bums.)

Back to my story . . .

Monday, after taking a final, I got back to my car and noticed my wheel covers were missing.

I was too irritated to laugh, and too amused to be angry.

Who steals cheap broken wheel covers? Should I call the police? Should I call my possy? Is Wal-mart trying to scare me off?

I can’t rest until I know, so I’m offering a reward for my missing wheel covers. If any of you can return my original wheel covers, I’ll give you . . . hummmm . . . $100 (I’m not joking).

1 Comment

Vim Video Tutorial: How to use Buffers

Linux, Vim

Part one of my Vim video tutorial series. This tutorial is about using vim’s buffers.

Shell Command Prompt Shirt
shell_prompt_shirt

Show Notes:
Here is a list of the commands I used in the video.

IMPORTANT NOTE: In the video, when I say “type a command” I took for granted that you would know when to type a colon (:) to enter an ex command. If you don’t type the colon first, you will have significantly different results. The two Vim commands I showed you were CTRL-Ww and CTRL-W c. You do not type a colon before these Vim commands (also, when you use the CTRL key, case is irrelevant so you don’t need to type CTRL-SHIFT-Ww, just CTRL-Ww).

Shell Stuff
$ ssh drone@evil_robot (not a vim command, but an important first step to hacking the evil robot)
$ clear (also not a vim command)
$ ls (ditto)

Part One: 3 Ways to load files into buffers
$ vim *.java (here’s how I would actually open these files to edit them)
:e (plus a file name)
:Ex (and navigate your files until you find what you want to edit, and press enter)

Part Two: Navigating around in your buffers
:ls
:b[N]
:bn & bp

To change your status line, add the following to your .vimrc file:
set statusline=\ %F%m%w\ %=\ BUFFER=%n\

To see what other options you have for your statusline type :help statusline

You’ll also might want the following line:
set laststatus=2 (Means always show statusline. Other options are 0 which means never show status line, and 1 which means only show status line when multiple windows are open–that is the default setting.)

I also used the command :make%
If you want to change your make program to a different compiler either enter the following command, or add it (without the colon) to you .vimrc file
:set makeprg=javac (Or whatever compiler you’re using. And this only affects Vim’s behaviour, not your shell.)

Part Three: Reading the buffer help file
:help buffer (NOTE: I intentionally typed “buffer” rather than “buffers.” If you type “buffers” your help buffer will open at the top of the windows.txt file which also contains information on how to use windows in vim. Typing “buffer” will open the file around line 1000 and this is the area that has information about using buffers.

:sb1
CTRL-Ww
CTRL-W c

Part Four: Special Buffers
:ls!
:e .vimrc
set hidden

:source % (the shortcut is :so % or you could add the following line to your .vimrc file and then this would happen automatically every time you save a change to your .vimrc file . . . so, you should add this line to your .vimrc file:

autocmd! bufwritepost .vimrc source ~/.vimrc

:sb1
:hide

:make%
To compile java add this to your .vimrc file (or whatever java compiler you use. . . and if you add the “\ %” to your .vimrc file, then you only have to type :make in vim . . . later I’ll show you how to set up Vim so it will use the correct compiler based on the filetype)
set makeprg=javac\ %

:cw
:cn
:cp

No Comments

Timeout Stinks

Fatherhood

Timeout doesn’t seem to phase my kids. They come up with the most bizarre ways to have fun while I’m trying to punish them.

Here’s what the last two minutes of timeout sounded like in my house:

  • “No roaring like a lion in timeout.”
  • “No singing ‘Jesus Loves Me’.” (That’s a weird rule to have to impose.)
  • “No being a blowfish in timeout.”
  • “No pretending your hand is a cookie.”

What do I have to do to make timeout as un-fun or my kids as it is for me? (I’m secretly proud of them for being so imaginative.)

No Comments

Is It Worth It? Buying Bulk at Walmart

Budget, Fatherhood, Money, The Man

The price tags on most food items in Walmart have a nice orange label that shows you the cost per oz. I like the orange tags because they make comparing similar items easy.

A couple weeks ago we ran out of laundry detergent, so I made an emergency trip to Walmart (the emergency was caused by a poopy diaper that exploded onto my kid’s clothes).

When I grabbed a jug of sent-free All laundry detergent, I noticed the orange tag was missing. Technically, this wasn’t food, so I guess Walmart didn’t feel the need to add the orange label, but it made me suspicious. I did some quick math an discovered that buying three 100oz containers would be about one dollar cheaper than buying one 300oz container.

I didn’t have pencil and paper with me so I didn’t get the exact prices. That’s why I went back yesterday to investigate what I call:

“The Walmart Bulk Scam”

Most of us believe buying bulk is cheaper than buying smaller individual items. I bet Walmart knows that, and that’s why they started charging more for the larger containers.

Here are a couple more over-priced bulk items I found:
(I was careful to compare the same chemical - I didn’t compare ultra-concentrate to regular, I only compared different sized containers of the exact same product.)

Detergent
Gain 2xConcentrate - 100oz for $10.00 (so every 50oz should cost $5, but wait)
Gain 2xConcentrate - 150oz for $15.97 (They’re sneaking in an extra 32 cents per 50oz)

Dish Washing Soap
Palmolive Original - 16oz for $1.00 (If you bought three 16oz bottles you’d have 16 * 3 = 48oz for only $3)
Palmolive Original - 38oz for $3.48 (But Walmart will sell you only 38oz for $3.48. That’s 10oz less for an extra 48 cents.)

Paper Towels
This one’s a little more difficult because I had to break this product down by price per sheet, that’s because the paper towel 2-pack had 144 sheets per roll, and the 8-pack had 84 sheets per roll - I think that’s another trick they use to keep us from figuring out they’re overcharging us for bulk items. I multiplied the number of rolls by the sheets per roll, and divided the price by the number of sheets:

Bounty one-ply 2-pack (w/ 144 sheets per roll ) $2.84/(2 * 144) = .009 per sheet
Bounty one-ply 8-pack (w/ 84 sheets per roll) $8.86/(8 * 84) = .013 per sheet

That doesn’t look like much until you multiply it back out. If I bought the same amount paper towels by buying the 2-pack and by buying the 8-pack. (2016 is the least common multiple)
7 2-packs = 2016 sheets = $19.88
3 8-packs = 2016 sheets = $26.58

That’s almost $7 more for the
exact same quantity if you buy in bulk.

And yes I will use 2016 paper towels - remember this all started over a poopy diaper explosion.

The Bad News

Walmart keeps switching which products they overcharge you for. When I first noticed they were overcharging for bulk, it was for bulk All laundry detergent. By the time I went back to Walmart with paper, pen, and calculator, they had fixed the price of All but now they were overcharging for Gain. That means we have to keep a close watch on what they’re charging us.

***************************
For those of you who like statistics, here’s how I conducted my survey:

I sampled 15 items from the two isles in Walmart’s food section that didn’t have the orange price-per-ounce sticker. I sampled no more than two items in one category (for example, I picked two laundry detergents, two dish soaps, etc). The only exception was for paper towels. Since the math was more involved, I sampled three different products, two by the same brand, Bounty.

I actually found 4 overpriced bulk items, but two were Bounty paper towels and I didn’t want to include two price breakdowns for paper towels (The results of the other Bounty paper towel comparison were: For two-ply paper towel packages, the 8-pack was the most expensive, the 6-pack was the least expensive, and the 2-pack was in between)
***************************

Next, I’m going to check out the pharmacy section to see if Walmart is over charging for bulk items like shaving cream and shampoo.

No wonder Walmart is doing so well even though the rest of the country is struggling. When consumers are trying to save money, most of us buy bulk, but apparently that might not be the best decision.

Walmart, you have one week to hire someone who knows how to use a calculator.

4 Comments

Dumb Parents

Fatherhood

5 Parenting Mistakes Tips:

  1. Don’t put your kid to sleep with talking books. (Last night my daughter fell asleep looking at a push-n-play book based on Disney’s Aladdin. She rolled over on the button that made the sound of Jafar’s evil laugh, which played over and over and over until she woke up screaming.)
  2. Don’t give your kid six boxes of apple juice in one day. (Apparently, apple juice is a laxative.)
  3. Never read the story “Five Silly Monkeys Jumping on the Bed” to your kids. (Whenever I catch my son jumping on the bed, he’s giggling and reciting that story.)
  4. Don’t take your eyes off a one-year-old with play-doh. (My daughter’s poop came out neon green.)
  5. Don’t teach a two year old the word “penis.” (Yes it’s the medically correct word, but it’s still pretty embarrassing when you’re at church and your son says, “I have a little penis, and daddy has a big *clasp hand over son’s mouth* .”)
1 Comment

Putt the Spark back in your Plugs

Car Repair, Fatherhood

Dedication

I’d like to dedicate this post to my dad, and to my grandpa, and to all the Royal men throughout history who always had to fix their own cars because they were poor.

The Symptoms

  1. It had been a couple years since I changed my spark plugs, so I’d been planning on changing them for a while. In fact, I actually bought new plugs and wires when I wrote Is It Worth It: The Oil Change.
  2. My car had been a bit sluggish for a while. Granted my car is 13 years old, but it’s a Toyota, and it’s hasn’t quit on me, so I’m not giving up on it.

Assemble the right tools

If you’re new to my blog, you should know these three tools are a long standing tradition in my house. See my Proof that washing machines eat socks for another experience the good Dr. got me through.

And, if you’ve achieved “SuperDad” status, don’t forget to strut.

You’ll notice that I went with the two-liter Dr. Pepper this time. That’s because auto repairs usually turn out to be a bigger job than you originally planned on. The book I chose was Burning Angel by James Lee Burke.

Side Note on James Lee Burke

Any writer who wants to see a brilliant example of how to create Setting should read Burke. I’ve read about a dozen books by him, and I’m almost ready to believe that Louisiana really exists.

Honestly, he’s good. I usually enjoy his mysteries, but Burning Angel is not one of his best.

Car Repair Gets Ugly

The first 3 plugs came out without any problems. And the plugs were all worn out, which was encouraging because that meant my diagnosis was correct. But when I pulled the fourth plug out, it was covered in oil. Crap. Time to refill my soda.

I pulled my valve cover off (four nuts and two bolts all right on top of the cover, so pretty easy), and saw the rubber ring on that plug’s tube was cracked. $3 at Autozone. Awesome. Time to refill my soda (a celebratory glass this time).

The Only Useful Part of This Post:

If you take your valve cover off, one helpful hint is that the washers under the nuts have a rubber center. The rubber fits snugly over the bolt, so they help keep the oil in . . . they also make it almost impossible to remove the valve cover while they are still on the bolts. I didn’t realized this, and since my valve cover was covered in dirt, I couldn’t tell the washers were any different than the cover. So I wasted a lot of time trying to pull the valve cover off before I discovered the rubber washers.

The Explosion

Well . . . I hope not. But I have to wait 24 hours for the RTV sealant to cure before I can start my car. If you don’t hear from me by of the end of the week I might be chatting with some of my poor Royal ancestors.

Before and After

No Comments

Does PBS Hate White Men?

The Man

Super Readers and Sid the Science Kid are a couple cartoons I occasionally watch with my kids. This morning, I noticed something interesting.

Can you find the white male in the picture below?
Can you find the white male?

Why does the white male have to be a pig?

What about this one?

Okay, this one isn’t as obvious, you have to watch the show before you see PBS’s true feelings about The Man. For example, this morning Sid (the lead character) asked Gerald (the representative white male) if he would eat a rotting banana (the show was exploring decomposition). Gerald’s response was to try and eat Sid’s microphone.

In every episode Gerald does at least one thing that makes him look like a complete idiot. The other characters are, of course, all intelligent young kids.

Now, there might be some truth to the images in these cartoons, but I’d much rather have my kids learn that the old fashioned way. I don’t need PBS to teach my kids white men can . . . occasionally . . . be stupid, or piggish, or both.

1 Comment

Don’t Be a Linux Jerk

Linux

Computer geeks can be kind of jerky sometimes, so here’s a suggestion for Linux etiquette.

If someone asks a question in a forum, don’t do either of these:

1) Tell them to “read the manual”
I had a simple question about the tar utility and while digging around in a Linux forum I found a reply to a similar question which basically said, “Go read the manual.” After I found GNU’s manual (the Linux jerk poweruser didn’t even give a link) I discovered it was almost 300 pages. >: (

2) Tell them to Google it
Today I typed “add Java to PATH Linux” into Google, and in one of the top results was a forum where someone had asked the same question, and the Linux jerk poweruser’s advice was to Google “add Java to PATH Linux” >:(

Of course that ruined Google’s indexing thereby making the search phrase a little less meaningful (now you know one of Google’s weaknesses)

Here’s my first rule for How not to be a Linux Jerk:
If you aren’t in the mood to actually answer the question, don’t.

No Comments
« Older Posts