diff --git a/rebase.zsh b/rebase.zsh new file mode 100644 index 0000000..6e4584d --- /dev/null +++ b/rebase.zsh @@ -0,0 +1,27 @@ +function rebase () { + + if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]] || [[ "$1" == "" ]]; then + echo "usage: rebase [base [top]]" + echo "where [top] defaults to the current branch" + return + fi + + START=`currentBranch` + + TOP=$2 + BASE=$1 + echo maybe $TOP + # fall back if second arg is not defined + if [[ "$2" == "" ]]; + TOP=$START + if + echo yes $TOP + echo rebasing $TOP onto $BASE + + git checkout $BASE + git pull + echo checking out $TOP + git checkout $TOP + git rebase $BASE + git checkout $START +} diff --git a/rgki.sh b/rgki.sh new file mode 100644 index 0000000..0200fab --- /dev/null +++ b/rgki.sh @@ -0,0 +1,25 @@ +#!/bin/zsh + +MAX_HITS=30 + +YELLOW=`tput setaf 3` +WHITE=`tput setaf 7` + +function rgki () { + local counter=1 + # populate array with the first MAX_HITS hits + hits=("${(@f)$(rg -l $1 | tail +2 | head -n $MAX_HITS)}"); + + # print file list with newline before and after + printf "\n" + for hit in "${hits[@]}";do + echo ${counter}$YELLOW ${hit} $WHITE + counter=$((counter+1)) + done + + printf "\nwhich file? " + + # get the file by number + read whichfile + kak ${hits[$whichfile]} +} diff --git a/zshrc b/zshrc index 9539910..bad377f 100644 --- a/zshrc +++ b/zshrc @@ -179,33 +179,12 @@ function gcol { } -function rebase () { - - if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then - echo "usage: rebase [base [top]]" - echo "where [top] defaults to the current branch" - return - fi - - START=`currentBranch` - - TOP=$2 - BASE=$1 - echo maybe $TOP - # fall back if second arg is not defined - if [[ "$2" == "" ]]; - TOP=$START - if - echo yes $TOP - echo rebasing $TOP onto $BASE - - git checkout $BASE - git pull - echo checking out $TOP - git checkout $TOP - git rebase $BASE - git checkout $START -} + source ~/dotfiles/pomodoro/pomodoro.sh +source ~/dotfiles/rgki.sh +source ~/dotfiles/rebase.zsh + alias work="pomo && pomo -s" + +alias gitrefine="git rebase -i HEAD~10"