diff --git a/SwiftNeoVim/NeoVimView+Key.swift b/SwiftNeoVim/NeoVimView+Key.swift index dd0e3bfa..bd060231 100644 --- a/SwiftNeoVim/NeoVimView+Key.swift +++ b/SwiftNeoVim/NeoVimView+Key.swift @@ -247,4 +247,12 @@ extension NeoVimView { return nil } + + public func didBecomeMain() { + self.agent.vimInput("") + } + + public func didResignMain() { + self.agent.vimInput("") + } } diff --git a/VimR/MainWindow.swift b/VimR/MainWindow.swift index 1be2574f..dd2a284a 100644 --- a/VimR/MainWindow.swift +++ b/VimR/MainWindow.swift @@ -491,6 +491,14 @@ extension MainWindow { self.emit(self.uuidAction(for: .becomeKey)) } + func windowDidBecomeMain(_ notification: Notification) { + self.neoVimView.didBecomeMain() + } + + func windowDidResignMain(_ notification: Notification) { + self.neoVimView.didResignMain() + } + func windowShouldClose(_: Any) -> Bool { guard self.neoVimView.isCurrentBufferDirty() else { self.neoVimView.closeCurrentTab()