Open qm1900 opened 8 years ago
syntex.gz
-file is required to jump between Sublime Text and the PDF viewer. Other files reduce the number of runs for pdflatex.From what I can tell, vim-latex uses c-j
in a manner a bit similar to Sublime's built-in snippets, which offers to ability to navigate amongst fields via the tab key. But you seem to be asking for something slightly different? (We don't bundle a lot of snippets because of how they play with STs completions, but the cwl functionality may give us some more scope to use the snippet functionality in more intelligent ways).
Creating a short-cut that moves the cursor outside of the brackets it is currently in is certainly feasible to do, but may be (somewhat) challenging to properly implement, because of the possibility of nested brackets (which we don't really handle properly most places). The cleanest way to add such functionality might be on top of the excellent BracketHighlighter plugin. But if this is what you're looking for and it seems useful enough, we might be able to make something work inside LaTeXTools itself (I'm keen to have LaTeXTools be a set of self-contained functionality).
-output-directory
and -aux-directory
built-in. In my mind this deals with the "aesthetic" issues of having those files around without actually sacrificing the reason those files exist in the first place.{
in vim, it gives you {|}<++>
(the symbol |
is for the cursor here), and after inputting you press Ctrl+J
, it changes to {xxxx}|
For nested brackets, when you type multiple brackets, it returns that {{{|}<++>}<++>}<++>
, and you can press three times Ctrl+J
to jump out every of them in order. {{{xxxx}|}<++>}<++>
-> {{{xxxx}xxxx}|}<++>
-> {{{xxxx}xxxx}xxxx}|
See, vim use <++>
to help locate
Sorry for my poor English expression which might be confusing, and I don't know much programming, but hope it be helpful.
[BracketHighlighter](https://packagecontrol.io/packages/BracketHighlighter BracketHighlighter
) seems help for this issues, I will try it.
@mqreric: Thanks for your explanation. That makes a lot of sense now. I missed the behaviour when you press {
.
I'm going to look into what may be needed to implement something like this. An imperfect but easily implemented solution would be to edit your key-bindings (Preferences | Keybindings - User) and add something like this:
{ "keys": ["{"], "command": "insert_snippet", "args": {"contents": "{$1}$2"},
"context":
[
{ "key": "selector", "operator": "equal", "operand": "text.tex.latex"},
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|$)", "match_all": true }
]
},
This overrides the default binding for {
(in LaTeX only) to insert a snippet with two fields that you can jump between using tab
(next_field
) or shift + tab
(prev_field
). So, you press {
, it will give you {|}
when you press tab, it changes to {xxxx}|
. The main issue with this is nested brackets where you need to press tab
or shift + tab
twice to move between them. (Anyone got a nifty solution to that?).
@ig0774
Just change the snippet to "contents": "{$1}$0"
to support nested snippets. However this partially disables fillall helper.
@mqreric
To use ctrl+J
as a jump command just add this to your keymap:
{
"keys": ["ctrl+shift+j"], "command": "next_field", "context":
[
{ "key": "has_next_field", "operator": "equal", "operand": true }
]
},
With BracketHighlighter you can define an Keybinding (above the other keybinding):
{
"keys": ["ctrl+shift+j"],
"command": "bh_key",
"args":
{
"no_outside_adj": null,
"no_block_mode": null,
"lines" : true,
"plugin":
{
"type": ["__all__"],
"command": "bh_modules.bracketselect",
"args": {"select": "right"}
}
},
"context":
[
{ "key": "selector", "operator": "equal", "operand": "text.tex.latex" }
]
},
With this it will jump to the inner end and then outside the bracket {{x|xx}}
->{{xxx|}}
->{{xxx}|}
->{{xxx}}|
. You could also create an issue there to support your jump :)
@ig0774 @r-stein
I try this way and it works:
With BracketHighlighter you can define an Keybinding (above the other keybinding):
{
"keys": ["ctrl+shift+j"],
"command": "bh_key",
"args":
{
"no_outside_adj": null,
"no_block_mode": null,
"lines" : true,
"plugin":
{
"type": ["__all__"],
"command": "bh_modules.bracketselect",
"args": {"select": "right"}
}
},
"context":
[
{ "key": "selector", "operator": "equal", "operand": "text.tex.latex" }
]
},
But there are still some unperfect. It works for jumping out of { }
and ( )
but not for $ $
and [ ]
and I don't understand the meaning of requesting to press twice of ctrl+shift+j
. In particular, maybe we just need press once hot key to accomplish jumping out of the brackets for LaTeX. (I think so.. )
Anyway, very thanks for the help of yours!
@mqreric If you are still interested in this. I implemented a (very small) plugin for BracketHighlighter, which does the requested jump.
bh_modules
in your User folderAdd this to your keymap:
{
"keys": ["ctrl+shift+j"],
"command": "bh_key",
"args":
{
"lines" : true,
"plugin":
{
"type": ["__all__"],
"command": "User.bh_modules.jumpright"
}
}
},
With this you will always be able to jump out of bracket. If you want to limit it to latex you can add the context as before.
PS. $
and even environments are now supported by BracketHighlighter.
(1) In the editor Vim with its plugin LaTeX suite, one is allowed to use
Ctrl+J
to universally jump out of all kinds of brackets after inputting, no matter what position of the cursor is in the brackets. Is it possible to make a similar function in LaTeXTools?(2) Could it be possible to configure to automatically remove the tmp files after compiling without pressing
Ctrl+L, Backspace
?(3) Maybe some conspicuous tags, e.g. related to the sections, could be deployed on the Minimap for fast locating.