Hokey Pokey

The question I have is with the "vi" editor.

The 'vi" paste feature is not doing what I want it to do.

The "p" wants to paste after a line.
The "P" wants to paste before a line.

I want to put my cursor on a line and paste and overwrite all the text on that line.

What do I need to do to make this happen?

PS: Do I need to do the hokey pokey and turn myself around to make this happen or what???
 
Hi,

"ddP" will do what you want.

BSD distributions used to come from Berkeley with a vi tutorial titled "An Introduction to Display Editing with Vi" by Bill Joy, et. al. Suggest you google it and then spend an afternoon practising.

Cheers,
 
gpw928 said:
Hi,

"ddP" will do what you want.

BSD distributions used to come from Berkeley with a vi tutorial titled "An Introduction to Display Editing with Vi" by Bill Joy, et. al. Suggest you google it and then spend an afternoon practising.

Cheers,

I think you misunderstood what I stated (above). I have some text on line 1. I type "yy" to copy it. I move my cursor down to line 5 and want to paste it right over the text that is on line 5.

How do I do it?

Again...
I want to OVERWRITE line 5 with line 1. I DO NOT want to delete the data on line 5 before I paste line 1. I want to OVERWRITE line 5.

I DO NOT want to paste it above or below line 5.
 
Hokey is in the eye of the beholder.

There are no primitives in vi to do exactly what you ask with a single command.

However there are many satisfactory ways of achieving the desired outcome.

Your proposal above will only work if line 5 is the last in the file.

One precise solution is "1GY5Gp-dd".

Cheers.
 
gpw928 said:
Hokey is in the eye of the beholder.

There are no primitives in vi to do exactly what you ask with a single command.

However there are many satisfactory ways of achieving the desired outcome.

Your proposal above will only work if line 5 is the last in the file.

One precise solution is "1GY5Gp-dd".

Cheers.

I can't believe what you have to type in order overwrite a line in the "vi" editor. I feel like we're doing morse code. You have to remember something. The "vi" editor was made when the hippies were coming off a decade of drugs. Bill Joy was on acid when he created it in 1976.
 
Niatross said:
I can't believe what you have to type in order overwrite a line in the "vi" editor. I feel like we're doing morse code. You have to remember something. The "vi" editor was made when the hippies were coming off a decade of drugs. Bill Joy was on acid when he created it in 1976.

Code:
map pp p-dd

Then use pp to overwrite the line.

Stick that in whatever .config file your version of vi/vim uses
 
Back
Top