diff --git a/.zsh_functions b/.zsh_functions index deafbf6..7254b1d 100644 --- a/.zsh_functions +++ b/.zsh_functions @@ -102,11 +102,26 @@ function docker-container-exec () { } # git functions (need to handle ??) +# tmux new-session -d -s foo 'exec pfoo' +# tmux send-keys 'bundle exec thin start' 'C-m' +# tmux rename-window 'Foo' +# tmux select-window -t foo:0 +# tmux split-window -h 'exec pfoo' +# tmux send-keys 'bundle exec compass watch' 'C-m' +# tmux split-window -v -t 0 'exec pfoo' +# tmux send-keys 'rake ts:start' 'C-m' +# tmux split-window -v -t 1 'exec pfoo' +# tmux -2 attach-session -t foo + +function split-and-execute() { + for i in $*; do; + echo "split and execute $i" + done; +} function git-diff-unstaged() { preview="git diff $@ --color=always -- {-1}" git diff $@ --name-only | fzf -m --ansi --preview $preview } - function git-diff-staged() { preview="git diff --cached $@ --color=always -- {-1}" git diff --cached $@ --name-only | fzf -m --ansi --preview $preview diff --git a/.zshrc b/.zshrc index 15c6aff..4aad0e6 100644 --- a/.zshrc +++ b/.zshrc @@ -33,11 +33,7 @@ source ~/.oh-my-zsh/oh-my-zsh.sh source ~/.zsh_env source ~/.zsh_aliases source ~/.zsh_functions -source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh source ~/.oh-my-zsh/custom/zsh-syntax-highlighting/themes/catppuccin_frappe-zsh-syntax-highlighting.zsh -# source $(brew --prefix)/Cellar/fzf/**/shellcompletion.zsh -# source $(brew --prefix)/Cellar/fzf/**/shell/key-bindings.zsh -eval "$(fzf --zsh)" # source ~/.oh-my-zsh/custom/scripts/fzf-git.sh if [[ ! -z ~/.zsh_local ]]; then ; for i in ~/.zsh_local/.*; do source $i; done ; fi # [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh diff --git a/install.sh b/install.sh index a012a7d..d01bc66 100755 --- a/install.sh +++ b/install.sh @@ -12,28 +12,28 @@ read distro if [[ "$distro" == *"M"* ]] || [[ "$distro" == *"m"* ]]; then OS_NAME='mac' - PACKAGE_MANAGER='brew' + PACKAGE_MANAGER='brew install' fi if [[ "$distro" == *"L"* ]] || [[ "$distro" == *"l"* ]]; then OS_NAME='linux' - PACKAGE_MANAGER='sudo apt' + PACKAGE_MANAGER='sudo apt install -y' fi if [[ "$distro" == *"W"* ]] || [[ "$distro" == *"w"* ]]; then OS_NAME='pc' - PACKAGE_MANAGER='sudo apt' + PACKAGE_MANAGER='sudo apt install -y' fi -ln -s $(pwd)/$OS_NAME/.env_vars ~/.zsh_local/.env_vars -ln -s $(pwd)/$OS_NAME/.functions ~/.zsh_local/.functions -if [ -f $(pwd)/$OS_NAME/.aliases ] - then ln -s $(pwd)/$OS_NAME/.aliases ~/.zsh_local/.aliases +ln -s "$(pwd)"/$OS_NAME/.env_vars ~/.zsh_local/.env_vars +ln -s "$(pwd)"/$OS_NAME/.functions ~/.zsh_local/.functions +if [ -f "$(pwd)"/$OS_NAME/.aliases ] + then ln -s "$(pwd)"/$OS_NAME/.aliases ~/.zsh_local/.aliases fi -ln -s $(pwd)/$OS_NAME/.env_vars ~/.zsh_env -ln -s $(pwd)/$OS_NAME/.zprofile ~/.zprofile +ln -s "$(pwd)"/$OS_NAME/.env_vars ~/.zsh_env +ln -s "$(pwd)"/$OS_NAME/.zprofile ~/.zprofile echo '----------------------------' echo 'running distro-specific install steps' @@ -45,13 +45,13 @@ echo '----------------------------' echo 'creating symlinks' echo '----------------------------' -ln -s $(pwd)/.gitignore_global ~/.gitignore_global -ln -s $(pwd)/.config ~/.config -ln -s $(pwd)/.tmux.conf ~/.tmux.conf -ln -s $(pwd)/.zshrc ~/.zshrc -ln -s $(pwd)/.zsh_aliases ~/.zsh_aliases -ln -s $(pwd)/.zsh_functions ~/.zsh_functions -ln -s $(pwd)/joe2.zsh-theme ~/.oh-my-zsh/themes/joe2.zsh-theme +ln -s "$(pwd)"/.gitignore_global ~/.gitignore_global +ln -s "$(pwd)"/.config ~/.config +ln -s "$(pwd)"/.tmux.conf ~/.tmux.conf +ln -s "$(pwd)"/.zshrc ~/.zshrc +ln -s "$(pwd)"/.zsh_aliases ~/.zsh_aliases +ln -s "$(pwd)"/.zsh_functions ~/.zsh_functions +ln -s "$(pwd)"/joe2.zsh-theme ~/.oh-my-zsh/themes/joe2.zsh-theme echo '----------------------------' echo 'symlink aws functions? (y/Y) or (n/N)' @@ -61,7 +61,7 @@ read aws_func # need to create ~/.aws if [[ "${aws_func}" == "Y" ]] || [[ "${aws_func}" == "y" ]] - then ln -s $(pwd)/util_functions/.aws_functions ~/.zsh_local/.aws_functions + then ln -s "$(pwd)"/util_functions/.aws_functions ~/.zsh_local/.aws_functions fi echo @@ -72,14 +72,14 @@ read kafka_func echo if [[ "${kafka_func}" == "Y" ]] || [[ "${kafka_func}" == "y" ]] - then ln -s $(pwd)/util_functions/.kafka_functions ~/.zsh_local/.kafka_functions + then ln -s "$(pwd)"/util_functions/.kafka_functions ~/.zsh_local/.kafka_functions brew install kafka fi -if [ -f ~/.gitconfig ] +if [ -f ~/.gitconfig ] then - echo "~/.gitconfig already exists." - else + echo "$HOME/.gitconfig already exists." + else tee -a ~/.gitconfig << EOF [core] excludesfile = ~/.gitignore_global @@ -114,10 +114,31 @@ echo '----------------------------' echo 'contents of ~/.gitconfig' echo '----------------------------' cat ~/.gitconfig -echo + +# install basic dependencies +echo '----------------------------' +echo 'installing software packages' +echo '----------------------------' +$PACKAGE_MANAGER zsh +(cd ~ && sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)") echo '----------------------------' echo "installing fzf-tab. may still be broken on most recent release" echo "may need to undo commits from main. Do so at ~/.oh-my-zsh/custom/plugins/fzf-tab" echo '----------------------------' -git clone https://github.com/Aloxaf/fzf-tab ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-tab +git clone https://github.com/Aloxaf/fzf-tab ~/.oh-my-zsh/custom/plugins/fzf-tab # git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm +$PACKAGE_MANAGER micro +$PACKAGE_MANAGER maven +$PACKAGE_MANAGER fzf +$PACKAGE_MANAGER tmuxinator +$PACKAGE_MANAGER bat +$PACKAGE_MANAGER ripgrep +$PACKAGE_MANAGER btop +#$PACKAGE_MANAGER zsh-syntax-highlighting +$PACKAGE_MANAGER rectangle +$PACKAGE_MANAGER gron +$PACKAGE_MANAGER jq +$PACKAGE_MANAGER jnv +git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions +git clone https://github.com/catppuccin/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/zsh-syntax-highlighting +git clone https://github.com/junegunn/fzf-git.sh.git ~/.oh-my-zsh/custom/scripts diff --git a/mac/.zprofile b/mac/.zprofile index 379651e..d0e8f35 100644 --- a/mac/.zprofile +++ b/mac/.zprofile @@ -1,4 +1,9 @@ eval "$(/opt/homebrew/bin/brew shellenv)" + +source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +# source $(brew --prefix)/Cellar/fzf/**/shellcompletion.zsh +# source $(brew --prefix)/Cellar/fzf/**/shell/key-bindings.zsh +eval "$(fzf --zsh)" #M1 ^ # eval "$(/usr/local/Homebrew/bin/brew shellenv)" -#intel ^ \ No newline at end of file +#intel ^ diff --git a/mac/install.sh b/mac/install.sh index b28c9a0..f7051d6 100644 --- a/mac/install.sh +++ b/mac/install.sh @@ -8,29 +8,6 @@ mkdir ~/temp # alias update="brew update --auto-update && brew upgrade && (cd ~/.oh-my-zsh/custom/plugins/fzf-tab && git pull) && (cd ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions && git pull)" # alias update="brew update --auto-update && brew upgrade && (cd ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions && git pull)" -echo '----------------------------' -echo 'installing software packages' -echo '----------------------------' - -brew install zsh -(cd ~ && sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)") -brew install micro -brew install maven -brew install fzf -brew install tmuxinator -brew install bat -brew install ripgrep -brew install btop -brew install zsh-syntax-highlighting -git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions -git clone https://github.com/catppuccin/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/zsh-syntax-highlighting -git clone https://github.com/junegunn/fzf-git.sh.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/scripts -brew install bat -brew install rectangle -brew install gron -brew install jq -brew install jnv - echo '----------------------------' echo 'install openjdk 8? (y/Y) or (n/N)' read install8 diff --git a/pc/install.sh b/pc/install.sh index f0f5ef5..e22b391 100644 --- a/pc/install.sh +++ b/pc/install.sh @@ -2,25 +2,11 @@ sudo apt -y update && sudo apt -y upgrade && sudo apt -y dist-upgrade && sudo apt -y autoremove -ln -s /mnt/c/Users/$(cd /mnt/c && /mnt/c/Windows/System32/cmd.exe /c 'echo %USERNAME%' | sed -e 's/\r//g')/Documents ~/Documents -ln -s /mnt/c/Users/$(cd /mnt/c && /mnt/c/Windows/System32/cmd.exe /c 'echo %USERNAME%' | sed -e 's/\r//g')/Downloads ~/Downloads +ln -s /mnt/c/Users/"$(cd /mnt/c && /mnt/c/Windows/System32/cmd.exe /c 'echo %USERNAME%' | sed -e 's/\r//g')"/Documents ~/Documents +ln -s /mnt/c/Users/"$(cd /mnt/c && /mnt/c/Windows/System32/cmd.exe /c 'echo %USERNAME%' | sed -e 's/\r//g')"/Downloads ~/Downloads mkdir /mnt/c/repos && ln -s /mnt/c/repos ~/repos mkdir /mnt/c/temp && ln -s /mnt/c/temp ~/temp -echo '----------------------------' -echo 'installing software packages' -echo '----------------------------' - -sudo apt install -y zsh -(cd ~ && sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)") -sudo apt install -y micro -sudo apt install -y maven -sudo apt install -y fzf -sudo apt install -y tmuxinator -sudo apt install -y bat -sudo apt install -y ripgrep -sudo apt install -y btop - echo 'install openjdk 8? (y/Y) or (n/N)' read install8 echo 'install openjdk 11? (y/Y) or (n/N)'