[SCM] Vim packaging branch, debian, updated. upstream/7.1.ds-307-g3ea27e6
James Vega
jamessan at debian.org
Thu Mar 27 04:52:30 UTC 2008
The following commit has been merged in the debian branch:
commit 68cedde9e1bff98087bfd6933342735081286219
Author: James Vega <jamessan at debian.org>
Date: Wed Mar 26 23:15:20 2008 -0400
Update the FAQ to the most recent (although still quite old) version.
diff --git a/debian/FAQ b/debian/FAQ
index c3c1add..00ec26d 100644
--- a/debian/FAQ
+++ b/debian/FAQ
@@ -5,7 +5,7 @@ vim at vim.org user mailing list and the comp.editors newsgroup. There are
several ways to solve a problem in Vim. This FAQ gives one of those several
possibilities. You can explore the other ways using the information and
links given in this FAQ. The credit for the answers in this FAQ goes to
-Peppe, Benji and numerous others.
+Peppe, Benji, Charles Campbell and numerous others.
INDEX
@@ -34,11 +34,10 @@ SECTION 2 - RESOURCES
this?
SECTION 3 - AVAILABILITY
- 3.1. What is the latest version of Vim? (*Updated*)
- 3.2. Where can I find the latest version of Vim? (*Updated*)
+ 3.1. What is the latest version of Vim?
+ 3.2. Where can I find the latest version of Vim?
3.3. What platforms does it run on?
3.4. Where can I download the latest version of the Vim runtime files?
- (*New*)
SECTION 4 - HELP
4.1. How do I use the help files?
@@ -50,658 +49,681 @@ SECTION 4 - HELP
4.6. Can I use compressed versions of the help files?
SECTION 5 - EDITING A FILE
- 5.1. I am currently editing a file in Vim. How do I load another file
- into Vim?
- 5.2. When I edit and save files, Vim creates a file with the same name
- as the original file and a "~" character at the end. How do I stop
- Vim from creating this file?
- 5.3. How do I save the current file in another name (save as) and edit
+ 5.1. How do I load a file in Vim for editing?
+ 5.2. How do I save the current file in another name (save as) and edit
a new file?
- 5.4. How do I change the current directory to the directory of the
+ 5.3. How do I change the current directory to the directory of the
current file?
- 5.5. How do I write a file without the line feed (EOL) at the end of
+ 5.4. How do I write a file without the line feed (EOL) at the end of
the file?
- 5.6. How do I configure Vim to open a file at the last edited location?
- 5.7. When editing a file in Vim, which is being changed by an external
+ 5.5. How do I configure Vim to open a file at the last edited location?
+ 5.6. When editing a file in Vim, which is being changed by an external
application, Vim opens a warning window (like the confirm dialog)
each time a change is detected. How do I disable this warning?
- 5.8. How do I edit a file whose name is under the cursor?
- 5.9. How do I reload/re-edit the current file?
- 5.10. When I save a file with Vim, the file permissions are changed.
- How do I configure Vim to save a file without chaging the file
- permissions?
- 5.11 How do I autosave a file periodically?
- 5.12. How do I open a file in read-only mode?
+ 5.7. How do I edit a file whose name is under the cursor?
+ 5.8. How do I reload/re-edit the current file?
+ 5.9. How do I autosave a file periodically?
+ 5.10. How do I open a file in read-only mode?
+ 5.11. How do I open a file for editing without saving the modifications
+ to the current file?
SECTION 6 - EDITING MULTIPLE FILES
- 6.1. How do I switch between files while editing multiple files in Vim?
- 6.2. How do I configure Vim to autoload several files at once similar
+ 6.1. How do I open multiple files at once from within Vim?
+ 6.2. How do I switch between multiple files/buffers in Vim?
+ 6.3. How do I open several files in Vim, with each file in a separate
+ window?
+ 6.4. How do I configure Vim to autoload several files at once similar
to "work-sets" or "projects"?
- 6.3. Is it possible to open multiple top level windows in a single
+ 6.5. Is it possible to open multiple top level windows in a single
instance of Vim similar to Nedit or emacs?
- 6.4. How do I open multiple files at once from within Vim?
- 6.5. How do I open several windows in Vim by supplying command line
- arguments?
6.6. How do I browse/explore directories from within Vim?
6.7. How do I edit files over a network using ftp/scp/rcp/http?
-SECTION 7 - BUFFERS
- 7.1. I have made some modifications to a buffer. How do I edit another
+SECTION 7 - BACKUP
+ 7.1. When I edit and save files, Vim creates a file with the same name
+ as the original file and a "~" character at the end. How do I stop
+ Vim from creating this file (or) How do I disable the Vim backup
+ file feature?
+ 7.2. How do I configure Vim to store all the backup files in a
+ particular directory?
+ 7.3. When I save a file with Vim, the file permissions are changed.
+ How do I configure Vim to save a file without changing the file
+ permissions?
+
+SECTION 8 - BUFFERS
+ 8.1. I have made some modifications to a buffer. How do I edit another
buffer without saving the modified buffer and also without losing
the modifications?
- 7.2. How do I configure Vim to auto-save a modified buffer when
+ 8.2. How do I configure Vim to auto-save a modified buffer when
switching to another buffer?
- 7.3. How do I replace the buffer in the current window with a blank
+ 8.3. How do I replace the buffer in the current window with a blank
buffer?
- 7.4. Is there a keyboard shortcut to load a buffer by the buffer
+ 8.4. Is there a keyboard shortcut to load a buffer by the buffer
number?
- 7.5. How do I open all the current buffers in separate windows?
- 7.6. How do I close (delete) a buffer without exiting Vim?
- 7.7. I have several buffers opened with ":e filename". How do I close
+ 8.5. How do I open all the current buffers in separate windows?
+ 8.6. How do I close (delete) a buffer without exiting Vim?
+ 8.7. I have several buffers opened with ":e filename". How do I close
one of the buffers without exiting Vim?
- 7.8. When I use the command ":%bd" to delete all the buffers, not all
+ 8.8. When I use the command ":%bd" to delete all the buffers, not all
the buffers are deleted. Why?
- 7.9. How do I display the buffer number of the current buffer/file?
- 7.10. How do I delete a buffer without closing the window in which the
+ 8.9. How do I display the buffer number of the current buffer/file?
+ 8.10. How do I delete a buffer without closing the window in which the
buffer is displayed?
- 7.11. How do I map the tab key to cycle through and open all the
- buffers? (*New*)
-
-SECTION 8 - WINDOWS
- 8.1. What is the difference between a Vim window and a buffer?
- 8.2. How do I increase the width of a Vim window?
- 8.3. How do I zoom into or out of a window? (*New*)
- 8.4. How do I execute an ex command on all the open buffers or open
- windows or all the files in the argument list? (*Updated*)
-
-SECTION 9 - MOTION
- 9.1. How do I jump to the beginning (first line) or end (last line) of
+ 8.11. How do I map the tab key to cycle through and open all the
+ buffers?
+
+SECTION 9 - WINDOWS
+ 9.1. What is the difference between a Vim window and a buffer?
+ 9.2. How do I increase the width of a Vim window?
+ 9.3. How do I zoom into or out of a window?
+ 9.4. How do I execute an ex command on all the open buffers or open
+ windows or all the files in the argument list?
+
+SECTION 10 - MOTION
+ 10.1. How do I jump to the beginning (first line) or end (last line) of
a file?
- 9.2. In insert mode, when I press the <Esc> key to go to command mode,
+ 10.2. In insert mode, when I press the <Esc> key to go to command mode,
the cursor moves one character to the left (except when the cursor
- is on the first character of the line). How do I prevent this?
- 9.3. How do I configure Vim to maintain the horizontal cursor position
+ is on the first character of the line). Is it possible to change
+ this behavior to keep the cursor at the same column?
+ 10.3. How do I configure Vim to maintain the horizontal cursor position
when scrolling with the <Page Up>, <Page Down>, etc keys?
- 9.4. Some lines in a file are more than the screen width and they are
+ 10.4. Some lines in a file are more than the screen width and they are
all wrapped. When I use the j, k keys to move from one line to the
next, the cursor is moved to the next line in the file instead of
the next line on the screen. How do I move from one screen line to
the next?
- 9.5. What is the definition of a sentence, paragraph and section in
+ 10.5. What is the definition of a sentence, paragraph and section in
Vim?
- 9.6. How do I jump to beginning or end of a sentence, paragraph or a
+ 10.6. How do I jump to beginning or end of a sentence, paragraph or a
section?
- 9.7. I have lines in a file that extends beyond the right extent of the
+ 10.7. I have lines in a file that extends beyond the right extent of the
screen. How do I move the Vim view to the right to see the text
off the screen?
- 9.8. How do I scroll two or more buffers simultaneously?
- 9.9. When I use my arrow keys, Vim changes modes, inserts weird
+ 10.8. How do I scroll two or more buffers simultaneously?
+ 10.9. When I use my arrow keys, Vim changes modes, inserts weird
characters in my document but doesn't move the cursor properly.
What's going on?
- 9.10. How do I configure Vim to move the cursor to the end of the
+ 10.10. How do I configure Vim to move the cursor to the end of the
previous line, when the left arrow key is pressed and the cursor
is currently at the beginning of a line?
- 9.11. How do I configure Vim to stay only in insert mode (modeless
+ 10.11. How do I configure Vim to stay only in insert mode (modeless
editing)?
- 9.12. How do I save and use Vim marks across Vim sessions?
- 9.13. How do I display some context lines when scrolling text?
+ 10.12. How do I display some context lines when scrolling text?
+ 10.13. How do I go back to previous cursor locations?
-SECTION 10 - SEARCHING TEXT
- 10.1. After I searched for a text with a pattern, all the matched text
+SECTION 11 - SEARCHING TEXT
+ 11.1. After I searched for a text with a pattern, all the matched text
stays highlighted. How do I turn off the highlighting
temporarily/permanently?
- 10.2. How do I enter a carriage return character in a search pattern?
- 10.3. How do I search for the character ^M?
- 10.4. How can I search/replace characters that display as '~R', '~S',
+ 11.2. How do I enter a carriage return character in a search pattern?
+ 11.3. How do I search for the character ^M?
+ 11.4. How can I search/replace characters that display as '~R', '~S',
etc.?
- 10.5. How do I highlight all the non-printable characters in a file?
- 10.6. How do I search for whole words in a file?
- 10.7. How do I search for the current word under the cursor?
- 10.8. How do I search for a word without regard to the case (uppercase
+ 11.5. How do I highlight all the non-printable characters in a file?
+ 11.6. How do I search for whole words in a file?
+ 11.7. How do I search for the current word under the cursor?
+ 11.8. How do I search for a word without regard to the case (uppercase
or lowercase)?
- 10.9. How do I search for words that occur twice consecutively?
- 10.10. How do I count the number of times a particular word occurs in a
+ 11.9. How do I search for words that occur twice consecutively?
+ 11.10. How do I count the number of times a particular word occurs in a
buffer?
- 10.11. How do I place the cursor at the end of the matched word when
+ 11.11. How do I place the cursor at the end of the matched word when
searching for a pattern?
- 10.12. How do I search for an empty line?
- 10.13. How do I search for a line containing only a single character?
- 10.14. How do I search and replace a string in multiple files?
- 10.15. I am using the ":s" substitute command in a mapping. When a
+ 11.12. How do I search for an empty line?
+ 11.13. How do I search for a line containing only a single character?
+ 11.14. How do I search and replace a string in multiple files?
+ 11.15. I am using the ":s" substitute command in a mapping. When a
search for a pattern fails, the map terminates. I would like the
map to continue processing the next command, even if the
substitute command fails. How do I do this?
- 10.16. How do I search for the n-th occurrence of a character in a
+ 11.16. How do I search for the n-th occurrence of a character in a
line?
- 10.17. How do I replace a tab (or any other character) with a hard
+ 11.17. How do I replace a tab (or any other character) with a hard
return (newline) character?
- 10.18. How do I search for a character by its ASCII value?
- 10.19. How do I search for long lines?
-
-SECTION 11 - CHANGING TEXT
- 11.1. How do I delete all the trailing white space characters (SPACE
+ 11.18. How do I search for a character by its ASCII value?
+ 11.19. How do I search for long lines?
+ 11.20. How do I display all the lines in the current buffer that
+ contain a specified pattern?
+ 11.21. How do I search for a text string that spans multiple lines?
+ 11.22. How do I search for a pattern only within a range of lines
+ in a buffer?
+
+SECTION 12 - CHANGING TEXT
+ 12.1. How do I delete all the trailing white space characters (SPACE
and TAB) at the end of all the lines in a file?
- 11.2. How do I replace all the occurrences of multiple consecutive
+ 12.2. How do I replace all the occurrences of multiple consecutive
space characters to a single space?
- 11.3. How do I reduce a range of empty lines into one line only?
- 11.4. How do I delete all blank lines in a file? How do I remove all
+ 12.3. How do I reduce a range of empty lines into one line only?
+ 12.4. How do I delete all blank lines in a file? How do I remove all
the lines containing only space characters?
- 11.5. How do I copy/yank the current word? (*Updated*)
- 11.6. How do I yank text from one position to another position within a
+ 12.5. How do I copy/yank the current word?
+ 12.6. How do I yank text from one position to another position within a
line, without yanking the entire line?
- 11.7. When I yank some text into a register, how do I append the text
+ 12.7. When I yank some text into a register, how do I append the text
to the current contents of the register?
- 11.8. How do I yank a complete sentence that spans over more than one
+ 12.8. How do I yank a complete sentence that spans over more than one
line?
- 11.9. How do I yank all the lines containing a pattern into a buffer?
- 11.10. How do I delete all the lines in a file that does not contain a
+ 12.9. How do I yank all the lines containing a pattern into a buffer?
+ 12.10. How do I delete all the lines in a file that does not contain a
pattern?
- 11.11. How do I add a line before each line with "pattern" in it?
- 11.12. Is there a way to operate on a line if the previous line
+ 12.11. How do I add a line before each line with "pattern" in it?
+ 12.12. Is there a way to operate on a line if the previous line
contains a particular pattern?
- 11.13. How do I execute a command on all the lines containing a
+ 12.13. How do I execute a command on all the lines containing a
pattern?
- 11.14. Can I copy the character above the cursor to the current cursor
+ 12.14. Can I copy the character above the cursor to the current cursor
position?
- 11.15. How do I insert a blank line above/below the current line
+ 12.15. How do I insert a blank line above/below the current line
without entering insert mode?
- 11.16. How do I insert the name of current file into the current
+ 12.16. How do I insert the name of current file into the current
+ buffer?
+ 12.17. How do I insert the contents of a Vim register into the current
buffer?
- 11.17. How do I move the cursor past the end of line and insert some
+ 12.18. How do I move the cursor past the end of line and insert some
characters at some columns after the end of the line?
- 11.18. How to replace the word under the cursor (say: junk) with
+ 12.19. How to replace the word under the cursor (say: junk) with
"foojunkbar" in Vim?
- 11.19. How do I replace a particular text in all the files in a
+ 12.20. How do I replace a particular text in all the files in a
directory?
- 11.20. I have some numbers in a file. How do I increment or decrement
+ 12.21. I have some numbers in a file. How do I increment or decrement
the numbers in the file?
- 11.21. How do I reuse the last used search pattern in a ":substitute"
+ 12.22. How do I reuse the last used search pattern in a ":substitute"
command?
- 11.22. How do I change the case of a string using the ":substitute"
+ 12.23. How do I change the case of a string using the ":substitute"
command?
- 11.23. How do I enter characters that are not present in the keyboard?
- 11.24. Is there a command to remove any or all digraphs?
- 11.25. In insert mode, when I press the backspace key, it erases only
+ 12.24. How do I enter characters that are not present in the keyboard?
+ 12.25. Is there a command to remove any or all digraphs?
+ 12.26. In insert mode, when I press the backspace key, it erases only
the characters entered in this instance of insert mode. How do I
erase previously entered characters in insert mode using the
backspace key?
- 11.26. I have a file which has lines longer than 72 characters
+ 12.27. I have a file which has lines longer than 72 characters
terminated with "+" and wrapped to the next line. How can I
quickly join the lines?
- 11.27. How do I paste characterwise yanked text into separate lines?
- 11.28. How do I change the case (uppercase, lowercase) of a word or
+ 12.28. How do I paste characterwise yanked text into separate lines?
+ 12.29. How do I change the case (uppercase, lowercase) of a word or
a character or a block of text?
- 11.29. How do I enter ASCII characters that are not present in the
+ 12.30. How do I enter ASCII characters that are not present in the
keyboard?
- 11.30. How do I replace non-printable characters in a file?
- 11.31. How do I remove duplicate lines from a buffer?
- 11.32. How do I prefix all the lines in a file with the corresponding
+ 12.31. How do I replace non-printable characters in a file?
+ 12.32. How do I remove duplicate lines from a buffer?
+ 12.33. How do I prefix all the lines in a file with the corresponding
line numbers?
- 11.33. How do I exchange (swap) two characters or words or lines?
- (*New*)
+ 12.34. How do I exchange (swap) two characters or words or lines?
+ 12.35. How do I change the characters used as word delimiters?
-SECTION 12 - COMPLETION IN INSERT MODE
- 12.1. How do I complete words or lines in insert mode?
- 12.2. How do I complete file names in insert mode?
- 12.3. I am using CTRL-P/CTRL-N to complete words in insert mode. How do
+SECTION 13 - COMPLETION IN INSERT MODE
+ 13.1. How do I complete words or lines in insert mode?
+ 13.2. How do I complete file names in insert mode?
+ 13.3. I am using CTRL-P/CTRL-N to complete words in insert mode. How do
I complete words that occur after the just completed word?
-SECTION 13 - TEXT FORMATTING
- 13.1. How do I format a text paragraph so that a new line is inserted
+SECTION 14 - TEXT FORMATTING
+ 14.1. How do I format a text paragraph so that a new line is inserted
at the end of each wrapped line?
- 13.2. How do I format long lines in a file so that each line contains
+ 14.2. How do I format long lines in a file so that each line contains
less than 'n' characters?
- 13.3. How do I join short lines to the form a paragraph?
- 13.4. How do I format bulleted and numbered lists?
- 13.5. How do I indent lines in insert mode? (*Updated*)
- 13.6. How do I format/indent an entire file?
- 13.7. How do I increase or decrease the indentation of the current
+ 14.3. How do I join short lines to the form a paragraph?
+ 14.4. How do I format bulleted and numbered lists?
+ 14.5. How do I indent lines in insert mode?
+ 14.6. How do I format/indent an entire file?
+ 14.7. How do I increase or decrease the indentation of the current
line?
- 13.8. How do I indent a block/group of lines?
- 13.9. When I indent lines using the > or < key, the standard 8-tabstops
+ 14.8. How do I indent a block/group of lines?
+ 14.9. When I indent lines using the > or < key, the standard 8-tabstops
are used instead of the current 'tabstop' setting. Why?
- 13.10. How do I turn off the automatic indentation of text?
- 13.11. How do I configure Vim to automatically set the 'textwidth'
+ 14.10. How do I turn off the automatic indentation of text?
+ 14.11. How do I configure Vim to automatically set the 'textwidth'
option to a particular value when I edit mails?
- 13.12. Is there a way to make Vim auto-magically break lines?
- 13.13. I am seeing a lot of ^M symbols in my file. I tried setting the
+ 14.12. Is there a way to make Vim auto-magically break lines?
+ 14.13. I am seeing a lot of ^M symbols in my file. I tried setting the
'fileformat' option to 'dos' and then 'unix' and then 'mac'.
None of these helped. How can I hide these symbols?
- 13.14. When I paste some text into a Vim buffer from another
+ 14.14. When I paste some text into a Vim buffer from another
application, the alignment (indentation) of the new text is
messed up. How do I fix this?
- 13.15. When there is a very long wrapped line (wrap is "on") and a line
+ 14.15. When there is a very long wrapped line (wrap is "on") and a line
doesn't fit entirely on the screen it is not displayed at all.
There are blank lines beginning with '@' symbol instead of
wrapped line. If I scroll the screen to fit the line the '@'
symbols disappear and the line is displayed again. What Vim
setting control this behavior?
- 13.16. How do I convert all the tab characters in a file to space
+ 14.16. How do I convert all the tab characters in a file to space
characters?
- 13.17. What Vim options can I use to edit text that will later go to a
+ 14.17. What Vim options can I use to edit text that will later go to a
word processor?
+ 14.18. How do I join lines without adding or removing any space
+ characters?
-SECTION 14 - VISUAL MODE
- 14.1. How do I do rectangular block copying?
- 14.2. How do I delete or change a column of text in a file?
- 14.3. How do I apply an ex-command on a set of visually selected lines?
- 14.4. How do I execute an ex command on a column of text selected in
+SECTION 15 - VISUAL MODE
+ 15.1. How do I do rectangular block copying?
+ 15.2. How do I delete or change a column of text in a file?
+ 15.3. How do I apply an ex-command on a set of visually selected lines?
+ 15.4. How do I execute an ex command on a column of text selected in
Visual block mode?
- 14.5. How do I select the entire file in visual mode?
- 14.6. When I visually select a set of lines and press the > key to
+ 15.5. How do I select the entire file in visual mode?
+ 15.6. When I visually select a set of lines and press the > key to
indent the selected lines, the visual mode ends. How can I
reselect the region for further operation? (or) How do I
- re-select the last selected visual area again? (*Updated*)
- 14.7. How do I jump to the beginning/end of a visually selected region?
- 14.8. When I select text with mouse and then press : to enter an ex
+ re-select the last selected visual area again?
+ 15.7. How do I jump to the beginning/end of a visually selected region?
+ 15.8. When I select text with mouse and then press : to enter an ex
command, the selected text is replaced with the : character. How
do I execute an ex command on a text selected using the mouse
similar to the text selected using the visual mode?
- 14.9. When I select a block of text using the mouse, Vim goes into
+ 15.9. When I select a block of text using the mouse, Vim goes into
selection mode instead of Visual mode. Why?
-SECTION 15 - COMMAND-LINE MODE
- 15.1. How do I use the name of the current file in the command mode or
+SECTION 16 - COMMAND-LINE MODE
+ 16.1. How do I use the name of the current file in the command mode or
an ex command line?
- 15.2. How do I edit the text in the Vim command-line effectively?
- 15.3. How do I switch from Vi mode to Ex mode?
- 15.4. How do I copy the output from an ex-command into a buffer?
- 15.5. When I press the tab key to complete the name of a file in the
+ 16.2. How do I edit the text in the Vim command-line effectively?
+ 16.3. How do I switch from Vi mode to Ex mode?
+ 16.4. How do I copy the output from an ex-command into a buffer?
+ 16.5. When I press the tab key to complete the name of a file in the
command mode, if there are more than one matching file names,
then Vim completes the first matching file name and displays a
list of all matching filenames. How do I configure Vim to only
display the list of all the matching filenames and not complete
the first one?
- 15.6. How do I copy text from a buffer to the command line and from the
+ 16.6. How do I copy text from a buffer to the command line and from the
command line to a buffer?
- 15.7. How do I put a command onto the command history without executing
+ 16.7. How do I put a command onto the command history without executing
it?
+ 16.8. How do I increase the height of the command-line?
+
+SECTION 17 - VIMINFO
+ 17.1. When I invoke Vim, I get error messages about illegal characters
+ in the viminfo file. What should I do to get rid of these
+ messages?
+ 17.2. How do I disable the viminfo feature?
+ 17.3. How do I save and use Vim marks across Vim sessions?
-SECTION 16 - REMOTE EDITING
- 16.1. How do I open a file with existing instance of gvim? What
+SECTION 18 - REMOTE EDITING
+ 18.1. How do I open a file with existing instance of gvim? What
happened to the Vim 5.x OpenWithVim.exe and SendToVim.exe files?
- 16.2. How do I send a command to a Vim server to write all buffers to
+ 18.2. How do I send a command to a Vim server to write all buffers to
disk?
- 16.3. Where can I get the documentation about the Vim remote server
+ 18.3. Where can I get the documentation about the Vim remote server
functionality?
-SECTION 17 - OPTIONS
- 17.1. How do I configure Vim in a simple way?
- 17.2. How do I toggle the value of an option?
- 17.3. How do I set an option that affects only the current
+SECTION 19 - OPTIONS
+ 19.1. How do I configure Vim in a simple way?
+ 19.2. How do I toggle the value of an option?
+ 19.3. How do I set an option that affects only the current
buffer/window?
- 17.4. How do I use space characters for a Vim option value?
- 17.5. Can I add (embed) Vim option settings to the contents of a file?
- 17.6. How do I display the line numbers of all the lines in a file?
- 17.7. How do I change the width of the line numbers displayed using the
- "number" option? (*Updated*)
- 17.8. How do I display (view) all the invisible characters in a file?
- 17.9. How do I configure Vim to always display the current line and
+ 19.4. How do I use space characters for a Vim option value?
+ 19.5. Can I add (embed) Vim option settings to the contents of a file?
+ 19.6. How do I display the line numbers of all the lines in a file?
+ 19.7. How do I change the width of the line numbers displayed using the
+ "number" option?
+ 19.8. How do I display (view) all the invisible characters like space,
+ tabs and newlines in a file?
+ 19.9. How do I configure Vim to always display the current line and
column number?
- 17.10. How do I display the current Vim mode?
- 17.11. How do I configure Vim to show pending/partial commands on the
+ 19.10. How do I display the current Vim mode?
+ 19.11. How do I configure Vim to show pending/partial commands on the
status line?
- 17.12. How do I configure the Vim status line to display different
+ 19.12. How do I configure the Vim status line to display different
settings/values?
- 17.13. How do I configure Vim to display status line always?
- 17.14. How do I make a Vim setting persistent across different Vim
+ 19.13. How do I configure Vim to display status line always?
+ 19.14. How do I make a Vim setting persistent across different Vim
invocations/instances/sessions?
- 17.15. Why do I hear a beep (why does my window flash) about 1 second
+ 19.15. Why do I hear a beep (why does my window flash) about 1 second
after I hit the Escape key?
- 17.16. How do I make the 'c' and 's' commands display a '$' instead of
+ 19.16. How do I make the 'c' and 's' commands display a '$' instead of
deleting the characters I'm changing?
- 17.17. How do I remove more than one flag using a single ":set" command
+ 19.17. How do I remove more than one flag using a single ":set" command
from a Vim option?
-SECTION 18 - MAPPING KEYS
- 18.1. How do I know what a key is mapped to?
- 18.2. How do list all the user-defined key mappings?
- 18.3. How do I unmap a key?
- 18.4. I am not able to create a mapping for the <xxx> key. What is
+SECTION 20 - MAPPING KEYS
+ 20.1. How do I know what a key is mapped to?
+ 20.2. How do list all the user-defined key mappings?
+ 20.3. How do I unmap a key?
+ 20.4. I am not able to create a mapping for the <xxx> key. What is
wrong?
- 18.5. How do I map the numeric keypad keys?
- 18.6. How do I create a mapping that works only in visual mode?
- 18.7. In a Vim script, how do I know which keys to use for my mappings,
+ 20.5. How do I map the numeric keypad keys?
+ 20.6. How do I create a mapping that works only in visual mode?
+ 20.7. In a Vim script, how do I know which keys to use for my mappings,
so that the mapped key will not collide with an already used key?
- 18.8. How do I map the escape key?
- 18.9. How do I map a key to perform nothing?
- 18.10. I want to use the Tab key to indent a block of text and
+ 20.8. How do I map the escape key?
+ 20.9. How do I map a key to perform nothing?
+ 20.10. I want to use the Tab key to indent a block of text and
Shift-Tab key to unindent a block of text. How do I map the keys
to do this? This behavior is similar to textpad, visual studio,
etc.
- 18.11. In my mappings the special characters like <CR> are not
+ 20.11. In my mappings the special characters like <CR> are not
recognized. How can I configure Vim to recognize special
characters?
- 18.12. How do I use the '|' to separate multiple commands in a map?
- 18.13. If I have a mapping/abbreviation whose ending is the beginning of
+ 20.12. How do I use the '|' to separate multiple commands in a map?
+ 20.13. If I have a mapping/abbreviation whose ending is the beginning of
another mapping/abbreviation, how do I keep the first from
expanding into the second one?
- 18.14. Why does it take a second or more for Vim to process a key,
+ 20.14. Why does it take a second or more for Vim to process a key,
sometimes when I press a key?
- 18.15. How do I map a key to run an external command using a visually
+ 20.15. How do I map a key to run an external command using a visually
selected text?
- 18.16. How do I map the Ctrl-I key while still retaining the
+ 20.16. How do I map the Ctrl-I key while still retaining the
functionality of the <Tab> key?
-SECTION 19 - ABBREVIATIONS
- 19.1. How do I auto correct misspelled words? (*New*)
- 19.2. How do I create multi-line abbreviations?
- 19.3. When my abbreviations are expanded, an additional space character
+SECTION 21 - ABBREVIATIONS
+ 21.1. How do I auto correct misspelled words?
+ 21.2. How do I create multi-line abbreviations?
+ 21.3. When my abbreviations are expanded, an additional space character
is added at the end of the expanded text. How do I avoid this
character?
- 19.4. How do I insert the current date/time stamp into the file?
-
-SECTION 20 - RECORD AND PLAYBACK
- 20.1. How do I repeat an editing operation (insertion, deletion, paste,
- etc)? (*New*)
- 20.2. How I record and repeat a set of key sequences?
- 20.3. How do I edit/modify a recorded set of key sequences?
- 20.4. How do I write recorded key sequences to a file?
- 20.5. I am using register 0 to record my key sequences (i.e. q0 ....
+ 21.4. How do I insert the current date/time stamp into the file?
+ 21.5. How do I prevent an abbreviation from expanding in insert mode?
+
+SECTION 22 - RECORD AND PLAYBACK
+ 22.1. How do I repeat an editing operation (insertion, deletion, paste,
+ etc)?
+ 22.2. How I record and repeat a set of key sequences?
+ 22.3. How do I edit/modify a recorded set of key sequences?
+ 22.4. How do I write recorded key sequences to a file?
+ 22.5. I am using register 0 to record my key sequences (i.e. q0 ....
q). In the recorded key sequences, I am yanking some text. After
the first replay of the recorded key sequence, I am no longer
able to play it back.
-SECTION 21 - AUTOCOMMANDS
- 21.1. How do I execute a command when I try to modify a read-only file?
- 21.2. How do I execute a command every time when entering a buffer?
- 21.3. How do I execute a command every time when entering a window?
- 21.4. From an autocmd, how can I determine the name of the file or the
+SECTION 23 - AUTOCOMMANDS
+ 23.1. How do I execute a command when I try to modify a read-only file?
+ 23.2. How do I execute a command every time when entering a buffer?
+ 23.3. How do I execute a command every time when entering a window?
+ 23.4. From an autocmd, how can I determine the name of the file or the
buffer number for which the autocommand is executed?
- 21.5. How do I automatically save all the changed buffers whenever Vim
+ 23.5. How do I automatically save all the changed buffers whenever Vim
loses focus?
- 21.6. How do I execute/run a function when Vim exits to do some
+ 23.6. How do I execute/run a function when Vim exits to do some
cleanup?
-SECTION 22 - SYNTAX HIGHLIGHT
- 22.1. How do I turn off/on syntax highlighting?
- 22.2. How do I change the background and foreground colors used by Vim?
- 22.3. How do I change the highlight colors to suit a dark/light
+SECTION 24 - SYNTAX HIGHLIGHT
+ 24.1. How do I turn off/on syntax highlighting?
+ 24.2. How do I change the background and foreground colors used by Vim?
+ 24.3. How do I change the highlight colors to suit a dark/light
background?
- 22.4. How do I change the color of the line numbers displayed when the
+ 24.4. How do I change the color of the line numbers displayed when the
":set number" command is used?
- 22.5. How do I change the background color used for a Visually selected
+ 24.5. How do I change the background color used for a Visually selected
block?
- 22.6. How do I highlight the special characters (tabs, trailing spaces,
+ 24.6. How do I highlight the special characters (tabs, trailing spaces,
end of line, etc) displayed by the 'list' option?
- 22.7. How do I specify a colorscheme in my .vimrc/.gvimrc file, so that
+ 24.7. How do I specify a colorscheme in my .vimrc/.gvimrc file, so that
Vim uses the specified colorscheme everytime?
- 22.8. Vim syntax highlighting is broken. When I am editing a file, some
+ 24.8. Vim syntax highlighting is broken. When I am editing a file, some
parts of the file is not syntax highlighted or syntax highlighted
incorrectly.
- 22.9. Is there a built-in function to syntax-highlight the
+ 24.9. Is there a built-in function to syntax-highlight the
corresponding matching bracket?
- 22.10. How do I turn off the C comment syntax highlighting?
- 22.11. How do I add my own syntax extensions to the standard syntax
+ 24.10. How do I turn off the C comment syntax highlighting?
+ 24.11. How do I add my own syntax extensions to the standard syntax
files supplied with Vim?
- 22.12. How do I replace a standard syntax file that comes with the Vim
+ 24.12. How do I replace a standard syntax file that comes with the Vim
distribution with my own syntax file?
- 22.13. How do I highlight all the characters after a particular column?
- 22.14. How do I convert a source file (.c, .h, etc) with the Vim syntax
+ 24.13. How do I highlight all the characters after a particular column?
+ 24.14. How do I convert a source file (.c, .h, etc) with the Vim syntax
highlighting into a HTML file?
- 22.15. How do I list the definition of all the current highlight
- groups? (*New*)
-
-SECTION 23 - VIM SCRIPT WRITING
- 23.1. How do I list the names of all the scripts sourced by Vim?
- 23.2. How do I debug Vim scripts?
- 23.3. How do I locate the script/plugin which sets a Vim option?
- 23.4. I am getting some error/informational messages from Vim (possibly
+ 24.15. How do I list the definition of all the current highlight
+ groups?
+
+SECTION 25 - VIM SCRIPT WRITING
+ 25.1. How do I list the names of all the scripts sourced by Vim?
+ 25.2. How do I debug Vim scripts?
+ 25.3. How do I locate the script/plugin which sets a Vim option?
+ 25.4. I am getting some error/informational messages from Vim (possibly
when running a script), the messages are cleared immediately. How
do I display the messages again?
- 23.5. How do I save and restore a plugin specific information across
+ 25.5. How do I save and restore a plugin specific information across
Vim invocations?
- 23.6. How do I start insert mode from a Vim function?
- 23.7. How do I change the cursor position from within a Vim function?
- 23.8. How do I check the value of an environment variable in the .vimrc
+ 25.6. How do I start insert mode from a Vim function?
+ 25.7. How do I change the cursor position from within a Vim function?
+ 25.8. How do I check the value of an environment variable in the .vimrc
file?
- 23.9. How do I check whether an environment variable is set or not from
+ 25.9. How do I check whether an environment variable is set or not from
a Vim function?
- 23.10. How do I call/use the Vim built-in functions?
- 23.11. I am using some normal mode commands in my Vim script. How do I
+ 25.10. How do I call/use the Vim built-in functions?
+ 25.11. I am using some normal mode commands in my Vim script. How do I
avoid using the user-defined mappings for these normal mode
commands and use the standard Vim functionality for these normal
mode commands?
- 23.12. How do I get a visually selected text into a Vim variable or
+ 25.12. How do I get a visually selected text into a Vim variable or
register?
- 23.13. I have some text in a Vim variable 'myvar'. I would like to use
+ 25.13. I have some text in a Vim variable 'myvar'. I would like to use
this variable in a ":s" substitute command to replace a text
'mytext'. How do I do this?
- 23.14. A Vim variable (bno) contains a buffer number. How do I use this
+ 25.14. A Vim variable (bno) contains a buffer number. How do I use this
variable to open the corresponding buffer?
- 23.15. How do I store the value of a Vim option into a Vim variable?
- 23.16. I have copied and inserted some text into a buffer from a Vim
+ 25.15. How do I store the value of a Vim option into a Vim variable?
+ 25.16. I have copied and inserted some text into a buffer from a Vim
function. How do I indent the inserted text from the Vim
function?
- 23.17. How do I get the character under the cursor from a Vim script?
- 23.18. How do I get the name of the current file without the extension?
- 23.19. How do I get the basename of the current file?
- 23.20. How do I get the output from a Vim function into the current
+ 25.17. How do I get the character under the cursor from a Vim script?
+ 25.18. How do I get the name of the current file without the extension?
+ 25.19. How do I get the basename of the current file?
+ 25.20. How do I get the output from a Vim function into the current
buffer?
- 23.21. How do I call external programs from a Vim function?
- 23.22. How do I get the return status of a program executed using the
+ 25.21. How do I call external programs from a Vim function?
+ 25.22. How do I get the return status of a program executed using the
":!" command?
- 23.23. How do I determine whether the current buffer is modified or
+ 25.23. How do I determine whether the current buffer is modified or
not?
- 23.24. I would like to use the carriage return character in a normal
+ 25.24. I would like to use the carriage return character in a normal
command from a Vim script. How do I specify the carriage return
character?
- 23.25. How do I split long lines in a Vim script?
- 23.26. When I try to "execute" my function using the "execute 'echo
+ 25.25. How do I split long lines in a Vim script?
+ 25.26. When I try to "execute" my function using the "execute 'echo
Myfunc()'" command, the cursor is moved to the top of the
current buffer. Why?
- 23.27. How do I source/execute the contents of a register?
- 23.28. After calling a Vim function or a mapping, when I press the 'u'
+ 25.27. How do I source/execute the contents of a register?
+ 25.28. After calling a Vim function or a mapping, when I press the 'u'
key to undo the last change, Vim undoes all the changes made by
the mapping/function. Why?
- 23.29. How can I call a function defined with s: (script local
+ 25.29. How can I call a function defined with s: (script local
function) from another script/plugin?
- 23.30. Is it possible to un-source a sourced script? In otherwords,
+ 25.30. Is it possible to un-source a sourced script? In otherwords,
reverse all the commands executed by sourcing a script.
- 23.31. How do I get the character under the cursor?
-
-SECTION 24 - PLUGINS
- 24.1. How do I set different options for different types of files?
- 24.2. I have downloaded some Vim plugins, syntax files, indent files,
- color schemes, filetype plugins, etc from the web. Where should I
- copy these files so that Vim will find them?
- 24.3. How do I extend an existing filetype plugin?
- 24.4. How do I turn off loading the Vim plugins?
- 24.5. How do I turn on/off loading the filetype plugins?
- 24.6. How do I override settings made in a file type plugin in the
+
+SECTION 26 - PLUGINS
+ 26.1. How do I set different options for different types of files?
+ 26.2. I have downloaded a Vim plugin or a syntax file or a indent file,
+ or a color scheme or a filetype plugin from the web. Where should
+ I copy these files so that Vim will find them?
+ 26.3. How do I extend an existing filetype plugin?
+ 26.4. How do I turn off loading the Vim plugins?
+ 26.5. How do I turn on/off loading the filetype plugins?
+ 26.6. How do I override settings made in a file type plugin in the
global ftplugin directory for all the file types?
- 24.7. How do I disable the Vim directory browser plugin?
- 24.8. How do I set the filetype option for files with names matching a
+ 26.7. How do I disable the Vim directory browser plugin?
+ 26.8. How do I set the filetype option for files with names matching a
particular pattern or depending on the file extension?
-SECTION 25 - EDITING PROGRAM FILES
- 25.1. How do I enable automatic indentation for C/C++ files?
- 25.2. How do I configure the indentation used for C/C++ files?
- 25.3. How do I turn off the automatic indentation feature?
- 25.4. How do I change the number of space characters used for the
+SECTION 27 - EDITING PROGRAM FILES
+ 27.1. How do I enable automatic indentation for C/C++ files?
+ 27.2. How do I configure the indentation used for C/C++ files?
+ 27.3. How do I turn off the automatic indentation feature?
+ 27.4. How do I change the number of space characters used for the
automatic indentation?
- 25.5. I am editing a C program using Vim. How do I display the
+ 27.5. I am editing a C program using Vim. How do I display the
definition of a macro or a variable?
- 25.6. I am editing a C program using Vim. How do I jump to the
+ 27.6. I am editing a C program using Vim. How do I jump to the
beginning or end of a code block from within the block?
- 25.7. Is there a way to turn off the "//" comment auto-insertion
+ 27.7. Is there a way to turn off the "//" comment auto-insertion
behavior for C++ files? If I'm sitting on a line beginning with
"//", then I open a new line above or below it, Vim automatically
inserts new "//" chars.
- 25.8. How do I add the comment character '#' to a set of lines at the
+ 27.8. How do I add the comment character '#' to a set of lines at the
beginning of each line?
- 25.9. How do I edit a header file with the same name as the
+ 27.9. How do I edit a header file with the same name as the
corresponding C source file?
- 25.10. How do I automatically insert comment leaders while typing
+ 27.10. How do I automatically insert comment leaders while typing
comments?
-SECTION 26 - QUICKFIX
- 26.1. How do I build programs from Vim?
- 26.2. When I run the make command in Vim I get the errors listed as the
+SECTION 28 - QUICKFIX
+ 28.1. How do I build programs from Vim?
+ 28.2. When I run the make command in Vim I get the errors listed as the
compiler compiles the program. When it finishes this list
disappears and I have to use the :clist command to see the error
message again. Is there any other way to see these error
messages?
-SECTION 27 - FOLDING
- 27.1. How do I extend the Vim folding support?
- 27.2. When I enable folding by setting the 'foldmethod' option, all the
+SECTION 29 - FOLDING
+ 29.1. How do I extend the Vim folding support?
+ 29.2. When I enable folding by setting the 'foldmethod' option, all the
folds are closed. How do I prevent this?
- 27.3. How do I control how many folds will be opened when I start
+ 29.3. How do I control how many folds will be opened when I start
editing a file?
- 27.4. How do I open and close folds using the mouse?
- 27.5. How do I change the text displayed for a closed fold?
- 27.6. How do I store and restore manually created folds across
+ 29.4. How do I open and close folds using the mouse?
+ 29.5. How do I change the text displayed for a closed fold?
+ 29.6. How do I store and restore manually created folds across
different Vim invocations?
-SECTION 28 - VIM WITH EXTERNAL APPLICATIONS
- 28.1. Can I run a shell inside a Vim window?
- 28.2. How do I pass the word under the cursor to an external command?
- 28.3. How do I get the output of a shell command into a Vim buffer?
- 28.4. How do I pipe the contents of the current buffer to a external
+SECTION 30 - VIM WITH EXTERNAL APPLICATIONS
+ 30.1. Can I run a shell inside a Vim window?
+ 30.2. How do I pass the word under the cursor to an external command?
+ 30.3. How do I get the output of a shell command into a Vim buffer?
+ 30.4. How do I pipe the contents of the current buffer to an external
command and replace the contents of the buffer with the output
from the command?
- 28.5. How do I sort a section of my file?
- 28.6. Is there a step-by-step guide for using Vim with slrn?
- 28.7. How do I use Vim as a pager?
- 28.8. How do I view Unix man pages from inside Vim?
- 28.9. How do I change the diff command used by the Vim diff support?
- 28.10. How do I use the Vim diff mode without folding?
-
-SECTION 29 - GUI VIM
- 29.1. How do I create buffer specific menus?
- 29.2. How do I change the font used by GUI Vim?
- 29.3. When starting GUI Vim, how do I specify the location of the GVIM
+ 30.5. How do I sort a section of my file?
+ 30.6. Is there a step-by-step guide for using Vim with slrn?
+ 30.7. How do I use Vim as a pager?
+ 30.8. How do I view Unix man pages from inside Vim?
+ 30.9. How do I change the diff command used by the Vim diff support?
+ 30.10. How do I use the Vim diff mode without folding?
+
+SECTION 31 - GUI VIM
+ 31.1. How do I create buffer specific menus?
+ 31.2. How do I change the font used by GUI Vim?
+ 31.3. When starting GUI Vim, how do I specify the location of the GVIM
window?
- 29.4. How do I add a horizontal scrollbar in GVim?
- 29.5. How do I make the scrollbar appear in the left side by default?
- 29.6. How do I remove the Vim menubar?
- 29.7. I am using GUI Vim. When I press the ALT key and a letter, the
+ 31.4. How do I add a horizontal scrollbar in GVim?
+ 31.5. How do I make the scrollbar appear in the left side by default?
+ 31.6. How do I remove the Vim menubar?
+ 31.7. I am using GUI Vim. When I press the ALT key and a letter, the
menu starting with that letter is selected. I don't want this
behavior as I want to map the ALT-<key> combination. How do I do
this?
- 29.8. Is it possible to scroll the text by dragging the scrollbar so
+ 31.8. Is it possible to scroll the text by dragging the scrollbar so
that the cursor stays in the original location?
- 29.9. How do I get gvim to start browsing files in a particular
+ 31.9. How do I get gvim to start browsing files in a particular
directory when using the ":browse" command?
- 29.10. For some questions, like when a file is changed outside of Vim,
+ 31.10. For some questions, like when a file is changed outside of Vim,
Vim displays a GUI dialog box. How do I replace this GUI dialog
box with a console dialog box?
- 29.11. I am trying to use GUI Vim as the editor for my xxx application.
+ 31.11. I am trying to use GUI Vim as the editor for my xxx application.
When the xxx application launches GUI Vim to edit a file, the
control immediately returns to the xxx application. How do I
start GUI Vim, so that the control returns to the xxx
application only after I quit Vim?
- 29.12. Why does the "Select Font" dialog doesn't show all the fonts
+ 31.12. Why does the "Select Font" dialog doesn't show all the fonts
installed in my system?
- 29.13. How do I use the mouse in Vim command-line mode?
- 29.14. When I use the middle mouse button to scroll text, it pastes the
+ 31.13. How do I use the mouse in Vim command-line mode?
+ 31.14. When I use the middle mouse button to scroll text, it pastes the
last copied text. How do I disable this behavior?
- 29.15. How do I change the location and size of a GUI Vim window?
+ 31.15. How do I change the location and size of a GUI Vim window?
-SECTION 30 - VIM ON UNIX
- 30.1. I am running Vim in a xterm. When I press the CTRL-S key, Vim
+SECTION 32 - VIM ON UNIX
+ 32.1. I am running Vim in a xterm. When I press the CTRL-S key, Vim
freezes. What should I do now?
- 30.2. I am seeing weird screen update problems in Vim. What can I do to
+ 32.2. I am seeing weird screen update problems in Vim. What can I do to
solve this screen/display update problems?
- 30.3. I am using the terminal/console version of Vim. In insertmode,
+ 32.3. I am using the terminal/console version of Vim. In insertmode,
When I press the backspace key, the character before the cursor
is not erased. How do I configure Vim to do this?
- 30.4. I am using Vim in a xterm. When I quit Vim, the screen contents
+ 32.4. I am using Vim in a xterm. When I quit Vim, the screen contents
are restored back to the original contents. How do I disable
this?
- 30.5. When I start Vim, it takes quite a few seconds to start. How do I
+ 32.5. When I start Vim, it takes quite a few seconds to start. How do I
minimize the startup time?
- 30.6. How can I make the cursor in gvim in unix stop blinking?
- 30.7. How do I change the menu font on GTK Vim?
- 30.8. How do I prevent <Ctrl-Z> from suspending Vim?
- 30.9. When I kill the xterm running Vim, the Vim process continues to
+ 32.6. How can I make the cursor in gvim in unix stop blinking?
+ 32.7. How do I change the menu font on GTK Vim?
+ 32.8. How do I prevent <Ctrl-Z> from suspending Vim?
+ 32.9. When I kill the xterm running Vim, the Vim process continues to
run and takes up a lot of CPU (99%) time. Why is this happening?
- 30.10. How do I get the Vim syntax highlighting to work in a Unix
+ 32.10. How do I get the Vim syntax highlighting to work in a Unix
terminal?
-SECTION 31 - VIM ON MS-WINDOWS
- 31.1. In MS-Windows, CTRL-V doesn't start the blockwise visual mode.
+SECTION 33 - VIM ON MS-WINDOWS
+ 33.1. In MS-Windows, CTRL-V doesn't start the blockwise visual mode.
What happened?
- 31.2. When I press the CTRL-Y key, it acts like the CTRL-R key. How do
+ 33.2. When I press the CTRL-Y key, it acts like the CTRL-R key. How do
I configure Vim to treat CTRL-Y as CTRL-Y?
- 31.3. How do I start GUI Vim in a maximized window always?
- 31.4. After doing some editing operations, Vim freezes. The cursor
+ 33.3. How do I start GUI Vim in a maximized window always?
+ 33.4. After doing some editing operations, Vim freezes. The cursor
becomes an empty rectangle. I am not able enter any characters.
What is happening?
- 31.5. I am using Windows XP, the display speed of maximized GVim is
+ 33.5. I am using Windows XP, the display speed of maximized GVim is
very slow. What can I do to speed the display updates?
- 31.6. What are the recommended settings for using Vim with cygwin?
- 31.7. I am trying to use GNU diff with Vim diff mode. When I run the
+ 33.6. What are the recommended settings for using Vim with cygwin?
+ 33.7. I am trying to use GNU diff with Vim diff mode. When I run the
diff from command line, it works. When I try to use the diff with
Vim it doesn't work. What should I do now?
- 31.8. Is it possible to use Vim as an external editor for MS-Windows
+ 33.8. Is it possible to use Vim as an external editor for MS-Windows
Outlook email client?
- 31.9. I am using Vim to edit HTML files. How do I start internet
+ 33.9. I am using Vim to edit HTML files. How do I start internet
explorer with the current file to preview the HTML file?
- 31.10. I would like to use Vim with Microsoft Visual Studio. How do I
+ 33.10. I would like to use Vim with Microsoft Visual Studio. How do I
do this?
- 31.11. Where do I place the _vimrc and _gvimrc files?
- 31.12. Everytime I save a file, Vim warns about the file being changed
+ 33.11. Where do I place the _vimrc and _gvimrc files?
+ 33.12. Everytime I save a file, Vim warns about the file being changed
outside of Vim. Why?
-SECTION 32 - PRINTING
- 32.1. How do I print a file along with line numbers for all the lines?
- 32.2. How do I print a file with the Vim syntax highlighting colors?
+SECTION 34 - PRINTING
+ 34.1. How do I print a file along with line numbers for all the lines?
+ 34.2. How do I print a file with the Vim syntax highlighting colors?
-SECTION 33 - BUILDING VIM FROM SOURCE
- 33.1. How do I build Vim from the sources on a Unix system?
- 33.2. How do I install Vim in my home directory or a directory other
+SECTION 35 - BUILDING VIM FROM SOURCE
+ 35.1. How do I build Vim from the sources on a Unix system?
+ 35.2. How do I install Vim in my home directory or a directory other
than the default installation directory in Unix?
- 33.3. How do I build Vim from the sources on a MS-Windows system?
- (*Updated*)
- 33.4. The Vim help, syntax, indent files are missing from my Vim
+ 35.3. How do I build Vim from the sources on a MS-Windows system?
+ 35.4. The Vim help, syntax, indent files are missing from my Vim
installation. How do I install these files?
- 33.5. I have built Vim from the source and installed the Vim package
+ 35.5. I have built Vim from the source and installed the Vim package
using "make install". Do I need to keep the Vim source directory?
- 33.6. How do I determine the Vim features which are enabled at compile
+ 35.6. How do I determine the Vim features which are enabled at compile
time?
- 33.7. Can I build Vim without the GUI support?
- 33.8. When building Vim on a Unix system, I am getting "undefined
+ 35.7. Can I build Vim without the GUI support?
+ 35.8. When building Vim on a Unix system, I am getting "undefined
reference to term_set_winsize' error. How do I resolve this
error?
- 33.9. Vim configure keeps complaining about the lack of gtk-config
+ 35.9. Vim configure keeps complaining about the lack of gtk-config
while trying to use GTK 2.03. This is correct, since in GTK 2
they moved to using the generic pkg-config. I can get pkg-config
to list the various includes and libs for gtk, but for some
reason the configure script still isn't picking this up.
-SECTION 34 - VARIOUS
- 34.1. How do I edit binary files with Vim?
- 34.2. When I invoke Vim, I get error messages about illegal characters
- in the viminfo file. What should I do to get rid of these
- messages?
- 34.3. How do I disable the visual error flash and the error beep?
- 34.4. How do I display the ascii value of a character displayed in a
+SECTION 36 - VARIOUS
+ 36.1. How do I edit binary files with Vim?
+ 36.2. How do I disable the visual error flash and the error beep?
+ 36.3. How do I display the ascii value of a character displayed in a
buffer?
- 34.5. Can I use zero as a count for a Vim command?
- 34.6. How do I disable the Vim welcome screen?
- 34.7. How do I avoid the "hit enter to continue" prompt?
- 34.8. How do I invoke Vim from command line to run a group of commands
+ 36.4. Can I use zero as a count for a Vim command?
+ 36.5. How do I disable the Vim welcome screen?
+ 36.6. How do I avoid the "hit enter to continue" prompt?
+ 36.7. How do I invoke Vim from command line to run a group of commands
on a group of files?
- 34.9. How do I disable the viminfo feature?
+ 36.8. How do I use a normal mode command from insert mode without
+ leaving the insert mode?
+ 36.9. How do I start Vim in insert mode?
-SECTION 35 - UNICODE
- 35.1. Is it possible to create Unicode files using Vim?
- 35.2. Which Vim settings are particularly important for editing Unicode
+SECTION 37 - UNICODE
+ 37.1. Is it possible to create Unicode files using Vim?
+ 37.2. Which Vim settings are particularly important for editing Unicode
files?
- 35.3. What is the 'encoding' option?
- 35.4. How does Vim name the various Unicode encodings?
- 35.5. How does Vim specify the presence or absence of a byte-order
+ 37.3. What is the 'encoding' option?
+ 37.4. How does Vim name the various Unicode encodings?
+ 37.5. How does Vim specify the presence or absence of a byte-order
mark?
- 35.6. What is the 'fileencoding' option?
- 35.7. What is the 'fileencodings' option?
- 35.8. What is the 'termencoding' option?
- 35.9. What is the 'bomb' option?
- 35.10. Where can I find an example of a typical use of all these
+ 37.6. What is the 'fileencoding' option?
+ 37.7. What is the 'fileencodings' option?
+ 37.8. What is the 'termencoding' option?
+ 37.9. What is the 'bomb' option?
+ 37.10. Where can I find an example of a typical use of all these
options?
- 35.11. How can I insert Unicode characters into a file using Vim?
- 35.12. How can I know which digraphs are defined and for which
+ 37.11. How can I insert Unicode characters into a file using Vim?
+ 37.12. How can I know which digraphs are defined and for which
characters?
@@ -1064,10 +1086,12 @@ SECTION 3 - AVAILABILITY
3.1. What is the latest version of Vim?
-The latest version of Vim is 6.2 released on 1st June 2003.
+The latest version of Vim is 6.3 released on 8th June 2004.
-A history of previously released versions of Vim is below:
+The release-history of different versions of Vim is below:
+Version 6.3 8th June 2004
+Version 6.2 1st June 2003
Version 6.1 24th March 2002
Version 6.0 27th September, 2001
Version 5.8 31st May, 2001
@@ -1212,9 +1236,9 @@ For more information, read
4.6. Can I use compressed versions of the help files?
-You can compress the help files and still be able to view them with Vim.
-This makes accessing the help files a bit slower and requires the "gzip"
-utility. Follow these steps to compress and use the Vim help files:
+Yes. You can compress the help files and still be able to view them with
+Vim. This makes accessing the help files a bit slower and requires the
+"gzip" utility. Follow these steps to compress and use the Vim help files:
- Compress all the help files using "gzip doc/*.txt".
@@ -1243,57 +1267,38 @@ For more information, read
SECTION 5 - EDITING A FILE
-5.1. I am currently editing a file in Vim. How do I load another file into
- Vim?
-
-There are several ways to load another file for editing. The simplest is to
-use the ":e" command:
-
- :e <another file>
-
-For more information, read
+5.1. How do I load a file in Vim for editing?
- :help usr_07
- :help edit-files
+There are several ways to load a file for editing. The simplest is to
+use the ":e" (:edit) command:
+ :e <filename>
-5.2. When I edit and save files, Vim creates a file with the same name as
- the original file and a "~" character at the end. How do I stop Vim
- from creating this file?
-
-You have set the 'backup' option, so Vim creates a backup file when saving
-the original file. You can stop Vim from creating the backup file, by
-clearing the option:
+You can also use the ":n" (:next) command to load files into Vim:
- :set nobackup
+ :n <filename(s)>
-Note that, by default this option is turned off. You have explicitly
-enabled the 'backup' option in one of the initialization files. You may
-also have to turn off the 'writebackup' option:
+You can also use the ":args" command to load files into Vim:
- :set nowritebackup
+ :args <filename(s)>
For more information, read
- :help 07.4
- :help backup-table
- :help 'backup'
- :help 'writebackup'
- :help 'backupskip'
- :help 'backupdir'
- :help 'backupext'
- :help 'backupcopy'
- :help backup
+ :help usr_07
+ :help edit-files
+ :help :edit
+ :help :next_f
+ :help :args_f
-5.3. How do I save the current file in another name (save as) and edit a
+5.2. How do I save the current file in another name (save as) and edit a
new file?
You can use the ":saveas" command to save the current file in another name:
:saveas <newfilename>
-Alternatively, you can also do:
+Alternatively, you can also use the following commands:
:w <newfilename>
:edit #
@@ -1305,12 +1310,13 @@ You can also use the ":file" command, followed by ":w" command:
For more information, read
+ :help 07.7
:help :saveas
:help :file_f
:help :w
-5.4. How do I change the current directory to the directory of the current
+5.3. How do I change the current directory to the directory of the current
file?
You can use the following command to change the current directory to the
@@ -1331,7 +1337,7 @@ For more information, read
:help autocommand
-5.5. How do I write a file without the line feed (EOL) at the end of the
+5.4. How do I write a file without the line feed (EOL) at the end of the
file?
You can turn off the 'eol' option and turn on the 'binary' option to write
@@ -1348,7 +1354,7 @@ For more information, read
:help 23.4
-5.6. How do I configure Vim to open a file at the last edited location?
+5.5. How do I configure Vim to open a file at the last edited location?
Vim stores the cursor position of the last edited location for each buffer
in the '"' register. You can use the following autocmd in your .vimrc or
@@ -1363,12 +1369,12 @@ For more information, read
:help last-position-jump
-5.7. When editing a file in Vim, which is being changed by an external
+5.6. When editing a file in Vim, which is being changed by an external
application, Vim opens a warning window (like the confirm dialog) each
time a change is detected. How do I disable this warning?
-You can set the 'autoread' option to configure Vim to automatically read
-the file again when it is changed outside of Vim:
+You can set the Vim 'autoread' option to automatically read the file again
+when it is changed outside of Vim:
:set autoread
@@ -1387,7 +1393,7 @@ For more information, read
:help :checktime
-5.8. How do I edit a file whose name is under the cursor?
+5.7. How do I edit a file whose name is under the cursor?
You can use the gf command to edit a file whose name is under the cursor.
You can use the CTRL-W f command to edit the file in a new window.
@@ -1402,7 +1408,7 @@ For more information, read
:help 'includeexpr'
-5.9. How do I reload/re-edit the current file?
+5.8. How do I reload/re-edit the current file?
You can use the ":edit" command, without specifying a file name, to reload
the current file. If you have made modifications to the file, you can use
@@ -1416,32 +1422,9 @@ For more information, read
:help 'confirm'
-5.10. When I save a file with Vim, the file permissions are changed.
- How do I configure Vim to save a file without chaging the file
- permissions?
-
-This may happen, if the 'backupcopy' option is set to 'no' or 'auto'. Note
-that the default value for this option is set in such a way that this will
-correctly work in most of the cases. If the default doesn't work for you,
-try setting the 'backupcopy' option to 'yes' to keep the file permission
-when saving a file:
-
- :set backupcopy=yes
+5.9. How do I autosave a file periodically?
-This applies, only if you have configured Vim to make a backup whenever
-overwriting a file. By default, Vim will not backup files.
-
-For more information, read
-
- :help 'backupcopy'
- :help backup
- :help 'backup'
- :help 'writebackup'
-
-
-5.11 How do I autosave a file periodically?
-
-Vim does not support auto-saving a file periodically.
+Vim doesn't support auto-saving a file periodically.
For more information, read
@@ -1450,7 +1433,7 @@ For more information, read
:help swap-file
-5.12. How do I open a file in read-only mode?
+5.10. How do I open a file in read-only mode?
You can open a file in read-only mode using the ":view" command:
@@ -1461,7 +1444,8 @@ use the "-R" command-line option to open a file in read-only mode:
$ vim -R <filename>
-You can also use the symbolic link "view" to open a file in read-only mode:
+You can also use the symbolic link executable "view" to open a file in
+read-only mode from the command-line:
$ view <filename>
@@ -1477,12 +1461,64 @@ For more information, read
:help -M
+5.11. How do I open a file for editing without saving the modifications to
+ the current file?
+
+You can open a file for editing without saving the modifications to the
+current file and without losing the changes using one of the following
+methods:
+
+ :split <new_filename>
+ :new <new_filename>
+
+You can also set the 'hidden' option and edit a new file:
+
+ :set hidden
+ : e <new_filename>
+
+If you want to discard the changes made to the current file and load
+another file for editing, then you can use the following command:
+
+ :e! <new_filename>
+
+For more information, read
+
+ :help :edit!_f
+ :help 'hidden'
+ :help :split
+ :help :new
+
+
=============================================================================
SECTION 6 - EDITING MULTIPLE FILES
-6.1. How do I switch between files while editing multiple files in Vim?
+6.1. How do I open multiple files at once from within Vim?
+
+There are several ways to open multiple files at once from within Vim. You
+can use the ":next" command to specify a group of files:
+
+ :next f1.txt f2.txt
+ :next *.c
+
+You can use the :args command to specify a group of files as arguments:
+
+ :args f1.txt f2.txt
+ :args *.c
+
+After loading the files, you can use the ":next" and ":prev" command to
+switch between the files.
+
+For more information, read
+
+ :help 07.2
+ :help :next
+ :help :args_f
+ :help argument-list
+
+
+6.2. How do I switch between multiple files/buffers in Vim?
There are several ways to switch between multiple files. You can use the
":buffer" command to switch between multiple files. For example,
@@ -1508,15 +1544,42 @@ For more information, read
:help 07.3
-6.2. How do I configure Vim to autoload several files at once similar to
+6.3. How do I open several files in Vim, with each file in a separate
+ window?
+
+You can use the -o and -O Vim command line arguments to open multiple files
+in separate horizontally or vertically split Vim windows. For example:
+
+ $ vim -o3 f1.txt f2.txt f3.txt
+
+The above command will open the files f1.txt, f2.txt and f3.txt in three
+separate horizontally split Vim windows.
+
+ $ vim -O3 f1.txt f2.txt f3.txt
+
+The above command will open the files f1.txt, f2.txt and f3.txt in three
+separate vertically split Vim windows.
+
+For more information, read
+
+ :help -o
+ :help -O
+ :help startup-options
+
+
+6.4. How do I configure Vim to autoload several files at once similar to
"work-sets" or "projects"?
-You can use the ":mksession" and ":mkview" commands to achieve this. The
-mksession command creates a Vim script that restores the current editing
-session. You can use the ":source" command to source the file produced by
-the mksession command. The mkview command creates a Vim script that
-restores the contents of the current window. You can use the ":loadview"
-command to load the view for the current file.
+You can use the ":mksession" and the ":mkview" commands to autoload several
+files in Vim.
+
+The ":mksession" command creates a Vim script that restores the current
+editing session. You can use the ":source" command to source the file
+produced by the mksession command.
+
+The ":mkview" command creates a Vim script that restores the contents of
+the current window. You can use the ":loadview" command to load the view
+for the current file.
For more information, read
@@ -1533,54 +1596,18 @@ For more information, read
:help buffers
-6.3. Is it possible to open multiple top level windows in a single instance
+6.5. Is it possible to open multiple top level windows in a single instance
of Vim similar to Nedit or emacs?
No. It is currently not possible to open multiple top-level windows in a
single instance of Vim. This feature is in the todo list.
-6.4. How do I open multiple files at once from within Vim?
-
-There are several ways to open multiple files at once from within Vim. You
-can use the ":next" command to specify a group of file:
-
- :next f1.txt f2.txt
- :next *.c
-
-You can use the :args command to specify a group of files as argument:
-
- :args f1.txt f2.txt
- :args *.c
-
-For more information, read
-
- :help :next
- :help :args_f
- :help argument-list
-
-
-6.5. How do I open several windows in Vim by supplying command line
- arguments?
-
-You can use the -o and -O Vim command line arguments to open multiple
-horizontally or vertically split windows. For example:
-
- $ vim -o2
- $ vim -O2
-
-For more information, read
-
- :help -o
- :help -O
- :help startup-options
-
-
6.6. How do I browse/explore directories from within Vim?
You can use the explorer.vim plugin, supplied with the standard Vim
-package, to browse/explore directories from within Vim. You can start the
-file explorer using one of the following commands:
+installation, to browse/explore directories from within Vim. You can start
+the file explorer using one of the following commands:
:e <directory>
:Explore
@@ -1611,10 +1638,84 @@ For more information, read
=============================================================================
-SECTION 7 - BUFFERS
+SECTION 7 - BACKUP
+
+
+7.1. When I edit and save files, Vim creates a file with the same name as
+ the original file and a "~" character at the end. How do I stop Vim
+ from creating this file? (or) How do I disable the Vim backup file
+ feature?
+
+You have set the 'backup' option, so Vim creates a backup file when saving
+the original file. You can stop Vim from creating the backup file, by
+clearing the option:
+
+ :set nobackup
+
+Note that, by default this option is turned off. You have explicitly
+enabled the 'backup' option in one of the initialization files. You may
+also have to turn off the 'writebackup' option:
+
+ :set nowritebackup
+
+For more information, read
+
+ :help 07.4
+ :help backup-table
+ :help 'backup'
+ :help 'writebackup'
+ :help 'backupskip'
+ :help 'backupdir'
+ :help 'backupext'
+ :help 'backupcopy'
+ :help backup
+
+
+7.2. How do I configure Vim to store all the backup files in a particular
+ directory?
+
+You can configure Vim to store all the backup files in a particular
+directory using the 'backupdir' option. For example, to store all the
+backup files in the ~/backup directory, you can use the following command:
+
+ :set backupdir=~/backup
+
+For more information, read
+
+ :help 07.4
+ :help 'backupdir'
+ :help backup
+
+
+7.3. When I save a file with Vim, the file permissions are changed.
+ How do I configure Vim to save a file without changing the file
+ permissions?
+
+This may happen, if the 'backupcopy' option is set to 'no' or 'auto'. Note
+that the default value for this option is set in such a way that this will
+correctly work in most of the cases. If the default doesn't work for you,
+try setting the 'backupcopy' option to 'yes' to keep the file permission
+when saving a file:
+
+ :set backupcopy=yes
+
+This applies, only if you have configured Vim to make a backup whenever
+overwriting a file. By default, Vim will not backup files.
+
+For more information, read
+
+ :help 'backupcopy'
+ :help backup
+ :help 'backup'
+ :help 'writebackup'
+
+
+=============================================================================
+
+SECTION 8 - BUFFERS
-7.1. I have made some modifications to a buffer. How do I edit another
+8.1. I have made some modifications to a buffer. How do I edit another
buffer without saving the modified buffer and also without losing the
modifications?
@@ -1634,7 +1735,7 @@ For more information, read
:help :hide
-7.2. How do I configure Vim to auto-save a modified buffer when switching
+8.2. How do I configure Vim to auto-save a modified buffer when switching
to another buffer?
You can set the 'autowrite' option to auto-save a modified buffer when
@@ -1649,7 +1750,7 @@ For more information, read
:help 'hidden'
-7.3. How do I replace the buffer in the current window with a blank buffer?
+8.3. How do I replace the buffer in the current window with a blank buffer?
You can use the ":enew" command to load an empty buffer in place of the
buffer in the current window.
@@ -1659,7 +1760,7 @@ For more information, read
:help :enew
-7.4. Is there a keyboard shortcut to load a buffer by the buffer number?
+8.4. Is there a keyboard shortcut to load a buffer by the buffer number?
You can use the CTRL-^ command to load a buffer by specifying the buffer
number. For example, to load buffer number 5, you have to use the 5 CTRL-^
@@ -1670,7 +1771,7 @@ For more information, read
:help CTRL-^
-7.5. How do I open all the current buffers in separate windows?
+8.5. How do I open all the current buffers in separate windows?
You can use the ":ball" or ":sball" commands to open all the buffers
in the buffer list:
@@ -1682,7 +1783,7 @@ For more information, read
:help :ball
-7.6. How do I close (delete) a buffer without exiting Vim?
+8.6. How do I close (delete) a buffer without exiting Vim?
You can use the ":bdelete" command to delete a buffer without exiting Vim.
For example:
@@ -1695,19 +1796,19 @@ For more information, read
:help :bwipeout
-7.7. I have several buffers opened with :e filename. How do I close one of
+8.7. I have several buffers opened with :e filename. How do I close one of
the buffers without exiting Vim?
You can use the ":bdelete <buffername>" command to close the buffer.
For more information, read
- :help :bdelelete
+ :help :bdelete
:help :bunload
:help :bwipeout
-7.8. When I use the command ":%bd" to delete all the buffers, not all the
+8.8. When I use the command ":%bd" to delete all the buffers, not all the
buffers are deleted. Why?
In the ":%bd" command, the '%' range will be replaced with the starting and
@@ -1720,7 +1821,7 @@ For more information, read
:help :bd
-7.9. How do I display the buffer number of the current buffer/file?
+8.9. How do I display the buffer number of the current buffer/file?
You can use 2<CTRL-G> command to display the buffer number for the current
file/buffer. Note the use of count before the CTRL-G command. If the count
@@ -1729,7 +1830,7 @@ is greater than 1, then Vim will display the buffer number.
You can also use the following command to display the current buffer
number:
- :echo bufnr("%")
+ :echo bufnr("%")
You can also include the "%n" field to the 'statusline' option to display
the current buffer number on the statusline.
@@ -1742,7 +1843,7 @@ For more information read,
:help 'statusline'
-7.10. How do I delete a buffer without closing the window in which the
+8.10. How do I delete a buffer without closing the window in which the
buffer is displayed?
You can use the following command to open the next buffer and delete
@@ -1757,7 +1858,7 @@ For more information read,
:help :buffers
-7.11. How do I map the tab key to cycle through and open all the buffers?
+8.11. How do I map the tab key to cycle through and open all the buffers?
You can use the following two map commands, to map the CTRL-Tab key to open
the next buffer and the CTRL-SHIFT-Tab key to open the previous buffer:
@@ -1773,10 +1874,10 @@ For more information read,
=============================================================================
-SECTION 8 - WINDOWS
+SECTION 9 - WINDOWS
-8.1. What is the difference between a Vim window and a buffer?
+9.1. What is the difference between a Vim window and a buffer?
A Vim buffer is a file loaded into memory for editing. The original file
remains unchanged until you write the buffer to the file. A Vim window is a
@@ -1791,7 +1892,7 @@ For more information, read
:help Q_wi
-8.2. How do I increase the width of a Vim window?
+9.2. How do I increase the width of a Vim window?
You can increase the width of a Vim window using one of the following
commands:
@@ -1810,7 +1911,7 @@ For more information, read
:help window-resize
-8.3. How do I zoom into or out of a window?
+9.3. How do I zoom into or out of a window?
You can zoom into a window (close all the windows except the current
window) using the "CTRL-W o" command or the ":only" ex command.
@@ -1849,6 +1950,13 @@ value (like 99999):
Now, the active window will always open to its maximum size, while the
other windows will stay present, but shrunken to just a status line.
+With any of the above mentioned methods, you cannot restore the window
+layout after zooming into a window. If you want to restore the Vim window
+layout after zooming into a window, you can use the ZoomWin plugin. You can
+download this plugin from the Vim online website at:
+
+http://vim.sourceforge.net/scripts/script.php?script_id=508
+
For more information, read
:help CTRL-W_o
@@ -1859,7 +1967,7 @@ For more information, read
:help 08.3
-8.4. How do I execute an ex command on all the open buffers or open windows
+9.4. How do I execute an ex command on all the open buffers or open windows
or all the files in the argument list?
You can use the ":bufdo" command to execute an ex command on all the open
@@ -1877,10 +1985,10 @@ For more information, read
=============================================================================
-SECTION 9 - MOTION
+SECTION 10 - MOTION
-9.1. How do I jump to the beginning (first line) or end (last line) of a
+10.1. How do I jump to the beginning (first line) or end (last line) of a
file?
You can use 'G' command to jump to the last line in the file and the 'gg'
@@ -1892,9 +2000,10 @@ For more information, read
:help gg
-9.2. In insert mode, when I press the <Esc> key to go to command mode, the
+10.2. In insert mode, when I press the <Esc> key to go to command mode, the
cursor moves one character to the left (except when the cursor is on
- the first character of the line). How do I prevent this?
+ the first character of the line). Is it possible to change this
+ behavior to keep the cursor at the same column?
No. It is not possible to change this behavior. The cursor is *always*
positioned on a valid character (unless you have virtual-edit mode
@@ -1903,12 +2012,16 @@ return to command mode the cursor *must* drop back onto the last character
you typed. For consistency sake, the cursor drops back everywhere, even if
you are in the middle of a line.
+You can use the CTRL-O command in insert mode to execute a single ex
+command and return back to insert mode without moving the cursor column.
+
For more information, read
:help 'virtual'
+ :help i_CTRL-O
-9.3. How do I configure Vim to maintain the horizontal cursor position when
+10.3. How do I configure Vim to maintain the horizontal cursor position when
scrolling with the <Page Up>, <Page Down>, etc keys?
You can reset the 'startofline' option to keep the cursor at the same
@@ -1921,18 +2034,23 @@ For more information, read
:help 'startofline'
-9.4. Some lines in a file are more than the screen width and they are all
+10.4. Some lines in a file are more than the screen width and they are all
wrapped. When I use the j, k keys to move from one line to the next,
the cursor is moved to the next line in the file instead of the next
line on the screen. How do I move from one screen line to the next?
You can use the gj and gk commands to move from one screen line to the
-next/previous screen line.
+next/previous screen line. The j and k commands move the cursor from one
+file line to the next file line. You can also avoid the line wrapping by
+resetting the 'wrap' option:
+
+ :set nowrap
For more information, read
:help gj
:help gk
+ :help 'wrap'
You can use the following mappings:
@@ -1942,7 +2060,7 @@ You can use the following mappings:
:imap <Down> <C-o>gj
-9.5. What is the definition of a sentence, paragraph and section in Vim?
+10.5. What is the definition of a sentence, paragraph and section in Vim?
A sentence is defined as ending at a '.', '!' or '?' followed by either the
end of a line, or by a space (or two) or tab. Which characters and the
@@ -1967,10 +2085,11 @@ For more information, read
:help word
-9.6. How do I jump to beginning or end of a sentence, paragraph or a
+10.6. How do I jump to beginning or end of a sentence, paragraph or a
section?
-The following motions jump relate to sentences, paragraphs and sections:
+You can use the following motion commands to jump to the beginning or end
+of a sentence or a paragraph or a section:
motion position where
( beginning current sentence
@@ -1990,19 +2109,30 @@ For more information, read
:help object-motions
-9.7. I have lines in a file that extends beyond the right extent of the
+10.7. I have lines in a file that extends beyond the right extent of the
screen. How do I move the Vim view to the right to see the text off
the screen?
-You can use zL or zH or zl or zh or zs or ze to scroll the screen to the
-left or right.
+You can use one of the following commands to horizontally scroll the screen
+to the left or right:
+
+ zl - scroll to the left
+ zh - scroll to the right
+ zL - scroll half a screenwidth to the left
+ zH - scroll half a screenwidth to the right
+ zs - scroll to position the cursor at the start of the screen
+ ze - scroll to position the cursor at the end of the screen
+
+You can use the g0 command to move the cursor to the first character of the
+screen line and the g$ command to move the cursor to the last character of
+the screen line without scrolling the screen.
For more information, read
:help scroll-horizontal
-9.8. How do I scroll two or more buffers simultaneously?
+10.8. How do I scroll two or more buffers simultaneously?
You can set the "scrollbind" option for each of the buffer to scroll them
simultaneously.
@@ -2014,7 +2144,7 @@ For more information, read
:help 'scrollopt'
-9.9. When I use my arrow keys, Vim changes modes, inserts weird characters
+10.9. When I use my arrow keys, Vim changes modes, inserts weird characters
in my document but doesn't move the cursor properly. What's going on?
There are a couple of things that could be going on: either you are using
@@ -2041,7 +2171,7 @@ For more information, read
:help vt100-cursor-keys
-9.10. How do I configure Vim to move the cursor to the end of the previous
+10.10. How do I configure Vim to move the cursor to the end of the previous
line, when the left arrow key is pressed and the cursor is currently
at the beginning of a line?
@@ -2051,9 +2181,9 @@ pressed and the cursor is currently at the beginning of a line:
:set whichwrap+=<
-Similaly, to move the cursor the beginning of the next line, when the right
-arrow key is pressed and the cursor is currently at the end of a line, add
-the '>' flag to the 'whichwrap' option:
+Similarly, to move the cursor the beginning of the next line, when the
+right arrow key is pressed and the cursor is currently at the end of a
+line, add the '>' flag to the 'whichwrap' option:
:set whichwrap+=>
@@ -2066,7 +2196,7 @@ For more information, read
:help 05.7
-9.11. How do I configure Vim to stay only in insert mode (modeless
+10.11. How do I configure Vim to stay only in insert mode (modeless
editing)?
You can set the 'insertmode' option to configure Vim to stay only in insert
@@ -2086,32 +2216,20 @@ disable this option, reset the 'insertmode' option:
You can also start vim using the "evim" command or you can use "vim -y" to
use Vim as a modeless editor.
+You can also start Vim in insert mode using the ":startinsert" ex command.
+
For more information, read
:help 'insertmode'
+ :help :startinsert
+ :help :stopinsert
:help i_CTRL-O
:help i_CTRL-L
:help evim
:help evim-keys
-9.12. How do I save and use Vim marks across Vim sessions?
-
-You can save and restore Vim marks across Vim sessions using the viminfo
-file. To use the viminfo file, make sure the 'viminfo' option is not empty.
-To save and restore Vim marks, the 'viminfo' option should not contain the
-'f' flag or should have a value greater than zero for the 'f' option.
-
-For more information, read
-
- :help 21.3
- :help viminfo
- :help 'viminfo'
- :help :wviminfo
- :help :rviminfo
-
-
-9.13. How do I display some context lines when scrolling text?
+10.12. How do I display some context lines when scrolling text?
You can set the 'scrolloff' option to display a minimal number of screen
lines (context) above and below the cursor.
@@ -2124,12 +2242,26 @@ For more information, read
:help 'sidescrolloff'
+10.13. How do I go back to previous cursor locations?
+
+You can go back to the cursor location before the latest jump using the ''
+or `` command. You can use the CTRL-O command to go back to older cursor
+positions and the CTRL-I command to go to the newer cursor positions in the
+jump list.
+
+For more information, read
+
+ :help 03.10
+ :help mark-motions
+ :help jump-motions
+
+
=============================================================================
-SECTION 10 - SEARCHING TEXT
+SECTION 11 - SEARCHING TEXT
-10.1. After I searched for a text with a pattern, all the matched text
+11.1. After I searched for a text with a pattern, all the matched text
stays highlighted. How do I turn off the highlighting
temporarily/permanently?
@@ -2153,7 +2285,7 @@ For more information, read
:help :nohlsearch
-10.2. How do I enter a carriage return character in a search pattern?
+11.2. How do I enter a carriage return character in a search pattern?
You can either use '\r' or <CTRL-V><CTRL-M> to enter a carriage return
character in a pattern. In Vim scripts, it is better to use '\r' for the
@@ -2164,7 +2296,7 @@ For more information, read
:help sub-replace-special
-10.3. How do I search for the character ^M?
+11.3. How do I search for the character ^M?
You can enter the ^M character in a search command by first pressing the
CTRL-V key and then pressing the CTRL-M key.
@@ -2180,7 +2312,7 @@ For more information, read
:help /\r
-10.4. How can I search/replace characters that display as '~R', '~S', etc.?
+11.4. How can I search/replace characters that display as '~R', '~S', etc.?
You can use the 'ga' command to display the ASCII value/code for the
special character. For example, let us say the ASCII value is 142. Then you
@@ -2197,7 +2329,7 @@ For more information, read
:help 24.8
-10.5. How do I highlight all the non-printable characters in a file?
+11.5. How do I highlight all the non-printable characters in a file?
You can use the following commands and search pattern to highlight all the
non-printable characters in a file:
@@ -2215,7 +2347,7 @@ For more information, read
:help 'hlsearch'
-10.6. How do I search for whole words in a file?
+11.6. How do I search for whole words in a file?
You can search for whole words in a file using the \< and \> atoms. For
example:
@@ -2231,7 +2363,7 @@ For more information, read
:help /\>
-10.7. How do I search for the current word under the cursor?
+11.7. How do I search for the current word under the cursor?
You can press the * key to search forward for the current word under the
cursor. To search backward, you can press the # key. Note that only whole
@@ -2247,7 +2379,7 @@ For more information, read
:help search-commands
-10.8. How do I search for a word without regard to the case (uppercase or
+11.8. How do I search for a word without regard to the case (uppercase or
lowercase)?
To always ignore case while searching for a pattern, set the 'ignorecase'
@@ -2267,7 +2399,7 @@ For more information, read
:help /\c
-10.9. How do I search for words that occur twice consecutively?
+11.9. How do I search for words that occur twice consecutively?
You can use one of the following search commands to locate words that occur
twice consecutively:
@@ -2293,7 +2425,7 @@ For more information, read
:help 'iskeyword'
-10.10. How do I count the number of times a particular word occurs in a
+11.10. How do I count the number of times a particular word occurs in a
buffer?
You can use the following set of commands to count the number of times a
@@ -2324,7 +2456,7 @@ For more information, read
:help 12.5
-10.11. How do I place the cursor at the end of the matched word when
+11.11. How do I place the cursor at the end of the matched word when
searching for a pattern?
You can use the 'e' offset to the search command to place the cursor at the
@@ -2338,7 +2470,7 @@ For more information about search offsets, read
:help /
-10.12. How do I search for an empty line?
+11.12. How do I search for an empty line?
You can search for an empty line using:
@@ -2357,7 +2489,7 @@ For more information, read
:help search-commands
-10.13. How do I search for a line containing only a single character?
+11.13. How do I search for a line containing only a single character?
You can search for a line containing only a single character using:
@@ -2372,7 +2504,7 @@ For more information, read
:help /$
-10.14. How do I search and replace a string in multiple files?
+11.14. How do I search and replace a string in multiple files?
You can use the 'argdo' or 'bufdo' or 'windo' commands to execute an ex
command on multiple files. For example:
@@ -2386,7 +2518,7 @@ For more information, read
:help :windo
-10.15. I am using the ":s" substitute command in a mapping. When a search
+11.15. I am using the ":s" substitute command in a mapping. When a search
for a pattern fails, the map terminates. I would like the map to
continue processing the next command, even if the substitute command
fails. How do I do this?
@@ -2399,7 +2531,7 @@ For more information, read
:help :s_flags
-10.16. How do I search for the n-th occurrence of a character in a line?
+11.16. How do I search for the n-th occurrence of a character in a line?
To search for the n-th occurrence of a character in a line, you can prefix
the 'f' command with a number. For example, to search for the 5th
@@ -2417,7 +2549,7 @@ For more information, read
:help ,
-10.17. How do I replace a tab (or any other character) with a hard return
+11.17. How do I replace a tab (or any other character) with a hard return
(newline) character?
You can replace a tab (or any other character) with a hard return (newline)
@@ -2435,7 +2567,7 @@ For more information, read
:help CR-used-for-NL
-10.18. How do I search for a character by its ASCII value?
+11.18. How do I search for a character by its ASCII value?
You can search for a character by its ASCII value by pressing CTRL-V
followed by the decimal or hexadecimal or octal value of that character in
@@ -2449,7 +2581,7 @@ For more information, read
:help ga
-10.19. How do I search for long lines?
+11.19. How do I search for long lines?
You can search for long lines or lines containing more than a specific
number of characters using the Vim regular-expressions in the search
@@ -2465,12 +2597,78 @@ For more information, read
:help /\%c
+11.20. How do I display all the lines in the current buffer that contain a
+ specified pattern?
+
+You can use the following command to display all the lines in the current
+buffer that contain a specified pattern:
+
+ :g/<pattern>/p
+
+For example, the following command will display all the lines in the
+current buffer that contain "vim":
+
+ :g/vim/p
+
+If you also want the corresponding line numbers, then you can use the
+following command:
+
+ :g/<pattern>/#
+
+For more information, read
+
+ :help :global
+ :help :print
+ :help :number
+
+
+11.21. How do I search for a text string that spans multiple lines?
+
+You can search for a text string that spans multiple lines using the \_x
+regular expression atom. For example, to search for the text string "Hello
+World", you can use the following search command:
+
+ /Hello\_sWorld
+
+This will match the word "Hello" followed by a newline character and then
+the word "World" at the beginning of the next line. This will also match
+the word "Hello" immediately followed by a space character and then the
+word "World". When searching for the "Hello World" string, to include the
+space characters at the end and beginning of the line, you can use the
+following search command:
+
+ /Hello\_s\+World
+
+For more information, read
+
+ :help 27.8
+ :help pattern-atoms
+ :help /\_
+ :help pattern-searches
+
+
+11.22. How do I search for a pattern within the specified range of lines
+ in a buffer?
+
+You can search for a pattern within a range of lines using the \%>l
+and \%<l regular expression atoms.
+
+For example, to search for the word 'white' between the lines 10 and 30 in
+a buffer, you can use the following command:
+
+ /white\%>10l\%<20l
+
+For more information, read
+
+ :help /\%l
+
+
=============================================================================
-SECTION 11 - CHANGING TEXT
+SECTION 12 - CHANGING TEXT
-11.1. How do I delete all the trailing white space characters (SPACE and
+12.1. How do I delete all the trailing white space characters (SPACE and
TAB) at the end of all the lines in a file?
You can use the ":substitute" command on the entire file to search and
@@ -2487,7 +2685,7 @@ For more information, read
:help /$
-11.2. How do I replace all the occurrences of multiple consecutive space
+12.2. How do I replace all the occurrences of multiple consecutive space
characters to a single space?
You can use the following command to replace all the occurrences of
@@ -2503,7 +2701,7 @@ For more information, read
:help :s_flags
-11.3. How do I reduce a range of empty lines into one line only?
+12.3. How do I reduce a range of empty lines into one line only?
You can use the following command to reduce a range of empty lines into one
line only:
@@ -2533,7 +2731,7 @@ For more information, read
:help collapse
-11.4. How do I delete all blank lines in a file? How do I remove all the
+12.4. How do I delete all blank lines in a file? How do I remove all the
lines containing only space characters?
To remove all blank lines, use the following command:
@@ -2551,7 +2749,7 @@ following command:
:g/^\s*$/d
-11.5. How do I copy/yank the current word?
+12.5. How do I copy/yank the current word?
You can use the "yiw" (yank inner word without whitespace) command or the
"yaw" (yank a word with whitespace) command to copy/yank the current
@@ -2567,7 +2765,7 @@ For more information, read
:help objects
-11.6. How do I yank text from one position to another position within a
+12.6. How do I yank text from one position to another position within a
line, without yanking the entire line?
You can specify a motion command with the yank operator (y) to yank text
@@ -2586,7 +2784,7 @@ For more information, read
:help 4.6
-11.7. When I yank some text into a register, how do I append the text to
+12.7. When I yank some text into a register, how do I append the text to
the current contents of the register?
When you specify the register for some operation, if you use the upper-case
@@ -2603,7 +2801,7 @@ For more information, read
:help 10.1
-11.8. How do I yank a complete sentence that spans over more than one line?
+12.8. How do I yank a complete sentence that spans over more than one line?
To yank a complete sentence that spans over more than one line you have to
use the yank operator followed by a motion command. For example:
@@ -2620,7 +2818,7 @@ For more information, read
:help 4.6
-11.9. How do I yank all the lines containing a pattern into a buffer?
+12.9. How do I yank all the lines containing a pattern into a buffer?
You can use the ":global" command to yank all the lines containing the
pattern into a register and then paste the contents of the register into
@@ -2644,7 +2842,7 @@ For more information, read
:help :registers
-11.10. How do I delete all the lines in a file that does not contain a
+12.10. How do I delete all the lines in a file that does not contain a
pattern?
You can use ":v" command to delete all the lines that does not contain a
@@ -2662,12 +2860,12 @@ For more information, read
:help :g
-11.11. How do I add a line before each line with "pattern" in it?
+12.11. How do I add a line before each line with "pattern" in it?
You can use the following command to add a line before each line with
"pattern" in it:
- :g/pattern/normal Oi<line of text goes here>
+ :g/pattern/normal Oi<line of text goes here>
Alternatively you can yank the line using the Y command and then insert the
line using the following command:
@@ -2682,7 +2880,7 @@ For more information, read
:help 0
-11.12. Is there a way to operate on a line if the previous line contains a
+12.12. Is there a way to operate on a line if the previous line contains a
particular pattern?
You can use the ":global" command to operate on a line, if the previous
@@ -2696,7 +2894,7 @@ For more information, read
:help :range
-11.13. How do I execute a command on all the lines containing a pattern?
+12.13. How do I execute a command on all the lines containing a pattern?
You can use the ":global" (:g) command to execute a command on all the
lines containing a pattern.
@@ -2718,7 +2916,7 @@ For more information, read
:help :normal
-11.14. Can I copy the character above the cursor to the current cursor
+12.14. Can I copy the character above the cursor to the current cursor
position?
In Insert mode, you can copy the character above the cursor to the current
@@ -2731,7 +2929,7 @@ For more information, read
:help i_CTRL-E
-11.15. How do I insert a blank line above/below the current line without
+12.15. How do I insert a blank line above/below the current line without
entering insert mode?
You can use the ":put" ex command to insert blank lines. For example, try
@@ -2744,7 +2942,7 @@ For more information, read
:help :put
-11.16. How do I insert the name of current file into the current buffer?
+12.16. How do I insert the name of current file into the current buffer?
There are several ways to insert the name of the current file into the
current buffer. In insert mode, you can use the <C-R>% or the
@@ -2758,7 +2956,24 @@ For more information, read
:help !!
-11.17. How do I move the cursor past the end of line and insert some
+12.17. How do I insert the contents of a Vim register into the current
+ buffer?
+
+In insert mode, you can use the <C-R><register> command to insert the
+contents of <register>. For example, use <C-R>a to insert the contents
+of register "a" into the current buffer.
+
+In normal mode, you can use the ":put <register>" command to insert the
+contents of <register>. For example, use the ":put d" command to insert
+the contents of register "d" into the current buffer.
+
+For more information, read
+
+ :help i_CTRL-R
+ :help :put
+
+
+12.18. How do I move the cursor past the end of line and insert some
characters at some columns after the end of the line?
You can set the "virtualedit" option to move the cursor past the
@@ -2772,7 +2987,7 @@ For more information, read
:help 'virtualedit'
-11.18. How to replace the word under the cursor (say: junk) with
+12.19. How to replace the word under the cursor (say: junk) with
"foojunkbar" in Vim?
There are several ways to do this. If the word is the first such word on
@@ -2794,7 +3009,7 @@ For more information, read
:help /\%c
-11.19. How do I replace a particular text in all the files in a directory?
+12.20. How do I replace a particular text in all the files in a directory?
You can use the "argdo" command to execute the substitute command on all
the files specified as arguments:
@@ -2809,22 +3024,24 @@ For more information, read
:help :s_flags
-11.20. I have some numbers in a file. How do I increment or decrement the
+12.21. I have some numbers in a file. How do I increment or decrement the
numbers in the file?
You can use the CTRL-A key to increment the number and the CTRL-X key to
decrement the number. You can also specify the number to
increment/decrement from the number by specifying a count to the key. This
-works for decimal, octal and hexadecimal numbers.
+works for decimal, octal and hexadecimal numbers. You can change the base
+used by Vim for this operation by modifying the 'nrformats' option.
For more information, read
+ :help 26.2
:help CTRL-A
:help CTRL-X
:help 'nrformats'
-11.21. How do I reuse the last used search pattern in a ":substitute"
+12.22. How do I reuse the last used search pattern in a ":substitute"
command?
To reuse the last used search pattern in a ":substitute" command, don't
@@ -2851,7 +3068,7 @@ For more information, read
:help sub-replace-special
-11.22. How do I change the case of a string using the ":substitute"
+12.23. How do I change the case of a string using the ":substitute"
command?
You can use special characters in the replacement string for a
@@ -2879,7 +3096,7 @@ For more information, read
:help \u
-11.23. How do I enter characters that are not present in the keyboard?
+12.24. How do I enter characters that are not present in the keyboard?
You can use digraphs to enter characters that are not present in the
keyboard. You can use the ":digraphs" command to display all the currently
@@ -2893,13 +3110,13 @@ For more information, read
:help 24.9
-11.24. Is there a command to remove any or all digraphs?
+12.25. Is there a command to remove any or all digraphs?
No. The digraphs table is defined at compile time. You can only add new
ones. Adding a command to remove digraphs is on the todo list.
-11.25. In insert mode, when I press the backspace key, it erases only the
+12.26. In insert mode, when I press the backspace key, it erases only the
characters entered in this instance of insert mode. How do I erase
previously entered characters in insert mode using the backspace
key?
@@ -2912,9 +3129,10 @@ in insert mode:
For more information, read
:help 'backspace'
+ :help i_backspacing
-11.26. I have a file which has lines longer than 72 characters terminated
+12.27. I have a file which has lines longer than 72 characters terminated
with "+" and wrapped to the next line. How can I quickly join the
lines?
@@ -2935,7 +3153,7 @@ For more information, read
:help :mark
-11.27. How do I paste characterwise yanked text into separate lines?
+12.28. How do I paste characterwise yanked text into separate lines?
You can use the ":put" command to paste characterwise yanked text into new
lines:
@@ -2948,7 +3166,7 @@ For more information, read
:help quote_=
-11.28. How do I change the case (uppercase, lowercase) of a word or a
+12.29. How do I change the case (uppercase, lowercase) of a word or a
character or a block of text?
You can use the "~" command to switch the case of a character.
@@ -2972,7 +3190,7 @@ For more information, read
:help case
-11.29. How do I enter ASCII characters that are not present in the
+12.30. How do I enter ASCII characters that are not present in the
keyboard?
You can enter ASCII characters that are not present in the keyboard by
@@ -2986,7 +3204,7 @@ For more information, read
:help 45.5
-11.30. How do I replace non-printable characters in a file?
+12.31. How do I replace non-printable characters in a file?
To replace a non-printable character, you have to first determine the ASCII
value for the character. You can use the ":ascii" ex command or the "ga"
@@ -3011,7 +3229,7 @@ For more information, read
:help :digraphs
-11.31. How do I remove duplicate lines from a buffer?
+12.32. How do I remove duplicate lines from a buffer?
You can use the following user-defined command to remove all the duplicate
lines from a buffer:
@@ -3022,7 +3240,7 @@ Add the above command to your .vimrc file and invoke ":Uniq" to remove all
the duplicate lines.
-11.32. How do I prefix all the lines in a file with the corresponding line
+12.33. How do I prefix all the lines in a file with the corresponding line
numbers?
You can prefix the lines with the corresponding line number in several
@@ -3042,7 +3260,7 @@ For more information, read
:help :global
-11.33. How do I exchange (swap) two characters or words or lines?
+12.34. How do I exchange (swap) two characters or words or lines?
You can exchange two characters with the "xp" command sequence. The 'x'
will delete the character under the cursor and 'p' will paste the just
@@ -3073,12 +3291,31 @@ For more information, read
:help :move
+12.35. How do I change the characters used as word delimiters?
+
+Vim uses the characters specified by the 'iskeyword' option as word
+delimitiers. The default setting for this option is "@,48-57,_,192-255".
+
+For example, to add ':' as a word delimitier, you can use
+
+ :set iskeyword+=:
+
+To remove '_' as a word delimitier, you can use
+
+ :set iskeyword-=_
+
+For more information, read
+
+ :help 'iskeyword'
+ :help word
+
+
=============================================================================
-SECTION 12 - COMPLETION IN INSERT MODE
+SECTION 13 - COMPLETION IN INSERT MODE
-12.1. How do I complete words or lines in insert mode?
+13.1. How do I complete words or lines in insert mode?
In insert mode, you can complete words using the CTRL-P and CTRL-N keys.
The CTRL-N command searches forward for the next matching keyword.
@@ -3107,7 +3344,7 @@ For more information, read
:help ins-completion
-12.2. How do I complete file names in insert mode?
+13.2. How do I complete file names in insert mode?
In insert mode, you can use the CTRL-X CTRL-F command sequence to complete
filenames that start with the same characters as in the current line before
@@ -3118,7 +3355,7 @@ For more information, read
:help compl-filename
-12.3. I am using CTRL-P/CTRL-N to complete words in insert mode. How do I
+13.3. I am using CTRL-P/CTRL-N to complete words in insert mode. How do I
complete words that occur after the just completed word?
You can use CTRL-X CTRL-N and CTRL-X CTRL-P keys to complete words that are
@@ -3133,10 +3370,10 @@ For more information, read
=============================================================================
-SECTION 13 - TEXT FORMATTING
+SECTION 14 - TEXT FORMATTING
-13.1. How do I format a text paragraph so that a new line is inserted at
+14.1. How do I format a text paragraph so that a new line is inserted at
the end of each wrapped line?
You can use the 'gq' command to format a paragraph. This will format the
@@ -3157,24 +3394,27 @@ For more information, read
:help motion.txt
-13.2. How do I format long lines in a file so that each line contains less
+14.2. How do I format long lines in a file so that each line contains less
than 'n' characters?
-First set the 'textwidth' option to the desired value:
+You can set the 'textwidth' option to control the number of characters that
+can be present in a line. For example, to set the maximum width of a line
+to 70 characters, you can use the following command:
set textwidth=70
-Now to break the long lines to the length defined by the 'textwidth'
-option, use
+Now to break the long lines in a file to the length defined by the
+'textwidth' option, you can use
:g/./normal gqq
For more information, read
+ :help 'textwidth'
:help gq
-13.3. How do I join short lines to form a paragraph?
+14.3. How do I join short lines to form a paragraph?
First, make sure the 'textwidth' option is set to a high value:
@@ -3196,7 +3436,7 @@ For more information, read
:help gqq
-13.4. How do I format bulleted and numbered lists?
+14.4. How do I format bulleted and numbered lists?
You can configure Vim to format bulleted and numbered lists using the
'formatoptions' option. For example, you can format the list of the
@@ -3221,9 +3461,10 @@ For more information, read
:help 'formatoptions'
:help fo-table
+ :help format-comments
-13.5. How do I indent lines in insert mode?
+14.5. How do I indent lines in insert mode?
In insert mode, you can press the CTRL-T key to insert one shiftwidth of
indent at the start of the current line. In insert mode, you can use the
@@ -3241,7 +3482,7 @@ For more information, read
:help <<
-13.6. How do I format/indent an entire file?
+14.6. How do I format/indent an entire file?
You can format/indent an entire file using the gg=G command, where
@@ -3258,7 +3499,7 @@ For more information, read
:help C-indenting
-13.7. How do I increase or decrease the indentation of the current line?
+14.7. How do I increase or decrease the indentation of the current line?
You can use the '>>' and '<<' commands to increase or decrease the
indentation of the current line.
@@ -3271,7 +3512,7 @@ For more information, read
:help 'shiftwidth'
-13.8. How do I indent a block/group of lines?
+14.8. How do I indent a block/group of lines?
You can visually select the group of lines and press the > or < key to
indent/unindent the lines. You can also use the following ex-command to
@@ -3288,7 +3529,7 @@ For more information, read
:help :>
-13.9. When I indent lines using the > or < key, the standard 8-tabstops are
+14.9. When I indent lines using the > or < key, the standard 8-tabstops are
used instead of the current 'tabstop' setting. Why?
The number of spaces used when lines are indented using the ">" operator is
@@ -3305,7 +3546,7 @@ For more information, read
:help 'softtabstop'
-13.10. How do I turn off the automatic indentation of text?
+14.10. How do I turn off the automatic indentation of text?
By default, the automatic indentation of text is not turned on. Check the
configuration files (.vimrc, .gvimrc) for settings related to indentation.
@@ -3323,7 +3564,7 @@ For more information, read
:help 'indentexpr'
-13.11. How do I configure Vim to automatically set the 'textwidth' option
+14.11. How do I configure Vim to automatically set the 'textwidth' option
to a particular value when I edit mails?
You can use the 'FileType' autocommand to set the 'textwidth' option:
@@ -3337,7 +3578,7 @@ For more information, read
:help usr_43.txt
-13.12. Is there a way to make Vim auto-magically break lines?
+14.12. Is there a way to make Vim auto-magically break lines?
Yes. Set the 'textwidth' option to the preferred length for a line. Then
Vim will auto-magically break the newly entered lines. For example:
@@ -3346,16 +3587,16 @@ Vim will auto-magically break the newly entered lines. For example:
For more information, read
- :help textwidth
+ :help 'textwidth'
:help ins-textwidth
:help 'formatoptions'
:help fo-table
:help formatting
-13.13. I am seeing a lot of ^M symbols in my file. I tried setting the
- 'fileformat' option to 'dos' and then 'unix' and then 'mac'. None of
- these helped. How can I hide these symbols?
+14.13. I am seeing a lot of ^M symbols in my file. I tried setting the
+ 'fileformat' option to 'dos' and then 'unix' and then 'mac'. None of
+ these helped. How can I hide these symbols?
When a file is loaded in Vim, the format of the file is determined as
below:
@@ -3388,6 +3629,16 @@ try the following commands:
:set fileformat=unix
:w
+To remove the carriage return (<CR>) character at the end of all the lines
+in the current file, you can use the following command:
+
+ :%s/\r$//
+
+To force Vim to use a particular file format, when editing a file, you can
+use the following command:
+
+ :e ++ff=dos filename
+
For more information, read
:help 'fileformats'
@@ -3398,9 +3649,10 @@ For more information, read
:help Mac-format-write
:help dos-file-formats
:help 23.1
+ :help ++ff
-13.14. When I paste some text into a Vim buffer from another application,
+14.14. When I paste some text into a Vim buffer from another application,
the alignment (indentation) of the new text is messed up. How do I
fix this?
@@ -3431,7 +3683,7 @@ For more information, read
:help gui-clipboard
-13.15. When there is a very long wrapped line (wrap is "on") and a line
+14.15. When there is a very long wrapped line (wrap is "on") and a line
doesn't fit entirely on the screen it is not displayed at all. There
are blank lines beginning with '@' symbol instead of wrapped line. If
I scroll the screen to fit the line the '@' symbols disappear and the
@@ -3448,7 +3700,7 @@ For more information, read
:help 'display'
-13.16. How do I convert all the tab characters in a file to space
+14.16. How do I convert all the tab characters in a file to space
characters?
You can use the ":retab" command to update all the tab characters in the
@@ -3466,7 +3718,7 @@ For more information, read
:help 25.3
-13.17. What Vim options can I use to edit text that will later go to a word
+14.17. What Vim options can I use to edit text that will later go to a word
processor?
You can set the following options to edit text that will later go into a
@@ -3488,12 +3740,34 @@ For more information, read
:help gj
+14.18. How do I join lines without adding or removing any space characters?
+
+By default, when you join lines using the "J" or ":join" command, Vim will
+replace the line break, leading white space and trailing white space with a
+single space character. If there are space characters at the end of a line
+or a line starts with the ')' character, then Vim will not add a space
+character.
+
+To join lines without adding or removing any space characters, you can use
+the gJ or ":join!" commands.
+
+For more information, read
+
+ :help gJ
+ :help :join
+ :help J
+ :hep 10.5
+ :help 'joinspaces'
+ :help 'cpoptions'
+ :help 'formatoptions'
+
+
=============================================================================
-SECTION 14 - VISUAL MODE
+SECTION 15 - VISUAL MODE
-14.1. How do I do rectangular block copying?
+15.1. How do I do rectangular block copying?
You can do rectangular block copying in Vim using the blockwise visual
mode. To start blockwise visual mode use the CTRL-V key. Move the cursor
@@ -3512,7 +3786,7 @@ For more information, read
:help Q_vi
-14.2. How do I delete or change a column of text in a file?
+15.2. How do I delete or change a column of text in a file?
You can use the Vim block-wise visual mode to select the column of text and
apply an operator (delete, change, copy, etc) on it.
@@ -3523,7 +3797,7 @@ For more information, read
:help visual-operators
-14.3. How do I apply an ex-command on a set of visually selected lines?
+15.3. How do I apply an ex-command on a set of visually selected lines?
When you select a range of lines in visual mode, the < register is set to
the start of the visual region and the > register is set to the end of the
@@ -3539,7 +3813,7 @@ For more information, read
:help '>
-14.4. How do I execute an ex command on a column of text selected in Visual
+15.4. How do I execute an ex command on a column of text selected in Visual
block mode?
All the ex commands operate on whole lines only. If you try to execute an
@@ -3555,7 +3829,7 @@ For more information, read
:help cmdline-lines
-14.5. How do I select the entire file in visual mode?
+15.5. How do I select the entire file in visual mode?
You can select the entire file in visual mode using ggVG.
@@ -3570,7 +3844,7 @@ For more information, read
:help G
-14.6. When I visually select a set of lines and press the > key to indent
+15.6. When I visually select a set of lines and press the > key to indent
the selected lines, the visual mode ends. How can I reselect the
region for further operation? (or) How do I re-select the last
selected visual area again?
@@ -3586,7 +3860,7 @@ For more information, read
:help '>
-14.7. How do I jump to the beginning/end of a visually selected region?
+15.7. How do I jump to the beginning/end of a visually selected region?
You can use the 'o' command to jump to the beginning/end of a visually
selected region.
@@ -3596,7 +3870,7 @@ For more information, read
:help v_o
-14.8. When I select text with mouse and then press : to enter an ex
+15.8. When I select text with mouse and then press : to enter an ex
command, the selected text is replaced with the : character. How do I
execute an ex command on a text selected using the mouse similar to
the text selected using the visual mode?
@@ -3620,7 +3894,7 @@ For more information, read
:help :behave
-14.9. When I select a block of text using the mouse, Vim goes into
+15.9. When I select a block of text using the mouse, Vim goes into
selection mode instead of Visual mode. Why?
The 'selectmode' option controls whether Select mode will be started when
@@ -3640,7 +3914,7 @@ For more information, read
:help :behave
-14.10. How do I visually select the last copy/pasted text?
+15.10. How do I visually select the last copy/pasted text?
You can use the '[ and '] marks to visually select the last copy/pasted
text. The '[ mark is set to the beginning of the last changed/yanked text
@@ -3657,10 +3931,10 @@ For more information, read
=============================================================================
-SECTION 15 - COMMAND-LINE MODE
+SECTION 16 - COMMAND-LINE MODE
-15.1. How do I use the name of the current file in the command mode or an
+16.1. How do I use the name of the current file in the command mode or an
ex command line?
In the command line, the '%' character represents the name of the current
@@ -3675,7 +3949,7 @@ For more information, read
:help expand()
-15.2. How do I edit the text in the Vim command-line effectively?
+16.2. How do I edit the text in the Vim command-line effectively?
You can use the command-line window for editing Vim command-line text. To
open the Vim command-line window use the "q:" command in normal mode. In
@@ -3692,7 +3966,7 @@ For more information, read
:help cmdline-window
-15.3. How do I switch from Vi mode to Ex mode?
+16.3. How do I switch from Vi mode to Ex mode?
You can use the Q command to switch from Vi mode to Ex mode. To switch from
Ex mode back to the Vi mode, use the :vi command.
@@ -3705,7 +3979,7 @@ For more information, read
:help :vi
-15.4. How do I copy the output from an ex-command into a buffer?
+16.4. How do I copy the output from an ex-command into a buffer?
To copy the output from an ex-command into a buffer, you have to first get
the command output into a register. You can use the ":redir" command to get
@@ -3736,7 +4010,7 @@ For more information, read
:help :silent
-15.5. When I press the tab key to complete the name of a file in the
+16.5. When I press the tab key to complete the name of a file in the
command mode, if there are more than one matching file names, then
Vim completes the first matching file name and displays a list of all
matching filenames. How do I configure Vim to only display the list
@@ -3753,7 +4027,7 @@ For more information, read
:help 'wildmode'
-15.6. How do I copy text from a buffer to the command line and from the
+16.6. How do I copy text from a buffer to the command line and from the
command line to a buffer?
To copy text from a buffer to the command line, after yanking the text from
@@ -3778,7 +4052,7 @@ For more information, read
:help cmdline-window
-15.7. How do I put a command onto the command history without executing it?
+16.7. How do I put a command onto the command history without executing it?
To put a command onto the command history without executing it, press the
<Esc> key to cancel the command.
@@ -3788,12 +4062,75 @@ For more information, read
:help c_<Esc>
+16.8. How do I increase the height of the command-line?
+
+You can increase the height of the command-line by changing the 'cmdheight'
+option:
+
+ :set cmdheight=2
+
+For more information, read
+
+ :help 'cmdheight'
+ :help hit-enter
+ :help 05.7
+
+
+=============================================================================
+
+SECTION 17 - VIMINFO
+
+
+17.1. When I invoke Vim, I get error messages about illegal characters in
+ the viminfo file. What should I do to get rid of these messages?
+
+You can remove the $HOME/.viminfo or the $HOME/_viminfo file to get rid of
+these error messages.
+
+For more information, read
+
+ :help viminfo-errors
+ :help viminfo-file-name
+ :help viminfo
+ :help 21.3
+
+
+17.2. How do I disable the viminfo feature?
+
+By default, the viminfo feature is disabled. If the viminfo feature is
+enabled by a system-wide vimrc file, then you can disable the viminfo
+feature by setting the 'viminfo' option to an empty string in your local
+.vimrc file:
+
+ :set viminfo=""
+
+For more information, read
+
+ :help 'viminfo'
+
+
+17.3. How do I save and use Vim marks across Vim sessions?
+
+You can save and restore Vim marks across Vim sessions using the viminfo
+file. To use the viminfo file, make sure the 'viminfo' option is not empty.
+To save and restore Vim marks, the 'viminfo' option should not contain the
+'f' flag or should have a value greater than zero for the 'f' option.
+
+For more information, read
+
+ :help 21.3
+ :help viminfo
+ :help 'viminfo'
+ :help :wviminfo
+ :help :rviminfo
+
+
=============================================================================
-SECTION 16 - REMOTE EDITING
+SECTION 18 - REMOTE EDITING
-16.1. How do I open a file with existing instance of gvim? What happened to
+18.1. How do I open a file with existing instance of gvim? What happened to
the Vim 5.x OpenWithVim.exe and SendToVim.exe files?
Starting with Vim6, the OLE version of OpenWithVim.exe and SendToVim.exe
@@ -3811,7 +4148,7 @@ To get more information about client-server feature, read
:help client-server
-16.2. How do I send a command to a Vim server to write all buffers to disk?
+18.2. How do I send a command to a Vim server to write all buffers to disk?
You can use the Vim remote server functionality to do this:
@@ -3824,7 +4161,7 @@ For more information, read
:help :wall
-16.3. Where can I get the documentation about the Vim remote server
+18.3. Where can I get the documentation about the Vim remote server
functionality?
You can get more information about the Vim remote server functionality by
@@ -3835,10 +4172,10 @@ reading
=============================================================================
-SECTION 17 - OPTIONS
+SECTION 19 - OPTIONS
-17.1. How do I configure Vim in a simple way?
+19.1. How do I configure Vim in a simple way?
You can use the ":options" command to open the Vim option window:
@@ -3851,7 +4188,7 @@ For more information, read
:help :options
-17.2. How do I toggle the value of an option?
+19.2. How do I toggle the value of an option?
You can prefix the option with "inv" to toggle the value of the option:
@@ -3868,7 +4205,16 @@ For more information, read
:help set-option
-17.3. How do I set an option that affects only the current buffer/window?
+19.3. How do I set an option that affects only the current buffer/window?
+
+Some of the Vim options can have a local or global value. A local value
+applies only to a specific buffer or window. A global value applies to all
+the buffers or windows.
+
+When a Vim option is modified using the ":set" command, both the global and
+local values for the option are changed. You can use the ":setlocal"
+command to modify only the local value for the option and the ":setglobal"
+command to modify only the global value.
You can use the ":setlocal" command to set an option that will affect only
the current file/buffer:
@@ -3889,7 +4235,7 @@ For more information, read
:help local-options
-17.4. How do I use space characters for a Vim option value?
+19.4. How do I use space characters for a Vim option value?
To use space characters in a Vim option value, you have to escape the space
character. For example:
@@ -3901,7 +4247,7 @@ For more information, read
:help option-backslash
-17.5. Can I add (embed) Vim option settings to the contents of a file?
+19.5. Can I add (embed) Vim option settings to the contents of a file?
You can use modelines to add Vim option settings to the contents of a file.
For example, in a C file, you can add the following line to the top or the
@@ -3923,7 +4269,7 @@ For more information, read
:help 'modelines'
-17.6. How do I display the line numbers of all the lines in a file?
+19.6. How do I display the line numbers of all the lines in a file?
You can set the 'number' option to display the line numbers for all the
lines.
@@ -3935,7 +4281,7 @@ For more information, read
:help 'number'
-17.7. How do I change the width of the line numbers displayed using the
+19.7. How do I change the width of the line numbers displayed using the
"number" option?
The width used for displaying the line numbers for the 'number' option is
@@ -3953,7 +4299,8 @@ used for the 'number' option is in the Vim todo list:
Other patch without an option by Gilles Roy (2002 Jul 25)"
-17.8. How do I display (view) all the invisible characters in a file?
+19.8. How do I display (view) all the invisible characters like space, tabs
+ and newlines in a file?
You can set the 'list' option to see all the invisible characters in your
file.
@@ -3963,7 +4310,17 @@ file.
With this option set, you can view space characters, tabs, newlines,
trailing space characters and wrapped lines.
-You can modify the 'listchars' option to configure how the invisible
+To not display the invisible characters (which is the default), you have to
+reset the 'list' option:
+
+ :set nolist
+ (or)
+ :set list!
+
+The ":set list!" command will toggle the current setting of the boolean
+'list' option.
+
+You can modify the 'listchars' option to configure how and which invisible
characters are displayed. For example, with the following command all the
trailing space characters will be displayed with a '.' character.
@@ -3975,7 +4332,7 @@ For more information, read
:help 'list'
-17.9. How do I configure Vim to always display the current line and column
+19.9. How do I configure Vim to always display the current line and column
number?
You can set the 'ruler' option to display current column and line number in
@@ -3988,7 +4345,7 @@ For more information, read
:help 'ruler'
-17.10. How do I display the current Vim mode?
+19.10. How do I display the current Vim mode?
You can set the 'showmode' option to display the current Vim mode. In
Insert, Replace and Visual modes, Vim will display the current mode on the
@@ -4001,7 +4358,7 @@ For more information, read
:help 'showmode'
-17.11. How do I configure Vim to show pending/partial commands on the
+19.11. How do I configure Vim to show pending/partial commands on the
status line?
You can set the 'showcmd' option to display pending/partial commands in the
@@ -4014,7 +4371,7 @@ For more information, read
:help 'showcmd'
-17.12. How do I configure the Vim status line to display different
+19.12. How do I configure the Vim status line to display different
settings/values?
You can set the 'statusline' option to display different values/settings in
@@ -4028,7 +4385,7 @@ For more information, read
:help 'ruler'
-17.13. How do I configure Vim to display status line always?
+19.13. How do I configure Vim to display status line always?
You can set the 'laststatus' option to 2 to display the status line always.
@@ -4039,7 +4396,7 @@ For more information, read
:help 'laststatus'
-17.14. How do I make a Vim setting persistent across different Vim
+19.14. How do I make a Vim setting persistent across different Vim
invocations/instances/sessions?
To make a Vim option setting persistent across different Vim instances, add
@@ -4056,7 +4413,7 @@ For more information, read
:help initialization
-17.15. Why do I hear a beep (why does my window flash) about 1 second after
+19.15. Why do I hear a beep (why does my window flash) about 1 second after
I hit the Escape key?
This is normal behavior. If your window flashes, then you've got the visual
@@ -4083,7 +4440,7 @@ For more information, read
:help ttimeout
-17.16. How do I make the 'c' and 's' commands display a '$' instead of
+19.16. How do I make the 'c' and 's' commands display a '$' instead of
deleting the characters I'm changing?
To make the 'c' and 's' commands display a '$' instead of deleting the
@@ -4096,7 +4453,7 @@ For more information, read
:help 'cpoptions'
-17.17. How do I remove more than one flag using a single ":set" command
+19.17. How do I remove more than one flag using a single ":set" command
from a Vim option?
You can remove more than one flag from a Vim option using a single ":set"
@@ -4120,10 +4477,10 @@ For more information, read
=============================================================================
-SECTION 18 - MAPPING KEYS
+SECTION 20 - MAPPING KEYS
-18.1. How do I know what a key is mapped to?
+20.1. How do I know what a key is mapped to?
To see what a key is mapped to, use the following commands:
@@ -4139,7 +4496,7 @@ For more information, read
:help map-overview
-18.2. How do list all the user-defined key mappings?
+20.2. How do list all the user-defined key mappings?
You can list all the user-defined key mappings using:
@@ -4150,7 +4507,7 @@ For more information, read
:help map-listing
-18.3. How do I unmap a previously mapped key?
+20.3. How do I unmap a previously mapped key?
You can unmap a previously mapped key using the ":unmap" command:
@@ -4178,7 +4535,7 @@ For more information, read
:help 'mapleader'
-18.4. I am not able to create a mapping for the <xxx> key. What is wrong?
+20.4. I am not able to create a mapping for the <xxx> key. What is wrong?
First make sure that the key is passed to Vim. In insert mode, press CTRL-V
followed by the desired key. You should see the keycode corresponding to
@@ -4194,7 +4551,7 @@ For more information, read
:help key-codes
-18.5. How do I map the numeric keypad keys?
+20.5. How do I map the numeric keypad keys?
First make sure that the numeric keypad keys are passed to Vim. Next, you
can use the following command to map the numeric keypad keys:
@@ -4210,7 +4567,7 @@ For more information, read
:help terminal-options
-18.6. How do I create a mapping that works only in visual mode?
+20.6. How do I create a mapping that works only in visual mode?
You can create mappings that work only in specific mode (normal, command,
insert, visual, etc). To create a mapping that works only in the visual
@@ -4225,7 +4582,7 @@ For more information, read
:help 40.1
-18.7. In a Vim script, how do I know which keys to use for my mappings, so
+20.7. In a Vim script, how do I know which keys to use for my mappings, so
that the mapped key will not collide with an already used key?
Vim uses most of the keys in the keyboard. You can use the <leader> prefix
@@ -4258,7 +4615,7 @@ For more information, read
:help write-plugin
-18.8. How do I map the escape key?
+20.8. How do I map the escape key?
You can map the Escape key to some other key using the ":map" command. For
example, the following command maps the escape key to CTRL-O.
@@ -4266,7 +4623,7 @@ example, the following command maps the escape key to CTRL-O.
:map <C-O> <Esc>
-18.9. How do I map a key to perform nothing?
+20.9. How do I map a key to perform nothing?
You can map a key to <Nop> to perform nothing when the key is pressed. For
example, with the following mappings, the <F7> key will do nothing when
@@ -4283,7 +4640,7 @@ For more information, read
:help map-modes
-18.10. I want to use the Tab key to indent a block of text and Shift-Tab
+20.10. I want to use the Tab key to indent a block of text and Shift-Tab
key to unindent a block of text. How do I map the keys to do this?
This behavior is similar to textpad, visual studio, etc.
@@ -4310,7 +4667,7 @@ For more information, read
:help <LT>
-18.11. In my mappings the special characters like <CR> are not recognized.
+20.11. In my mappings the special characters like <CR> are not recognized.
How can I configure Vim to recognize special characters?
Check the value of the 'cpoptions' option:
@@ -4336,7 +4693,7 @@ For more information, read
:help 'compatible'
-18.12. How do I use the '|' to separate multiple commands in a map?
+20.12. How do I use the '|' to separate multiple commands in a map?
You can escape the '|' character using backslash (\) to use '|' in a map.
@@ -4353,7 +4710,7 @@ For more information, read
:help map_bar
-18.13. If I have a mapping/abbreviation whose ending is the beginning of
+20.13. If I have a mapping/abbreviation whose ending is the beginning of
another mapping/abbreviation, how do I keep the first from expanding
into the second one?
@@ -4367,7 +4724,7 @@ For more information, read
:help :noreabbrev
-18.14. Why does it take a second or more for Vim to process a key,
+20.14. Why does it take a second or more for Vim to process a key,
sometimes when I press a key?
Make sure you have not defined a mapping for this key using the following
@@ -4396,7 +4753,7 @@ For more information, read
:help slow-fast-terminal
-18.15. How do I map a key to run an external command using a visually
+20.15. How do I map a key to run an external command using a visually
selected text?
You can the ":vmap" command to map a key in the visual mode. In the mapped
@@ -4429,7 +4786,7 @@ For more information, read
:help :!cmd
-18.16. How do I map the Ctrl-I key while still retaining the functionality
+20.16. How do I map the Ctrl-I key while still retaining the functionality
of the <Tab> key?
The Ctrl-I key and the <Tab> key produce the same keycode, so Vim cannot
@@ -4444,10 +4801,10 @@ For more information, read
=============================================================================
-SECTION 19 - ABBREVIATIONS
+SECTION 21 - ABBREVIATIONS
-19.1. How do I auto correct misspelled words?
+21.1. How do I auto correct misspelled words?
You can auto correct misspelled words using abbreviations. For example, the
following abbreviation can be used to correct "teh" with "the":
@@ -4464,7 +4821,7 @@ For more information, read
:help Q_ab
-19.2. How do I create multi-line abbreviations?
+21.2. How do I create multi-line abbreviations?
You can create multi-line abbreviations by embedding the "<CR>"
key code in the text:
@@ -4484,7 +4841,7 @@ For more information, read
:help abbreviations
-19.3. When my abbreviations are expanded, an additional space character is
+21.3. When my abbreviations are expanded, an additional space character is
added at the end of the expanded text. How do I avoid this character?
To avoid an additional space character at the end of the expanded text, you
@@ -4508,7 +4865,7 @@ For more information, read
:help abbreviations
-19.4. How do I insert the current date/time stamp into the file?
+21.4. How do I insert the current date/time stamp into the file?
You can use the strftime() function to insert the current data/time stamp
in a file. For example, you can use the following abbreviation:
@@ -4532,12 +4889,22 @@ For more information, read
:help i_CTRL-R
+21.5. How do I prevent an abbreviation from expanding in insert mode?
+
+You can prevent an abbreviation from expanding in insert mode by typing
+CTRL-V before the character after the abrreviated word.
+
+For more information, read
+
+ :help abbreviations
+
+
=============================================================================
-SECTION 20 - RECORD AND PLAYBACK
+SECTION 22 - RECORD AND PLAYBACK
-20.1. How do I repeat an editing operation (insertion, deletion, paste,
+22.1. How do I repeat an editing operation (insertion, deletion, paste,
etc)?
You can repeat the last editing operation using the '.' command. This will
@@ -4550,7 +4917,7 @@ For more information, read
:help Q_re
-20.2. How I record and repeat a set of key sequences?
+22.2. How I record and repeat a set of key sequences?
You can use the 'q' command in normal mode to record a set of key sequences
and store it in a register. For example, in the normal mode you can press q
@@ -4576,7 +4943,7 @@ For more information, read
:help -s
-20.3. How do I edit/modify a recorded set of key sequences?
+22.3. How do I edit/modify a recorded set of key sequences?
The recorded key sequences are stored in a register. You can paste the
contents of the register into a Vim buffer, edit the pasted text and again
@@ -4594,7 +4961,7 @@ For more information, read
:help 'cpoptions'
-20.4. How do I write recorded key sequences to a file?
+22.4. How do I write recorded key sequences to a file?
The recorded key sequences are stored in a register. You can paste the
contents of the register into a Vim buffer. Now you can save the buffer
@@ -4610,7 +4977,7 @@ For more information, read
:help 10.1
-20.5. I am using register 0 to record my key sequences (i.e. q0 .... q).
+22.5. I am using register 0 to record my key sequences (i.e. q0 .... q).
In the recorded key sequences, I am yanking some text. After the
first replay of the recorded key sequence, I am no longer able to
play it back.
@@ -4627,10 +4994,10 @@ For more information, read
=============================================================================
-SECTION 21 - AUTOCOMMANDS
+SECTION 23 - AUTOCOMMANDS
-21.1. How do I execute a command when I try to modify a read-only file?
+23.1. How do I execute a command when I try to modify a read-only file?
You can use the FileChangedRO autocommand event to execute a command when a
read-only file modified. For example, you can use this event to checkout a
@@ -4643,7 +5010,7 @@ For more information, read
:help FileChangedRO
-21.2. How do I execute a command every time when entering a buffer?
+23.2. How do I execute a command every time when entering a buffer?
You can use the BufEnter autocommand event to execute a command every time
when entering a buffer. For example:
@@ -4655,7 +5022,7 @@ For more information, read
:help BufEnter
-21.3. How do I execute a command every time when entering a window?
+23.3. How do I execute a command every time when entering a window?
You can use the WinEnter autocommand event to execute a command every time
when entering a window. For example:
@@ -4667,7 +5034,7 @@ For more information, read
:help WinEnter
-21.4. From an autocmd, how can I determine the name of the file or the
+23.4. From an autocmd, how can I determine the name of the file or the
buffer number for which the autocommand is executed?
You can use the special words <afile> or <abuf> in an autocmd to get the
@@ -4681,7 +5048,7 @@ For more information, read
:help :<amatch>
-21.5. How do I automatically save all the changed buffers whenever Vim
+23.5. How do I automatically save all the changed buffers whenever Vim
loses focus?
You can define an autocommand for the FocusLost event which will save all
@@ -4695,7 +5062,7 @@ For more information, read
:help :wall
-21.6. How do I execute/run a function when Vim exits to do some cleanup?
+23.6. How do I execute/run a function when Vim exits to do some cleanup?
You can use VimLeave autocmd event to execute a function just before Vim
exists. For example,
@@ -4709,10 +5076,10 @@ For more information, read
=============================================================================
-SECTION 22 - SYNTAX HIGHLIGHT
+SECTION 24 - SYNTAX HIGHLIGHT
-22.1. How do I turn off/on syntax highlighting?
+24.1. How do I turn off/on syntax highlighting?
By default, the Vim syntax highlighting is turned off. To enable the syntax
highlighting, you can use one of the following commands:
@@ -4736,7 +5103,7 @@ For more information, read
:help :syn-clear
-22.2. How do I change the background and foreground colors used by Vim?
+24.2. How do I change the background and foreground colors used by Vim?
Vim uses the "Normal" highlight group for the background and foreground
colors. To change the foreground/background colors, you have to modify the
@@ -4765,7 +5132,7 @@ For more information, read
:help -gui
-22.3. How do I change the highlight colors to suit a dark/light background?
+24.3. How do I change the highlight colors to suit a dark/light background?
You can set the 'background' option to either 'dark' or 'light' to change
the highlight colors to suit a dark/light background:
@@ -4778,7 +5145,7 @@ For more information, read
:help 6.2
-22.4. How do I change the color of the line numbers displayed when the
+24.4. How do I change the color of the line numbers displayed when the
":set number" command is used?
The line numbers displayed use the LineNr highlighting group. To display
@@ -4797,7 +5164,7 @@ For more information, read
:help :highlight
-22.5. How do I change the background color used for a Visually selected
+24.5. How do I change the background color used for a Visually selected
block?
You can modify the 'Visual' highlight group to change the color used for a
@@ -4811,7 +5178,7 @@ For more information, read
:help hl-Visual
-22.6. How do I highlight the special characters (tabs, trailing spaces, end
+24.6. How do I highlight the special characters (tabs, trailing spaces, end
of line, etc) displayed by the 'list' option?
You can modify the "NonText" and "SpecialKey" highlight groups to highlight
@@ -4831,7 +5198,7 @@ For more information, read
:help hl-SpecialKey
-22.7. How do I specify a colorscheme in my .vimrc/.gvimrc file, so that Vim
+24.7. How do I specify a colorscheme in my .vimrc/.gvimrc file, so that Vim
uses the specified colorscheme everytime?
You can specify the color scheme using the ":colorscheme" command in your
@@ -4844,7 +5211,7 @@ For more information, read
:help :colorscheme
-22.8. Vim syntax highlighting is broken. When I am editing a file, some
+24.8. Vim syntax highlighting is broken. When I am editing a file, some
parts of the file is not syntax highlighted or syntax highlighted
incorrectly.
@@ -4864,7 +5231,7 @@ For more information, read
:help :syn-sync-first
-22.9. Is there a built-in function to syntax-highlight the corresponding
+24.9. Is there a built-in function to syntax-highlight the corresponding
matching bracket?
No. Vim doesn't support syntax-highlighting matching brackets. You can try
@@ -4884,7 +5251,7 @@ For more information, read
:help 'matchpairs'
-22.10. How do I turn off the C comment syntax highlighting?
+24.10. How do I turn off the C comment syntax highlighting?
You can use the following command to turn off C comment syntax
highlighting:
@@ -4896,7 +5263,7 @@ For more information, read
:help c-syntax
-22.11. How do I add my own syntax extensions to the standard syntax files
+24.11. How do I add my own syntax extensions to the standard syntax files
supplied with Vim?
You should not modify the syntax files supplied with Vim to add your
@@ -4911,7 +5278,7 @@ For more information, read
:help 'runtimepath'
-22.12. How do I replace a standard syntax file that comes with the Vim
+24.12. How do I replace a standard syntax file that comes with the Vim
distribution with my own syntax file?
You can replace a standary syntax file that comes with the Vim distribution
@@ -4928,7 +5295,7 @@ For more information, read
:help mysyntaxfile
-22.13. How do I highlight all the characters after a particular column?
+24.13. How do I highlight all the characters after a particular column?
You can use the ":match" command to highlight all the characters after a
particular column:
@@ -4945,7 +5312,7 @@ For more information, read
:help /.
-22.14. How do I convert a source file (.c, .h, etc) with the Vim syntax
+24.14. How do I convert a source file (.c, .h, etc) with the Vim syntax
highlighting into a HTML file?
You can use the 2html.vim script to convert a source file into a HTML file
@@ -4958,7 +5325,7 @@ For more information, read
:help convert-to-HTML
-22.15. How do I list the definition of all the current highlight groups?
+24.15. How do I list the definition of all the current highlight groups?
You can list the definition of all the current highlight groups using the
":highlight" (without any arguments) ex command.
@@ -4970,10 +5337,10 @@ For more information, read
=============================================================================
-SECTION 23 - VIM SCRIPT WRITING
+SECTION 25 - VIM SCRIPT WRITING
-23.1. How do I list the names of all the scripts sourced by Vim?
+25.1. How do I list the names of all the scripts sourced by Vim?
You can use the ":scriptnames" command to list the names of all the scripts
sourced by Vim:
@@ -4985,7 +5352,7 @@ For more information, read
:help :scriptnames
-23.2. How do I debug Vim scripts?
+25.2. How do I debug Vim scripts?
Vim has built-in support for a primitive debugger to debug Vim plugins and
scripts. Using this debugger you can set breakpoints and step through the
@@ -4997,7 +5364,7 @@ For more information, read
:help -D
-23.3. How do I locate the script/plugin which sets a Vim option?
+25.3. How do I locate the script/plugin which sets a Vim option?
You can use the ":verbose" command to locate the plugin/script which last
modified a Vim option. For example:
@@ -5010,7 +5377,7 @@ For more information, read
:help :verbose
-23.4. I am getting some error/informational messages from Vim (possibly
+25.4. I am getting some error/informational messages from Vim (possibly
when running a script), the messages are cleared immediately. How do
I display the messages again?
@@ -5026,7 +5393,7 @@ For more information, read
:help message-history
-23.5. How do I save and restore a plugin specific information across Vim
+25.5. How do I save and restore a plugin specific information across Vim
invocations?
Vim will save and restore global variables that start with an uppercase
@@ -5041,7 +5408,7 @@ For more information, read
:help variables
-23.6. How do I start insert mode from a Vim function?
+25.6. How do I start insert mode from a Vim function?
You can use the ":startinsert" command to start the insert mode from inside
a Vim function.
@@ -5051,7 +5418,7 @@ For more information, read
:help :startinsert
-23.7. How do I change the cursor position from within a Vim function?
+25.7. How do I change the cursor position from within a Vim function?
You can use the cursor() function to position the cursor.
@@ -5067,7 +5434,7 @@ For more information, read
:help bar
-23.8. How do I check the value of an environment variable in the .vimrc
+25.8. How do I check the value of an environment variable in the .vimrc
file?
You can use prefix the environment variable name with the '$' character to
@@ -5082,7 +5449,7 @@ For more information, read
:help expr-env
-23.9. How do I check whether an environment variable is set or not from a
+25.9. How do I check whether an environment variable is set or not from a
Vim function?
You can use the exists() function to check for the existence of a
@@ -5097,7 +5464,7 @@ For more information, read
:help expr-env
-23.10. How do I call/use the Vim built-in functions?
+25.10. How do I call/use the Vim built-in functions?
You can use the ":call" command to invoke a Vim built-in function:
@@ -5130,7 +5497,7 @@ For more information, read
:help usr_41.txt
-23.11. I am using some normal mode commands in my Vim script. How do I
+25.11. I am using some normal mode commands in my Vim script. How do I
avoid using the user-defined mappings for these normal mode commands
and use the standard Vim functionality for these normal mode
commands?
@@ -5144,14 +5511,14 @@ For more information, read
:help :normal
-23.12. How do I get the current visually selected text into a Vim variable
+25.12. How do I get the current visually selected text into a Vim variable
or register?
You can get the current visually selected text into a Vim variable by
yanking the text into Vim register and then assigning the contents of the
register into the variable:
- :normal gvy
+ :normal! gvy
:let myvar = @"
The above command copies the visually selected text into the variable
@@ -5180,7 +5547,7 @@ For more information, read
:help registers
-23.13. I have some text in a Vim variable 'myvar'. I would like to use this
+25.13. I have some text in a Vim variable 'myvar'. I would like to use this
variable in a ":s" substitute command to replace a text 'mytext'.
How do I do this?
@@ -5201,7 +5568,7 @@ For more information, read
:help sub-replace-special
-23.14. A Vim variable (bno) contains a buffer number. How do I use this
+25.14. A Vim variable (bno) contains a buffer number. How do I use this
variable to open the corresponding buffer?
The :buffer command will not accept a variable name. It accepts only a
@@ -5215,7 +5582,7 @@ For more information, read
:help :execute
-23.15. How do I store the value of a Vim option into a Vim variable?
+25.15. How do I store the value of a Vim option into a Vim variable?
You can prefix the option name with the '&' character and assign the option
value to a Vim variable using the "let" command. For example, to store the
@@ -5235,7 +5602,7 @@ For more information, read
:help let-option
-23.16. I have copied and inserted some text into a buffer from a Vim
+25.16. I have copied and inserted some text into a buffer from a Vim
function. How do I indent the inserted text from the Vim function?
You can use the following command to format the just inserted text:
@@ -5250,7 +5617,7 @@ For more information, read
:help :normal
-23.17. How do I get the character under the cursor from a Vim script?
+25.17. How do I get the character under the cursor from a Vim script?
You can use the getline() function and use string index [] to get the
character:
@@ -5263,6 +5630,14 @@ character in a string by its index with the "string[index]" notation. The
col(".") returns the column of the cursor position; the adjustment is to
get the right character of the string.
+Alternatively, you can use the following sequence of commands to get the
+character under the cursor:
+
+ normal! vy
+ let ch=@"
+
+Note that the above commands will change the '< and '> marks.
+
For more information, read
:help getline()
@@ -5270,7 +5645,7 @@ For more information, read
:help expr-[]
-23.18. How do I get the name of the current file without the extension?
+25.18. How do I get the name of the current file without the extension?
You can get the name of the current file without the extension using:
@@ -5289,7 +5664,7 @@ For more information, read
:help fnamemodify()
-23.19. How do I get the basename of the current file?
+25.19. How do I get the basename of the current file?
You can use the :t filename modifier to get the basename of the current
file:
@@ -5301,7 +5676,7 @@ For more information, read
:help filename-modifiers
-23.20. How do I get the output from a Vim function into the current buffer?
+25.20. How do I get the output from a Vim function into the current buffer?
You can insert the return value from a function using the following command
in insert mode:
@@ -5318,7 +5693,7 @@ For more information, read
:help expression
-23.21. How do I call external programs from a Vim function?
+25.21. How do I call external programs from a Vim function?
There are several ways to call external programs from a Vim function. You
can use the builtin system() function to invoke external programs and get
@@ -5335,7 +5710,7 @@ For more information, read
:help 10.9
-23.22. How do I get the return status of a program executed using the ":!"
+25.22. How do I get the return status of a program executed using the ":!"
command?
You can use the predefined Vim v:shell_error variable to get the return
@@ -5346,7 +5721,7 @@ For more information, read
:help v:shell_error
-23.23. How do I determine whether the current buffer is modified or not?
+25.23. How do I determine whether the current buffer is modified or not?
You can check the value of the 'modified' option to determine whether the
current buffer is modified:
@@ -5364,7 +5739,7 @@ For more information, read
:help 'modified'
-23.24. I would like to use the carriage return character in a normal
+25.24. I would like to use the carriage return character in a normal
command from a Vim script. How do I specify the carriage return
character?
@@ -5380,7 +5755,7 @@ For more information, read
:help expr-quote
-23.25. How do I split long lines in a Vim script?
+25.25. How do I split long lines in a Vim script?
You can split long lines in a Vim script by inserting the backslash
character ("\") at the start of the next line. For example,
@@ -5390,7 +5765,7 @@ For more information, read
:help line-continuation
-23.26. When I try to "execute" my function using the "execute 'echo
+25.26. When I try to "execute" my function using the "execute 'echo
Myfunc()'" command, the cursor is moved to the top of the current
buffer. Why?
@@ -5416,7 +5791,7 @@ For more information, read
:help 41.6
-23.27. How do I source/execute the contents of a register?
+25.27. How do I source/execute the contents of a register?
If you have yanked a set of Vim commands into a Vim register (for example
register 'a'), then you can source the contents of the register using one
@@ -5431,7 +5806,7 @@ For more information, read
:help :@
-23.28. After calling a Vim function or a mapping, when I press the 'u'
+25.28. After calling a Vim function or a mapping, when I press the 'u'
key to undo the last change, Vim undoes all the changes made by
the mapping/function. Why?
@@ -5446,7 +5821,7 @@ For more information, read
:help map-undo
-23.29. How can I call a function defined with s: (script local function)
+25.29. How can I call a function defined with s: (script local function)
from another script/plugin?
The s: prefix for a Vim function name is used to create a script local
@@ -5462,7 +5837,7 @@ For more information, read
:help :scriptnames
-23.30. Is it possible to un-source a sourced script? In otherwords, reverse
+25.30. Is it possible to un-source a sourced script? In otherwords, reverse
all the commands executed by sourcing a script.
No. It is not possible to reverse or undo all the commands executed by
@@ -5473,28 +5848,12 @@ For more information, read
:help :source
-23.31. How do I get the character under the cursor?
-
-You can use the getline() function to retrieve the current line and then
-use the col() function to index into the returned text. For example,
-
- :echo getline(".")[col(".") - 1]
-
-will echo the character under the cursor.
-
-For more information, read
-
- :help expr-[]
- :help getline()
- :help col()
-
-
=============================================================================
-SECTION 24 - PLUGINS
+SECTION 26 - PLUGINS
-24.1. How do I set different options for different types of files?
+26.1. How do I set different options for different types of files?
You can create filetype plugins to set different options for different
types of files. You should first enable filetype plugins using the command:
@@ -5527,17 +5886,22 @@ For more information, read
:help 40.3
-24.2. I have downloaded some Vim plugins, syntax files, indent files, color
- schemes, filetype plugins, etc from the web. Where should I copy
+26.2. I have downloaded a Vim plugin or a syntax file or a indent file, or
+ a color scheme or a filetype plugin from the web. Where should I copy
these files so that Vim will find them?
-You can place the runtime files (plugins, syntax files, indent files, color
-schemes, filetype plugins, etc) under one of the directories specified by
-the 'runtimepath' option. For Unix systems, this is usally the "$HOME/.vim"
-directory. For MS-Windows systems, this is usually the $VIM\vimfiles or
-$HOME\vimfiles directory. Depending on the type of the runtime file, you
-have to place it under a specific directory under the above runtime
-directory. The names of the directories are listed below:
+You can place the Vim runtime files (plugins, syntax files, indent files,
+color schemes, filetype plugins, etc) under one of the directories
+specified in the 'runtimepath' option. To determine the current value of
+the 'runtimepath' option, use the following command:
+
+ :set runtimepath
+
+For Unix systems, this is usally the "$HOME/.vim" directory. For MS-Windows
+systems, this is usually the $VIM\vimfiles or $HOME\vimfiles directory.
+Depending on the type of the runtime file, you have to place it under a
+specific directory under the above runtime directory. The names of the
+directories are listed below:
colors/ - color scheme files
compiler/ - compiler files
@@ -5557,7 +5921,7 @@ For more information, read
:help :runtime
-24.3. How do I extend an existing filetype plugin?
+26.3. How do I extend an existing filetype plugin?
You can extend an existing filetype plugin by creating a file under either
the $VIMRTUNTIME/after/ftplugin or the $VIMRTUNTIME/ftplugin directory. The
@@ -5578,7 +5942,7 @@ For more information, read
:help 'runtimepath'
-24.4. How do I turn off loading the Vim plugins?
+26.4. How do I turn off loading the Vim plugins?
You can reset the 'loadplugins' option to turn off loading the plugins:
@@ -5596,7 +5960,7 @@ For more information, read
:help load-plugins
-24.5. How do I turn on/off loading the filetype plugins?
+26.5. How do I turn on/off loading the filetype plugins?
By default, Vim will not load the filetype plugins. You can configure Vim
to load filetype plugins using the command:
@@ -5614,7 +5978,7 @@ For more information, read
:help :filetype
-24.6. How do I override settings made in a file type plugin in the global
+26.6. How do I override settings made in a file type plugin in the global
ftplugin directory for all the file types?
You can use an autocommand triggered on the FileType event:
@@ -5637,7 +6001,7 @@ For more information, read
:help myfiletypefile
-24.7. How do I disable the Vim directory browser plugin?
+26.7. How do I disable the Vim directory browser plugin?
To disable the directory browsing Vim plugin, add the following line to
your .vimrc file:
@@ -5649,7 +6013,7 @@ For more information, read
:help file-explorer
-24.8. How do I set the filetype option for files with names matching a
+26.8. How do I set the filetype option for files with names matching a
particular pattern or depending on the file extension?
You can set the 'filetype' option for files with names matching a
@@ -5680,10 +6044,10 @@ For more information, read
=============================================================================
-SECTION 25 - EDITING PROGRAM FILES
+SECTION 27 - EDITING PROGRAM FILES
-25.1. How do I enable automatic indentation for C/C++ files?
+27.1. How do I enable automatic indentation for C/C++ files?
You can enable file-type based indentation using:
@@ -5700,7 +6064,7 @@ For more information, read
:help filetype
-25.2. How do I configure the indentation used for C/C++ files?
+27.2. How do I configure the indentation used for C/C++ files?
You can configure the Vim C indentation by modifying the value of the
'cinoptions', 'cinkeys' and 'cinwords' options.
@@ -5716,7 +6080,7 @@ For more information, read
:help 'smartindent'
-25.3. How do I turn off the automatic indentation feature?
+27.3. How do I turn off the automatic indentation feature?
By default, the automatic indentation is not turned on. You must have
configured Vim to do automatic indentation in either .vimrc or .gvimrc
@@ -5743,7 +6107,7 @@ For more information, read
:help 'indentexpr'
-25.4. How do I change the number of space characters used for the automatic
+27.4. How do I change the number of space characters used for the automatic
indentation?
You can modify the 'shiftwidth' option to change the number of space
@@ -5756,7 +6120,7 @@ For more information, read
:help 'shiftwidth'
-25.5. I am editing a C program using Vim. How do I display the definition
+27.5. I am editing a C program using Vim. How do I display the definition
of a macro or a variable?
You can use the [d command to display the definition of a macro and the [i
@@ -5771,7 +6135,7 @@ For more information, read
:help 29.5
-25.6. I am editing a C program using Vim. How do I jump to the beginning or
+27.6. I am editing a C program using Vim. How do I jump to the beginning or
end of a code block from within the block?
You can use '[{' command to jump to the beginning of the code block and ']}
@@ -5784,7 +6148,7 @@ For more information, read
:help various-motions
-25.7. Is there a way to turn off the "//" comment auto-insertion behavior
+27.7. Is there a way to turn off the "//" comment auto-insertion behavior
for C++ files? If I'm sitting on a line beginning with "//", then I
open a new line above or below it, Vim automatically inserts new "//"
chars.
@@ -5800,7 +6164,7 @@ For more information, read
:help format-comments
-25.8. How do I add the comment character '#' to a set of lines at the
+27.8. How do I add the comment character '#' to a set of lines at the
beginning of each line?
First, select the first character in all the lines using visual block mode
@@ -5816,7 +6180,7 @@ For more information, read
:help v_b_I
-25.9. How do I edit a header file with the same name as the corresponding C
+27.9. How do I edit a header file with the same name as the corresponding C
source file?
You can use the following command to edit a header file with the same name
@@ -5848,7 +6212,7 @@ For more information, read
:help 'path'
-25.10. How do I automatically insert comment leaders while typing comments?
+27.10. How do I automatically insert comment leaders while typing comments?
To automatically insert comment leaders while typing comments, add the 'r'
and 'o' flags to the 'formatoptions' option.
@@ -5871,10 +6235,10 @@ For more information, read
=============================================================================
-SECTION 26 - QUICKFIX
+SECTION 28 - QUICKFIX
-26.1. How do I build programs from Vim?
+28.1. How do I build programs from Vim?
You can use the ":make" command to build programs from Vim. The ":make"
command runs the program specified by the 'makeprg' option.
@@ -5889,7 +6253,7 @@ For more information, read
:help quickfix
-26.2. When I run the make command in Vim I get the errors listed as the
+28.2. When I run the make command in Vim I get the errors listed as the
compiler compiles the program. When it finishes this list disappears
and I have to use the :clist command to see the error message again.
Is there any other way to see these error messages?
@@ -5907,10 +6271,10 @@ For more information, read
=============================================================================
-SECTION 27 - FOLDING
+SECTION 29 - FOLDING
-27.1. How do I extend the Vim folding support?
+29.1. How do I extend the Vim folding support?
You can use the 'foldexpr' option to fold using an user specified function.
For example, to fold subroutines of the following form into a single line:
@@ -5942,7 +6306,7 @@ For more information, read
:help fold-expr
-27.2. When I enable folding by setting the 'foldmethod' option, all the
+29.2. When I enable folding by setting the 'foldmethod' option, all the
folds are closed. How do I prevent this?
You can set the 'foldlevelstart' option to a particular value to close only
@@ -5957,7 +6321,7 @@ For more information, read
:help fold-foldlevel
-27.3. How do I control how many folds will be opened when I start editing a
+29.3. How do I control how many folds will be opened when I start editing a
file?
You can modify the 'foldlevelstart' option to control the number of folds
@@ -5966,12 +6330,16 @@ all the folds closed:
:set foldlevelstart=0
+To start editing with all the folds opened, you can use
+
+ :set foldlevelstart=999
+
For more information, read
:help 'foldlevelstart'
-27.4. How do I open and close folds using the mouse?
+29.4. How do I open and close folds using the mouse?
You can click on the + and - characters displayed at the leftmost column to
open and close fold. For this to work, you have to set the 'foldcolumn'
@@ -5984,7 +6352,7 @@ For more information, read
:help 'foldcolumn'
-27.5. How do I change the text displayed for a closed fold?
+29.5. How do I change the text displayed for a closed fold?
You can use the 'foldtext' option to change the text displayed for a closed
fold.
@@ -5996,7 +6364,7 @@ For more information, read
:help 'fillchars'
-27.6. How do I store and restore manually created folds across different
+29.6. How do I store and restore manually created folds across different
Vim invocations?
You can use the ":mkview" command to store manually created folds. Later,
@@ -6016,10 +6384,10 @@ For more information, read
=============================================================================
-SECTION 28 - VIM WITH EXTERNAL APPLICATIONS
+SECTION 30 - VIM WITH EXTERNAL APPLICATIONS
-28.1. Can I run a shell inside a Vim window?
+30.1. Can I run a shell inside a Vim window?
Currently Vim doesn't have support for running shell and other external
commands inside a Vim window.
@@ -6038,7 +6406,7 @@ more information visit the following URL:
http://vim.sourceforge.net/scripts/script.php?script_id=165
-28.2. How do I pass the word under the cursor to an external command?
+30.2. How do I pass the word under the cursor to an external command?
You can use the special keyword <cword> to pass the word under the cursor
to an external command. For example:
@@ -6050,52 +6418,83 @@ For more information, read
:help <cword>
-28.3. How do I get the output of a shell command into a Vim buffer?
+30.3. How do I get the output of a shell command into a Vim buffer?
You can use the ":r !" command to get the output of a shell command into a
-Vim buffer:
+Vim buffer. For example, to insert the output of the "ls" shell command,
+you can use the following command:
:r !ls
+To insert the output of the shell command above the first line use the
+following command:
+
+ :0r !ls
+
For more information, read
:help :r!
-28.4. How do I pipe the contents of the current buffer to a external
+30.4. How do I pipe the contents of the current buffer to an external
command and replace the contents of the buffer with the output from
the command?
You can use the :! command to pipe the contents of the current buffer to a
external command and replace the contents of the buffer with the output
from the command. For example, to sort the contents of the current buffer,
-you can use the following command:
+using the Unix sort command, you can use the following command:
:%!sort
+To sort only lines 10-20, you can use the following command
+
+ :10,20!sort
+
+Also, if you want to pipe a buffer to an external command but not put the
+results back in the buffer, you can use
+
+ :w !sort
+
+The above command will pipe the entire buffer to the sort command. Note
+that the space between the 'w' and the '!' is critical. To pipe only a
+range of lines, you can use
+
+ :10,20w !sort
+
+The above command will pipe the lines 10-20 to the sort command.
+
For more information, read
:help :range!
+ :help 10.9
+ :help :w_c
-28.5. How do I sort a section of my file?
+30.5. How do I sort a section of my file?
-You can pipe the section of the file to the "sort" utility to sort the
+You can pipe a section of the file to the Unix "sort" utility to sort the
file. For example:
:5,100!sort
-You can also use a visual block, and use !sort on it.
+You can also use a visual block, and use the "!sort" command on the
+selected block.
+
+To sort using visual blocks (sort based on a column or sort just the column
+itself), read the following tip from the Vim online web page:
+http://vim.sourceforge.net/tips/tip.php?tip_id=588
-28.6. Is there a step-by-step guide for using Vim with slrn?
+
+30.6. Is there a step-by-step guide for using Vim with slrn?
Visit the following link to get information about using Vim with Slrn:
http://thingy.apana.org.au/~fun/slrn/
-28.7. How do I use Vim as a pager?
+30.7. How do I use Vim as a pager?
You can use Vim as a pager using the $VIMRUNTIME/macros/less.sh shell
script, supplied as part of the standard Vim distribution. This shell
@@ -6107,7 +6506,7 @@ For more information, read
:help less
-28.8. How do I view Unix man pages from inside Vim?
+30.8. How do I view Unix man pages from inside Vim?
You can view Unix man pages, inside Vim, using the man.vim plugin supplied
as part of the standard Vim distribution. To use this plugin, add the
@@ -6126,7 +6525,7 @@ For more information, read
:help 'keywordprg'
-28.9. How do I change the diff command used by the Vim diff support?
+30.9. How do I change the diff command used by the Vim diff support?
By default, the Vim diff support uses the 'diff' command. You can change
this by changing the 'diffexpr' option.
@@ -6137,7 +6536,7 @@ For more information, read
:help 'diffexpr'
-28.10. How do I use the Vim diff mode without folding?
+30.10. How do I use the Vim diff mode without folding?
You can use the following command-line to start Vim with two filenames
and use the diff mode without folding:
@@ -6153,10 +6552,10 @@ For more information, read
=============================================================================
-SECTION 29 - GUI VIM
+SECTION 31 - GUI VIM
-29.1. How do I create buffer specific menus?
+31.1. How do I create buffer specific menus?
Adding support for buffer specific menus is in the Vim TODO list. In the
mean time, you can try Michael Geddes's plugin, buffermenu.vim:
@@ -6164,7 +6563,7 @@ mean time, you can try Michael Geddes's plugin, buffermenu.vim:
http://vim.sourceforge.net/scripts/script.php?script_id=246
-29.2. How do I change the font used by GUI Vim?
+31.2. How do I change the font used by GUI Vim?
You can change the 'guifont' option to change the font used by GUI Vim. To
display the current value of this option, you can use
@@ -6198,7 +6597,7 @@ For more information, read
:help -menufontset
-29.3. When starting GUI Vim, how do I specify the location of the GVIM
+31.3. When starting GUI Vim, how do I specify the location of the GVIM
window?
You can use the "-geometry" command line argument to specify the location
@@ -6212,7 +6611,7 @@ For more information, read
:help -geom
-29.4. How do I add a horizontal scrollbar in GVim?
+31.4. How do I add a horizontal scrollbar in GVim?
You can enable the horizontal scrollbar by modifying the 'guioptions'
option:
@@ -6225,7 +6624,7 @@ For more information, read
:help gui-horiz-scroll
-29.5. How do I make the scrollbar appear in the left side by default?
+31.5. How do I make the scrollbar appear in the left side by default?
You can add the 'l' flag to the 'guioptions' option to make the scrollbar
appear in the left side.
@@ -6239,7 +6638,7 @@ For more information, read
:help gui-scrollbars
-29.6. How do I remove the Vim menubar?
+31.6. How do I remove the Vim menubar?
You can remove the Vim menubar by removing the 'm' flag from the
'guioptions' option:
@@ -6251,7 +6650,7 @@ For more information, read
:help 'guioptions'
-29.7. I am using GUI Vim. When I press the ALT key and a letter, the menu
+31.7. I am using GUI Vim. When I press the ALT key and a letter, the menu
starting with that letter is selected. I don't want this behavior as
I want to map the ALT-<key> combination. How do I do this?
@@ -6266,7 +6665,7 @@ For more information, read
:help :simalt
-29.8. Is it possible to scroll the text by dragging the scrollbar so that
+31.8. Is it possible to scroll the text by dragging the scrollbar so that
the cursor stays in the original location?
The way Vim is designed, the cursor position has to be in a visible spot in
@@ -6285,7 +6684,7 @@ For more information, read
:help mark-motions
-29.9. How do I get gvim to start browsing files in a particular directory
+31.9. How do I get gvim to start browsing files in a particular directory
when using the ":browse" command?
You can set the 'browsedir' option to the default directory to use for the
@@ -6298,7 +6697,7 @@ For more information, read
:help 'browsedir'
-29.10. For some questions, like when a file is changed outside of Vim, Vim
+31.10. For some questions, like when a file is changed outside of Vim, Vim
displays a GUI dialog box. How do I replace this GUI dialog box with
a console dialog box?
@@ -6312,7 +6711,7 @@ For more information, read
:help 'guioptions'
-29.11. I am trying to use GUI Vim as the editor for my xxx application.
+31.11. I am trying to use GUI Vim as the editor for my xxx application.
When the xxx application launches GUI Vim to edit a file, the
control immediately returns to the xxx application. How do I start
GUI Vim, so that the control returns to the xxx application only
@@ -6332,7 +6731,7 @@ For more information, read
:help -f
-29.12. Why does the "Select Font" dialog doesn't show all the fonts
+31.12. Why does the "Select Font" dialog doesn't show all the fonts
installed in my system?
Vim supports only fixed width (mono-spaced) fonts. Proportional fonts are
@@ -6345,7 +6744,7 @@ For more information, read
:help 'guifont'
-29.13. How do I use the mouse in Vim command-line mode?
+31.13. How do I use the mouse in Vim command-line mode?
You can set the 'c' flag in the 'mouse' option to use mouse in the Vim
command-line mode:
@@ -6359,7 +6758,7 @@ For more information, read
:help 09.2
-29.14. When I use the middle mouse button to scroll text, it pastes the
+31.14. When I use the middle mouse button to scroll text, it pastes the
last copied text. How do I disable this behavior?
You can map the middle mouse button to <Nop> to disable the middle mouse
@@ -6374,7 +6773,7 @@ For more information, read
:help <Nop>
-29.15. How do I change the location and size of a GUI Vim window?
+31.15. How do I change the location and size of a GUI Vim window?
You can use the "winpos" command to change the Vim window position. To
change the size of the window, you can modify the "lines" and "columns"
@@ -6384,25 +6783,30 @@ For example, the following commands will position the GUI Vim window at the
X,Y co-ordinates 50,50 and set the number of lines to 50 and the number of
columsn to 80.
- :winpos 50 50
- :set lines=50
- :set columns=80
+ :winpos 50 50
+ :set lines=50
+ :set columns=80
+
+The arguments to the 'winpos' command specify the pixel co-ordinates of the
+Vim window. The 'lines' and 'columns' options specify the number of lines
+and characters to use for the height and the width of the window
+respectively.
For more information, read
- :help 31.4
- :help :winpos
- :help 'lines'
- :help 'columns'
- :help GUIEnter
+ :help 31.4
+ :help :winpos
+ :help 'lines'
+ :help 'columns'
+ :help GUIEnter
=============================================================================
-SECTION 30 - VIM ON UNIX
+SECTION 32 - VIM ON UNIX
-30.1. I am running Vim in a xterm. When I press the CTRL-S key, Vim
+32.1. I am running Vim in a xterm. When I press the CTRL-S key, Vim
freezes. What should I do now?
Many terminal emulators and real terminal drivers use the CTRL-S key to
@@ -6415,9 +6819,9 @@ When you press the CTRL-S key, the terminal driver will stop sending the
output data. As a result of this, it will look like Vim is hung. If you
press the CTRL-Q key, then everything will be back to normal.
-You can turn of the terminal driver flow control using the 'stty' command:
+You can turn off the terminal driver flow control using the 'stty' command:
- $ stty -ixon -xoff
+ $ stty -ixon -ixoff
or, you can change the keys used for the terminal flow control, using the
following commands:
@@ -6426,7 +6830,7 @@ following commands:
$ stty start <char>
-30.2. I am seeing weird screen update problems in Vim. What can I do to
+32.2. I am seeing weird screen update problems in Vim. What can I do to
solve this screen/display update problems?
You have to use a proper terminal emulator like xterm with correct TERM
@@ -6436,7 +6840,7 @@ For more information, read
:help 'term'
-30.3. I am using the terminal/console version of Vim. In insertmode, When I
+32.3. I am using the terminal/console version of Vim. In insertmode, When I
press the backspace key, the character before the cursor is not
erased. How do I configure Vim to do this?
@@ -6460,7 +6864,7 @@ For more information, read
:help NetBSD-backspace
-30.4. I am using Vim in a xterm. When I quit Vim, the screen contents are
+32.4. I am using Vim in a xterm. When I quit Vim, the screen contents are
restored back to the original contents. How do I disable this?
The xterm has a capability called "alternate screen". If this capability
@@ -6476,7 +6880,7 @@ For more information, read
:help xterm-screens
-30.5. When I start Vim, it takes quite a few seconds to start. How do I
+32.5. When I start Vim, it takes quite a few seconds to start. How do I
minimize the startup time?
This may be related to Vim opening the X display for setting the xterm
@@ -6501,7 +6905,7 @@ For more information, read
:help 'clipboard'
-30.6. How can I make the cursor in gvim in unix stop blinking?
+32.6. How can I make the cursor in gvim in unix stop blinking?
You can modify the 'guicursor' option, to stop the cursor from blinking.
For example:
@@ -6513,7 +6917,7 @@ For more information, read
:help 'guicursor'
-30.7. How do I change the menu font on GTK Vim?
+32.7. How do I change the menu font on GTK Vim?
You can modify the ~/.gtkrc file to change the menu font on GTK Vim. For
example:
@@ -6529,7 +6933,7 @@ For more information, read
:help gui-gtk
-30.8. How do I prevent <Ctrl-Z> from suspending Vim?
+32.8. How do I prevent <Ctrl-Z> from suspending Vim?
You can map <Ctrl-Z> to prevent the suspending. Here are some suggestions:
@@ -6549,7 +6953,7 @@ For the last example, the double quote is necessary in order to keep the
message on the status line.
-30.9. When I kill the xterm running Vim, the Vim process continues to run
+32.9. When I kill the xterm running Vim, the Vim process continues to run
and takes up a lot of CPU (99%) time. Why is this happening?
When Vim is built with support for Python interface, you will have this
@@ -6562,7 +6966,7 @@ For more information, read
:help python
-30.10. How do I get the Vim syntax highlighting to work in a Unix terminal?
+32.10. How do I get the Vim syntax highlighting to work in a Unix terminal?
The easiest and simplest way to get Vim syntax highlighting is to use the
GUI version of Vim (GVIM). To get syntax highlighting to work in the
@@ -6594,10 +6998,10 @@ For more information, read
=============================================================================
-SECTION 31 - VIM ON MS-WINDOWS
+SECTION 33 - VIM ON MS-WINDOWS
-31.1. In MS-Windows, CTRL-V doesn't start the blockwise visual mode. What
+33.1. In MS-Windows, CTRL-V doesn't start the blockwise visual mode. What
happened?
The mswin.vim script provides key mappings and options to make Vim behave
@@ -6615,7 +7019,7 @@ For more information, read
:help 10.5
-31.2. When I press the CTRL-Y key, it acts like the CTRL-R key. How do I
+33.2. When I press the CTRL-Y key, it acts like the CTRL-R key. How do I
configure Vim to treat CTRL-Y as CTRL-Y?
The mapping of the CTRL-Y key to the CTRL-R key is done by the mswin.vim
@@ -6625,7 +7029,7 @@ comment out the line in mswin.vim that maps the CTRL-Y key or you can
remove the line in your .vimrc file that sources the mswin.vim script.
-31.3. How do I start GUI Vim in a maximized window always?
+33.3. How do I start GUI Vim in a maximized window always?
You can use the "simalt" command to maximize the Vim window. You can use
the GUIEnter autocmd to maximize the Vim window on startup:
@@ -6639,7 +7043,7 @@ For more information, read
:help gui-win32-maximized
-31.4. After doing some editing operations, Vim freezes. The cursor becomes
+33.4. After doing some editing operations, Vim freezes. The cursor becomes
an empty rectangle. I am not able enter any characters. What is
happening?
@@ -6652,7 +7056,7 @@ For more information, read
:help intellimouse-wheel-problems
-31.5. I am using Windows XP, the display speed of maximized GVim is very
+33.5. I am using Windows XP, the display speed of maximized GVim is very
slow. What can I do to speed the display updates?
This may be due to the fact that you have enabled 'Smooth edges of screen
@@ -6660,7 +7064,7 @@ fonts' in the display properties. Try turning off font smoothing or try
changing the smoothing method to "Standard".
-31.6. What are the recommended settings for using Vim with cygwin?
+33.6. What are the recommended settings for using Vim with cygwin?
You may want to set the following shell related Vim settings:
@@ -6673,7 +7077,7 @@ You may want to set the following shell related Vim settings:
:set shellredir=>%s 2>&1
-31.7. I am trying to use GNU diff with Vim diff mode. When I run the diff
+33.7. I am trying to use GNU diff with Vim diff mode. When I run the diff
from command line, it works. When I try to use the diff with Vim it
doesn't work. What should I do now?
@@ -6683,7 +7087,7 @@ GNU diff.exe built by Ron Aaron from the following link:
http://www.mossbayeng.com/~ron/vim/builds.html
-31.8. Is it possible to use Vim as an external editor for MS-Windows
+33.8. Is it possible to use Vim as an external editor for MS-Windows
Outlook email client?
You can use the "cubiclevim" COM Add-In to use Vim as an external editor
@@ -6695,7 +7099,7 @@ information:
Note that currently this works only with MS-Office 2000 and XP.
-31.9. I am using Vim to edit HTML files. How do I start internet explorer
+33.9. I am using Vim to edit HTML files. How do I start internet explorer
with the current file to preview the HTML file?
You can use the following command:
@@ -6703,7 +7107,7 @@ You can use the following command:
:!start c:\progra~1\intern~1\iexplore.exe file://%:p<CR>
-31.10. I would like to use Vim with Microsoft Visual Studio. How do I do
+33.10. I would like to use Vim with Microsoft Visual Studio. How do I do
this?
You have to download and use the OLE version of Vim (for example:
@@ -6715,7 +7119,7 @@ For more information, read
:help MSVisualStudio
-31.11. Where do I place the _vimrc and _gvimrc files?
+33.11. Where do I place the _vimrc and _gvimrc files?
You can place the _vimrc and _gvimrc files under the directory pointed to
by the VIM environment variable. If you are sharing this system with other
@@ -6728,7 +7132,7 @@ For more information, read
:help _vimrc
-31.12. Everytime I save a file, Vim warns about the file being changed
+33.12. Everytime I save a file, Vim warns about the file being changed
outside of Vim. Why?
If you get the following warning message, everytime you save a file:
@@ -6752,10 +7156,10 @@ For more information, read
=============================================================================
-SECTION 32 - PRINTING
+SECTION 34 - PRINTING
-32.1. How do I print a file along with line numbers for all the lines?
+34.1. How do I print a file along with line numbers for all the lines?
You can set the 'printoptions' option and use the ":hardcopy" command to
print your file:
@@ -6769,7 +7173,7 @@ For more information, read
:help :hardcopy
-32.2. How do I print a file with the Vim syntax highlighting colors?
+34.2. How do I print a file with the Vim syntax highlighting colors?
You can use the ":hardcopy" command to print a file with the Vim syntax
highlighting colors. You can also convert your file to a HTML file using
@@ -6785,10 +7189,10 @@ For more information, read
=============================================================================
-SECTION 33 - BUILDING VIM FROM SOURCE
+SECTION 35 - BUILDING VIM FROM SOURCE
-33.1. How do I build Vim from the sources on a Unix system?
+35.1. How do I build Vim from the sources on a Unix system?
For a Unix system, follow these steps to build Vim from the sources:
@@ -6814,7 +7218,7 @@ For more information, read
:help install
-33.2. How do I install Vim in my home directory or a directory other
+35.2. How do I install Vim in my home directory or a directory other
than the default installation directory in Unix?
To install Vim in a directory other than the default installation
@@ -6834,7 +7238,7 @@ For more information, read
:help install
-33.3. How do I build Vim from the sources on a MS-Windows system?
+35.3. How do I build Vim from the sources on a MS-Windows system?
For a MS-Windows system, Vim can be built using either the Visual C++
compiler or the Borland C++ compiler or the Ming GCC compiler or the cygwin
@@ -6866,7 +7270,7 @@ For more information, read
:help install
-33.4. The Vim help, syntax, indent files are missing from my Vim
+35.4. The Vim help, syntax, indent files are missing from my Vim
installation. How do I install these files?
The Vim help, syntax, indent and other runtime files are part of the Vim
@@ -6879,7 +7283,7 @@ For more information, read
:help install
-33.5. I have built Vim from the source and installed the Vim package using
+35.5. I have built Vim from the source and installed the Vim package using
"make install". Do I need to keep the Vim source directory?
No. Once you have built and installed Vim in some directory other than the
@@ -6887,7 +7291,7 @@ original source directory (for example, /usr/bin or /usr/local/bin), then
you can remove the source directory.
-33.6. How do I determine the Vim features which are enabled at compile
+35.6. How do I determine the Vim features which are enabled at compile
time?
You can use the ":version" command to determine the Vim features that are
@@ -6908,7 +7312,7 @@ For more information, read
:help has()
-33.7. Can I build Vim without the GUI support?
+35.7. Can I build Vim without the GUI support?
Yes. You can build Vim by optionally enabling/disabling many of the
features including GUI.
@@ -6918,7 +7322,7 @@ For more information, read
:help install
-33.8. When building Vim on a Unix system, I am getting "undefined reference
+35.8. When building Vim on a Unix system, I am getting "undefined reference
to term_set_winsize' error. How do I resolve this error?
You will get this error when the build process is not able to locate the
@@ -6926,7 +7330,7 @@ termlib, termcap or ncurses library. You have to install the ncurses-dev
package to resolve this error.
-33.9. Vim configure keeps complaining about the lack of gtk-config while
+35.9. Vim configure keeps complaining about the lack of gtk-config while
trying to use GTK 2.03. This is correct, since in GTK 2 they moved to
using the generic pkg-config. I can get pkg-config to list the
various includes and libs for gtk, but for some reason the configure
@@ -6940,10 +7344,10 @@ Use the following shell script named gtk-config:
=============================================================================
-SECTION 34 - VARIOUS
+SECTION 36 - VARIOUS
-34.1. How do I edit binary files with Vim?
+36.1. How do I edit binary files with Vim?
You can set the following options to edit binary files in Vim:
@@ -6968,21 +7372,7 @@ For more information, read
:help 'display'
-34.2. When I invoke Vim, I get error messages about illegal characters in
- the viminfo file. What should I do to get rid of these messages?
-
-You can remove the $HOME/.viminfo or $HOME/_viminfo file to get rid of
-these error messages.
-
-For more information, read
-
- :help viminfo-errors
- :help viminfo-file-name
- :help viminfo
- :help 21.3
-
-
-34.3. How do I disable the visual error flash and the error beep?
+36.2. How do I disable the visual error flash and the error beep?
You can disable both the visual error flash and the error beep using the
following command:
@@ -6996,7 +7386,7 @@ For more information, read
:help t_vb
-34.4. How do I display the ascii value of a character displayed in a
+36.3. How do I display the ascii value of a character displayed in a
buffer?
You can use the 'ga' command to display the ascii value of a displayed
@@ -7008,7 +7398,7 @@ For more information, read
:help :ascii
-34.5. Can I use zero as a count for a Vim command?
+36.4. Can I use zero as a count for a Vim command?
You cannot use zero as a count for a Vim command, as "0" is a command on
its own, moving to the first column of the line.
@@ -7019,7 +7409,7 @@ For more information, read
:help count
-34.6. How do I disable the Vim welcome screen?
+36.5. How do I disable the Vim welcome screen?
You can disable the Vim welcome screen, by adding the 'I' flag to the
'shortmess' option:
@@ -7032,7 +7422,7 @@ For more information, read
:help 'shortmess'
-34.7. How do I avoid the "hit enter to continue" prompt?
+36.6. How do I avoid the "hit enter to continue" prompt?
Vim will prompt you with the "hit enter to continue" prompt, if there are
some messages on the screen for you to read and the screen is about to be
@@ -7053,7 +7443,7 @@ For more information, read
:help 'cmdheight'
-34.8. How do I invoke Vim from command line to run a group of commands on a
+36.7. How do I invoke Vim from command line to run a group of commands on a
group of files?
There are several ways to invoke Vim from command line to run a group of
@@ -7071,6 +7461,16 @@ line option and the "|" character to separate the ex commands:
In the above command, if an ex command fails, then all the remaining ex
commands will not be executed.
+For example, to replace "ABC" with "DEF" in a file from the command-line,
+you can use the following command:
+
+ $ vim -c "%s/ABC/DEF/ge | update" myfile.txt
+
+To replace "ABC" with "DEF" in multiple files from the command-line,
+you can use the following command:
+
+ $ vim -c "argdo %s/ABC/DEF/ge | update" *.txt
+
You can store the group of commands into a file and use the "-s" command
line option to run the commands on a set of files. For example, if the
group of commands are stored in the file mycmds.txt, then you can use the
@@ -7084,27 +7484,48 @@ For more information, read
:help -s
-34.9. How do I disable the viminfo feature?
+36.8. How do I use a normal mode command from insert mode without leaving
+ the insert mode?
-By default, the viminfo feature is disabled. If the viminfo feature is
-enabled by a system-wide vimrc file, then you can disable the viminfo
-feature by setting the 'viminfo' option to an empty string in your local
-.vimrc file:
+You can use a normal command from insert mode, without leaving the insert
+mode, by first pressing the CTRL-O key and then follow that with a single
+normal mode command.
- :set viminfo=""
+To execute more than one normal mode command, press the CTRL-L key,
+followed by any number of normal mode commands and then press <Esc> to get
+back to the insert mode.
For more information, read
- :help 'viminfo'
+ :help i_CTRL-O
+ :help i_CTRL-L
+
+
+36.9. How do I start Vim in insert mode?
+
+You can start Vim in insert mode using the ":startinsert" ex command.
+
+ $ vim +startinsert myfile.txt
+
+The above command will open the file "myfile.txt" and start insert mode
+with the cursor in front of the first character on the first line. To open
+the file and start appending after the last character on the last line,
+you can use the following command:
+
+ $ vim + +startinsert! myfile.txt
+
+For more information, read
+
+ :help :startinsert
=============================================================================
-SECTION 35 - UNICODE
+SECTION 37 - UNICODE
Author: Tony Mechelynck <antoine.mechelynck AT belgacom.net>
-35.1. Is it possible to create Unicode files using Vim?
+37.1. Is it possible to create Unicode files using Vim?
Yes. It may be more or less complicated depending on the keyboard and fonts
available to you, but it is always possible to encode any possible Unicode
@@ -7122,7 +7543,7 @@ For more information, read
:help usr_45.txt
-35.2. Which Vim settings are particularly important for editing Unicode
+37.2. Which Vim settings are particularly important for editing Unicode
files?
The most important are the various "encoding" options, i.e., 'encoding',
@@ -7138,7 +7559,7 @@ For more information, read
:help 'bomb'
-35.3. What is the 'encoding' option?
+37.3. What is the 'encoding' option?
Basically, the 'encoding' option defines how Vim will represent your data
internally. However, all Unicode encodings are represented internally as
@@ -7149,7 +7570,7 @@ For more information, read
:help 'encoding'
-35.4. How does Vim name the various Unicode encodings?
+37.4. How does Vim name the various Unicode encodings?
Utf-8 is called utf-8 or utf8; utf-16 is called ucs-2 or ucs2; utf-32 is
called ucs-4 or ucs4. Also, you may specify endianness (except for utf-8
@@ -7165,7 +7586,7 @@ For more information, read
:help encoding-table
-35.5. How does Vim specify the presence or absence of a byte-order mark?
+37.5. How does Vim specify the presence or absence of a byte-order mark?
When reading a file, if the 'fileencodings' option includes "ucs-bom", Vim
will check for a byte-order mark. When writing a file, if the 'bomb' option
@@ -7178,7 +7599,7 @@ For more information, read
:help 'bomb'
-35.6. What is the 'fileencoding' option?
+37.6. What is the 'fileencoding' option?
The 'fileencoding' option defines the particular encoding which Vim will
use to write a file. If empty, then the value of the 'encoding' option is
@@ -7189,7 +7610,7 @@ For more information, read
:help 'fileencoding'
-35.7. What is the 'fileencodings' option?
+37.7. What is the 'fileencodings' option?
The 'fileencodings' option defines the heuristics used by Vim when opening
an existing file. It is a comma separated list of encodings. A special
@@ -7208,7 +7629,7 @@ For more information, read
:help 'encoding'
-35.8. What is the 'termencoding' option?
+37.8. What is the 'termencoding' option?
The 'termencoding' option defines how your keyboard encodes the data you
type. If empty, Vim assumes that it has the same value as 'encoding'.
@@ -7220,7 +7641,7 @@ For more information, read
:help locale
-35.9. What is the 'bomb' option?
+37.9. What is the 'bomb' option?
When reading a file with "ucs-bom" present in the 'fileencodings' option,
Vim will set the 'bomb' option on or off depending on the presence or
@@ -7233,13 +7654,13 @@ For more information, read
:help 'bomb'
-35.10. Where can I find an example of a typical use of all these options?
+37.10. Where can I find an example of a typical use of all these options?
There is a "tip", with explains them in different words with an example, at
http://vim.sourceforge.net/tip_view.php?tip_id=246 .
-35.11. How can I insert Unicode characters into a file using Vim?
+37.11. How can I insert Unicode characters into a file using Vim?
Several methods are available:
@@ -7260,7 +7681,7 @@ For more information, read
:help i_CTRL-V_digit
-35.12. How can I know which digraphs are defined and for which characters?
+37.12. How can I know which digraphs are defined and for which characters?
First set the 'encoding' option properly (for instance, to utf-8), then use
the :digraphs command to list the currently defined digraphs.
@@ -7274,5 +7695,5 @@ For more information, read
=============================================================================
Current Maintainer: Yegappan Lakshmanan
-Last updated on: 17 October 2003
+Last updated on: 2 January 2005
--
Vim packaging
More information about the pkg-vim-maintainers
mailing list