Eliot00 / git-lens.vim

A vim9 plugin inspired by VSCode's GitLens.
GNU Affero General Public License v3.0
60 stars 1 forks source link

E1070 when using vim8 native pack system #2

Closed aaronscott072 closed 1 year ago

aaronscott072 commented 1 year ago

After cloning the repo into pack/**/start and starting vim, I receive the following error:

Error detected while processing /.vim/pack/plugins/start/git-lens.vim/plugin/main.vim:
line   18:
E1070: Missing "from"
Press ENTER or type command to continue
Eliot00 commented 1 year ago

@aaronscott072 What's your vim version?

aaronscott072 commented 1 year ago

Believe it was vim 8.1

Eliot00 commented 1 year ago

Believe it was vim 8.1

Now I'm sure it's a version issue: https://github.com/vim/vim/blob/c580943965fc9b006ec233bdee4ea5380f5594ea/src/errors.h#L181

According to the old documentation, the temporary solution is to modify the main.vim to:

vim9script

if exists('LOADED_GIT_LENS') || &cp
    finish
endif
g:LOADED_GIT_LENS = true

if !has('textprop')
    echoerr '[git-lens] needs textprop feature'
    finish
endif

def g:ToggleGitLens()
    const is_special_buffer = &buftype !=# ''
    if is_special_buffer
        echoerr '[git-lens] This is a special buffer'
        return
    endif

    if !get(g:, 'GIT_LENS_ENABLED', false) || !get(b:, 'git_lens_enabled', false)
        g:GIT_LENS_ENABLED = true
        b:git_lens_enabled = true
        git_lens#blame#Initialize()
    else
        g:GIT_LENS_ENABLED = false
        b:git_lens_enabled = false
        git_lens#blame#Deinitialize()
    endif
enddef

if get(g:, 'GIT_LENS_ENABLED', false)
    git_lens#blame#Initialize()
endif
Eliot00 commented 1 year ago

But I think your Vim version may be too old and lacks the feature that blame depends on.

aaronscott072 commented 1 year ago

Thanks for the responses, I missed that dependency somehow when installing, closing as not an issue.