Skip to content

Commit 820c18f

Browse files
authored
Clean up settings handling (#140)
- Use sublime_lib.NamedSettingsDict to handle settings - apart from `trailing_spaces_highlight_color` which has special handling, get all options directly from settings so that they are always up-to-date with user preferences. Previously settings were only read on init. - remove `trailing_spaces_` prefixes from settings. Settings with prefixes are still respected for backward-compatibility.
1 parent ea3ff98 commit 820c18f

File tree

5 files changed

+101
-127
lines changed

5 files changed

+101
-127
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.mypy_cache
22
TODO.md
3+
*.pyc

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ You may change the highlighting color, providing a color scope name such as
131131
"error", "comment"… just like that:
132132

133133
``` js
134-
{ "trailing_spaces_highlight_color": "comment" }
134+
{ "highlight_color": "comment" }
135135
```
136136

137137
The scope should be defined in your current theme file. Here is a dummy,
@@ -164,7 +164,7 @@ You can make trailing spaces "invisible" yet still rely on the deletion
164164
command. To do that, set the highlight scope to an empty string:
165165

166166
``` js
167-
{ "trailing_spaces_highlight_color": "" }
167+
{ "highlight_color": "" }
168168
```
169169

170170
Beware: this is **not** the same as *disabling* the highlighting (see "On-
@@ -181,7 +181,7 @@ each time you are about to start a new word, the space you type is matched as
181181
a trailing spaces. Currently edited line can thus be ignored:
182182

183183
``` js
184-
{ "trailing_spaces_include_current_line": false }
184+
{ "include_current_line": false }
185185
```
186186

187187
Even though the trailing spaces are not highlighted on this line, they are
@@ -195,7 +195,7 @@ When firing the deletion command, empty lines are matched as trailing regions,
195195
and end up being deleted. You can specifically ignore them:
196196

197197
``` js
198-
{ "trailing_spaces_include_empty_lines": false }
198+
{ "include_empty_lines": false }
199199
```
200200

201201
They will not be highlighted either.
@@ -216,7 +216,7 @@ regions. You may either:
216216
- specify as a setting:
217217

218218
``` js
219-
{ "trailing_spaces_modified_lines_only": true }
219+
{ "modified_lines_only": true }
220220
```
221221

222222
There is also a command to toggle this feature on and off. You may thus define
@@ -234,7 +234,7 @@ Setting this to `true` will ensure trailing spaces are deleted when you save
234234
your document. It abides by the other settings, such as *Modified Lines Only*.
235235

236236
``` js
237-
{ "trailing_spaces_trim_on_save": true }
237+
{ "trim_on_save": true }
238238
```
239239

240240
### Save After Trim
@@ -246,7 +246,7 @@ around could prove useful. Setting this to `true` will automatically save your
246246
document after you fire the deletion command:
247247

248248
``` js
249-
{ "trailing_spaces_save_after_trim": true }
249+
{ "save_after_trim": true }
250250
```
251251

252252
It is obviously ignored if *Trim On Save* is on.
@@ -265,7 +265,7 @@ to cause slowness (for instance, you already installed several *heavy*
265265
plugins), you can disable live matching:
266266

267267
``` js
268-
{ "trailing_spaces_enabled": false }
268+
{ "enabled": false }
269269
```
270270

271271
In this case, for no trailing regions are matched until you request them to be
@@ -291,7 +291,7 @@ By default, the scope under the mouse cursor is shown by pressing
291291

292292
``` js
293293
// Trailing spaces for find results, build output and markdown are ignored
294-
{ "trailing_spaces_scope_ignore": ["text.find-in-files", "source.build_output", "text.html.markdown"] }
294+
{ "scope_ignore": ["text.find-in-files", "source.build_output", "text.html.markdown"] }
295295
```
296296

297297
### For power-users only!
@@ -303,7 +303,7 @@ The default threshold is around 1 million of characters. This is
303303
configurable (in "File Settings - User") and the unit is number of chars:
304304

305305
``` js
306-
{ "trailing_spaces_file_max_size": 1000}
306+
{ "file_max_size": 1000}
307307
```
308308

309309
#### The matching pattern
@@ -316,7 +316,7 @@ to abide by another definition to cover edge-cases, go ahead:
316316

317317
``` js
318318
// *danger* will match newline chars and many other folks
319-
"trailing_spaces_regexp": "[\\s]+"
319+
"regexp": "[\\s]+"
320320
```
321321

322322
About Sublime Text's built-in features

dependencies.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"*": {
3+
"*": [
4+
"sublime_lib"
5+
]
6+
}
7+
}

0 commit comments

Comments
 (0)