diff --git a/SwiftNeoVim/NeoVimView+Key.swift b/SwiftNeoVim/NeoVimView+Key.swift index e9b28069..c442b55c 100644 --- a/SwiftNeoVim/NeoVimView+Key.swift +++ b/SwiftNeoVim/NeoVimView+Key.swift @@ -229,4 +229,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()