From 9948e261458f7bda8340ab5ff3ac9f6737d398d0 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Sun, 6 Aug 2023 02:48:14 +0200 Subject: [PATCH] vim: add plugin 'folke/trouble.nvim' --- config/nvim/lua/user/plugins/telescope.lua | 5 +++++ config/nvim/lua/user/plugins/trouble.lua | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 config/nvim/lua/user/plugins/trouble.lua diff --git a/config/nvim/lua/user/plugins/telescope.lua b/config/nvim/lua/user/plugins/telescope.lua index 299bd3e..8064c18 100644 --- a/config/nvim/lua/user/plugins/telescope.lua +++ b/config/nvim/lua/user/plugins/telescope.lua @@ -17,6 +17,11 @@ local config = function() [''] = actions.cycle_history_prev, } + local has_trouble, trouble = pcall(require, 'trouble.providers.telescope') + if has_trouble then + mappings[''] = trouble.open_with_trouble + end + telescope.setup { defaults = { -- ╭────────╮ diff --git a/config/nvim/lua/user/plugins/trouble.lua b/config/nvim/lua/user/plugins/trouble.lua new file mode 100644 index 0000000..c4596e0 --- /dev/null +++ b/config/nvim/lua/user/plugins/trouble.lua @@ -0,0 +1,19 @@ +return { + 'folke/trouble.nvim', + + dependencies = { 'nvim-tree/nvim-web-devicons' }, + + config = function() + local trouble = require('trouble') + + trouble.setup { + padding = false, -- don't add an extra new line of top of the list + auto_preview = false, -- don't preview automatically + } + + vim.keymap.set('n', 'xx', function() trouble.open() end) + vim.keymap.set('n', 'xw', function() trouble.open('workspace_diagnostics') end) + vim.keymap.set('n', 'xd', function() trouble.open('document_diagnostics') end) + end +} +