Skip to content

Commit

Permalink
Improve executing ginitvim
Browse files Browse the repository at this point in the history
  • Loading branch information
akiyosi committed May 27, 2022
1 parent ba31c2c commit 1981682
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions editor/editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,9 @@ func (e *Editor) setFont() {
e.app.SetFont(gui.NewQFont2(e.extFontFamily, e.extFontSize, 1, false), "QLabel")
}

// pushNotification is
// level: notify level
// period: display period
func (e *Editor) pushNotification(level NotifyLevel, p int, message string, opt ...NotifyOptionArg) {
a := NotifyOptions{}
for _, o := range opt {
Expand Down
8 changes: 5 additions & 3 deletions editor/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -818,9 +818,11 @@ func (w *Workspace) initGonvim() {

func (w *Workspace) loadGinitVim() {
if editor.config.Editor.GinitVim != "" {
scripts := strings.NewReplacer(`'`, `''`, "\r\n", "\n", "\r", "\n", "\n", "\n").Replace(editor.config.Editor.GinitVim)
execGinitVim := fmt.Sprintf(`call execute(split('%s', '\n'))`, scripts)
w.nvim.Command(execGinitVim)
var result bool
_, err := w.nvim.Exec(editor.config.Editor.GinitVim, result)
if err != nil {
editor.pushNotification(NotifyWarn, 0, "An error occurs while processing Vimscript in Ginitvim.\n"+err.Error(), notifyOptionArg([]*NotifyButton{}))
}
}
}

Expand Down

0 comments on commit 1981682

Please sign in to comment.