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
|
|
|
|
2006-12-06 20:25:37 +08:00
|
|
|
set -l cmd (commandline)
|
2007-09-26 17:01:59 +08:00
|
|
|
|
|
|
|
switch $cmd
|
|
|
|
|
|
|
|
case ''
|
2006-11-12 19:45:44 +08:00
|
|
|
exit 0
|
2007-09-26 17:01:59 +08:00
|
|
|
|
|
|
|
case '*'
|
|
|
|
commandline -f delete-char
|
|
|
|
|
2006-02-17 18:13:39 +08:00
|
|
|
end
|
2007-09-26 17:01:59 +08:00
|
|
|
|
2006-02-17 18:13:39 +08:00
|
|
|
end
|
|
|
|
|