Compare commits
No commits in common. "2611de78f292b539b766fd8ab9da9b752bdf25d8" and "9e8f286a62c95f0b9e9dd4fcea207be536ed7f3e" have entirely different histories.
2611de78f2
...
9e8f286a62
13
.busted
13
.busted
|
|
@ -1,13 +0,0 @@
|
||||||
return {
|
|
||||||
_all = {
|
|
||||||
coverage = false,
|
|
||||||
lpath = 'lua/?.lua;lua/?/init.lua',
|
|
||||||
lua = 'nlua',
|
|
||||||
},
|
|
||||||
default = {
|
|
||||||
verbose = true,
|
|
||||||
},
|
|
||||||
tests = {
|
|
||||||
verbose = true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
name: Ci
|
|
||||||
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Stylua
|
|
||||||
uses: JohnnyMorganz/stylua-action@v3
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
version: latest
|
|
||||||
args: --check .
|
|
||||||
|
|
||||||
docs:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: pandoc to vimdoc
|
|
||||||
if: ${{ github.ref == 'refs/heads/main' }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: panvimdoc
|
|
||||||
uses: kdheepak/panvimdoc@main
|
|
||||||
with:
|
|
||||||
vimdoc: QQdock.nvim.nvim
|
|
||||||
treesitter: true
|
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
|
||||||
with:
|
|
||||||
commit_message: "chore(doc): auto generate docs"
|
|
||||||
commit_user_name: "github-actions[bot]"
|
|
||||||
commit_user_email: "github-actions[bot]@users.noreply.github.com"
|
|
||||||
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
|
|
||||||
ub.com>"
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
name: Run tests
|
|
||||||
on:
|
|
||||||
pull_request: ~
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Run tests
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
neovim_version: ['nightly', 'stable']
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Download stylua
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
wget "https://github.com/JohnnyMorganz/StyLua/releases/download/v0.18.0/stylua-linux.zip" -P /home/runner/.local/bin
|
|
||||||
unzip /home/runner/.local/bin/stylua-linux.zip -d /home/runner/.local/bin
|
|
||||||
chmod +x /home/runner/.local/bin/stylua
|
|
||||||
- name: Run tests
|
|
||||||
uses: nvim-neorocks/nvim-busted-action@v1
|
|
||||||
with:
|
|
||||||
nvim_version: ${{ matrix.neovim_version }}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
column_width = 100
|
|
||||||
line_endings = "Unix"
|
|
||||||
indent_type = "Spaces"
|
|
||||||
indent_width = 2
|
|
||||||
quote_style = "AutoPreferSingle"
|
|
||||||
call_parentheses = "Always"
|
|
||||||
21
LICENSE
21
LICENSE
|
|
@ -1,21 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2023 nvimdev
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
44
README.md
44
README.md
|
|
@ -2,17 +2,20 @@
|
||||||
|
|
||||||
持久化自适应浮动终端管理器。
|
持久化自适应浮动终端管理器。
|
||||||
|
|
||||||
每次按 `<c-t>` 打开 shell,聊完 Reasonix 按 `<C-i>` 隐藏,再按回来——对话还在。横屏自动右侧分屏,竖屏自动下方分屏。
|
## 特性
|
||||||
|
|
||||||
|
- **持久化** — 同一个终端实例反复 show/hide,命令输出不丢
|
||||||
|
- **自适应方向** — 横屏 → 右侧分屏(45%),竖屏 → 下方分屏(40%)
|
||||||
|
- **轻量** — 依赖 toggleQQdock.nvim,API 简洁
|
||||||
|
|
||||||
## 安装
|
## 安装
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- lazy.nvim
|
|
||||||
{
|
{
|
||||||
'newbie/QQdock.nvim',
|
"newbie/QQdock.nvim",
|
||||||
dependencies = { 'akinsho/toggleterm.nvim' },
|
dependencies = { "akinsho/toggleQQdock.nvim" },
|
||||||
config = function()
|
config = function()
|
||||||
-- QQdock 无全局配置,直接用
|
require("QQdock").setup()
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
@ -20,42 +23,31 @@
|
||||||
## 用法
|
## 用法
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local Q = require('QQdock')
|
local T = require("QQdock")
|
||||||
|
|
||||||
Q.shell() -- 普通 shell
|
T.shell() -- 普通 shell
|
||||||
Q.open('reasonix') -- Reasonix AI agent
|
T.open("reasonix") -- Reasonix AI
|
||||||
Q.open('lazygit') -- lazygit
|
T.open("lazygit") -- lazygit
|
||||||
Q.open('btm') -- 系统监控
|
|
||||||
Q.open('yazi') -- 文件管理器
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 推荐键位
|
## 推荐键位
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
vim.keymap.set({ 'n', 'i' }, '<c-t>', Q.shell, { noremap = true })
|
vim.keymap.set("n", "<c-t>", T.shell)
|
||||||
vim.keymap.set('n', '<C-i>', function() Q.open('reasonix') end)
|
vim.keymap.set("i", "<c-t>", T.shell)
|
||||||
vim.keymap.set('n', '<leader>gg', function() Q.open('lazygit') end)
|
vim.keymap.set("n", "<C-i>", function() T.open("reasonix") end)
|
||||||
|
vim.keymap.set("n", "<leader>gg", function() T.open("lazygit") end)
|
||||||
```
|
```
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
| 函数 | 参数 | 作用 |
|
| 函数 | 参数 | 作用 |
|
||||||
|------|------|------|
|
|------|------|------|
|
||||||
| `Q.shell()` | — | 打开/关闭持久 shell |
|
| `T.shell()` | — | 打开/关闭持久 shell |
|
||||||
| `Q.open(cmd)` | cmd | 打开/关闭指定命令的持久终端 |
|
| `T.open(cmd)` | cmd: string | 打开/关闭指定命令的持久终端 |
|
||||||
|
|
||||||
## 特性
|
|
||||||
|
|
||||||
- **持久化** — toggle 显隐,终端状态保留
|
|
||||||
- **自适应** — 横屏右侧 45%,竖屏下方 40%
|
|
||||||
- **轻量** — 仅依赖 toggleterm.nvim,无其他依赖
|
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- [ ] 翻译(trans)
|
- [ ] 翻译(trans)
|
||||||
- [ ] 系统监控(btop)
|
- [ ] 系统监控(btop)
|
||||||
- [ ] 文件管理器(yazi)
|
- [ ] 文件管理器(yazi)
|
||||||
|
|
||||||
## 协议
|
|
||||||
|
|
||||||
MIT
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
-- QQdock.nvim — Persistent adaptive terminal dock
|
-- addons/term.lua — 持久化自适应终端
|
||||||
--
|
|
||||||
-- 特性:持久化终端实例、自适应窗口方向(横屏右分屏/竖屏下分屏)、依赖 toggleterm.nvim
|
|
||||||
--
|
--
|
||||||
-- 用法:
|
-- 用法:
|
||||||
-- local Q = require('QQdock')
|
-- local T = require('addons.term')
|
||||||
-- Q.shell() -- 打开/关闭普通 shell
|
-- T.shell() -- 打开/关闭普通终端(<c-t>)
|
||||||
-- Q.open('reasonix') -- 打开/关闭 Reasonix
|
-- T.open('reasonix') -- 打开/关闭 Reasonix(<C-i>)
|
||||||
-- Q.open('lazygit') -- 打开/关闭 lazygit
|
--
|
||||||
|
-- 特性:
|
||||||
|
-- - 同一个终端实例持久化(关掉再开回来,对话不丢)
|
||||||
|
-- - 窗口方向自适应:横屏→右侧(45%),竖屏→下方(40%)
|
||||||
|
-- - 依赖 toggleterm.nvim
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
|
@ -14,9 +16,6 @@ local terms = {} -- 缓存终端实例,key 是命令名(nil = 普通 shell
|
||||||
|
|
||||||
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__'
|
||||||
|
|
||||||
Loading…
Reference in New Issue