mirror of
https://github.com/helix-editor/helix.git
synced 2024-09-11 18:58:00 +03:00
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.
This commit is contained in:
parent
641255ccc8
commit
5b1a628e81
@ -1,11 +1,11 @@
|
||||
| Language | Syntax Highlighting | Treesitter Textobjects | Auto Indent | Default LSP |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| bash | ✓ | | | `bash-language-server` |
|
||||
| c | ✓ | | | `clangd` |
|
||||
| c | ✓ | ✓ | ✓ | `clangd` |
|
||||
| c-sharp | ✓ | | | |
|
||||
| cmake | ✓ | ✓ | ✓ | `cmake-language-server` |
|
||||
| comment | ✓ | | | |
|
||||
| cpp | ✓ | | | `clangd` |
|
||||
| cpp | ✓ | ✓ | ✓ | `clangd` |
|
||||
| css | ✓ | | | |
|
||||
| dart | ✓ | | ✓ | `dart` |
|
||||
| dockerfile | ✓ | | | `docker-langserver` |
|
||||
|
16
runtime/queries/c/indents.toml
Normal file
16
runtime/queries/c/indents.toml
Normal file
@ -0,0 +1,16 @@
|
||||
indent = [
|
||||
"compound_statement",
|
||||
"field_declaration_list",
|
||||
"enumerator_list",
|
||||
"parameter_list",
|
||||
"init_declarator",
|
||||
"case_statement",
|
||||
"condition_clause",
|
||||
"expression_statement",
|
||||
]
|
||||
|
||||
outdent = [
|
||||
"case",
|
||||
"}",
|
||||
"]",
|
||||
]
|
13
runtime/queries/c/textobjects.scm
Normal file
13
runtime/queries/c/textobjects.scm
Normal file
@ -0,0 +1,13 @@
|
||||
(function_definition
|
||||
body: (_) @function.inside) @function.around
|
||||
|
||||
(struct_specifier
|
||||
body: (_) @class.inside) @class.around
|
||||
|
||||
(enum_specifier
|
||||
body: (_) @class.inside) @class.around
|
||||
|
||||
(union_specifier
|
||||
body: (_) @class.inside) @class.around
|
||||
|
||||
(parameter_declaration) @parameter.inside
|
17
runtime/queries/cpp/indents.toml
Normal file
17
runtime/queries/cpp/indents.toml
Normal file
@ -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",
|
||||
"}",
|
||||
"]",
|
||||
]
|
7
runtime/queries/cpp/textobjects.scm
Normal file
7
runtime/queries/cpp/textobjects.scm
Normal file
@ -0,0 +1,7 @@
|
||||
; inherits: c
|
||||
|
||||
(lambda_expression
|
||||
body: (_) @function.inside) @function.around
|
||||
|
||||
(class_specifier
|
||||
body: (_) @class.inside) @class.around
|
Loading…
Reference in New Issue
Block a user