*cmdline.txt*   For IdeaVIM version 0.12.0.  Last change: 2006 Dec 01

                  IdeaVIM REFERENCE MANUAL    by Rick Maddy

                                *Cmdline-mode* *Command-line-mode*
Command-line mode               *Cmdline* *Command-line* *mode-cmdline* *:*

Command-line mode is used to enter Ex commands (":"), search patterns
("/" and "?"), and filter commands ("!").

Basic command line editing is explained in chapter 20 of the user manual

1. Command-line editing         |cmdline-editing|
2. Command-line completion      |cmdline-completion|
3. Ex command-lines             |cmdline-lines|
4. Ex command-line ranges       |cmdline-ranges|
5. Ex special characters        |cmdline-special|
6. Command-line window          |cmdline-window|

1. Command-line editing                                 *cmdline-editing*

Normally characters are inserted in front of the cursor position.  You can
move around in the command-line with the left and right cursor keys.  With the
<Insert> key, you can toggle between inserting and overstriking characters.

When the command line is getting longer than what fits on the screen, only the
part that fits will be shown.  The cursor can only move in this visible part,
thus you cannot edit beyond that.

                                                *cmdline-history* *history*
The command-lines that you enter are remembered in a history table.  You can
recall them with the up and down cursor keys.  There are actually four
history tables:
- one for ':' commands
- one for search strings
- one for expressions
- one for input lines, typed for the |input()| function.
These are completely separate.  Each history can only be accessed when
entering the same type of line.
Use the 'history' option to set the number of lines that are remembered
(default: 20).
- When you enter a command-line that is exactly the same as an older one, the
  old one is removed (to avoid repeated commands moving older commands out of
  the history).
- Only commands that are typed are remembered.  Ones that completely come from
  mappings are not put in the history
- All searches are put in the search history, including the ones that come
  from commands like "*" and "#".  But for a mapping, only the last search is
  remembered (to avoid that long mappings trash the history).

There is an automatic completion of names on the command-line; see

CTRL-V          Insert next non-digit literally.  Up to three digits form the
                decimal value of a single byte.  The non-digit and the three
                digits are not considered for mapping.  This works the same
                way as in Insert mode (see above, |i_CTRL-V|).
                Note: Under Windows CTRL-V is often mapped to paste text.
                Use CTRL-Q instead then.
CTRL-Q          Same as CTRL-V.  But with some terminals it is used for
                control flow, it doesn't work then.

<Left>          cursor left
<Right>         cursor right
<S-Left> or <C-Left>                                    *c_<C-Left>*
                cursor one WORD left
<S-Right> or <C-Right>                                  *c_<C-Right>*
                cursor one WORD right
CTRL-B or <Home>                                        *c_CTRL-B* *c_<Home>*
                cursor to beginning of command-line
CTRL-E or <End>                                         *c_CTRL-E* *c_<End>*
                cursor to end of command-line

<LeftMouse>     cursor to position of mouse click.

CTRL-H                                                  *c_<BS>* *c_CTRL-H*
<BS>            delete the character in front of the cursor (see |:fixdel| if
                your <BS> key does not do what you want).
<Del>           delete the character under the cursor (at end of line:
                character before the cursor) (see |:fixdel| if your <Del>
                key does not do what you want).
CTRL-W          delete the word before the cursor
CTRL-U          remove all characters between the cursor position and
                the beginning of the line.
                Note: if the command-line becomes empty with one of the
                delete commands, Command-line mode is quit.
<Insert>        Toggle between insert and overstrike.

CTRL-K {char1} {char2}                                  *c_CTRL-K*
                enter digraph (see |digraphs|).

CTRL-J                                          *c_CTRL-J* *c_<NL>* *c_<CR>*
<CR> or <NL>    start entered command
<Esc>           When typed and 'x' not present in 'cpoptions', quit
                Command-line mode without executing.  In macros or when 'x'
                present in 'cpoptions', start entered command.
CTRL-C          quit command-line without executing

<Up>            recall older command-line from history, whose beginning
                matches the current command-line (see below).
<Down>          recall more recent command-line from history, whose beginning
                matches the current command-line (see below).

                                                        *c_<S-Up>* *c_<PageUp>*
<S-Up> or <PageUp>
                recall older command-line from history
                                                *c_<S-Down>* *c_<PageDown>*
<S-Down> or <PageDown>
                recall more recent command-line from history

The <Up> and <Down> keys take the current command-line as a search string.
The beginning of the next/previous command-lines are compared with this
string.  The first line that matches is the new command-line.  When typing
these two keys repeatedly, the same string is used again.  For example, this
can be used to find the previous substitute command: Type ":s" and then <Up>.
The same could be done by typing <S-Up> a number of times until the desired
command-line is shown.  (Note: the shifted arrow keys do not work on all

                                                        *his* *:history*
:his[tory]      Print the history of last entered commands.

:his[tory] [{name}] [{first}][, [{last}]]
                List the contents of history {name} which can be:
                c[md]    or :   command-line history
                s[earch] or /   search string history
                e[xpr]   or =   expression register history
                i[nput]  or @   input line history
                a[ll]           all of the above

                If the numbers {first} and/or {last} are given, the respective
                range of entries from a history is listed.  These numbers can
                be specified in the following form:
                A positive number represents the absolute index of an entry
                as it is given in the first column of a :history listing.
                This number remains fixed even if other entries are deleted.

                A negative number means the relative position of an entry,
                counted from the newest entry (which has index -1) backwards.

                List entries 6 to 12 from the search history:
                        :history / 6,12

                List the recent five entries from all histories:
                        :history all -5,

2. Command-line completion                              *cmdline-completion*

Not currently supported by IdeaVIM

3. Ex command-lines                                     *cmdline-lines*

The '!' (bang) character after an Ex command makes the command behave in a
different way.  The '!' should be placed immediately after the command, without
any blanks in between.  If you insert blanks the '!' will be seen as an
argument for the command, which has a different meaning.  For example:
        :w! name        write the current buffer to file "name", overwriting
                        any existing file
        :w !name        send the current buffer as standard input to command

4. Ex command-line ranges       *cmdline-ranges* *[range]* *E16* *E493*

Some Ex commands accept a line range in front of them.  This is noted as
[range].  It consists of one or more line specifiers, separated with ',' or

The basics are explained in section |10.3| of the user manual.

                                                *:,* *:;*
When separated with ';' the cursor position will be set to that line
before interpreting the next line specifier.  This doesn't happen for ','.
   4,/this line/
<       from line 4 till match with "this line" after the cursor line.
   5;/that line/
       from line 5 till match with "that line" after line 5.

The default line specifier for most commands is the cursor position, but the
commands ":write" and ":global" have the whole file (1,$) as default.

If more line specifiers are given than required for the command, the first
one(s) will be ignored.

Line numbers may be specified with:             *:range* *E14* *{address}*
        {number}        an absolute line number
        .               the current line                          *:.*
        $               the last line in the file                 *:$*
        %               equal to 1,$ (the entire file)            *:%*
        't              position of mark t (lowercase)            *:'*
        'T              position of mark T (uppercase); when the mark is in
                        another file it cannot be used in a range
        /{pattern}[/]   the next line where {pattern} matches     *:/*
        ?{pattern}[?]   the previous line where {pattern} matches *:?*
        \/              the next line where the previously used search
                        pattern matches
        \?              the previous line where the previously used search
                        pattern matches
        \&              the next line where the previously used substitute
                        pattern matches

Each may be followed (several times) by '+' or '-' and an optional number.
This number is added or subtracted from the preceding line number.  If the
number is omitted, 1 is used.

The "/" and "?" after {pattern} are required to separate the pattern from
anything that follows.

The "/" and "?" may be preceded with another address.  The search starts from
there.  The difference from using ';' is that the cursor isn't moved.
        /pat1//pat2/    Find line containing "pat2" after line containing
                        "pat1", without moving the cursor.
        7;/pat2/        Find line containing "pat2", after line 7, leaving
                        the cursor in line 7.

The {number} must be between 0 and the number of lines in the file.  When
using a 0 (zero) this is interpreted as a 1 by most commands.  Commands that
use it as a count do use it as a zero.  Some commands
interpret the zero as "before the first line" (search pattern, etc).

        .+3             three lines below the cursor
        /that/+1        the line below the next line containing "that"
        .,$             from current line until end of file
        0;/that         the first line containing "that", also matches in the
                        first line.
        1;/that         the first line after line 1 containing "that"

Some commands allow for a count after the command.  This count is used as the
number of lines to be used, starting with the line given in the last line
specifier (the default is the cursor line).  The commands that accept a count
are the ones that use a range but do not have a file name argument (because
a file name can also be a number).

        :s/x/X/g 5      substitute 'x' by 'X' in the current line and four
                        following lines
        :23d 4          delete lines 23, 24, 25 and 26

Count and Range                                         *N:*

When giving a count before entering ":", this is translated into:
                :.,.+(count - 1)
In words: The 'count' lines at and after the cursor.  Example: To delete
three lines:
                3:d<CR>         is translated into: .,.+2d<CR>

Visual Mode and Range                                   *v_:*

{Visual}:       Starts a command-line with the Visual selected lines as a
                range.  The code ":'<,'>" is used for this range, which makes
                it possible to select a similar line from the command-line
                history for repeating a command on different Visually selected

5. Ex special characters                                *cmdline-special*

6. Command-line window                          *cmdline-window* *cmdwin*