[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ranger-users] ranger: bash code example in man page doesn't work
From: |
Roman Z. |
Subject: |
Re: [Ranger-users] ranger: bash code example in man page doesn't work |
Date: |
Wed, 5 Dec 2012 19:09:48 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
works for me.
Try
- open a new shell, so the function is actually available
- then start ranger with "ranger-cd"
On Wed, Dec 05, 2012 at 12:34:17PM -0500, ping wrote:
>
> I want to have range to continue exactly where I left off when
> re-run, but these code from the man page seems doesn't work.
>
> Bash: cd to last path after exit
> This is a bash function (for ~/.bashrc) to change the
> directory to the last visited one after ranger quits. You can
> always type "cd -" to go back
> to the original one.
>
> I put these into my .bashrc
>
> function ranger-cd {
> tempfile='/tmp/chosendir'
> /usr/bin/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"'
>
>
> am I missing anythinghere?
>
>