abbr: Also show --position

(if not the default)
This commit is contained in:
Fabian Boehm 2022-12-14 18:06:24 +01:00
parent 30a37d9433
commit bb98cb01c7
2 changed files with 6 additions and 0 deletions

View File

@ -103,6 +103,10 @@ static int abbr_show(const abbr_options_t &, io_streams_t &streams) {
comps.push_back(L"--regex"); comps.push_back(L"--regex");
comps.push_back(escape_string(abbr.key)); comps.push_back(escape_string(abbr.key));
} }
if (abbr.position != abbrs_position_t::command) {
comps.push_back(L"--position");
comps.push_back(L"anywhere");
}
if (abbr.set_cursor_marker.has_value()) { if (abbr.set_cursor_marker.has_value()) {
comps.push_back(L"--set-cursor=" + escape_string(*abbr.set_cursor_marker)); comps.push_back(L"--set-cursor=" + escape_string(*abbr.set_cursor_marker));
} }

View File

@ -156,9 +156,11 @@ abbr --show
abbr --add nonregex_name foo abbr --add nonregex_name foo
abbr --add regex_name --regex 'A[0-9]B' bar abbr --add regex_name --regex 'A[0-9]B' bar
abbr --add !! --position anywhere --function replace_history
abbr --show abbr --show
# CHECK: abbr -a -- nonregex_name foo # CHECK: abbr -a -- nonregex_name foo
# CHECK: abbr -a --regex 'A[0-9]B' -- regex_name bar # CHECK: abbr -a --regex 'A[0-9]B' -- regex_name bar
# CHECK: abbr -a --position anywhere --function -- !! replace_history
abbr --erase (abbr --list) abbr --erase (abbr --list)
abbr --add bogus --position never stuff abbr --add bogus --position never stuff