Trouble Nvim

Published Feb 1, 2024 Revision: 1 · marker

Somehow I have had this handy plugin installed for months without actually using it. After becoming familiar with quickfix(/posts/vim-quickfix-list) I had to give it another go. My current config is very basic, with just a single key bound to opening :Trouble.

{ 1 :folke/trouble.nvim :dependencies [:nvim-tree/nvim-web-devicons] :keys [  {    :mode "n"    1 "<leader>ci"    2 ":Trouble<Cr>"    :desc "Trouble"  } ]}

Trouble's default configuration uses your LSP to populate a readable menu with links to errors and warnings. Here is an example of some TypeScript errors when I add an explicit any to my code:

Trouble nvim errors

With this example you can see some of the value, using return will move your cursor to the file and location of the error. When combined with a project-wide language server such as TypeScript, you can quickly execute refactors on typed code.