ranger-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ranger-users] %D variable possible?


From: Roman Z.
Subject: Re: [Ranger-users] %D variable possible?
Date: Mon, 12 Jul 2010 19:27:06 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Mon, Jul 12, 2010 at 10:58:42AM +0530, Sitaram Chamarty wrote:
> Hi!
> 
> %d currently expands to the path of the current directory.  If you
> have 2 tabs open, could %D perhaps expand to the path of the current
> dir on the other tab?  (or the most recently visited tab, if there are
> more than two)?
> 
> Here's why I ask.  (Again, this is a frequent operation for me).
> 
> If I want to run "diff -qr" on 2 directories, I now do this:
> 
>         ranger dir1 dir2        # start ranger with 2 tabs
>         <tab>                   # go to dir2 tab
>         h                       # go to dir2's parent
>         yy                      # yank full path of dir2
>         <tab>                   # go to dir1 tab
>         #diff -qr %d %c
> 
> In mc, I used to just type in: diff -qr %d %D
> 
> I'm trying to make something like that work.  I'm not saying it has to
> be exactly the same, only that it would be nice if the steps could be
> shortened.
> 
> While you're about it, you may want to think of the equivalents for
> %f, %s, etc for other tabs.  Like maybe %<N><letter> is %<letter> in
> tab <N> perhaps?  Would be real cool!
> 
> thanks,
> 
> -- 
> Sitaram
> 

Yo Sitaram.

Are you really typing that whole line each time?
Maybe it's time for a shortcut :)

Anyway, well, it sounds reasonable to add those %<N><letter> commands.

There's just a little problem:
As you know, the tabs feature is very simple.  Its a dictionary of
strings, {1: "/home/hut", 2: "/usr/bin", ..} which saves the paths of your
tabs, and a pointer to the current tab.  The "current file" and
"selected files" are saved in the directory, not the tab.

This means: Two tabs with the same path have the same %s and %f.
You gonna have to live with that. =P

About %D....  It's ambiguous.  I personally would give it the meaning
"the path of the tab to the right, wrapping around when hitting the end."
I've been playing around with the idea in my head to add an optional
extra column at the right which shows the content of this %D.  One could
then turn off previews and set column_ratios to (1, 0) to replicate the
look of mc.
%D = "The path of the most recently visited tab" might me more convenient
when you got many tabs and you work on tabs 3 and 8, making %D useless.
Then again, you can use %8d or %3d.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]