about summary refs log blame commit diff stats
path: root/examples/bash_automatic_cd.sh
blob: 04b58e24ad22aa1f33aebb2fad1678c40bcba760 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                            
 







                                                                              
                                      
                                                 








                                                              
# 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"'
or: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
[colours]
bkgnd=default
titlebar=blue
titlebar.text=bold_white
titlebar.brackets=bold_white
titlebar.unencrypted=bold_red
titlebar.encrypted=bold_white
titlebar.untrusted=bold_yellow
titlebar.trusted=bold_white
titlebar.online=bold_green
titlebar.offline=bold_red
titlebar.away=bold_cyan
titlebar.xa=bold_cyan
titlebar.dnd=bold_red
titlebar.chat=bold_green
statusbar=blue
statusbar.text=bold_white
statusbar.time=bold_white
statusbar.brackets=bold_white
statusbar.active=bold_cyan
statusbar.new=bold_white
main.text=white
main.text.me=cyan
main.text.them=bold_white
main.splash=bold_red
main.help.header=bold_white
main.time=yellow
input.text=bold_green
subscribed=green
unsubscribed=red
otr.started.trusted=green
otr.started.untrusted=yellow
otr.ended=red
otr.trusted=green
otr.untrusted=yellow
online=green
away=cyan
chat=white
dnd=magenta
xa=blue
offline=red
incoming=bold_yellow
mention=bold_cyan
trigger=bold_blue
typing=yellow
gone=red
error=red
roominfo=yellow
roommention=bold_white
roommention.term=bold_cyan
roomtrigger=bold_white
roomtrigger.term=bold_blue
me=blue
them=bold_green
roster.header=bold_yellow
roster.chat=white
roster.online=green
roster.away=cyan
roster.xa=blue
roster.dnd=magenta
roster.offline=red
roster.chat.active=white
roster.online.active=green
roster.away.active=cyan
roster.xa.active=blue
roster.dnd.active=magenta
roster.offline.active=red
roster.chat.unread=bold_white
roster.online.unread=bold_green
roster.away.unread=bold_cyan
roster.xa.unread=bold_blue
roster.dnd.unread=bold_magenta
roster.offline.unread=bold_red
roster.room=green
roster.room.unread=bold_green
roster.room.mention=bold_cyan
roster.room.trigger=bold_blue
occupants.header=bold_yellow
receipt.sent=bold_black

[ui]
beep=false
flash=false
splash=true
wrap=true
time.console=%H:%M:%S
time.chat=%H:%M:%S
time.muc=%H:%M:%S
time.config=off
time.private=%H:%M:%S
time.xmlconsole=off
time.statusbar=%H:%M:%S
time.lastactivity=%d/%m/%y %H:%M:%S
privileges=true
presence=true
intype=true
enc.warn=true
resource.title=true
resource.message=true
statuses.console=none
statuses.chat=none
statuses.muc=none
roster=true
roster.offline=false
roster.empty=false
roster.by=group
roster.order=presence
roster.unread=after
roster.priority=false
roster.size=30
roster.wrap=true
roster.header.char=@
roster.contact.indent=1
roster.resource=true
roster.resource.char=/
roster.resource.indent=1
roster.resource.join=true
roster.presence=true
roster.presence.indent=-1
roster.status=true
roster.contacts=true
roster.unsubscribed=true
roster.rooms=true
roster.rooms.order=name
roster.rooms.unread=after
roster.rooms.pos=last
roster.rooms.by=none
roster.rooms.private.char=/
roster.private=room
roster.count=unread
roster.count.zero=false
occupants=true
occupants.size=15
occupants.jid=false
wins.autotidy=true
otr.char=@
pgp.char=%
omemo.char=*
tls.show=true
console.muc=first
console.chat=all
console.private=all
titlebar.position=1
mainwin.position=2
statusbar.position=3
inputwin.position=4