Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request - add a directory without cding #84

Open
mcky opened this issue Jan 16, 2020 · 3 comments
Open

Feature request - add a directory without cding #84

mcky opened this issue Jan 16, 2020 · 3 comments

Comments

@mcky
Copy link

mcky commented Jan 16, 2020

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

@jethrokuan
Copy link
Owner

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.

@mcky
Copy link
Author

mcky commented Jan 16, 2020

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..

@jethrokuan
Copy link
Owner

jethrokuan commented Jan 17, 2020

I see. I'm open to a PR adding:

  1. Optional arguments to __z_add that when existent, gets added to the index
  2. A flag -u or -a in z as you suggested, which when set in conjunction with -e, calls _z_add with the result before returning

The 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants