@@ -52,7 +52,8 @@ func newNvim(cols, rows int, ctx context.Context) (signal *neovimSignal, redrawU
52
52
errCh <- nil
53
53
}
54
54
setVar (neovim )
55
- initGui (neovim )
55
+ setupGoneovim (neovim )
56
+ setupGoneovimCommands (neovim )
56
57
registerHandler (neovim , signal , redrawUpdates , guiUpdates )
57
58
attachUI (neovim , cols , rows )
58
59
@@ -429,19 +430,11 @@ func attachUIOption(nvim *nvim.Nvim) (int, map[string]interface{}) {
429
430
return channel , o
430
431
}
431
432
432
- func initGui (neovim * nvim.Nvim ) {
433
- guiInitScript := `
434
- aug GuiInit | au! | aug END
435
- au GuiInit VimEnter * call rpcnotify(g:goneovim_channel_id, "Gui", "gonvim_vimenter")
436
- `
437
- registerScripts := fmt .Sprintf (`call execute(%s)` , util .SplitVimscript (guiInitScript ))
438
- neovim .Command (registerScripts )
439
- }
440
-
441
433
func setupGoneovim (neovim * nvim.Nvim ) {
442
434
// autocmds that goneovim uses
443
435
gonvimAutoCmds := `
444
436
aug GoneovimCore | au! | aug END
437
+ au GoneovimCore VimEnter * call rpcnotify(g:goneovim_channel_id, "Gui", "gonvim_vimenter")
445
438
au GoneovimCore OptionSet * if &ro != 1 | silent! call rpcnotify(g:goneovim_channel_id, "Gui", "gonvim_optionset", expand("<amatch>"), v:option_new, v:option_old, win_getid()) | endif
446
439
au GoneovimCore BufEnter * call rpcnotify(g:goneovim_channel_id, "Gui", "gonvim_bufenter", win_getid())
447
440
au GoneovimCore TermEnter * call rpcnotify(g:goneovim_channel_id, "Gui", "gonvim_termenter")
@@ -458,7 +451,9 @@ func setupGoneovim(neovim *nvim.Nvim) {
458
451
}
459
452
registerScripts := fmt .Sprintf (`call execute(%s)` , util .SplitVimscript (gonvimAutoCmds ))
460
453
neovim .Command (registerScripts )
454
+ }
461
455
456
+ func setupGoneovimCommands (neovim * nvim.Nvim ) {
462
457
// Definition of the commands that goneovim provides
463
458
gonvimCommands := fmt .Sprintf (`
464
459
command! -nargs=1 GonvimResize call rpcnotify(g:goneovim_channel_id, "Gui", "gonvim_resize", <args>)
@@ -492,9 +487,11 @@ func setupGoneovim(neovim *nvim.Nvim) {
492
487
command! GonvimIndentguide call rpcnotify(g:goneovim_channel_id, "Gui", "gonvim_indentguide")
493
488
command! -nargs=? GonvimMousescrollUnit call rpcnotify(g:goneovim_channel_id, "Gui", "gonvim_mousescroll_unit", <args>)
494
489
`
495
- registerScripts = fmt .Sprintf (`call execute(%s)` , util .SplitVimscript (gonvimCommands ))
490
+ registerScripts : = fmt .Sprintf (`call execute(%s)` , util .SplitVimscript (gonvimCommands ))
496
491
neovim .Command (registerScripts )
492
+ }
497
493
494
+ func setupGoneovimClipBoard (neovim * nvim.Nvim ) {
498
495
code := `
499
496
local function set_clipboard(register)
500
497
return function(lines, regtype)
0 commit comments