Open mcky opened 4 years ago
Never thought z
would ever be used in a script, that seems somewhat dangerous/non-deterministic.
I suppose __z_add can optionally take a directories as arguments, and use pwd otherwise, if that makes sense.
Sorry script was probably the wrong word, it's fish functions for sublime/vscode/cat'ting files etc, with z's nice autocompletion
function subz --wraps z
subl (z -e $argv[1])
end
I occasionally run into
> catz foo
[bat error]: ''foo' did not match any results': No such file or directory (os error 2)
Which I should write a failsafe for..
I see. I'm open to a PR adding:
__z_add
that when existent, gets added to the index-u
or -a
in z
as you suggested, which when set in conjunction with -e, calls _z_add
with the result before returningThe reason in conjunction is important is because the directory would otherwise be added twice, once manually, and once by the change in directory. If you don't mind the wait I could do it, but would take me a while.
I use
z -e
a lot for in scripts to go to directories I rarely cd to, so some folders which are in reality the most used, stay lower down the rankings.I'd like these directories to be updated in the Z_DATA file, possibly manually through something like
z -a $dir
. I'd manually call__z_add
in the scripts but that relies on the$pwd
.Happy to raise a PR if you think this is worth adding to the core, otherwise I can add it to my own config