jwkvam / jupyterlab-vim

:neckbeard: Vim notebook cell bindings for JupyterLab
MIT License
973 stars 73 forks source link

Search across cells? #26

Open penndsg opened 6 years ago

benlindsay commented 6 years ago

(Sorry, I was signed in as the wrong user above...not sure how to delete that empty post...)

First of all, thanks for this excellent plugin! This made it possible for me to switch to Jupyter Lab.

Now I know the [original vim bindings] plugin for jupyter notebook didn't have this feature, but it would be great to have in the future if possible. I'd like to be able to search for terms with / and not have it limited to a single cell. I'm envisioning something like CTRL-O / from within vim normal mode in a cell or just typing / from Jupyter mode and being able to use n to iterate over the matches in all cells. Ideally a black command box would pop up at the bottom of the screen, unattached to any individual cells, but if the box had to be part of whatever cell you're currently selecting, that would be cool too.

I guess this concept could apply to some other kinds of commands (:%s/oldterm/newterm/g, ?backwardsearchterm etc) but just a simple search would be a great starting point.

Again, I know there are a lot of other functionalities that are higher priority to this one, and this plugin is great without it, but it would be fantastic if this could be done in the future.

jwkvam commented 6 years ago

Thanks for the suggestion! I was just planning on waiting until the jlab devs release some "find and replace" function, but I can see this being very powerful and useful. The tricky part I see here is somehow federating all the cells, then we could get all the searching and replacing for free with codemirror. If that's even the correct path hmm.

@ian-r-rose Sorry to bug you. Would you have any ideas on how feasible this might be or a solution sketch?

ian-r-rose commented 6 years ago

It might be possible, I am not really sure. Does the vim-mode provide any programmatic access to the find-and-replace functionality? If so, you could try to intercept those commands and apply them to all the cell editors (which can be accessed through tracker.currentWidget.notebook.widgets.editor). You certainly know much more about the vim emulation than I do though :smile:

jwkvam commented 6 years ago

Hmm, interesting idea, I don't know but I will investigate :)

ian-r-rose commented 6 years ago

This function applies things like line numbering and word wrap to all cells. The find-and-replace action is rather more complex, though.

ian-r-rose commented 6 years ago

And I would add that we are generally interested in having notebook-wide find-and-replace in the core (as you noted above). If you happen to make any progress here, we would likely be interested in working out how to make it work independent of vim-mode as well.

daliagachc commented 5 years ago

any progress on this? it seems like a great feature. BTW, thanks for the awesome plugin

joelostblom commented 5 years ago

This has been released in jupyterlab 1.0, so I think this issue can be closed.

dacaldar commented 5 years ago

I'm new here - thanks so much for the extension. I am also interested in this feature, but while the above comment says it's released, I'm using jupyterlab 1.0 and I am not finding I can use '/' nor 'CTRL-O /' to search outside of the current cell.

Is there some other jupyterlab-vim way (not counting CTRL-F, which has problems, IMHO) that I missed?

I also noticed that / seems to be doing case-insensitive searching, and wondered if there's a way to toggle that, but didn't know if I should start a new "issue" to ask about it. Advice welcome.