aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2015-07-23 00:48:51 -0400
committerTeddy Wing2015-07-23 00:48:51 -0400
commita43d3caaea3682f58aee6dc295e48cca415067c5 (patch)
tree513932890d0eb1fdd059ad62ef54701007a0f0ac
parent6752ebe34e1e53373fb7895e7a177272a90abdc0 (diff)
downloaddotvim-a43d3caaea3682f58aee6dc295e48cca415067c5.tar.bz2
vimrc: Add mapping to `git blame` current buffer
Inspired by a mapping I happened upon in Ben Orenstein's vimrc, this will open a new vertical split with the `git blame` of the current buffer. Still needs to be refined, but this should be useful without having to install Fugitive (as I'm not convinced I need most of what the plugin provides). Noticed recently that I've been `git blame`ing a file I have open in Vim, and need to type out the file path into a terminal in order to get to it. Would be much quicker to just open this in Vim.
-rw-r--r--vimrc8
1 files changed, 8 insertions, 0 deletions
diff --git a/vimrc b/vimrc
index 01de3b2..c375449 100644
--- a/vimrc
+++ b/vimrc
@@ -321,6 +321,9 @@
" 2015.07.21:
" * Add mappings for Netrw :Explore, :Sexplore, :Vexplore, and :Rexplore
"
+" 2015.07.23:
+" * Add mapping to open a new split that `git blame`s the current file
+"
" Pathogen
@@ -650,6 +653,11 @@ cnoremap <Esc>f <S-Right>
" Read from OS X pasteboard for faster pasting
nnoremap <leader>p :read !pbpaste<cr>
+" Open a new split with a `git blame` of the current file
+" Inspired by Ben Orenstein
+" https://github.com/r00k/dotfiles/blob/7874508b825fd754e4ec3259da65f324ab96c8ea/vimrc#L74
+nnoremap <leader>gb :vnew \| read !git blame <c-r>=expand('%:p')<cr><cr> \| redraw!<cr>
+
" Commands