about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMathis Chenuet <artdevelopp@hotmail.fr>2019-11-08 02:12:12 +0800
committerGitHub <noreply@github.com>2019-11-08 02:12:12 +0800
commit0e6f244e7ef3ea34e106ab877fe86056b6f7eb52 (patch)
tree2ae827810373fb5c286ef770c5d4e5fb3a1066a5
parent885b7a7f993bfe05011889fa5410d07ae4f77a00 (diff)
downloadranger-0e6f244e7ef3ea34e106ab877fe86056b6f7eb52.tar.gz
use function, cleanup file, proper repaint
-rw-r--r--examples/fish_automatic_cd.fish10
1 files changed, 8 insertions, 2 deletions
diff --git a/examples/fish_automatic_cd.fish b/examples/fish_automatic_cd.fish
index 5e859463..d097ddd1 100644
--- a/examples/fish_automatic_cd.fish
+++ b/examples/fish_automatic_cd.fish
@@ -8,8 +8,14 @@
 # Note: funcsave save the alias in fish's config files, you do not need to copy
 # this file anywhere, just execute it once
 
-alias ranger-cd 'ranger --choosedir=$HOME/.rangerdir; set RANGERDIR (cat $HOME/.rangerdir); cd $RANGERDIR'
+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 ; fish_prompt'
+bind \co ranger-cd