dstein64 / nvim-scrollview

A Neovim plugin that displays interactive vertical scrollbars and signs.
MIT License
563 stars 10 forks source link

Unable to disable nor choose which signs to enable #99

Closed gonviegas closed 1 year ago

gonviegas commented 1 year ago

signs_on_startup seems to not be working at all. Im on the lastest neovim release using lazy. This is my nvim-scrollview setup:

return {
  'dstein64/nvim-scrollview',
  config = function()
    require("scrollview").setup({
      excluded_filetypes = { 'NvimTree' },
      current_only = true,
      column = 1,
      signs_on_startup = {},
    })
  end
}
dstein64 commented 1 year ago

@gonviegas, is the issue resolved after 3138714544ad7b9c1cab77dc74238624dd16d9b9?

This sounds like the same issue encountered by @Fausto-Korpsvart.

Some of the plugin's functionality was being initialized asynchronously to work around Neovim #13720. I switched back to synchronous initialization in 23c4e10f5b84f33a4b3992d3ef8c16d4863f5ed1, since Neovim #13720 was resolved.

However, I'll keep the existing behavior if it prevents other issues, like the ones that you and @Fausto-Korpsvart are encountering. Unfortunately, a downside of asynchronous initialization is that some of the plugin's events will be omitted from the output when using nvim --startuptime, which could complicate profiling.

Fausto-Korpsvart commented 1 year ago

@gonviegas, is the issue resolved after 3138714?

This sounds like the same issue encountered by @Fausto-Korpsvart.

Some of the plugin's functionality was being initialized asynchronously to work around Neovim #13720. I switched back to synchronous initialization in 23c4e10, since Neovim #13720 was resolved.

However, I'll keep the existing behavior if it prevents other issues, like the ones that you and @Fausto-Korpsvart are encountering. Unfortunately, a downside of asynchronous initialization is that some of the plugin's events will be omitted from the output when using nvim --startuptime, which could complicate profiling.

@dstein64, I updated a moment ago and everything works normally again, even the folding icons are back too, I went back to the old configuration and everything works fine. Much appreciated. }:-]

gonviegas commented 1 year ago

@gonviegas, is the issue resolved after 3138714?

This sounds like the same issue encountered by @Fausto-Korpsvart.

Some of the plugin's functionality was being initialized asynchronously to work around Neovim #13720. I switched back to synchronous initialization in 23c4e10, since Neovim #13720 was resolved.

However, I'll keep the existing behavior if it prevents other issues, like the ones that you and @Fausto-Korpsvart are encountering. Unfortunately, a downside of asynchronous initialization is that some of the plugin's events will be omitted from the output when using nvim --startuptime, which could complicate profiling.

Yes, it's all working fine now, even setting to only folds like I like to have, works fine. Thank you!

dstein64 commented 1 year ago

I think I know what the issue was.

nvim-scrollview was implemented as a traditional Vim-style plugin, in VimScript.

At some point, it was ported to Lua, but the interface remained the same. It was still effectively a Vim-style plugin, using a plugin/ script for initialization, not a setup() function.

There was a request to transition to a Lua-style plugin. That would have broken the plugin for existing users and complicated configuration for users using init.vim instead of init.lua. I added a Lua setup() function for convenience, which effectively set the existing scrollview configuration global variables.

When configuring plugins with lazy.nvim, using something like the example above (repeated here) assumes the plugin is not a Vim-style plugin.

{
  'dstein64/nvim-scrollview',
  config = function()
    require("scrollview").setup({
      excluded_filetypes = { 'NvimTree' },
      current_only = true,
      column = 1,
      signs_on_startup = {},
    })
  end
}

The plugin/ scripts are executed prior to the config function. For the nvim-scrollview functionality that had to be set before plugin loading, this was problematic since the plugin/ script would execute but the configuration had not occurred yet.

A workaround would be to specify an init function for lazy.nvim instead of a config function (haven't tested). It looks like that is the approach recommended for traditional Vim-style plugins.

{
  'dstein64/nvim-scrollview',
  init = function()  -- this 'init' function was a 'config' function earlier
    require("scrollview").setup({
      excluded_filetypes = { 'NvimTree' },
      current_only = true,
      column = 1,
      signs_on_startup = {},
    })
  end
}

-- Or:

{
  'dstein64/nvim-scrollview',
  init = function()  -- this 'init' function was a 'config' function earlier
    vim.g.scrollview_excluded_filetypes = { 'NvimTree' },
    vim.g.scrollview_current_only = true,
    vim.g.scrollview_column = 1,
    vim.g.scrollview_signs_on_startup = {},
  end
}

Asynchronous configuration fixed the issue since it deferred the execution of some nvim-scrollview initialization until after the lazy.nvim config function ran. I will keep that approach, since it resolves the issue and won't require users to change from using config to init. However, a downside is that events will be omitted from nvim --startuptime's output. But events were already being omitted, since the same type of workaround had been used, until recently, to resolve another issue.

gonviegas commented 1 year ago

Ok. Thank you for the detailed info.