nvim: fugitive/git: Add helper to rename branch
This commit is contained in:
parent
4565822924
commit
efaba37bcf
3 changed files with 10 additions and 0 deletions
|
@ -13,3 +13,5 @@ nnoremap <buffer> <Leader>gp :call git#git_cherry_pick()<CR>
|
|||
xnoremap <buffer> <Leader>gP :<C-U>call git#git_cherry_pick_range()<CR>
|
||||
nnoremap <buffer> <Leader>gr :call git#git_rebase_branch()<CR>
|
||||
nnoremap <buffer> <Leader>gR :call git#git_reflog_restore()<CR>
|
||||
|
||||
nnoremap <buffer> <expr> <Leader>gn git#git_branch_rename()
|
||||
|
|
|
@ -16,6 +16,7 @@ nnoremap <Leader>gL :Git log --stat -n 100<CR>
|
|||
xnoremap <Leader>gl :<C-U>call git#git_log_range()<CR>
|
||||
xnoremap <Leader>gL :call git#git_log_named_block()<CR>
|
||||
nnoremap <Leader>gM :call git#git_merge_origin()<CR>
|
||||
nnoremap <Leader>gn :Git branch -m<SPACE>
|
||||
nnoremap <Leader>go :call git#git_log_compare()<CR>
|
||||
nnoremap <Leader>gp :Git push<CR>
|
||||
nnoremap <Leader>gP :Git push -u<SPACE>
|
||||
|
|
|
@ -36,6 +36,13 @@ function! git#git_branch_checkout() abort
|
|||
silent execute "bw"
|
||||
endfunction
|
||||
|
||||
" Populate the command line with git command to rename branch on current line.
|
||||
" Run Git branch -a first. Not for renaming current branch.
|
||||
function! git#git_branch_rename() abort
|
||||
let branch_to_rename = trim(getline('.'))
|
||||
return ":Git branch -m " . branch_to_rename . " "
|
||||
endfunction
|
||||
|
||||
" Get the log of the branch on current line in the output of Git branch -a.
|
||||
function! git#git_branch_log() abort
|
||||
let line = trim(getline('.'))
|
||||
|
|
Loading…
Reference in a new issue