Conversation
|
👍 |
I think I am currently leaning towards having a Also sorry for the extremely late reply, I kinda lost motivation to work on this for a while, but recently have gotten interested in Vim plugin API design again. I think my goal is to have the plugin behave a bit more like a "traditional" Vim plugin---if you like the defaults then you shouldn't need to invoke/setup anything (similar to |
|
I also realize that I'm not great at writing documentation (although I'm trying to improve!), so any advice on how to improve the help docs would be much appreciated |
This is in-line with `vim-surround`'s naming scheme.
setup optional.
In this feature/version upgrade, we make `setup` optional by decoupling initialization and configuration of `nvim-surround`. We leverage (Neo)Vim's built-in runtimepath lazy loading to initialize the plugin, defining the public API in the form of `<Plug>` maps. Configuration is still done via `setup`. Please see `:h nvim-surround.migrating.v3_to_v4` for details on how to update your configurations.
In this feature/version upgrade, we make `setup` optional by decoupling initialization and configuration of `nvim-surround`. We leverage (Neo)Vim's built-in runtimepath lazy loading to initialize the plugin, defining the public API in the form of `<Plug>` maps. Configuration is still done via `setup`. Please see `:h nvim-surround.migrating.v3_to_v4` for details on how to update your configurations.
|
Quick question: I've been using on-demand (not "lazy") loading via M = { 'kylechui/nvim-surround' }
M.config = true
M.keys = {
{ 'ds' },
{ 'cs' },
{ 'ys' },
{ 'yS' },
{ 'S', mode = 'v' },
}
return Mwhich (still) works nicely, so I thought I could delete the Not a huge deal thinks still work as before; just wanted to mention it since I thought this would be a goal here. |
|
Hmm that is not intended behavior at all; I'll take a look at why that might be the case. Thanks for flagging |
BREAKING CHANGE
EDIT: We will still use
setup(...)andbuffer_setupfor configuration, but initialization is now done out-of-the-box. As in,setupis no longer mandatory for the plugin to function.This commit will deprecate the existingsetupandbuffer_setupfunction calls, in line with this blog post. I believe that plugins, by default, should merely expose functionality but not actively modify user configuration at all. The goal is to have the installation script in the README contain the current "default" configuration, and any changes can be made by users directly. While this results in more code for the end user, I think that the reduced complexity and layers of abstraction will ultimately help users better understand the plugin and have more control for how it behaves.The changes will be:
setup(...)→vim.g.nvim_surroundbuffer_setup(...)→vim.b.nvim_surround