diff --git a/nvim/.config/nvim/after/plugin/fugitive.vim b/nvim/.config/nvim/after/plugin/fugitive.vim index 2658aa2..2c9aaf0 100644 --- a/nvim/.config/nvim/after/plugin/fugitive.vim +++ b/nvim/.config/nvim/after/plugin/fugitive.vim @@ -23,7 +23,7 @@ nnoremap gM :call git#git_merge_origin() nnoremap gn :Git branch -m nnoremap go :call git#git_log_compare() nnoremap gr :call git#git_rebase_origin() -nnoremap gR :Git rebase --abort +nnoremap gR :call git#git_review() nnoremap g- :call git#git_stash():e nnoremap g+ :Git stash pop nnoremap gs :Git stash list diff --git a/nvim/.config/nvim/autoload/git.vim b/nvim/.config/nvim/autoload/git.vim index e34fc66..9457e12 100644 --- a/nvim/.config/nvim/autoload/git.vim +++ b/nvim/.config/nvim/autoload/git.vim @@ -242,6 +242,13 @@ function! git#git_rebase_origin() abort execute "Git rebase origin/" . default[3] endfunction +" Opens the output of Git diff main... in a tab for review +function! git#git_review() abort + let default = split(trim(system('git symbolic-ref refs/remotes/origin/HEAD')), '/') + let current = trim(system("git branch --show-current")) + execute "Gtabedit | Git diff " . default[3] . "..." . current . "| only" +endfunction + " Generate a helpful name when using Git stash function! git#git_stash() abort let current = trim(system("git branch --show-current"))