@@ -16,14 +16,24 @@ LaTeX Package keymap for Linux
1616 "command" : " latextools_build_selector" ,
1717 "args" : {"select" : true }},
1818
19+ {
20+ "keys" : [" ctrl+v" ],
21+ "command" : " latextools_smart_paste" ,
22+ "context" :
23+ [
24+ { "key" : " selector" , "operand" : " text.tex.latex" },
25+ { "key" : " latextools.setting.enable_smart_paste" },
26+ ],
27+ },
28+
1929 // New-style keybindings use "ctrl+l" as a prefix
2030 // This overrides "extend selection to line", which is remapped to
2131 // "ctrl+l","ctrl+l" [?]
2232 // However, keybindings are scoped to the text.tex.latex selector, so they do not
2333 // pollute the standard bindings
2434
2535 // Reassign expand_selection to ctrl+l, ctrl+l
26- { "keys" : [" ctrl+l" ," ctrl+l" ],
36+ { "keys" : [" ctrl+l" ," ctrl+l" ],
2737 "context" : [
2838 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
2939 "command" : " expand_selection" , "args" : {"to" : " line" } },
@@ -40,15 +50,15 @@ LaTeX Package keymap for Linux
4050 },
4151
4252 // Insert latex command or environment, and close current environment
43- { "keys" : [" ctrl+l" ," c" ],
53+ { "keys" : [" ctrl+l" ," c" ],
4454 "context" : [
4555 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
4656 "command" : " latexcmd" },
4757 { "keys" : [" ctrl+l" ," e" ],
4858 "context" : [
4959 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
5060 "command" : " latexenv" },
51- { "keys" : [" ctrl+l" ," ." ],
61+ { "keys" : [" ctrl+l" ," ." ],
5262 "context" : [
5363 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
5464 "command" : " latex_env_closer" },
@@ -67,11 +77,11 @@ LaTeX Package keymap for Linux
6777 "command" : " latex_fill_all" , "args" : {"completion_type" : [" cite" , " ref" ]}},
6878
6979 // Fill helper command
70- { "keys" : [" ctrl+l" ," ctrl+f" ],
80+ { "keys" : [" ctrl+l" ," ctrl+f" ],
7181 "context" : [
7282 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
7383 "command" : " latex_fill_all" },
74- { "keys" : [" ctrl+l" ," ctrl+alt+f" ],
84+ { "keys" : [" ctrl+l" ," ctrl+alt+f" ],
7585 "context" : [
7686 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
7787 "command" : " latex_fill_all" , "args" : {"overwrite" : true }},
@@ -107,7 +117,7 @@ LaTeX Package keymap for Linux
107117 {"key" : " selection_empty" , "operator" : " equal" , "operand" : true , "match_all" : true },
108118 {"key" : " lt_fill_all_cite.comma" , "operator" : " equal" , "match_all" : true , "operand" : true }],
109119 "command" : " latex_fill_all" , "args" : {"completion_type" : " cite" , "insert_char" : " ," }},
110-
120+
111121 { "keys" : [" ," ],
112122 "context" : [
113123 {"key" : " setting.disable_latex_ref_cite_auto_trigger" , "operator" : " not_equal" , "operand" : true },
@@ -164,57 +174,53 @@ LaTeX Package keymap for Linux
164174 {"key" : " lt_fill_all_directive.equal_sign" , "operator" : " equal" , "match_all" : true , "operand" : true }],
165175 "command" : " latex_fill_all" , "args" : {"completion_type" : " directive" , "insert_char" : " =" }},
166176
167- // Toggle autocomplete
168- { "keys" : [" ctrl+l" ," t" ," a" , " r" ],
169- "context" : [
170- {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
171- "command" : " toggle_auto" , "args" : {"which" : " ref" }},
172- { "keys" : [" ctrl+l" ," t" ," a" , " c" ],
173- "context" : [
174- {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
175- "command" : " toggle_auto" , "args" : {"which" : " cite" }},
176- { "keys" : [" ctrl+l" ," t" ," a" , " f" ],
177- "context" : [
178- {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
179- "command" : " toggle_auto" , "args" : {"which" : " fill" }},
180- { "keys" : [" ctrl+l" ," t" ," a" , " e" ],
181- "context" : [
182- {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
183- "command" : " toggle_auto" , "args" : {"which" : " env" }},
184- { "keys" : [" ctrl+l" ," t" ," a" , " d" ],
185- "context" : [
186- {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
187- "command" : " toggle_auto" , "args" : {"which" : " tex_directive" }},
188- { "keys" : [" ctrl+l" ," t" ," a" , " b" ],
189- "context" : [
190- {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
191- "command" : " toggle_auto" , "args" : {"which" : " smart_bracket" }},
177+ // add a keybinding to auto-insert labels similar to the fill-all helper
178+ {
179+ "keys" : [" ctrl+l" ," ctrl+f" ],
180+ "command" : " latextools_auto_insert_label" ,
181+ "context" :
182+ [
183+ { "key" : " selector" , "operand" : " text.tex.latex" },
184+ { "key" : " preceding_text" , "operator" : " regex_contains" , "operand" : " \\\\ label\\ {$" , "match_all" : true },
185+ { "key" : " following_text" , "operator" : " regex_match" , "operand" : " \\ }" , "match_all" : true }
186+
187+ ]
188+ },
189+ {
190+ "keys" : [" {" ],
191+ "command" : " latextools_auto_insert_label" ,
192+ "context" :
193+ [
194+ { "key" : " selector" , "operand" : " text.tex.latex" },
195+ { "key" : " preceding_text" , "operator" : " regex_contains" , "operand" : " \\\\ label$" , "match_all" : true },
196+ { "key" : " latextools.setting.auto_label_auto_trigger" }
197+ ]
198+ },
192199
193200 // View PDF, jump to point, toggle editor/viewer focus and syncing behavior
194201 { "keys" : [" ctrl+l" ," v" ],
195202 "context" : [
196203 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
197204 "command" : " view_pdf" },
198- { "keys" : [" ctrl+l" ," j" ],
205+ { "keys" : [" ctrl+l" ," j" ],
199206 "context" : [
200207 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
201208 "command" : " jump_to_pdf" , "args" : {"from_keybinding" : true }},
202- { "keys" : [" ctrl+l" ," t" ," f" ],
203- "context" : [
204- {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
205- "command" : " toggle_focus" },
206- { "keys" : [" ctrl+l" ," t" ," s" ],
207- "context" : [
208- {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
209- "command" : " toggle_fwdsync" },
210- { "keys" : [" ctrl+l" ," t" ," v" ],
211- "context" : [
212- {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
213- "command" : " toggle_view_on_build" },
214- { "keys" : [" ctrl+l" ," t" ," ?" ],
215- "context" : [
216- {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
217- "command" : " toggle_show" },
209+ {
210+ "keys" : [" ctrl+l" , " t" , " <character>" ], "command" : " latextools_toggle_keys" ,
211+ "context" :
212+ [
213+ {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }
214+ ],
215+ },
216+ {
217+ "keys" : [" ctrl+l" , " t" , " a" , " <character>" ], "command" : " latextools_toggle_keys" ,
218+ "args" : {"prefix" : " a" },
219+ "context" :
220+ [
221+ {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }
222+ ],
223+ },
218224
219225 // Jump to a tex file (will create the file if it does not exists)
220226 { "keys" : [" ctrl+l" , " ctrl+o" ],
@@ -230,15 +236,15 @@ LaTeX Package keymap for Linux
230236 "command" : " jumpto_tex_anywhere" },
231237
232238 // Wrap selected text in command or environment
233- { "keys" : [" ctrl+l" ," ctrl+c" ],
239+ { "keys" : [" ctrl+l" ," ctrl+c" ],
234240 "context" : [
235241 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
236242 "command" : " insert_snippet" , "args" : {"name" :" Packages/LaTeXTools/Wrap in command.sublime-snippet" }},
237- { "keys" : [" ctrl+l" ," ctrl+n" ],
243+ { "keys" : [" ctrl+l" ," ctrl+n" ],
238244 "context" : [
239245 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
240246 "command" : " insert_snippet" , "args" : {"name" :" Packages/LaTeXTools/Wrap in environment.sublime-snippet" }},
241- { "keys" : [" ctrl+l" ," ctrl+n" ],
247+ { "keys" : [" ctrl+l" ," ctrl+n" ],
242248 "context" : [
243249 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" },
244250 {"key" : " selection_empty" , "operator" : " equal" , "operand" : true , "match_all" : true }],
@@ -255,24 +261,24 @@ LaTeX Package keymap for Linux
255261 "command" : " latex_toggle_environment_star" },
256262
257263 // Wrap selected text in emph, bold or underline
258- { "keys" : [" ctrl+l" ," ctrl+e" ],
264+ { "keys" : [" ctrl+l" ," ctrl+e" ],
259265 "context" : [
260266 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
261267 "command" : " insert_snippet" , "args" : {"name" :" Packages/LaTeXTools/Text emphasize.sublime-snippet" }},
262- { "keys" : [" ctrl+l" ," ctrl+b" ],
268+ { "keys" : [" ctrl+l" ," ctrl+b" ],
263269 "context" : [
264270 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
265271 "command" : " insert_snippet" , "args" : {"name" :" Packages/LaTeXTools/Text boldface.sublime-snippet" }},
266- { "keys" : [" ctrl+l" ," ctrl+u" ],
272+ { "keys" : [" ctrl+l" ," ctrl+u" ],
267273 "context" : [
268274 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
269275 "command" : " insert_snippet" , "args" : {"name" :" Packages/LaTeXTools/Text underline.sublime-snippet" }},
270- { "keys" : [" ctrl+l" ," ctrl+t" ],
276+ { "keys" : [" ctrl+l" ," ctrl+t" ],
271277 "context" : [
272278 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
273279 "command" : " insert_snippet" , "args" : {"name" :" Packages/LaTeXTools/Text monospace.sublime-snippet" }},
274280
275- // Replace the `C-r` overlay and the `C-shift-r` overlay with a
281+ // Replace the `C-r` overlay and the `C-shift-r` overlay with a
276282 // whole document overlay as opt-out
277283 // Also add these overlays to `C-l, C-r` and `C-l, C-shift-r`
278284 { "keys" : [" ctrl+r" ], "command" : " latex_toc_quickpanel" ,
@@ -309,8 +315,8 @@ LaTeX Package keymap for Linux
309315 // Lifted from default file
310316 // insert matching $
311317 // note the "key": "selector" line!
312- { "keys" : [" $" ], "command" : " insert_snippet" , "args" : {"contents" : " \\ $$0\\ $" },
313- "context" :
318+ { "keys" : [" $" ], "command" : " insert_snippet" , "args" : {"contents" : " \\ $$0\\ $" },
319+ "context" :
314320 [
315321 { "key" : " setting.command_mode" , "operator" : " equal" , "operand" : false },
316322 { "key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" },
@@ -321,13 +327,13 @@ LaTeX Package keymap for Linux
321327 // don't insert, it inside math environments
322328 { "key" : " selector" , "operator" : " not_equal" , "operand" : " meta.environment.math, string.other.math" , "match_all" : true },
323329 // don't insert, if there is an open dollar math environment at the end of the line
324- { "key" : " eol_selector" , "operator" : " not_equal" ,
330+ { "key" : " eol_selector" , "operator" : " not_equal" ,
325331 "operand" : " meta.environment.math.inline.dollar - punctuation.definition.string.end, string.other.math - punctuation.definition.string.end" ,
326332 "match_all" : true }
327- ]
333+ ]
328334 },
329335 // fully close $$ environments
330- { "keys" : [" $" ], "command" : " insert" , "args" : {"characters" : " $$" },
336+ { "keys" : [" $" ], "command" : " insert" , "args" : {"characters" : " $$" },
331337 "context" :
332338 [
333339 { "key" : " setting.command_mode" , "operator" : " equal" , "operand" : false },
@@ -349,7 +355,7 @@ LaTeX Package keymap for Linux
349355 },
350356 // move over closing $
351357 { "keys" : [" $" ], "command" : " move" , "args" : {"by" : " characters" , "forward" : true }, "context" :
352- [
358+ [
353359 { "key" : " setting.command_mode" , "operator" : " equal" , "operand" : false },
354360 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" },
355361 { "key" : " setting.auto_match_enabled" , "operator" : " equal" , "operand" : true },
@@ -370,8 +376,8 @@ LaTeX Package keymap for Linux
370376
371377 // overlay specifications (Tobias Schmidt)
372378 // FIXME: the scope for the four following should actually be text.tex.latex.beamer, but for some reason this does not seem to work
373- { "keys" : [" <" ], "command" : " insert_snippet" , "args" : {"contents" : " <${1:+-}>$0" },
374- "context" :
379+ { "keys" : [" <" ], "command" : " insert_snippet" , "args" : {"contents" : " <${1:+-}>$0" },
380+ "context" :
375381 [
376382 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex - (string.other.math, meta.environment.math)" },
377383 { "key" : " setting.auto_match_enabled" , "operator" : " equal" , "operand" : true },
@@ -389,7 +395,7 @@ LaTeX Package keymap for Linux
389395 },
390396 // move over closing >
391397 { "keys" : [" >" ], "command" : " move" , "args" : {"by" : " characters" , "forward" : true }, "context" :
392- [
398+ [
393399 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" },
394400 { "key" : " setting.auto_match_enabled" , "operator" : " equal" , "operand" : true },
395401 { "key" : " selection_empty" , "operator" : " equal" , "operand" : true , "match_all" : true },
@@ -457,17 +463,17 @@ LaTeX Package keymap for Linux
457463
458464 // shift+super+{up,down} for super/subscripts with braces
459465 // (courtesy of Tobias Schmidt; I only changed the keybindings)
460- { "keys" : [" shift+super+down" ], "command" : " insert_snippet" , "args" : {"contents" : " _{$1}$0" },
461- "context" :
466+ { "keys" : [" shift+super+down" ], "command" : " insert_snippet" , "args" : {"contents" : " _{$1}$0" },
467+ "context" :
462468 [
463469 {"key" : " selector" , "operator" : " equal" , "operand" : " ttext.tex.latex meta.environment.math" },
464470 { "key" : " setting.auto_match_enabled" , "operator" : " equal" , "operand" : true },
465471 { "key" : " selection_empty" , "operator" : " equal" , "operand" : true , "match_all" : true }
466472 ]
467473 },
468474
469- { "keys" : [" shift+super+up" ], "command" : " insert_snippet" , "args" : {"contents" : " ^{$1}$0" },
470- "context" :
475+ { "keys" : [" shift+super+up" ], "command" : " insert_snippet" , "args" : {"contents" : " ^{$1}$0" },
476+ "context" :
471477 [
472478 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex meta.environment.math" },
473479 { "key" : " setting.auto_match_enabled" , "operator" : " equal" , "operand" : true },
@@ -477,12 +483,12 @@ LaTeX Package keymap for Linux
477483
478484
479485 // ctrl+l,backspace to remove temporary files
480- { "keys" : [" ctrl+l" ," backspace" ],
486+ { "keys" : [" ctrl+l" ," backspace" ],
481487 "context" : [
482488 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
483489 "command" : " delete_temp_files" },
484490 // Delete/clear local Cache
485- { "keys" : [" ctrl+l" ," ctrl+d" ," ctrl+c" ],
491+ { "keys" : [" ctrl+l" ," ctrl+d" ," ctrl+c" ],
486492 "context" : [
487493 {"key" : " selector" , "operator" : " equal" , "operand" : " text.tex.latex" }],
488494 "command" : " clear_local_latex_cache" },
0 commit comments