- How do I start using vim?
If you have a text file called MyDoc.txt, enter the following command in the terminal prompt:
vim MyDoc.txt - How do I start inserting text?
Press the "esc" button and then press the "i" button. Start typing your text. - How do I move the cursor around?
Use the arrow keys. - How do I quit vi?
Press the "esc" button and then type :q - How do I quit vi without saving the file?
Press the "esc" button and then type :q! - How do I save a file?
Press the "esc" button and then type :w - How do I undo my changes?
Press the "esc" button and then press the "u" button. - How do I redo my changes?
Press the "esc" button. Then hold the "control" button down while pressing the "r" button (Ctrl+r). - How do I delete text?
Press the "esc" button and then press the "x" button. Press the "x" button again to delete the next letter. - How do I search?
If you are searching for the text "findme", press the "esc" button and then type /findme - How do I find next after search?
Press the "esc" button and then press the "n" button. - How do I replace?
If you want to replace the text "findme" with "replacedme", first move to the line with the text "findme". Press the "esc" button then type :s/findme/replacedme/ - How do I replace all?
Press the "esc" button and type type :1,$s/findme/replacedme/g
1,$ means "From line 1 to the end of the file" (I remember $ with the mnemonic "cash out last")
s means substitute
g means globally
"From line 1 to the end of file, substitute findme with replacedme globally" - Where can I learn more about vim without being overwhelmed?
Vi Editor Reference Manual
SyntaxHighlighter JS
2013-02-20
15 minutes of vim
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment