This commit is contained in:
Ruslan Matveev 2025-10-21 22:06:46 -04:00
parent 2f87cff429
commit c3046fb544
5 changed files with 75 additions and 120 deletions

View File

@ -1,94 +1,26 @@
{ {
"LuaSnip": { "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
"branch": "master", "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" },
"commit": "458560534a73f7f8d7a11a146c801db00b081df0" "conform.nvim": { "branch": "master", "commit": "235dd79731c1dc51ec04abb4045cbc54727a172a" },
}, "fidget.nvim": { "branch": "main", "commit": "3f5475949679953af6d78654db29b944fa826e6a" },
"blink.cmp": { "gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" },
"branch": "main", "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" },
"commit": "327fff91fe6af358e990be7be1ec8b78037d2138" "lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" },
}, "lazydev.nvim": { "branch": "main", "commit": "e28ce52fc7ff79fcb76f0e79ee6fb6182fca90b9" },
"conform.nvim": { "lazygit.nvim": { "branch": "main", "commit": "2305deed25bc61b866d5d39189e9105a45cf1cfb" },
"branch": "master", "mason-lspconfig.nvim": { "branch": "main", "commit": "2304ff65ecc8cb2afc2484de3e2ed9a407edf0b9" },
"commit": "235dd79731c1dc51ec04abb4045cbc54727a172a" "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
}, "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
"fidget.nvim": { "mini.nvim": { "branch": "main", "commit": "cf32454e91b3d963a12fef0314811fb035b62d49" },
"branch": "main", "nvim-lspconfig": { "branch": "master", "commit": "e5c61b02f33b5c6538be25b2696b33b4cc91e667" },
"commit": "3f5475949679953af6d78654db29b944fa826e6a" "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
}, "nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" },
"gitsigns.nvim": { "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"branch": "main", "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
"commit": "20ad4419564d6e22b189f6738116b38871082332" "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
}, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"guess-indent.nvim": { "todo-comments.nvim": { "branch": "main", "commit": "19d461ddd543e938eb22505fb03fa878800270b6" },
"branch": "main", "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
"commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" "tokyonight.nvim": { "branch": "main", "commit": "e63c42a42b11cd6225f009dd949b9ee0fccc15ef" },
}, "which-key.nvim": { "branch": "main", "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" }
"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"
}
} }

View File

@ -1,15 +1,35 @@
# Custom ToggleTerm Setup # Custom Plugins Setup
## ToggleTerm
Quick notes on the terminal experience provided by `lua/custom/plugins/toggleterm.lua`. Quick notes on the terminal experience provided by `lua/custom/plugins/toggleterm.lua`.
## Highlights ### Highlights
- Floating terminals sized responsively to the current UI (`<C-\>` or `<leader>tf`). - Floating terminals sized responsively to the current UI (`<C-\>` or `<leader>tf`).
- Dedicated splits: `<leader>th` (horizontal) and `<leader>tv` (vertical). - Dedicated splits: `<leader>th` (horizontal) and `<leader>tv` (vertical).
- Terminal picker `<leader>tt`, plus a pre-configured floating `lazygit` on `<leader>tg`. - Terminal picker `<leader>tt` to switch between multiple terminals.
- Send code to the primary terminal with `<leader>ts` (line or visual selection). - Send code to the primary terminal with `<leader>ts` (line or visual selection).
- Terminal windows inherit familiar navigation (`<Esc>`, `jk`, `<C-hjkl>`) automatically. - Terminal windows inherit familiar navigation (`<Esc>`, `jk`, `<C-hjkl>`) automatically.
## Tips ### Tips
- Use counts (`2ToggleTerm`, `3ToggleTerm`) when you want to retarget a specific layout. - Use counts (`2ToggleTerm`, `3ToggleTerm`) when you want to retarget a specific layout.
- `TermExec cmd="npm run test"` reuses the floating terminal without stealing focus. - `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. - 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 `<leader>gg` to open lazygit in current repo
- Use `<leader>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

View File

@ -5,5 +5,6 @@
local plugins = {} local plugins = {}
vim.list_extend(plugins, require('custom.plugins.toggleterm')) vim.list_extend(plugins, require('custom.plugins.toggleterm'))
vim.list_extend(plugins, require('custom.plugins.lazygit'))
return plugins return plugins

View File

@ -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 = {
{ '<leader>gg', '<cmd>LazyGit<cr>', desc = 'LazyGit' },
{ '<leader>gf', '<cmd>LazyGitCurrentFile<cr>', 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,
},
}

View File

@ -57,7 +57,6 @@ return {
local TERM_FLOAT = 1 local TERM_FLOAT = 1
local TERM_HORIZONTAL = 2 local TERM_HORIZONTAL = 2
local TERM_VERTICAL = 3 local TERM_VERTICAL = 3
local TERM_LAZYGIT = 10
local function toggle_float() local function toggle_float()
toggleterm.toggle(TERM_FLOAT, nil, nil, 'float') toggleterm.toggle(TERM_FLOAT, nil, nil, 'float')
@ -71,22 +70,6 @@ return {
toggleterm.toggle(TERM_VERTICAL, nil, nil, 'vertical') toggleterm.toggle(TERM_VERTICAL, nil, nil, 'vertical')
end 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 <leader>tg', vim.log.levels.WARN)
end
local map = vim.keymap.set local map = vim.keymap.set
map({ 'n', 'i', 't' }, '<C-`>', toggle_float, { desc = 'Toggle floating terminal' }) map({ 'n', 'i', 't' }, '<C-`>', toggle_float, { desc = 'Toggle floating terminal' })
@ -94,13 +77,6 @@ return {
map('n', '<leader>th', toggle_horizontal, { desc = '[T]erminal horizontal' }) map('n', '<leader>th', toggle_horizontal, { desc = '[T]erminal horizontal' })
map('n', '<leader>tv', toggle_vertical, { desc = '[T]erminal vertical' }) map('n', '<leader>tv', toggle_vertical, { desc = '[T]erminal vertical' })
map('n', '<leader>tt', '<cmd>TermSelect<CR>', { desc = '[T]erminal picker' }) map('n', '<leader>tt', '<cmd>TermSelect<CR>', { desc = '[T]erminal picker' })
map('n', '<leader>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', '<leader>ts', function() map('n', '<leader>ts', function()
vim.cmd.ToggleTermSendCurrentLine(TERM_FLOAT) vim.cmd.ToggleTermSendCurrentLine(TERM_FLOAT)
end, { desc = '[T]erminal [s]end line' }) end, { desc = '[T]erminal [s]end line' })