This is the first push to this repo with my dotfiles
[dotfilesold/.git] / vimusage.txt
1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2                                Lesson 1 SUMMARY
3
4
5   1. The cursor is moved using either the arrow keys or the hjkl keys.
6          h (left)       j (down)       k (up)       l (right)
7
8   2. To start Vim from the shell prompt type:  vim FILENAME <ENTER>
9
10   3. To exit Vim type:     <ESC>   :q!   <ENTER>  to trash all changes.
11              OR type:      <ESC>   :wq   <ENTER>  to save the changes.
12
13   4. To delete the character at the cursor type:  x
14
15   5. To insert or append text type:
16          i   type inserted text   <ESC>         insert before the cursor
17          A   type appended text   <ESC>         append after the line
18
19 NOTE: Pressing <ESC> will place you in Normal mode or will cancel
20       an unwanted and partially completed command.
21
22 Now continue with lesson 2.
23
24 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26                                Lesson 2 SUMMARY
27
28
29   1. To delete from the cursor up to the next word type:    dw
30   2. To delete from the cursor to the end of a line type:    d$
31   3. To delete a whole line type:    dd
32
33   4. To repeat a motion prepend it with a number:   2w
34   5. The format for a change command is:
35                operator   [number]   motion
36      where:
37        operator - is what to do, such as  d  for delete
38        [number] - is an optional count to repeat the motion
39        motion   - moves over the text to operate on, such as  w (word),
40                   $ (to the end of line), etc.
41
42   6. To move to the start of the line use a zero:  0
43
44   7. To undo previous actions, type:           u  (lowercase u)
45      To undo all the changes on a line, type:  U  (capital U)
46      To undo the undo's, type:                 CTRL-R
47
48 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50                                Lesson 3 SUMMARY
51
52
53   1. To put back text that has just been deleted, type   p .  This puts the
54      deleted text AFTER the cursor (if a line was deleted it will go on the
55      line below the cursor).
56
57   2. To replace the character under the cursor, type   r   and then the
58      character you want to have there.
59
60   3. The change operator allows you to change from the cursor to where the
61      motion takes you.  eg. Type  ce  to change from the cursor to the end of
62      the word,  c$  to change to the end of a line.
63
64   4. The format for change is:
65
66          c   [number]   motion
67
68 Now go on to the next lesson.
69
70
71
72 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74                                Lesson 4 SUMMARY
75
76
77   1. CTRL-G  displays your location in the file and the file status.
78              G  moves to the end of the file.
79      number  G  moves to that line number.
80             gg  moves to the first line.
81
82   2. Typing  /  followed by a phrase searches FORWARD for the phrase.
83      Typing  ?  followed by a phrase searches BACKWARD for the phrase.
84      After a search type  n  to find the next occurrence in the same direction
85      or  N  to search in the opposite direction.
86      CTRL-O takes you back to older positions, CTRL-I to newer positions.
87
88   3. Typing  %  while the cursor is on a (,),[,],{, or } goes to its match.
89
90   4. To substitute new for the first old in a line type    :s/old/new
91      To substitute new for all 'old's on a line type       :s/old/new/g
92      To substitute phrases between two line #'s type       :#,#s/old/new/g
93      To substitute all occurrences in the file type        :%s/old/new/g
94      To ask for confirmation each time add 'c'             :%s/old/new/gc
95
96 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98                                Lesson 5 SUMMARY
99
100
101   1.  :!command  executes an external command.
102
103       Some useful examples are:
104          (Windows)        (Unix)
105           :!dir            :!ls            -  shows a directory listing.
106           :!del FILENAME   :!rm FILENAME   -  removes file FILENAME.
107
108   2.  :w FILENAME  writes the current Vim file to disk with name FILENAME.
109
110   3.  v  motion  :w FILENAME  saves the Visually selected lines in file
111       FILENAME.
112
113   4.  :r FILENAME  retrieves disk file FILENAME and puts it below the
114       cursor position.
115
116   5.  :r !dir  reads the output of the dir command and puts it below the
117       cursor position.
118
119
120 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
121 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
122                                Lesson 6 SUMMARY
123
124   1. Type  o  to open a line BELOW the cursor and start Insert mode.
125      Type  O  to open a line ABOVE the cursor.
126
127   2. Type  a  to insert text AFTER the cursor.
128      Type  A  to insert text after the end of the line.
129
130   3. The  e  command moves to the end of a word.
131
132   4. The  y  operator yanks (copies) text,  p  puts (pastes) it.
133
134   5. Typing a capital  R  enters Replace mode until  <ESC>  is pressed.
135
136   6. Typing ":set xxx" sets the option "xxx".  Some options are:
137         'ic' 'ignorecase'       ignore upper/lower case when searching
138         'is' 'incsearch'        show partial matches for a search phrase
139         'hls' 'hlsearch'        highlight all matching phrases
140      You can either use the long or the short option name.
141
142   7. Prepend "no" to switch an option off:   :set noic
143
144 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
146                                Lesson 7 SUMMARY
147
148
149   1. Type  :help  or press <F1> or <HELP>  to open a help window.
150
151   2. Type  :help cmd  to find help on  cmd .
152
153   3. Type  CTRL-W CTRL-W  to jump to another window.
154
155   4. Type  :q  to close the help window.
156
157   5. Create a vimrc startup script to keep your preferred settings.
158
159   6. When typing a  :  command, press CTRL-D to see possible completions.
160      Press <TAB> to use one completion.
161
162
163
164
165
166
167