Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add coc_git_blame support #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions plugin/eleline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,13 @@ function! ElelineCoc() abort
return ''
endif
if get(g:, 'coc_enabled', 0)
return coc#status().' '
let l:coc_status = coc#status()
if !empty(get(b:, 'coc_git_blame', ''))
if len(l:coc_status) + len(b:coc_git_blame) < winwidth("%") / 3
return l:coc_status.' '.b:coc_git_blame
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the full blame info can be very long and consume too many valuable spaces of the statusline. If you only show them when the info's short, that's kind of strange as they can just show occasionally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes @liuchengxu currently it only shows when the info isn't too long. I'm actually not sure on the correct way to see git blame.

in virtual text it can be too distracting while coding
in status line it looks better but maybe not enough space

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can truncate the blame info to a short one, but not sure that's still very useful.

endif
endif
return l:coc_status
endif
return ''
endfunction
Expand All @@ -240,7 +246,7 @@ function! s:StatusLine() abort
let l:status = s:def('ElelineGitStatus')
let l:error = s:def('ElelineError')
let l:warning = s:def('ElelineWarning')
let l:tags = '%{exists("b:gutentags_files") ? gutentags#statusline() : ""} '
let l:tags = '%{exists("b:gutentags_files") ? gutentags#statusline() : ""}'
let l:lcn = '%{ElelineLCN()}'
let l:coc = '%{ElelineCoc()}'
let l:lsp = ''
Expand Down