about summary refs log tree commit diff stats
path: root/dwm.h
diff options
context:
space:
mode:
Diffstat (limited to 'dwm.h')
0 files changed, 0 insertions, 0 deletions
 Byler <jbyler@coverity.com>  2015-06-10 16:20:09 -0700
committer  Jesse Byler <jbyler@coverity.com>  2015-06-10 16:20:09 -0700

Fix mktemp invocation to work on Mac OS X and Linux' href='/akspecs/ranger/commit/examples/bash_automatic_cd.sh?h=v1.9.3&id=864e372ce78c6e2c027bf525ea9eae1dfd0ddb0a'>864e372c ^
89b0c60b ^
796074b5 ^








1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
                                            
 







                                                                              
                                      
                                                 








                                                              
# Compatible with ranger 1.4.2 through 1.7.*
#
# Automatically change the directory in bash after closing ranger
#
# This is a bash function for .bashrc 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.

function ranger-cd {
    tempfile="$(mktemp -t tmp.XXXXXX)"
    ranger --choosedir="$tempfile" "${@:-$(pwd)}"
    test -f "$tempfile" &&
    if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
        cd -- "$(cat "$tempfile")"
    fi
    rm -f -- "$tempfile"
}

# This binds Ctrl-O to ranger-cd:
bind '"\C-o":"ranger-cd\C-m"'