From e01030e0064c093e7e1500c7532bd09504b3e7c2 Mon Sep 17 00:00:00 2001 From: Tom Carabine <12697250+tcarabine@users.noreply.github.com.> Date: Wed, 27 Nov 2024 16:30:43 +0000 Subject: [PATCH] Resolving --- init.lua | 22 ++++++++---- lua/custom/plugins/harpoon.lua | 65 ++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 lua/custom/plugins/harpoon.lua diff --git a/init.lua b/init.lua index 08717d53..0998c965 100644 --- a/init.lua +++ b/init.lua @@ -102,7 +102,7 @@ vim.g.have_nerd_font = false vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -157,6 +157,13 @@ vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. vim.opt.scrolloff = 10 +-- Settings from lifted from Prime +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true +vim.opt.smartindent = true + -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -176,10 +183,10 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') +vim.keymap.set('n', '', 'echo "Use h to move!!"') +vim.keymap.set('n', '', 'echo "Use l to move!!"') +vim.keymap.set('n', '', 'echo "Use k to move!!"') +vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows @@ -190,6 +197,9 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +-- Keybinds borrowing from Prime +vim.keymap.set('n', 'pv', vim.cmd.Ex, { desc = 'Open Explorer [P]roject [V]iew' }) + -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -938,7 +948,7 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 00000000..ef9b8372 --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,65 @@ +return { + { + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-telescope/telescope.nvim', + }, + config = function() + local harpoon = require 'harpoon' + harpoon:setup() + + vim.keymap.set('n', 'a', function() + harpoon:list():add() + end) + --[[vim.keymap.set('n', '', function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end) + --]] + vim.keymap.set('n', '', function() + harpoon:list():select(1) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(2) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(3) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(4) + end) + + -- Toggle previous & next buffers stored within Harpoon list + vim.keymap.set('n', '', function() + harpoon:list():prev() + end) + vim.keymap.set('n', '', function() + harpoon:list():next() + end) + + local conf = require('telescope.config').values + local function toggle_telescope(harpoon_files) + local file_paths = {} + for _, item in ipairs(harpoon_files.items) do + table.insert(file_paths, item.value) + end + + require('telescope.pickers') + .new({}, { + prompt_title = 'Harpoon', + finder = require('telescope.finders').new_table { + results = file_paths, + }, + previewer = conf.file_previewer {}, + sorter = conf.generic_sorter {}, + }) + :find() + end + + vim.keymap.set('n', '', function() + toggle_telescope(harpoon:list()) + end, { desc = 'Open harpoon window' }) + end, + }, +}