Skip to content

Instantly share code, notes, and snippets.

@fgarcia
Last active January 3, 2016 00:39
Show Gist options
  • Save fgarcia/8383945 to your computer and use it in GitHub Desktop.
Save fgarcia/8383945 to your computer and use it in GitHub Desktop.
Running the latest version of ZSH the right way

Use brew to make sure you are running the latest version: brew reinstall zsh --enable-etcdir

It will not behave as your /bin/zsh without --enable-etcdir

Change your default shell:

chsh

Speed up your login:

touch ~/.hushlogin

The big problem for Vim users is that by default, Vim does not use your shell environment. For example, I have installed the latest version of Ruby with chruby, but since Vim uses the system default environment I get this:

!ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]

That means that the syntax checker is outdated, and I cannot run any extra gem like reek or rubocop.

To solve that, add this to your vimrc.vim file:

if has('gui_running')
   set shellcmdflag=-ci
end

Now I see this:

!ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]

This solution only gives you your normal shell if you are running Vim on its GUI. I do not enable this on the shell mode because then, vim forks into the background:

http://stackoverflow.com/questions/11415428/terminal-vim-not-loading-zshrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment