From 844d4e70e3ffa9cca8afe99ecda5f8f09bd35bb5 Mon Sep 17 00:00:00 2001 From: Ruslan Matveev Date: Sat, 2 Aug 2025 23:29:33 -0400 Subject: [PATCH 1/5] Updated .gitignore --- .gitignore | 3 ++- lazy-lock.json | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 lazy-lock.json diff --git a/.gitignore b/.gitignore index 005b535b606..a074298234b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ test.sh nvim spell/ -lazy-lock.json + +.DS_Store diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000000..9c84849d8bb --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,24 @@ +{ + "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, + "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, + "conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" }, + "fidget.nvim": { "branch": "main", "commit": "4ec7bed6c86b671ddde03ca1b227343cfa3e65fa" }, + "gitsigns.nvim": { "branch": "main", "commit": "8270378ab83540b03d09c0194ba3e208f9d0cb72" }, + "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "844d247d998c2f9a6a3baad8bb9748edc55ce69f" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, + "mason.nvim": { "branch": "main", "commit": "9e25c98d4826998460926f8c5c2284848d80ae89" }, + "mini.nvim": { "branch": "main", "commit": "efff26174ca363c059f92e906753db47e81d870b" }, + "nvim-lspconfig": { "branch": "master", "commit": "d0dbf489a8810672fa9a61f4a86e5cf89214b772" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-web-devicons": { "branch": "master", "commit": "3362099de3368aa620a8105b19ed04c2053e38c0" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, + "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, + "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } +} From 7810e2af8d27d8bf90b927be3803c3b667652ed8 Mon Sep 17 00:00:00 2001 From: Ruslan Matveev Date: Tue, 5 Aug 2025 16:10:51 -0400 Subject: [PATCH 2/5] Enabled nerd-fonts --- init.lua | 2 +- lazy-lock.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index b98ffc6198a..8090243de97 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.o` diff --git a/lazy-lock.json b/lazy-lock.json index 9c84849d8bb..420677f1c54 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -3,15 +3,15 @@ "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, "conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" }, "fidget.nvim": { "branch": "main", "commit": "4ec7bed6c86b671ddde03ca1b227343cfa3e65fa" }, - "gitsigns.nvim": { "branch": "main", "commit": "8270378ab83540b03d09c0194ba3e208f9d0cb72" }, + "gitsigns.nvim": { "branch": "main", "commit": "736f51d2bb684c06f39a2032f064d7244f549981" }, "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "844d247d998c2f9a6a3baad8bb9748edc55ce69f" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, "mason.nvim": { "branch": "main", "commit": "9e25c98d4826998460926f8c5c2284848d80ae89" }, - "mini.nvim": { "branch": "main", "commit": "efff26174ca363c059f92e906753db47e81d870b" }, - "nvim-lspconfig": { "branch": "master", "commit": "d0dbf489a8810672fa9a61f4a86e5cf89214b772" }, + "mini.nvim": { "branch": "main", "commit": "03387f53f1cb8c6a8ba0798041c6aa3525ed11ba" }, + "nvim-lspconfig": { "branch": "master", "commit": "63a38440989c58e1f100373ab603fd24665bdc9a" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-web-devicons": { "branch": "master", "commit": "3362099de3368aa620a8105b19ed04c2053e38c0" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, From 27105b9f60dd53e27e3307f0326ebb73d43de0ad Mon Sep 17 00:00:00 2001 From: Ruslan Matveev Date: Mon, 20 Oct 2025 21:37:09 -0400 Subject: [PATCH 3/5] toggleterm --- init.lua | 12 +-- lazy-lock.json | 29 +++---- lua/custom/plugins/README.md | 15 ++++ lua/custom/plugins/init.lua | 6 +- lua/custom/plugins/toggleterm.lua | 128 ++++++++++++++++++++++++++++++ 5 files changed, 169 insertions(+), 21 deletions(-) create mode 100644 lua/custom/plugins/README.md create mode 100644 lua/custom/plugins/toggleterm.lua diff --git a/init.lua b/init.lua index 8090243de97..e73829ddef7 100644 --- a/init.lua +++ b/init.lua @@ -102,7 +102,7 @@ vim.g.have_nerd_font = true vim.o.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.o.relativenumber = true +vim.o.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.o.mouse = 'a' @@ -298,7 +298,7 @@ require('lazy').setup({ -- Then, because we use the `opts` key (recommended), the configuration runs -- after the plugin has been loaded as `require(MODULE).setup(opts)`. - { -- Useful plugin to show you pending keybinds. + { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' opts = { @@ -379,7 +379,7 @@ require('lazy').setup({ { 'nvim-telescope/telescope-ui-select.nvim' }, -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that @@ -487,7 +487,7 @@ require('lazy').setup({ 'WhoIsSethDaniel/mason-tool-installer.nvim', -- Useful status updates for LSP. - { 'j-hui/fidget.nvim', opts = {} }, + { 'j-hui/fidget.nvim', opts = {} }, -- Allows extra capabilities provided by blink.cmp 'saghen/blink.cmp', @@ -931,7 +931,7 @@ require('lazy').setup({ -- cursor location to LINE:COLUMN ---@diagnostic disable-next-line: duplicate-set-field statusline.section_location = function() - return '%2l:%-2v' + return '%2l:%-2v %P' end -- ... and there is more! @@ -984,7 +984,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/lazy-lock.json b/lazy-lock.json index 420677f1c54..0133912ac3e 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,24 +1,25 @@ { "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, - "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, - "conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" }, - "fidget.nvim": { "branch": "main", "commit": "4ec7bed6c86b671ddde03ca1b227343cfa3e65fa" }, - "gitsigns.nvim": { "branch": "main", "commit": "736f51d2bb684c06f39a2032f064d7244f549981" }, + "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, + "conform.nvim": { "branch": "master", "commit": "235dd79731c1dc51ec04abb4045cbc54727a172a" }, + "fidget.nvim": { "branch": "main", "commit": "3f5475949679953af6d78654db29b944fa826e6a" }, + "gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" }, "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, - "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "844d247d998c2f9a6a3baad8bb9748edc55ce69f" }, + "lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" }, + "lazydev.nvim": { "branch": "main", "commit": "e28ce52fc7ff79fcb76f0e79ee6fb6182fca90b9" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2304ff65ecc8cb2afc2484de3e2ed9a407edf0b9" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, - "mason.nvim": { "branch": "main", "commit": "9e25c98d4826998460926f8c5c2284848d80ae89" }, - "mini.nvim": { "branch": "main", "commit": "03387f53f1cb8c6a8ba0798041c6aa3525ed11ba" }, - "nvim-lspconfig": { "branch": "master", "commit": "63a38440989c58e1f100373ab603fd24665bdc9a" }, + "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, + "mini.nvim": { "branch": "main", "commit": "14145d3769eacdb48aa1cfd21f1e244896a85f68" }, + "nvim-lspconfig": { "branch": "master", "commit": "e5c61b02f33b5c6538be25b2696b33b4cc91e667" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-web-devicons": { "branch": "master", "commit": "3362099de3368aa620a8105b19ed04c2053e38c0" }, + "nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, - "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, - "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, - "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } + "todo-comments.nvim": { "branch": "main", "commit": "19d461ddd543e938eb22505fb03fa878800270b6" }, + "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, + "tokyonight.nvim": { "branch": "main", "commit": "e63c42a42b11cd6225f009dd949b9ee0fccc15ef" }, + "which-key.nvim": { "branch": "main", "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" } } diff --git a/lua/custom/plugins/README.md b/lua/custom/plugins/README.md new file mode 100644 index 00000000000..51887fd388d --- /dev/null +++ b/lua/custom/plugins/README.md @@ -0,0 +1,15 @@ +# Custom ToggleTerm Setup + +Quick notes on the terminal experience provided by `lua/custom/plugins/toggleterm.lua`. + +## Highlights +- Floating terminals sized responsively to the current UI (`` or `tf`). +- Dedicated splits: `th` (horizontal) and `tv` (vertical). +- Terminal picker `tt`, plus a pre-configured floating `lazygit` on `tg`. +- Send code to the primary terminal with `ts` (line or visual selection). +- Terminal windows inherit familiar navigation (``, `jk`, ``) automatically. + +## Tips +- Use counts (`2ToggleTerm`, `3ToggleTerm`) when you want to retarget a specific layout. +- `TermExec cmd="npm run test"` reuses the floating terminal without stealing focus. +- Update sizing or borders in `float_opts` if your display or font spacing demands it. diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8d7a..4874b87c9ec 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,8 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information -return {} +local plugins = {} + +vim.list_extend(plugins, require('custom.plugins.toggleterm')) + +return plugins diff --git a/lua/custom/plugins/toggleterm.lua b/lua/custom/plugins/toggleterm.lua new file mode 100644 index 00000000000..044d8c4cf64 --- /dev/null +++ b/lua/custom/plugins/toggleterm.lua @@ -0,0 +1,128 @@ +local function clamp(value, min_value, max_value) + assert(min_value <= max_value, 'min_value must be <= max_value') + return math.max(min_value, math.min(value, max_value)) +end + +return { + { + 'akinsho/toggleterm.nvim', + version = '*', + event = 'VeryLazy', + cmd = { + 'ToggleTerm', + 'ToggleTermToggleAll', + 'TermExec', + 'TermSelect', + 'ToggleTermSendCurrentLine', + 'ToggleTermSendVisualSelection', + }, + opts = function() + return { + size = function(term) + if term.direction == 'horizontal' then + return clamp(math.floor(vim.o.lines * 0.28), 10, math.floor(vim.o.lines * 0.45)) + elseif term.direction == 'vertical' then + return clamp(math.floor(vim.o.columns * 0.35), 40, math.floor(vim.o.columns * 0.6)) + end + return 20 + end, + open_mapping = { [[]] }, + shade_terminals = true, + shading_factor = -12, + start_in_insert = true, + insert_mappings = true, + terminal_mappings = true, + persist_size = true, + persist_mode = true, + direction = 'float', + close_on_exit = true, + auto_scroll = true, + float_opts = { + border = 'curved', + winblend = 0, + width = function() + return clamp(math.floor(vim.o.columns * 0.9), 80, vim.o.columns - 2) + end, + height = function() + return clamp(math.floor(vim.o.lines * 0.85), 20, vim.o.lines - 2) + end, + title_pos = 'center', + }, + } + end, + config = function(_, opts) + local toggleterm = require('toggleterm') + toggleterm.setup(opts) + + local TERM_FLOAT = 1 + local TERM_HORIZONTAL = 2 + local TERM_VERTICAL = 3 + local TERM_LAZYGIT = 10 + + local function toggle_float() + toggleterm.toggle(TERM_FLOAT, nil, nil, 'float') + end + + local function toggle_horizontal() + toggleterm.toggle(TERM_HORIZONTAL, nil, nil, 'horizontal') + end + + local function toggle_vertical() + toggleterm.toggle(TERM_VERTICAL, nil, nil, 'vertical') + end + + local lazygit = nil + if vim.fn.executable('lazygit') == 1 then + local Terminal = require('toggleterm.terminal').Terminal + lazygit = Terminal:new { + cmd = 'lazygit', + count = TERM_LAZYGIT, + direction = 'float', + hidden = true, + float_opts = { + border = 'curved', + }, + } + else + vim.notify('lazygit not found in PATH. Install it to use tg', vim.log.levels.WARN) + end + + local map = vim.keymap.set + + map({ 'n', 'i', 't' }, '', toggle_float, { desc = 'Toggle floating terminal' }) + map('n', 'tf', toggle_float, { desc = '[T]erminal float' }) + map('n', 'th', toggle_horizontal, { desc = '[T]erminal horizontal' }) + map('n', 'tv', toggle_vertical, { desc = '[T]erminal vertical' }) + map('n', 'tt', 'TermSelect', { desc = '[T]erminal picker' }) + map('n', 'tg', function() + if lazygit then + lazygit:toggle() + else + vim.notify('lazygit is not available', vim.log.levels.WARN) + end + end, { desc = '[T]erminal lazygit' }) + map('n', 'ts', function() + vim.cmd.ToggleTermSendCurrentLine(TERM_FLOAT) + end, { desc = '[T]erminal [s]end line' }) + + map('v', 'ts', function() + vim.cmd.ToggleTermSendVisualSelection(TERM_FLOAT) + end, { desc = '[T]erminal [s]end selection' }) + + local term_augroup = vim.api.nvim_create_augroup('custom-toggleterm', { clear = true }) + vim.api.nvim_create_autocmd('TermOpen', { + group = term_augroup, + pattern = 'term://*toggleterm#*', + callback = function() + local term_opts = { buffer = 0, silent = true } + vim.keymap.set('t', '', [[]], term_opts) + vim.keymap.set('t', 'jk', [[]], term_opts) + vim.keymap.set('t', '', [[wincmd h]], term_opts) + vim.keymap.set('t', '', [[wincmd j]], term_opts) + vim.keymap.set('t', '', [[wincmd k]], term_opts) + vim.keymap.set('t', '', [[wincmd l]], term_opts) + end, + }) + end, + }, +} From 2f87cff4292bf67e2eacd44b89788275d9dae7b0 Mon Sep 17 00:00:00 2001 From: Ruslan Matveev Date: Mon, 20 Oct 2025 21:42:19 -0400 Subject: [PATCH 4/5] lazy lock hashes --- lazy-lock.json | 115 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 92 insertions(+), 23 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 0133912ac3e..a71294faa52 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,25 +1,94 @@ { - "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, - "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, - "conform.nvim": { "branch": "master", "commit": "235dd79731c1dc51ec04abb4045cbc54727a172a" }, - "fidget.nvim": { "branch": "main", "commit": "3f5475949679953af6d78654db29b944fa826e6a" }, - "gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" }, - "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, - "lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" }, - "lazydev.nvim": { "branch": "main", "commit": "e28ce52fc7ff79fcb76f0e79ee6fb6182fca90b9" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "2304ff65ecc8cb2afc2484de3e2ed9a407edf0b9" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, - "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, - "mini.nvim": { "branch": "main", "commit": "14145d3769eacdb48aa1cfd21f1e244896a85f68" }, - "nvim-lspconfig": { "branch": "master", "commit": "e5c61b02f33b5c6538be25b2696b33b4cc91e667" }, - "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" }, - "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, - "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, - "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, - "todo-comments.nvim": { "branch": "main", "commit": "19d461ddd543e938eb22505fb03fa878800270b6" }, - "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, - "tokyonight.nvim": { "branch": "main", "commit": "e63c42a42b11cd6225f009dd949b9ee0fccc15ef" }, - "which-key.nvim": { "branch": "main", "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" } + "LuaSnip": { + "branch": "master", + "commit": "458560534a73f7f8d7a11a146c801db00b081df0" + }, + "blink.cmp": { + "branch": "main", + "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" + }, + "conform.nvim": { + "branch": "master", + "commit": "235dd79731c1dc51ec04abb4045cbc54727a172a" + }, + "fidget.nvim": { + "branch": "main", + "commit": "3f5475949679953af6d78654db29b944fa826e6a" + }, + "gitsigns.nvim": { + "branch": "main", + "commit": "20ad4419564d6e22b189f6738116b38871082332" + }, + "guess-indent.nvim": { + "branch": "main", + "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" + }, + "lazy.nvim": { + "branch": "main", + "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" + }, + "lazydev.nvim": { + "branch": "main", + "commit": "e28ce52fc7ff79fcb76f0e79ee6fb6182fca90b9" + }, + "mason-lspconfig.nvim": { + "branch": "main", + "commit": "2304ff65ecc8cb2afc2484de3e2ed9a407edf0b9" + }, + "mason-tool-installer.nvim": { + "branch": "main", + "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" + }, + "mason.nvim": { + "branch": "main", + "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" + }, + "mini.nvim": { + "branch": "main", + "commit": "14145d3769eacdb48aa1cfd21f1e244896a85f68" + }, + "nvim-lspconfig": { + "branch": "master", + "commit": "e5c61b02f33b5c6538be25b2696b33b4cc91e667" + }, + "nvim-treesitter": { + "branch": "master", + "commit": "42fc28ba918343ebfd5565147a42a26580579482" + }, + "nvim-web-devicons": { + "branch": "master", + "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" + }, + "plenary.nvim": { + "branch": "master", + "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" + }, + "telescope-fzf-native.nvim": { + "branch": "main", + "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" + }, + "telescope-ui-select.nvim": { + "branch": "master", + "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" + }, + "telescope.nvim": { + "branch": "master", + "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" + }, + "todo-comments.nvim": { + "branch": "main", + "commit": "19d461ddd543e938eb22505fb03fa878800270b6" + }, + "toggleterm.nvim": { + "branch": "main", + "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" + }, + "tokyonight.nvim": { + "branch": "main", + "commit": "e63c42a42b11cd6225f009dd949b9ee0fccc15ef" + }, + "which-key.nvim": { + "branch": "main", + "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" + } } From c3046fb5440d74adca426f3397fd0823cf92762f Mon Sep 17 00:00:00 2001 From: Ruslan Matveev Date: Tue, 21 Oct 2025 22:06:46 -0400 Subject: [PATCH 5/5] lazygit --- lazy-lock.json | 116 +++++++----------------------- lua/custom/plugins/README.md | 28 ++++++-- lua/custom/plugins/init.lua | 1 + lua/custom/plugins/lazygit.lua | 26 +++++++ lua/custom/plugins/toggleterm.lua | 24 ------- 5 files changed, 75 insertions(+), 120 deletions(-) create mode 100644 lua/custom/plugins/lazygit.lua diff --git a/lazy-lock.json b/lazy-lock.json index a71294faa52..d708be6ad35 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,94 +1,26 @@ { - "LuaSnip": { - "branch": "master", - "commit": "458560534a73f7f8d7a11a146c801db00b081df0" - }, - "blink.cmp": { - "branch": "main", - "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" - }, - "conform.nvim": { - "branch": "master", - "commit": "235dd79731c1dc51ec04abb4045cbc54727a172a" - }, - "fidget.nvim": { - "branch": "main", - "commit": "3f5475949679953af6d78654db29b944fa826e6a" - }, - "gitsigns.nvim": { - "branch": "main", - "commit": "20ad4419564d6e22b189f6738116b38871082332" - }, - "guess-indent.nvim": { - "branch": "main", - "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" - }, - "lazy.nvim": { - "branch": "main", - "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" - }, - "lazydev.nvim": { - "branch": "main", - "commit": "e28ce52fc7ff79fcb76f0e79ee6fb6182fca90b9" - }, - "mason-lspconfig.nvim": { - "branch": "main", - "commit": "2304ff65ecc8cb2afc2484de3e2ed9a407edf0b9" - }, - "mason-tool-installer.nvim": { - "branch": "main", - "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" - }, - "mason.nvim": { - "branch": "main", - "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" - }, - "mini.nvim": { - "branch": "main", - "commit": "14145d3769eacdb48aa1cfd21f1e244896a85f68" - }, - "nvim-lspconfig": { - "branch": "master", - "commit": "e5c61b02f33b5c6538be25b2696b33b4cc91e667" - }, - "nvim-treesitter": { - "branch": "master", - "commit": "42fc28ba918343ebfd5565147a42a26580579482" - }, - "nvim-web-devicons": { - "branch": "master", - "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" - }, - "plenary.nvim": { - "branch": "master", - "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" - }, - "telescope-fzf-native.nvim": { - "branch": "main", - "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" - }, - "telescope-ui-select.nvim": { - "branch": "master", - "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" - }, - "telescope.nvim": { - "branch": "master", - "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" - }, - "todo-comments.nvim": { - "branch": "main", - "commit": "19d461ddd543e938eb22505fb03fa878800270b6" - }, - "toggleterm.nvim": { - "branch": "main", - "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" - }, - "tokyonight.nvim": { - "branch": "main", - "commit": "e63c42a42b11cd6225f009dd949b9ee0fccc15ef" - }, - "which-key.nvim": { - "branch": "main", - "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" - } + "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, + "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, + "conform.nvim": { "branch": "master", "commit": "235dd79731c1dc51ec04abb4045cbc54727a172a" }, + "fidget.nvim": { "branch": "main", "commit": "3f5475949679953af6d78654db29b944fa826e6a" }, + "gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" }, + "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, + "lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" }, + "lazydev.nvim": { "branch": "main", "commit": "e28ce52fc7ff79fcb76f0e79ee6fb6182fca90b9" }, + "lazygit.nvim": { "branch": "main", "commit": "2305deed25bc61b866d5d39189e9105a45cf1cfb" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2304ff65ecc8cb2afc2484de3e2ed9a407edf0b9" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, + "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, + "mini.nvim": { "branch": "main", "commit": "cf32454e91b3d963a12fef0314811fb035b62d49" }, + "nvim-lspconfig": { "branch": "master", "commit": "e5c61b02f33b5c6538be25b2696b33b4cc91e667" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, + "todo-comments.nvim": { "branch": "main", "commit": "19d461ddd543e938eb22505fb03fa878800270b6" }, + "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, + "tokyonight.nvim": { "branch": "main", "commit": "e63c42a42b11cd6225f009dd949b9ee0fccc15ef" }, + "which-key.nvim": { "branch": "main", "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" } } diff --git a/lua/custom/plugins/README.md b/lua/custom/plugins/README.md index 51887fd388d..211e4597cb5 100644 --- a/lua/custom/plugins/README.md +++ b/lua/custom/plugins/README.md @@ -1,15 +1,35 @@ -# Custom ToggleTerm Setup +# Custom Plugins Setup + +## ToggleTerm Quick notes on the terminal experience provided by `lua/custom/plugins/toggleterm.lua`. -## Highlights +### Highlights - Floating terminals sized responsively to the current UI (`` or `tf`). - Dedicated splits: `th` (horizontal) and `tv` (vertical). -- Terminal picker `tt`, plus a pre-configured floating `lazygit` on `tg`. +- Terminal picker `tt` to switch between multiple terminals. - Send code to the primary terminal with `ts` (line or visual selection). - Terminal windows inherit familiar navigation (``, `jk`, ``) automatically. -## Tips +### Tips - Use counts (`2ToggleTerm`, `3ToggleTerm`) when you want to retarget a specific layout. - `TermExec cmd="npm run test"` reuses the floating terminal without stealing focus. - Update sizing or borders in `float_opts` if your display or font spacing demands it. + +## LazyGit + +Enhanced git interface using `lua/custom/plugins/lazygit.lua`. + +### Highlights +- Fast, native lazygit integration with no keyboard shortcut conflicts +- Opens in a proper floating window (95% of screen size) +- Fully functional with all lazygit features and keybindings +- Use `gg` to open lazygit in current repo +- Use `gf` to open lazygit focused on current file history + +### Why Not ToggleTerm? +LazyGit.nvim is used instead of toggleterm for lazygit because: +- Better performance (uses native terminal, not Neovim's terminal emulator) +- No keyboard shortcut conflicts (q, Esc, etc. work as expected) +- Designed specifically for lazygit integration +- Supports editing commit messages in Neovim diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 4874b87c9ec..e0888915b3b 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -5,5 +5,6 @@ local plugins = {} vim.list_extend(plugins, require('custom.plugins.toggleterm')) +vim.list_extend(plugins, require('custom.plugins.lazygit')) return plugins diff --git a/lua/custom/plugins/lazygit.lua b/lua/custom/plugins/lazygit.lua new file mode 100644 index 00000000000..9ec9d4cb038 --- /dev/null +++ b/lua/custom/plugins/lazygit.lua @@ -0,0 +1,26 @@ +-- LazyGit integration using dedicated plugin for better performance and keybind handling +return { + { + 'kdheepak/lazygit.nvim', + cmd = { + 'LazyGit', + 'LazyGitConfig', + 'LazyGitCurrentFile', + 'LazyGitFilter', + 'LazyGitFilterCurrentFile', + }, + dependencies = { + 'nvim-lua/plenary.nvim', + }, + keys = { + { 'gg', 'LazyGit', desc = 'LazyGit' }, + { 'gf', 'LazyGitCurrentFile', desc = 'LazyGit Current File' }, + }, + config = function() + vim.g.lazygit_floating_window_winblend = 0 -- transparency of floating window + vim.g.lazygit_floating_window_scaling_factor = 0.95 -- scaling factor for floating window + vim.g.lazygit_floating_window_border_chars = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' } -- customize border + vim.g.lazygit_use_neovim_remote = 1 -- Use neovim remote for editing commit messages + end, + }, +} diff --git a/lua/custom/plugins/toggleterm.lua b/lua/custom/plugins/toggleterm.lua index 044d8c4cf64..223f1c0ffa1 100644 --- a/lua/custom/plugins/toggleterm.lua +++ b/lua/custom/plugins/toggleterm.lua @@ -57,7 +57,6 @@ return { local TERM_FLOAT = 1 local TERM_HORIZONTAL = 2 local TERM_VERTICAL = 3 - local TERM_LAZYGIT = 10 local function toggle_float() toggleterm.toggle(TERM_FLOAT, nil, nil, 'float') @@ -71,22 +70,6 @@ return { toggleterm.toggle(TERM_VERTICAL, nil, nil, 'vertical') end - local lazygit = nil - if vim.fn.executable('lazygit') == 1 then - local Terminal = require('toggleterm.terminal').Terminal - lazygit = Terminal:new { - cmd = 'lazygit', - count = TERM_LAZYGIT, - direction = 'float', - hidden = true, - float_opts = { - border = 'curved', - }, - } - else - vim.notify('lazygit not found in PATH. Install it to use tg', vim.log.levels.WARN) - end - local map = vim.keymap.set map({ 'n', 'i', 't' }, '', toggle_float, { desc = 'Toggle floating terminal' }) @@ -94,13 +77,6 @@ return { map('n', 'th', toggle_horizontal, { desc = '[T]erminal horizontal' }) map('n', 'tv', toggle_vertical, { desc = '[T]erminal vertical' }) map('n', 'tt', 'TermSelect', { desc = '[T]erminal picker' }) - map('n', 'tg', function() - if lazygit then - lazygit:toggle() - else - vim.notify('lazygit is not available', vim.log.levels.WARN) - end - end, { desc = '[T]erminal lazygit' }) map('n', 'ts', function() vim.cmd.ToggleTermSendCurrentLine(TERM_FLOAT) end, { desc = '[T]erminal [s]end line' })