Please tell me how to do use cscope or ctag with php

1,615 views
Skip to first unread message

SamPeng

unread,
May 1, 2009, 3:37:25 AM5/1/09
to vim...@googlegroups.com
Hi,
   my cscope and ctag don't working with php.
   use C-] don't jump any function or var.Have one error:don't have this tags.
  ctag -R and cscope -R I test this cmd.not have any help.
  Thanks your help!

David Fishburn

unread,
May 1, 2009, 8:25:18 AM5/1/09
to vim...@googlegroups.com

What OS are you running this on?

I usually do the following:
cd /root/dir/where/php/is

dir /s/b *.php > cscope.files (Windows)
find -name *.php > cscope.files (Unix)

cscope -b (create the cscope database)

In Vim:
:cd /root/dir/where/php/is
:cs add cscope.out . -C
" I use the -C for case insensitivity

Then I primarily use these 2 mappings:
nnoremap g<C-\> :silent! cs find 0
<C-R>=expand("<cword>")<CR><CR>:cwindow<CR>
vnoremap <silent> g<c-\> :<C-U>
\:let old_reg=getreg('"')<bar>
\:let old_regmode=getregtype('"')<cr>
\gvy
\:silent! cs find s <C-R>=@"<cr><cr>
\:call setreg('"', old_reg, old_regmode)<cr>:cwindow<CR>

Notice this is using the cs find command, since cscope doesn't
understand PHP, it can be used to find the methods and what not
though. I do the same for SQL files and Perl.

You can map the above to anything you want, it is hard to find key
combinations which are not already useful though!

HTH,
Dave

SamPeng

unread,
May 1, 2009, 4:33:38 PM5/1/09
to vim...@googlegroups.com
Oh~!
Thank you this detail help.they are many helpful for me.
yes.I solve this question..I to google this quesstion has 2 days.Thank you help me saving many time to programe

2009/5/1 David Fishburn <dfishb...@gmail.com>

Nicolas Sebrecht

unread,
May 2, 2009, 2:54:33 AM5/2/09
to vim...@googlegroups.com
On Fri, May 01, 2009 at 08:25:18AM -0400, David Fishburn wrote:

> find -name *.php > cscope.files (Unix)

Shouldn't be
find -name '*.php' > cscope.files
?

% tree
.
|-- b.c
|-- y
| `-- r.c
`-- z
`-- b.c
% find -name *.c
./b.c
./z/b.c
% find -name '*.c'
./b.c
./z/b.c
./y/r.c
%

--
Nicolas Sebrecht

Nicolas Sebrecht

unread,
May 2, 2009, 2:56:31 AM5/2/09
to vim...@googlegroups.com
On Fri, May 01, 2009 at 08:25:18AM -0400, David Fishburn wrote:

> find -name *.php > cscope.files (Unix)

Shouldn't be

Tony Mechelynck

unread,
May 3, 2009, 8:03:44 PM5/3/09
to vim...@googlegroups.com
On 01/05/09 22:33, SamPeng wrote:
> Oh~!
> Thank you this detail help.they are many helpful for me.
> yes.I solve this question..I to google this quesstion has 2 days.Thank
> you help me saving many time to programe
[...]

This may come as a surprise to you, but on the topic of Vim, and topics
related to it, Google is rarely the best place to find help.

The places to find Vim help are:
- Vim's own help system (using the :help command, possibly with help tag
completion, and the :helpgrep command)
see:
:help
:help :help
:help {subject}
:help 'wildmenu'
:help 'wildmode'
:help :helpgrep

- The Vim Tips Wiki http://vim.wikia.com/

- This mailing list / Google group.

I'm listing them in the order in which I recommend checking them. This
ML may have more answers than the other two together, but unlike them,
it depends on the constant goodwill of flesh-and-bones people, while the
other two are their accumulated knowledge and require only minimal updating.


Best regards,
Tony.
--
If you took all the students that fell asleep in class and laid them
end to end, they'd be a lot more comfortable.
-- "Graffiti in the Big Ten"

Reply all
Reply to author
Forward
0 new messages