&dactyl.appName; provides a number of commands to change the behavior of key presses. This can mean anything from automatically substituting one key for another or automatically replacing one typed word for another, to launching a dialog or running a command.
Key mappings are the most basic means &dactyl.appName; provides
for altering the actions of key presses. Each key mapping is
associated with a mode, such as insert,
normal, or
command-line, and only
has effect when that mode is active. Although each mode has a
full suite of internal mappings, they may be easily augmented,
altered, or removed with the
:map :echo Date()
causes “
Standard key mapping commands are provided for the four most common modes,
The ordinary
Map the
:map a b
:map b a
In order to avoid this shortcoming, the
Any of the map commands may be given the following options:
Map the
:noremap d D
:noremap D d
Remove the mapping of lhs for the applicable mode(s).
Remove all user-defined mappings for the applicable mode(s).
List all mappings for the applicable mode(s).
List all mappings starting with lhs for the applicable mode(s).
When the first argument to one of the mapping commands is
Below is an overview of which modes each map command applies to:
:map :noremap :unmap :mapclear – both Normal and Visual modes
:nmap :nnoremap :nunmap :nmapclear – Normal mode
:vmap :vnoremap :vunmap :vmapclear – Visual mode
:imap :inoremap :iunmap :imapclear – Insert mode
:cmap :cnoremap :cunmap :cmapclear – Command-line mode
Most keys in key sequences are represented simply by the character that you see on the screen when you type them. However, as a number of these characters have special meanings, and a number of keys have no visual representation, a special notation is required.
In order to represent key presses using the Control, Alt, Meta, or Shift keys, the following prefixes may be used,
These prefixes can be combined however you see fit, though you should note that within angle brackets all alphabetic characters are read as lowercase. Uppercase characters can only be specified with the S- modifier. The following key sequences are interpreted as described,
Do nothing. This pseudo-key is useful for disabling a
specific builtin mapping. For example,
Expand to a line terminator in a key mapping. An Ex command in the rhs of a
mapping requires a line terminator after it so that it is executed when the
mapping is expanded.
Expands to the value of the ‘mapleader’ variable in key mapping. If ‘mapleader’ is unset or empty then ‘\’ is used. For example, by default,
:map h :echo Hello
works like
:map \h :echo Hello
but after
:let mapleader = ,
it works like
:map ,h :echo Hello
In addition to basic mappings, &dactyl.appName; can also automatically replace whole words after they've been typed. These shortcuts are known as abbreviations, and are most often useful for correcting spelling of commonly mistyped words, as well as shortening the typing of oft-typed but long words or phrases. There are three basic types of abbreviations, defined by the types of characters they contain,
For the purposes of abbreviations, keyword characters include
all non-whitespace characters except for single or double
quotation marks. Abbreviations are expanded as soon as any
non-keyword character, or the key
Abbreviate lhs to rhs. If only lhs is given, list all abbreviations that start with lhs. If no arguments are given, list all abbreviations.
If the -javascript (short names -js, -j) option is given, lhs is expanded to the value returned by the JavaScript code rhs. The code is evaluated with the variable editor set to the editable element that the abbreviation is currently being expanded in. The code should not make any changes to the contents of the editor.
Abbreviate a key sequence for Command-line mode. Same as
Abbreviate a key sequence for Insert mode. Same as
Remove an abbreviation.
Remove an abbreviation for Command-line mode. Same as
Remove an abbreviation for Insert mode. Same as
Remove all abbreviations.
Remove all abbreviations for command-line mode.
Remove all abbreviations for Insert mode.
Defining new commands is perhaps the most straightforward way of
repeating commonly used actions. User-defined commands may be
entered from the command-line or scripts exactly like standard
commands, and may similarly accept arguments, options, counts,
and
List all user-defined commands.
List all user-defined commands that start with cmd.
Define a new user command. The name of the command is
cmd and its replacement text is rep. If a
command with this name already exists, an error is
reported unless
The new command is usually defined by a string to be
executed as an Ex command. In this case, before
execution, strings of the form
The command's behavior can be altered by providing attributes when the command is defined.
By default, user commands accept no arguments. This can be changed by specifying the -nargs attribute.
The valid values are:
Completion for arguments to user-defined commands is not available by default. Completion can be enabled by specifying one of the following arguments to the -complete option when defining the command.
Custom completion can be provided by specifying the
start is the index into the word being completed at which the returned values should be applied and completions is a two-dimensional array of the form: [[arg1, description1], [arg2, description2], …]
By default, user commands do not accept a count. Use the -count attribute if you'd like to have a count passed to your user command. This will then be available for expansion as <count> in the argument.
By default, a user command does not have a special version, i.e. a version executed with the ! modifier. Providing the -bang attribute will enable this and <bang> will be available in the argument.
The command's description text can be set with -description. Otherwise it will default to "User-defined command".
The replacement text rep is scanned for escape sequences and these are replaced with values from the user-entered command line. The resulting string is then executed as an Ex command.
The valid escape sequences are:
"q-" can be prefixed to the escape sequence so that the value is quoted, making it suitable for expression evaluation. Example: <q-args>
Delete all user-defined commands.
Delete the user-defined command cmd.
Add a :Google command to search via google:
:command -nargs=* Google open google <args>