jupyterlab-vimrc
jupyterlab-vimrc copied to clipboard
iabbr support
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>
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
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:
- This would also be useful to non-vim users
- probably easier to implement there
- 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
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
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.
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.