summary refs log tree commit diff stats
path: root/examples
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2019-12-20 01:10:06 +0100
committertoonn <toonn@toonn.io>2019-12-20 01:10:06 +0100
commit300309fe6728922daf85ba2ef15bff91cf32044f (patch)
tree26ad8acd0bc99c61486a4dd947c5c96bb088331a /examples
parent0de267984a656b65317d3214a87d55449a162738 (diff)
parent0e6f244e7ef3ea34e106ab877fe86056b6f7eb52 (diff)
downloadranger-300309fe6728922daf85ba2ef15bff91cf32044f.tar.gz
Merge branch 'artemisart-patch-1'
Diffstat (limited to 'examples')
-rw-r--r--examples/fish_automatic_cd.fish21
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/fish_automatic_cd.fish b/examples/fish_automatic_cd.fish
new file mode 100644
index 00000000..d097ddd1
--- /dev/null
+++ b/examples/fish_automatic_cd.fish
@@ -0,0 +1,21 @@
+# Automatically change the directory in fish after closing ranger
+#
+# This is a fish alias to automatically change the directory to the last visited
+# one after ranger quits.
+# To undo the effect of this function, you can type "cd -" to return to the
+# original directory.
+#
+# Note: funcsave save the alias in fish's config files, you do not need to copy
+# this file anywhere, just execute it once
+
+function ranger-cd
+    set dir (mktemp -t ranger_cd.XXX)
+    ranger --choosedir=$dir
+    cd (cat $dir) $argv
+    rm $dir
+    commandline -f repaint
+end
+funcsave ranger-cd
+
+# To bind Ctrl-O to ranger-cd, save this in `~/.config/fish/config.fish`:
+bind \co ranger-cd