LaTeXTools
LaTeXTools copied to clipboard
Using tab to autocomplete while in an environment exits the environment
Example:
![]()
It would seem more intuitive to only use tab to exit the environment when there is nothing to autocomplete (in this case three tabs would be required, one to autocomplete the enumerate environment, one to exit the enumerate environment and a last to exit the document environment.)
Actually it should be like this and this is about the precedence of the tab key in different situation. By default commit_completion has a higher one than next_field. You may check your keybindings for bindings with the tab key.
If you don't find anything you may add this kbd to your user keybindings:
{ "keys": ["tab"], "command": "commit_completion", "context":
[
{ "key": "auto_complete_visible" },
{ "key": "setting.auto_complete_commit_on_tab" }
]
},
I have the same problem. The kbd above can be found in the default keybindings. It does not help. Can you help me?
Did you copy it to your user key bindings?
Yes, of course. But it does not work.
I think, the next problem is the same. I usually write \alpha by a+tab. If I write first a math environment, say $$+tab, then it appears [ "cursor" ] then I add a+tab and the cursor jumps outside of the environment and \alpha does not appear. I get the following:: [ a ]"cursor"
The same problem appears if in the LateXYZ package I set "auto_create_fields": true.
Thank you for your help.
Richard Stein [email protected] ezt írta (időpont: 2018. jan. 28., V, 10:35):
Did you copy it to your user key bindings?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SublimeText/LaTeXTools/issues/1261#issuecomment-361049890, or mute the thread https://github.com/notifications/unsubscribe-auth/AiNktMjMKGk-hHZLQ1GzDKwoSnvzSH3Jks5tPD9UgaJpZM4QjSR8 .
When you press tab Sublime Text searches for the a tab-keybinding with the matching context and executes the corresponding command. If the kbd usually works and something else is executes instead for certain situations your tab kbd has a lower precedence, so you should try to move it to the bottom of the user keybinding file, because it has the highest precendence there (maybe you have a different tab keybinding in your user keybinding file).
I am sorry, this is a new and original installation, I used the definition of a+tab given in "Sublime Text 3\Packages\LaTeXTools\LaTeX math.sublime-completions" and the one $$+tab (or another environment) given also in latextools. I did not give any user kbd except the one you suggested. And it does not work.
Richard Stein [email protected] ezt írta (időpont: 2018. jan. 28., V, 17:28):
When you press tab Sublime Text searches for the a tab-keybinding with the matching context and executes the corresponding command. If the kbd usually works and something else is executes instead for certain situations your tab kbd has a lower precedence, so you should try to move it to the bottom of the user keybinding file, because it has the highest precendence there (maybe you have a different tab keybinding in your user keybinding file).
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SublimeText/LaTeXTools/issues/1261#issuecomment-361075404, or mute the thread https://github.com/notifications/unsubscribe-auth/AiNktKBevnrO5MgG2SSwPuhKXmbnim-Nks5tPKAwgaJpZM4QjSR8 .
Yeah snippets are slighty different, because you trigger them without the auto-complete popup open. The default behavior of ST is to insert the best completion (i.e. insert the snippet) if no other tab option is possible, but you haven't a context to check whether a snippet expansion is possible or not. Hence you can't overwrite the tab keybinding for those cases. Not sure how to fix that cases. You may try to press ctrl+space before and select the snippet or add a different keybinding for snippet expansion.
How can I add a different keybinding (say "escape"?) for snippet expansion?
Richard Stein [email protected] ezt írta (időpont: 2018. jan. 28., V, 18:01):
Yeah snippets are slighty different, because you trigger them without the auto-complete popup open. The default behavior of ST is to insert the best completion (i.e. insert the snippet) if no other tab option is possible, but you haven't a context to check whether a snippet expansion is possible or not. Hence you can't overwrite the tab keybinding for those cases. Not sure how to fix that cases. You may try to press ctrl+space before and select the snippet or add a different keybinding for snippet expansion.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SublimeText/LaTeXTools/issues/1261#issuecomment-361077913, or mute the thread https://github.com/notifications/unsubscribe-auth/AiNktATkUbXi5n1NdTYfCYB7yNKThGKDks5tPKfxgaJpZM4QjSR8 .
You can add this keybinding to expand on alt+e (expanding on escape, enter, ... also overwrites a lot of other behaviors as tab does):
{ "keys": ["alt+e"], "command": "insert_best_completion", "args": {"default": "\t", "exact": false} },
Thank you. Can I define the keybindings in the other way? Can I use tab for the snippets and say alt+e for jumping outside the environment?
Richard Stein [email protected] ezt írta (időpont: 2018. jan. 28., V, 22:19):
You can add this keybinding to expand on alt+e (expanding on escape, enter, ... also overwrites a lot of other behaviors as tab does):
{ "keys": ["alt+e"], "command": "insert_best_completion", "args": {"default": "\t", "exact": false} },— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SublimeText/LaTeXTools/issues/1261#issuecomment-361096909, or mute the thread https://github.com/notifications/unsubscribe-auth/AiNktCBHItCm4GmqKuva1Yynll3JUTLzks5tPORLgaJpZM4QjSR8 .
tab has a lot of behaviors. If you really want to have that behavior with tab I suggest to open Preferences > Keybindings and copy all keybinding with the key "tab" (they are all at the same position) to your user keybinding. Then you can remove the one, which executes the command next_field and add an other keybinding for that.
Be aware that this can have unwanted side effects if other packages try to overwrite the tab key to add their behavior
I.e. copy this to your user keybindings:
{ "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": true} },
{ "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": false},
"context":
[
{ "key": "setting.tab_completion", "operator": "equal", "operand": true },
{ "key": "preceding_text", "operator": "not_regex_match", "operand": ".*\\b[0-9]+$", "match_all": true },
]
},
{ "keys": ["tab"], "command": "replace_completion_with_next_completion", "context":
[
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
{ "key": "setting.tab_completion", "operator": "equal", "operand": true }
]
},
{ "keys": ["tab"], "command": "reindent", "context":
[
{ "key": "setting.auto_indent", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_match", "operand": "^$", "match_all": true },
{ "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true }
]
},
{ "keys": ["tab"], "command": "indent", "context":
[
{ "key": "text", "operator": "regex_contains", "operand": "\n" }
]
},
{ "keys": ["tab"], "command": "commit_completion", "context":
[
{ "key": "auto_complete_visible" },
{ "key": "setting.auto_complete_commit_on_tab" }
]
},
{ "keys": ["alt+e"], "command": "next_field", "context":
[
{ "key": "has_next_field", "operator": "equal", "operand": true }
]
},
Thank you very much. It works. I changed "alt+e" by "f1". This could be the solution.
Richard Stein [email protected] ezt írta (időpont: 2018. jan. 29., H, 17:03):
tab has a lot of behaviors. If you really want to have that behavior with tab I suggest to open Preferences > Keybindings and copy all keybinding with the key "tab" (they are all at the same position) to your user keybinding. Then you can remove the one, which executes the command next_field and add an other keybinding for that.
Be aware that this can have unwanted side effects if other packages try to overwrite the tab key to add their behavior
I.e. copy this to your user keybindings:
{ "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": true} }, { "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": false}, "context": [ { "key": "setting.tab_completion", "operator": "equal", "operand": true }, { "key": "preceding_text", "operator": "not_regex_match", "operand": ".*\\b[0-9]+$", "match_all": true }, ] }, { "keys": ["tab"], "command": "replace_completion_with_next_completion", "context": [ { "key": "last_command", "operator": "equal", "operand": "insert_best_completion" }, { "key": "setting.tab_completion", "operator": "equal", "operand": true } ] }, { "keys": ["tab"], "command": "reindent", "context": [ { "key": "setting.auto_indent", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_match", "operand": "^$", "match_all": true }, { "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true } ] }, { "keys": ["tab"], "command": "indent", "context": [ { "key": "text", "operator": "regex_contains", "operand": "\n" } ] }, { "keys": ["tab"], "command": "commit_completion", "context": [ { "key": "auto_complete_visible" }, { "key": "setting.auto_complete_commit_on_tab" } ] }, { "keys": ["alt+e"], "command": "next_field", "context": [ { "key": "has_next_field", "operator": "equal", "operand": true } ] },— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SublimeText/LaTeXTools/issues/1261#issuecomment-361293031, or mute the thread https://github.com/notifications/unsubscribe-auth/AiNktFqn2UXIBXwFSAScPwWmMcQafdyJks5tPeu1gaJpZM4QjSR8 .
Dear Richard, Are you still working on latextools? Best regards, Ferenc
Dr. Ferenc Weisz @.***> ezt írta (időpont: 2018. jan. 29., H, 17:39):
Thank you very much. It works. I changed "alt+e" by "f1". This could be the solution.
Richard Stein @.***> ezt írta (időpont: 2018. jan. 29., H, 17:03):
tab has a lot of behaviors. If you really want to have that behavior with tab I suggest to open Preferences > Keybindings and copy all keybinding with the key "tab" (they are all at the same position) to your user keybinding. Then you can remove the one, which executes the command next_field and add an other keybinding for that.
Be aware that this can have unwanted side effects if other packages try to overwrite the tab key to add their behavior
I.e. copy this to your user keybindings:
{ "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": true} }, { "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": false}, "context": [ { "key": "setting.tab_completion", "operator": "equal", "operand": true }, { "key": "preceding_text", "operator": "not_regex_match", "operand": ".*\\b[0-9]+$", "match_all": true }, ] }, { "keys": ["tab"], "command": "replace_completion_with_next_completion", "context": [ { "key": "last_command", "operator": "equal", "operand": "insert_best_completion" }, { "key": "setting.tab_completion", "operator": "equal", "operand": true } ] }, { "keys": ["tab"], "command": "reindent", "context": [ { "key": "setting.auto_indent", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_match", "operand": "^$", "match_all": true }, { "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true } ] }, { "keys": ["tab"], "command": "indent", "context": [ { "key": "text", "operator": "regex_contains", "operand": "\n" } ] }, { "keys": ["tab"], "command": "commit_completion", "context": [ { "key": "auto_complete_visible" }, { "key": "setting.auto_complete_commit_on_tab" } ] }, { "keys": ["alt+e"], "command": "next_field", "context": [ { "key": "has_next_field", "operator": "equal", "operand": true } ] },— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SublimeText/LaTeXTools/issues/1261#issuecomment-361293031, or mute the thread https://github.com/notifications/unsubscribe-auth/AiNktFqn2UXIBXwFSAScPwWmMcQafdyJks5tPeu1gaJpZM4QjSR8 .