From a9c91c06e434d1101a7bae7d6de3dd5d00677754 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Fri, 14 May 2021 14:16:13 +0530 Subject: [PATCH] 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 which we do not want. Basically we do not want a fugitive git buffer to become alternate-file. See :help alternate-file. --- nvim/.config/nvim/autoload/git.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nvim/.config/nvim/autoload/git.vim b/nvim/.config/nvim/autoload/git.vim index 820c156..6c7f323 100644 --- a/nvim/.config/nvim/autoload/git.vim +++ b/nvim/.config/nvim/autoload/git.vim @@ -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