Exuberant Ctags on Mac

2020-05-24 19:42发布

I'm currently using vim for my PHP development. A few weeks ago I bought myself a mac, and wanted to re-generate my tags for a new Zend Framework version.

I used the following script in the past (linux machine) to generate the tags:

#!/bin/bash
cd ~/www/ZF/     
ctags-exuberant -f ~/.vim/tags/zend \
-h ".php" -R \
--exclude="\.svn" \
--totals=yes \
--tag-relative=yes \
--PHP-kinds=+cf \
--regex-PHP='/abstract class ([^ ]*)/\1/c/' \
--regex-PHP='/interface ([^ ]*)/\1/c/' \
--regex-PHP='/(public |static |abstract |protected |private )+function ([^ (]*)/\2/f/'

You can see I used the "ctags-exuberant" command. The problem is that this isn't found on my system (mac). I only have the ctags command. I tried installing the newest version of the ctags library (http://ctags.sourceforge.net/) but didn't gave me that command.

The ctags command does not have the same parameters as the ctags-exuberant. So 2 questions:

  • What's the difference between the 2 commands?
  • How can I install ctags-exuberant or use the normal ctags command for PHP?

Thanks! Ward

3条回答
迷人小祖宗
2楼-- · 2020-05-24 19:50

Install MacPorts, then do:

port install ctags
查看更多
我欲成王,谁敢阻挡
3楼-- · 2020-05-24 19:56

For a more friendly way to do this instead of using mac-ports or homebrew and running the risk of causing errors download ctags from here and compile with xcode (starting with version 4.3 command line tools are not installed by default but rather through Preferences -> Downloads) then simply move the compiled ctags to /usr/bin/ctags-exuberant to preserve the original.

Commands Used:

Change Directory to Downloads and ctags directory:

$cd
$cd Down<tab>ctags<tab>

Configure:

$./configure

Make:

$make

Move to /usr/bin:

$sudo mv ctags /usr/bin/ctags-exuberant



NOTE: <tab> is equal to pressing the tab key.
NOTE: XCode can now be downloaded from the Apple App Store!

Very useful for getting Tagbar for vim to work! Tagbar is available here.

查看更多
ら.Afraid
4楼-- · 2020-05-24 19:58

Install Homebrew, then do:

brew install ctags
查看更多
登录 后发表回答