Monday, March 22, 2010

Re: issues with codde completion

On 2010-03-21, Jagpreet wrote:
> On Mar 19, 8:20 pm, Gary Johnson <garyj...@spocom.com> wrote:
> > On 2010-03-19, Jagpreet wrote:
> > > Hi Vimmers,
> >
> > > I'm using code_complete.vim plugin for code completion.
> > > I have written my won snippets file but that's not getting executed
> > > with the plugin command
> >
> > > exec "silent! runtime ".g:user_defined_snippets
> >
> > > I suspect this is the only problem, co'z the output of
> > > command  :scriptnames  doesn't show the entry of my_snippets.vim
> >
> > > If I execute the command manually with :so <PATH>/my_snippets.vim then
> > > my_snippets.vim gets displayed in the listing(:scriptnames), also my
> > > snippets are working.
> >
> > > Is there anything wrong with the last line in the plugin
> > > exec "silent! runtime ".g:user_defined_snippets
> >
> > > I have defined g:user_defined_snippets in my .vimrc file.
> >
> > It would help greatly to know what that definition is and where you
> > actually put my_snippets.vim.
> >
> > My guess is that you've defined g:user_defined_snippets as
> > "my_snippets.vim" but put it somewhere that is not in your
> > 'runtimepath'.  In other words, the <PATH> you referred to above is
> > not one of the directories in the 'runtimepath' list.  Consequently,
> > the runtime command won't find it.
> >
> > See also
> >
> >     :help :runtime
> >     :help 'runtimepath'
> >
> > HTH,
> > Gary
>
> Gary,
>
> :echo $VIMRUNTIME is " $HOME/VIM/vim/share/vim/vim72 "
> This path is set in my .bashrc
> I have compiled the source at some other server and copied the
> complete directory structure at $HOME/VIM
>
> now what path I defined at g:user_defined_snippets is $HOME/.vim/tools/
> my_snippets.vim

The reference manual entry for :runtime says that the command
searches for files in the 'runtimepath'; it doesn't say that it
accepts fully qualified path names and in my limited
experimentation, it appears that it doesn't. I think your
g:user_defined_snippets setting would have to look like this.

let g:user_defined_snippets = "tools/my_snippets.vim"

> also I tried using the command :help :runtime but no help available
> for me.
> I guess this is because of the directories I copied from some other
> servers.

You should look into fixing that. Not only are Vim's help files
extremely useful, but this problem may be indicative of other
problems in your setup that will cause you other difficulties.

All the help files should be in $VIMRUNTIME/doc.

One reason you may not be able to see any help files is that you may
be using the minimal vim installation that some Linux distributions
provide by default.

> as a workaround I copied the my_snippets.vim at $HOME/.vim/plugin and
> it works

$HOME/.vim is in your 'runtimepath' and vim loads all the files in
the plugin directories in 'runtimepath' at startup.

> but I was keen to know the reasons why exec "silent! runtime
> ".g:user_defined_snippets is failing.

As Ben suggested, get rid of the "silent!" in that command, at least
until you find out what the problem is. If you don't want to modify
the plugin, just try that command from Vim's command line, without
the "silent!", and see what the messages are.

Regards,
Gary


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

No comments: