On this gif
bellow I got some text unindented selected. Then I press tab to indent them. This is my tab command:
{ "keys": ["tab"], "command": "reindent", "context":
[
{ "key": "setting.auto_indent", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_match", "operand": "^$", "match_all": true },
{ "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true }
]
},
{ "keys": ["tab"], "command": "indent", "context":
[
{ "key": "text", "operator": "regex_contains", "operand": "\n" }
]
},
Now the indentation created on the first line is out of the selection bounds after the indent command:
Then I have to select them manually later, after the indentation.
- So, should be necessary write a package with a new indent command?
- Or is there some package which does this already?
Therefore pseudocode could be something like:
- Call default indent command to do the indentation, and
- Later select the spaces until find the start of the line, from the first cursor/caret.