vim

General

Blocks

  <                     Moves the block one tab to the left
  <<                    Moves the current line one tab to the left
  >                     Moves the block one tab to the right
  >>                    Moves the current line one tab to the right
  ==                    Autoindents the block
  <ctrl>+v              Mark a block line by line
  <shift>+<ctrl>+v      Mark a block per column
                        I     Insert text at each line of the block
                        :I    Autoincrement the marked numbers with left align
                        :II   Autoincrement the marked numbers with right align
                        :B    To substitute in the block only type :B s/a/b/

Buffers

  :n                    Next buffer
  :N                    Previous buffer
  :ls                   Lists all available buffers
  :buffer n             Jumps to buffer n
  :e file               Replaces the current buffer with file
  :arge file            Opens a new buffer for file
  " letter              Sets the name of the buffer to letter
                        * Is the name of the X11 clipboard
                        % Is the current filename
  !cmd                  When a buffer is marked it gets filtered through cmd

Buffer explorer

  \be                   Opens the buffer explorer in a full window
  \bs                   Opens the buffer explorer in a split window

Folding

  zc                    Close fold
  zd                    Delete folding
  zf                    New folding
  zM                    Close all folds
  zo                    Open fold
  zR                    Open all folds

Marker

  m<letter>            Sets a marker with the name letter
  '<letter>            Jumps to a marker with the name letter

Misc

  :r file               Inserts file at the current position
  :r !cmd               Inserts the output of cmd at the current position
  ga                    Show current characters ASCII value
  g <ctrl>+g            Show current cursor position
  <ctrl>+x <ctrl+f>     Filename completion at the current position
  <ctrl>+k <uml>:       To enter an umlaut press <ctrl>+k, the regular letter
                        and ':'
  <ctrl>+v <num>        Inserts the ASCII character <num>

Modification commands

  c                     Cut
  gq                    Formats the current line
  guaw                  Convert current word to lowercase
  gUaw                  Convert current word to uppercase
  gu                    Convert to lowercase
  gU                    Convert to uppercase
  guu                   Convert current line to lowercase
  gUU                   Convert current line to uppercase
  ~                     Switch case of the character under the cursor
  <visual> u            Convert visual block to lowercase
  <visual> U            Convert visual block to uppercase
  y                     Yank

Movement

  b                     The word on the left side of the cursor
  e                     The end of the word
  w                     The word on the right side of the cursor
  )                     Jump forward one sentence
  (                     Jump backward one sentence
  }                     Jump forward one paragraph
  {                     Jump backward one paragraph
  H                     Jump to the top of the display
  M                     Jump to the middle of the display
  L                     Jump to the bottom of the display
  'm                    Jump to the beginning of the line of mark m
  `m                    Jump to the location of mark m
  gd                    Jump to the declaration of a local variable
  gD                    Jump to the declaration of a global variable
  G                     Jump to end of file
  1G                    Jump to beginning of file
  ''                    Return to the line where the cursor was before the
                        latest jump
  ``                    Return to the cursor position before the latest jump
                        (undo the jump).
  %                     Jump to corresponding item, e.g. from an open brace to
                        its matching closing brace
  t char                Everything from the cursor position to char
                        exclusive the char
  f char                Everything from the cursor position to char
                        inclusive the char
  *                     Forward search the word under the cursor
  #                     Backward search the word under the cursor

Recording

  qq                    Start recording
  q                     Stop recording
  @q                    Replay the recorded stuff
  \c                    If \c is in a searchpattern the pattern is handled
                        case insensitive

Split

  :split                Splits the current window
  :split file           Opens a new window with file
  :split <ctrl>+f <ctrl>+r
                        Opens a new window with the word under the cursor as
                        file
  :resize +/-n          Enlarges/reduces the current window by n lines
  :q                    Close the current window
  <ctrl>+W up/down      Jumps to window above/below
  zz                    Center current line in window

Special stuff

C help

  \ch                   Get help for word under cursor
  \chc:                 Jump to table of contents of the C-reference manual
  \chp:                 Prompt for word

CVS

  \ca                   CVS add
  \cc                   CVS commit
  \cd                   CVS diff
  \ce                   CVS edit
  \ci                   CVS editors
  \cl                   CVS log
  \cn                   CVS annotate
  \cr                   CVS review
  \cs                   CVS status
  \ct                   CVS unedit
  \cu                   CVS update
  \cv                   CVS vim diff
  \cwa                  CVS watch add
  \cwa                  CVS watch off
  \cwn                  CVS watch on
  \cwr                  CVS watch remove
  \cwv                  CVS watchers

DrawIt

  \di                   Start DrawIt
  \ds                   Stop DrawIt

  <lefopy the msgid string to msgstr                           <S-F3>       
  <right>               Move and draw right, inserting lines/space as needed
  <up>                  Move and draw up, inserting lines/space as needed
  <down>                Move and draw down, inserting lines/space as needed
  <s-left>              Move left
  <s-right>             Move right, inserting lines/space as needed
  <s-up>                Move up, inserting lines/space as needed
  <s-down>              Move down, inserting lines/space as needed
  <space>               Toggle into and out of erase mode
  >                     Draw -> arrow
  <                     Draw <- arrow
  ^                     Draw ^  arrow
  v                     Draw v  arrow
  <pgdn>                Replace with a \, move down and right, and insert a \
  <end>                 Replace with a /, move down and left,  and insert a /
  <pgup>                Replace with a /, move up   and right, and insert a /
  <home>                Replace with a \, move up   and left,  and insert a \
  \>                    Draw fat -> arrow
  ve to an untransl. string backward                   <S-F2>       
  \<                    Draw fat <- arrow
  \^                    Draw fat ^  arrow
  \v                    Draw fat v  arrow
  \a                    Draw arrow based on corners of visual-block
  \b                    Draw box using visual-block selected region
  \e                    Draw an ellipse inside visual-block
  \f                    Fill a figure with some character
  \h                    Create a canvas for \a \b \e \l
  \l                    Draw line based on corners of visual block
  \s                    Adds spaces to canvas 

PO

Move to an untransl. string forward                       <S-F1>
Move to an untransl. string forward                       <S-F1>

ve to the next fuzzy translation                          <S-F5>
ve topy the msgid string to msgstr                        <S-F3>
how msgfmt statistics for the file (UNIX)                 <S-F11>

Spec

  <F9>                  Insert a function description at the cutring                                         <S-F4>       rent position
                        (must be in insert mode already)
  <F10>                 Open/close the Tlist window

Spellchecking

  \ss                   write file, spellcheck & highlight spelling mistakes
  \sl                   switch between languages
  \sq                   return to normal syntax coloring
  \sn                   go to next error.
  \sp                   go to previous error.
  \si                   insert word under cursor into directory
  \su                   insert word under cursor as lowercase into directory
  \sa                   accept word for this session only
  \s?                   check for alternatives

MRU list

  \r                    Opens the list of most recently used files

Swap two words

  <ctrl>+w              For example, to swap "apple" and "orange" in the line 
                        below:
                        int apple, lemon, orange;
                        1. Delete "apple", using e.g. diw or df<space>
                        2. Visually select "orange"
                        3. Press <ctrl>+w
 
harry/vim.txt · Last modified: 2006/03/17 11:25 (external edit)
Locations of visitors to this page

 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki