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

A completion can not go with no arguments. #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DehanLUO
Copy link

@DehanLUO DehanLUO commented Aug 4, 2021

Reproduce the bug

~/.vim/vimrc

call plug#begin('~/.vim/plugged')

Plug 'preservim/nerdtree'
Plug 'scrooloose/nerdtree-project-plugin'

call plug#end()

Open vim.

Describe the bug

My vim (8.2.3200) gives the following warning with the two plugins installed.

Error detected while processing /home/admin/.vim/plugged/nerdtree/plugin/NERD_tree.vim[229]..function nerdtree#postSourceActions[5]..script /home/admin/.vim/plugged/nerdtree-project-plugin/nerdtree_plugin/project.vim:
line   45: E1208: -complete used without -nargsPress 

Looking at the repo for project.vim, the existing code causes the warning.

command! -nargs=0 -complete=customlist,NERDTreeCompleteProjectNames NERDTreeProjectLoadFromCWD call g:NERDTreeProject.LoadFromCWD() 

A completion should go with at least an argument, while -nargs=0 means no arguments are allowed. Changing to –nargs=?, specifying 0 or 1 arguments are allowed, can solve the problem.

@terrencetec
Copy link

I am also encountering the same error.

Copy link

@nicored nicored left a comment

Choose a reason for hiding this comment

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

lgtm and it works on my machine

@zythina
Copy link

zythina commented Sep 2, 2022

Same error on both Windows 11 with Powershell and Arch Linux on bash and zshrc ( although it may not be relevant )

LE: This branch's fix worked for me, thank you!

@unfirthman
Copy link

Had the same issue with Ubuntu 22.04 on a Macbook using ohmyzsh. I applied this fix locally and it worked. Thanks!

@jlejeune
Copy link

The fix works like a charm, thanks !

@silopolis
Copy link

Just switched Vundle entry to @DehanLUO 's repo in vimrc and back on track 💯
Thanks!

Copy link

@Song-Tianxiang Song-Tianxiang left a comment

Choose a reason for hiding this comment

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

I think it's better change line 45 to:
command! -nargs=0 NERDTreeProjectLoadFromCWD call g:NERDTreeProject.LoadFromCWD()

There is no argument needed.

@DehanLUO
Copy link
Author

I think it's better change line 45 to: command! -nargs=0 NERDTreeProjectLoadFromCWD call g:NERDTreeProject.LoadFromCWD()

There is no argument needed.

Yes. You are right.

-complete=customlist,NERDTreeCompleteProjectNames is meant to provide ProjectName completions for command g:NERDTreeProject.LoadFromCWD(), which is designed to take no arguments.

Your version, command! -nargs=0 NERDTreeProjectLoadFromCWD call g:NERDTreeProject.LoadFromCWD(), will not attempt to use the useless argument completion, and it should resolve the warning.

Thanks. Have a good day!

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

Successfully merging this pull request may close these issues.

8 participants