diff options
Diffstat (limited to 'helix-view/src')
-rw-r--r-- | helix-view/src/editor.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index b2615c9f..a9014fe7 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -306,6 +306,8 @@ pub struct Config { pub indent_guides: IndentGuidesConfig, /// Explorer configuration. pub explorer: ExplorerConfig, + /// The initial mode for newly opened editors. Defaults to `"normal"`. + pub initial_mode: Mode, /// Whether to color modes with different colors. Defaults to `false`. pub color_modes: bool, /// Whether to render rainbow highlights. Defaults to `false`. @@ -874,6 +876,7 @@ impl Default for Config { bufferline: BufferLine::default(), indent_guides: IndentGuidesConfig::default(), explorer: ExplorerConfig::default(), + initial_mode: Mode::Normal, color_modes: false, rainbow_brackets: false, soft_wrap: SoftWrap { @@ -1359,7 +1362,8 @@ impl Editor { return; } - self.enter_normal_mode(); + // this causes tree.rs to panic upon launch. todo: debug + // self.enter_normal_mode(); match action { Action::Replace => { @@ -1448,6 +1452,7 @@ impl Editor { /// Generate an id for a new document and register it. fn new_document(&mut self, mut doc: Document) -> DocumentId { + self.mode = self.config().initial_mode; let id = self.next_document_id; // Safety: adding 1 from 1 is fine, probably impossible to reach usize max self.next_document_id = |