From fcf48d31e343596f374c5a34361496f2953a01ac Mon Sep 17 00:00:00 2001 From: Gabe Venberg Date: Thu, 3 Aug 2023 16:08:06 -0500 Subject: [PATCH] added todo-comments.nvim --- neovim/.config/nvim/init.lua | 3 +- neovim/.config/nvim/lua/LSPconfig.lua | 2 + neovim/.config/nvim/lua/packages.lua | 130 +++++++++++++++----------- 3 files changed, 78 insertions(+), 57 deletions(-) diff --git a/neovim/.config/nvim/init.lua b/neovim/.config/nvim/init.lua index 71ae32f..6f1d136 100644 --- a/neovim/.config/nvim/init.lua +++ b/neovim/.config/nvim/init.lua @@ -113,7 +113,7 @@ map('n', 't', ':NvimTreeToggle', opts) --open symbols-outline with leader+o map('n', 'o', ':SymbolsOutline', opts) --telescope stuff -map('n', 'ff', ':lua require "telescope".extensions.file_browser.file_browser()', opts) +map('n', 'ff', ':Telescope find_files', opts) map('n', 'fg', ':Telescope live_grep', opts) map('n', 'fb', ':Telescope buffers', opts) map('n', 'fm', ':Telescope marks', opts) @@ -124,6 +124,7 @@ map('n', 'fz', ':Telescope current_buffer_fuzzy_find', opts) map('n', 'fgc', ':Telescope git_commits', opts) map('n', 'fgb', ':Telescope git_branches', opts) map('n', 'fgs', ':Telescope git_stash', opts) +map('n', 'fto', ':TodoTelescope', opts) map('n', 'ft', ':Telescope treesitter', opts) --Treesitter context map('n', 'c', ':TSContextToggle', opts) diff --git a/neovim/.config/nvim/lua/LSPconfig.lua b/neovim/.config/nvim/lua/LSPconfig.lua index e2bfb77..12e4319 100644 --- a/neovim/.config/nvim/lua/LSPconfig.lua +++ b/neovim/.config/nvim/lua/LSPconfig.lua @@ -28,6 +28,8 @@ local on_attach = function() set_keymap('', 'ln', 'lua vim.diagnostic.goto_next()', opts) set_keymap('', 'lp', 'lua vim.diagnostic.goto_prev()', opts) set_keymap('', 'lm', 'lua vim.lsp.buf.format {async=true}', opts) + set_keymap('', ']d', 'lua vim.diagnostic.goto_next()', opts) + set_keymap('', '[d', 'lua vim.diagnostic.goto_prev()', opts) end require("mason-lspconfig").setup_handlers({ function(server_name) diff --git a/neovim/.config/nvim/lua/packages.lua b/neovim/.config/nvim/lua/packages.lua index d283bc4..9b29611 100644 --- a/neovim/.config/nvim/lua/packages.lua +++ b/neovim/.config/nvim/lua/packages.lua @@ -146,6 +146,73 @@ return require('packer').startup(function(use) end } + use { 'folke/trouble.nvim', + requires = "kyazdani42/nvim-web-devicons", + config = function() + require("trouble").setup { + position = "bottom", -- position of the list can be: bottom, top, left, right + height = 10, -- height of the trouble list when position is top or bottom + width = 50, -- width of the list when position is left or right + icons = true, -- use devicons for filenames + mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" + fold_open = "", -- icon used for open folds + fold_closed = "", -- icon used for closed folds + group = true, -- group results by file + padding = true, -- add an extra new line on top of the list + action_keys = { + -- key mappings for actions in the trouble list + -- map to {} to remove a mapping, for example: + -- close = {}, + close = "q", -- close the list + cancel = "", -- cancel the preview and get back to your last window / buffer / cursor + refresh = "r", -- manually refresh + jump = { "", "" }, -- jump to the diagnostic or open / close folds + open_split = { "" }, -- open buffer in new split + open_vsplit = { "" }, -- open buffer in new vsplit + open_tab = { "" }, -- open buffer in new tab + jump_close = { "o" }, -- jump to the diagnostic and close the list + toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode + toggle_preview = "P", -- toggle auto_preview + hover = "K", -- opens a small popup with the full multiline message + preview = "p", -- preview the diagnostic location + close_folds = { "zM", "zm" }, -- close all folds + open_folds = { "zR", "zr" }, -- open all folds + toggle_fold = { "zA", "za", '' }, -- toggle fold of current file + previous = "k", -- previous item + next = "j" -- next item + }, + indent_lines = true, -- add an indent guide below the fold icons + auto_open = false, -- automatically open the list when you have diagnostics + auto_close = false, -- automatically close the list when you have no diagnostics + auto_preview = true, -- automatically preview the location of the diagnostic. to close preview and go back to last window + auto_fold = false, -- automatically fold a file trouble list at creation + auto_jump = { "lsp_definitions" }, -- for the given modes, automatically jump if there is only a single result + signs = { + -- icons / text used for a diagnostic + error = "", + warning = "", + hint = "", + information = "", + other = "﫠" + }, + use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client + } + end + } + + use { + "folke/todo-comments.nvim", + requires = { "nvim-lua/plenary.nvim" }, + config = function() + local opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } + require("todo-comments").setup(opts) + end + } + --file browser use { 'kyazdani42/nvim-tree.lua', requires = { @@ -158,8 +225,13 @@ return require('packer').startup(function(use) local api = require('nvim-tree.api') local function opts(desc) - return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, - nowait = true } + return { + desc = 'nvim-tree: ' .. desc, + buffer = bufnr, + noremap = true, + silent = true, + nowait = true + } end @@ -357,60 +429,6 @@ return require('packer').startup(function(use) requires = { { 'hoob3rt/lualine.nvim', opt = true }, { 'kyazdani42/nvim-web-devicons', opt = true } } } - use { 'folke/trouble.nvim', - requires = "kyazdani42/nvim-web-devicons", - config = function() - require("trouble").setup { - position = "bottom", -- position of the list can be: bottom, top, left, right - height = 10, -- height of the trouble list when position is top or bottom - width = 50, -- width of the list when position is left or right - icons = true, -- use devicons for filenames - mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" - fold_open = "", -- icon used for open folds - fold_closed = "", -- icon used for closed folds - group = true, -- group results by file - padding = true, -- add an extra new line on top of the list - action_keys = { - -- key mappings for actions in the trouble list - -- map to {} to remove a mapping, for example: - -- close = {}, - close = "q", -- close the list - cancel = "", -- cancel the preview and get back to your last window / buffer / cursor - refresh = "r", -- manually refresh - jump = { "", "" }, -- jump to the diagnostic or open / close folds - open_split = { "" }, -- open buffer in new split - open_vsplit = { "" }, -- open buffer in new vsplit - open_tab = { "" }, -- open buffer in new tab - jump_close = { "o" }, -- jump to the diagnostic and close the list - toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode - toggle_preview = "P", -- toggle auto_preview - hover = "K", -- opens a small popup with the full multiline message - preview = "p", -- preview the diagnostic location - close_folds = { "zM", "zm" }, -- close all folds - open_folds = { "zR", "zr" }, -- open all folds - toggle_fold = { "zA", "za", '' }, -- toggle fold of current file - previous = "k", -- previous item - next = "j" -- next item - }, - indent_lines = true, -- add an indent guide below the fold icons - auto_open = false, -- automatically open the list when you have diagnostics - auto_close = false, -- automatically close the list when you have no diagnostics - auto_preview = true, -- automatically preview the location of the diagnostic. to close preview and go back to last window - auto_fold = false, -- automatically fold a file trouble list at creation - auto_jump = { "lsp_definitions" }, -- for the given modes, automatically jump if there is only a single result - signs = { - -- icons / text used for a diagnostic - error = "", - warning = "", - hint = "", - information = "", - other = "﫠" - }, - use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client - } - end - } - use { 'romgrk/nvim-treesitter-context', requires = 'nvim-treesitter/nvim-treesitter', config = function()