Вопрос

I'm using terminal vim in OSX and I've installed ctags via homebrew

then I have added the /usr/local/bin/ directory to my PATH

and also aliased CTAGS to use the homebrew installed version

all of this in my .zshrc, and It works fine.

The problem is that when I try to run :!ctags -R . within VIM

It fails because it doens't recognized the option '-R'

I have runned :!which ctags and returns

/usr/bin/ctags

instead the /usr/local/bin/ctags

is any way to solve this?

UPDATE

I add my zshrc file

# 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"
Это было полезно?

Решение

I found out what was the problem, accordingly to 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).

and the solution for me was to set a global path like described here

was to edit my /etc/paths

and add /usr/local/bin to the beginning of the file (in other case it doesn't work)

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top