Skip to content

Instantly share code, notes, and snippets.

@jaseg
Created April 9, 2016 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaseg/880d09480f5b4abea69381c89a65e8ce to your computer and use it in GitHub Desktop.
Save jaseg/880d09480f5b4abea69381c89a65e8ce to your computer and use it in GitHub Desktop.
# Modified cd that also displays the directory's contents if the listing is less than 5 lines long
function cd
if test -n "$argv"
if test -e $argv -a ! -d (realpath $argv)
set argv (dirname $argv)
end
end
builtin cd $argv
and test (ls -C -w $COLUMNS |wc -l) -le 5; and ls
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment