diff --git a/nvim/.config/nvim/after/plugin/fugitive.vim b/nvim/.config/nvim/after/plugin/fugitive.vim index d5f9fcb..ead892c 100644 --- a/nvim/.config/nvim/after/plugin/fugitive.vim +++ b/nvim/.config/nvim/after/plugin/fugitive.vim @@ -36,6 +36,7 @@ nnoremap G :keepalt Git nnoremap gp :call git#git_push_to_upstream() nnoremap gP git#git_push() +nnoremap gO git#git_show_file_on_branch() augroup custom_fugitive autocmd! diff --git a/nvim/.config/nvim/autoload/git.vim b/nvim/.config/nvim/autoload/git.vim index 8f03ec3..5f53436 100644 --- a/nvim/.config/nvim/autoload/git.vim +++ b/nvim/.config/nvim/autoload/git.vim @@ -289,6 +289,11 @@ function! git#git_review_fileview() abort execute "Git difftool -y " . default[3] . "..." . current endfunction +" Show file on another branch without changing current branch +function! git#git_show_file_on_branch() abort + return ":Git show :" . expand("%") +endfunction + " Generate a helpful name when using Git stash function! git#git_stash() abort let current = trim(system("git branch --show-current"))