mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 10:20:05 +08:00
perf(git): add key binding v
to view log
This commit is contained in:
parent
16b8430918
commit
305e4545ec
@ -103,6 +103,23 @@ local function delete_branch()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function view_log_of_branch()
|
||||||
|
local remote_line = vim.fn.search('^r:', 'bnW')
|
||||||
|
if remote_line == 0 then
|
||||||
|
local line = vim.fn.getline('.')
|
||||||
|
if vim.startswith(line, ' * ') then
|
||||||
|
elseif vim.startswith(line, ' ') then
|
||||||
|
local branch = vim.trim(line)
|
||||||
|
vim.cmd('tabnew | Git log ' .. branch)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local line = vim.fn.getline('.')
|
||||||
|
local branch = vim.trim(line)
|
||||||
|
local remote = string.sub(vim.fn.getline(remote_line), 3)
|
||||||
|
vim.cmd('tabnew | Git log ' .. remote .. '/' .. branch)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function M.open()
|
function M.open()
|
||||||
if branch_manager_bufnr ~= -1 and vim.api.nvim_buf_is_valid(branch_manager_bufnr) then
|
if branch_manager_bufnr ~= -1 and vim.api.nvim_buf_is_valid(branch_manager_bufnr) then
|
||||||
vim.api.nvim_buf_delete(branch_manager_bufnr, {
|
vim.api.nvim_buf_delete(branch_manager_bufnr, {
|
||||||
@ -125,6 +142,9 @@ function M.open()
|
|||||||
vim.api.nvim_buf_set_keymap(branch_manager_bufnr, 'n', 'dd', '', {
|
vim.api.nvim_buf_set_keymap(branch_manager_bufnr, 'n', 'dd', '', {
|
||||||
callback = delete_branch,
|
callback = delete_branch,
|
||||||
})
|
})
|
||||||
|
vim.api.nvim_buf_set_keymap(branch_manager_bufnr, 'n', 'v', '', {
|
||||||
|
callback = view_log_of_branch,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.update()
|
function M.update()
|
||||||
|
@ -58,6 +58,14 @@ if you want to use `fugitive` instead:
|
|||||||
| `SPC g h r` | undo cursor hunk |
|
| `SPC g h r` | undo cursor hunk |
|
||||||
| `SPC g h v` | preview cursor hunk |
|
| `SPC g h v` | preview cursor hunk |
|
||||||
|
|
||||||
|
**Key bindings in Git branch manager:**
|
||||||
|
|
||||||
|
| Key Binding | Description |
|
||||||
|
| ----------- | ------------------ |
|
||||||
|
| `v` | view log of branch |
|
||||||
|
| `Enter` | checkout branch |
|
||||||
|
| `dd` | delete branch |
|
||||||
|
|
||||||
## Omnifunc of commit message
|
## Omnifunc of commit message
|
||||||
|
|
||||||
This layer also provides omnifunc of commit message. The key binding is `ctrl-x_ctrl-o` in insert mode.
|
This layer also provides omnifunc of commit message. The key binding is `ctrl-x_ctrl-o` in insert mode.
|
||||||
|
Loading…
Reference in New Issue
Block a user