Skip to content
This repository
Browse code

NEW-STYLE KEYBINDINGS.

  • Loading branch information...
commit cfe57a2a83ef3955dc62d9680145c3d64efdcd7b 1 parent df5f5ec
msiniscalchi authored September 17, 2012
94  Default (Linux).sublime-keymap
@@ -2,21 +2,81 @@
2 2
 LaTeX Package keymap for Linux
3 3
 */
4 4
 [
5  
-	// { "keys": ["ctrl+alt+t"], "command": "make_pdf" }, // now bound to Command-B via the standard build system
6  
-	{ "keys": ["ctrl+alt+s"], "command": "tex_sections" },
7  
-	/* why not use TextMate's keybindings? 
8  
-	   we only clobber next-tab and previous-tab, whihc are also bound
9  
-	   to arrow keys */
10  
-	{ "keys": ["super+shift+right_bracket"], "command": "latexcmd"},
11  
-	{ "keys": ["super+shift+left_bracket"], "command": "latexenv"},
12  
-	{ "keys": ["super+shift+period"], "command": "latex_env_closer"}, 
13  
-	/* can't use forward slash or period; also, why not CMD? */
14  
-	{ "keys": ["super+alt+forward_slash"], "command": "tex_macro"},
15  
-	/* alternatives: the second is reminiscent of super+B for build */
16  
-	{ "keys": ["ctrl+alt+v"], "command": "view_pdf"},
17  
-	{ "keys": ["ctrl+alt+r"], "command": "tex_ref"},
18  
-	{ "keys": ["super+shift+j"], "command": "jump_to_pdf"},
19  
-	{ "keys": ["super+shift+b"], "command": "view_pdf"},
  5
+
  6
+	// New-style keybindings use "ctrl+l" as a prefix
  7
+	// This overrides "extend selection to line", which is remapped to
  8
+	// "ctrl+l","ctrl+l" [?]
  9
+	// However, keybindings are scoped to the text.tex.latex selector, so they do not
  10
+	// pollute the standard bindings
  11
+
  12
+	// Reassign expand_selection to ctrl+l, ctrl+l
  13
+	{ 	"keys": ["ctrl+l","ctrl+l"], 
  14
+		"context":  [
  15
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  16
+		"command": "expand_selection", "args": {"to": "line"} },
  17
+
  18
+	// Insert latex command or environment, and close current environment
  19
+	{ 	"keys": ["ctrl+l","c"], 
  20
+		"context":  [
  21
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  22
+		"command": "latexcmd"},
  23
+	{ 	"keys": ["ctrl+l","e"],
  24
+		"context":  [
  25
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  26
+		"command": "latexenv"},
  27
+	{ 	"keys": ["ctrl+l","."], 
  28
+		"context":  [
  29
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  30
+		"command": "latex_env_closer"},
  31
+
  32
+	// Complete reference or citation
  33
+	{ 	"keys": ["ctrl+l","ctrl+space"],
  34
+		"context":  [
  35
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  36
+		"command": "latex_ref_cite"},
  37
+
  38
+	// View PDF, jump to point, toggle editor/viewer focus
  39
+	{ 	"keys": ["ctrl+l","v"],
  40
+		"context":  [
  41
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  42
+		"command": "view_pdf"},
  43
+	{ 	"keys": ["ctrl+l","j"], 
  44
+		"context":  [
  45
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  46
+		"command": "jump_to_pdf"},
  47
+	{ 	"keys": ["ctrl+l","t","f"],
  48
+		"context":  [
  49
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  50
+		"command": "toggle_focus"},
  51
+
  52
+	// Wrap selected text in command or environment
  53
+	{ "keys": ["ctrl+l","ctrl+c"], 
  54
+		"context":  [
  55
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  56
+		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Wrap in command.sublime-snippet"}},
  57
+	{ "keys": ["ctrl+l","ctrl+n"],  
  58
+		"context":  [
  59
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  60
+		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Wrap in environment.sublime-snippet"}},
  61
+
  62
+	// Wrap selected text in emph, bold or underline
  63
+	{ "keys": ["ctrl+l","ctrl+e"],  
  64
+		"context":  [
  65
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  66
+		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Text emphasize.sublime-snippet"}},
  67
+	{ "keys": ["ctrl+l","ctrl+b"],  
  68
+		"context":  [
  69
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  70
+		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Text boldface.sublime-snippet"}},
  71
+	{ "keys": ["ctrl+l","ctrl+u"],  
  72
+		"context":  [
  73
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  74
+		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Text underline.sublime-snippet"}},
  75
+
  76
+
  77
+
  78
+
  79
+
20 80
 
21 81
 		// Auto-pair ``$''
22 82
 		// Lifted from default file
@@ -61,7 +121,7 @@ LaTeX Package keymap for Linux
61 121
 		]
62 122
 	},
63 123
 
64  
-	// overlay specifications (Tobias Schmidt)
  124
+		// overlay specifications (Tobias Schmidt)
65 125
 	// FIXME: the scope for the four following should actually be text.tex.latex.beamer, but for some reason this does not seem to work
66 126
 	{ "keys": ["<"], "command": "insert_snippet", "args": {"contents": "<${1:+-}>$0"}, 
67 127
 	"context":  
@@ -160,6 +220,4 @@ LaTeX Package keymap for Linux
160 220
 			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
161 221
 		]
162 222
 	}
163  
-
164  
-
165 223
 ]
165  Default (Linux).sublime-keymap.OLD
... ...
@@ -0,0 +1,165 @@
  1
+/*
  2
+LaTeX Package keymap for Linux
  3
+*/
  4
+[
  5
+	// { "keys": ["ctrl+alt+t"], "command": "make_pdf" }, // now bound to Command-B via the standard build system
  6
+	{ "keys": ["ctrl+alt+s"], "command": "tex_sections" },
  7
+	/* why not use TextMate's keybindings? 
  8
+	   we only clobber next-tab and previous-tab, whihc are also bound
  9
+	   to arrow keys */
  10
+	{ "keys": ["super+shift+right_bracket"], "command": "latexcmd"},
  11
+	{ "keys": ["super+shift+left_bracket"], "command": "latexenv"},
  12
+	{ "keys": ["super+shift+period"], "command": "latex_env_closer"}, 
  13
+	/* can't use forward slash or period; also, why not CMD? */
  14
+	{ "keys": ["super+alt+forward_slash"], "command": "tex_macro"},
  15
+	/* alternatives: the second is reminiscent of super+B for build */
  16
+	{ "keys": ["ctrl+alt+v"], "command": "view_pdf"},
  17
+	{ "keys": ["ctrl+alt+r"], "command": "tex_ref"},
  18
+	{ "keys": ["super+shift+j"], "command": "jump_to_pdf"},
  19
+	{ "keys": ["super+shift+b"], "command": "view_pdf"},
  20
+
  21
+		// Auto-pair ``$''
  22
+		// Lifted from default file
  23
+	// insert matching $
  24
+	// note the "key": "selector" line!
  25
+	{ "keys": ["$"], "command": "insert_snippet", "args": {"contents": "\\$$0\\$"}, 
  26
+	"context":  
  27
+		[
  28
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  29
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  30
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  31
+			/*{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|])", "match_all": true },*/
  32
+			{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\"a-zA-Z0-9_]$", "match_all": true },
  33
+			{ "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double", "match_all": true }
  34
+		] 
  35
+	},
  36
+	// wrap in $
  37
+	{ "keys": ["$"], "command": "insert_snippet", "args": {"contents": "\\$${0:$SELECTION}\\$"}, "context":
  38
+		[
  39
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  40
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  41
+			{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
  42
+		]
  43
+	},
  44
+	// move over closing $
  45
+	{ "keys": ["$"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
  46
+		[	
  47
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  48
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  49
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  50
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^\\$", "match_all": true }
  51
+		]
  52
+	},
  53
+	// delete $ pair
  54
+	{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context":
  55
+		[
  56
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  57
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  58
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  59
+			{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\$$", "match_all": true },
  60
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^\\$", "match_all": true }
  61
+		]
  62
+	},
  63
+
  64
+	// overlay specifications (Tobias Schmidt)
  65
+	// FIXME: the scope for the four following should actually be text.tex.latex.beamer, but for some reason this does not seem to work
  66
+	{ "keys": ["<"], "command": "insert_snippet", "args": {"contents": "<${1:+-}>$0"}, 
  67
+	"context":  
  68
+		[
  69
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  70
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  71
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  72
+			{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\item|only|textbf|color|onslide|only|uncover|visible|invisible|alt|temporal$", "match_all": true }
  73
+		]
  74
+	},
  75
+	// wrap in <>
  76
+	{ "keys": ["<"], "command": "insert_snippet", "args": {"contents": "<${0:$SELECTION}>"}, "context":
  77
+		[
  78
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  79
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  80
+			{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
  81
+		]
  82
+	},
  83
+	// move over closing >
  84
+	{ "keys": [">"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
  85
+		[	
  86
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  87
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  88
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  89
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^>", "match_all": true }
  90
+		]
  91
+	},
  92
+	// delete <> pair
  93
+	{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context":
  94
+		[
  95
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  96
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  97
+			{ "key": "preceding_text", "operator": "regex_contains", "operand": "<$", "match_all": true },
  98
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^>", "match_all": true }
  99
+		]
  100
+	},
  101
+	// autopair quotation marks (`')
  102
+	{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`$0'"}, "context":
  103
+		[
  104
+			{ "key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  105
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  106
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
  107
+		]
  108
+	},
  109
+	{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`${0:$SELECTION}'"}, "context":
  110
+		[
  111
+			{ "key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  112
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  113
+			{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
  114
+		]
  115
+	},
  116
+	{ "keys": ["'"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
  117
+		[
  118
+			{ "key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  119
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  120
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  121
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^'", "match_all": true }
  122
+		]
  123
+	},
  124
+	{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context":
  125
+		[
  126
+			{ "key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  127
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  128
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  129
+			{ "key": "preceding_text", "operator": "regex_contains", "operand": "`$", "match_all": true },
  130
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^'", "match_all": true }
  131
+		]
  132
+	},
  133
+	// automatic addition of new \items when hitting Shift+Enter in a list environment
  134
+ 	{ "keys": ["shift+enter"], "command": "insert_snippet", "args": {"contents": "\n\\item $0"}, 
  135
+ 	"context":  
  136
+	 	[
  137
+			{"key": "selector", "operator": "equal", "operand": "meta.function.environment.list.latex"},
  138
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  139
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
  140
+		]
  141
+	},
  142
+
  143
+
  144
+	// shift+super+{up,down} for super/subscripts with braces
  145
+	// (courtesy of Tobias Schmidt; I only changed the keybindings)
  146
+	{ "keys": ["shift+super+down"], "command": "insert_snippet", "args": {"contents": "_{$1}$0"}, 
  147
+	"context":  
  148
+		[
  149
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex string.other.math"},
  150
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  151
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
  152
+		]
  153
+	},
  154
+
  155
+	{ "keys": ["shift+super+up"], "command": "insert_snippet", "args": {"contents": "^{$1}$0"}, 
  156
+	"context":  
  157
+		[
  158
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex string.other.math"},
  159
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  160
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
  161
+		]
  162
+	}
  163
+
  164
+
  165
+]
92  Default (OSX).sublime-keymap
... ...
@@ -1,49 +1,83 @@
1 1
 /*
2  
-LaTeX Package keymap for OSX
  2
+LaTeX Package keymap for OS X
3 3
 */
4 4
 [
5  
-	// { "keys": ["ctrl+alt+t"], "command": "make_pdf" }, // now bound to Command-B via the standard build system
6  
-	{ "keys": ["ctrl+alt+s"], "command": "tex_sections" },
7  
-	/* why not use TextMate's keybindings? 
8  
-	   we only clobber next-tab and previous-tab, whihc are also bound
9  
-	   to arrow keys */
10  
-	{ "keys": ["super+shift+right_bracket"], "command": "latexcmd"},
11  
-	{ "keys": ["super+shift+left_bracket"], "command": "latexenv"},
12  
-	{ "keys": ["super+shift+period"], "command": "latex_env_closer"}, 
13  
-	/* can't use forward slash or period; also, why not CMD? */
14  
-	{ "keys": ["super+alt+forward_slash"], "command": "tex_macro"},
15  
-	/* alternatives: the second is reminiscent of super+B for build */
16  
-	{ "keys": ["ctrl+alt+v"], "command": "view_pdf"},
17  
-	{ "keys": ["ctrl+alt+r"], "command": "tex_ref"},
18  
-	{ "keys": ["super+shift+j"], "command": "jump_to_pdf"},
19  
-	{ "keys": ["super+shift+b"], "command": "view_pdf"},
20  
-	{ "keys": ["super+ctrl+f"], "command": "toggle_focus"},
21  
-
22  
-	// Cross-reference commands
23  
-	{ "keys": ["super+shift+c"], "command": "latex_cite"},	
24  
-
25  
-	// Wrapping commands
26  
-	{ "keys": ["alt+shift+w","c"], 
  5
+
  6
+	// New-style keybindings use "cmd+l" as a prefix
  7
+	// This overrides "extend selection to line", which is remapped to
  8
+	// "cmd+l","cmd+l"
  9
+	// However, keybindings are scoped to the text.tex.latex selector, so they do not
  10
+	// pollute the standard bindings
  11
+
  12
+	// Reassign expand_selection to ctrl+l, ctrl+l
  13
+	{ 	"keys": ["super+l","super+l"], 
  14
+		"context":  [
  15
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  16
+		"command": "expand_selection", "args": {"to": "line"} },
  17
+
  18
+	// Insert latex command or environment, and close current environment
  19
+	{ 	"keys": ["super+l","c"], 
  20
+		"context":  [
  21
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  22
+		"command": "latexcmd"},
  23
+	{ 	"keys": ["super+l","e"],
  24
+		"context":  [
  25
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  26
+		"command": "latexenv"},
  27
+	{ 	"keys": ["super+l","."], 
  28
+		"context":  [
  29
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  30
+		"command": "latex_env_closer"},
  31
+
  32
+	// Complete reference or citation
  33
+	{ 	"keys": ["super+l","ctrl+space"], // this may have to change!
  34
+		"context":  [
  35
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  36
+		"command": "latex_ref_cite"},
  37
+
  38
+	// View PDF, jump to point, toggle editor/viewer focus
  39
+	{ 	"keys": ["super+l","v"],
  40
+		"context":  [
  41
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  42
+		"command": "view_pdf"},
  43
+	{ 	"keys": ["super+l","j"], 
  44
+		"context":  [
  45
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  46
+		"command": "jump_to_pdf"},
  47
+	{ 	"keys": ["super+l","t","f"],
  48
+		"context":  [
  49
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  50
+		"command": "toggle_focus"},
  51
+
  52
+	// Wrap selected text in command or environment
  53
+	{ "keys": ["super+l","super+c"], 
27 54
 		"context":  [
28 55
 			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
29 56
 		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Wrap in command.sublime-snippet"}},
30  
-	{ "keys": ["alt+shift+w","n"],  
  57
+	{ "keys": ["super+l","super+n"],  
31 58
 		"context":  [
32 59
 			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
33 60
 		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Wrap in environment.sublime-snippet"}},
34  
-	{ "keys": ["alt+shift+w","e"],  
  61
+
  62
+	// Wrap selected text in emph, bold or underline
  63
+	{ "keys": ["super+l","super+e"],  
35 64
 		"context":  [
36 65
 			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
37 66
 		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Text emphasize.sublime-snippet"}},
38  
-	{ "keys": ["alt+shift+w","b"],  
  67
+	{ "keys": ["super+l","super+b"],  
39 68
 		"context":  [
40 69
 			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
41 70
 		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Text boldface.sublime-snippet"}},
42  
-	{ "keys": ["alt+shift+w","u"],  
  71
+	{ "keys": ["super+l","super+u"],  
43 72
 		"context":  [
44 73
 			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
45 74
 		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Text underline.sublime-snippet"}},
46 75
 
  76
+
  77
+
  78
+
  79
+
  80
+
47 81
 		// Auto-pair ``$''
48 82
 		// Lifted from default file
49 83
 	// insert matching $
@@ -87,7 +121,7 @@ LaTeX Package keymap for OSX
87 121
 		]
88 122
 	},
89 123
 
90  
-	// overlay specifications (Tobias Schmidt)
  124
+		// overlay specifications (Tobias Schmidt)
91 125
 	// FIXME: the scope for the four following should actually be text.tex.latex.beamer, but for some reason this does not seem to work
92 126
 	{ "keys": ["<"], "command": "insert_snippet", "args": {"contents": "<${1:+-}>$0"}, 
93 127
 	"context":  
@@ -186,6 +220,4 @@ LaTeX Package keymap for OSX
186 220
 			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
187 221
 		]
188 222
 	}
189  
-
190  
-
191 223
 ]
191  Default (OSX).sublime-keymap.OLD
... ...
@@ -0,0 +1,191 @@
  1
+/*
  2
+LaTeX Package keymap for OSX
  3
+*/
  4
+[
  5
+	// { "keys": ["ctrl+alt+t"], "command": "make_pdf" }, // now bound to Command-B via the standard build system
  6
+	{ "keys": ["ctrl+alt+s"], "command": "tex_sections" },
  7
+	/* why not use TextMate's keybindings? 
  8
+	   we only clobber next-tab and previous-tab, whihc are also bound
  9
+	   to arrow keys */
  10
+	{ "keys": ["super+shift+right_bracket"], "command": "latexcmd"},
  11
+	{ "keys": ["super+shift+left_bracket"], "command": "latexenv"},
  12
+	{ "keys": ["super+shift+period"], "command": "latex_env_closer"}, 
  13
+	/* can't use forward slash or period; also, why not CMD? */
  14
+	{ "keys": ["super+alt+forward_slash"], "command": "tex_macro"},
  15
+	/* alternatives: the second is reminiscent of super+B for build */
  16
+	{ "keys": ["ctrl+alt+v"], "command": "view_pdf"},
  17
+	{ "keys": ["ctrl+alt+r"], "command": "tex_ref"},
  18
+	{ "keys": ["super+shift+j"], "command": "jump_to_pdf"},
  19
+	{ "keys": ["super+shift+b"], "command": "view_pdf"},
  20
+	{ "keys": ["super+ctrl+f"], "command": "toggle_focus"},
  21
+
  22
+	// Cross-reference commands
  23
+	{ "keys": ["super+shift+c"], "command": "latex_cite"},	
  24
+
  25
+	// Wrapping commands
  26
+	{ "keys": ["alt+shift+w","c"], 
  27
+		"context":  [
  28
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  29
+		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Wrap in command.sublime-snippet"}},
  30
+	{ "keys": ["alt+shift+w","n"],  
  31
+		"context":  [
  32
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  33
+		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Wrap in environment.sublime-snippet"}},
  34
+	{ "keys": ["alt+shift+w","e"],  
  35
+		"context":  [
  36
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  37
+		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Text emphasize.sublime-snippet"}},
  38
+	{ "keys": ["alt+shift+w","b"],  
  39
+		"context":  [
  40
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  41
+		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Text boldface.sublime-snippet"}},
  42
+	{ "keys": ["alt+shift+w","u"],  
  43
+		"context":  [
  44
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  45
+		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Text underline.sublime-snippet"}},
  46
+
  47
+		// Auto-pair ``$''
  48
+		// Lifted from default file
  49
+	// insert matching $
  50
+	// note the "key": "selector" line!
  51
+	{ "keys": ["$"], "command": "insert_snippet", "args": {"contents": "\\$$0\\$"}, 
  52
+	"context":  
  53
+		[
  54
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  55
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  56
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  57
+			/*{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|])", "match_all": true },*/
  58
+			{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\"a-zA-Z0-9_]$", "match_all": true },
  59
+			{ "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double", "match_all": true }
  60
+		] 
  61
+	},
  62
+	// wrap in $
  63
+	{ "keys": ["$"], "command": "insert_snippet", "args": {"contents": "\\$${0:$SELECTION}\\$"}, "context":
  64
+		[
  65
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  66
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  67
+			{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
  68
+		]
  69
+	},
  70
+	// move over closing $
  71
+	{ "keys": ["$"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
  72
+		[	
  73
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  74
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  75
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  76
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^\\$", "match_all": true }
  77
+		]
  78
+	},
  79
+	// delete $ pair
  80
+	{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context":
  81
+		[
  82
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  83
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  84
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  85
+			{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\$$", "match_all": true },
  86
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^\\$", "match_all": true }
  87
+		]
  88
+	},
  89
+
  90
+	// overlay specifications (Tobias Schmidt)
  91
+	// FIXME: the scope for the four following should actually be text.tex.latex.beamer, but for some reason this does not seem to work
  92
+	{ "keys": ["<"], "command": "insert_snippet", "args": {"contents": "<${1:+-}>$0"}, 
  93
+	"context":  
  94
+		[
  95
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  96
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  97
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  98
+			{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\item|only|textbf|color|onslide|only|uncover|visible|invisible|alt|temporal$", "match_all": true }
  99
+		]
  100
+	},
  101
+	// wrap in <>
  102
+	{ "keys": ["<"], "command": "insert_snippet", "args": {"contents": "<${0:$SELECTION}>"}, "context":
  103
+		[
  104
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  105
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  106
+			{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
  107
+		]
  108
+	},
  109
+	// move over closing >
  110
+	{ "keys": [">"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
  111
+		[	
  112
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  113
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  114
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  115
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^>", "match_all": true }
  116
+		]
  117
+	},
  118
+	// delete <> pair
  119
+	{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context":
  120
+		[
  121
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  122
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  123
+			{ "key": "preceding_text", "operator": "regex_contains", "operand": "<$", "match_all": true },
  124
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^>", "match_all": true }
  125
+		]
  126
+	},
  127
+	// autopair quotation marks (`')
  128
+	{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`$0'"}, "context":
  129
+		[
  130
+			{ "key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  131
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  132
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
  133
+		]
  134
+	},
  135
+	{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`${0:$SELECTION}'"}, "context":
  136
+		[
  137
+			{ "key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  138
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  139
+			{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
  140
+		]
  141
+	},
  142
+	{ "keys": ["'"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
  143
+		[
  144
+			{ "key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  145
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  146
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  147
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^'", "match_all": true }
  148
+		]
  149
+	},
  150
+	{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context":
  151
+		[
  152
+			{ "key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  153
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  154
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  155
+			{ "key": "preceding_text", "operator": "regex_contains", "operand": "`$", "match_all": true },
  156
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^'", "match_all": true }
  157
+		]
  158
+	},
  159
+	// automatic addition of new \items when hitting Shift+Enter in a list environment
  160
+ 	{ "keys": ["shift+enter"], "command": "insert_snippet", "args": {"contents": "\n\\item $0"}, 
  161
+ 	"context":  
  162
+	 	[
  163
+			{"key": "selector", "operator": "equal", "operand": "meta.function.environment.list.latex"},
  164
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  165
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
  166
+		]
  167
+	},
  168
+
  169
+
  170
+	// shift+super+{up,down} for super/subscripts with braces
  171
+	// (courtesy of Tobias Schmidt; I only changed the keybindings)
  172
+	{ "keys": ["shift+super+down"], "command": "insert_snippet", "args": {"contents": "_{$1}$0"}, 
  173
+	"context":  
  174
+		[
  175
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex string.other.math"},
  176
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  177
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
  178
+		]
  179
+	},
  180
+
  181
+	{ "keys": ["shift+super+up"], "command": "insert_snippet", "args": {"contents": "^{$1}$0"}, 
  182
+	"context":  
  183
+		[
  184
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex string.other.math"},
  185
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  186
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
  187
+		]
  188
+	}
  189
+
  190
+
  191
+]
91  Default (Windows).sublime-keymap
... ...
@@ -1,51 +1,84 @@
1 1
 /*
2  
-LaTeX Package keymap for OSX
  2
+LaTeX Package keymap for Windows
3 3
 */
4 4
 [
5  
-	// not yet active
6  
-	// { "keys": ["ctrl+alt+s"], "command": "tex_sections" },
7  
-	/* why not use TextMate's keybindings? 
8  
-	   we only clobber next-tab and previous-tab, whihc are also bound
9  
-	   to arrow keys */
10  
-	{ "keys": ["alt+shift+right_bracket"], "command": "latexcmd"},
11  
-	{ "keys": ["alt+shift+left_bracket"], "command": "latexenv"},
12  
-	{ "keys": ["alt+shift+period"], "command": "latex_env_closer"}, 
13  
-	/* can't use forward slash or period; also, why not CMD? */
14  
-	// subsumed by tab completion
15  
-	// { "keys": ["super+alt+forward_slash"], "command": "tex_macro"},
16  
-	/* alternatives: the second is reminiscent of super+B for build */
17  
-	{ "keys": ["ctrl+alt+v"], "command": "view_pdf"},
18  
-	// subsumed by ref<TAB> and completion API
19  
-	// { "keys": ["ctrl+alt+r"], "command": "tex_ref"},
20  
-	{ "keys": ["alt+shift+j"], "command": "jump_to_pdf"},
21  
-	{ "keys": ["super+shift+b"], "command": "view_pdf"},
22  
-	{ "keys": ["super+shift+f"], "command": "toggle_focus"},
23  
-
24  
-	// Cross-reference commands
25  
-	{ "keys": ["alt+shift+c"], "command": "latex_cite"},	
26  
-
27  
-	// Wrapping commands
28  
-	{ "keys": ["alt+shift+w","c"], 
  5
+
  6
+	// New-style keybindings use "ctrl+l" as a prefix
  7
+	// This overrides "extend selection to line", which is remapped to
  8
+	// "ctrl+l","ctrl+l" [?]
  9
+	// However, keybindings are scoped to the text.tex.latex selector, so they do not
  10
+	// pollute the standard bindings
  11
+
  12
+	// Reassign expand_selection to ctrl+l, ctrl+l
  13
+	{ 	"keys": ["ctrl+l","ctrl+l"], 
  14
+		"context":  [
  15
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  16
+		"command": "expand_selection", "args": {"to": "line"} },
  17
+
  18
+	// Insert latex command or environment, and close current environment
  19
+	{ 	"keys": ["ctrl+l","c"], 
  20
+		"context":  [
  21
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  22
+		"command": "latexcmd"},
  23
+	{ 	"keys": ["ctrl+l","e"],
  24
+		"context":  [
  25
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  26
+		"command": "latexenv"},
  27
+	{ 	"keys": ["ctrl+l","."], 
  28
+		"context":  [
  29
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  30
+		"command": "latex_env_closer"},
  31
+
  32
+	// Complete reference or citation
  33
+	{ 	"keys": ["ctrl+l","ctrl+space"],
  34
+		"context":  [
  35
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  36
+		"command": "latex_ref_cite"},
  37
+
  38
+	// View PDF, jump to point, toggle editor/viewer focus
  39
+	{ 	"keys": ["ctrl+l","v"],
  40
+		"context":  [
  41
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  42
+		"command": "view_pdf"},
  43
+	{ 	"keys": ["ctrl+l","j"], 
  44
+		"context":  [
  45
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  46
+		"command": "jump_to_pdf"},
  47
+	{ 	"keys": ["ctrl+l","t","f"],
  48
+		"context":  [
  49
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  50
+		"command": "toggle_focus"},
  51
+
  52
+	// Wrap selected text in command or environment
  53
+	{ "keys": ["ctrl+l","ctrl+c"], 
29 54
 		"context":  [
30 55
 			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
31 56
 		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Wrap in command.sublime-snippet"}},
32  
-	{ "keys": ["alt+shift+w","n"],  
  57
+	{ "keys": ["ctrl+l","ctrl+n"],  
33 58
 		"context":  [
34 59
 			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
35 60
 		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Wrap in environment.sublime-snippet"}},
36  
-	{ "keys": ["alt+shift+w","e"],  
  61
+
  62
+	// Wrap selected text in emph, bold or underline
  63
+	{ "keys": ["ctrl+l","ctrl+e"],  
37 64
 		"context":  [
38 65
 			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
39 66
 		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Text emphasize.sublime-snippet"}},
40  
-	{ "keys": ["alt+shift+w","b"],  
  67
+	{ "keys": ["ctrl+l","ctrl+b"],  
41 68
 		"context":  [
42 69
 			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
43 70
 		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Text boldface.sublime-snippet"}},
44  
-	{ "keys": ["alt+shift+w","u"],  
  71
+	{ "keys": ["ctrl+l","ctrl+u"],  
45 72
 		"context":  [
46 73
 			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
47 74
 		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Text underline.sublime-snippet"}},
48 75
 
  76
+
  77
+
  78
+
  79
+
  80
+
  81
+
49 82
 		// Auto-pair ``$''
50 83
 		// Lifted from default file
51 84
 	// insert matching $
191  Default (Windows).sublime-keymap.OLD
... ...
@@ -0,0 +1,191 @@
  1
+/*
  2
+LaTeX Package keymap for OSX
  3
+*/
  4
+[
  5
+	// not yet active
  6
+	// { "keys": ["ctrl+alt+s"], "command": "tex_sections" },
  7
+	/* why not use TextMate's keybindings? 
  8
+	   we only clobber next-tab and previous-tab, whihc are also bound
  9
+	   to arrow keys */
  10
+	{ "keys": ["alt+shift+right_bracket"], "command": "latexcmd"},
  11
+	{ "keys": ["alt+shift+left_bracket"], "command": "latexenv"},
  12
+	{ "keys": ["alt+shift+period"], "command": "latex_env_closer"}, 
  13
+	/* can't use forward slash or period; also, why not CMD? */
  14
+	// subsumed by tab completion
  15
+	// { "keys": ["super+alt+forward_slash"], "command": "tex_macro"},
  16
+	/* alternatives: the second is reminiscent of super+B for build */
  17
+	{ "keys": ["ctrl+alt+v"], "command": "view_pdf"},
  18
+	// subsumed by ref<TAB> and completion API
  19
+	// { "keys": ["ctrl+alt+r"], "command": "tex_ref"},
  20
+	{ "keys": ["alt+shift+j"], "command": "jump_to_pdf"},
  21
+	{ "keys": ["super+shift+b"], "command": "view_pdf"},
  22
+	{ "keys": ["super+shift+f"], "command": "toggle_focus"},
  23
+
  24
+	// Cross-reference commands
  25
+	{ "keys": ["alt+shift+c"], "command": "latex_cite"},	
  26
+
  27
+	// Wrapping commands
  28
+	{ "keys": ["alt+shift+w","c"], 
  29
+		"context":  [
  30
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  31
+		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Wrap in command.sublime-snippet"}},
  32
+	{ "keys": ["alt+shift+w","n"],  
  33
+		"context":  [
  34
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  35
+		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Wrap in environment.sublime-snippet"}},
  36
+	{ "keys": ["alt+shift+w","e"],  
  37
+		"context":  [
  38
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  39
+		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Text emphasize.sublime-snippet"}},
  40
+	{ "keys": ["alt+shift+w","b"],  
  41
+		"context":  [
  42
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  43
+		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Text boldface.sublime-snippet"}},
  44
+	{ "keys": ["alt+shift+w","u"],  
  45
+		"context":  [
  46
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"}],
  47
+		"command": "insert_snippet", "args": {"name":"Packages/LaTeXTools/Text underline.sublime-snippet"}},
  48
+
  49
+		// Auto-pair ``$''
  50
+		// Lifted from default file
  51
+	// insert matching $
  52
+	// note the "key": "selector" line!
  53
+	{ "keys": ["$"], "command": "insert_snippet", "args": {"contents": "\\$$0\\$"}, 
  54
+	"context":  
  55
+		[
  56
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  57
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  58
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  59
+			/*{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|])", "match_all": true },*/
  60
+			{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\"a-zA-Z0-9_]$", "match_all": true },
  61
+			{ "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double", "match_all": true }
  62
+		] 
  63
+	},
  64
+	// wrap in $
  65
+	{ "keys": ["$"], "command": "insert_snippet", "args": {"contents": "\\$${0:$SELECTION}\\$"}, "context":
  66
+		[
  67
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  68
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  69
+			{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
  70
+		]
  71
+	},
  72
+	// move over closing $
  73
+	{ "keys": ["$"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
  74
+		[	
  75
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  76
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  77
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  78
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^\\$", "match_all": true }
  79
+		]
  80
+	},
  81
+	// delete $ pair
  82
+	{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context":
  83
+		[
  84
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  85
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  86
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  87
+			{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\$$", "match_all": true },
  88
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^\\$", "match_all": true }
  89
+		]
  90
+	},
  91
+
  92
+		// overlay specifications (Tobias Schmidt)
  93
+	// FIXME: the scope for the four following should actually be text.tex.latex.beamer, but for some reason this does not seem to work
  94
+	{ "keys": ["<"], "command": "insert_snippet", "args": {"contents": "<${1:+-}>$0"}, 
  95
+	"context":  
  96
+		[
  97
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  98
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  99
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  100
+			{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\item|only|textbf|color|onslide|only|uncover|visible|invisible|alt|temporal$", "match_all": true }
  101
+		]
  102
+	},
  103
+	// wrap in <>
  104
+	{ "keys": ["<"], "command": "insert_snippet", "args": {"contents": "<${0:$SELECTION}>"}, "context":
  105
+		[
  106
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  107
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  108
+			{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
  109
+		]
  110
+	},
  111
+	// move over closing >
  112
+	{ "keys": [">"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
  113
+		[	
  114
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  115
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  116
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  117
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^>", "match_all": true }
  118
+		]
  119
+	},
  120
+	// delete <> pair
  121
+	{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context":
  122
+		[
  123
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  124
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  125
+			{ "key": "preceding_text", "operator": "regex_contains", "operand": "<$", "match_all": true },
  126
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^>", "match_all": true }
  127
+		]
  128
+	},
  129
+	// autopair quotation marks (`')
  130
+	{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`$0'"}, "context":
  131
+		[
  132
+			{ "key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  133
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  134
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
  135
+		]
  136
+	},
  137
+	{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`${0:$SELECTION}'"}, "context":
  138
+		[
  139
+			{ "key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  140
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  141
+			{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
  142
+		]
  143
+	},
  144
+	{ "keys": ["'"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
  145
+		[
  146
+			{ "key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  147
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  148
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  149
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^'", "match_all": true }
  150
+		]
  151
+	},
  152
+	{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context":
  153
+		[
  154
+			{ "key": "selector", "operator": "equal", "operand": "text.tex.latex"},
  155
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  156
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  157
+			{ "key": "preceding_text", "operator": "regex_contains", "operand": "`$", "match_all": true },
  158
+			{ "key": "following_text", "operator": "regex_contains", "operand": "^'", "match_all": true }
  159
+		]
  160
+	},
  161
+	// automatic addition of new \items when hitting Shift+Enter in a list environment
  162
+ 	{ "keys": ["shift+enter"], "command": "insert_snippet", "args": {"contents": "\n\\item $0"}, 
  163
+ 	"context":  
  164
+	 	[
  165
+			{"key": "selector", "operator": "equal", "operand": "meta.function.environment.list.latex"},
  166
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  167
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
  168
+		]
  169
+	},
  170
+
  171
+
  172
+	// shift+super+{up,down} for super/subscripts with braces
  173
+	// (courtesy of Tobias Schmidt; I only changed the keybindings)
  174
+	{ "keys": ["shift+super+down"], "command": "insert_snippet", "args": {"contents": "_{$1}$0"}, 
  175
+	"context":  
  176
+		[
  177
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex string.other.math"},
  178
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  179
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
  180
+		]
  181
+	},
  182
+
  183
+	{ "keys": ["shift+super+up"], "command": "insert_snippet", "args": {"contents": "^{$1}$0"}, 
  184
+	"context":  
  185
+		[
  186
+			{"key": "selector", "operator": "equal", "operand": "text.tex.latex string.other.math"},
  187
+			{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
  188
+			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
  189
+		]
  190
+	}
  191
+]

0 notes on commit cfe57a2

Please sign in to comment.
Something went wrong with that request. Please try again.