*editing.txt*   For IdeaVIM version 0.12.0.  Last change: 2007 Jan 01

                  IdeaVIM REFERENCE MANUAL    by Rick Maddy

Editing files                                           *edit-files*

1.  Introduction                |edit-intro|
2.  Editing a file              |edit-a-file|
3.  Dialogs                     |edit-dialogs|
4.  The current directory       |current-directory|
5.  The argument list           |argument-list|
6.  Writing                     |writing|
7.  Writing and quitting        |write-quit|
8.  Editing binary files        |edit-binary|
9.  Encryption                  |encryption|
10. Timestamps                  |timestamps|

1. Introduction                                         *edit-intro*

Editing a file with Vim means:

1. reading the file into the internal buffer
2. changing the buffer with editor commands
3. writing the buffer into a file

As long as you don't write the buffer, the original file remains unchanged.
If you start editing a file (read a file into the buffer), the file name is
remembered as the "current file name".

CTRL-G          or                              *CTRL-G* *:f* *:fi* *:file*
:f[ile]                 Prints the current file name (as typed), the
                        cursor position (unless the 'ruler' option is set),
                        and the file status (readonly, modified, read errors,
                        new file)).  See the 'shortmess' option about how tho
                        make this message shorter.  {Vi does not include
                        column number}

{count}CTRL-G           Like CTRL-G, but prints the current file name with
                        full path.  If the count is higher than 1 the current
                        buffer number is also given.

                                        *g_CTRL-G* *word-count* *byte-count*
g CTRL-G                Prints the current position of the cursor in four
                        ways: Column, Line, Word and Byte.  If there are
                        characters in the line that take more than one
                        position on the screen (<Tab> or special character),
                        both the "real" column and the screen column are
                        shown, separated with a dash.  See also 'ruler'

{Visual}g CTRL-G        Similar to "g CTRL-G", but Word, Line, and Byte counts
                        for the visually selected region are displayed.  In
                        Blockwise mode, Column count is also shown.  (For
                        {Visual} see |Visual-mode|.)

2. Editing a file                                       *edit-a-file*

                                                        *:e* *:edit*
:e[dit] {file}
                        Edit {file}.
                        This opens an existing file anywhere within the current

:e[dit] #
                        Select the previous file. This command does the same as

                                                        *:fin* *:find*
:fi[nd] {file}
                        Find {file}.
                        This opens an existing file anywhere within the current

                                                        *:cla* *:class*
:cla[ss] {class}
                        Find Java class {class}.
                        This opens an existing class anywhere within the current
                        project. {Not in Vim}

CTRL-^                  This gets you to the previously edited file.  This is a
                        quick way to toggle between two (or more) files.

3. Dialogs                                              *edit-dialogs*

                                                           *:browse* *:bro*
:bro[wse]               Opens the File Open dialog.

4. The current directory                                *current-directory*

This information does not apply to IdeaVIM.

5. The argument list                            *argument-list* *arglist*

                                                        *:argu* *:argument*
:[count]argu[ment] [count] [++opt] [+cmd]
                        Edit file [count] in the argument list.  When [count]
                        is omitted the current entry is used.
:[count]n[ext] [++opt] [+cmd]                   *:n* *:ne* *:next* *E165* *E163*
                        Edit [count] next file.

:[count]N[ext] [count] [++opt] [+cmd]                   *:Next* *:N* *E164*
                        Edit [count] previous file in argument list.

:[count]prev[ious] [count] [++opt] [+cmd]               *:prev* *:previous*
                        Same as :Next.

                                                        *:rew* *:rewind*
:rew[ind] [++opt] [+cmd]
                        Start editing the first file in the argument list.
                                                        *:fir* *:first*
:fir[st][!] [++opt] [+cmd]
                        Other name for ":rewind".

                                                        *:la* *:last*
:la[st] [++opt] [+cmd]
                        Start editing the last file in the argument list.
                                                        *:wn* *:wnext*
:[count]wn[ext] [++opt] [+cmd]
                        Write current file and start editing the [count]
                        next file.
:[count]wN[ext][!] [++opt] [+cmd] [file]                *:wN* *:wNext*
:[count]wp[revous][!] [++opt] [+cmd] [file]             *:wp* *:wprevious*
                        Same as :wnext, but go to previous file instead of

The [count] in the commands above defaults to one.  For some commands it is
possible to use two counts.  The last one (rightmost one) is used.

If no [+cmd] argument is present, the cursor is positioned at the last known
cursor position for the file.  If 'startofline' is set, the cursor will be
positioned at the first non-blank in the line, otherwise the last know column
is used.  If there is no last known cursor position the cursor will be in the
first line (the last line in Ex mode).

The wildcards in the argument list are expanded and the file names are sorted.
Thus you can use the command "vim *.c" to edit all the C files.  From within
Vim the command ":n *.c" does the same.  On Unix you can also use backticks,
for example:
        :n `find . -name \\*.c -print`
The backslashes before the star are required to prevent "*.c" to be expanded
by the shell before executing the find program.

When there is an argument list you can see which file you are editing in the
title of the window (if there is one and 'title' is on) and with the file
message you get with the "CTRL-G" command.  You will see something like
        (file 4 of 11)
If 'shortmess' contains 'f' it will be
        (4 of 11)
If you are not really editing the file at the current position in the argument
list it will be
        (file (4) of 11)
This means that you are position 4 in the argument list, but not editing the
fourth file in the argument list.  This happens when you do ":e file".

6. Writing                                      *writing* *save-file*

                                                        *:w* *:write*
                                *E502* *E503* *E504* *E505* *E512* *E514*
:w[rite]                Write the whole buffer to the current file.  This is
                        the normal way to save changes to a file.  It fails
                        when the 'readonly' option is set or when there is
                        another reason why the file can't be written.

WRITING WITH MULTIPLE BUFFERS                           *buffer-write*

                                                        *:wa* *:wall*
:wa[ll]                 Write all changed buffers.  Buffers without a file
                        name or which are readonly are not written.

Vim will warn you if you try to overwrite a file that has been changed
elsewhere.  See |timestamp|.

7. Writing and quitting                                 *write-quit*

                                                        *:q* *:quit*
:q[uit]                 Quit the current editor.
:wq                     Write the current file and quit.  Writing fails when
                        the file is read-only.
                                                        *:x* *:xit*
:[range]x[it][!] [file]
                        Like ":wq", but write only when changes have been
                        When 'hidden' is set and there are more windows, the
                        current buffer becomes hidden, after writing the file.

                                                        *:exi* *:exit*
:[range]exi[t][!] [file]
                        Same as :xit.

ZZ                      Write current file, if modified, and quit (same as
                        ":x").  (Note: If there are several windows for the
                        current file, the file is written if it was modified
                        and the window is closed).

ZQ                      Quit without checking for changes (same as ":q!").

MULTIPLE WINDOWS AND BUFFERS                            *window-exit*

                                                        *:qa* *:qall*
:qa[ll]         Exit Vim, unless there are some buffers which have been
                                                        *:quita* *:quitall*
:quita[ll][!]   Close all editors.

:wqa[ll]                                        *:wqa* *:wqall* *:xa* *:xall*
:xa[ll]         Write all changed buffers.

8. Editing binary files                                 *edit-binary*

This information does not apply to IdeaVIM.

9. Encryption                                           *encryption*

This information does not apply to IdeaVIM.

10. Timestamps                                  *timestamp* *timestamps*

This information does not apply to IdeaVIM.