Operating System - HP-UX
1752796 Members
6013 Online
108789 Solutions
New Discussion юеВ

Re: A Really Embarassing vi Question

 
SOLVED
Go to solution
Michael Mike Reaser
Valued Contributor

A Really Embarassing vi Question

I've used vi for well over 20 years since I was first presented with an HP9000/S300 workstation on my desk in early 1988, and I've just been asked a question that's got me stumped:

What is the difference between "b" and "B", and "w" and "W", for single-word movement (backwards and forwards, respectively) around the file being edited?

I've read and re-read the man page for vi, and honestly, I have no idea. I've always used the lowercase versions of both commands and never worried about the capitalized versions - if I needed to move forward a word or three, I just hit "w" one or more times, and if I needed to move backwards, I used "b".

I'm trying to give my vi-newbie cow-orkers some hints and guidance on vi, and they've buffaloed me with this.

Could some kind soul smack me up-side the head with a Clue-By-Four and tell me what I'm missing?
There's no place like 127.0.0.1

HP-Server-Literate since 1979
5 REPLIES 5
Pete Randall
Outstanding Contributor
Solution

Re: A Really Embarassing vi Question

The capitalized version of both commands ignore punctuation.


Pete

Pete
James R. Ferguson
Acclaimed Contributor

Re: A Really Embarassing vi Question

Hi Mike:

Have a look at this:

http://www.cs.rit.edu/~cslab/vi.html

Regards!

...JRF...
gstonian
Trusted Contributor

Re: A Really Embarassing vi Question

B & W will ignore punctuation characters like " etc.

b & w will incorporate these characters when jumping to the next mark
Michael Mike Reaser
Valued Contributor

Re: A Really Embarassing vi Question

To Pete, JRF and gstonian, THANK YOU! I knew that I had to be Missing Something Really Obvious, and the bit about punctuation was it.

Which also explains why I've used the lowercase versions of these commands for forever-and-a-day. :-)

Again, thanks for the quick answers!!!
There's no place like 127.0.0.1

HP-Server-Literate since 1979
Dennis Handly
Acclaimed Contributor

Re: A Really Embarassing vi Question

>What is the difference between "b" and "B", and "w" and "W", for single-word

You might want to try it to see how far it moves. vi(1) says B/W move to a space delimited word.

>Which also explains why I've used the lowercase versions of these commands for forever-and-a-day. :-)

If you put a number in front, you could move faster. Or if you have unique chars, you can use "f" then char to move forward. And ";" to repeat.