neovim / go-client

Nvim Go client
https://pkg.go.dev/github.com/neovim/go-client
Apache License 2.0
578 stars 36 forks source link

Support autocmd once #47

Open zchee opened 5 years ago

zchee commented 5 years ago

Currently, there is no Once field on AutocmdOptions. https://github.com/neovim/go-client/blob/805675898d92f6fc53018e83366ec9e58205c8ff/nvim/plugin/plugin.go#L277

But not works even if adding that field (on local env) I think should be support and change nvim core runtime/autoload/remote/define.vim.

https://github.com/neovim/neovim/blob/2a3bcd1ff883429a3dd17e7ae5ddc1396abbad17/runtime/autoload/remote/define.vim#L228

zchee commented 5 years ago

/cc @justinmk My Interpretation is correct?

justinmk commented 5 years ago

@zchee sure we could enhance remote/define.vim. But AFAIK remote/define.vim already manages autocmds as needed, so I don't know what the "once" feature would be used for. Does go-client have an API for defining generic autocmds?

zchee commented 5 years ago

@justinmk I will more detail comment later.

zchee commented 5 years ago

Just in case,

But AFAIK remote/define.vim already manages autocmds as needed

I said once feature means ++once arg on autocmd. https://github.com/neovim/neovim/commit/3259e45f926bcde4052e8b989e039f6047c2b205

The garyburd styles remote#host#Register usage for Go plugin is depends runtime/autoload/remote/host.vim.

Anyway, will comment later.

justinmk commented 5 years ago

I said once feature means ++once arg on autocmd.

Understood. But I don't see what it would be used for.

zchee commented 5 years ago

Just for confirm, in case of vim script, when register some func to CursorMoved autocmd with ++once, that func will called when only of first CursorMoved event, right?

mhinz commented 5 years ago

Yup, the autocmd gets removed after its first usage.

zchee commented 5 years ago

@mhinz Thanks, so describe to how to use in Go with pseudo code later.