Why am I learning to use vim?
- I am tired of buying text editor licenses & having the new version never come out
- Vim is installed on every *nix computer
- Vim is free
*the repeater all commands can be prepended with a number of times to do the command
- h = left 1 char
- j = up 1 line
- k = down 1 line
- l = right 1 char
- w = forward 1 word
- W = forward whole word. ex first-second is treated as 1 word
- b = back 1 word
- B = back whole word. ex first-second is treated as 1 word
- $ = end of line
- ^ = first non-whitespace char
- 0 = first space in line
- gg = beginning of the file
- G = last line of file
- #gg or #G or :# = moves down to line #
- { = previous paragraph
- } = next paragraph
- f<char> = finds next instance of char in the line & moves cursor there
- F<char> = finds previous instance of char in the line & moves cursor 1 space before
- t<char> = finds next instance of char in the line & moves cursor there
- T<char> = finds previous instance of char in the line & moves cursor 1 space before
- x = delete char
- u = undo
- dw = delete word forward
- db = delete word backwards
- cw = delete word forward & enter insert mode
- dd = delete whole line
- dj = delete current line and line below
- cc = delete whole line & enter insert mode
- ct<char> = delete everything between cursor & char &enter insert mode
- ci<delemiter> = delete everything between the delimiter. valid are "'{[(
- ca<delemiter> = delete the delimiter and everything inbetween. valid are "'{[(
- p = paste in the char after cursor
- P = paste at the cursor location
- yw = copy word
- yy = copy line
- y0 = copy from current cursor to the beginning of the line
- x = delete char at cursor
- X = delete char before cursor
- /<search term> = searches for the next instance of the search term in the file. case sensitive & loops back to top
- n = next result moving down
- N = next result moving up
- ?<search term> = searches for the previous instance of the search term in the file. case sensitive & loops back to bottom
- n = next result moving up
- N = next result moving down
- d/<seatch term> = delete everything between cursor & search term
- c/<seatch term> = delete everything between cursor & search term & enter insert mode
- y/<seatch term> = copy everything between cursor & search term
- :w writes a file
- :q = exit
- :q! = exit & discard changes
- :x or :wq = save file & exit
- :<line number> = go to that line number
file to put vim settings into
- incsearch - enables incremental search
- ignorecase - makes search case insensitive
- hlsearch - highlight all search results
- nohlsearch - disables highlight search results