refactor: added support for zsh

This commit is contained in:
rkiel
2020-11-21 10:20:23 -05:00
parent 5b9d2b0711
commit 7e9338128d
5 changed files with 111 additions and 33 deletions

13
dotfiles/bash_profile Normal file
View File

@@ -0,0 +1,13 @@
export EDITOR=vim
# generated by ./bin/generate-bash-prompt
export PS1='[\[\e[0;35m\]\u@\h\[\e[0m\] \[\e[1;34m\]\W\[\e[0m\]]\$ '
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
LOCALS=~/.bashrc_local
if [ -f $LOCALS ]; then
source $LOCALS
fi

View File

@@ -1,30 +1,27 @@
# alias add="git add"
alias branch="git branch"
alias checkout="git checkout"
# alias commit="feature commit"
alias pop="git stash pop --index"
alias pull="git pull"
alias push="git push"
alias master="git checkout master"
# alias develop="git checkout develop"
# alias diff="clear; git diff -w"
# alias linuxdiff="/usr/bin/diff"
# alias sysdiff="/usr/bin/diff"
# alias log="git log --graph --decorate --abbrev-commit --pretty=oneline"
# alias log="git log --graph --date=short --pretty=format:'%C(yellow)%h %C(white)%ad %C(black)[%C(green)%an%C(black)] %C(blue)%s%C(yellow)%d'"
alias stash="git stash save"
# alias status="git status; echo; echo STASH:; git stash list; echo"
alias h='history'
alias lsa='ls -la'
alias lsl='ls -l'
alias more='less -RX'
alias sl='ls'
alias a='git add'
alias b="git branch"
alias branch="git branch"
alias c='feature commit'
alias checkout="git checkout"
alias co='git checkout'
alias d='clear; git diff -w'
alias l="git log --graph --date=short --pretty=format:'%C(yellow)%h %C(white)%ad %C(black)[%C(green)%an%C(black)] %C(blue)%s%C(yellow)%d'"
alias log='git log -w -u'
alias m='feature merge'
alias master="git checkout master"
alias pop="git stash pop --index"
alias pull="git pull"
alias push="git push"
alias r='feature rebase'
alias s='git status; echo; echo STASH:; git stash list; echo'
alias show='git show -w'
alias stash="git stash save"
alias x='xgrep'
@@ -42,14 +39,9 @@ function get_feature_commands()
fi
}
function get_release_commands()
{
if [ -z $2 ] ; then
COMPREPLY=(`release tab`)
else
COMPREPLY=(`release tab $2`)
fi
}
complete -F get_feature_commands feature
complete -F get_release_commands release
LOCALS=~/.bashrc_locals
if [ -f $LOCALS ]; then
source $LOCALS
fi

15
dotfiles/zprofile Normal file
View File

@@ -0,0 +1,15 @@
export EDITOR=vim
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
setopt prompt_subst
zstyle ':vcs_info:git:*' formats '%b'
# generated by ./bin/generate-bash-prompt
export PS1='[%B%F{magenta}%n@%m%f%b %B%F{blue}%1d%f%b %B%F{green}'\$vcs_info_msg_0_'%f%b]$ '
LOCALS=~/.zprofile_locals
if [ -f $LOCALS ]; then
source $LOCALS
fi

47
dotfiles/zshrc Normal file
View File

@@ -0,0 +1,47 @@
alias h='history'
alias lsa='ls -la'
alias lsl='ls -l'
alias more='less -RX'
alias sl='ls'
alias a='git add'
alias b="git branch"
alias branch="git branch"
alias c='feature commit'
alias checkout="git checkout"
alias co='git checkout'
alias d='clear; git diff -w'
alias l="git log --graph --date=short --pretty=format:'%C(yellow)%h %C(white)%ad %C(black)[%C(green)%an%C(black)] %C(blue)%s%C(yellow)%d'"
alias log='git log -w -u'
alias m='feature merge'
alias master="git checkout master"
alias pop="git stash pop --index"
alias pull="git pull"
alias push="git push"
alias r='feature rebase'
alias s='git status; echo; echo STASH:; git stash list; echo'
alias show='git show -w'
alias stash="git stash save"
alias x='xgrep'
alias sfind='find . -not \( -type d -name .git -prune \) -not \( -type d -name node_modes -prune \) -and \( -type f \)|sort -f'
alias sgrep='find . -not \( -type d -name .git -prune \) -not \( -type d -name node_modes -prune \) -and \( -type f \)|sort -f|xargs grep --color=always'
alias cgrep='grep --color=always'
alias vgrep='grep -v'
function get_feature_commands()
{
if [ -z $2 ] ; then
COMPREPLY=(`feature tab`)
else
COMPREPLY=(`feature tab $2`)
fi
}
complete -F get_feature_commands feature
LOCALS=~/.zshrc_locals
if [ -f $LOCALS ]; then
source $LOCALS
fi

View File

@@ -1,10 +1,21 @@
#!/usr/bin/env ruby
REPO="~/GitHub/rkiel/git-utilities"
require_relative '../lib/setup/commander'
if [ "$1" == "zsh" ] ; then
FILE=~/.zprofile
echo >> $FILE
echo "GIT_UTILITIES_BIN=${REPO}/bin" >> $FILE
echo "export PATH=${GIT_UTILITIES_BIN}:$PATH" >> $FILE
commander = Setup::Commander.new(ARGV)
if commander.valid?
commander.execute
FILE=~/.zshrc
echo >> $FILE
echo "source ${REPO}/zshrc" >> $FILE
else
commander.help
end
FILE=~/.bash_profile
echo >> $FILE
echo "GIT_UTILITIES_BIN=${REPO}/bin" >> $FILE
echo "export PATH=${GIT_UTILITIES_BIN}:$PATH" >> $FILE
FILE=~/.bashrc
echo >> $FILE
echo "source ${REPO}/bashrc" >> $FILE
fi