From 314108e53939a90b81e08f4ecd44fb9b4597d167 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 9 Oct 2016 21:32:36 +0100 Subject: [PATCH] Document register alternate names and add some missing ones Fixes #853 --- README.asciidoc | 24 +++++++++++++++--------- doc/manpages/registers.asciidoc | 26 ++++++++++++++++---------- src/register_manager.cc | 6 +++++- 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index a20530a8..ff240ff1 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -1017,27 +1017,33 @@ selection. Registers are lists, instead of simply text in order to interact well with multiselection. Each selection has its own captures or yank buffer. +Alternate names +^^^^^^^^^^^^^^^ + +non alphanumeric registers have an alternative name that can be used +in contexts where only alphanumeric identifiers are possible. + Special registers ^^^^^^^^^^^^^^^^^ Some registers are not general purposes, they cannot be written to, but they contain some special data: - * `%`: current buffer name - * `.`: current selection contents - * `#`: selection indices (first selection has 1, second has 2, ...) - * `_`: null register, always empty + * `%` (`percent`): current buffer name + * `.` (`dot`): current selection contents + * `#` (`dash`): selection indices (first selection has 1, second has 2, ...) + * `_` (`underscore`): null register, always empty Default registers ^^^^^^^^^^^^^^^^^ Most commands using a register default to a specific one if not specified: - * `"`: default yank, used by yanking and pasting commands like `y`, `p` and `R` - * `/`: default search register, used by regex based commands like `s`, `*` or `/` - * `@`: default macro register, used by `q` and `Q` - * `^`: default mark register, used by `z` and `Z` - * `|`: default shell command register, used by command that spawn a subshell such as `|`, ``, `!` or `` + * `"` (`dqoute`): default yank register, used by yanking and pasting commands like `y`, `p` and `R` + * `/` (`slash`): default search register, used by regex based commands like `s`, `*` or `/` + * `@` (`arobase`): default macro register, used by `q` and `Q` + * `^` (`caret`): default mark register, used by `z` and `Z` + * `|` (`pipe`): default shell command register, used by command that spawn a subshell such as `|`, ``, `!` or `` Macros ~~~~~~ diff --git a/doc/manpages/registers.asciidoc b/doc/manpages/registers.asciidoc index 4ad233df..8fbb9175 100644 --- a/doc/manpages/registers.asciidoc +++ b/doc/manpages/registers.asciidoc @@ -20,25 +20,31 @@ Interacting *"*:: in normal mode, select the ** register (single character) +Alternate names +--------------- + +non alphanumeric registers have an alternative name that can be used +in contexts where only alphanumeric identifiers are possible. + Default registers ----------------- Most commands using a register default to a specific one if not specified: -*"*:: - default yank, used by yanking and pasting commands like *y*, *p* +*"* (dquote):: + default yank register, used by yanking and pasting commands like *y*, *p* and *R* -*/*:: +*/* (slash):: default search register, used by regex based commands like *s*, *** or */* -*@*:: +*@* (arobase):: default macro register, used by *q* and *Q* -*^*:: +*^* (caret):: default mark register, used by *z* and *Z* -*|*:: +*|* (pipe):: default shell command register, used by command that spawn a subshell such as *|*, **, *!* or ** @@ -47,16 +53,16 @@ Special registers Some registers are not general purposes, they cannot be written to, but they contain some special data -*%*:: +*%* (percent):: current buffer name -*.*:: +*.* (dot):: current selection contents -*#*:: +*#* (dash):: selection indices (first selection has 1, second has 2, ...) -*_*:: +*_* (underscore):: null register, always empty Integer registers diff --git a/src/register_manager.cc b/src/register_manager.cc index c026f3fc..a1ebabf2 100644 --- a/src/register_manager.cc +++ b/src/register_manager.cc @@ -16,7 +16,11 @@ Register& RegisterManager::operator[](StringView reg) const { "dquote", '"' }, { "pipe", '|' }, { "caret", '^' }, - { "arobase", '@' } + { "arobase", '@' }, + { "percent", '%' }, + { "dot", '.' }, + { "dash", '#' }, + { "underscore", '_' } }; auto it = reg_names.find(reg); if (it == reg_names.end())