Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Updated: Comment #18
Problem/Motivation
There are two problems with the vimrc file as created or modified by the installation script for this project:
- If the script downloads the current version of pathogen, then the lines added to the vimrc file will not have the correct syntax.
- If the user already has a vimrc file, then the script may need to add "filetype plugin on".
Proposed resolution
Update the drush-based installation script.
Remaining tasks
- Test whether pathogen is already installed, and which syntax it expects, before adding lines to the vimrc file.
- Test whether ftplugins are already enabled before adding the :filetype line.
User interface changes
None.
API changes
None.
Related Issues
None.
Original report by @technicalknocokout
Just tried installing using the drush install instructions, install scripts appeared to run fine without error. Now vim reports the following whenever I edit a file:
Error detected while processing <user path>/.vimrc:
line 3:
E118: Too many arguments for function: pathogen#infect
line 4:
E118: Too many arguments for function: pathogen#infect
Press ENTER or type command to continue
vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled May 31 2012 14:41:25)
MacOS X (unix) version
Comment | File | Size | Author |
---|---|---|---|
#22 | update_install_script-2038201-22.patch | 2.96 KB | benjifisher |
#21 | vimrc-update-variables-2038201-0.patch | 608 bytes | ronaldmulero |
Comments
Comment #1
benjifisherNear the top of your vimrc file (i.e.,
<user path>/.vimrc
) there should be a couple of lines likeIn fact, judging by the error message, the non-comment part will be lines 3 and 4. What do you have there? Probably the fix will be pretty obvious, and I will have to adjust the script to escape the appropriate characters: spaces, commas?
Comment #2
technicalknockout CreditAttribution: technicalknockout commentedThanks for the reply! Here is the stuff the script added to my vimrc:
In the script the actual path to my home folder is where I put <user path>, I just didn't wanna post that.
Comment #3
benjifisherThat looks normal. Are there any unusual characters in
<user path>
: spaces, commas, single quotes, backslashes?The function
pathogen#infect()
expects one argument. The error message is pretty clear: this function is being called with multiple arguments.No, wait. It takes a variable number of arguments. It should never generate that error message.
Maybe something is wrong with your version of pathogen. What does
:function pathogen#infect
tell you? The function declaration should be
function! pathogen#infect(...)
Maybe there is something wrong with your version of vim. You gave the first few lines of
vim --version
, but what features are compiled in? Do you have Huge, Big, Normal, Small, or Tiny version of vim?What error message, if any, do you get when you call
:call pathogen#infect('<user path>/.drush/vimrc/bundle')
manually?
Comment #4
technicalknockout CreditAttribution: technicalknockout commentedNo unusual characters the user path: /Users/ and username is a-z characters.
This is what I get with :function pathogen#infect
Vim version is
Huge version without GUI.
Calling manually I get the same error:
E118: Too many arguments for function
Comment #5
benjifisherAha: there is something wrong with your version of pathogen. I think it is very old. According to https://github.com/tpope/vim-pathogen/commits/master/autoload/pathogen.v... this function was added on May 13, 2011 as a function with no arguments. On June 13, 2011, the function was modified so that you can optionally specify the path (defaults to
~/.vim/bundle
).I suggest you get the current version of pathogen (
~/.vim/autoload/pathogen.vim
). If that is not a good option for you, then you could replace the two lines in your vimrc file withcall pathogen#infect()
and then (untested)
$ ln -s <user path>/.drush/vimrc/bundle/vim-plugin-for-drupal ~/.vim/bundle
It is also possible that there is more than one version of pathogen.vim on your system, and the wrong one is being loaded. You should be able to diagnose this with
:scriptnames
I am changing the category to "support request." If my solution works, then please change the status to "fixed."
Comment #6
technicalknockout CreditAttribution: technicalknockout commentedOk, I updated to the latest vim-pathogen and that got rid of the error but not sure yet how to tell if it's working correctly :) I'll do a little more homework, but just wanted to report I got the following messages related to the drush vimrc-install code:
I guess then this might be a feature request? to update for latest pathogen file as of this time...
Comment #7
benjifisherThanks for letting me know about the warnings. I want to think about how to minimize incompatibilities. I prefer the noisy warning messages you get to the silent failure I get when I add "/{}" to the
pathogen#infect()
lines in my vimrc file.To see whether it is working correctly, you can check
:set rtp?
If pathogen is working, then this should include all subdirectories of
/Users/<username>/.drush/vimrc/bundle
and of/Users/<username>/.vim/bundle
. You should start to see al the Drupal goodness that this project provides. As a test, edit a PHP file in your Drupal project and try:echo b:Drupal_info
Comment #8
technicalknockout CreditAttribution: technicalknockout commentedOK, I see the .drush/vimrc/bundle and I can run Drush commands with :Drush from vim now - so cool :) I'm also seeing what looks like colored markers for the drupal coding standards.
:echo b:Drupal_info
throws some errors though:Not sure that's something that needs fixing or something else in my environment - should I be worried about that? Thanks so much for your help!
Comment #9
benjifisherWhat file were you editing when you got the error?
Comment #10
technicalknockout CreditAttribution: technicalknockout commentedJust tried again - error happens when editing
theme template.php
custom module .module file
index.php at drupal root
Comment #11
benjifisherIf we cannot figure this out quickly, maybe we should open a separate issue.
Those files should all work.
Did you start a new vim session after updating pathogen and editing your vimrc file?
Does
:set ft?
give the result
php.drupal
?Comment #12
technicalknockout CreditAttribution: technicalknockout commentedyes it does, for all those files.
Comment #13
benjifisherThis makes a difference. If
b:Drupal_info
is not set, then a lot of things will not work.You did not answer the first question in #11.
OK, I can think of one explanation. If you have simply
:filetype on
in your vimrc file (the leading ":" is optional) that would explain it. If this is the case, then (when editing almost any file--say index.php to be specific)
:echo did_load_ftplugin
should give an error. In this case,
should give you different results.
If that is not the right answer, then this is what is supposed to happen, with some tests, when you
:e index.php
::set ft?
):scriptnames
)ftplugin/drupal.vim
is :source'd, one of the first few lines is:let b:Drupal_info = drupal#DrupalInfo()
. (:echo b:Drupal_info
Maybe you can figure out which step is broken.
For the record, what version of this project are you using: 7.x-1.0 or the latest git (only one more commit) or (I hope not) an earlier version?
Comment #14
technicalknockout CreditAttribution: technicalknockout commentedI have exited and started vim every time I change the vimrc file or any vim config- is that what you mean by start a new vim session?
Ok in vim running the following does output some php array for b:Drupal_info
Comment #15
technicalknockout CreditAttribution: technicalknockout commentedI'm running whatever version the drush installer installs. Don't really see a changelog or version info in the ~/.drush/vimrc dir. Is there a way to output the version number of a file to check?
Comment #16
benjifisher@technicalknockout:
Thanks for helping me figure out what is going on!
The version probably does not matter for this question. If you downloaded with git, then
git show
should tell you which commit is checked out. You are right, I should include a changelog, especially now that there is a full release (7.x-1.0).For the record, yes.
The install script creates a vimrc file if you do not already have one. In this case, you would get the line
which :source's the example vimrc file that comes with the standard vim distribution. Among other things, this gives you
I am pretty sure that you already had a vimrc file, and that it already included
In this case, the install script will add some lines to the start of your vimrc file, mostly related to pathogen. I did not think to check the :filetype settings. I will have to do something about that.
You should be able to get the full benefit from this project by finding the :filetype line in your vimrc file and adding "plugin". Or add
or
Comment #17
technicalknockout CreditAttribution: technicalknockout commentedYes, it's almost like you're reading my vimrc file :-)
I just added 'plugin' to two lines in my vimrc so they now read as follows:
Now
:echo b:Drupal_info
outputs an array with keys 'DRUPAL_ROOT', 'TYPE', 'CORE', and 'INFO_FILE'.Thanks for your help!
Comment #18
benjifisherI still need to update the install script, so I am marking this issue as NW. Maybe I should update the issue summary now that I know what needs to be done.
Comment #18.0
benjifisheradding vim version info
Comment #19
benjifisherI marked #2089161: " Change pathogen#infect ..." Warning at vim launch as a duplicate of this issue.
Comment #19.0
benjifisherUpdate the summary, now that the problems have been diagnosed.
Comment #20
estoyausenteSame problem. I haven't idea about the solution :-(
Suscribe.
Comment #21
ronaldmulero CreditAttribution: ronaldmulero commentedfwiw, here's a patch to add "/{}" to the values of $vimrcbundle and $bundle in vimrc.drush.inc, so that it will install .vimrc with (e.g. OSX):
call pathogen#infect('/Users/[username]/.drush/vimrc/bundle/{}')
call pathogen#infect('/Users/[username]/.vim/bundle/{}')
Comment #22
benjifisher@estoyausente: What problem are you having? During the course of this issue, @technicalknockout had two or three problems, and the discussion above gives solutions to them all. If you are getting warning messages from pathogen because your version of pathogen is not compatible with your version of this project, then do what the messages tell you to do.
@ronaldmulero: See my comment in #7 above for why I do not want to use that solution. Also, your patch would fix only one of the two problems in the issue summary.
I have attached a patch that solves both problems, and (I hope) does not create new ones if you already have an older version of pathogen installed. I will take a chance and commit it without further review, so I am marking this issue fixed.
Comment #25
benjifisherI closed #2334541: error at gvim startup as a duplicate of this issue.