-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: document abbreviations #3023
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
Conversation
Rather than special files, can we make this static and a part of the current toml config? In the future this can be more scriptable then |
I think we could have both ! I could add editor-wide abbreviations sourced from the configuration file, but I'd like to keep the ability to load from file because sometimes you have abbreviations specific to one document but don't want them all the time, you just want to reload them until you finish the document and then get rid of them. |
How does this relate to #2852 ? They seem to be the same thing with sightly different angles of attack to me. Also wondering how both intersect with the idea of snippets. |
This was not made with #2852 in mind at all, but I guess people could use abbreviations to be able to insert digraphs. I'm French, so I wouldn't be able to help a lot with that as I don't really know how one uses digraphs. Snippets are different, they're closer to the LSP aspect of the editor and they are not something one can define "on-the-fly", unlike abbreviations. I've implemented static abbreviations in the TOML config file, which are available editor-wide. |
0ef99d4
to
97f2996
Compare
97f2996
to
2ed7327
Compare
I just rebased this on the current master. Been using it since July without any issue, would someone care to review ? |
2ed7327
to
9216223
Compare
Rebased on master. |
9216223
to
10c91cc
Compare
Rebased and resolved conflicts. Any hope for a review ? |
989825c
to
abee7d7
Compare
Rebased on master. |
abee7d7
to
857a329
Compare
Rebased on master. |
Following a discussion on Matrix with @pascalkuthe, we came to the conclusion that abbreviations should be implemented as special snippets that trigger instantaneously. It would also require to implement a command to define them on-the-fly. Closing. |
This feature introduces four new typed commands to handle vim-like abbreviations:
insert-abbreviation
(aliasabbr
): adds a new abbreviation, or overwrites an existing one (with completion, local to current document only)delete-abbreviation
(aliasrabbr
): removes an abbreviation (with completion)load-abbreviations-from-file
(aliaslabbr
): loads abbreviations from a file. Each line is an abbreviation, for instance:write-abbreviations-to-file
(aliaswabbr
): writes to file with the same format as aboveI have tested and solved edge cases (beginning of the file, of a line, etc), but would be happy to have someone test this.
Closes #1471.