From 3ce3f904a723e2cf88dc214d2fce7df5679a7539 Mon Sep 17 00:00:00 2001 From: Sean Wong Date: Tue, 22 Sep 2020 18:15:20 +0800 Subject: [PATCH 1/3] master: trim git commit message if length > window width --- autoload/gitblame.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autoload/gitblame.vim b/autoload/gitblame.vim index cefdfd6..93e2d40 100644 --- a/autoload/gitblame.vim +++ b/autoload/gitblame.vim @@ -81,6 +81,10 @@ function! gitblame#echo() let l:echoMsg = '['.l:gb['error'].']' else let l:echoMsg = '['.l:gb['commit_hash'][0:8].'] '.l:gb['summary'] .l:blank .l:gb['author_mail'] .l:blank .l:gb['author'] .l:blank .'('.l:gb['author_time'].')' + let excess = strwidth(l:echoMsg) - winwidth(0) + if excess > 0 + let l:echoMsg = '['.l:gb['commit_hash'][0:8].'] '.l:gb['summary'][:strwidth(l:gb['summary'])-excess-5] .'...' .l:blank .l:gb['author_mail'] .l:blank .l:gb['author'] .l:blank .'('.l:gb['author_time'].')' + endif endif if (g:GBlameVirtualTextEnable) let l:ns = nvim_create_namespace('gitBlame'.b:GBlameVirtualTextCounter) From 5eb7087c930f8eb3c400575e75bf569d441fb4ea Mon Sep 17 00:00:00 2001 From: Sean Wong Date: Wed, 23 Sep 2020 23:09:59 +0800 Subject: [PATCH 2/3] master: add instruction on auto git blame on current line --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 14bb120..7e2f531 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Using [Vundle](https://github.com/VundleVim/Vundle.vim) Plugin 'zivyangll/git-blame.vim' ``` -Please setting bindings +Manual binding ----------------- ** You must push the map in your vimrc to avoid conflicts with other plugins you may have installed.: ** @@ -54,6 +54,17 @@ Please setting bindings nnoremap s :call gitblame#echo() ``` +Auto git blame on current line +----------------- + +Taking the cue from [@Edo78](https://github.com/Edo78)'s [comment](https://github.com/zivyangll/git-blame.vim/issues/20#issuecomment-534526591), add the following to your `~/.vimrc`: + +```vim +autocmd CursorHold * :call gitblame#echo() +``` + +This will display the git blame after the cursor is held momentarily. + Quick start guide ----------------- From 2dc1b0869c1a2957478e284805df81c7687af6b3 Mon Sep 17 00:00:00 2001 From: Sean Wong Date: Tue, 4 May 2021 12:49:38 +0800 Subject: [PATCH 3/3] add additional feature section and update the plug source to match the forked source --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7e2f531..22b1cef 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,11 @@ See Git Blame information in the status bar for the currently selected line. ![](https://wx2.sinaimg.cn/large/bceaad1fly1frwfmv50ytj21kw0in42a.jpg) +Additional Feature +------------------ + +This fork has the trim message length in the status line, mainly for users who use 1 line height to avoid git commit message > 1 line height and gets prompted to PRESS ENTER TO CONTINUE. + Installation -------------- @@ -36,13 +41,13 @@ then simply copy and paste: Using [vim-plug](https://github.com/junegunn/vim-plug): ```vim -Plug 'zivyangll/git-blame.vim' +Plug 'wotzhs/git-blame.vim' ``` Using [Vundle](https://github.com/VundleVim/Vundle.vim) ```viml -Plugin 'zivyangll/git-blame.vim' +Plugin 'wotzhs/git-blame.vim' ``` Manual binding