aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAriel D'Alessandro <ariel.dalessandro@auto1.com>2023-01-13 10:43:22 +0100
committerAriel D'Alessandro <ariel.dalessandro@auto1.com>2023-01-13 10:43:41 +0100
commit0586c7a92cc352925e0e60009dd4ec975880748c (patch)
tree6d7ca852f3953f8a04a6901512b4be0caa8fa616
parentdfae2fe09525ab95f9a9fae67d55381ef6461d9c (diff)
downloadnvim-conf-0586c7a92cc352925e0e60009dd4ec975880748c.tar.gz
nvim-conf-0586c7a92cc352925e0e60009dd4ec975880748c.zip
feat: move harpoon to lazy load
-rw-r--r--after/plugin/harpoon.lua23
-rw-r--r--after/plugin/hydra.lua48
-rw-r--r--lua/alpha/harpoon.lua44
-rw-r--r--lua/alpha/plugins.lua4
4 files changed, 48 insertions, 71 deletions
diff --git a/after/plugin/harpoon.lua b/after/plugin/harpoon.lua
deleted file mode 100644
index d80178f..0000000
--- a/after/plugin/harpoon.lua
+++ /dev/null
@@ -1,23 +0,0 @@
-local ok, harpoon = pcall(require, "harpoon")
-if not ok then
- return
-end
-
-harpoon.setup {}
-
-vim.keymap.set('n', '<leader>ss', require("harpoon.ui").toggle_quick_menu, {noremap = true, silent = true, expr = false})
-vim.keymap.set('n', '<leader>sa', require("harpoon.mark").add_file, {noremap = true, silent = true, expr = false})
-vim.keymap.set('n', '<leader><leader>1', function () require("harpoon.term").gotoTerminal(1) end, {noremap = true, silent = true, expr = false})
-vim.keymap.set('n', '<leader><leader>2', function () require("harpoon.term").gotoTerminal(2) end, {noremap = true, silent = true, expr = false})
-vim.keymap.set('n', '<leader><leader>3', function () require("harpoon.term").gotoTerminal(3) end, {noremap = true, silent = true, expr = false})
-
-for i = 1, 5 do
- vim.keymap.set(
- 'n',
- string.format("<leader>%s", i),
- function ()
- require("harpoon.ui").nav_file(i)
- end,
- {noremap = true, silent = true, expr = false}
- )
-end
diff --git a/after/plugin/hydra.lua b/after/plugin/hydra.lua
deleted file mode 100644
index 2538f68..0000000
--- a/after/plugin/hydra.lua
+++ /dev/null
@@ -1,48 +0,0 @@
-local ok, hydra = pcall(require, "hydra")
-if not ok then
- return
-end
-
--- Windows management, move and resize
--- hydra({
--- name = "windows",
--- mode = "n",
--- body = "<C-w>",
--- heads = {
--- { "l", "<C-w>l" },
--- { "h", "<C-w>h" },
--- { "j", "<C-w>j" },
--- { "k", "<C-w>k" },
--- { "q", "<C-w>q" },
--- { "o", "<C-w>o" },
--- { "L", "<C-w>2>" },
--- { "H", "<C-w>2<" },
--- { "J", "<C-w>2-" },
--- { "K", "<C-w>2+" },
--- -- { "<C-l>", "<C-w>L" },
--- -- { "<C-h>", "<C-w>H" },
--- -- { "<C-j>", "<C-w>J" },
--- -- { "<C-k>", "<C-w>K" },
--- { "=", "<C-w>=" },
--- },
--- })
-
--- want a way to run make commands
--- Make commands runs good but the output is not good
--- like up I like that is done and good
--- hydra({
--- name = "make",
--- mode = "n",
--- body = "<C-m>",
--- config = {
--- color = "blue",
--- },
--- heads = {
--- { "t", function() vim.cmd("vsplit term://make test") end },
--- { "v", function()
--- vim.cmd('vert new')
--- vim.fn.termopen("make vars")
--- vim.cmd('startinsert')
--- end, {exit = true} },
--- },
--- })
diff --git a/lua/alpha/harpoon.lua b/lua/alpha/harpoon.lua
new file mode 100644
index 0000000..958489b
--- /dev/null
+++ b/lua/alpha/harpoon.lua
@@ -0,0 +1,44 @@
+local M = {};
+
+-- changing this values will require re-compile packer
+local terms = vim.g.harpoon_terms or 3
+local quick_binds = vim.g.harpoon_quick_binds or 5
+
+M.keymaps = {
+ "<leader>ss",
+ "<leader>sa",
+}
+
+for i = 1, terms do
+ table.insert(M.keymaps, string.format("<leader><leader>%s", i))
+end
+
+for i = 1, quick_binds do
+ table.insert(M.keymaps, string.format("<leader>%s", i))
+end
+
+M.setup = function()
+ require('harpoon').setup({})
+
+ vim.keymap.set('n', '<leader>ss', require("harpoon.ui").toggle_quick_menu,
+ { noremap = true, silent = true, expr = false })
+ vim.keymap.set('n', '<leader>sa', require("harpoon.mark").add_file, { noremap = true, silent = true, expr = false })
+
+ for i = 1, terms do
+ vim.keymap.set('n', string.format('<leader><leader>%s', i), function() require("harpoon.term").gotoTerminal(1) end,
+ { noremap = true, silent = true, expr = false })
+ end
+
+ for i = 1, quick_binds do
+ vim.keymap.set(
+ 'n',
+ string.format("<leader>%s", i),
+ function()
+ require("harpoon.ui").nav_file(i)
+ end,
+ { noremap = true, silent = true, expr = false }
+ )
+ end
+end
+
+return M
diff --git a/lua/alpha/plugins.lua b/lua/alpha/plugins.lua
index d0e4c7a..7d01f99 100644
--- a/lua/alpha/plugins.lua
+++ b/lua/alpha/plugins.lua
@@ -65,6 +65,10 @@ return require("packer").startup(function(use)
"nvim-lua/plenary.nvim",
"nvim-lua/popup.nvim",
},
+ keys = require('alpha.harpoon').keymaps,
+ config = function ()
+ require('alpha.harpoon').setup()
+ end
})
use({