command it
can be done earlier.
Packages will be loaded only once. Using
`:packloadall` a second time will have no effect.
When the optional ! is added this command will load
packages even when done before.
Note that when using `:packloadall` in the |vimrc|
file, the 'runtimepath' option is updated, and later
all plugins in 'runtimepath' will be loaded, which
means they are loaded again. Plugins are expected to
handle that.
An error only causes sourcing the script where it
happens to be aborted, further plugins will be loaded.
See |packages|.
:scripte[ncoding] [encoding] *:scripte* *:scriptencoding* *E167*
Specify the character encoding used in the script.
The following lines will be converted from [encoding]
to the value of the 'encoding' option, if they are
different. Examples: >
scriptencoding iso-8859-5
scriptencoding cp932
<
When [encoding] is empty, no conversion is done. This
can be used to restrict conversion to a sequence of
lines: >
scriptencoding euc-jp
... lines to be converted ...
scriptencoding
... not converted ...
< When conversion isn't supported by the system, there
is no error message and no conversion is done. When a
line can't be converted there is no error and the
original line is kept.
Don't use "ucs-2" or "ucs-4", scripts cannot be in
these encodings (they would contain NUL bytes).
When a sourced script starts with a BOM (Byte Order
Mark) in utf-8 format Vim will recognize it, no need
to use ":scriptencoding utf-8" then.
*:scr* *:scriptnames*
:scr[iptnames] List all sourced script names, in the order they were
first sourced. The number is used for the script ID
|<SID>|.
Also see `getscriptinfo()`.
:scr[iptnames][!] {scriptId} *:script*
Edit script {scriptId}. Although ":scriptnames name"
works, using ":script name" is recommended.
When the current buffer can't be |abandon|ed and the !
is not present, the command fails.
*:fini* *:finish* *E168*
:fini[sh] Stop sourcing a script. Can only be used in a Vim
script file. This is a quick way to skip the rest of
the file. If it is used after a |:try| but before the
matching |:finally| (if present), the commands
following the ":finally" up to the matching |:endtry|
are executed first. This process applies to all
nested ":try"s in the script. The outermost ":endtry"
then stops sourcing the script.
All commands and command sequences can be repeated by putting them in a named
register and then executing it. There are two ways to get the commands in the
register:
- Use the record command "q". You type the commands once, and while they are
being executed they are stored in a register. Easy, because you can see
what you are doing. If you make a mistake, "p"ut the register into the
file, edit the command sequence, and then delete it into the register
again. You can continue recording by appending to the register (use an
uppercase letter).
- Delete or yank the command sequence into the register.
Often used command sequences can be put under a function key with the ':map'
command.
An alternative is to put the commands in a file, and execute them with the
':source!' command. Useful for long command sequences. Can be combined with
the ':map' command to put complicated commands under a function key.
The ':source' command reads Ex commands from a file or a buffer line by line.
You will have to type any needed keyboard input. The ':source!' command reads
from a script file character by character, interpreting each character as if
you typed it.
Example: When you give the ":!ls" command you get the |hit-enter| prompt. If
you ':source' a file with the line "!ls" in it, you will have to type the
<Enter> yourself. But if you ':source!' a file with the line ":!ls" in it,
the next characters from that file are read until a <CR> is found. You will
not have to type <CR> yourself,