From 47d61c1cb5af62cc75218661dfc7c3a0dc3378a8 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Appel Date: Sun, 17 Dec 2023 17:17:40 -0500 Subject: made nvim keymap locations sensible, add harpoon Keymaps are now stored in the lua/plugins/.lua or lua/keymap.lua Installed harpoon v2 --- nvim/lua/plugins/fugitive.lua | 6 ++++++ nvim/lua/plugins/harpoon.lua | 46 ++++++++++++++++++++++++++++++++++++++++++ nvim/lua/plugins/init.lua | 7 ------- nvim/lua/plugins/telescope.lua | 25 +++++++++++++++++++++++ 4 files changed, 77 insertions(+), 7 deletions(-) create mode 100644 nvim/lua/plugins/fugitive.lua create mode 100644 nvim/lua/plugins/harpoon.lua (limited to 'nvim/lua/plugins') diff --git a/nvim/lua/plugins/fugitive.lua b/nvim/lua/plugins/fugitive.lua new file mode 100644 index 0000000..a203ea8 --- /dev/null +++ b/nvim/lua/plugins/fugitive.lua @@ -0,0 +1,6 @@ +return { + 'tpope/vim-fugitive', -- close to native git command integrations + keys = { + {"gs", vim.cmd.Git, desc = "Git Status"} + } +} diff --git a/nvim/lua/plugins/harpoon.lua b/nvim/lua/plugins/harpoon.lua new file mode 100644 index 0000000..061ca9e --- /dev/null +++ b/nvim/lua/plugins/harpoon.lua @@ -0,0 +1,46 @@ +return { + 'ThePrimeagen/harpoon', -- quick file navigator + branch = "harpoon2", + dependencies = 'nvim-lua/plenary.nvim', + config = function() + require("harpoon"):setup() + end, + keys = { + {"", function() + local harpoon = require("harpoon") + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, + desc = "Open Harpoon Quickmenu" + }, + {"m", function() + local harpoon = require("harpoon") + harpoon:list():append() + end, + desc = "Add file to harpoon" + }, + {"1", function() + local harpoon = require("harpoon") + harpoon:list():select(1) + end, + desc = "Navigate to the first file" + }, + {"2", function() + local harpoon = require("harpoon") + harpoon:list():select(2) + end, + desc = "Navigate to the second file" + }, + {"3", function() + local harpoon = require("harpoon") + harpoon:list():select(3) + end, + desc = "Navigate to the third file" + }, + {"4", function() + local harpoon = require("harpoon") + harpoon:list():select(4) + end, + desc = "Navigate to the fourth file" + }, + } +} diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua index c05f0f0..5c90a28 100644 --- a/nvim/lua/plugins/init.lua +++ b/nvim/lua/plugins/init.lua @@ -3,10 +3,6 @@ return { -- common dependacy "nvim-lua/plenary.nvim", - -- git - 'tpope/vim-fugitive', -- close to native git command integrations - - -- completion -- TODO:config completion and setup binds 'hrsh7th/nvim-cmp', @@ -23,9 +19,6 @@ return { dependencies = { 'hrsh7th/nvim-cmp' } }, - - - { 'numToStr/Comment.nvim', -- faster commentting lazy = false, diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua index 55bc045..360994a 100644 --- a/nvim/lua/plugins/telescope.lua +++ b/nvim/lua/plugins/telescope.lua @@ -3,5 +3,30 @@ return { dependencies = { 'nvim-lua/plenary.nvim', 'nvim-tree/nvim-web-devicons' + }, + keys = { + {"ff", function() + require("telescope.builtin").find_files() + end, + desc = "Search for files (respcting .gitignore)" + }, + {"fb", function() + require("telescope.builtin").buffers() + end + }, + {"gf", function() + require("telescope.builtin").live_grep() + end + }, + {"fr", function() + -- TODO: if lsp supports reference provider and lsp is attached + -- [telescope.builtin.lsp_*]: server does not support referencesProvider + if #vim.lsp.get_active_clients({bufnr = 0}) > 0 then + require("telescope.builtin").lsp_references() + else + require("telescope.builtin").grep_string() + end + end + } } } -- cgit v1.2.3