Compare commits

..

No commits in common. "2611de78f292b539b766fd8ab9da9b752bdf25d8" and "9e8f286a62c95f0b9e9dd4fcea207be536ed7f3e" have entirely different histories.

8 changed files with 27 additions and 137 deletions

13
.busted
View File

@ -1,13 +0,0 @@
return {
_all = {
coverage = false,
lpath = 'lua/?.lua;lua/?/init.lua',
lua = 'nlua',
},
default = {
verbose = true,
},
tests = {
verbose = true,
},
}

View File

@ -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>"

View File

@ -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 }}

View File

@ -1,6 +0,0 @@
column_width = 100
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "Always"

21
LICENSE
View File

@ -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.

View File

@ -2,17 +2,20 @@
持久化自适应浮动终端管理器。
每次按 `<c-t>` 打开 shell聊完 Reasonix 按 `<C-i>` 隐藏,再按回来——对话还在。横屏自动右侧分屏,竖屏自动下方分屏。
## 特性
- **持久化** — 同一个终端实例反复 show/hide命令输出不丢
- **自适应方向** — 横屏 → 右侧分屏45%),竖屏 → 下方分屏40%
- **轻量** — 依赖 toggleQQdock.nvimAPI 简洁
## 安装
```lua
-- lazy.nvim
{
'newbie/QQdock.nvim',
dependencies = { 'akinsho/toggleterm.nvim' },
"newbie/QQdock.nvim",
dependencies = { "akinsho/toggleQQdock.nvim" },
config = function()
-- QQdock 无全局配置,直接用
require("QQdock").setup()
end,
}
```
@ -20,42 +23,31 @@
## 用法
```lua
local Q = require('QQdock')
local T = require("QQdock")
Q.shell() -- 普通 shell
Q.open('reasonix') -- Reasonix AI agent
Q.open('lazygit') -- lazygit
Q.open('btm') -- 系统监控
Q.open('yazi') -- 文件管理器
T.shell() -- 普通 shell
T.open("reasonix") -- Reasonix AI
T.open("lazygit") -- lazygit
```
## 推荐键位
```lua
vim.keymap.set({ 'n', 'i' }, '<c-t>', Q.shell, { noremap = true })
vim.keymap.set('n', '<C-i>', function() Q.open('reasonix') end)
vim.keymap.set('n', '<leader>gg', function() Q.open('lazygit') end)
vim.keymap.set("n", "<c-t>", T.shell)
vim.keymap.set("i", "<c-t>", T.shell)
vim.keymap.set("n", "<C-i>", function() T.open("reasonix") end)
vim.keymap.set("n", "<leader>gg", function() T.open("lazygit") end)
```
## API
| 函数 | 参数 | 作用 |
|------|------|------|
| `Q.shell()` | — | 打开/关闭持久 shell |
| `Q.open(cmd)` | cmd | 打开/关闭指定命令的持久终端 |
## 特性
- **持久化** — toggle 显隐,终端状态保留
- **自适应** — 横屏右侧 45%,竖屏下方 40%
- **轻量** — 仅依赖 toggleterm.nvim无其他依赖
| `T.shell()` | — | 打开/关闭持久 shell |
| `T.open(cmd)` | cmd: string | 打开/关闭指定命令的持久终端 |
## TODO
- [ ] 翻译trans
- [ ] 系统监控btop
- [ ] 文件管理器yazi
## 协议
MIT

View File

@ -1,12 +1,14 @@
-- QQdock.nvim — Persistent adaptive terminal dock
--
-- 特性:持久化终端实例、自适应窗口方向(横屏右分屏/竖屏下分屏)、依赖 toggleterm.nvim
-- addons/term.lua — 持久化自适应终端
--
-- 用法:
-- local Q = require('QQdock')
-- Q.shell() -- 打开/关闭普通 shell
-- Q.open('reasonix') -- 打开/关闭 Reasonix
-- Q.open('lazygit') -- 打开/关闭 lazygit
-- local T = require('addons.term')
-- T.shell() -- 打开/关闭普通终端(<c-t>
-- T.open('reasonix') -- 打开/关闭 Reasonix<C-i>
--
-- 特性:
-- - 同一个终端实例持久化(关掉再开回来,对话不丢)
-- - 窗口方向自适应横屏→右侧45%竖屏→下方40%
-- - 依赖 toggleterm.nvim
local M = {}
@ -14,9 +16,6 @@ local terms = {} -- 缓存终端实例key 是命令名nil = 普通 shell
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__'

View File