Friday, July 30, 2010

Re: need help with tags

On 30/07/10 22:24, dud wrote:
> Hi,
>
> I'm running version 7.2.245 on an Ubuntu server.
>
> I've been a vi user since the 1980's and use the tags feature
> extensively.
>
> My coworker cannot get tags to work in vim. Any tag he tries returns:
>
> E426: tag not found:<subroutine name here>
>
> I can reproduce this by logging in as a different user than myself.
> Something
> is magical about my environment that allows tags to work for me but no
> one
> else.
>
> The conditions are:
>
> I'm "in" the directory where the source is, as well as where the tags
> file is.
>
> The tags file is 644, read by world.
>
> The source files are 644, read by world.
>
> How can I debug what the problem is?
>
> Why can't vim find the tag even though it's right there in the tags
> file?
>
> How can I ask vim what it's "path" is for finding the tags file? I
> can't find that in the help.
> :set all doesn't show anything like a list of locations to search for
> tags.
> If I set verbose to 99, I see vim trying all kinds of stupid places
> for the tags file,
> except the current directory.
>
> I do not have a .vimrc or .exrc, just this in my .profile:
>
> EXINIT="set ai sm magic ic sw=4 cedit= export EXINIT
>
> Thanks,
> Bill Dudley
>

I suppose you mean C tags. For them to work, the tags file must have
been created (preferably by Exuberant ctags) and Vim must be able to
find it.

By default, Vim looks for the tags file in the current directory (which
will be shown in answer to the :pwd command) and in the directory of the
current file. If you want to search other locations (such as the parent
directories of the current file's directory) you will have to tweak the
'tags' option yourself.

Note also that if your coworker has 'autochdir' set (which I don't
recommend) the current directory will always be changed to the directory
of the current file, which means that only one of the two "typical"
locations of the tags file will be searched.

With only an EXINIT environment variable, there are many nice features
of Vim which you won't see. In particular, it will put you in
'compatible' mode, some plugins will simply not work, and with the
values you have set, you won't even get filetype-specific behaviour. I
recommend to remove that EXINIT variable and to write the following into
a file named ~/.vimrc

runtime vimrc_example.vim
set autoindent
set ignorecase showmatch
set magic
set shiftwidth=4

If later you want more customizations, you will add them to this file,
usually after the call to vimrc_example.vim (but if you want to change
the menu and messages language, you must do it before instead). For
instance, to be able to edit files containing any kind of weird
characters you might add

if has('multi_byte')
" if the required capabilities are not available,
" we cannot use them
" is the OS locale already Unicode?
" if not, prepare to change
if &encoding !~? '^u'
" but first, avoid jamming keyboard input
if &termencoding == ""
let &termencoding = &encoding
endif
set encoding=utf-8
endif
" set a «reasonable» heuristic to determine
" the 'fileencoding of existing files
set fileencodings=ucs-bom,utf-8,default,latin1
" the following two settings are optional
" create new files in UTF-8
setglobal fileencoding=utf-8
" create new Unicode files with Byte-Order mark
setglobal bomb
" Note: certain files, including anything starting #!
" must have 'nobomb' instead (using :setlocal),
" or be created in some non-Unicode 'fileencoding'
" such as e.g. Latin1.
endif

or to use a font of your choice in gvim (the GUI version of Vim) you
would add something like what is shown under :help setting-guifont


Best regards,
Tony.
--
Proposed Additions to the PDP-11 Instruction Set:

PI Punch Invalid
POPI Punch Operator Immediately
PVLC Punch Variable Length Card
RASC Read And Shred Card
RPM Read Programmers Mind
RSSC reduce speed, step carefully (for improved accuracy)
RTAB Rewind tape and break
RWDSK rewind disk
RWOC Read Writing On Card
SCRBL scribble to disk - faster than a write
SLC Search for Lost Chord
SPSW Scramble Program Status Word
SRSD Seek Record and Scar Disk
STROM Store in Read Only Memory
TDB Transfer and Drop Bit
WBT Water Binary Tree

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

No comments:

Post a Comment