*editing.txt* For Vim version 7.2a. Last change: 2008 Apr 29
VIM REFERENCE MANUAL by Bram Moolenaar
Editing files *edit-files*
1. Introduction |edit-intro|
2. Editing a file |edit-a-file|
3. The argument list |argument-list|
4. Writing |writing|
5. Writing and quitting |write-quit|
6. Dialogs |edit-dialogs|
7. The current directory |current-directory|
8. Editing binary files |edit-binary|
9. Encryption |encryption|
10. Timestamps |timestamps|
11. File Searching |file-searching|
==============================================================================
1. Introduction *edit-intro*
Editing a file with Vim means:
1. reading the file into a buffer
2. changing the buffer with editor commands
3. writing the buffer into a file
*current-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". This is also known as the name of the
current buffer. It can be used with "%" on the command line |:_%|.
*alternate-file*
If there already was a current file name, then that one becomes the alternate
file name. It can be used with "#" on the command line |:_#| and you can use
the |CTRL-^| command to toggle between the current and the alternate file.
However, the alternate file name is not changed when |:keepalt| is used.
*:keepalt* *:keepa*
:keepalt {cmd} Execute {cmd} while keeping the current alternate file
name. Note that commands invoked indirectly (e.g.,
with a function) may still set the alternate file
name. {not in Vi}
All file names are remembered in the buffer list. When you enter a file name,
for editing (e.g., with ":e filename") or writing (e.g., with ":w filename"),
the file name is added to the list. You can use the buffer list to remember
which files you edited and to quickly switch from one file to another (e.g.,
to copy text) with the |CTRL-^|