f-person / git-blame.nvim

Git Blame plugin for Neovim written in Lua
GNU General Public License v3.0
909 stars 42 forks source link

Needs to be enabled to make the GitBlameCopySHA or GitBlameOpenCommitURL work #47

Closed ranelpadon closed 2 years ago

ranelpadon commented 2 years ago

I disabled this plugin on startup since I don't want to have clutter:

let g:gitblame_enabled = 0

But when running :GitBlameCopySHA or :GitBlameOpenCommitURL, it will trigger this error and will not work:

Screen Shot 2022-04-27 at 2 40 25 AM

Apparently, I need to enable the plugin first (via :GitBlameEnable or :GitBlameToggle) before I could execute those 2 commands, which is not good UX I think. Ideally, the plugin should be enabled automatically when it's disabled before performing actions such as :GitBlameCopySHA or :GitBlameOpenCommitURL, then revert back to disabled after performing the actions.

I tried this also but it didn't work (same error):

function SampleFunc()
      :GitBlameEnable  " Make sure it's enabled.
      :GitBlameCopySHA
      :GitBlameDisable  " Revert back to disabled.
endfunction
nnoremap <Leader>gbs :call SampleFunc()<CR>

Am I missing something? Or could we have a flag/setting to have this kind of behavior? Thanks :)

f-person commented 2 years ago

Hi, thanks for the issue! Yup, the plugin doesn't load blames when it's disabled, that's why you get the exception. I think what you tried to do is the expected behavior and will fix it on weekends or sooner :)

f-person commented 2 years ago

It's fixed now :)

ranelpadon commented 2 years ago

@f-person Confirmed to be working. Thanks a lot. :)