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: Sat, 17 Jul 2010 03:15:00 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Tue, Jul 13, 2010 at 05:50:00AM +0530, Sitaram Chamarty wrote:
> On Mon, Jul 12, 2010 at 10:57 PM, Roman Z. <address@hidden> wrote:
> > 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 :)
> 
> well I just used diff -qr as an example.  In practice I have a few
> other commands that do directory comparisions and merges.  I sometimes
> use kdiff3, or unison, or some home-grown scripts that deal much
> better with renames/moves, etc... :-)
> >
> > 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
> 
> Aaha!  When I have a tab on foo and one on foo/bar, and I copy foo/baz
> by yy/dd and switch to tab 2 and pp it into foo/bar, when I come back
> to foo the cursor has moved to bar instead of staying where it was.  I
> suspect this is caused by the same thing?
> 
> > 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."
> 
> perfect... (actually anything at all that gives me the path of any
> other tab is fine for me; I only ever need two so even if I have
> multiple tabs open I can manage)
> 
> > 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.
> 
> please make it optional... mc's look is right boring compared to ranger!
> 
> > %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.
> 
> Thanks for looking into it!  Whatever way you can do it is fine by me.

So, I'm getting around to implement it after all.

Here's the commit, including documentation at the bottom:
http://git.savannah.gnu.org/cgit/ranger.git/commit/?id=f54adde9099f08a8e15d8003a6a2cdf275593e4d




reply via email to

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