aboutsummaryrefslogtreecommitdiffhomepage
path: root/init/functions/__fish_list_current_token.fish
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-02-12 23:14:21 +1000
committerGravatar axel <axel@liljencrantz.se>2006-02-12 23:14:21 +1000
commita2cd8c8a8dfc8b3acc208bb1113260cb69ca03d1 (patch)
treebe40070e50d31cfb1b0d380c48841a94a9597558 /init/functions/__fish_list_current_token.fish
parent3b03bd6a109c9e69582c00c4fdb5d0383769d0ad (diff)
Move a few more shellscript functions to their own files
darcs-hash:20060212131421-ac50b-861f8941af76cf9a1e6fb7da2ac7f33795fab272.gz
Diffstat (limited to 'init/functions/__fish_list_current_token.fish')
-rw-r--r--init/functions/__fish_list_current_token.fish20
1 files changed, 20 insertions, 0 deletions
diff --git a/init/functions/__fish_list_current_token.fish b/init/functions/__fish_list_current_token.fish
new file mode 100644
index 00000000..b31aac40
--- /dev/null
+++ b/init/functions/__fish_list_current_token.fish
@@ -0,0 +1,20 @@
+
+#
+# This function is bound to Alt-L, it is used to list the contents of
+# the directory under the cursor
+#
+
+function __fish_list_current_token -d "List contents of token under the cursor if it is a directory, otherwise list the contents of the current directory"
+ set val (eval echo (commandline -t))
+ if test -d $val
+ ls $val
+ else
+ set dir (dirname $val)
+ if test $dir != . -a -d $dir
+ ls $dir
+ else
+ ls
+ end
+ end
+end
+