diff --git a/init.lua b/init.lua index 93e07b6b..e2fa7828 100644 --- a/init.lua +++ b/init.lua @@ -361,9 +361,16 @@ require('lazy').setup({ end, }, { 'nvim-telescope/telescope-ui-select.nvim' }, + { 'ThePrimeagen/harpoon' }, -- Useful for getting pretty icons, but requires a Nerd Font. { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + { + 'nvim-telescope/telescope-live-grep-args.nvim', + -- This will not install any breaking changes. + -- For major updates, this must be adjusted manually. + version = '^1.0.0', + }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that @@ -393,7 +400,7 @@ require('lazy').setup({ -- defaults = { mappings = { - i = { [''] = 'to_fuzzy_refine' }, + i = { [''] = 'to_fuzzy_refine' }, }, file_ignore_patterns = { 'build/*', @@ -410,6 +417,7 @@ require('lazy').setup({ -- Enable Telescope extensions if they are installed pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'ui-select') + pcall(require('telescope').load_extension, 'live_grep_args') -- See `:help telescope.builtin` local builtin = require 'telescope.builtin' @@ -418,7 +426,9 @@ require('lazy').setup({ vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) - vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) + -- vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) + vim.keymap.set('n', 'sg', "lua require('telescope').extensions.live_grep_args.live_grep_args()", { desc = 'Live Grep' }) + vim.keymap.set('n', 'sc', 'lua require("telescope.builtin").live_grep({ glob_pattern = "!{spec,test}"})', { desc = 'Live Grep Code' }) vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) @@ -468,7 +478,16 @@ require('lazy').setup({ 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs and related tools to stdpath for Neovim - { 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants + { + 'williamboman/mason.nvim', + opts = { + ensure_installed = { + 'clangd', + 'codelldb', + }, + }, + config = true, + }, -- NOTE: Must be loaded before dependants 'williamboman/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', @@ -703,22 +722,22 @@ require('lazy').setup({ opts = { autoformat = true, notify_on_error = false, - format_on_save = function(bufnr) - -- Disable "format_on_save lsp_fallback" for languages that don't - -- have a well standardized coding style. You can add additional - -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true } - local lsp_format_opt - if disable_filetypes[vim.bo[bufnr].filetype] then - lsp_format_opt = 'never' - else - lsp_format_opt = 'fallback' - end - return { - timeout_ms = 500, - lsp_format = lsp_format_opt, - } - end, + -- format_on_save = function(bufnr) + -- -- Disable "format_on_save lsp_fallback" for languages that don't + -- -- have a well standardized coding style. You can add additional + -- -- languages here or re-enable it for the disabled ones. + -- local disable_filetypes = { c = true, cpp = true } + -- local lsp_format_opt + -- if disable_filetypes[vim.bo[bufnr].filetype] then + -- lsp_format_opt = 'never' + -- else + -- lsp_format_opt = 'fallback' + -- end + -- return { + -- timeout_ms = 500, + -- lsp_format = lsp_format_opt, + -- } + -- end, formatters_by_ft = { lua = { 'stylua' }, cpp = { 'clang-format' }, @@ -958,7 +977,7 @@ require('lazy').setup({ -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - -- require 'kickstart.plugins.debug', + require 'kickstart.plugins.debug', require 'kickstart.plugins.indent_line', -- require 'kickstart.plugins.lint', require 'kickstart.plugins.autopairs', diff --git a/lua/custom/plugins/goto-preview.lua b/lua/custom/plugins/goto-preview.lua new file mode 100644 index 00000000..d1d73119 --- /dev/null +++ b/lua/custom/plugins/goto-preview.lua @@ -0,0 +1,8 @@ +return { + { + 'rmagatti/goto-preview', + event = 'BufEnter', + config = true, -- necessary as per https://github.com/rmagatti/goto-preview/issues/88 + default_mappings = true, + }, +} diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 00000000..002dac31 --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,23 @@ +return { + "ThePrimeagen/harpoon", + config = function() + local mark = require("harpoon.mark") + local ui = require("harpoon.ui") + + vim.keymap.set("n", "a", mark.add_file, { desc = "Harpoon: Mark File" }) + vim.keymap.set("n", "", ui.toggle_quick_menu, { desc = "Toggle Harpoon Menu" }) + + vim.keymap.set("n", "", function() + ui.nav_file(1) + end, { desc = "Harpoon File 1" }) + vim.keymap.set("n", "", function() + ui.nav_file(2) + end, { desc = "Harpoon File 2" }) + vim.keymap.set("n", "", function() + ui.nav_file(3) + end, { desc = "Harpoon File 3" }) + vim.keymap.set("n", "", function() + ui.nav_file(4) + end, { desc = "Harpoon File 4" }) + end, +} diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 196f2c6d..2ada6672 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -63,7 +63,8 @@ return { -- online, please don't ask me how to install them :) ensure_installed = { -- Update this to ensure that you have the debuggers for the langs you want - 'delve', + -- 'delve', + 'codelldb', }, }