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

iabbr support #10

Open
quantum-booty opened this issue Sep 22, 2020 · 5 comments
Open

iabbr support #10

quantum-booty opened this issue Sep 22, 2020 · 5 comments

Comments

@quantum-booty
Copy link

quantum-booty commented Sep 22, 2020

Is it possible to add iabbr support?
For example the following commands would automatically insert a colon for def, class, if, etc...


iabbr def def:<Left>
iabbr class class:<Left>
iabbr if if:<Left>
iabbr elif elif:<Left>
iabbr while while:<Left>
iabbr for for:<Left>

iabbr else else:<CR>
iabbr try try:<CR>
iabbr except except:<CR>

@ianhi
Copy link
Owner

ianhi commented Sep 22, 2020

Hi @quantum-booty that's a good suggestion!

However, I'm not sure that the codemirror vim api will easily support this. That said, if we can figure a way to implement this that is not too involved I would love to see it be part of this library as it is very useful.

A related thing you may be interested in is: https://github.com/ryanhomer/jupyterext-text-shortcuts though looking at it it doesn't seem to have the same behavior as iabbr

handy link for future me (or someone else)

https://stackoverflow.com/questions/1988163/when-to-use-abbr-vs-map-in-vi-vim

@ianhi
Copy link
Owner

ianhi commented Sep 22, 2020

There is some prior art for abbreviations in codemirror https://github.com/emmetio/codemirror-plugin. Although looking at their implementation(https://github.com/emmetio/codemirror-plugin/blob/master/src/abbreviation.ts) I wonder if this would make more sense as a feature request to jupyterlab. The reasons for this are:

  1. This would also be useful to non-vim users
  2. probably easier to implement there
  3. may make sense to connect with the machinery behind for tab autocomplete

I also wonder if this is something that jupyterlab-lsp might be useful for

@ianhi
Copy link
Owner

ianhi commented Sep 22, 2020

I also asked about this on jupyterlab gitter: https://gitter.im/jupyterlab/jupyterlab?at=5f6a89971c5b0d210ac57892
I will update this comment if it gets any responses

@quantum-booty
Copy link
Author

Thank you so much for your work and you quick reply! I had a look at the jupyterext-text-shortcuts, but indeed its not the same. I will open an issue on jupyterlab for the feature request.

@ianhi
Copy link
Owner

ianhi commented Feb 2, 2021

related topic discussed on gitter here: https://gitter.im/jupyterlab/jupyterlab?at=601876aeaa6a6f319dfaaa18

I definitely think that jupyterlab-lsp is ultimately th ebest way forward here.

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