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: Trouble windows should set winfixbuf #593

Open
4 tasks done
dlyongemallo opened this issue Oct 23, 2024 · 2 comments
Open
4 tasks done

bug: Trouble windows should set winfixbuf #593

dlyongemallo opened this issue Oct 23, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@dlyongemallo
Copy link

dlyongemallo commented Oct 23, 2024

Did you check docs and existing issues?

  • I have read all the trouble.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of trouble.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

v0.10.0

Operating system/version

Ubuntu 22.04

Describe the bug

Trouble's special windows do not set winfixbuf. In particular, when in the qflist window, using :cnext or :cprev results in a Cursor position outside buffer error (whereas neovim's own copen/cfile window handles this perfectly fine).

Steps To Reproduce

  1. nvim -u repro.lua
  2. :cfile cfile.txt (attached cfile.txt)
  3. :copen, switch to this window
  4. :cnext, works perfectly fine
  5. :Trouble qflist toggle, switch to the Trouble window
  6. :cnext, results in error

Expected Behavior

:cnext and :cprev should work as if in the native copen window.

Note: If :set winfixbuf is used inside the Trouble window, then :cnext and :cprev work as expected.

Repro

-- use vim-plug
local vim = vim
local Plug = vim.fn['plug#']

vim.call('plug#begin')
Plug('folke/trouble.nvim')
vim.call('plug#end')
require("trouble").setup()
@dlyongemallo dlyongemallo added the bug Something isn't working label Oct 23, 2024
@jonsmithers
Copy link

jonsmithers commented Oct 25, 2024

I also encounter this issue (Cursor position outside buffer errors) when I mess with the windows while Trouble is open. Specifically if I close every window except the trouble window using <c-w>o, and then press enter to jump to the selected diagnostic.

If I set winfixbuf in the Trouble window as suggested above, I instead see a single error Cannot switch buffer. 'winfixbuf' is enabled.

@dlyongemallo
Copy link
Author

If anyone else has the same problem, I worked around this by putting the following in my ~/.config/nvim/after/ftplugin/trouble.lua:

vim.keymap.set('n', ']q', 'j', { buffer = 0, noremap = true, silent = true })
vim.keymap.set('n', '[q', 'k', { buffer = 0, noremap = true, silent = true })

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

No branches or pull requests

2 participants