我在 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/