Difference between revisions of "VIM"

From John Freier
Jump to: navigation, search
(Windows)
Line 40: Line 40:
 
'''Switch''' between windows.  The arrow key or direction key you want to go to.
 
'''Switch''' between windows.  The arrow key or direction key you want to go to.
 
   ctrl+w {arrow key} or {h,j,k,l}
 
   ctrl+w {arrow key} or {h,j,k,l}
 +
 +
Opens a new vertical split
 +
  CTRL+w, v
 +
 +
Opens a new horizontal split
 +
  CTRL+w, s
 +
 +
Closes a window but keeps the buffer
 +
  CTRL+w, c
 +
 +
Closes other windows, keeps the active window only
 +
  CTRL+w, o
 +
 +
Moves the current window to the right
 +
  CTRL+w, r
 +
 +
Makes all splits equal size
 +
  CTRL+w, =
  
 
== Show Whitespace ==
 
== Show Whitespace ==

Revision as of 12:53, 9 September 2022

Syntax Highlighting

Inside VI type the command below.

:syntax on

Maybe

:syn on

Bottom Page

This goes to the bottom of the page.

G

Bookmarks

To bookmark a position press m and then a letter. Use capital letter for Global or multiple files.

 ma

To go to the bookmark press ` and then letter marking you want to go to.

 `a

To see all your bookmarks.

 :marks

To to last edit location.

 `.



Record

To record a set of keys press q and then a letter to record to.

 qa

To play back the recording press @ and then letter marking you want to play back.

 @a


Windows

Switch between windows. The arrow key or direction key you want to go to.

 ctrl+w {arrow key} or {h,j,k,l}

Opens a new vertical split

 CTRL+w, v

Opens a new horizontal split

 CTRL+w, s

Closes a window but keeps the buffer

 CTRL+w, c

Closes other windows, keeps the active window only

 CTRL+w, o

Moves the current window to the right

 CTRL+w, r

Makes all splits equal size

 CTRL+w, =

Show Whitespace

This will show all whitespace char

 set list

You can also show only select char.

 :set listchars=eol:$,tab:>-,trail:~

Spelling

To turn spell checker on.

 :set spell spelllang=en_us

To turn spell checker off.

 :set nospell

To move between misspelled words.

 ]s and [s

To get misspelled recommendations, move in misspelled word and press.

 z=

To add word to dictionary.

 zg

To mark a word as incorrect

 zw


Autocomplete

This autocomplete tries to match word already in the document.

 ctl+n or ctl+p