aboutsummaryrefslogtreecommitdiff
path: root/common/config/nvim/lua/plugins/trouble.lua
blob: 4a07e3b9a84740ec60c6cbb8bcc73a7f2efe5332 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
local M = {}

--- Setup and configure trouble.nvim
-- This function initializes and configures the trouble plugin for diagnostics and references
-- @return boolean True if setup was successful, false otherwise
function M.setup()
  local ok, trouble = pcall(require, 'trouble')
  if not ok then
    return false
  end
  
  trouble.setup({
  position = "bottom", -- bottom, top, left, right
  height = 10,
  width = 50,
  icons = {
    indent = {
      fold = {
        open = "",
        closed = "",
      },
    },
    kinds = {
      -- you can use LSP kind symbols or devicons here
      -- remove if you want default
    },
  },
  modes = {
    diagnostics = {
      groups = { "filename", "kind" },
    },
    symbols = {
      format = "{kind_icon} {symbol.name} {symbol.kind} [{symbol.scope}]",
    },
  },
  action_keys = {
    close = "q",
    cancel = "<esc>",
    refresh = "r",
    jump = { "<cr>", "<tab>" },
    open_split = { "<c-x>" },
    open_vsplit = { "<c-v>" },
    open_tab = { "<c-t>" },
    jump_close = { "o" },
    toggle_preview = "P",
    hover = "K",
    preview = "p",
    close_folds = { "zM", "zm" },
    open_folds = { "zR", "zr" },
    toggle_fold = { "zA", "za" },
    previous = "k",
    next = "j",
  },
  indent_lines = true,
  auto_open = false,
  auto_close = false,
  auto_preview = true,
  auto_fold = false,
  auto_jump = { "lsp_definitions" },
  signs = {
    error = "",
    warning = "▲",
    info = "󰋼",
    hint = "⚑",
    other = "•",
  },
  use_diagnostic_signs = true,
  })
  
  return true
end

return M