I’m trying to put one of my unix intro lessons into a jupyter notebook. I’m using a bash kernel, but one things i’ve hit is that when i try to use tab-completion, it does show the files and directories of the current working directory, but it also shows other things that are unrelated, e.g. in the attached image, I want only what’s tab-completed-suggested from bash (which here should just be “experiment”, but the others show up.
Is there a way i can disable these auto-completion suggestions? Ideally in a way that’s attached to the notebook, like in Notebook Metadata or Cell Metadata?
Thanks for any help!
So this is an IPython issue as IPython is responsible for providing completions. I am not sure if we should support this for
ls but spelling it out like
%ls should probably suppress suggestions other than file names. Recent completer refactor enables us to do exactly that but I think no one suggested it before. Would you mind opening an issue in IPython repository?
Thanks, @krassowski! Just wanted to double-check as the IPython issue template specifically states that’s for IPython command-line, and requests not posting things that should go to a different place, haha. Unless, maybe i should post an issue to IPython kernel for jupyter?
Also, it’s not just
ls, because i’d want it to work for anything you would do at a unix-like command line. It doesn’t seem like there might be a path to just block them entirely through the jupyter side of things when using a bash kernel instead of a python kernel?
(I know these notebooks, so far at least, aren’t built to be a perfect unix-like command line environment. I typically do command line intros just at a terminal, but i’m being gently prodded to try to build them into notebooks and I’m trying to iron out how smoothly that might be able to workout. I’d like to still do things in a manner that is as close to what being at just a terminal would be like, which is why i’m trying with a bask kernel and wanted to avoid this like the magic % invocations. And tab-completion is one of the most exciting selling points to new-comers to the command-line, I’d hate to not be able to show how clean and helpful it is, ha)
Ah, you are using Bash kernel. Sorry I missed this, because it works the same way in IPython.
I was mistaken on this. I incorrectly assumed these were python-related suggestions, but they are possible full bash commands being found. The confusing part for me was commands/programs showing up as possible completions when not being the first argument. So the issue seems to be with how the bash kernel is attempting to build possible auto-completions, and there is some work on this happening here: More thoughtful completion by kdm9 · Pull Request #126 · takluyver/bash_kernel · GitHub