2006-02-17 18:13:39 +08:00
|
|
|
#
|
|
|
|
# This function deletes a character from the commandline if it is
|
|
|
|
# non-empty, and exits the shell otherwise. Implementing this
|
|
|
|
# functionality has been a longstanding request from various
|
|
|
|
# fish-users.
|
|
|
|
#
|
|
|
|
|
2006-10-26 04:28:36 +08:00
|
|
|
function delete-or-exit
|
2007-09-26 17:01:59 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
set -l cmd (commandline)
|
2007-09-26 17:01:59 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
switch "$cmd"
|
2007-09-26 17:01:59 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
case ''
|
|
|
|
exit 0
|
2007-09-26 17:01:59 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
case '*'
|
|
|
|
commandline -f delete-char
|
2007-09-26 17:01:59 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
end
|
2007-09-26 17:01:59 +08:00
|
|
|
|
2006-02-17 18:13:39 +08:00
|
|
|
end
|
|
|
|
|