From a43d3caaea3682f58aee6dc295e48cca415067c5 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 23 Jul 2015 00:48:51 -0400 Subject: 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. --- vimrc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'vimrc') 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 f " Read from OS X pasteboard for faster pasting nnoremap p :read !pbpaste +" 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 gb :vnew \| read !git blame =expand('%:p') \| redraw! + " Commands -- cgit v1.2.3