File tree Expand file tree Collapse file tree 5 files changed +30
-6
lines changed Expand file tree Collapse file tree 5 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -27,9 +27,11 @@ The Wrap plugin can be customized to your requirements.
27
27
28
28
### 🔧 Preferences
29
29
30
- The type of brackets used by ` Wrap ` can be customized via the command ` Preferences: Wrap ` .
30
+ The types of brackets used by ` Wrap ` can be customized via the command ` Preferences: Wrap ` .
31
31
32
- Simply change the ` bracket_type ` to your preference.
32
+ Change the default bracket type with the ` bracket_type ` setting.
33
+
34
+ Change context-specific bracket types with the ` contexts ` setting.
33
35
34
36
### ⌨ Keybindings
35
37
Original file line number Diff line number Diff line change 1
1
{
2
- // Type of brackets to use (examples: (), [], {})
3
- "bracket_type" : " ()"
2
+ // Default bracket type (examples: (), [], {})
3
+ "bracket_type" : " ()" ,
4
+
5
+ // Context-specific bracket types (overrides default)
6
+ "contexts" : [
7
+ {
8
+ "name" : " LaTeX" ,
9
+ "scope" : " text.tex.latex" ,
10
+ "extensions" : [" tex" ],
11
+ "bracket_type" : " {}"
12
+ }
13
+ ]
4
14
}
Original file line number Diff line number Diff line change 1
1
{
2
- "install" : " messages/install.txt"
2
+ "install" : " messages/install.txt" ,
3
+ "1.1.0" : " messages/1.1.0.txt"
3
4
}
Original file line number Diff line number Diff line change
1
+ v1.1.0
2
+
3
+ There is now the option to add special contexts where overriding bracket types should be used. Use `Preferences: Wrap` in the command palette to open the settings file and do so.
Original file line number Diff line number Diff line change 5
5
class WrapCommand (sublime_plugin .TextCommand ):
6
6
def run (self , edit ):
7
7
settings = sublime .load_settings ("Wrap.sublime-settings" )
8
- a , b = settings .get ("bracket_type" , "()" )
8
+ extension = self .view .file_name ().split ("." )[- 1 ]
9
+
10
+ # Determine bracket type
11
+ for c in settings .get ("contexts" ):
12
+ if self .view .match_selector (self .view .sel ()[0 ].begin (), c .get ("scope" )) or extension in c .get ("extensions" ):
13
+ a , b = c .get ("bracket_type" , "()" )
14
+ break
15
+ else :
16
+ a , b = settings .get ("bracket_type" , "()" )
9
17
10
18
region = self .view .sel ()[0 ]
11
19
You can’t perform that action at this time.
0 commit comments