Skip to content

Commit c8c1db3

Browse files
committed
Fix unwanted plugin trigger
If there was a `+` at the beginning of the line (ignoring whitespace prefix), this was enough for the plugin to trigger on several keybindings. This caused some unwanted operations in some cases. It is now mandatory to have a `---` or `===` right after the initial `+` to trigger the plugin. This complies with Emacs and grid style table syntaxes.
1 parent 167ec70 commit c8c1db3

3 files changed

+51
-51
lines changed

Diff for: Default (Linux).sublime-keymap

+17-17
Original file line numberDiff line numberDiff line change
@@ -2,119 +2,119 @@
22
{ "keys": ["ctrl+shift+a"], "command": "table_editor_align", "context":
33
[
44
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
5-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
5+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
66
{ "key": "following_text", "operator": "regex_contains", "operand": "$", "match_all": true }
77
]
88
},
99
{ "keys": ["tab"], "command": "table_editor_next_field", "context":
1010
[
1111
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
12-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
12+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
1313
{ "key": "following_text", "operator": "regex_contains", "operand": "$", "match_all": true }
1414
]
1515
},
1616
{ "keys": ["shift+tab"], "command": "table_editor_previous_field", "context":
1717
[
1818
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
19-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
19+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
2020
{ "key": "following_text", "operator": "regex_contains", "operand": "$", "match_all": true }
2121
]
2222
},
2323
{ "keys": ["enter"], "command": "table_editor_next_row", "context":
2424
[
2525
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
26-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
26+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
2727
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
2828
]
2929
},
3030
{ "keys": ["alt+enter"], "command": "table_editor_split_column_down", "context":
3131
[
3232
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
33-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
33+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
3434
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
3535
]
3636
},
3737
{ "keys": ["ctrl+j"], "command": "table_editor_join_lines", "context":
3838
[
3939
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
40-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
40+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
4141
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
4242
]
4343
},
4444
{ "keys": ["alt+right"], "command": "table_editor_move_column_right", "context":
4545
[
4646
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
47-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
47+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
4848
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
4949
]
5050
},
5151
{ "keys": ["alt+left"], "command": "table_editor_move_column_left", "context":
5252
[
5353
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
54-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
54+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
5555
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
5656
]
5757
},
5858
{ "keys": ["alt+shift+left"], "command": "table_editor_delete_column", "context":
5959
[
6060
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
61-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
61+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
6262
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
6363
]
6464
},
6565
{ "keys": ["alt+shift+right"], "command": "table_editor_insert_column", "context":
6666
[
6767
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
68-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
68+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
6969
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
7070
]
7171
},
7272
{ "keys": ["alt+shift+up"], "command": "table_editor_kill_row", "context":
7373
[
7474
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
75-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
75+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
7676
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
7777
]
7878
},
7979
{ "keys": ["alt+shift+down"], "command": "table_editor_insert_row", "context":
8080
[
8181
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
82-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
82+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
8383
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
8484
]
8585
},
8686
{ "keys": ["alt+up"], "command": "table_editor_move_row_up", "context":
8787
[
8888
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
89-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
89+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
9090
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
9191
]
9292
},
9393
{ "keys": ["alt+down"], "command": "table_editor_move_row_down", "context":
9494
[
9595
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
96-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
96+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
9797
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
9898
]
9999
},
100100
{ "keys": ["ctrl+k","-"], "command": "table_editor_insert_single_hline", "context":
101101
[
102102
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
103-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
103+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
104104
{ "key": "following_text", "operator": "regex_contains", "operand": "$", "match_all": true }
105105
]
106106
},
107107
{ "keys": ["ctrl+k","="], "command": "table_editor_insert_double_hline", "context":
108108
[
109109
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
110-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
110+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
111111
{ "key": "following_text", "operator": "regex_contains", "operand": "$", "match_all": true }
112112
]
113113
},
114114
{ "keys": ["ctrl+k","enter"], "command": "table_editor_hline_and_move", "context":
115115
[
116116
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
117-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
117+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
118118
{ "key": "following_text", "operator": "regex_contains", "operand": "$", "match_all": true }
119119
]
120120
},

Diff for: Default (OSX).sublime-keymap

+17-17
Original file line numberDiff line numberDiff line change
@@ -2,119 +2,119 @@
22
{ "keys": ["ctrl+shift+a"], "command": "table_editor_align", "context":
33
[
44
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
5-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
5+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
66
{ "key": "following_text", "operator": "regex_contains", "operand": "$", "match_all": true }
77
]
88
},
99
{ "keys": ["tab"], "command": "table_editor_next_field", "context":
1010
[
1111
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
12-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
12+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
1313
{ "key": "following_text", "operator": "regex_contains", "operand": "$", "match_all": true }
1414
]
1515
},
1616
{ "keys": ["shift+tab"], "command": "table_editor_previous_field", "context":
1717
[
1818
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
19-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
19+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
2020
{ "key": "following_text", "operator": "regex_contains", "operand": "$", "match_all": true }
2121
]
2222
},
2323
{ "keys": ["enter"], "command": "table_editor_next_row", "context":
2424
[
2525
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
26-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
26+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
2727
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
2828
]
2929
},
3030
{ "keys": ["alt+enter"], "command": "table_editor_split_column_down", "context":
3131
[
3232
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
33-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
33+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
3434
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
3535
]
3636
},
3737
{ "keys": ["ctrl+j"], "command": "table_editor_join_lines", "context":
3838
[
3939
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
40-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
40+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
4141
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
4242
]
4343
},
4444
{ "keys": ["alt+right"], "command": "table_editor_move_column_right", "context":
4545
[
4646
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
47-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
47+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
4848
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
4949
]
5050
},
5151
{ "keys": ["alt+left"], "command": "table_editor_move_column_left", "context":
5252
[
5353
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
54-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
54+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
5555
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
5656
]
5757
},
5858
{ "keys": ["alt+shift+left"], "command": "table_editor_delete_column", "context":
5959
[
6060
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
61-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
61+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
6262
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
6363
]
6464
},
6565
{ "keys": ["alt+shift+right"], "command": "table_editor_insert_column", "context":
6666
[
6767
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
68-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
68+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
6969
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
7070
]
7171
},
7272
{ "keys": ["alt+shift+up"], "command": "table_editor_kill_row", "context":
7373
[
7474
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
75-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
75+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
7676
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
7777
]
7878
},
7979
{ "keys": ["alt+shift+down"], "command": "table_editor_insert_row", "context":
8080
[
8181
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
82-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
82+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
8383
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
8484
]
8585
},
8686
{ "keys": ["alt+up"], "command": "table_editor_move_row_up", "context":
8787
[
8888
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
89-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
89+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
9090
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
9191
]
9292
},
9393
{ "keys": ["alt+down"], "command": "table_editor_move_row_down", "context":
9494
[
9595
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
96-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
96+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
9797
{ "key": "following_text", "operator": "regex_contains", "operand": "[\\|\\+]", "match_all": true }
9898
]
9999
},
100100
{ "keys": ["ctrl+k","-"], "command": "table_editor_insert_single_hline", "context":
101101
[
102102
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
103-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
103+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
104104
{ "key": "following_text", "operator": "regex_contains", "operand": "$", "match_all": true }
105105
]
106106
},
107107
{ "keys": ["ctrl+k","="], "command": "table_editor_insert_double_hline", "context":
108108
[
109109
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
110-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
110+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
111111
{ "key": "following_text", "operator": "regex_contains", "operand": "$", "match_all": true }
112112
]
113113
},
114114
{ "keys": ["ctrl+k","enter"], "command": "table_editor_hline_and_move", "context":
115115
[
116116
{ "key": "setting.enable_table_editor", "operator": "equal", "operand": true, "match_all": true },
117-
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*[\\|\\+]", "match_all": true },
117+
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(\\||\\+(---|===))", "match_all": true },
118118
{ "key": "following_text", "operator": "regex_contains", "operand": "$", "match_all": true }
119119
]
120120
},

0 commit comments

Comments
 (0)