diff --git a/src/builtins/abbr.cpp b/src/builtins/abbr.cpp index b7349fd82..31f10264c 100644 --- a/src/builtins/abbr.cpp +++ b/src/builtins/abbr.cpp @@ -99,10 +99,6 @@ static int abbr_show(const abbr_options_t &, io_streams_t &streams) { comps.clear(); comps.push_back(L"abbr -a"); if (abbr.from_universal) comps.push_back(L"-U"); - comps.push_back(L"--"); - // Literal abbreviations have the name and key as the same. - // Regex abbreviations have a pattern separate from the name. - comps.push_back(escape_string(abbr.name)); if (abbr.is_regex()) { comps.push_back(L"--regex"); comps.push_back(escape_string(abbr.key)); @@ -113,6 +109,10 @@ static int abbr_show(const abbr_options_t &, io_streams_t &streams) { if (abbr.replacement_is_function) { comps.push_back(L"--function"); } + comps.push_back(L"--"); + // Literal abbreviations have the name and key as the same. + // Regex abbreviations have a pattern separate from the name. + comps.push_back(escape_string(abbr.name)); comps.push_back(escape_string(abbr.replacement)); wcstring result = join_strings(comps, L' '); result.push_back(L'\n'); @@ -397,4 +397,4 @@ maybe_t builtin_abbr(parser_t &parser, io_streams_t &streams, const wchar_t // validate() should error or ensure at least one path is set. DIE("unreachable"); return STATUS_INVALID_ARGS; -} \ No newline at end of file +} diff --git a/tests/checks/abbr.fish b/tests/checks/abbr.fish index b5a348c28..17612d53b 100644 --- a/tests/checks/abbr.fish +++ b/tests/checks/abbr.fish @@ -158,7 +158,7 @@ abbr --add nonregex_name foo abbr --add regex_name --regex 'A[0-9]B' bar abbr --show # CHECK: abbr -a -- nonregex_name foo -# CHECK: abbr -a -- regex_name --regex 'A[0-9]B' bar +# CHECK: abbr -a --regex 'A[0-9]B' -- regex_name bar abbr --erase (abbr --list) abbr --add bogus --position never stuff