*intro.txt*     For IdeaVIM version 0.12.0.  Last change: 2006 Nov 12

                  IdeaVIM REFERENCE MANUAL    by Rick Maddy

Introduction to Vim                                     *ref* *reference*

1. Introduction                 |intro|
2. Vim on the internet          |internet|
3. Credits                      |credits|
4. Notation                     |notation|
5. Modes, introduction          |vim-modes-intro|
6. Switching from mode to mode  |mode-switching|
7. The window contents          |window-contents|
8. Definitions                  |definitions|

1. Introduction                                         *intro*

IdeaVIM is an attempt to replicate the features of Vim withing the context of
IntelliJ IDEA. Not all the functionality of Vim applies within IDEA. And not
all appropriate features are implemented.

An overview of this manual can be found in the file "help.txt", |help.txt|.
It can be accessed from within Vim with the <Help> or <F1> key and with the
|:help| command (just type ":help", without the bars or quotes).
   The 'helpfile' option can be set to the name of the help file, in case it
is not located in the default place.  You can jump to subjects like with tags:
Use CTRL-] to jump to a subject under the cursor, use CTRL-T to jump back.

Throughout this manual the differences between Vim and IdeaVIM are mentioned in
curly braces, like this: {IdeaVIM does not support this feature}.  See
|vi_diff.txt| for a summary of the differences between IdeaVIM and Vim.

This manual is a reference for all the IdeaVIM commands and options.  This is not
an introduction to the use of Vi or Vim, it gets a bit complicated here and
there.  To learn using Vim, read the user manual |usr_toc.txt|.

There are many books on Vi that contain a section for beginners.  There are
two books I can recommend:

        "Vim - Vi Improved" by Steve Oualline

This is the very first book completely dedicated to Vim.  It is very good for
beginners.  The most often used commands are explained with pictures and
examples.  The less often used commands are also explained, the more advanced
features are summarized.  There is a comprehensive index and a quick
reference.  Parts of this book have been included in the user manual
Published by New Riders Publishing.  ISBN: 0735710015
For more information try one of these:

        "Learning the Vi editor" by Linda Lamb and Arnold Robbins

This is a book about Vi that includes a chapter on Vim (in the sixth edition).
The first steps in Vi are explained very well.  The commands that Vim adds are
only briefly mentioned.  There is also a German translation.
Published by O'Reilly.  ISBN: 1-56592-426-6.

2. IdeaVIM on the internet                                  *internet*

                        *www* *faq* *FAQ* *distribution* *download*
IdeaVIM is hosted on SourceForge.

        IdeaVIM home page:

Bug reports:                            *bugs* *bug-reports* *bugreport.vim*

Bug reports and other requests can be made on SourceForge at

3. Credits                                              *credits* *author*

IdeaVIM was written by Rick Maddy <>.

Most of Vim was written by Bram Moolenaar.

Parts of the documentation come from several Vi manuals, written by:
        W.N. Joy
        Alan P.W. Hewett
        Mark Horton

The Vim editor is based on Stevie and includes (ideas from) other software,
worked on by the people mentioned here.  Other people helped by sending me
patches, suggestions and giving feedback about what is good and bad in Vim.

Vim would never have become what it is now, without the help of these people!

        Ron Aaron               Win32 GUI changes
        Zoltan Arpadffy         work on VMS port
        Tony Andrews            Stevie
        Gert van Antwerpen      changes for DJGPP on MS-DOS
        Berkeley DB(3)          ideas for swap file implementation
        Keith Bostic            Nvi
        Walter Briscoe          Makefile updates, various patches
        Ralf Brown              SPAWNO library for MS-DOS
        Robert Colon            many useful remarks
        Marcin Dalecki          GTK+ GUI port, toolbar icons, gettext()
        Kayhan Demirel          sent me news in Uganda
        Chris & John Downey     xvi (ideas for multi-windows version)
        Henk Elbers             first VMS port
        Eric Fischer            Mac port, 'cindent', and other improvements
        Benji Fisher            Answering lots of user questions
        Bill Foster             Athena GUI port
        Loic Grenie             xvim (ideas for multi windows version)
        Sven Guckes             Vim WWW page maintainer
        Darren Hiebert          Exuberant ctags
        Bruce Hunsaker          improvements for VMS port
        Andy Kahn               Cscope support, GTK+ GUI port
        Oezguer Kesim           Maintainer of Vim Mailing Lists
        Axel Kielhorn           work on the Macintosh port
        Steve Kirkendall        Elvis
        Roger Knobbe            original port to Windows NT
        Sergey Laskavy          Vim's help from Moscow
        Felix von Leitner       Maintainer of Vim Mailing Lists
        David Leonard           Port of Python extensions to Unix
        Avner Lottem            Edit in right-to-left windows
        Flemming Madsen         X11 client-server, various features and patches
        MicroSoft               Gave me a copy of DevStudio to compile Vim with
        Paul Moore              Python interface extensions, many patches
        Katsuhito Nagano        Work on multi-byte versions
        Sung-Hyun Nam           Work on multi-byte versions
        Vince Negri             Win32 GUI and generic console enhancements
        Steve Oualline          Author of the first Vim book |frombook|
        George V. Reilly        Win32 port, Win32 GUI start-off
        Stephen Riehm           bug collector
        Stefan Roemer           various patches and help to users
        Ralf Schandl            IBM OS/390 port
        Olaf Seibert            DICE and BeBox version, regexp improvements
        Mortaza Shiran          Farsi patches
        Peter da Silva          termlib
        Paul Slootman           OS/2 port
        Henry Spencer           regular expressions
        Dany St-Amant           Macintosh port
        Tim Thompson            Stevie
        G. R. (Fred) Walter     Stevie
        Sven Verdoolaege        Perl interface
        Robert Webb             Command-line completion, GUI versions, and
                                lots of patches
        Ingo Wilken             Tcl interface
        Mike Williams           PostScript printing
        Juergen Weigert         Lattice version, AUX improvements, UNIX and
                                MS-DOS ports, autoconf
        Stefan 'Sec' Zehl       Maintainer of

I wish to thank all the people that sent me bug reports and suggestions.  The
list is too long to mention them all here.  Vim would not be the same without
the ideas from all these people: They keep Vim alive!

In this documentation there are several references to other versions of Vi:
Vi      "the original".  Without further remarks this is the version
        of Vi that appeared in Sun OS 4.x.  ":version" returns
        "Version 3.7, 6/7/85".  Sometimes other versions are referred
        to.  Only runs under Unix.  Source code only available with a
        license.  More information on Vi can be found through:
Posix   From the IEEE standard 1003.2, Part 2: Shell and utilities.
        Generally known as "Posix".  This is a textual description of
        how Vi is supposed to work.
        The version used is a draft from beginning 1996, so all remarks are
        "expected to comply to" this.  Anything can change though...
Nvi     The "New" Vi.  The version of Vi that comes with BSD 4.4 and FreeBSD.
        Very good compatibility with the original Vi, with a few extensions.
        The version used is 1.79.  ":version" returns "Version 1.79
        (10/23/96)".  There has been no release the last few years, although
        there is a development version 1.81.
        Source code is freely available.
Elvis   Another Vi clone, made by Steve Kirkendall.  Very compact but isn't
        as flexible as Vim.
        The version used is 2.1.  It is still being developed.  Source code is
        freely available.

4. Notation                                             *notation*

When syntax highlighting is used to read this, text that is not typed
literally is often highlighted with the Special group.  These are items in [],
{} and <>, and CTRL-X.

Note that Vim uses all possible characters in commands.  Sometimes the [], {}
and <> are part of what you type, the context should make this clear.

[]              Characters in square brackets are optional.

                                                    *count* *[count]* *E489*
[count]         An optional number that may precede the command to multiply
                or iterate the command.  If no number is given, a count of one
                is used, unless otherwise noted.  Note that in this manual the
                [count] is not mentioned in the description of the command,
                but only in the explanation.  This was done to make the
                commands easier to look up.  If the 'showcmd' option is on,
                the (partially) entered count is shown at the bottom of the
                window.  You can use <Del> to erase the last digit (|N<Del>|).

["x]            An optional register designation where text can be stored.
                See |registers|.  The x is a single character between 'a' and
                'z' or 'A' and 'Z' or '"', and in some cases (with the put
                command) between '0' and '9', '%', '#', or others. The
                uppercase and lowercase letter designate the same register,
                but the lowercase letter is used to overwrite the previous
                register contents, while the uppercase letter is used to
                append to the previous register contents. Without the ""x" or
                with """" the stored text is put into the unnamed register.

{}              Curly braces denote parts of the command which must appear,
                but which can take a number of different values.  The
                differences between Vim and Vi are also given in curly braces
                (this will be clear from the context).

{char1-char2}   A single character from the range char1 to char2.  For
                example: {a-z} is a lowercase letter.  Multiple ranges may be
                concatenated.  For example, {a-zA-Z0-9} is any alphanumeric

{motion}        A command that moves the cursor.  These are explained in
                |motion.txt|.  Examples:
                        w               to start of next word
                        4j              four lines down
                        /The<CR>        to next occurrence of "The"
                This is used after an |operator| command to move over the text
                that is to be operated upon.
                - If the motion includes a count and the operator also had a
                  count, the two counts are multiplied.  For example: "2d3w"
                  deletes six words.
                - The motion can also be a mouse click.  The mouse is not
                  supported in every terminal though.
                - The ":omap" command can be used to map characters while an
                  operator is pending.
                - Ex commands can be used to move the cursor.  This can be
                  used to call a function that does some complicated motion.
                  The motion is always characterwise exclusive, no matter
                  what ":" command is used.  This means it's impossible to
                  include the last character of a line without the line break
                  (unless 'virtualedit' is set).
                  If the Ex command changes the text before where the operator
                  start or jumps to another buffer the result is
                  unpredictable.  It is possible to change the text further
                  down.  Jumping to another buffer is possible if the current
                  buffer is not unloaded.

{Visual}        A selected text area.  It is started with the "v", "V", or
                CTRL-V command, then any cursor movement command can be used
                to change the end of the selected text.
                This is used before an |operator| command to highlight the
                text that is to be operated upon.
                See |Visual-mode|.

<character>     A special character from the table below, optionally with
                modifiers, or a single ASCII character with modifiers.

'c'             A single ASCII character.

CTRL-{char}     {char} typed as a control character; that is, typing {char}
                while holding the CTRL key down.  The case of {char} does not
                matter; thus CTRL-A and CTRL-a are equivalent.  But on some
                terminals, using the SHIFT key will produce another code,
                don't use it then.

'option'        An option, or parameter, that can be set to a value, is
                enclosed in single quotes.  See |options|.

"command"       A reference to a command that you can type is enclosed in
                double quotes.

                                        *key-notation* *key-codes* *keycodes*
These names for keys are used in the documentation.  They can also be used
with the ":map" command (insert the key name by pressing CTRL-K and then the
key you want the name for).

notation        meaning             equivalent  decimal value(s)        

<Nul>           zero                    CTRL-@    0 (stored as 10) *<Nul>*
<BS>            backspace               CTRL-H    8     *backspace*
<Tab>           tab                     CTRL-I    9     *tab* *Tab*
<NL>            linefeed                CTRL-J   10 (used for <Nul>)
<FF>            formfeed                CTRL-L   12     *formfeed*
<CR>            carriage return         CTRL-M   13     *carriage-return*
<Return>        same as <CR>                            *<Return>*
<Enter>         same as <CR>                            *<Enter>*
<Esc>           escape                  CTRL-[   27     *escape* *<Esc>*
<Space>         space                            32     *space*
<lt>            less-than               <        60     *<lt>*
<Bslash>        backslash               \        92     *backslash* *<Bslash>*
<Bar>           vertical bar            |       124     *<Bar>*
<Del>           delete                          127
<CSI>           command sequence intro  ALT-Esc 155     *<CSI>*
<xCSI>          CSI when typed in the GUI               *<xCSI>*

<EOL>           end-of-line (can be <CR>, <LF> or <CR><LF>,
                depends on system and 'fileformat')     *<EOL>*

<Up>            cursor-up                       *cursor-up* *cursor_up*
<Down>          cursor-down                     *cursor-down* *cursor_down*
<Left>          cursor-left                     *cursor-left* *cursor_left*
<Right>         cursor-right                    *cursor-right* *cursor_right*
<S-Up>          shift-cursor-up
<S-Down>        shift-cursor-down
<S-Left>        shift-cursor-left
<S-Right>       shift-cursor-right
<C-Left>        control-cursor-left
<C-Right>       control-cursor-right
<F1> - <F12>    function keys 1 to 12           *function_key* *function-key*
<S-F1> - <S-F12> shift-function keys 1 to 12    *<S-F1>*
<Help>          help key
<Undo>          undo key
<Insert>        insert key
<Home>          home                            *home*
<End>           end                             *end*
<PageUp>        page-up                         *page_up* *page-up*
<PageDown>      page-down                       *page_down* *page-down*
<kHome>         keypad home (upper left)        *keypad-home*
<kEnd>          keypad end (lower left)         *keypad-end*
<kPageUp>       keypad page-up (upper right)    *keypad-page-up*
<kPageDown>     keypad page-down (lower right)  *keypad-page-down*
<kPlus>         keypad +                        *keypad-plus*
<kMinus>        keypad -                        *keypad-minus*
<kMultiply>     keypad *                        *keypad-multiply*
<kDivide>       keypad /                        *keypad-divide*
<kEnter>        keypad Enter                    *keypad-enter*
<kPoint>        keypad Decimal point            *keypad-point*
<k0> - <k9>     keypad 0 to 9                   *keypad-0* *keypad-9*
<S-...>         shift-key                       *shift* *<S-*
<C-...>         control-key                     *control* *ctrl* *<C-*
<M-...>         alt-key or meta-key             *meta* *alt* *<M-*
<A-...>         same as <M-...>                 *<A-*
<D-...>         command-key (Macintosh only)    *<D-*
<t_xx>          key with "xx" entry in termcap

Note: The keypad keys are used in the same way as the corresponding "normal"
keys.  For example, <kHome> has the same effect as <Home>.  If a keypad key
sends the same raw key code as it non-keypad equivalent, it will be recognized
as the non-keypad code.  For example, when <kHome> sends the same code as
<Home>, when pressing <kHome> Vim will think <Home> was pressed.  Mapping
<kHome> will not work then.

5. Modes, introduction                          *vim-modes-intro* *vim-modes*

IdeaVIM has four BASIC modes:

                                        *Normal* *Normal-mode* *command-mode*
Normal mode             In Normal mode you can enter all the normal editor
                        commands.  If you start the editor you are in this
                        mode (unless you have set the 'insertmode' option,
                        see below).  This is also known as command mode.

Visual mode             This is like Normal mode, but the movement commands
                        extend a highlighted area.  When a non-movement
                        command is used, it is executed for the highlighted
                        area.  See |Visual-mode|.
                        If the 'showmode' option is on "-- VISUAL --" is shown
                        at the bottom of the window.

Insert mode             In Insert mode the text you type is inserted into the
                        buffer.  See |Insert-mode|.
                        If the 'showmode' option is on "-- INSERT --" is shown
                        at the bottom of the window.

Command-line mode       In Command-line mode (also called Cmdline mode) you
Cmdline mode            can enter one line of text at the bottom of the
                        window.  This is for the Ex commands, ":", the pattern
                        search commands, "?" and "/", and the filter command,
                        "!".  |Cmdline-mode|

There are four ADDITIONAL modes.  These are variants of the BASIC modes:

                                *Operator-pending* *Operator-pending-mode*
Operator-pending mode   This is like Normal mode, but after an operator
                        command has started, and Vim is waiting for a {motion}
                        to specify the text that the operator will work on.

Replace mode            Replace mode is a special case of Insert mode.  You
                        can do the same things as in Insert mode, but for
                        each character you enter, one character of the existing
                        text is deleted.  See |Replace-mode|.
                        If the 'showmode' option is on "-- REPLACE --" is
                        shown at the bottom of the window.

Insert Normal mode      Entered when CTRL-O given in Insert mode.  This is
                        like Normal mode, but after executing one command Vim
                        returns to Insert mode.
                        If the 'showmode' option is on "-- (insert) --" is
                        shown at the bottom of the window.

Insert Visual mode      Entered when starting a Visual selection from Insert
                        mode, e.g., by using CTRL-O and then "v", "V" or
                        CTRL-V.  When the Visual selection ends, Vim returns
                        to Insert mode.
                        If the 'showmode' option is on "-- (insert) VISUAL --"
                        is shown at the bottom of the window.

6. Switching from mode to mode                          *mode-switching*

If for any reason you do not know which mode you are in, you can always get
back to Normal mode by typing <Esc> twice.  This doesn't work for Ex mode
though, use ":visual".
You will know you are back in Normal mode when you see the screen flash or
hear the bell after you type <Esc>.  However, when pressing <Esc> after using
CTRL-O in Insert mode you get a beep but you are still in Insert mode, type
<Esc> again.

                TO mode                                     
                Normal  Visual  Insert    Replace   Cmd-line
FROM mode
Normal                  v V ^V   *1         R       : / ? !
Visual           *2              c C        --        :
Insert           <Esc>    --              <Insert>    --
Replace          <Esc>    --    <Insert>              --
Command-line     *3       --     :start     --

-  NA
-- not possible

*1 Go from Normal mode to Insert mode by giving the command "i", "I", "a",
   "A", "o", "O", "c", "C", "s" or S".
*2 Go from Visual mode to Normal mode by giving a non-movement command, which
   causes the command to be executed, or by hitting <Esc> "v", "V" or "CTRL-V"
   (see |v_v|), which just stops Visual mode without side effects.
*3 Go from Command-line mode to Normal mode by:
   - Hitting <CR> or <NL>, which causes the entered command to be executed.
   - Deleting the complete line (e.g., with CTRL-U) and giving a final <BS>.
   - Hitting CTRL-C or <Esc>, which quits the command-line without executing
     the command.

        *CTRL-\_CTRL-N* *i_CTRL-\_CTRL-N* *c_CTRL-\_CTRL-N* *v_CTRL-\_CTRL-N*
Additionally the command CTRL-\ CTRL-N or <C-\><C-N> can be used to go to
Normal mode from any other mode.  This can be used to make sure Vim is in
Normal mode, without causing a beep like <Esc> would.  However, this does not
work in Ex mode.

7. The window contents                                  *window-contents*

This information does not apply to IdeaVIM.

8. Definitions                                          *definitions*

A difference is made between four types of lines:

  buffer lines          The lines in the buffer.  This is the same as the
                        lines as they are read from/written to a file.  They
                        can be thousands of characters long.
  logical lines         The buffer lines with folding applied.  Buffer lines
                        in a closed fold are changed to a single logical line:
                        "+-- 99 lines folded".  They can be thousands of
                        characters long.
  window lines          The lines displayed in a window: A range of logical
                        lines with wrapping, line breaks, etc.  applied.  They
                        can only be as long as the width of the window allows,
                        longer lines are wrapped or truncated.
  screen lines          The lines of the screen that Vim uses.  Consists of
                        the window lines of all windows, with status lines
                        and the command line added.  They can only be as long
                        as the width of the screen allows.  When the command
                        line gets longer it wraps and lines are scrolled to
                        make room.

buffer lines    logical lines   window lines    screen lines 

1. one          1. one          1. +-- folded   1.  +-- folded
2. two          2. +-- folded   2. five         2.  five
3. three        3. five         3. six          3.  six
4. four         4. six          4. seven        4.  seven
5. five         5. seven                        5.  === status line ===
6. six                                          6.  aaa
7. seven                                        7.  bbb
                                                8.  ccc ccc c
1. aaa          1. aaa          1. aaa          9.  cc
2. bbb          2. bbb          2. bbb          10. ddd
3. ccc ccc ccc  3. ccc ccc ccc  3. ccc ccc c    11. 
4. ddd          4. ddd          4. cc           12. === status line ===
                                5. ddd          13. (command line)