Question:
What is the command in vi to edit?
Jorge
2007-12-02 15:00:53 UTC
what is the command so i can just backspace, type, do what ever where the cursor is???

not a,

and if your feeling frisky, what are just the basic commands

Thanks
Three answers:
Robin T
2007-12-02 15:32:16 UTC
- To start editing from where the cursor is: i

- To create a new line below the line where the cursor is and start editing: o

- To create a new line above the line where the cursor is and start editing: O (upper case o)



Below are some commands that I think most commonly used. You need to be in command mode (from editing mode, punch the [Esc] button).



To make the cursor go to:

- start of the line: 0 (the number zero)

- end of the line: $

- start of next word: w

- start of previous word: b

- first line of the file: gg

- last line of the file: G

- line number x: :x (colon followed by the line number. e.g.: ':12' will bring the cursor to line 12).

- left, right, up, down you can just use the arrow



- To undo the last change: u (you can undo multiple times)

- To redo: [CTRL] r



- To delete one character: x

- to delete one word: dw

- to delete one line: dd
2007-12-02 23:12:54 UTC
press the escape key, followed by the letter "i" to insert.



press the escape key, followed by the letter "a" to append to the end of some text.



escape x, to delete.



vi is a very difficult editor to learn, but is also very powerful.
2007-12-02 23:04:05 UTC
Go and find a quick reference sheet to print out. vi is completely horrible and non obvious.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...