diff options
Diffstat (limited to 'runtime/doc/editing.txt')
-rw-r--r-- | runtime/doc/editing.txt | 115 |
1 files changed, 65 insertions, 50 deletions
diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index aa964a521f..4700af41b7 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -63,10 +63,14 @@ g CTRL-G Prints the current position of the cursor in five ways: Column, Line, Word, Character and Byte. If the number of Characters and Bytes is the same then the Character position is omitted. + 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. + character), or characters using more than one byte per + column (characters above 0x7F when 'encoding' is + utf-8), both the byte column and the screen column are + shown, separated by a dash. + Also see the 'ruler' option and the |wordcount()| function. @@ -298,10 +302,13 @@ CTRL-^ Edit the alternate file. Mostly the alternate file is *gF* [count]gF Same as "gf", except if a number follows the file name, then the cursor is positioned on that line in - the file. The file name and the number must be - separated by a non-filename (see 'isfname') and - non-numeric character. White space between the - filename, the separator and the number are ignored. + the file. + The file name and the number must be separated by a + non-filename (see 'isfname') and non-numeric + character. " line " is also recognized, like it is + used in the output of `:verbose command UserCmd` + White space between the filename, the separator and + the number are ignored. Examples: eval.c:10 ~ eval.c @ 20 ~ @@ -439,6 +446,9 @@ This edits the same file again with 'fileformat' set to "unix". > :w ++enc=latin1 newfile This writes the current buffer to "newfile" in latin1 format. +The message given when writing a file will show "[converted]" when +'fileencoding' or the value specified with ++enc differs from 'encoding'. + There may be several ++opt arguments, separated by white space. They must all appear before any |+cmd| argument. @@ -508,15 +518,16 @@ If you start editing a new file and the 'fileformats' option is not empty (which is the default), Vim will try to detect whether the lines in the file are separated by the specified formats. When set to "unix,dos", Vim will check for lines with a single <NL> (as used on Unix) or by a <CR><NL> pair -(Windows). Only when ALL lines end in <CR><NL>, 'fileformat' is set to "dos", -otherwise it is set to "unix". When 'fileformats' includes "mac", and no <NL> -characters are found in the file, 'fileformat' is set to "mac". +(MS-Windows). Only when ALL lines end in <CR><NL>, 'fileformat' is +set to "dos", otherwise it is set to "unix". When 'fileformats' includes +"mac", and no <NL> characters are found in the file, 'fileformat' is set to +"mac". -If the 'fileformat' option is set to "dos" on non-Windows systems the message -"[dos format]" is shown to remind you that something unusual is happening. On -Windows systems you get the message "[unix format]" if 'fileformat' is set to -"unix". On all systems but the Macintosh you get the message "[mac format]" -if 'fileformat' is set to "mac". +If the 'fileformat' option is set to "dos" on non-MS-Windows systems the +message "[dos format]" is shown to remind you that something unusual is +happening. On MS-Windows systems you get the message "[unix format]" if +'fileformat' is set to "unix". On all systems but the Macintosh you get the +message "[mac format]" if 'fileformat' is set to "mac". If the 'fileformats' option is empty and DOS format is used, but while reading a file some lines did not end in <CR><NL>, "[CR missing]" will be included in @@ -607,7 +618,7 @@ list of the current window. :args ## x < This will add the "x" item and sort the new list. -:argd[elete] {pattern} .. *:argd* *:argdelete* *E480* +:argd[elete] {pattern} .. *:argd* *:argdelete* *E480* *E610* Delete files from the argument list that match the {pattern}s. {pattern} is used like a file pattern, see |file-pattern|. "%" can be used to delete the @@ -617,7 +628,7 @@ list of the current window. Example: > :argdel *.obj -:[range]argd[elete] Delete the {range} files from the argument list. +:[range]argd[elete] Delete the [range] files from the argument list. Example: > :10,$argdel < Deletes arguments 10 and further, keeping 1-9. > @@ -965,7 +976,7 @@ to write anyway add a '!' to the command. *write-permissions* When writing a new file the permissions are read-write. For unix the mask is -0666 with additionally umask applied. When writing a file that was read Vim +0o666 with additionally umask applied. When writing a file that was read Vim will preserve the permissions, but clear the s-bit. *write-readonly* @@ -984,7 +995,7 @@ original file fails, there will be an error message telling you that you lost the original file. *DOS-format-write* -If the 'fileformat' is "dos", <CR> <NL> is used for <EOL>. This is default +If the 'fileformat' is "dos", <CR><NL> is used for <EOL>. This is default for Windows. On other systems the message "[dos format]" is shown to remind you that an unusual <EOL> was used. *Unix-format-write* @@ -1018,11 +1029,11 @@ When the file name is actually a device name, Vim will not make a backup (that would be impossible). You need to use "!", since the device already exists. Example for Unix: > :w! /dev/lpt0 -and Windows: > +and MS-Windows: > :w! lpt0 For Unix a device is detected when the name doesn't refer to a normal file or a directory. A fifo or named pipe also looks like a device to Vim. -For Windows the device is detected by its name: +For MS-Windows the device is detected by its name: CON CLOCK$ NUL @@ -1036,9 +1047,9 @@ The names can be in upper- or lowercase. *:q* *:quit* :q[uit] Quit the current window. Quit Vim if this is the last - window. This fails when changes have been made and - Vim refuses to |abandon| the current buffer, and when - the last file in the argument list has not been + |edit-window|. This fails when changes have been made + and Vim refuses to |abandon| the current buffer, and + when the last file in the argument list has not been edited. If there are other tab pages and quitting the last window in the current tab page the current tab page is @@ -1063,18 +1074,22 @@ The names can be in upper- or lowercase. code. See |:cq|. *:wq* -:wq [++opt] Write the current file and quit. Writing fails when - the file is read-only or the buffer does not have a - name. Quitting fails when the last file in the - argument list has not been edited. - -:wq! [++opt] Write the current file and quit. Writing fails when - the current buffer does not have a name. - -:wq [++opt] {file} Write to {file} and quit. Quitting fails when the +:wq [++opt] Write the current file and close the window. If this + was the last |edit-window| Vim quits. + Writing fails when the file is read-only or the buffer + does not have a name. Quitting fails when the last + file in the argument list has not been edited. + +:wq! [++opt] Write the current file and close the window. If this + was the last |edit-window| Vim quits. Writing fails + when the current buffer does not have a name. + +:wq [++opt] {file} Write to {file} and close the window. If this was the + last |edit-window| Vim quits. Quitting fails when the last file in the argument list has not been edited. -:wq! [++opt] {file} Write to {file} and quit. +:wq! [++opt] {file} Write to {file} and close the current window. Quit + Vim if this was the last |edit-window|. :[range]wq[!] [++opt] [file] Same as above, but only write the lines in [range]. @@ -1091,10 +1106,10 @@ The names can be in upper- or lowercase. Same as :xit. *ZZ* -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). +ZZ Write current file, if modified, and close the current + window (same as ":x"). + If there are several windows for the current file, + only the current window is closed. *ZQ* ZQ Quit without checking for changes (same as ":q!"). @@ -1195,13 +1210,13 @@ For versions of Vim where browsing is not supported, the command is executed unmodified. *browsefilter* -For Windows you can modify the filters that are used in the browse dialog. By -setting the g:browsefilter or b:browsefilter variables, you can change the -filters globally or locally to the buffer. The variable is set to a string in -the format "{filter label}\t{pattern};{pattern}\n" where {filter label} is the -text that appears in the "Files of Type" comboBox, and {pattern} is the -pattern which filters the filenames. Several patterns can be given, separated -by ';'. +For MS-Windows you can modify the filters that are used in the browse +dialog. By setting the g:browsefilter or b:browsefilter variables, you can +change the filters globally or locally to the buffer. The variable is set to +a string in the format "{filter label}\t{pattern};{pattern}\n" where {filter +label} is the text that appears in the "Files of Type" comboBox, and {pattern} +is the pattern which filters the filenames. Several patterns can be given, +separated by ';'. For example, to have only Vim files in the dialog, you could use the following command: > @@ -1248,7 +1263,7 @@ exist, the next-higher scope in the hierarchy applies. Does not change the meaning of an already opened file, because its full path name is remembered. Files from the |arglist| may change though! - On Windows this also changes the active drive. + On MS-Windows this also changes the active drive. To change to the directory of the current file: > :cd %:h < @@ -1279,7 +1294,7 @@ exist, the next-higher scope in the hierarchy applies. *:lch* *:lchdir* :lch[dir][!] Same as |:lcd|. - *:lcd-* + *:lcd-* :lc[d][!] - Change to the previous current directory (before the previous ":lcd {path}" command). @@ -1323,7 +1338,7 @@ to 0, 'modeline' off, 'expandtab' off). Setting the 'binary' option has the same effect. Don't forget to do this before reading the file. There are a few things to remember when editing binary files: -- When editing executable files the number of characters must not change. +- When editing executable files the number of bytes must not change. Use only the "R" or "r" command to change text. Do not delete characters with "x" or by backspacing. - Set the 'textwidth' option to 0. Otherwise lines will unexpectedly be @@ -1335,8 +1350,8 @@ There are a few things to remember when editing binary files: It is also possible that you get an "out of memory" error when reading the file. - Make sure the 'binary' option is set BEFORE loading the - file. Otherwise both <CR> <NL> and <NL> are considered to end a line - and when the file is written the <NL> will be replaced with <CR> <NL>. + file. Otherwise both <CR><NL> and <NL> are considered to end a line + and when the file is written the <NL> will be replaced with <CR><NL>. - <Nul> characters are shown on the screen as ^@. You can enter them with "CTRL-V CTRL-@" or "CTRL-V 000". - To insert a <NL> character in the file split a line. When writing the @@ -1372,7 +1387,7 @@ focus. If you want to automatically reload a file when it has been changed outside of Vim, set the 'autoread' option. This doesn't work at the moment you write the file though, only when the file wasn't changed inside of Vim. - + *ignore-timestamp* If you do not want to be asked or automatically reload the file, you can use this: > set buftype=nofile |