From 5def324265f7ddc961fdbde76daa6b53ef1b8744 Mon Sep 17 00:00:00 2001 From: Vivianne Date: Mon, 21 Mar 2022 03:23:13 -0700 Subject: [PATCH] Add neovide_confirm_quit option to confirm before quitting (#1247) * Add g:neovide_confirm_quit which will ask before quitting * more compact * cargo fmt --- src/bridge/ui_commands.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bridge/ui_commands.rs b/src/bridge/ui_commands.rs index b5c9d22..08611fb 100644 --- a/src/bridge/ui_commands.rs +++ b/src/bridge/ui_commands.rs @@ -127,7 +127,11 @@ impl ParallelCommand { async fn execute(self, nvim: &Neovim) { match self { ParallelCommand::Quit => { - nvim.command("qa!").await.ok(); + nvim.command( + "if get(g:, 'neovide_confirm_quit', 0) == 1 | confirm qa | else | qa! | endif", + ) + .await + .ok(); } ParallelCommand::Resize { width, height } => nvim .ui_try_resize(width.max(10) as i64, height.max(3) as i64)