configs  Artifact [db35a08764]

Artifact db35a08764d278372b8c547f0f321acc7b9cd95e25e992dce8726d256cd95f53:

  • File config/fish/functions/cd.fish — part of check-in [5334b70051] at 2015-02-15 19:27:52 on branch trunk — Add fish config (user: js size: 604)

# vim: se ts=4:

function cd --description 'Change directory'
	# Skip history in subshells
	if status --is-command-substitution
		builtin cd $argv
		return $status
	end

	# Avoid set completions
	set -l previous $PWD

	if test $argv[1] = - ^/dev/null
		if test "$__fish_cd_direction" = next ^/dev/null
			nextd
		else
			prevd
		end
		return $status
	end

	builtin cd $argv[1]
	set -l cd_status $status

	if test $cd_status = 0 -a "$PWD" != "$previous"
		set -g dirprev $dirprev $previous
		set -e dirnext
		set -g __fish_cd_direction prev
	end

	if test $cd_status = 0
		ls
	end

	return $cd_status
end