switch QQdock from local module to lazy spec
This commit is contained in:
parent
e1009aea83
commit
93650204df
|
|
@ -1,37 +0,0 @@
|
|||
-- addons/QQdock.lua — 持久化自适应终端
|
||||
--
|
||||
-- 注意:这是 QQdock.nvim 插件的本地副本(根分区只读,无法通过 lazy 装远程插件)
|
||||
-- 远程仓库:https://git.qyhhh.top/newbie/QQdock.nvim
|
||||
--
|
||||
-- 用法:
|
||||
-- local Q = require('addons.QQdock')
|
||||
-- Q.shell() -- <c-t> 普通终端
|
||||
-- Q.open('reasonix') -- <C-i> Reasonix
|
||||
-- Q.open('lazygit') -- <leader>gg lazygit
|
||||
|
||||
local M = {}
|
||||
|
||||
local terms = {}
|
||||
|
||||
function M.open(cmd)
|
||||
local ui = vim.api.nvim_list_uis()[1]
|
||||
if not ui then return end
|
||||
local tall = ui.height > ui.width
|
||||
local name = cmd or '__shell__'
|
||||
|
||||
if not terms[name] or not terms[name]:is_open() then
|
||||
terms[name] = require('toggleterm.terminal').Terminal:new({
|
||||
direction = tall and 'horizontal' or 'vertical',
|
||||
cmd = cmd,
|
||||
size = tall and math.floor(ui.height * 0.4) or math.floor(ui.width * 0.45),
|
||||
})
|
||||
end
|
||||
|
||||
terms[name]:toggle()
|
||||
end
|
||||
|
||||
function M.shell()
|
||||
M.open(nil)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -38,12 +38,3 @@ G.map({
|
|||
{ 'n', '<right>', ':vertical resize +5<CR>' },
|
||||
})
|
||||
|
||||
-- 终端 / Reasonix / lazygit(QQdock.nvim:持久化 + 自适应分屏)
|
||||
-- TODO: 根分区恢复读写后改为 lazy spec 引用 git.qyhhh.top/newbie/QQdock.nvim,删本地 lua/QQdock/
|
||||
local Q = require('QQdock')
|
||||
G.map({
|
||||
{ 'n', '<c-t>', Q.shell, { noremap = true } },
|
||||
{ 'i', '<c-t>', Q.shell, { noremap = true } },
|
||||
{ 'n', '<C-i>', function() Q.open('reasonix') end, { noremap = true } },
|
||||
{ 'n', '<leader>gg', function() Q.open('lazygit') end, { noremap = true } },
|
||||
})
|
||||
|
|
|
|||
|
|
@ -9,7 +9,5 @@ return {
|
|||
require('plugs.theme'),
|
||||
require('plugs.edit-plugs'),
|
||||
require('plugs.dev'),
|
||||
-- TODO: 根分区恢复读写后启用 ↓
|
||||
-- require('plugs.QQdock'),
|
||||
-- 同时删 lua/QQdock/ 目录、删 keymap.lua 中的 QQdock 映射段
|
||||
require('plugs.QQdock'),
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue