added wzp to start wezterm profiles and modified scripts

This commit is contained in:
Jeremie Fraeys 2024-05-29 19:20:11 -04:00
parent 1e8ad4f4d6
commit bc1172e33c
8 changed files with 79 additions and 134 deletions

View file

@ -1 +0,0 @@
*.log

View file

@ -1,104 +0,0 @@
autoconf
bat
bats-core
brotli
c-ares
ca-certificates
certifi
coreutils
curl
docker
docker-completion
fd
fzf
gcc
gettext
gh
git
gmp
go
hyperfine
ical-buddy
icu4c
isl
jq
julia
krb5
libevent
libgit2
libidn2
liblinear
libmpc
libnghttp2
libssh2
libtermkey
libunistring
libuv
libvterm
libyaml
lua
luajit
luv
lz4
m4
marp-cli
mbedtls@2
mpdecimal
mpfr
msgpack
ncurses
neovim
nmap
node
oniguruma
openblas
openldap
openlibm
openssl@3
p7zip
pcre
pcre2
pkg-config
postgresql@14
pyenv
pygments
python-certifi
python-packaging
python-setuptools
python@3.11
python@3.12
pyyaml
readline
ripgrep
rtmpdump
skhd
sqlite
stow
tmux
tree
tree-sitter
unibilium
utf8proc
xz
yabai
zoxide
zsh
zstd
base
bitwarden
docker
drawio
firefox
google-drive
iterm2
logi-options-plus
maccy
microsoft-auto-update
microsoft-teams
miniforge
postman
pycharm
sparkle
spotify
vscodium
zotero

View file

@ -1,18 +0,0 @@
base
bitwarden
docker
drawio
firefox
google-drive
iterm2
logi-options-plus
maccy
microsoft-auto-update
microsoft-teams
miniforge
postman
pycharm
sparkle
spotify
vscodium
zotero

3
.gitignore vendored
View file

@ -1,6 +1,5 @@
*.log
__pycache__*
brew_lists/cask_list.txt.new
brew_lists/brewa-list.txt.new
.brew_lists/*

21
add_yaml_header.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
# Function to add '---' to YAML files if not present
add_yaml_header() {
while IFS= read -r file; do
if ! grep -q '^---' "$file"; then
echo "Adding --- to $file"
sed -i '1s/^/---\n/' "$file"
fi
done < <(fd -t f -e yaml -e yml "$1")
}
# Check if a directory is provided
if [ -z "$1" ]; then
echo "Usage: $0 <directory>"
exit 1
fi
# Call the function with the provided directory
add_yaml_header "$1"

View file

@ -8,7 +8,7 @@ start_docker() {
}
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
install_docker(){
echo "Docker is not installed."
read -p "Do you want to install Docker using Homebrew? (y/n): " choice
if [ "$choice" == "y" ]; then
@ -19,6 +19,24 @@ if ! command -v docker &> /dev/null; then
echo "Docker is required to run this script. Exiting."
exit 1
fi
}
# Check if docker-compose is installed
install_docker_compose() {
echo "docker-compose is not installed."
read -p "Do you want to install docker-compose using Homebrew? (y/n): " choise
if [ "$choice" == "y" ]; then
brew install docker-compose
echo "Docker has been installed. Please restart this script."
exit 0
else
echo "Docker is required to run this script. Exiting."
exit 1
fi
}
if ! command -v docker &> /dev/null; then
install_docker
fi
# Check if Docker is running
@ -30,7 +48,9 @@ fi
if [ "$1" == "docker-compose" ]; then
# If docker-compose is called, check if Docker is running again
if [ "$(docker info >/dev/null 2>&1 && echo "running")" != "running" ]; then
start_docker
if ! command -v docker-compose &> /dev/null; then
start_docker
fi
fi
fi

View file

@ -87,8 +87,13 @@ if ! command_exists zsh; then
fi
# Check and install tmux
if ! command_exists tmux; then
install_dependencies tmux
# if ! command_exists tmux; then
# install_dependencies tmux
# fi
# Check and install Neovim
if ! command_exists nvim; then
install_dependencies neovim
fi
# Install Go
@ -132,17 +137,14 @@ esac
# Create symbolic links for dotfiles
ln -s "$DOTFILES_DIR/zsh/.zshrc" ~/.zshrc
ln -s "$DOTFILES_DIR/tmux/.tmux.conf" ~/.tmux.conf
# ln -s "$DOTFILES_DIR/tmux/.tmux.conf" ~/.tmux.conf
ln -s "$DOTFILES_DIR/nvim" ~/.config/nvim
# Source configurations for the current session
source ~/.zshrc
tmux source ~/.tmux.conf
# tmux source ~/.tmux.conf
# Inform the user and wait for input
echo "Zsh, Tmux, Neovim, Go, and development tools configurations applied."
# Enable notifications if the flag is set
if [ "$ENABLE_NOTIFICATION" == true ]; then
echo "Press Enter to start Zsh and Tmux."
@ -154,3 +156,4 @@ fi
# Start Zsh and Tmux
zsh

25
wzp Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Wezterm Project - Start a new wezterm project
PROJECTS_DIR="$HOME/.config/wezterm/projects"
project=""
if [[ -z "$1" ]]; then
# List all files in projects directory. Only keep the file name without the extension
project=$(fd -d 1 -e lua -t f -t l . ~/.config/wezterm/projects --print0 | xargs -0 -n 1 basename | sed 's/\.lua$//' | fzf --cycle --layout=reverse)
else
if [[ ! -e "$PROJECTS_DIR/$1.lua" ]]; then
echo "The project file '$PROJECTS_DIR/$1.lua' not exists"
exit 1
fi
project="$1"
fi
if [[ -z $project ]]; then
echo "No project selected"
exit 1
fi
WZ_PROJECT="$project" wezterm start --always-new-process &