From 1f5668382c10c430558a3454716e664a12ff1f66 Mon Sep 17 00:00:00 2001 From: hyper Date: Tue, 4 Feb 2025 15:28:04 +0800 Subject: [PATCH] feat: toggleterm for lazygit in nvim --- lazy-lock.json | 1 + lua/plugins/editing.lua | 13 ++++++++++++- lua/plugins/visuals.lua | 12 ++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lazy-lock.json b/lazy-lock.json index a718664..a899100 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -29,6 +29,7 @@ "render-markdown.nvim": { "branch": "main", "commit": "2a9e0ab6043bfb4996ce6a6a35594ab357e5d299" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, + "toggleterm.nvim": { "branch": "main", "commit": "e76134e682c1a866e3dfcdaeb691eb7b01068668" }, "trouble.nvim": { "branch": "main", "commit": "6f380b8826fb819c752c8fd7daaee9ef96d4c689" }, "typescript-tools.nvim": { "branch": "master", "commit": "35e397ce467bedbbbb5bfcd0aa79727b59a08d4a" }, "ultisnips": { "branch": "master", "commit": "35252b3327bf0cb55136399dfe615637093a8291" }, diff --git a/lua/plugins/editing.lua b/lua/plugins/editing.lua index 5743417..fff2343 100644 --- a/lua/plugins/editing.lua +++ b/lua/plugins/editing.lua @@ -69,7 +69,7 @@ return { local utils = require('telescope.utils') -- generic - vim.keymap.set('n', 'l', builtin.live_grep, { desc = 'Telescope live grep' }) + -- vim.keymap.set('n', 'l', builtin.live_grep, { desc = 'Telescope live grep' }) vim.keymap.set('n', 'H', builtin.help_tags, { desc = 'Telescope help tags' }) vim.keymap.set('n', 'o', builtin.oldfiles, { desc = 'Telescope oldfiles' }) vim.keymap.set('n', 't', function() @@ -117,6 +117,17 @@ return { vim.keymap.set('n', '[c', function() vim.cmd [[cprev]] end, {desc = 'Prev Quicklist'}) + + -- well, avante + vim.keymap.set('n', 'apd', function() + vim.cmd [[AvanteSwitchProvider deepseek]] + end, {desc = 'deepseek-v3 official'}) + vim.keymap.set('n', 'apg', function() + vim.cmd [[AvanteSwitchProvider groq]] + end, {desc = 'groq r1-distill-70b'}) + vim.keymap.set('n', 'aps', function() + vim.cmd [[AvanteSwitchProvider siliconflow]] + end, {desc = 'siliconflow deepseek-v3'}) end }, { "folke/trouble.nvim", diff --git a/lua/plugins/visuals.lua b/lua/plugins/visuals.lua index 00cc9b9..6d92e9d 100644 --- a/lua/plugins/visuals.lua +++ b/lua/plugins/visuals.lua @@ -85,5 +85,17 @@ return { ---@module 'render-markdown' ---@type render.md.UserConfig opts = {}, + },{ + 'akinsho/toggleterm.nvim', + config = function() + local Terminal = require('toggleterm.terminal').Terminal + local lazygit = Terminal:new({ cmd = "lazygit.exe", hidden = true, direction = 'float'}) + + function _lazygit_toggle() + lazygit:toggle() + end + + vim.api.nvim_set_keymap("n", "lg", "lua _lazygit_toggle()", {noremap = true, silent = true}) + end } }