diff --git a/nvim/.config/nvim/after/ftplugin/git.vim b/nvim/.config/nvim/after/ftplugin/git.vim index d7613ed..984f903 100644 --- a/nvim/.config/nvim/after/ftplugin/git.vim +++ b/nvim/.config/nvim/after/ftplugin/git.vim @@ -13,3 +13,5 @@ nnoremap gp :call git#git_cherry_pick() xnoremap gP :call git#git_cherry_pick_range() nnoremap gr :call git#git_rebase_branch() nnoremap gR :call git#git_reflog_restore() + +nnoremap gn git#git_branch_rename() diff --git a/nvim/.config/nvim/after/plugin/fugitive.vim b/nvim/.config/nvim/after/plugin/fugitive.vim index 2610a42..c706f13 100644 --- a/nvim/.config/nvim/after/plugin/fugitive.vim +++ b/nvim/.config/nvim/after/plugin/fugitive.vim @@ -16,6 +16,7 @@ nnoremap gL :Git log --stat -n 100 xnoremap gl :call git#git_log_range() xnoremap gL :call git#git_log_named_block() nnoremap gM :call git#git_merge_origin() +nnoremap gn :Git branch -m nnoremap go :call git#git_log_compare() nnoremap gp :Git push nnoremap gP :Git push -u diff --git a/nvim/.config/nvim/autoload/git.vim b/nvim/.config/nvim/autoload/git.vim index 4409bcf..55d29bd 100644 --- a/nvim/.config/nvim/autoload/git.vim +++ b/nvim/.config/nvim/autoload/git.vim @@ -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('.'))