mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-13 02:05:40 +08:00
feat(git): add :Git tag
command
This commit is contained in:
parent
f46cd4aab5
commit
b9cc3e76e9
@ -80,7 +80,7 @@ function! git#complete(ArgLead, CmdLine, CursorPos) abort
|
||||
return join(['add', 'push', 'status', 'commit', 'diff',
|
||||
\ 'merge', 'rebase', 'branch', 'checkout',
|
||||
\ 'fetch', 'reset', 'log', 'config', 'reflog',
|
||||
\ 'blame', 'pull', 'stash', 'cherry-pick', 'rm', 'mv', 'remote', 'clean', 'shortlog'
|
||||
\ 'blame', 'pull', 'stash', 'cherry-pick', 'rm', 'mv', 'remote', 'clean', 'shortlog', 'tag'
|
||||
\ ],
|
||||
\ "\n")
|
||||
elseif str =~# '^Git\s\+add\s\+.*$'
|
||||
|
77
bundle/git.vim/lua/git/command/tag.lua
Normal file
77
bundle/git.vim/lua/git/command/tag.lua
Normal file
@ -0,0 +1,77 @@
|
||||
local M = {}
|
||||
|
||||
local job = require('spacevim.api.job')
|
||||
local nt = require('spacevim.api.notify')
|
||||
local log = require('git.log')
|
||||
|
||||
local tag_jobid = -1
|
||||
local stderr_data = {}
|
||||
|
||||
local function on_stdout(id, data)
|
||||
if id ~= tag_jobid then
|
||||
return
|
||||
end
|
||||
for _, line in pairs(data) do
|
||||
nt.notify_max_width = vim.fn.max({ vim.fn.strwidth(line) + 5, nt.notify_max_width })
|
||||
nt.notify(line)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_stderr(id, data)
|
||||
if id ~= tag_jobid then
|
||||
return
|
||||
end
|
||||
for _, line in pairs(data) do
|
||||
table.insert(stderr_data, line)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_exit(id, code, single)
|
||||
log.debug('tag exit code:' .. code .. ' single:' .. single)
|
||||
if id ~= tag_jobid then
|
||||
return
|
||||
end
|
||||
if code == 0 and single == 0 then
|
||||
for _, line in ipairs(stderr_data) do
|
||||
nt.notify(line)
|
||||
end
|
||||
else
|
||||
for _, line in ipairs(stderr_data) do
|
||||
nt.notify(line, 'WarningMsg')
|
||||
end
|
||||
end
|
||||
tag_jobid = -1
|
||||
end
|
||||
|
||||
function M.run(argv)
|
||||
if tag_jobid ~= -1 then
|
||||
nt.notify('previous tag command is not finished')
|
||||
end
|
||||
|
||||
nt.notify_max_width = vim.fn.float2nr(vim.o.columns * 0.3)
|
||||
|
||||
stderr_data = {}
|
||||
|
||||
local cmd = { 'git', 'tag' }
|
||||
|
||||
if argv then
|
||||
for _, v in ipairs(argv) do
|
||||
table.insert(cmd, v)
|
||||
end
|
||||
end
|
||||
log.debug(vim.inspect(cmd))
|
||||
tag_jobid = job.start(cmd, {
|
||||
on_stdout = on_stdout,
|
||||
on_stderr = on_stderr,
|
||||
on_exit = on_exit,
|
||||
})
|
||||
|
||||
if tag_jobid == -1 then
|
||||
nt.notify('`git` is not executable', 'WarningMsg')
|
||||
end
|
||||
end
|
||||
|
||||
function M.complete(ArgLead, CmdLine, CursorPos) end
|
||||
|
||||
return M
|
||||
|
@ -22,6 +22,7 @@ local cmds = {
|
||||
'rm',
|
||||
'shortlog',
|
||||
'status',
|
||||
'tag',
|
||||
}
|
||||
local supported_commands = {}
|
||||
|
||||
|
@ -28,6 +28,7 @@ lang: zh
|
||||
- [x] `:Git blame`
|
||||
- [x] `:Git cherry-pick`
|
||||
- [x] `:Git shortlog`
|
||||
- [x] `:Git tag`
|
||||
- [x] 日志系统整合至 SpaceVim 运行时日志
|
||||
- [x] 使用 lua 重写 code runner
|
||||
- [x] 使用 lua 重写 task manager
|
||||
@ -39,9 +40,15 @@ lang: zh
|
||||
- [x] 增加 git 远程仓库管理插件
|
||||
- [x] 使用 `<cr>` 快捷键展示 git log
|
||||
- [x] 切换项目时,更新 remote 窗口信息
|
||||
- [x] 注册项目管理函数时,使用描述信息
|
||||
- [ ] 缓存远程仓库以及分支名称等信息
|
||||
- [ ] 基于项目路径存储信息
|
||||
- [x] 显示根目录地址
|
||||
- [x] 使用 lua 实现 `ctags#update` 函数
|
||||
- [x] 项目管理插件注册函数增加描述支持
|
||||
- [x] 切换项目时,更新 todo 管理插件窗口内容
|
||||
- [x] 为主题 `one` 增加 treesitter 支持
|
||||
- [x] 最后一个窗口时,关闭 git log 页面
|
||||
|
||||
## 已完成版本
|
||||
|
||||
|
@ -27,6 +27,7 @@ The roadmap defines the project direction and priorities.
|
||||
- [x] `:Git blame`
|
||||
- [x] `:Git cherry-pick`
|
||||
- [x] `:Git shortlog`
|
||||
- [x] `:Git tag`
|
||||
- [x] plugin log manager derived from SPC runtime logger
|
||||
- [x] rewrite code runner with lua
|
||||
- [x] rewrite task manager with lua
|
||||
@ -48,7 +49,6 @@ The roadmap defines the project direction and priorities.
|
||||
- [x] make `one` coloscheme support treesitter
|
||||
- [x] quit git log win when it is last win
|
||||
|
||||
|
||||
## Completed
|
||||
|
||||
All completed releases can be viewed in [changelog](../development/#Changelog)
|
||||
|
Loading…
x
Reference in New Issue
Block a user