Friday, March 26, 2010

Re: issues with codde completion

On 2010-03-26, Jagpreet wrote:
> On Mar 22, 9:59 pm, Gary Johnson <garyj...@spocom.com> wrote:
> > On 2010-03-21,Jagpreetwrote:
> > > On Mar 19, 8:20 pm, Gary Johnson <garyj...@spocom.com> wrote:
> > > > On 2010-03-19,Jagpreetwrote:
> > > > > 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"
>
> No, I have given the absolute path for g:user_defined_snippets

I guess I didn't make myself clear. The runtime path command
expects its argument to be a relative path name, where the path name
is relative to one or more of the directories in 'runtimepath'. The
runtime command will not work with an absolute file name.
Therefore, the value of g:user_defined_snippets _must_ be a relative
path name; it _cannot_ be an absolute file name.

If you "have given the absolute path for g:user_defined_snippets",
the runtime command in the code_complete.vim plugin _will_not_work_.

> > > 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.
>
> I know, as a workaround I set the VIMRUNTIME in .bashrc but, that's
> the best possible shortcut I got.
> I now realize the earlier issues when I was facing were because of
> this problem only.
> all the help files are indeed available at my $VIMRUNTIME/doc but I
> can't access them from vim.
> I just wanted to check for ttimeout but it says E149: Sorry, no help
> for
> even for help.txt also its the same.
>
> >
> > 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.
> >
> I am using full version of Unix installation and this is what
> the :version command output is
>
> VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Mar 31 2009 15:21:16)
> Compiled by jagpreet@server19
> Normal version with X11-Motif GUI. Features included (+) or not (-):
> -arabic +autocmd +balloon_eval +browse +builtin_terms +byte_offset
> +cindent +clientserver +clipboard +cmdline_compl
> +cmdline_hist +cmdline_info +comments +cryptv -cscope +cursorshape
> +dialog_con_gui +diff +digraphs -dnd -ebcdic -emacs_tags
> +eval +ex_extra +extra_search -farsi +file_in_path +find_in_path
> +float +folding -footer +fork() -gettext -hangul_input -iconv
> +insert_expand +jumplist -keymap -langmap +libcall +linebreak
> +lispindent +listcmds +localmap +menu +mksession +modify_fname
> +mouse +mouseshape -mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm
> -mouse_sysmouse +mouse_xterm -multi_byte +multi_lang
> -mzscheme +netbeans_intg -osfiletype +path_extra -perl +postscript
> +printer -profile -python +quickfix +reltime -rightleft
> -ruby +scrollbind +signs +smartindent -sniff +statusline -sun_workshop
> +syntax +tag_binary +tag_old_static -tag_any_white -tcl
> +terminfo +termresponse +textobjects +title +toolbar +user_commands
> +vertsplit +virtualedit +visual +visualextra +viminfo
> +vreplace +wildignore +wildmenu +windows +writebackup +X11 +xfontset
> +xim +xsmp_interact +xterm_clipboard -xterm_save
> system vimrc file: "$VIM/vimrc"
> user vimrc file: "$HOME/.vimrc"
> user exrc file: "$HOME/.exrc"
> system gvimrc file: "$VIM/gvimrc"
> user gvimrc file: "$HOME/.gvimrc"
> system menu file: "$VIMRUNTIME/menu.vim"
> fall-back for $VIM: "/export/home/jagpreet/.tools//share/vim"
> Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MOTIF -I/
> usr/dt/include -g -O2 -I/usr/openwin/include
> Linking: gcc -L/usr/dt/lib -R /usr/dt/lib -L/usr/openwin/lib -R/usr/
> openwin/lib -o vim -lXmu -lXext -lXm -lXpm -lXt -lX11 -lSM
> -lICE -lm -ltermlib -lnsl -lsocket -ldl
>
>
> Just notice the fall-back for $VIM , this path doesn't exists at the
> server where I copied the bin and share folders. If I don't set the
> VIMRUNTIME variable at .bashrc then I get this error
>
> Error detected while processing /itcdev10_1/jagpreet/.vimrc:
> line 32:
> E484: Can't open file /export/home/jagpreet/.tools//share/vim/syntax/
> syntax.vim
> and no syntax highlight works.
>
>
> > > 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.
>
> I tried this command at command line but nothing happens, no changes
> whatsoever.
>
> >
> > Regards,
> > Gary
>
> I understand the runtime path doesn't include the doc and may be some
> other paths.
> As a workaround I can add those paths as well in the VIMRUNTIME in
> bashrc but don't want to go happy further with just workaround, it
> might create some other problem tomorrow.
>
> Is there a way I can avoid changing the VIMRUNTIME path in .bashrc and
> doing something else.
> I can't install vim at all the servers so I am left with the options
> of coping bin/ and share/ only from the server where I installed it.
>
> I don't know what should be the best possible solution for this case.

The best possible solution is for all your servers to be configured
the same with respect to the files that Vim cares about so that a
Vim built on any of the servers will work on all of the servers.

The second-best possible solution is to build Vim on every server on
which it's going to be run. Then it will be configured properly for
each server.

The third-best possible solution is to do what you have attempted to
do: set VIMRUNTIME in your ~/.profile or ~/.bashrc. This should
work, and it seems to partly work for you since it seems to allow
your syntax highlighting to work. We just need to find out why it
doesn't work completely.

I did some experimentation and I think I know why your :help doesn't
work. When you copied all the Vim files from one server to the
other you also copied the help tags file ($VIMRUNTIME/doc/tags)
which contains the paths to your help files that were valid on the
first server. You need to rebuild that tags file on the second
server. To do that, execute the following command.

:helptags $VIMRUNTIME/doc

In summary, I think that if you:

1. rebuild your help tags file as explained above, and
2. set g:user_defined_snippets to a _relative_ path to
my_snippets.vim, as explained above,

then the code_complete.vim plugin should work and everything else
should work as well on the second server as it did on the first.

Regards,
Gary

P.S.

I apologize for the length of this post, but it helped me to be able
to see everything that went before, so I kept it all, untrimmed.


--
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:

Post a Comment