This commit is contained in:
sxyazi 2023-10-05 21:30:31 +08:00
parent a02086ab00
commit 313bee78b8
No known key found for this signature in database
2 changed files with 15 additions and 17 deletions

View file

@ -42,19 +42,17 @@ impl App {
} }
fn dispatch_quit(&mut self, no_cwd_file: bool) { fn dispatch_quit(&mut self, no_cwd_file: bool) {
if !no_cwd_file { if let Some(p) = BOOT.cwd_file.as_ref().filter(|_| !no_cwd_file) {
if let Some(p) = &BOOT.cwd_file { let cwd = self.cx.manager.cwd().as_os_str();
let cwd = self.cx.manager.cwd().as_os_str();
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
{ {
std::fs::write(p, cwd.to_string_lossy().as_bytes()).ok(); std::fs::write(p, cwd.to_string_lossy().as_bytes()).ok();
} }
#[cfg(not(target_os = "windows"))] #[cfg(not(target_os = "windows"))]
{ {
use std::os::unix::ffi::OsStrExt; use std::os::unix::ffi::OsStrExt;
std::fs::write(p, cwd.as_bytes()).ok(); std::fs::write(p, cwd.as_bytes()).ok();
}
} }
} }
} }

View file

@ -1,11 +1,11 @@
[manager] [manager]
keymap = [ keymap = [
{ on = [ "<Esc>" ], exec = "escape", desc = "Exit visual mode, clear selected, or cancel search" }, { on = [ "<Esc>" ], exec = "escape", desc = "Exit visual mode, clear selected, or cancel search" },
{ on = [ "q" ], exec = "quit", desc = "Exit the process" }, { on = [ "q" ], exec = "quit", desc = "Exit the process" },
{ on = [ "Q" ], exec = "quit --no-cwd-file", desc = "Exit the process without writing the current directory to cwd-file" }, { on = [ "Q" ], exec = "quit --no-cwd-file", desc = "Exit the process without writing cwd-file" },
{ on = [ "<C-q>" ], exec = "close", desc = "Close the current tab, or quit if it is last tab" }, { on = [ "<C-q>" ], exec = "close", desc = "Close the current tab, or quit if it is last tab" },
{ on = [ "<C-z>" ], exec = "suspend", desc = "Suspend the process" }, { on = [ "<C-z>" ], exec = "suspend", desc = "Suspend the process" },
# Navigation # Navigation
{ on = [ "k" ], exec = "arrow -1", desc = "Move cursor up" }, { on = [ "k" ], exec = "arrow -1", desc = "Move cursor up" },