folke / trouble.nvim

🚦 A pretty diagnostics, references, telescope results, quickfix and location list to help you solve all the trouble your code is causing.
Apache License 2.0
5.36k stars 175 forks source link

Feature: Option to prevent initial preview when opening Trouble #289

Closed yavorski closed 5 months ago

yavorski commented 1 year ago

Did you check the docs?

Is your feature request related to a problem? Please describe.

When opening Trouble I don't want to be distracted/frustrated by the first automatic auto_preview action.

Describe the solution you'd like

Would like to have an option to disable just the first/initial auto_preview when trouble is opening.

Describe alternatives you've considered

I am using the following autocmd to prevent the unwanted initial preview. This is moving the cursor at the top of Trouble window and somehow it is preventing the initial jump. Sadly it does not work for lsp_references, but it works for workspace_diagnostics.

{
  "folke/trouble.nvim",
  cmd = "Trouble",
  opts = {},
  init = function()
    -- prevent jump on open
    vim.api.nvim_create_autocmd("FileType", {
      pattern = "Trouble",
      callback = function()
        vim.api.nvim_feedkeys("gg", "n", true)
      end
    })
  end
}

Additional context

The auto_preview option is great, but I don't want it to be executed automatically when opening Trouble. I want to be able to execute it only when moving to the next/prev items in the list.

folke commented 5 months ago

Development on the main branch is EOL.

Trouble has been rewritten and will be merged in main soon.

This issue/feature either no longer exists or has been implemented on dev.

For more info, see https://github.com/folke/trouble.nvim/tree/dev