Actions

Difference between revisions of "Visual Editor (VI)"

From kemiko

 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
  
 
Using a document containing several pages helps show vi's power.  Using the sentence "[https://en.wikipedia.org/wiki/The_quick_brown_fox_jumps_over_the_lazy_dog The quick brown fox jumps over the lazy dog]" to practice your typing with VI is fun because it has all the letters in one sentence.
 
Using a document containing several pages helps show vi's power.  Using the sentence "[https://en.wikipedia.org/wiki/The_quick_brown_fox_jumps_over_the_lazy_dog The quick brown fox jumps over the lazy dog]" to practice your typing with VI is fun because it has all the letters in one sentence.
 +
  
 
Some of my favorite commands are below:
 
Some of my favorite commands are below:
Line 11: Line 12:
 
Jump to a specific column
 
Jump to a specific column
 
* <number>|
 
* <number>|
Jump to opening/closing parenthesis when cursor is sitting on one of them
+
Jump to opening/closing parenthesis and brackets...(),{},[]...when cursor is sitting on one of them
 
* %
 
* %
 
Jump to the beginning of line
 
Jump to the beginning of line
Line 17: Line 18:
 
Jump to the end of line
 
Jump to the end of line
 
* $
 
* $
 +
  
 
'''Display''':
 
'''Display''':
Line 26: Line 28:
 
Show hidden characters
 
Show hidden characters
 
* :set list
 
* :set list
 +
  
 
'''Delete/Copy/Paste/Edit''':
 
'''Delete/Copy/Paste/Edit''':
Line 43: Line 46:
 
Redo
 
Redo
 
* <ctrl>r
 
* <ctrl>r
 +
  
 
'''Search''':
 
'''Search''':
Line 54: Line 58:
 
Previous match of search
 
Previous match of search
 
* N
 
* N
 +
Case insensitive search
 +
* \c<pattern>
 +
  
 
'''Tips/Tricks''':
 
'''Tips/Tricks''':
Us undo to jump back to where you were editing, then redo to get back to the same change
+
Use undo to jump back to where you were editing, then redo to get back to the same change
 
* u
 
* u
 
* <ctrl>r
 
* <ctrl>r
 
Repeat the same command
 
Repeat the same command
 
* .
 
* .
 +
If your terminal's suspend key is set correctly...go back to shell...do stuff...and return
 +
* <ctrl>z
 +
* fg
 +
While in vi sort the contents
 +
* :sort

Latest revision as of 10:54, 25 January 2017

Visual Editor


I love the vi editor. Many do not like it because of vi's large learning curve. It is well worth the time and effort need to learn it. vi is very powerful and will save a lot of time in the end. It can do many things that standard editor can and can not do...like edit text documents with a terminal, regular expressions, macros, show hidden characters, show line numbers, pairing brackets/parenthesis, etc, etc.

Using a document containing several pages helps show vi's power. Using the sentence "The quick brown fox jumps over the lazy dog" to practice your typing with VI is fun because it has all the letters in one sentence.


Some of my favorite commands are below:

Jump to a specific line

  • <number>G or <number>gg

Jump to a specific column

  • <number>|

Jump to opening/closing parenthesis and brackets...(),{},[]...when cursor is sitting on one of them

  •  %

Jump to the beginning of line

  • 0

Jump to the end of line

  • $


Display:

Move the cursor's line to the top of the editor

  • z<enter>

Show line numbers

  •  :set number

Show hidden characters

  •  :set list


Delete/Copy/Paste/Edit:

Delete word (what you delete/copy is automatically put in your buffer...if you want to paste somewhere else)

  • dw

Yank/copy word

  • yw

Delete entire line

  • D or dd

Paste before

  • P

Paste after

  • p

Undo

  • u

Redo

  • <ctrl>r


Search:

Forward search

  • /<pattern>

Backward search

  •  ?<pattern>

Next match of search

  • n

Previous match of search

  • N

Case insensitive search

  • \c<pattern>


Tips/Tricks: Use undo to jump back to where you were editing, then redo to get back to the same change

  • u
  • <ctrl>r

Repeat the same command

  • .

If your terminal's suspend key is set correctly...go back to shell...do stuff...and return

  • <ctrl>z
  • fg

While in vi sort the contents

  •  :sort