简体   繁体   English

在Macvim中打开/安装ctags(已安装自制软件,oh-my-zsh,janus)

[英]turn on/install ctags in Macvim (having installed homebrew, oh-my-zsh, janus)

I installed macvim using homebrew on my Mackbook Pro (lion). 我在Mackbook Pro(狮子)上使用自制软件安装了macvim。 once that was installed I installed janus. 一旦安装,我就安装了janus。 I also installed oh-my-zsh (if that helps solve this problem). 我还安装了oh-my-zsh(如果可以帮助解决此问题)。 I can't seem to get ctags working though. 我似乎无法使ctags工作。 In MacVim when I do Tools>Build Tags File I get: 在MacVim中,当我执行“工具”>“构建标签文件”时,我得到:

:!ctags -R .
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...

shell returned 1 
Press RETURN or type command to continue

How do I get it to work? 我如何让它工作?

Here's some additional info that may help you: 以下是一些可以帮助您的其他信息:

✗ ctags --version
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Jul  7 2012, 01:00:53
  Addresses: <dhiebert@users.sourceforge.net>, http://ctags.sourceforge.net
  Optional compiled features: +wildcards, +regex

✗ which ctags
/usr/local/bin/ctags 

✗ echo $path
/Users/adam/.rvm/gems/ruby-1.9.3-p194@gemset/bin /Users/adam/.rvm/gems/ruby-1.9.3-p194@global/bin /Users/adam/.rvm/rubies/ruby-1.9.3-p194/bin /Users/adam/.rvm/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /usr/X11/bin /Users/adam/.rvm/bin

It definitely looks like Vim is picking up /usr/bin/ctags, which doesn't recognize -R , instead of /usr/local/bin/ctags. 看起来Vim肯定在拾取/ usr / bin / ctags而不识别-R ,而不是/ usr / local / bin / ctags。 This can happen if put /usr/local/bin in your path only for login shells. 如果仅将/ usr / local / bin放在登录shell的路径中,则会发生这种情况。

You might want to make sure /usr/local/bin gets added to your path in the non-login, non-interactive environment file. 您可能要确保将/ usr / local / bin添加到非登录,非交互式环境文件中的路径中。 I don't use zsh myself, but it looks like that would be .zshenv. 我自己不使用zsh,但是看起来像是.zshenv。

On a mac, by default the path that vim uses and the path that the terminal (bash/zsh) uses are different, so even if you have the correct path set in the terminal, it won't translate to vim correctly, to rectify this situation, you need to run 在Mac上,默认情况下,vim使用的路径与终端(bash / zsh)使用的路径不同,因此,即使您在终端中设置了正确的路径,也无法正确转换为vim,以进行纠正这种情况下,您需要运行

sudo chmod ugo-x /usr/libexec/path_helper

For more information see: How to use correct ruby in vim ? 有关更多信息,请参见: 如何在vim中使用正确的红宝石? How to modify $PATH in VIM? 如何在VIM中修改$ PATH? .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM