Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Respect config during initialization #270

Open
1 task done
jemag opened this issue Dec 21, 2024 · 3 comments · May be fixed by #271
Open
1 task done

[Bug]: Respect config during initialization #270

jemag opened this issue Dec 21, 2024 · 3 comments · May be fixed by #271
Assignees
Labels
bug Something isn't working

Comments

@jemag
Copy link

jemag commented Dec 21, 2024

Similar Issues

  • Before filing, I have searched for similar issues.

Neovim Version

NVIM v0.11.0-dev-1369+gb03e790cdd

Multiplexer Integration

tmux

Multiplexer Version

tmux 3.5a

Steps to Reproduce

  1. Create config for smart-splits.nvim
  2. Open neovim and notice config is ignored at initialization

Expected Behavior

Config is respected

Actual Behavior

Config is ignored

Minimal Configuration to Reproduce

See additional details.

Additional Details and/or Screenshots

Currently increasing the log_level or disabling the multiplexer_integration is ignored during the initialization phase, as the user config is only loaded afterwards.

For example, this config

require('smart-splits').setup({
  -- enable or disable the tmux Integration
  multiplexer_integration = false,
  log_level = 'error',
  cursor_follows_swapped_bufs = true,
})

Will not be respected on initial loading of neovim.

This causes issues where despite increasing the log_level and disabling the multiplexer_integration, I will still receive error messages based on the tmux integration (which I do not wish to use).
In my case, I use the following for quick editing of tmux scroll back buffer in neovim

bind-key e 'capture-pane -JS -1000 ; save-buffer ~/tmux.history ; delete-buffer; display-popup -h 75% -w 75% -E $EDITOR ~/tmux.history'

However this will always trigger an annoying logging message since initially the config is ignored and tmux is initialized. Basically tmux init happens before config is loaded. Here is the sequence of event when loading the scrollback buffer:

DEBUGPRINT[7]: init.lua:41: require('smart-splits.config').log_level="info"
DEBUGPRINT[7]: init.lua:41: require('smart-splits.config').log_level="info"
[smart-splits.nvim] 
tmux init: could not detect pane ID!
DEBUGPRINT[8]: config.lua:114: new_config={
  cursor_follows_swapped_bufs = true,
  log_level = "error",
  multiplexer_integration = false
}

It would be great if the config can be respected and prevent tmux initialization and therefore error message.

@jemag jemag added the bug Something isn't working label Dec 21, 2024
@mrjones2014
Copy link
Owner

Does #271 solve your issue? Basically uses the VimEnter autocmd so that (hopefully) your setup() call happens before the rest of the init logic.

@jemag
Copy link
Author

jemag commented Dec 21, 2024

unfortunately it does not:
image
would it not be possible to simply initialize it after setup is called?

Is this so that users are not required to call the setup function?

@mrjones2014
Copy link
Owner

Yeah, the idea is so that you don't necessarily need to call setup() . I'm potentially willing to revisit that, but I'll need to put more thought into it since it would be a breaking change.

Likely won't get to it till after christmas since I'm at my parents' house till then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants