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
Implements feature requested in #1043 #1048
Conversation
Adds a command to wrap the selected text in a simple LaTeX command and automatically expands no selection to the current word. This also changes the keybindings from using snippets to using the command for emph, bold, etc. Additionally, I suppose, this makes new keybindings for new similar commands pretty trivial to implement. I've left the snippets in place so they can be used if desired, but obviously they do not have the same word-grabbing rules.
I think this is a little bit to greedy in selecting words and we should insert a snippet if the selection is empty to easy jump-out of it. |
The greediness (i.e., selecting the word immediately after or immediately before the cursor) is quite intentional. That was part of the initial request. On the snippet thing: I'm not exactly sure I see inserting, e.g., |
This does not only select words, but also other characters, e.g. if you have
The snippets usually only have a few words/one sentence, so I personally just press it, write the content, and press tab to go further. |
That's a good point and a limitation of the
Good point. I think I was thinking broadly in terms of getting this working across multiple selections, which is hard to do with snippets, where the selections might vary from one another. The common case, though, is probably just a single cursor and that could be optimised to use a snippet, I suppose. |
@r-stein: 1acf8ab implements what I mentioned above. I'd be grateful if you could take a look. |
I would use the expand feature very conservative, because you always can just manually expand it before triggering, but not the other way.
|
Adds a command to wrap the selected text in a simple LaTeX command and automatically expands no selection to the current word. This also changes the keybindings from using snippets to using the command for emph, bold, etc. Additionally, I suppose, this makes new keybindings for new similar commands pretty trivial to implement. I've left the snippets in place so they can be used if desired, but obviously they do not have the same word-grabbing rules.