-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Support LaTeX-to-Unicode tab expansion #21
Support LaTeX-to-Unicode tab expansion #21
Conversation
If there is a previous tab-key binding, can you call it if the LaTeX completion fails? |
" Support for LaTex-to-Unicode conversion as in the Julia REPL | ||
|
||
" (The dictionary was generated from within Julia with the following line: | ||
" println("let g:latex_symbols = {", join([string("'", latex, "': '", unicode, "'") for (latex,unicode) in Base.REPLCompletions.latex_symbols], ','), "}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the symbol table is updated in the future, this will have to be re-run. To generate smaller diffs when this happens, you might consider:
- Putting one symbol per line
- Sorting the symbols by codepoint:
for (latex,unicode) in sort!(collect(Base.REPLCompletions.latex_symbols), by=x->x[2])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorting is a good idea. As per one symbol per line, I tried and failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok this is also fixed now.
Updated. Now it works by overlaying the latex-to-unix machinery on top of any other mapping the user may have, i.e. it tries to complete latex symbols and if it fails falls back to the user mapping, as @stevengj was suggesting. |
Support LaTeX-to-Unicode tab expansion
Awesome! |
This adds support using tab to complete LaTeX symbols in ViM like in the Julia REPL.
However, in order to do so, it may need to interact with other plug-ins installed in the system.
The default (vanilla) behaviour is that upon pressing TAB a latex entry is searched for before the cursor, but if it's not found a literal TAB is inserted. I did not add any mapping to explicitly force a literal tab insertion, which however should always be available with
^V
+TAB.The substitution is assigned to the omnicompletion setting, so it's also available with
^X^O
.I'm a user of supertab and it seems everything works great with that, but perhaps other users may have custom settings which are conflicting, or get overridden etc., in which case please do let me know.
Another popular plug-in I know about is YouCompleteMe, which at the moment is incompatible with this setting, since it overrides the TAB key binding. At the moment, it seems that the options are 1) change the YCM settings to free up the TAB key for the Julia plug-in, or use
^X^O
to force the Julia omnicompletion to kick in and do the LaTeX-Unicode translation.Any user of these or other completion plug-ins, or which have remapped the tab key somehow, are encouraged to give it a try, provide suggestions etc. If there are no major problems or objections I shall merge this as is, and then it can be refined later.