abbr: Clarify universal variable message

And give explicit upgrade instructions.
This commit is contained in:
Fabian Boehm 2023-01-18 19:58:51 +01:00
parent 01d681067c
commit 9043008933
3 changed files with 15 additions and 2 deletions

View File

@ -36,6 +36,19 @@ Combining these features, it is possible to create custom syntaxes, where a regu
Previous versions of this allowed saving abbreviations in universal variables.
That's no longer possible. Existing variables will still be imported and ``abbr --erase`` will also erase the variables.
We recommend adding abbreviations to :ref:`config.fish <configuration>` by just adding the ``abbr --add`` command.
When you run ``abbr``, you will see output like this
::
> abbr
abbr -a -- foo bar # imported from a universal variable, see `help abbr`
In that case you should take the part before the ``#`` comment and save it in :ref:`config.fish <configuration>`,
then you can run ``abbr --erase`` to remove the universal variable::
> abbr >> ~/.config/fish/config.fish
> abbr --erase (abbr --list)
"add" subcommand
--------------------

View File

@ -99,7 +99,6 @@ static int abbr_show(const abbr_options_t &, io_streams_t &streams) {
for (const auto &abbr : abbrs->list()) {
comps.clear();
comps.push_back(L"abbr -a");
if (abbr.from_universal) comps.push_back(L"-U");
if (abbr.is_regex()) {
comps.push_back(L"--regex");
comps.push_back(escape_string(abbr.key));
@ -122,6 +121,7 @@ static int abbr_show(const abbr_options_t &, io_streams_t &streams) {
if (!abbr.replacement_is_function) {
comps.push_back(escape_string(abbr.replacement));
}
if (abbr.from_universal) comps.push_back(_(L"# imported from a universal variable, see `help abbr`"));
wcstring result = join_strings(comps, L' ');
result.push_back(L'\n');
streams.out.append(result);

View File

@ -4,7 +4,7 @@
set -U _fish_abbr_cuckoo somevalue
set fish (status fish-path)
$fish -c abbr
# CHECK: abbr -a -U -- cuckoo somevalue
# CHECK: abbr -a -- cuckoo somevalue # imported from a universal variable, see `help abbr`
# Test basic add and list of __abbr1
abbr __abbr1 alpha beta gamma