From e6721e42b20687c91cabbebc03005afb8dfcec25 Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Mon, 15 Sep 2025 07:22:32 -0400 Subject: [PATCH 1/4] Guard jenv and pyenv initialization --- home/.zshrc | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/home/.zshrc b/home/.zshrc index b5f9420..96fa312 100644 --- a/home/.zshrc +++ b/home/.zshrc @@ -25,10 +25,27 @@ export XKB_DEFAULT_OPTIONS="caps:escape" export PASSWORD_STORE_CHARACTER_SET='a-zA-Z0-9+\-$!*_=' export XDEB_PKGROOT=${HOME}/.config/xdeb -# Add cuda to path -export PATH="$PATH:/usr/local/cuda-12.8/bin" +# Custom path additions +export PATH="$PATH:/usr/local/cuda-12.8/bin:$HOME/bin" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-12.8/lib64" +#============================================================================== +# OS-Specific Configuration +#============================================================================== + +if [ "$(uname)" = "Darwin" ]; then + export PATH="$PATH:/opt/homebrew/bin" + alias ls="gls --classify --group-directories-first --color" + alias gemini="(source ~/.gemini_project && gemini)" + export NVIM_JDTLS_JAVA_HOME="/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home/" + # I only start tmux by default on Mac because of dwm+swallow patch + if [[ -z "$TMUX" ]] && [[ -n "$PS1" ]]; then + tmux attach -t dev || tmux new -s dev + fi +else + alias ls="ls --classify --group-directories-first --color" +fi + #============================================================================== # Aliases #============================================================================== @@ -70,12 +87,18 @@ export NVM_DIR="$HOME/.nvm" [ -f "/home/aselimov/.ghcup/env" ] && . "/home/aselimov/.ghcup/env" # ghcup-env # pyenv -if [ $(which pyenv 2>&1 1>/dev/null) ]; then +if command -v pyenv >/dev/null 2>&1; then export PYENV_ROOT="$HOME/.pyenv" [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init - zsh)" fi +# jenv +if command -v jenv >/dev/null 2>&1; then + export PATH="$HOME/.jenv/bin:$PATH" + eval "$(jenv init -)" +fi + # starship eval "$(starship init zsh)" @@ -96,19 +119,3 @@ bindkey -v bindkey '^[[A' history-substring-search-up bindkey '^[[B' history-substring-search-down -#============================================================================== -# OS-Specific Configuration -#============================================================================== - -if [ "$(uname)" = "Darwin" ]; then - export PATH="$PATH:/opt/homebrew/bin" - alias ls="gls --classify --group-directories-first --color" - alias gemini="(source ~/.gemini_project && gemini)" - export NVIM_JDTLS_JAVA_HOME="/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home/" - # I only start tmux by default on Mac because of dwm+swallow patch - if [[ -z "$TMUX" ]] && [[ -n "$PS1" ]]; then - tmux attach -t dev || tmux new -s dev - fi -else - alias ls="ls --classify --group-directories-first --color" -fi From d36ded958e4e87e27a41f5c3d5593e83b82f18bf Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Mon, 15 Sep 2025 08:24:44 -0400 Subject: [PATCH 2/4] Update script to ensure neovim and ghostty are synchronized --- bin/swap_mode.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/swap_mode.sh b/bin/swap_mode.sh index f4a9b27..b93ea3d 100755 --- a/bin/swap_mode.sh +++ b/bin/swap_mode.sh @@ -13,18 +13,18 @@ sed -E -i '' \ -e 's/^([[:space:]]*theme[[:space:]]*=[[:space:]]*)zenwritten-light/\1zenwritten-dark/' \ "$GHOSTTY_CONF" -# Toggle Neovim vim.g.light_mode true/false -sed -E -i '' \ - -e 's/(vim\.g\.light_mode[[:space:]]*=[[:space:]]*)true/\1false/' \ - -e 't' \ - -e 's/(vim\.g\.light_mode[[:space:]]*=[[:space:]]*)false/\1true/' \ - "$NVIM_CONF" - # Determine new mode from Ghostty theme if grep -Eq '^\s*theme\s*=\s*zenwritten-light' "$GHOSTTY_CONF"; then MODE="light" + # Toggle Neovim vim.g.light_mode true/false + sed -E -i '' \ + -e 's/(vim\.g\.light_mode[[:space:]]*=[[:space:]]*).*/\1true/' \ + "$NVIM_CONF" else MODE="dark" + sed -E -i '' \ + -e 's/(vim\.g\.light_mode[[:space:]]*=[[:space:]]*).*/\1false/' \ + "$NVIM_CONF" fi # Reload neovim theme From 9ed95658f872dd3c72563f0201eb68c8f2a873ca Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Wed, 17 Sep 2025 09:14:53 -0400 Subject: [PATCH 3/4] Update swap_mode.sh to take parametes to specify specific modes --- bin/swap_mode.sh | 62 ++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/bin/swap_mode.sh b/bin/swap_mode.sh index b93ea3d..70fc9bc 100755 --- a/bin/swap_mode.sh +++ b/bin/swap_mode.sh @@ -6,26 +6,37 @@ GHOSTTY_CONF="${HOME}/.config/ghostty/config" [ -f "$NVIM_CONF" ] || { echo "Missing $NVIM_CONF"; exit 1; } [ -f "$GHOSTTY_CONF" ] || { echo "Missing $GHOSTTY_CONF"; exit 1; } -# Toggle Ghostty theme between zenwritten-dark and zenwritten-light -sed -E -i '' \ - -e 's/^([[:space:]]*theme[[:space:]]*=[[:space:]]*)zenwritten-dark/\1zenwritten-light/' \ - -e 't' \ - -e 's/^([[:space:]]*theme[[:space:]]*=[[:space:]]*)zenwritten-light/\1zenwritten-dark/' \ - "$GHOSTTY_CONF" - -# Determine new mode from Ghostty theme -if grep -Eq '^\s*theme\s*=\s*zenwritten-light' "$GHOSTTY_CONF"; then +set_light_mode() { + sed -E -i '' 's/^([[:space:]]*theme[[:space:]]*=[[:space:]]*)zenwritten-dark/\1zenwritten-light/' "$GHOSTTY_CONF" + sed -E -i '' 's/(vim.g.light_mode[[:space:]]*=[[:space:]]*).*/\1true/' "$NVIM_CONF" MODE="light" - # Toggle Neovim vim.g.light_mode true/false - sed -E -i '' \ - -e 's/(vim\.g\.light_mode[[:space:]]*=[[:space:]]*).*/\1true/' \ - "$NVIM_CONF" -else +} + +set_dark_mode() { + sed -E -i '' 's/^([[:space:]]*theme[[:space:]]*=[[:space:]]*)zenwritten-light/\1zenwritten-dark/' "$GHOSTTY_CONF" + sed -E -i '' 's/(vim.g.light_mode[[:space:]]*=[[:space:]]*).*/\1false/' "$NVIM_CONF" MODE="dark" - sed -E -i '' \ - -e 's/(vim\.g\.light_mode[[:space:]]*=[[:space:]]*).*/\1false/' \ - "$NVIM_CONF" -fi +} + +toggle_mode() { + if grep -Eq '^\s*theme\s*=\s*zenwritten-light' "$GHOSTTY_CONF"; then + set_dark_mode + else + set_light_mode + fi +} + +case "$1" in + light) + set_light_mode + ;; + dark) + set_dark_mode + ;; + toggle|*) + toggle_mode + ;; +esac # Reload neovim theme if [ "$MODE" = "light" ]; then @@ -36,24 +47,13 @@ fi for dir in "${XDG_RUNTIME_DIR:-}" "${TMPDIR:-/tmp}" "/tmp" "$HOME/.local/state/nvim"; do [ -d "$dir" ] || continue find "$dir" -type s -name 'nvim*' 2>/dev/null | while read -r sock; do - if command -v timeout >/dev/null 2>&1; then - timeout 1s nvim --server "$sock" --remote-send "$keys" >/dev/null 2>&1 || true - else - ( nvim --server "$sock" --remote-send "$keys" >/dev/null 2>&1 & ) - fi + timeout 1s nvim --server "$sock" --remote-send "$keys" >/dev/null 2>&1 || true done done # Reload Ghostty: send SIGUSR2 to running ghostty processes (macOS/Linux) -if command -v pkill >/dev/null 2>&1; then - pkill -USR2 -x ghostty 2>/dev/null || true -elif command -v killall >/dev/null 2>&1; then - killall -USR2 ghostty 2>/dev/null || true -else - pids=$(pgrep -x ghostty 2>/dev/null || true) - [ -n "${pids:-}" ] && kill -USR2 $pids || true -fi +pkill -USR2 -x ghostty 2>/dev/null echo "Switched to ${MODE} mode" From 429c1fca38408f943015191fc0a3a0b1f18a7a1a Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Thu, 18 Sep 2025 09:47:45 -0400 Subject: [PATCH 4/4] Add gemini configurations --- deploy.sh | 5 +++-- gemini/GEMINI.md | 32 ++++++++++++++++++++++++++++++++ home/.zshrc | 2 +- 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 gemini/GEMINI.md diff --git a/deploy.sh b/deploy.sh index aae4b4f..72b9b88 100755 --- a/deploy.sh +++ b/deploy.sh @@ -33,7 +33,7 @@ deploy_links() { if [ -L "$dest_link" ]; then echo "Replacing existing symlink: $dest_link" rm "$dest_link" - # If it's a directory or file, back it up. + # If it's a directory or file, back it up. else echo "Backing up existing entry: $dest_link -> ${dest_link}.bak" mv "$dest_link" "${dest_link}.bak" @@ -45,7 +45,7 @@ deploy_links() { # Create the new symlink. echo "Linking: $dest_link -> $abs_src_path" - ln -s "$abs_src_path" "$dest_link" + ln -s "$abs_src_path" "$dest_link" done echo "Done." echo @@ -57,5 +57,6 @@ deploy_links "$PROJECT_ROOT/bin" "$HOME/bin" "bin" deploy_links "$PROJECT_ROOT/home" "$HOME" "home" deploy_links "$PROJECT_ROOT/config" "$HOME/.config" "config" deploy_links "$PROJECT_ROOT/wallpapers" "$HOME/media/wallpapers" "wallpapers" +deploy_links "$PROJECT_ROOT/gemini" "$HOME/.gemini" "gemini" echo "All deployments complete!" diff --git a/gemini/GEMINI.md b/gemini/GEMINI.md new file mode 100644 index 0000000..eaebfeb --- /dev/null +++ b/gemini/GEMINI.md @@ -0,0 +1,32 @@ +# Gemini Global Configuration + +This document outlines my general preferences for working with Gemini. + +## General Principles + +- **Programming Style**: Please use a functional programming style whenever possible and appropriate for the language. +- **Immutability**: Favor immutable data structures and variables where practical. +- **Verification**: Do not run tests or build commands. I will handle verification myself. +- **Dependencies**: If a new third-party library is needed, propose it and wait for my explicit approval before adding it to the project. +- **Documentation**: Use descriptive function and variable names to make code self-documenting. Doc comments should generally only be used for functions that are part of a public or library API. +- **Handling Ambiguity**: If a request is unclear or could be interpreted in multiple ways, always stop and ask for clarification. +- **Logging**: Unless instructed otherwise, add descriptive logging statements for errors. For logical flows, add messages like "Starting {logic}" and "Successfully completed {logic}". +- **API Design**: While not a primary task, prefer `snake_case` for JSON field names. Above all, always remain consistent with the conventions of the current project. + + +## Language-Specific Guidelines + +### Formatting +- **Java**: Adhere to the Google Java Style Guide. +- **C++**: Use the default formatting provided by `clangd`. +- **Python**: Format code using the `black` code formatter. +- **Rust**: Format code using the default `rust-fmt` configuration. + +### Error Handling +- **Rust**: Always return a `Result` type instead of panicking. +- **Java & Python**: Throw exceptions for error conditions. +- **C++**: Use a "Look Before You Leap" (LBYL) approach, checking preconditions to avoid errors. + +### Functional Programming +- **Java**: Prioritize the use of functional features like the Stream API. +- **C++**: Prioritize the use of modern C++ features that support a functional style, such as lambdas and ranges. diff --git a/home/.zshrc b/home/.zshrc index c444029..a6a6ec8 100644 --- a/home/.zshrc +++ b/home/.zshrc @@ -57,7 +57,7 @@ alias clip2png="xclip -selection clipboard -target image/png -out" load_env() { set -a - . "$1" + . "./$1" set +a }