rupa / z

z - jump around

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feature addition: scripts for grepping on z list and moving to one of the outputs

jerabaul29 opened this issue · comments

commented

First, many thanks for a really great tool!

I have been using a couple of small extra scripts lately, that I found to be very useful. They are quite low quality, and I am now thinking about improving their quality and seeing if they should be added to the project. For reference:

https://github.com/jerabaul29/my_bash_scripts/blob/master/zg.sh

https://github.com/jerabaul29/my_bash_scripts/blob/master/zx.sh

Basically the workflow is as visible under:

  • the grep script takes a list of words, looks for them in the z database, and prints the ordered, numbered outputs. The grepping also has color highlighting, which I find useful.

  • the execute script takes one of these numbers, and moves to the corresponding folder. I find it very convenient when there may be several possible matches.

See the illustration:

Screenshot from 2020-07-05 15-55-24

I was thinking about adding these scripts in the following ways:

  • creating a z -g that does the same as the grep script: 1) take 1 or several words, 2) use these to grep the z database with highlighting etc 3) prints the results

  • creating a z -x that takes in a number n and that does the same as the execute script, in the following way: 1) get the latest history entry 2) check that it is a z -g command 3) if it is not, issue an error message, if it is 4) re-run the command, and grab the output 5) if n > number of output lines, error, otherwise, 6) move to the n-th output.

Any commends around that? Things that could / should be done better?