Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/add zshrc file #3

Merged
merged 17 commits into from
Nov 7, 2023
13 changes: 10 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@ jobs:
run: |
test -f "$HOME/.zshrc" || (echo "Zsh configuration dont exist" && exit 1)
test -d "$HOME/.oh-my-zsh" || (echo "Oh My Zsh is not installed" && exit 1)
shell: zsh {0}

- name: Check for Neovim configuration
run: |
test -f "$HOME/.config/nvim/init.lua" || (echo "Neovim configuration dont exist" && exit 1)
test -d "$HOME/.config/nvim/lua/custom" || (echo "Neovim plugins dont exist" && exit 1)
shell: zsh {0}

- name: Check for conda configuration
run: |
conda --version || (echo "Conda is not installed" && exit 1)
shell: zsh {0}

- name: Check for Tmux configuration
run: |
test -f "$HOME/.tmux/plugins/tpm/tpm" || (echo "Tmux plugins dont exist" && exit 1)
test -f "$HOME/.tmux.conf" || (echo "Tmux configuration dont exists" && exit 1)

test -f "$HOME/.tmux.conf" || (echo "Tmux configuration dont exist" && exit 1)
test -d "$HOME/.tmux/plugins/tpm" || (echo "Tmux plugins dont exist" && exit 1)
shell: zsh {0}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,4 @@ cython_debug/
#.idea/
*.tar.gz
*/~/*
*/.tmux/plugins/*
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "terminal/.tmux/plugins/tpm"]
path = terminal/.tmux/plugins/tpm
url = https://github.com/tmux-plugins/tpm
44 changes: 23 additions & 21 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ install_neovim_chad() {
install_neovim() {
echo "Installing Neovim..."
if ! command_exists nvim; then
if [ "$OS" = "Linux" ]; then
sudo snap install nvim --classic # using snap to get the latest version of neovim
if [ "$OS" = "Linux" ]; then
sudo snap install nvim --classic # using snap to get the latest version of neovim
elif [ "$OS" = "Darwin" ]; then
brew install neovim
brew install neovim
fi
else
echo "Neovim is already installed"
Expand All @@ -105,25 +105,15 @@ install_tmux() {
echo "Installing Tmux..."
if ! command_exists tmux; then
if [ "$OS" = "Linux" ]; then
sudo apt-get update && sudo apt-get install -y tmux
sudo apt-get update && sudo apt-get install -y tmux
elif [ "$OS" = "Darwin" ]; then
brew install tmux
brew install tmux
fi
else
echo "Tmux is already installed"
fi
}

# install tmp
install_tmp() {
echo "Installing tmp..."
if ! [ -d "$HOME/.tmux/plugins/tpm" ]; then
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
else
echo "tmp is already installed"
fi
}

install_brew() {
echo "Installing Homebrew..."
if ! command_exists brew; then
Expand All @@ -150,21 +140,33 @@ install_stow() {

set_symlinks() {
echo "Setting symlinks using stow from $(pwd)..."
stow -v -R -t $HOME config/
stow -v -R -t $HOME terminal/
if [ -f "$HOME/.zshrc" ]; then
mv $HOME/.zshrc $HOME/.zshrc.backup
fi
stow -v -R -t $HOME terminal
stow -v -R -t $HOME config
}

install_additional_deps () {
echo "Installing additional dependencies..."
if [ "$OS" = "Linux" ]; then
sudo apt-get update && sudo apt-get install -y tree gh snapd
sudo apt-get update && sudo apt-get install -y gh tree snapd
sudo snap install tldr
elif [ "$OS" = "Darwin" ]; then
brew install tree gh tldr
brew install gh tree tldr
fi
gh extension install nektos/gh-act
}

setup_conda() {
echo "Setting up Conda..."
if ! command_exists conda; then
$HOME/miniconda/bin/conda init zsh
else
conda init zsh
fi
}


main() {

install_brew
Expand All @@ -176,9 +178,9 @@ main() {
install_neovim
install_neovim_chad
install_tmux
install_tmp
install_stow
set_symlinks
setup_conda
echo "All requested dependencies are installed."

}
Expand Down
1 change: 1 addition & 0 deletions terminal/.tmux/plugins/tpm
Submodule tpm added at 99469c
27 changes: 27 additions & 0 deletions terminal/.zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="robbyrussell"
plugins=(git)

source $ZSH/oh-my-zsh.sh

# User configuration
TIMEPROMPT='%{$fg_bold[blue]%}%D{%b %d, %Y - %H:%M:%S}%{$reset_color%}'

function preexec() {
timer=${timer:-$SECONDS}
}

function precmd() {
if [ $timer ]; then
timer_show=$(($SECONDS - $timer))
export RPROMPT="%F{cyan}${timer_show}s %{$reset_color%} ${TIMEPROMPT}"
unset timer
else
export RPROMPT=$TIMEPROMPT
fi
}

[[ -z $TMUX ]] || conda deactivate; conda activate base

# alias
alias vim=nvim
Loading