summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2019-04-20 10:28:01 +0200
committerMaxime Coste <mawww@kakoune.org>2019-04-20 10:28:01 +0200
commit04df0e181ee0779d3c5f0f6c949bfba152ace7fc (patch)
treef9d1ac09ba8eda230cd4d7f3aa2952bc451dc460
parentaec58b968b10c82210af882d30b61be8bc8e22eb (diff)
parent4ce37c1211bf12f28ae3debe518a70bb353ae92a (diff)
Merge remote-tracking branch 'Delapouite/doc-aliases'
-rw-r--r--README.asciidoc26
-rw-r--r--doc/pages/commands.asciidoc31
2 files changed, 34 insertions, 23 deletions
diff --git a/README.asciidoc b/README.asciidoc
index 2b061275..125ddc37 100644
--- a/README.asciidoc
+++ b/README.asciidoc
@@ -790,36 +790,20 @@ Custom key shortcuts can be registered through mappings.
See <<doc/pages/mapping#,`:doc mapping`>>.
-Defining Commands
+Defining Commands and Aliases
~~~~~~~~~~~~~~~~~
New commands can be created using `:define-command`.
See <<doc/pages/commands#declaring-new-commands,`:doc commands declaring-new-commands`>>.
-Some helper commands are available to define composite commands.
-
-See <<doc/pages/commands#helpers,`:doc commands helpers`>>.
+They can be given additional short names depending of the scope with `:alias`.
-Aliases
-~~~~~~~
-
-With `:alias` commands can be given additional names. Aliases are scoped, so
-that an alias can refer to one command for a buffer, and to another for another
-buffer. The following command defines `<alias>` as an alias for `<command>`:
+See <<doc/pages/commands#aliases,`:doc commands aliases`>>.
---------------------------------
-:alias <scope> <alias> <command>
---------------------------------
-
-`<scope>` can be one of `global`, `buffer` or `window`.
-
--------------------------------------
-:unalias <scope> <alias> [<expected>]
--------------------------------------
+Some helper commands are available to define composite commands.
-Will remove the given alias in the given scope. If `<expected>` is specified
-the alias will only be removed if its current value is `<expected>`.
+See <<doc/pages/commands#helpers,`:doc commands helpers`>>.
FIFO Buffers
~~~~~~~~~~~
diff --git a/doc/pages/commands.asciidoc b/doc/pages/commands.asciidoc
index 125371a4..cc1b06af 100644
--- a/doc/pages/commands.asciidoc
+++ b/doc/pages/commands.asciidoc
@@ -150,12 +150,12 @@ of the file onto the filesystem
*alias* <scope> <name> <command>::
define a new alias named *name* in *scope*
- (See <<scopes#,`:doc scopes`>>)
+ (See <<aliases,Using aliases>> and <<scopes#,`:doc scopes`>>)
*unalias* <scope> <name> [<command>]::
remove an alias if its current value is the same as the one passed
as an optional parameter, remove it unconditionally otherwise
- (See <<scopes#,`:doc scopes`>>)
+ (See <<aliases,Using aliases>> and <<scopes#,`:doc scopes`>>)
*evaluate-commands* [<switches>] <command> ...::
*alias* eval +
@@ -404,3 +404,30 @@ Kakoune's state:
--------------------------------------------------------
def " print_selection %{ echo %sh{ ${kak_selection} } }"
--------------------------------------------------------
+
+== Aliases
+
+With `:alias`, commands can be given additional names.
+As aliases are intended to be used interactively most of the time,
+they are often short. For example `:reg` is an alias for `:set-register`.
+
+They are scoped, so that an alias can refer to one command for a buffer,
+and to another for another buffer. For instance `:next` could be an alias
+for `grep-next-match` in a `*grep*` buffer while pointing to
+`:make-next-error` in a `*make*` buffer.
+
+The following command defines `<alias>` as an alias for `<command>`:
+
+--------------------------------
+:alias <scope> <alias> <command>
+--------------------------------
+
+`<scope>` can be one of `global`, `buffer` or `window`.
+
+-------------------------------------
+:unalias <scope> <alias> [<expected>]
+-------------------------------------
+
+Will remove the given alias in the given scope. If `<expected>` is specified
+the alias will only be removed if its current value is `<expected>`.
+