diff --git a/README.md b/README.md index 56e7d4f2..b939caac 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,9 @@ And others I forgot about... # Applied Changes - Changed opening the window popup from `ctrl + w` to `ctrl + v` -- Added an auto select for files in the tree explorer when jumping through opened buffers +- Added an auto highlight for files in the tree explorer when jumping through opened buffers - Changed some default settings (enabling bufferline, indent guides, the embedded explorer, cursor modes etc.) +- Added a `--show-explorer` cli flag to open the file explorer on startup (useful for embedded explorer mode) - - - diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index cd499f1c..8dd4f1ed 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -12,11 +12,11 @@ use serde_json::json; use crate::{ args::Args, commands::apply_workspace_edit, - compositor::{Compositor, Event}, + compositor::{self, Compositor, Event}, config::Config, job::Jobs, keymap::Keymaps, - ui::{self, overlay::overlayed}, + ui::{self, overlay::overlayed, Explorer}, }; use log::{error, warn}; @@ -153,7 +153,19 @@ impl Application { let keys = Box::new(Map::new(Arc::clone(&config), |config: &Config| { &config.keys })); - let editor_view = Box::new(ui::EditorView::new(Keymaps::new(keys))); + let mut editor_view = Box::new(ui::EditorView::new(Keymaps::new(keys))); + + if args.show_explorer { + let mut jobs = Jobs::new(); + let mut context = compositor::Context { + editor: &mut editor, + scroll: None, + jobs: &mut jobs, + }; + let mut explorer = Explorer::new(&mut context)?; + explorer.unfocus(); + editor_view.explorer = Some(overlayed(explorer)); + } compositor.push(editor_view); if args.load_tutor { diff --git a/helix-term/src/args.rs b/helix-term/src/args.rs index 48c86633..b72e9172 100644 --- a/helix-term/src/args.rs +++ b/helix-term/src/args.rs @@ -17,6 +17,7 @@ pub struct Args { pub log_file: Option, pub config_file: Option, pub files: Vec<(PathBuf, Position)>, + pub show_explorer: bool, } impl Args { @@ -32,6 +33,7 @@ impl Args { "--version" => args.display_version = true, "--help" => args.display_help = true, "--tutor" => args.load_tutor = true, + "--show-explorer" => args.show_explorer = true, "--vsplit" => args.split = Some(Layout::Vertical), "--hsplit" => args.split = Some(Layout::Horizontal), "--health" => { diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs index 726bf9e3..6f69e318 100644 --- a/helix-term/src/main.rs +++ b/helix-term/src/main.rs @@ -72,6 +72,7 @@ FLAGS: -V, --version Prints version information --vsplit Splits all given files vertically into different windows --hsplit Splits all given files horizontally into different windows + --show-explorer Opens the explorer on startup ", env!("CARGO_PKG_NAME"), env!("VERSION_AND_GIT_HASH"),