Last active
December 22, 2017 21:24
-
-
Save shunchu/880762272e6ec7fcf1e8ff47ec67729c to your computer and use it in GitHub Desktop.
dotfile zshrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source ~/.aliases | |
source ~/.exports | |
source /usr/local/share/chruby/chruby.sh | |
source /usr/local/share/chruby/auto.sh | |
# load zgen | |
ZGEN_PREZTO_LOAD_DEFAULT=0 | |
source "${HOME}/.zgen/zgen.zsh" | |
# if the init scipt doesn't exist | |
if ! zgen saved; then | |
echo "Creating a zgen save" | |
zgen prezto prompt theme 'agnoster' | |
zgen prezto editor key-bindings 'vi' | |
zgen prezto utility:ls color 'yes' | |
zgen prezto '*:*' case-sensitive 'yes' | |
zgen prezto '*:*' color 'yes' | |
zgen prezto | |
zgen prezto git | |
zgen prezto environment | |
zgen prezto terminal | |
zgen prezto editor | |
zgen prezto directory | |
zgen prezto spectrum | |
zgen prezto utility | |
zgen prezto prompt | |
zgen prezto archive | |
zgen prezto ruby | |
zgen prezto command-not-found | |
zgen prezto fasd | |
zgen prezto history-substring-search | |
zgen prezto syntax-highlighting | |
zgen load m42e/prezto_extras | |
zgen load caarlos0/zsh-git-sync | |
zgen load TBSliver/zsh-plugin-colored-man | |
zgen load junegunn/fzf shell | |
zgen load zsh-users/zsh-syntax-highlighting | |
zgen load tarruda/zsh-autosuggestions | |
zgen load eendroroy/zed-zsh | |
zgen save | |
fi | |
autoload -Uz add-zsh-hook | |
add-zsh-hook precmd newline-after-command | |
function newline-after-command() { | |
print '' | |
} | |
export FZF_COMPLETION_TRIGGER='' | |
bindkey '^T' fzf-completion | |
################## | |
# Node | |
export NVM_DIR=~/.nvm | |
source $(brew --prefix nvm)/nvm.sh | |
# Opens the github page for the current git repo/branch in your browser | |
function gh() { | |
giturl=$(git config --get remote.origin.url) | |
if [ "$giturl" == "" ] | |
then | |
echo "Not a git repository or no remote.origin.url set" | |
exit 1; | |
fi | |
giturl=${giturl/git\@github\.com\:/https://github.com/} | |
giturl=${giturl/\.git/\/tree/} | |
branch="$(git symbolic-ref HEAD 2>/dev/null)" || | |
branch="(unnamed branch)" # detached HEAD | |
branch=${branch##refs/heads/} | |
giturl=$giturl$branch | |
open $giturl | |
} | |
# Opens the bitbucket page for the current git repo/branch in your browser | |
function bb() { | |
giturl=$(git config --get remote.origin.url) | |
if [ "$giturl" == "" ] | |
then | |
echo "Not a git repository or no remote.origin.url set" | |
exit 1; | |
fi | |
branch="$(git symbolic-ref HEAD 2>/dev/null)" || | |
branch="(unnamed branch)" # detached HEAD | |
branch=${branch##refs/heads/} | |
githash="$(git rev-parse $branch)" | |
giturl=${giturl/git\@bitbucket\.org\:/https://bitbucket.org/} | |
giturl=${giturl/\.git/\/src/$githash?at=} | |
giturl=$giturl$branch | |
open $giturl | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment