From 74d34ae12c8b5fc36714c103b9b04a0a035ccb52 Mon Sep 17 00:00:00 2001 From: Kyohei Uto Date: Sat, 20 Jan 2024 06:49:31 +0900 Subject: [PATCH] Add :config to jump to config file directory --- src/run.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/run.rs b/src/run.rs index 3402086..0362ad0 100644 --- a/src/run.rs +++ b/src/run.rs @@ -2137,6 +2137,33 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> { state.empty_trash(&screen)?; break 'command; } + "config" => { + //move to the directory that contains + //config path + state.layout.nums.reset(); + if let Some(ref config_path) = + state.config_path + { + if let Err(e) = state.chdir( + config_path + .clone() + .parent() + .unwrap(), + Move::Jump, + ) { + print_warning( + e, + state.layout.y, + ); + } + } else { + print_warning( + "Cannot find the config path.", + state.layout.y, + ) + } + break 'command; + } _ => {} } } else if commands.len() == 2 && command == "cd" {