mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 12:41:08 +08:00
abbr: Clarify universal variable message
And give explicit upgrade instructions.
This commit is contained in:
parent
01d681067c
commit
9043008933
|
@ -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
|
||||
--------------------
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user