S
S
Shimpanze2017-11-27 08:00:42
Sublime Text
Shimpanze, 2017-11-27 08:00:42

How to change SublimeText settings?

Good afternoon!
Please tell me how to change the SublimeText settings so that when creating a CSS rule, the closing curly brace does not wrap to the next line, but stays on the same line as the last property written. I don't remember what this style is called.
Now like this:

p {
  color: blue;
  font-size: 16px;
}

... but it should be like this:
p {
  color: blue;
  font-size: 16px; }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Karagodnikov, 2017-11-27
@Shimpanze

Go to the menu item Preferences - Key Bindings and place the following code in the User section:

{ "keys": ["enter"], "command": "insert", "args": {"characters": "\n\t"}, "context":
  [
    { "key": "setting.auto_indent", "operator": "equal", "operand": true },
    { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
    { "key": "preceding_text", "operator": "regex_contains", "operand": "\\{$", "match_all": true },
    { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true },
    { "key": "selector", "operator": "equal", "operand": "source.css" }
  ]
}

This change will lead to the fact that after pressing the enter key in the css file, in addition to line breaks, a tab character will be added. When clicked, the {behavior will be similar. As in the case of empty brackets:
.test {
  }

So in the case of automatic bracket substitution:
.test // нажимаем здесь {
  width: 40px;

.test {
  width: 40px;} // автоматически подставляется }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question