restore: local addons/QQdock pending RO fs fix, remote repo at git.qyhhh.top/newbie/QQdock.nvim
This commit is contained in:
parent
9ae6fcb2ad
commit
7884551a26
|
|
@ -1,21 +1,21 @@
|
||||||
-- addons/term.lua — 持久化自适应终端
|
-- addons/QQdock.lua — 持久化自适应终端
|
||||||
|
--
|
||||||
|
-- 注意:这是 QQdock.nvim 插件的本地副本(根分区只读,无法通过 lazy 装远程插件)
|
||||||
|
-- 远程仓库:https://git.qyhhh.top/newbie/QQdock.nvim
|
||||||
--
|
--
|
||||||
-- 用法:
|
-- 用法:
|
||||||
-- local T = require('addons.term')
|
-- local Q = require('addons.QQdock')
|
||||||
-- T.shell() -- 打开/关闭普通终端(<c-t>)
|
-- Q.shell() -- <c-t> 普通终端
|
||||||
-- T.open('reasonix') -- 打开/关闭 Reasonix(<C-i>)
|
-- Q.open('reasonix') -- <C-i> Reasonix
|
||||||
--
|
-- Q.open('lazygit') -- <leader>gg lazygit
|
||||||
-- 特性:
|
|
||||||
-- - 同一个终端实例持久化(关掉再开回来,对话不丢)
|
|
||||||
-- - 窗口方向自适应:横屏→右侧(45%),竖屏→下方(40%)
|
|
||||||
-- - 依赖 toggleterm.nvim
|
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local terms = {} -- 缓存终端实例,key 是命令名(nil = 普通 shell)
|
local terms = {}
|
||||||
|
|
||||||
function M.open(cmd)
|
function M.open(cmd)
|
||||||
local ui = vim.api.nvim_list_uis()[1]
|
local ui = vim.api.nvim_list_uis()[1]
|
||||||
|
if not ui then return end
|
||||||
local tall = ui.height > ui.width
|
local tall = ui.height > ui.width
|
||||||
local name = cmd or '__shell__'
|
local name = cmd or '__shell__'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,11 @@ G.map({
|
||||||
{ 'n', '<right>', ':vertical resize +5<CR>' },
|
{ 'n', '<right>', ':vertical resize +5<CR>' },
|
||||||
})
|
})
|
||||||
|
|
||||||
-- 终端(addons/term:持久化 + 自适应分屏)
|
-- 终端 / Reasonix / lazygit(addons/QQdock:持久化 + 自适应分屏)
|
||||||
local T = require('addons.QQdock')
|
local Q = require('addons.QQdock')
|
||||||
G.map({
|
G.map({
|
||||||
{ 'n', '<c-t>', T.shell, { noremap = true } },
|
{ 'n', '<c-t>', Q.shell, { noremap = true } },
|
||||||
{ 'i', '<c-t>', T.shell, { noremap = true } },
|
{ 'i', '<c-t>', Q.shell, { noremap = true } },
|
||||||
{ 'n', '<C-i>', function() T.open('reasonix') end, { noremap = true } },
|
{ 'n', '<C-i>', function() Q.open('reasonix') end, { noremap = true } },
|
||||||
{ 'n', '<leader>gg', function() T.open('lazygit') end, { noremap = true } },
|
{ 'n', '<leader>gg', function() Q.open('lazygit') end, { noremap = true } },
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ return {
|
||||||
dependencies = { "nvim-lua/plenary.nvim" },
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
-- 终端(方向由 keymap.lua <c-t> 自适应控制)
|
-- toggleterm:被 addons/QQdock 使用的底层终端
|
||||||
'akinsho/toggleterm.nvim',
|
'akinsho/toggleterm.nvim',
|
||||||
version = "*",
|
version = "*",
|
||||||
config = function()
|
config = function()
|
||||||
|
|
@ -44,7 +44,6 @@ return {
|
||||||
shading_factor = 1,
|
shading_factor = 1,
|
||||||
start_in_insert = true,
|
start_in_insert = true,
|
||||||
persist_size = true,
|
persist_size = true,
|
||||||
-- direction 不写死,由 keymap 创建时动态决定
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue