aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorSkyler Hawthorne2022-10-08 22:14:49 +0000
committerMichael Davis2023-08-01 14:41:42 +0000
commit15e07d4db893aec7b9e117c1f88400a68ba98ae2 (patch)
treef3d78f1904c596af44e79d0f850c33c3f518f2fb /helix-view
parent93acb538121cab36712f40f26fa287df93817de5 (diff)
feat: smart_tab
Implement `smart_tab`, which optionally makes the tab key run the `move_parent_node_start` command when the cursor has non- whitespace to its left.
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/editor.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 4ea1c49f..2152ff9b 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -287,6 +287,24 @@ pub struct Config {
pub workspace_lsp_roots: Vec<PathBuf>,
/// Which line ending to choose for new documents. Defaults to `native`. i.e. `crlf` on Windows, otherwise `lf`.
pub default_line_ending: LineEndingConfig,
+ /// Enables smart tab
+ pub smart_tab: Option<SmartTabConfig>,
+}
+
+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq, PartialOrd, Ord)]
+#[serde(rename_all = "kebab-case", default)]
+pub struct SmartTabConfig {
+ pub enable: bool,
+ pub supersede_menu: bool,
+}
+
+impl Default for SmartTabConfig {
+ fn default() -> Self {
+ SmartTabConfig {
+ enable: true,
+ supersede_menu: false,
+ }
+ }
}
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
@@ -820,6 +838,7 @@ impl Default for Config {
completion_replace: false,
workspace_lsp_roots: Vec::new(),
default_line_ending: LineEndingConfig::default(),
+ smart_tab: Some(SmartTabConfig::default()),
}
}
}