1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-25 23:02:35 +03:00

GH-376 Fix paste

This commit is contained in:
Tae Won Ha 2017-01-07 20:17:50 +01:00
parent 964dc69459
commit f004165e90
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44

View File

@ -729,6 +729,11 @@ extension NeoVimView {
return
}
if self.mode == .Cmdline || self.mode == .Replace || self.mode == .Term {
self.agent.vimInput(self.vimPlainString(content))
return
}
guard let curPasteMode = self.agent.boolOption("paste") else {
self.ipcBecameInvalid("Reason: 'set paste' failed")
return
@ -743,17 +748,15 @@ extension NeoVimView {
pasteModeSet = false
}
let resetPasteModeCmd = pasteModeSet ? ":set nopaste<CR>" : ""
switch self.mode {
case .Insert:
self.agent.vimInput("<ESC>\"+pa")
case .Cmdline, .Replace, .Term:
self.agent.vimInput(self.vimPlainString(content))
self.agent.vimInput("<ESC>\"+p\(resetPasteModeCmd)a")
case .Normal, .Visual:
self.agent.vimInput("\"+p")
}
if pasteModeSet {
self.agent.setBoolOption("paste", to: curPasteMode.boolValue)
self.agent.vimInput("\"+p\(resetPasteModeCmd)")
default:
return
}
}