macos - 在 OSX 中的 vim 内生成 ctags 标签不起作用

标签 macos vim ctags exuberant-ctags

我在 OSX 中使用终端 vim,并通过自制程序安装了 ctags

然后我已将 /usr/local/bin/ 目录添加到我的 PATH

并且还别名 CTAGS 以使用自制安装版本

所有这些都在我的 .zshrc 中,并且工作正常。

问题是当我尝试在 VIM 中运行 :!ctags -R .

它失败,因为它无法识别选项“-R”

我已经运行了 :!which ctags 并返回了

/usr/bin/ctags

而是 /usr/local/bin/ctags

有什么办法可以解决这个问题吗?

更新

我添加我的 zshrc 文件

# number of lines kept in history
export HISTSIZE=1000
# number of lines saved in the history after logout
export SAVEHIST=1000
# location of history
export HISTFILE=~/.zhistory
# append command to history file once executed
setopt inc_append_history

autoload -U compinit
compinit

# Colors
autoload -U colors
colors
setopt prompt_subst

# Save a smiley to a local variable if the last command exited with success.
local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})"

# Show the relative path on one line, then the smiley.
PROMPT='%{$fg[cyan]%}%~ ${smiley} %{$reset_color%}'

RPROMPT='%{$fg[cyan]%} $(~/Dotfiles/rbenv-version.sh)$(~/Dotfiles/git-cwd-info.sh)%{$reset_color%}'

# Example aliases
source ~/Dotfiles/zsh/aliases
source ~/Dotfiles/zsh/plugins/bundler.zsh

export SHELL=/bin/zsh

export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
export PATH="$HOME/.rbenv/bin:$PATH"
export PATH=/usr/local/bin:$PATH

eval "$(rbenv init -)"

export LC_ALL=en_US.utf-8
export LANG="$LC_ALL"

export EDITOR=vim
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

最佳答案

我根据 this answer in superuser 找到了问题所在

Vim 'ignores' your aliases because your shell is not in a 'mood' to parse your .bash_profile/.bashrc (you did not specify, where your aliases are defined) because it is not started as a login/interactive shell (read here to find out more about what is read when and for what reason).

我的解决方案是设置一个全局路径,如 described here

是编辑我的/etc/paths

并将/usr/local/bin添加到文件开头(在其他情况下不起作用)

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

关于macos - 在 OSX 中的 vim 内生成 ctags 标签不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16409225/

相关文章:

java - 在 Windows 上将 Ctags 与 Gvim 结合使用

macos - 有没有办法根据系统暗/亮模式更改 macOS 终端主题/配置文件?

python - 使用 python 绑定(bind)安装 dlib

macos - Qt的QMediaPlayer无法播放mp3

vim 路径扩展卡在 8.3 模式

c++ - 在带有 C++ 项目的 emacs 中使用 ETAGS/CTAGS

c++ - Xcode - Mac App - 启动时 Bootstrap 检查错误

vim - 为什么我的 Vim 以替换模式启动?

vim - 使用 matchit 匹配反引号 --- 可能吗?

emacs - 通过指定文件名在emacs中自动打开文件