php Mac 上的 Exuberant Ctags

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6808781/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 01:19:25  来源:igfitidea点击:

Exuberant Ctags on Mac

phpvimctagsexuberant-ctags

提问by Presnus

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.

我目前正在使用 vim 进行 PHP 开发。几周前,我给自己买了一台 mac,想为新的 Zend Framework 版本重新生成我的标签。

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

我过去使用以下脚本(linux机器)来生成标签:

#!/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 ([^ ]*)//c/' \
--regex-PHP='/interface ([^ ]*)//c/' \
--regex-PHP='/(public |static |abstract |protected |private )+function ([^ (]*)//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.

你可以看到我使用了“ctags-exuberant”命令。问题是这在我的系统(mac)上找不到。我只有 ctags 命令。我尝试安装最新版本的 ctags 库 (http://ctags.sourceforge.net/),但没有给我那个命令。

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

ctags 命令没有与 ctags-exuberant 相同的参数。所以2个问题:

  • What's the difference between the 2 commands?
  • How can I install ctags-exuberant or use the normal ctags command for PHP?
  • 这两个命令有什么区别?
  • 如何为 PHP 安装 ctags-exuberant 或使用普通的 ctags 命令?

Thanks! Ward

谢谢!病房

采纳答案by romainl

Install MacPorts, then do:

安装MacPorts,然后执行:

port install ctags

回答by daniel

Install Homebrew, then do:

安装Homebrew,然后执行:

brew install ctags

回答by MacManChomp

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

要以更友好的方式执行此操作,而不是使用 mac-ports 或自制软件并冒导致错误的风险,请从此处下载 ctags并使用 xcode 进行编译(从 4.3 版开始,命令行工具不是默认安装的,而是通过Preferences -> Downloads)然后简单地将编译后的 ctags 移动到 /usr/bin/ctags-exuberant 以保留原始文件。

Commands Used:

使用的命令:

Change Directory to Downloads and ctags directory:

ç焊割directory来下载和CTAGS目录:

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

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

Configure:

配置:

$./configure$./configure





Make:

制作:

$make$make





Move to /usr/bin:

移动到 /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!



注意:<tab> 相当于按下 tab 键。
注意:现在可以从 Apple App Store 下载 XCode!

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

对于让 vim 的 Tagbar 工作非常有用!标签栏在此处可用。