A
A
Artur Masloboev2016-08-23 18:11:07
Sublime Text
Artur Masloboev, 2016-08-23 18:11:07

Where can I set up parentheses?

Hello. The transfer of round brackets to st3 is done like this:
c6a435ed0e.png
And curly brackets are like this:
f5e1e88fb4.png
Obviously, the second option is much more convenient, and I would like to do the same for round brackets.
Maybe someone knows in which direction to dig? In what files are these settings hidden?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artur Masloboev, 2016-08-23
@arthurmasl

As usual, I find the answer myself. Who cares:
Key Bindings - User, add:

{ "keys": ["enter"], "command": "run_macro_file", "args": {"file": "Packages/User/[ИМЯ ВАШЕГО ФАЙЛА].sublime-macro"}, "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 }
        ]
    }

Next, create a macro file in AppData/Roaming/..st3/Packages/User/[FILE NAME].sublime-macro
File contents:
[
  {"args": { "characters": "\n" }, "command": "insert"},
  {"args": null, "command": "left_delete"},
  {"args": null, "command": "left_delete"},
  {"args": null, "command": "left_delete"},
  {"args": null, "command": "left_delete"},
  {"args": { "characters": "\n" },"command": "insert"},
  {"args": { "by": "lines", "forward": false}, "command": "move"},
  {"args": null, "command": "reindent"},
  {"args": null, "command": "left_delete"},
  {"args": null, "command": "left_delete"},
  {"args": null, "command": "left_delete"}
]

The macro is not perfect, I did it for myself. If it doesn't work for you, write your own.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question