2019-06-26 19:10:01 +00:00
|
|
|
#RUN: %fish %s
|
|
|
|
# Test various `bind` command invocations. This is meant to verify that
|
|
|
|
# invalid flags, mode names, etc. are caught as well as to verify that valid
|
|
|
|
# ones are allowed.
|
|
|
|
|
2023-12-30 00:26:39 +00:00
|
|
|
# Verify that an invalid bind mode is rejected.
|
2019-06-26 19:10:01 +00:00
|
|
|
bind -m 'bad bind mode' \cX true
|
2022-04-08 14:36:06 +00:00
|
|
|
# CHECKERR: bind: bad bind mode: invalid mode name. See `help identifiers`
|
2021-11-04 05:52:17 +00:00
|
|
|
|
2023-12-30 00:26:39 +00:00
|
|
|
# Verify that an invalid bind mode target is rejected.
|
2019-06-26 19:10:01 +00:00
|
|
|
bind -M bind-mode \cX true
|
2022-04-08 14:36:06 +00:00
|
|
|
# CHECKERR: bind: bind-mode: invalid mode name. See `help identifiers`
|
2019-06-26 19:10:01 +00:00
|
|
|
|
|
|
|
# This should succeed and result in a success, zero, status.
|
|
|
|
bind -M bind_mode \cX true
|
|
|
|
|
|
|
|
### HACK: All full bind listings need to have the \x7f -> backward-delete-char
|
|
|
|
# binding explicitly removed, because on some systems that's backspace, on others not.
|
|
|
|
# Listing bindings
|
|
|
|
bind | string match -v '*backward-delete-char'
|
|
|
|
bind --user --preset | string match -v '*backward-delete-char'
|
|
|
|
# CHECK: bind --preset '' self-insert
|
|
|
|
# CHECK: bind --preset \n execute
|
|
|
|
# CHECK: bind --preset \r execute
|
|
|
|
# CHECK: bind --preset \t complete
|
2021-02-16 15:45:38 +00:00
|
|
|
# CHECK: bind --preset \cc cancel-commandline
|
2019-06-26 19:10:01 +00:00
|
|
|
# CHECK: bind --preset \cd exit
|
|
|
|
# CHECK: bind --preset \ce bind
|
2021-02-16 15:45:38 +00:00
|
|
|
# CHECK: bind --preset \cs pager-toggle-search
|
|
|
|
# CHECK: bind --preset \cu backward-kill-line
|
2019-06-26 19:10:01 +00:00
|
|
|
# CHECK: bind --preset \e\[A up-line
|
|
|
|
# CHECK: bind --preset \e\[B down-line
|
|
|
|
# CHECK: bind --preset \e\[C forward-char
|
|
|
|
# CHECK: bind --preset \e\[D backward-char
|
2021-02-16 15:45:38 +00:00
|
|
|
# CHECK: bind --preset \cp up-line
|
|
|
|
# CHECK: bind --preset \cn down-line
|
|
|
|
# CHECK: bind --preset \cb backward-char
|
|
|
|
# CHECK: bind --preset \cf forward-char
|
2019-06-26 19:10:01 +00:00
|
|
|
# CHECK: bind -M bind_mode \cx true
|
|
|
|
# CHECK: bind --preset '' self-insert
|
|
|
|
# CHECK: bind --preset \n execute
|
|
|
|
# CHECK: bind --preset \r execute
|
|
|
|
# CHECK: bind --preset \t complete
|
2021-02-16 15:45:38 +00:00
|
|
|
# CHECK: bind --preset \cc cancel-commandline
|
2019-06-26 19:10:01 +00:00
|
|
|
# CHECK: bind --preset \cd exit
|
|
|
|
# CHECK: bind --preset \ce bind
|
2021-02-16 15:45:38 +00:00
|
|
|
# CHECK: bind --preset \cs pager-toggle-search
|
|
|
|
# CHECK: bind --preset \cu backward-kill-line
|
2019-06-26 19:10:01 +00:00
|
|
|
# CHECK: bind --preset \e\[A up-line
|
|
|
|
# CHECK: bind --preset \e\[B down-line
|
|
|
|
# CHECK: bind --preset \e\[C forward-char
|
|
|
|
# CHECK: bind --preset \e\[D backward-char
|
2021-02-16 15:45:38 +00:00
|
|
|
# CHECK: bind --preset \cp up-line
|
|
|
|
# CHECK: bind --preset \cn down-line
|
|
|
|
# CHECK: bind --preset \cb backward-char
|
|
|
|
# CHECK: bind --preset \cf forward-char
|
2019-06-26 19:10:01 +00:00
|
|
|
# CHECK: bind -M bind_mode \cx true
|
|
|
|
|
|
|
|
# Preset only
|
|
|
|
bind --preset | string match -v '*backward-delete-char'
|
|
|
|
# CHECK: bind --preset '' self-insert
|
|
|
|
# CHECK: bind --preset \n execute
|
|
|
|
# CHECK: bind --preset \r execute
|
|
|
|
# CHECK: bind --preset \t complete
|
2021-02-16 15:45:38 +00:00
|
|
|
# CHECK: bind --preset \cc cancel-commandline
|
2019-06-26 19:10:01 +00:00
|
|
|
# CHECK: bind --preset \cd exit
|
|
|
|
# CHECK: bind --preset \ce bind
|
2021-02-16 15:45:38 +00:00
|
|
|
# CHECK: bind --preset \cs pager-toggle-search
|
|
|
|
# CHECK: bind --preset \cu backward-kill-line
|
2019-06-26 19:10:01 +00:00
|
|
|
# CHECK: bind --preset \e\[A up-line
|
|
|
|
# CHECK: bind --preset \e\[B down-line
|
|
|
|
# CHECK: bind --preset \e\[C forward-char
|
|
|
|
# CHECK: bind --preset \e\[D backward-char
|
2021-02-16 15:45:38 +00:00
|
|
|
# CHECK: bind --preset \cp up-line
|
|
|
|
# CHECK: bind --preset \cn down-line
|
|
|
|
# CHECK: bind --preset \cb backward-char
|
|
|
|
# CHECK: bind --preset \cf forward-char
|
2019-06-26 19:10:01 +00:00
|
|
|
|
|
|
|
# User only
|
|
|
|
bind --user | string match -v '*backward-delete-char'
|
|
|
|
# CHECK: bind -M bind_mode \cx true
|
|
|
|
|
|
|
|
# Adding bindings
|
|
|
|
bind \t 'echo banana'
|
|
|
|
bind | string match -v '*backward-delete-char'
|
|
|
|
# CHECK: bind --preset '' self-insert
|
|
|
|
# CHECK: bind --preset \n execute
|
|
|
|
# CHECK: bind --preset \r execute
|
|
|
|
# CHECK: bind --preset \t complete
|
2021-02-16 15:45:38 +00:00
|
|
|
# CHECK: bind --preset \cc cancel-commandline
|
2019-06-26 19:10:01 +00:00
|
|
|
# CHECK: bind --preset \cd exit
|
|
|
|
# CHECK: bind --preset \ce bind
|
2021-02-16 15:45:38 +00:00
|
|
|
# CHECK: bind --preset \cs pager-toggle-search
|
|
|
|
# CHECK: bind --preset \cu backward-kill-line
|
2019-06-26 19:10:01 +00:00
|
|
|
# CHECK: bind --preset \e\[A up-line
|
|
|
|
# CHECK: bind --preset \e\[B down-line
|
|
|
|
# CHECK: bind --preset \e\[C forward-char
|
|
|
|
# CHECK: bind --preset \e\[D backward-char
|
2021-02-16 15:45:38 +00:00
|
|
|
# CHECK: bind --preset \cp up-line
|
|
|
|
# CHECK: bind --preset \cn down-line
|
|
|
|
# CHECK: bind --preset \cb backward-char
|
|
|
|
# CHECK: bind --preset \cf forward-char
|
2019-06-26 19:10:01 +00:00
|
|
|
# CHECK: bind -M bind_mode \cx true
|
|
|
|
# CHECK: bind \t 'echo banana'
|
|
|
|
|
|
|
|
# Erasing bindings
|
|
|
|
bind --erase \t
|
|
|
|
bind \t
|
|
|
|
bind \t 'echo wurst'
|
2023-12-30 00:26:39 +00:00
|
|
|
# CHECK: bind --preset \t complete
|
2019-06-26 19:10:01 +00:00
|
|
|
bind --erase --user --preset \t
|
|
|
|
bind \t
|
2023-12-30 00:26:39 +00:00
|
|
|
# CHECKERR: bind: No binding found for sequence '\t'
|
2019-06-26 19:10:01 +00:00
|
|
|
|
|
|
|
exit 0
|