aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/delete-or-exit.fish
blob: d82bf2ac118fcf9f7b6e4a9c4bd68410d7046df8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#
# 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.
#

function delete-or-exit
	set -l cmd (commandline)
	if test "$cmd"
		commandline -f delete-char
	else
		exit 0
	end
end