mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 19:41:15 -03:00
Implement set-cursor for abbreviations
set-cursor enables abbreviations to specify the cursor location after
expansion, by passing in a string which is expected to be found in the
expansion. For example you may create an abbreviation like `L!`:
abbr L! --position anywhere --set-cursor ! "! | less"
and the cursor will be positioned where the "!" is after expansion, with
the "| less" appearing to its right.
This commit is contained in:
@@ -152,3 +152,11 @@ expect_prompt()
|
||||
# The quiet one sees a token starting with 'a' and ending with 'z' and uppercases it.
|
||||
sendline(r"echo %abcdez%")
|
||||
expect_prompt(r"ABCDEZ")
|
||||
|
||||
# Test cursor positioning.
|
||||
sendline(r"""abbr --erase (abbr --list) """)
|
||||
expect_prompt()
|
||||
sendline(r"""abbr LLL --position anywhere --set-cursor !HERE! '!HERE! | less'""")
|
||||
expect_prompt()
|
||||
send(r"""echo LLL derp?""")
|
||||
expect_str(r"echo derp | less ")
|
||||
|
||||
Reference in New Issue
Block a user