Skip to content

Instantly share code, notes, and snippets.

@jaseg
Created April 9, 2016 17:02
Show Gist options
  • Select an option

  • Save jaseg/880d09480f5b4abea69381c89a65e8ce to your computer and use it in GitHub Desktop.

Select an option

Save jaseg/880d09480f5b4abea69381c89a65e8ce to your computer and use it in GitHub Desktop.

Revisions

  1. jaseg created this gist Apr 9, 2016.
    10 changes: 10 additions & 0 deletions cd.fish
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    # 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