diff --git a/nvim/.config/nvim/after/plugin/luasnip.lua b/nvim/.config/nvim/after/plugin/luasnip.lua index 1af36d6..2ea1b63 100644 --- a/nvim/.config/nvim/after/plugin/luasnip.lua +++ b/nvim/.config/nvim/after/plugin/luasnip.lua @@ -5,25 +5,4 @@ ls.config.set_config { updateevents = "TextChanged,TextChangedI", } -vim.keymap.set({ 'i', 's' }, "", function() - if ls.expand_or_jumpable() then - ls.expand_or_jump() - end -end, { silent = true }) - -vim.keymap.set({ 'i', 's' }, "", function() - if ls.jumpable(-1) then - ls.jump(-1) - end -end, { silent = true }) - -vim.keymap.set({ 'i', 's' }, "", function() - if ls.choice_active() then - ls.change_choice(1) - end -end, { silent = true }) - -vim.keymap.set("n", "ss", "source ~/.config/nvim/after/plugin/luasnip.lua", - { desc = "[S]nippets [s]ource" }) - require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" }) diff --git a/nvim/.config/nvim/lua/lupan/plugins.lua b/nvim/.config/nvim/lua/lupan/plugins.lua index f943282..c6a0899 100644 --- a/nvim/.config/nvim/lua/lupan/plugins.lua +++ b/nvim/.config/nvim/lua/lupan/plugins.lua @@ -143,4 +143,8 @@ require('lazy').setup({ 'ggandor/lightspeed.nvim', + { + 'ThePrimeagen/harpoon', + dependencies = { 'nvim-lua/plenary.nvim' }, + } }) diff --git a/nvim/.config/nvim/lua/lupan/remap.lua b/nvim/.config/nvim/lua/lupan/remap.lua index 770e10b..138ab34 100644 --- a/nvim/.config/nvim/lua/lupan/remap.lua +++ b/nvim/.config/nvim/lua/lupan/remap.lua @@ -46,3 +46,63 @@ key('v', '>', '>gv', opts) -- Keep old value of register key('v', 'P', '"_dP', opts) + +-- luasnip + +vim.keymap.set({ 'i', 's' }, "", function() + local ls = require "luasnip" + if ls.expand_or_jumpable() then + ls.expand_or_jump() + end +end, { silent = true }) + +vim.keymap.set({ 'i', 's' }, "", function() + local ls = require "luasnip" + if ls.jumpable(-1) then + ls.jump(-1) + end +end, { silent = true }) + +vim.keymap.set({ 'i', 's' }, "", function() + local ls = require "luasnip" + if ls.choice_active() then + ls.change_choice(1) + end +end, { silent = true }) + +vim.keymap.set("n", "ss", "source ~/.config/nvim/after/plugin/luasnip.lua", + { desc = "[S]nippets [s]ource" }) + +-- terminal + +key('t', '', '') + +-- harpoon + +key('n', 'ha', function() + require("harpoon.mark").add_file() +end, { desc = '[H]arpoon [a]dd' }) + +key('n', 'hm', function() + require("harpoon.ui").toggle_quick_menu() +end, { desc = '[H]arpoon toggle quick [m]enu' }) + +key('n', 'hj', function() + require("harpoon.ui").nav_next() +end, { desc = '[H]arpoon next (j)' }) + +key('n', 'hk', function() + require("harpoon.ui").nav_prev() +end, { desc = '[H]arpoon prev (k)' }) + +for i = 1, 9, 1 do + key('n', 'h' .. i, function() + require("harpoon.ui").nav_file(i) + end, { desc = '[H]arpoon nav_file [' .. i .. ']' }) +end + +for i = 1, 9, 1 do + key('n', 't' .. i, function() + require("harpoon.term").gotoTerminal(i) + end, { desc = '[H]arpoon nav_file [' .. i .. ']' }) +end