-*cmdline.txt* For Vim version 9.1. Last change: 2024 Aug 20
+*cmdline.txt* For Vim version 9.1. Last change: 2024 Oct 05
VIM REFERENCE MANUAL by Bram Moolenaar
completing other texts (e.g. command names), the 'ignorecase' option is used
instead (fuzzy matching always ignores case, however).
-If you like tcsh's autolist completion, you can use this mapping:
+If you like tcsh's autolist completion, you can use this mapping: >
:cnoremap X <C-L><C-D>
(Where X is the command key to use, <C-L> is CTRL-L and <C-D> is CTRL-D)
This will find the longest match and then list all matching files.
If you like tcsh's autolist completion, you can use the 'wildmode' option to
-emulate it. For example, this mimics autolist=ambiguous:
+emulate it. For example, this mimics autolist=ambiguous: >
:set wildmode=longest,list
This will find the longest match with the first 'wildchar', then list all
matching files with the next.
-*if_tcl.txt* For Vim version 9.1. Last change: 2022 Jan 08
+*if_tcl.txt* For Vim version 9.1. Last change: 2024 Oct 05
VIM REFERENCE MANUAL by Ingo Wilken
Here are a few small (and maybe useful) Tcl scripts.
This script sorts the lines of the entire buffer (assume it contains a list
-of names or something similar):
+of names or something similar): >
set buf $::vim::current(buffer)
set lines [$buf get top bottom]
set lines [lsort -dictionary $lines]
$buf set top bottom $lines
This script reverses the lines in the buffer. Note the use of "::vim::lbase"
-and "$buf last" to work with any line number setting.
+and "$buf last" to work with any line number setting: >
set buf $::vim::current(buffer)
set t $::vim::lbase
set b [$buf last]
incr b -1
}
-This script adds a consecutive number to each line in the current range:
+This script adds a consecutive number to each line in the current range: >
set buf $::vim::current(buffer)
set i $::vim::range(start)
set n 1
incr i ; incr n
}
-The same can also be done quickly with two Ex commands, using ":tcldo":
+The same can also be done quickly with two Ex commands, using ":tcldo": >
:tcl set n 1
:[range]tcldo set line "$n\t$line" ; incr n
-This procedure runs an Ex command on each buffer (idea stolen from Ron Aaron):
+This procedure runs an Ex command on each buffer (idea stolen from Ron Aaron): >
proc eachbuf { cmd } {
foreach b [::vim::buffer list] {
$b command $cmd
}
}
-Use it like this:
+Use it like this: >
:tcl eachbuf %s/foo/bar/g
Be careful with Tcl's string and backslash substitution, tough. If in doubt,
surround the Ex command with curly braces.
If you want to add some Tcl procedures permanently to vim, just place them in
a file (e.g. "~/.vimrc.tcl" on Unix machines), and add these lines to your
-startup file (usually "~/.vimrc" on Unix):
+startup file (usually "~/.vimrc" on Unix): >
if has("tcl")
tclfile ~/.vimrc.tcl
endif
-*indent.txt* For Vim version 9.1. Last change: 2024 Feb 29
+*indent.txt* For Vim version 9.1. Last change: 2024 Oct 05
VIM REFERENCE MANUAL by Bram Moolenaar
"<!>", respectively, for those keys.
For an emacs-style indent mode where lines aren't indented every time you
-press <Enter> but only if you press <Tab>, I suggest:
+press <Enter> but only if you press <Tab>, I suggest: >
:set cinkeys=0{,0},:,0#,!<Tab>,!^F
You might also want to switch off 'autoindent' then.
-*intro.txt* For Vim version 9.1. Last change: 2024 Apr 11
+*intro.txt* For Vim version 9.1. Last change: 2024 Oct 05
VIM REFERENCE MANUAL by Bram Moolenaar
command characters are those that you typed but were not used yet.
If you have a slow terminal you can switch off the status messages to speed
-up editing:
+up editing: >
:set nosc noru nosm
If there is an error, an error message will be shown for at least one second
-*motion.txt* For Vim version 9.1. Last change: 2024 Aug 28
+*motion.txt* For Vim version 9.1. Last change: 2024 Oct 05
VIM REFERENCE MANUAL by Bram Moolenaar
CTRL-H or *CTRL-H* *<BS>*
<BS> [count] characters to the left. |exclusive| motion.
Note: If you prefer <BS> to delete a character, use
- the mapping:
+ the mapping: >
:map CTRL-V<BS> X
- (to enter "CTRL-V<BS>" type the CTRL-V key, followed
+< (to enter "CTRL-V<BS>" type the CTRL-V key, followed
by the <BS> key)
See |:fixdel| if the <BS> key does not do what you
want.
-*repeat.txt* For Vim version 9.1. Last change: 2024 Aug 12
+*repeat.txt* For Vim version 9.1. Last change: 2024 Oct 05
VIM REFERENCE MANUAL by Bram Moolenaar
The global command sets both the last used search pattern and the last used
substitute pattern (this is vi compatible). This makes it easy to globally
-replace a string:
+replace a string: >
:g/pat/s//PAT/g
-This replaces all occurrences of "pat" with "PAT". The same can be done with:
+This replaces all occurrences of "pat" with "PAT". The same can be done with: >
:%s/pat/PAT/g
Which is two characters shorter!
\:%,
\n:>,
\fb:-
-are interpreted as if they were given in one line:
+are interpreted as if they were given in one line: >
:set comments=sr:/*,mb:*,el:*/,://,b:#,:%,n:>,fb:-
All leading whitespace characters in the line before a backslash are ignored.
Using a package and loading automatically ~
Let's assume your Vim files are in the "~/.vim" directory and you want to add a
-package from a zip archive "/tmp/foopack.zip":
+package from a zip archive "/tmp/foopack.zip": >
% mkdir -p ~/.vim/pack/foo
% cd ~/.vim/pack/foo
% unzip /tmp/foopack.zip
Using a single plugin and loading it automatically ~
If you don't have a package but a single plugin, you need to create the extra
-directory level:
+directory level: >
% mkdir -p ~/.vim/pack/foo/start/foobar
% cd ~/.vim/pack/foo/start/foobar
% unzip /tmp/someplugin.zip
Type the following commands:
>
cd /d f:\forkvim\src\po
- (the following command must be entered in one line, here it is separated for example)
- For Russian:
+< (the following command must be entered in one line, here it is separated for example)
+ For Russian: >
nmake.exe -f Make_mvc.mak "PLUGPACKAGE=aap"
"PO_PLUGPACKAGE=e:\project\translate\plugins\ru.po"
"MO_PLUGPACKAGE_PATH=d:\Programs\vim\vim91\lang\ru\LC_MESSAGES"
aap.mo
- For German:
+< For German: >
nmake.exe -f Make_mvc.mak "PLUGPACKAGE=aap"
"PO_PLUGPACKAGE=e:\project\translate\plugins\de.po"
"MO_PLUGPACKAGE_PATH=d:\Programs\vim\vim91\lang\de\LC_MESSAGES"
-*spell.txt* For Vim version 9.1. Last change: 2024 May 17
+*spell.txt* For Vim version 9.1. Last change: 2024 Oct 05
VIM REFERENCE MANUAL by Bram Moolenaar
The format for the affix and word list files is based on what Myspell uses
(the spell checker of Mozilla and OpenOffice.org). A description can be found
here:
- http://lingucomponent.openoffice.org/affix.readme ~
+ http://lingucomponent.openoffice.org/affix.readme
Note that affixes are case sensitive, this isn't obvious from the description.
Vim supports quite a few extras. They are described below |spell-affix-vim|.
compile-changes-9 version9.txt /*compile-changes-9*
compile-changes-9.2 version9.txt /*compile-changes-9.2*
compiler-compaqada ft_ada.txt /*compiler-compaqada*
+compiler-cppcheck quickfix.txt /*compiler-cppcheck*
compiler-decada ft_ada.txt /*compiler-decada*
compiler-dotnet quickfix.txt /*compiler-dotnet*
compiler-gcc quickfix.txt /*compiler-gcc*
quickfix-buffer quickfix.txt /*quickfix-buffer*
quickfix-changedtick quickfix.txt /*quickfix-changedtick*
quickfix-context quickfix.txt /*quickfix-context*
+quickfix-cppcheck quickfix.txt /*quickfix-cppcheck*
quickfix-directory-stack quickfix.txt /*quickfix-directory-stack*
quickfix-error-lists quickfix.txt /*quickfix-error-lists*
quickfix-functions usr_41.txt /*quickfix-functions*
-*term.txt* For Vim version 9.1. Last change: 2024 May 05
+*term.txt* For Vim version 9.1. Last change: 2024 Oct 05
VIM REFERENCE MANUAL by Bram Moolenaar
On some systems (at least on FreeBSD with XFree86 3.1.2) the codes that the
<End> and <Home> keys send contain a <Nul> character. To make these keys send
the proper key code, add these lines to your ~/.Xdefaults file:
-
-*VT100.Translations: #override \n\
- <Key>Home: string("0x1b") string("[7~") \n\
- <Key>End: string("0x1b") string("[8~")
-
+>
+ *VT100.Translations: #override \n\
+ <Key>Home: string("0x1b") string("[7~") \n\
+ <Key>End: string("0x1b") string("[8~")
+<
*xterm-8bit* *xterm-8-bit*
Xterm can be run in a mode where it uses 8-bit escape sequences. The CSI code
is used instead of <Esc>[. The advantage is that an <Esc> can quickly be
sent from the terminal to Vim every time the terminal gains or loses focus.
Vim fires focus events (|FocusGained|/|FocusLost|) by handling them accordingly.
Focus event tracking is disabled by a 't_fd' sequence when exiting "raw" mode.
-If you would like to disable this feature, add the following to your .vimrc:
- `set t_fd=`
- `set t_fe=`
+If you would like to disable this feature, add the following to your .vimrc: >
+ set t_fd=
+ set t_fe=
If your terminal does support this but Vim does not recognize the terminal,
you may have to set the options yourself: >
let &t_fe = "\<Esc>[?1004h"
Note for xterm users: The shifted cursor keys normally don't work. You can
make them work with the xmodmap command and some mappings in Vim.
- Give these commands in the xterm:
+ Give these commands in the xterm: >
xmodmap -e "keysym Up = Up F13"
xmodmap -e "keysym Down = Down F16"
xmodmap -e "keysym Left = Left F18"
xmodmap -e "keysym Right = Right F19"
-
- And use these mappings in Vim:
+<
+ And use these mappings in Vim: >
:map <t_F3> <S-Up>
:map! <t_F3> <S-Up>
:map <t_F6> <S-Down>
-*usr_29.txt* For Vim version 9.1. Last change: 2022 Mar 13
+*usr_29.txt* For Vim version 9.1. Last change: 2024 Oct 05
VIM USER MANUAL - by Bram Moolenaar
"ctags" is a separate program. Most Unix systems already have it installed.
If you do not have it yet, you can find Universal/Exuberant ctags at:
- http://ctags.io ~
- http://ctags.sf.net ~
+ http://ctags.io
+ http://ctags.sf.net
Universal ctags is preferred, Exuberant ctags is no longer being developed.
-*usr_45.txt* For Vim version 9.1. Last change: 2022 May 13
+*usr_45.txt* For Vim version 9.1. Last change: 2024 Oct 05
VIM USER MANUAL - by Bram Moolenaar
enhance xterm with Unicode support. If you don't have this font, you might
find it here:
- http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts.tar.gz ~
+ http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts.tar.gz
For MS-Windows, some fonts have a limited number of Unicode characters. Try
using the "Courier New" font. You can use the Edit/Select Font... menu to
If it doesn't work well, try getting a fontpack. If Microsoft didn't move it,
you can find it here:
- http://www.microsoft.com/typography/fonts/default.aspx ~
+ http://www.microsoft.com/typography/fonts/default.aspx
Now you have told Vim to use Unicode internally and display text with a
Unicode font. Typed characters still arrive in the encoding of your original
-*usr_90.txt* For Vim version 9.1. Last change: 2022 May 13
+*usr_90.txt* For Vim version 9.1. Last change: 2024 Oct 05
VIM USER MANUAL - by Bram Moolenaar
You can get precompiled binaries for many different UNIX systems. There is a
long list with links on this page:
- http://www.vim.org/binaries.html ~
+ http://www.vim.org/binaries.html
Volunteers maintain the binaries, so they are often out of date. It is a
good idea to compile your own UNIX version from the source. Also, creating
To get the Vim archives, look in this file for a mirror near you, this should
provide the fastest download:
- ftp://ftp.vim.org/pub/vim/MIRRORS ~
+ ftp://ftp.vim.org/pub/vim/MIRRORS
Or use the home site ftp.vim.org, if you think it's fast enough. Go to the
"unix" directory and you'll find a list of files there. The version number is
To get the Vim archives, look in this file for a mirror near you, this should
provide the fastest download:
- ftp://ftp.vim.org/pub/vim/MIRRORS ~
+ ftp://ftp.vim.org/pub/vim/MIRRORS
Or use the home site ftp.vim.org, if you think it's fast enough. Go to the
"pc" directory and you'll find a list of files there. The version number is
-*various.txt* For Vim version 9.1. Last change: 2024 Jul 17
+*various.txt* For Vim version 9.1. Last change: 2024 Oct 05
VIM REFERENCE MANUAL by Bram Moolenaar
If the character can be inserted as a digraph, also
output the two characters that can be used to create
the character:
- <ö> 246, Hex 00f6, Oct 366, Digr o: ~
+ <ö> 246, Hex 00f6, Oct 366, Digr o: ~
This shows you can type CTRL-K o : to insert ö.
*g8*
-*vi_diff.txt* For Vim version 9.1. Last change: 2024 May 15
+*vi_diff.txt* For Vim version 9.1. Last change: 2024 Oct 05
VIM REFERENCE MANUAL by Bram Moolenaar
considered to be a bug, or at least need improvement. But still, Vim
starts in a mode which behaves like the "real" Vi as much as possible.
To make Vim behave a little bit better, try resetting the 'compatible'
- option:
+ option: >
:set nocompatible
- Or start Vim with the "-N" argument:
+< Or start Vim with the "-N" argument: >
vim -N
- Vim starts with 'nocompatible' automatically if you have a .vimrc
+< Vim starts with 'nocompatible' automatically if you have a .vimrc
file. See |startup|.
The 'cpoptions' option can be used to set Vi compatibility on/off for
a number of specific items.
" Vim syntax file
" Language: Vim help file
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 10
+" Last Change: 2024 Oct 05
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Quit when a (custom) syntax file was already loaded
syn match helpSpecial "(N\>"ms=s+1
syn match helpSpecial "\[N]"
-" avoid highlighting N N in help.txt
+" avoid highlighting N N in quickref.txt
syn match helpSpecial "N N"he=s+1
syn match helpSpecial "Nth"me=e-2
syn match helpSpecial "N-1"me=e-2
+" highlighting N of cinoptions-values in indent.txt
+syn match helpSpecial "^\t-\?\zsNs\?\s"me=s+1
+" highlighting N of cinoptions-values in indent.txt
+syn match helpSpecial "^\t[>enf{}^L:=lbghNEpti+cC/(uUwWkmMjJ)*#P]N\s"ms=s+2,me=e-1
syn match helpSpecial "{[-a-zA-Z0-9'"*+/:%#=[\]<>.,]\+}"
syn match helpSpecial "\s\[[-a-z^A-Z0-9_]\{2,}]"ms=s+1
syn match helpSpecial "<[-a-zA-Z0-9_]\+>"