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

	switch "$cmd"

		case ''
		exit 0

		case '*'
		commandline -f delete-char

	end

end