-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
164 changed files
with
23,817 additions
and
374 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// VimShareAction+Host.swift | ||
// iVim | ||
// | ||
// Created by Terry Chou on 12/26/19. | ||
// Copyright © 2019 Boogaloo. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
|
||
extension ShareAction { | ||
func removeData() { | ||
guard let key = self.userDefaultsKey else { return } | ||
UserDefaults.appGroup.removeObject(forKey: key) | ||
} | ||
|
||
func newWithText() { | ||
guard let text: String = self.getData() else { | ||
NSLog("failed to get text for \(self.name)") | ||
return | ||
} | ||
if !is_current_buf_new() { | ||
do_cmdline_cmd("tabnew") | ||
} | ||
do_cmdline_cmd("normal! i\(text)") | ||
gEnsureSuccessfulOpen() | ||
self.removeData() | ||
} | ||
} | ||
|
||
extension ShareTextAction { | ||
func run() { | ||
switch self { | ||
case .text: | ||
self.newWithText() | ||
} | ||
} | ||
} | ||
|
||
extension ShareFileAction { | ||
func run() { | ||
switch self { | ||
case .content: | ||
self.newWithText() | ||
} | ||
} | ||
} |
Oops, something went wrong.