From 15e07d4db893aec7b9e117c1f88400a68ba98ae2 Mon Sep 17 00:00:00 2001 From: Skyler Hawthorne Date: Sat, 8 Oct 2022 18:14:49 -0400 Subject: 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. --- helix-view/src/editor.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'helix-view/src') 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, /// 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, +} + +#[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()), } } } -- cgit v1.2.3-70-g09d2