nvim: autoload: git: Use bwipeout instead of bdelete

Really delete the buffer. If bdelete is used, we can still go back to
the previous buffer using <C-^> which we do not want. Basically we do
not want a fugitive git buffer to become alternate-file.

See :help alternate-file.
This commit is contained in:
Sanchayan Maity 2021-05-14 14:16:13 +05:30
parent 8694445d2d
commit a9c91c06e4

View file

@ -17,7 +17,7 @@ function! git#git_branch_delete() abort
execute "Git push -d " . remote . " " . branch
execute "Git branch -D " . branch
endif
silent execute "bd"
silent execute "bw"
endfunction
" Checkout the branch on the current line in the output of Git branch -a.
@ -33,7 +33,7 @@ function! git#git_branch_checkout() abort
silent execute "Git checkout " . remote
silent execute "Git checkout -b " . branch[2]
endif
silent execute "bd"
silent execute "bw"
endfunction
" Get the log of the branch on current line in the output of Git branch -a.
@ -41,7 +41,7 @@ function! git#git_branch_log() abort
let line = trim(getline('.'))
let branch = split(line, "/")
" Close the buffer opened by Git branch -a
silent execute "bd"
silent execute "bw"
if len(branch) == 1
" Handles the case for local branch
execute "Git log " . branch[0]
@ -59,7 +59,7 @@ function! git#git_branch_log_pretty() abort
let line = trim(getline('.'))
let branch = split(line, "/")
" Close the buffer opened by Git branch -a
silent execute "bd"
silent execute "bw"
if len(branch) == 1
" Handles the case for local branch
execute "Git log --pretty=oneline --no-merges " . branch[0]
@ -91,7 +91,7 @@ function! git#git_cherry_pick_range() abort
let oldCommit = split(lines[0], " ")[:0][0]
let newCommit = split(lines[-1], " ")[:0][0]
execute "Git cherry-pick " . oldCommit . "^.." . newCommit
silent execute "bd"
silent execute "bw"
endfunction
" Run Git difftool on the commit in the line which we are at. To be used after