LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   vi question (https://www.linuxquestions.org/questions/linux-software-2/vi-question-65751/)

IamDaniel 06-15-2003 12:42 PM

vi question
 
I am wonder how to do the following:

Assume that I wanna copy a line of text and paste it in the 'n' line, but in the middle of the sentence, the problem is that every time I paste, it just pasted in the new line, instead the current cursor.

which like the following format:
Code:


//I use 'yy' to copy the following line
//and paste with 'p'
I am in problem,
this is annoying when thing not in control
this is annoying when thing not in control

//instead, I want it like this
I am in problem, this is annoying when thing not in control :(

This also raise me a second question:

The backspace is supposed to be:
Code:

1  I am in problem, this is annoying when thing <------
                                                      |
2  not in control  -----------------------------------

how to make the second line resume in the word 'thing'

Qzukk 06-15-2003 01:00 PM

The problem is that the "yy" command copies an entire line, including the linebreaks. Try moving the cursor to the start of the line, and pressing "y$" to copy from the cursor to the end of the line. This command does not include the line breaks.

moses 06-15-2003 01:55 PM

"J" joins lines, so you could place your cursor on the first line and hit "J" and it will remove whitespace until there is only one space between "thing" and "not".
You have to remember that vi works on lines, so when there is a break between lines, a backspace will not go from one line to the previous. (I think this has been changed in newer versions of vi, but I'm not sure, maybe vim or gvim)


All times are GMT -5. The time now is 08:30 AM.