autojump icon indicating copy to clipboard operation
autojump copied to clipboard

Idea: autocomplete for jc, jo, jco

Open grota opened this issue 12 years ago • 12 comments

Here's an idea for a new feature: autocomplete functions for jc jo and jco. The one for jo should be the same already existing for j. I can give it a go in my spare time if you want. IMHO, from an usability point of view, I don't think I would even use autojump without an autocomplete function, so I think that an autocomplete for those 3 functions would be very very useful, even a "must have".

grota avatar Feb 14 '13 22:02 grota

Sounds like a good idea.

wting avatar May 14 '13 15:05 wting

autocomplete for jo seems to be a one liner (same as the one for j) while autocomplete for jc and jco seems to require changes to the script itself, which I am not able to do (I don't know python). Any thoughts?

grota avatar May 16 '13 16:05 grota

ping

grota avatar Sep 01 '13 09:09 grota

Off the top of my head I'm not sure how autocomplete for jc and jco would work. Say you had a directory /foo/bar/baz and typed in jc fo ba. How would you know which element to autocomplete?

wting avatar Sep 01 '13 15:09 wting

I might be saying something stupid here because I haven't been using jc for a long time (due in fact to the lack of autocompletion), so if that's the case, apologies in advance.

I'm assuming that in this case the pwd is / and we are issuing jc fo ba, right? I think the answer to your question would be "both if both dirs are in the database, and ordered depending on their weight"

grota avatar Sep 01 '13 16:09 grota

Just a follow up, this isn't a bad idea but to be honest it's a lot of work. If you or someone else decides to implement this I'd be more than happy to merge the pull request.

wting avatar Mar 10 '14 03:03 wting

For jc and jco I'll try to figure out if filtering the output of autojump --complete $PWD is feasible (using only shell scripting). I guess I'll end up with holes in the list numbering but it's better than nothing I guess

grota avatar Mar 10 '14 09:03 grota

Ok, so I've transformed this issue in a pull request. I've asked and it seems like the use case we outlined above is not possible (in bash). I'm not 100% satisfied with the current code but I don't know python so I don't feel comfortable digging further.

grota avatar Mar 10 '14 15:03 grota

I've added another commit where I use aliases for jc and jco. Not sure if this is the correct approach, it needs another set of eyes.

grota avatar Mar 10 '14 15:03 grota

Not sure if this is the correct approach, it needs another set of eyes.

This does not make sense, since e.g. jc foo is supposed to limit the queries to subdirectories, which is not given anymore then.

Regarding your question on SO: you do not need to replace what's on the user's command line, do you? You only need to change the command used for getting completions.

FWIW, i would be more interested in zsh completion for it.. ;)

blueyed avatar Jun 23 '14 19:06 blueyed

i love this ieda, and now i implement it partly. now jc can only check child directories, jco also works. i add this feature for bash and zsh, as i only know this two shell. under zsh, it seems work good.

now i want add auto completion feature for jc under ZSH, but i can't find how to deal it? who can give some tips? Thanks!

liuyang1 avatar Aug 24 '14 10:08 liuyang1

I add compdef jo=j into the end of .zshrc. It works for me.

dcy10000 avatar Nov 10 '22 05:11 dcy10000