chodak166 1 month ago
parent
commit
783ce31b51
  1. 9
      .config/nvim/lazy-lock.json
  2. 34
      .config/nvim/lua/config/terminal.lua
  3. 2
      .config/nvim/lua/plugins/terminal.lua
  4. 2
      .gitignore
  5. 6
      .local/share/applications/mimeinfo.cache

9
.config/nvim/lazy-lock.json

@ -4,6 +4,7 @@
"blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" }, "blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"catppuccin": { "branch": "main", "commit": "e068ab5f8261f23f6f71ffd8791ae40315b77b9c" }, "catppuccin": { "branch": "main", "commit": "e068ab5f8261f23f6f71ffd8791ae40315b77b9c" },
"clangd_extensions.nvim": { "branch": "main", "commit": "78c2ecd659d54972be17aa6ba2deac3c53223b80" },
"conform.nvim": { "branch": "master", "commit": "619363c30309d29ffa631e67c8183f2a72caa373" }, "conform.nvim": { "branch": "master", "commit": "619363c30309d29ffa631e67c8183f2a72caa373" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"dotenv.nvim": { "branch": "main", "commit": "7d516e9293c6e3ac21830fb10a4e8674c02747c6" }, "dotenv.nvim": { "branch": "main", "commit": "7d516e9293c6e3ac21830fb10a4e8674c02747c6" },
@ -12,19 +13,21 @@
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
"gitsigns.nvim": { "branch": "main", "commit": "2038c666bd9d8a0b7349a0b6ee00dc83104b9ecf" }, "gitsigns.nvim": { "branch": "main", "commit": "2038c666bd9d8a0b7349a0b6ee00dc83104b9ecf" },
"grug-far.nvim": { "branch": "main", "commit": "c69859c1d5427ab5fc7ed12380ab521b4e336691" }, "grug-far.nvim": { "branch": "main", "commit": "c69859c1d5427ab5fc7ed12380ab521b4e336691" },
"hybrid-theme": { "branch": "main", "commit": "10e207f3ac64c4b46c7331b57463e26c25d94e16" },
"indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" }, "indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" },
"just-runner.nvim": { "branch": "main", "commit": "f29d405aa828900df242600720a2b0e57261489f" }, "just-runner.nvim": { "branch": "main", "commit": "f29d405aa828900df242600720a2b0e57261489f" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"lazydev.nvim": { "branch": "main", "commit": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d" }, "lazydev.nvim": { "branch": "main", "commit": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d" },
"lualine.nvim": { "branch": "master", "commit": "221ce6b2d999187044529f49da6554a92f740a96" }, "lualine.nvim": { "branch": "master", "commit": "221ce6b2d999187044529f49da6554a92f740a96" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "50bf3871b539896bd0650b882f6e6b467cc1c1eb" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "47059d71b42d74b0a1e9f61c1d99d301039c3b5b" },
"mason.nvim": { "branch": "main", "commit": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d" }, "mason.nvim": { "branch": "main", "commit": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d" },
"mini.ai": { "branch": "main", "commit": "d73c36349aa7b0bab5f77ad71701a1d42211a1df" }, "mini.ai": { "branch": "main", "commit": "cb20f298ebf5ae91924cd0c6c310712de2ef4086" },
"mini.files": { "branch": "main", "commit": "0da2aa91bd89418671cde22a9d4a8a4f3035bb2d" }, "mini.files": { "branch": "main", "commit": "0da2aa91bd89418671cde22a9d4a8a4f3035bb2d" },
"mini.icons": { "branch": "main", "commit": "e56797f90192d81f1fda02e662fc3e8e3d775027" }, "mini.icons": { "branch": "main", "commit": "e56797f90192d81f1fda02e662fc3e8e3d775027" },
"mini.pairs": { "branch": "main", "commit": "db0fac0a25884183650352ccf92b362a41ed2e9c" }, "mini.pairs": { "branch": "main", "commit": "db0fac0a25884183650352ccf92b362a41ed2e9c" },
"noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" }, "noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-dev-container": { "branch": "main", "commit": "365b4c815339d42133829006dce3e5f8b182b771" },
"nvim-lint": { "branch": "master", "commit": "a219b2c9e5b4765e5c845aba119dad55806fcaf1" }, "nvim-lint": { "branch": "master", "commit": "a219b2c9e5b4765e5c845aba119dad55806fcaf1" },
"nvim-lspconfig": { "branch": "master", "commit": "3371bf298c1f56efc26771ee961f461176958fb5" }, "nvim-lspconfig": { "branch": "master", "commit": "3371bf298c1f56efc26771ee961f461176958fb5" },
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" }, "nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
@ -37,6 +40,6 @@
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
"tokyonight.nvim": { "branch": "main", "commit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6" }, "tokyonight.nvim": { "branch": "main", "commit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6" },
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
"ts-comments.nvim": { "branch": "main", "commit": "123a9fb12e7229342f807ec9e6de478b1102b041" }, "ts-comments.nvim": { "branch": "main", "commit": "a59d6092213447450191122c9346f309161504cb" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
} }

34
.config/nvim/lua/config/terminal.lua

@ -6,18 +6,21 @@
-- <leader>fT terminal in the current working directory -- <leader>fT terminal in the current working directory
-- --
-- This module adds: -- This module adds:
-- <Tab> a *dedicated* floating terminal (stable toggle, one-key close) -- <Tab> open/focus a *dedicated* floating terminal (close it with <C-/>)
-- <leader>ft a picker that lists every live terminal so any contextual -- <leader>ft a picker that lists every live terminal so any contextual
-- terminal can be focused or restored even after its window was -- terminal can be focused or restored even after its window was
-- closed/hidden. -- closed/hidden.
local M = {} local M = {}
-- The <Tab> floating terminal. Tracked as an upvalue so <Tab> is a real -- The <Tab> floating terminal. Tracked as an upvalue so <Tab> always re-focuses
-- open/close toggle regardless of which directory the editor is in. -- the *same* float regardless of which directory the editor is in.
---@type snacks.win? ---@type snacks.win?
local float local float
--- Open or focus the <Tab> floating terminal, or hide it if already focused. --- Open or focus the <Tab> floating terminal, or hide it if already focused.
-- NOTE: currently unused; <Tab> calls open_float() instead so shell
-- tab-completion keeps working while the terminal is open. Kept around for a
-- future explicit open/close toggle.
function M.toggle_float() function M.toggle_float()
-- Reuse the existing instance: hide if visible, re-show if hidden. -- Reuse the existing instance: hide if visible, re-show if hidden.
if float and float:buf_valid() then if float and float:buf_valid() then
@ -50,6 +53,31 @@ function M.toggle_float()
end end
end end
--- Open or focus the <Tab> floating terminal. This never hides the window, so
--- once the float is open <Tab> falls through to the shell and stays available
--- for tab-completion. Close the floating terminal with <C-/> while it is
--- visible (handled by Snacks' native terminal keymap).
function M.open_float()
if float and float:buf_valid() then
if not float:win_valid() then
float:show()
end
if float:win_valid() then
vim.api.nvim_set_current_win(float.win)
end
vim.cmd("startinsert")
return
end
-- First open: a high fixed count guarantees this terminal never collides with
-- the count-keyed bottom terminals (1, 2, 3 ...), so it is always the *same*
-- float for <Tab> no matter the context.
float = Snacks.terminal(nil, {
count = 99,
win = { position = "float", border = "rounded" },
})
end
--- List every live Snacks terminal in a picker. Restore/focus one with <CR>, --- List every live Snacks terminal in a picker. Restore/focus one with <CR>,
--- kill one with <d>. --- kill one with <d>.
function M.picker() function M.picker()

2
.config/nvim/lua/plugins/terminal.lua

@ -7,7 +7,7 @@ return {
{ {
"<Tab>", "<Tab>",
function() function()
require("config.terminal").toggle_float() require("config.terminal").open_float()
end, end,
desc = "Terminal (float)", desc = "Terminal (float)",
mode = "n", mode = "n",

2
.gitignore vendored

@ -2,3 +2,5 @@
*.orig *.orig
*.bak *.bak
.config/nvim/.env .config/nvim/.env
.local/share/applications/mimeinfo.cache
.docker/config.json

6
.local/share/applications/mimeinfo.cache

@ -1,6 +0,0 @@
[MIME Cache]
application/x-shellscript=nvim.desktop;
inode/directory=yazi.desktop;
text/html=nvim.desktop;
text/markdown=nvim.desktop;
text/plain=nvim.desktop;
Loading…
Cancel
Save