go-client icon indicating copy to clipboard operation
go-client copied to clipboard

Support autocmd once

Open zchee opened this issue 5 years ago • 8 comments

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 avatar May 06 '19 23:05 zchee

/cc @justinmk My Interpretation is correct?

zchee avatar May 06 '19 23:05 zchee

@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?

justinmk avatar May 07 '19 06:05 justinmk

@justinmk I will more detail comment later.

zchee avatar May 07 '19 08:05 zchee

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.

zchee avatar May 07 '19 08:05 zchee

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

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

justinmk avatar May 07 '19 08:05 justinmk

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?

zchee avatar May 07 '19 08:05 zchee

Yup, the autocmd gets removed after its first usage.

mhinz avatar May 07 '19 09:05 mhinz

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

zchee avatar May 07 '19 09:05 zchee