Depois de um pouco de ajustes, rvm
finalmente carrega seu ambiente com sucesso por padrão. Agora, eu não sei exatamente qual parte do que eu fiz resolveu o problema, mas espero que isso ajude alguém.
Essencialmente, eu passei e dividi minha configuração de zsh
em dois arquivos: o arquivo .zshenv
(que é carregado por todos os programas) e o arquivo .zshrc
(que é carregado por programas gráficos). Para aqueles que não estão familiarizados com o funcionamento do zsh
, esses arquivos são essencialmente análogos a .bash_profile
e .bashrc
.
Meu .zshenv
:
# -------------------------------------------------------------
# Maintainer: Itai Ferber
# http://itaiferber.net - [email protected]
#
# Version: 1.0 - 19/02/12
#
# Sections:
# -> RVM
# -> Environment Variables
# -> Aliases
# -> File Manipulation
# -> Process Manipulation
# -> Terminal Manipulation
# -> zsh Options
#
# Revisions:
# -> 1.0.0: Initial revision (settings copied over from .zshrc where logical).
# -------------------------------------------------------------
# -------------------------------------------------------------
# => RVM
# -------------------------------------------------------------
[[ -s ~/.rvm/scripts/rvm ]] && source ~/.rvm/scripts/rvm
# -------------------------------------------------------------
# => Environment Variables
# -------------------------------------------------------------
# Path
export PATH=.:~/.rvm/bin:/usr/local/bin:/usr/local/sbin:~/Library/Haskell/bin:/usr/local/texlive/2011/bin/universal-darwin:/usr/local/narwhal/bin:$PATH
# History
export HISTFILE=~/dotfiles/.zsh_history
export HISTSIZE=10000
export HISTCONTROL=ignoredups
export SAVEHIST=10000
# Editor
export EDITOR=vim
# Localization
export LC_TYPE=en_US.UTF-8
# Frameworks
export NODE_PATH=/usr/local/lib/node/:$NODE_PATH
export CAPP_BUILD='/Users/itaiferber/Desktop/Cappuccino Build'
export NARWHAL_ENGINE=jsc
# -------------------------------------------------------------
# => Aliases
# -------------------------------------------------------------
# Command Aliases
alias ..='cd ..'
alias ...='cd ../..'
alias internet='lsof -inP | cut -f 1 -d " " | uniq'
alias restart='sudo shutdown -r NOW'
# Expansions
alias ls='ls -AFGp'
alias tree='tree -aCFl --charset=UTF8 --du --si'
# Root Aliases
[ $UID = 0 ] && \
alias rm='rm -i' && \
alias mv='mv -i' && \
alias cp='cp -i'
# -------------------------------------------------------------
# => Terminal Manipulation
# -------------------------------------------------------------
# Usage: reset
# Description: 'resets' the terminal by clearing and returning to default directory
reset () {
cd ~/Desktop && clear
}
# -------------------------------------------------------------
# => Process Manipulation
# -------------------------------------------------------------
# Usage: pid <procname>
# Description: returns the pid of the process with the given name
# Notes: if multiple processes with the given name are running, no guarantee is made to which pid is returned
pid () {
ps Ao pid,comm | grep -im1 $1 | awk '{match($0,/([0-9]+)/); print substr($0,RSTART,RLENGTH);}'
}
# Usage: fp <pattern>
# Description: list processes matching the given partial-match pattern
fp () {
ps Ao pid,comm | awk '{match($0,/[^\/]+$/); print substr($0,RSTART,RLENGTH)": "$1}' | grep -i $1 | grep -v grep
}
# Usage: fk <pattern>
# Description: list process matching the given partial-match pattern to kill
fk () {
IFS=$'\n'
PS3='Kill which process? (1 to cancel): '
select OPT in 'Cancel' $(fp $1); do
if [ $OPT != 'Cancel' ]; then
kill $(echo $OPT | awk '{print $NF}')
fi
break
done
unset IFS
unset PS3
}
# Usage: console <procname>
# Description: get the latest logs for the given process name
console () {
if [[ $# > 0 ]]; then
query=$(echo "$*" | tr - s ' ' '|')
tail -f /var/log/system.log | grep -i --color=auto -E "$query"
else
tail -f /var/log/system.log
fi
}
# -------------------------------------------------------------
# => File Manipulation
# -------------------------------------------------------------
# Usage: rm <file>
# Description: if called with no arguments, move files to trash instead of deleting outright
rm () {
local path
for path in "$@"; do
if [[ "$path" = -* ]]; then
/bin/rm $@
break
else
local file=${path##*/}
while [ -e ~/.Trash/"$file" ]; do
file="$file "$(date +%H-%M-%S)
done
/bin/mv "$path" ~/.Trash/"$file"
fi
done
}
# Usage: extract <file>
# Description: extracts archived files / mounts disk images
extract () {
if [ -f $1 ]; then
case $1 in
*.bz2) bunzip2 $1;;
*.dmg) hdiutil mount $1;;
*.gz) gunzip $1;;
*.tar) tar -xvf $1;;
*.tar.bz2|*.tbz2) tar -jxvf $1;;
*.tar.gz|*.tgz) tar -zxvf $1;;
*.zip) unzip $1;;
*.Z) uncompress $1;;
*) echo "'$1' not recognized.";;
esac
else
echo "'$1' not found."
fi
}
# -------------------------------------------------------------
# => zsh Options
# -------------------------------------------------------------
# Directories
setopt AUTO_CD AUTO_PUSHD CD_ABLE_VARS CHASE_DOTS CHASE_LINKS
# Completion
setopt AUTO_LIST AUTO_MENU AUTO_PARAM_SLASH COMPLETE_IN_WORD LIST_TYPES MENU_COMPLETE REC_EXACT
# History
setopt APPEND_HISTORY EXTENDED_HISTORY
# Input/Output
setopt CORRECT
# Scripts and Functions
setopt MULTIOS
# Other
setopt NO_BEEP ZLE
# Key Bindings
bindkey "^[[3~" delete-char
Meu .zshrc
:
# -------------------------------------------------------------
# Maintainer: Itai Ferber
# http://itaiferber.net - [email protected]
#
# Version: 1.0 - 19/02/12
#
# Sections:
# -> zshenv
# -> screen
# -> Environment Variables
# -> Prompt
# -> zsh Autocompletion
#
# Revisions:
# -> 1.0.0: Initial revision. Style copied from vimrc.
# -------------------------------------------------------------
# -------------------------------------------------------------
# => zshenv
# -------------------------------------------------------------
source ~/.zshenv
# -------------------------------------------------------------
# => screen
# -------------------------------------------------------------
if [[ $TERM != 'screen' ]]; then
exec screen -aADRU
fi
reset
# -------------------------------------------------------------
# => Environment Variables
# -------------------------------------------------------------
export TERM=xterm-256color
export CLICOLOR=AxFxcxdxBxegbdHbGgcdBd
# -------------------------------------------------------------
# => Prompt
# -------------------------------------------------------------
if [[ $UID = 0 ]]; then
export PROMPT="%~ +=> "
else
export PROMPT="%~ => "
fi
export RPROMPT="%*"
# -------------------------------------------------------------
# => zsh Autocompletion
# -------------------------------------------------------------
# Enable autocompletion.
autoload -U compinit && compinit -C && autoload -U zstyle+
# Attempt to complete as much as possible.
zstyle ':completion:*' completer _complete _list _oldlist _expand _ignored _match _correct
zstyle ':completion:*::::' completer _expand _complete _ignored _approximate
# Sort files by name.
zstyle ':completion:*' file-sort name
# Allow for case-insensitive completion.
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
# Color completions.
zstyle ':completion:*' list-colors ${CLICOLOR}
zstyle ':completion:*:*:kill:*:processes' command 'ps -axco pid,user,command'
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
# Set the amount of completions that triggers the menu.
zstyle ':completion:*' menu select=long
# Ignore certain patterns.
zstyle ':completion:*:functions' ignored-patterns '_*'
zstyle ':completion:*:complete:-command-::commands' ignored-patterns '*\~'
zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.(o|c~|old|pro|zwc)'
# Cache completions.
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path ~/.zcompcache/$HOST
# Allow errors.
zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX+$#SUFFIX)/2 )) numeric )'
# Insert all expansions for expand completer (eh, don't know what this does).
zstyle ':completion:*:expand:*' tag-order all-expansions
# Formatting and messages.
zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s'
zstyle ':completion:*' verbose yes
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:warnings' format 'No matches for: %d'
zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
zstyle ':completion:*' group-name ''
# Offer indexes before parameters in subscripts.
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
Espero que isso sirva como um pequeno guia para alertar qualquer outra pessoa que tenha os mesmos problemas que eu tive.