summaryrefslogtreecommitdiff
path: root/functions/cd.fish
diff options
context:
space:
mode:
Diffstat (limited to 'functions/cd.fish')
-rw-r--r--functions/cd.fish10
1 files changed, 10 insertions, 0 deletions
diff --git a/functions/cd.fish b/functions/cd.fish
new file mode 100644
index 0000000..53b8d45
--- /dev/null
+++ b/functions/cd.fish
@@ -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