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

Gives syntax error on seemingly valid code from vim docs #373

Open
poetaman opened this issue Jun 18, 2021 · 0 comments
Open

Gives syntax error on seemingly valid code from vim docs #373

poetaman opened this issue Jun 18, 2021 · 0 comments

Comments

@poetaman
Copy link

poetaman commented Jun 18, 2021

Vim documentation's file tips.txt has an example on how to open help in current window. It works when used, but for some reason vint gives a syntax error on it.

Error:

SyntaxError - unexpected token: . (see vim-jp/vim-vimlparser)

Code:

let s:did_open_help = v:false
function s:HelpCurwin(subject) abort
    let mods = 'silent noautocmd keepalt'
    if !s:did_open_help
        execute mods .. ' help'
        execute mods .. ' helpclose'
        let s:did_open_help = v:true
    endif
    if !getcompletion(a:subject, 'help')->empty()
        execute mods .. ' edit ' .. &helpfile
    endif
    return 'help ' .. a:subject
endfunction
command -bar -nargs=? -complete=help HelpCurwin execute <SID>HelpCurwin(<q-args>)

Source of code snippet:
Search for help-curwin in https://vimhelp.org/tips.txt.html or https://neovim.io/doc/user/tips.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant