mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-24 03:25:03 +03:00
Adapt to RxSwift 6.2
This commit is contained in:
parent
d558d2c4cc
commit
7093d96b0f
@ -36,7 +36,7 @@ public extension NvimView {
|
|||||||
self.api
|
self.api
|
||||||
.getCurrentBuf()
|
.getCurrentBuf()
|
||||||
.flatMap { self.neoVimBuffer(for: $0, currentBuffer: $0) }
|
.flatMap { self.neoVimBuffer(for: $0, currentBuffer: $0) }
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func allBuffers() -> Single<[NvimView.Buffer]> {
|
func allBuffers() -> Single<[NvimView.Buffer]> {
|
||||||
@ -46,14 +46,14 @@ public extension NvimView {
|
|||||||
self.neoVimBuffer(for: buf, currentBuffer: tuple.curBuf)
|
self.neoVimBuffer(for: buf, currentBuffer: tuple.curBuf)
|
||||||
} }
|
} }
|
||||||
.flatMap(Single.fromSinglesToSingleOfArray)
|
.flatMap(Single.fromSinglesToSingleOfArray)
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func isCurrentBufferDirty() -> Single<Bool> {
|
func isCurrentBufferDirty() -> Single<Bool> {
|
||||||
self
|
self
|
||||||
.currentBuffer()
|
.currentBuffer()
|
||||||
.map(\.isDirty)
|
.map(\.isDirty)
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func allTabs() -> Single<[NvimView.Tabpage]> {
|
func allTabs() -> Single<[NvimView.Tabpage]> {
|
||||||
@ -68,13 +68,13 @@ public extension NvimView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.flatMap(Single.fromSinglesToSingleOfArray)
|
.flatMap(Single.fromSinglesToSingleOfArray)
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newTab() -> Completable {
|
func newTab() -> Completable {
|
||||||
self.api
|
self.api
|
||||||
.command(command: "tabe")
|
.command(command: "tabe")
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func open(urls: [URL]) -> Completable {
|
func open(urls: [URL]) -> Completable {
|
||||||
@ -96,13 +96,13 @@ public extension NvimView {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func openInNewTab(urls: [URL]) -> Completable {
|
func openInNewTab(urls: [URL]) -> Completable {
|
||||||
Completable
|
Completable
|
||||||
.concat(urls.map { url in self.open(url, cmd: "tabe") })
|
.concat(urls.map { url in self.open(url, cmd: "tabe") })
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func openInCurrentTab(url: URL) -> Completable {
|
func openInCurrentTab(url: URL) -> Completable {
|
||||||
@ -112,13 +112,13 @@ public extension NvimView {
|
|||||||
func openInHorizontalSplit(urls: [URL]) -> Completable {
|
func openInHorizontalSplit(urls: [URL]) -> Completable {
|
||||||
Completable
|
Completable
|
||||||
.concat(urls.map { url in self.open(url, cmd: "sp") })
|
.concat(urls.map { url in self.open(url, cmd: "sp") })
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func openInVerticalSplit(urls: [URL]) -> Completable {
|
func openInVerticalSplit(urls: [URL]) -> Completable {
|
||||||
Completable
|
Completable
|
||||||
.concat(urls.map { url in self.open(url, cmd: "vsp") })
|
.concat(urls.map { url in self.open(url, cmd: "vsp") })
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func select(buffer: NvimView.Buffer) -> Completable {
|
func select(buffer: NvimView.Buffer) -> Completable {
|
||||||
@ -132,7 +132,7 @@ public extension NvimView {
|
|||||||
|
|
||||||
return self.api.command(command: "tab sb \(buffer.handle)")
|
return self.api.command(command: "tab sb \(buffer.handle)")
|
||||||
}
|
}
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func goTo(line: Int) -> Completable {
|
func goTo(line: Int) -> Completable {
|
||||||
@ -143,37 +143,37 @@ public extension NvimView {
|
|||||||
func closeCurrentTab() -> Completable {
|
func closeCurrentTab() -> Completable {
|
||||||
self.api
|
self.api
|
||||||
.command(command: "q")
|
.command(command: "q")
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func saveCurrentTab() -> Completable {
|
func saveCurrentTab() -> Completable {
|
||||||
self.api
|
self.api
|
||||||
.command(command: "w")
|
.command(command: "w")
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func saveCurrentTab(url: URL) -> Completable {
|
func saveCurrentTab(url: URL) -> Completable {
|
||||||
self.api
|
self.api
|
||||||
.command(command: "w \(url.path)")
|
.command(command: "w \(url.path)")
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func closeCurrentTabWithoutSaving() -> Completable {
|
func closeCurrentTabWithoutSaving() -> Completable {
|
||||||
self.api
|
self.api
|
||||||
.command(command: "q!")
|
.command(command: "q!")
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func quitNeoVimWithoutSaving() -> Completable {
|
func quitNeoVimWithoutSaving() -> Completable {
|
||||||
self.api
|
self.api
|
||||||
.command(command: "qa!")
|
.command(command: "qa!")
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func vimOutput(of command: String) -> Single<String> {
|
func vimOutput(of command: String) -> Single<String> {
|
||||||
self.api
|
self.api
|
||||||
.exec(src: command, output: true)
|
.exec(src: command, output: true)
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func cursorGo(to position: Position) -> Completable {
|
func cursorGo(to position: Position) -> Completable {
|
||||||
@ -182,7 +182,7 @@ public extension NvimView {
|
|||||||
.flatMapCompletable { curWin in
|
.flatMapCompletable { curWin in
|
||||||
self.api.winSetCursor(window: curWin, pos: [position.row, position.column])
|
self.api.winSetCursor(window: curWin, pos: [position.row, position.column])
|
||||||
}
|
}
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func didBecomeMain() -> Completable { self.bridge.focusGained(true) }
|
func didBecomeMain() -> Completable { self.bridge.focusGained(true) }
|
||||||
@ -217,13 +217,13 @@ public extension NvimView {
|
|||||||
isListed: listed
|
isListed: listed
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func open(_ url: URL, cmd: String) -> Completable {
|
private func open(_ url: URL, cmd: String) -> Completable {
|
||||||
self.api
|
self.api
|
||||||
.command(command: "\(cmd) \(url.path)")
|
.command(command: "\(cmd) \(url.path)")
|
||||||
.subscribeOn(self.scheduler)
|
.subscribe(on:self.scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func neoVimWindow(
|
private func neoVimWindow(
|
||||||
|
Loading…
Reference in New Issue
Block a user