2006-02-17 10:13:39 +00: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-25 20:28:36 +00:00
|
|
|
function delete-or-exit
|
2007-09-26 09:01:59 +00:00
|
|
|
|
2006-12-06 12:25:37 +00:00
|
|
|
set -l cmd (commandline)
|
2007-09-26 09:01:59 +00:00
|
|
|
|
2012-06-07 15:48:02 +00:00
|
|
|
switch "$cmd"
|
2007-09-26 09:01:59 +00:00
|
|
|
|
|
|
|
case ''
|
2006-11-12 11:45:44 +00:00
|
|
|
exit 0
|
2007-09-26 09:01:59 +00:00
|
|
|
|
|
|
|
case '*'
|
|
|
|
commandline -f delete-char
|
|
|
|
|
2006-02-17 10:13:39 +00:00
|
|
|
end
|
2007-09-26 09:01:59 +00:00
|
|
|
|
2006-02-17 10:13:39 +00:00
|
|
|
end
|
|
|
|
|