zump.xys - z-like recent locations jumping

Discuss and share scripts and script files...
Post Reply
SammaySarkar
Posts: 4190
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

zump.xys - z-like recent locations jumping

Post by SammaySarkar » 18 Jun 2019 13:10

a simple approximation of github:rupa/z for XYplorer. Navigates to most recent location matching given patterns.
in short, type @z foo bar and jump to most-recent location with "foo" and "bar" in path.

Installation
zump runs as an alias. Enter this in the addressbar to define the alias:

Code: Select all

@z=::global $G_zump_pattern='<@0>'; load "<xyscripts>/_alias/zump.xys";
Don't forget to adjust the path to zump.xys as necessary.
The "z" in @z is the alias name. It may contain any character apart from "=", "/", and space. It may even be completely empty, in which case just @ calls zump.

Usage
Run from the address bar: @z [/options] pattern [pattern ...]
Run from within xyscripts: goto "@z [/options] pattern [pattern ...]";

Recognized options:
        /l: list matching dirs
        /h: include pane history in search candidates
        /r: go to last matching dir
        /n: go to nth matching dir
        /-n: go to nth-to-last matching dir


• To include pane history by default, set ::perm $P_ZUMP_APPEND_HISTORY=1;
• Patterns are always matched from left to right.
• Each single quote in pattern must be typed twice, otherwise they can summon demons.
• Nested quotes are not supported.

Examples

Code: Select all

    @z foo bar       // goto latest dir with "foo" and "bar" in path
    @z "foo bar"     // goto latest dir with exactly "foo bar" in path
    @z foo\bar       // match foo and bar at different path levels

    @z /l foo bar    // list dirs that match given pattern
    @z /r foo bar    // goto last matching dir (reverse order)
    @z /2 foo bar    // goto 2nd matching dir
    @z /-1 foo bar   // goto last matching dir
    @z /lr foo bar   // list matching dirs in reversed order
    @z /lh foo bar   // list matching dirs, history inclusive
-------------------------------------------------------------------------
Downloads
Latest release:
zump.xys
v1.2.0
(5.82 KiB) Downloaded 7 times
-------------------------------------------------------------------------
older releases:
zump.xys
v1.0.1
(5.27 KiB) Downloaded 8 times
zump.xys
v1.0.0
(5.15 KiB) Downloaded 8 times

SammaySarkar
Posts: 4190
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: zump.xys - z-like recent locations jumping

Post by SammaySarkar » 18 Jun 2019 16:24

invariably I had left two bugs in.
/n & /-n type option detection was bugged, and finding correct index from matches was off target. Fixed in 1.0.1.

SammaySarkar
Posts: 4190
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: zump.xys - z-like recent locations jumping

Post by SammaySarkar » 20 Jun 2019 09:57

v1.2.0
  • can search history in addition to recent locations. This is disabled by default. History items always come after recents.
    History means current pane's global history only.
  • fixed parsing of "\"-format patterns.
  • Removed a stray step; statement
Oh and this requires at least XYplorer v20.20.0001.

Post Reply