Skip to content

A completion can not go with no arguments.#2

Open
DehanLUO wants to merge 1 commit into
scrooloose:masterfrom
DehanLUO:master
Open

A completion can not go with no arguments.#2
DehanLUO wants to merge 1 commit into
scrooloose:masterfrom
DehanLUO:master

Conversation

@DehanLUO

@DehanLUO DehanLUO commented Aug 4, 2021

Copy link
Copy Markdown

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
Copy Markdown

I am also encountering the same error.

@nicored nicored left a comment

Copy link
Copy Markdown

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

zythina commented Sep 2, 2022

Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

The fix works like a charm, thanks !

@silopolis

Copy link
Copy Markdown

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

@Song-Tianxiang Song-Tianxiang left a comment

Copy link
Copy Markdown

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
Copy Markdown
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