diff options
author | Sebastian Neubauer | 2022-01-04 01:53:04 +0000 |
---|---|---|
committer | GitHub | 2022-01-04 01:53:04 +0000 |
commit | 5b1a628e81b7d2f198ef401d442ca7967c5a0135 (patch) | |
tree | 380f8a9f0b61d2c5945496458821c73ec285de98 /runtime/queries/cpp | |
parent | 641255ccc83648d164bf6e8e8e4e93460591830b (diff) |
Add textobjects and indents to c and cpp (#1293)
Indentation of single line statements doesn't work, i.e.
for (;;)<hit enter>
leads to
for(;;)
<cursor here>
Only blocks with curly braces are indented.
Diffstat (limited to 'runtime/queries/cpp')
-rw-r--r-- | runtime/queries/cpp/indents.toml | 17 | ||||
-rw-r--r-- | runtime/queries/cpp/textobjects.scm | 7 |
2 files changed, 24 insertions, 0 deletions
diff --git a/runtime/queries/cpp/indents.toml b/runtime/queries/cpp/indents.toml new file mode 100644 index 00000000..0ca2ed8b --- /dev/null +++ b/runtime/queries/cpp/indents.toml @@ -0,0 +1,17 @@ +indent = [ + "compound_statement", + "field_declaration_list", + "enumerator_list", + "parameter_list", + "init_declarator", + "case_statement", + "condition_clause", + "expression_statement", +] + +outdent = [ + "case", + "access_specifier", + "}", + "]", +] diff --git a/runtime/queries/cpp/textobjects.scm b/runtime/queries/cpp/textobjects.scm new file mode 100644 index 00000000..6e3de1a2 --- /dev/null +++ b/runtime/queries/cpp/textobjects.scm @@ -0,0 +1,7 @@ +; inherits: c + +(lambda_expression + body: (_) @function.inside) @function.around + +(class_specifier + body: (_) @class.inside) @class.around |