|
4 | 4 | export QT_QPA_PLATFORMTHEME=qt5ct |
5 | 5 | export QT_QPA_PLATFORMTHEME=qt6ct |
6 | 6 |
|
| 7 | +# Add fzf to PATH |
| 8 | +export PATH="$HOME/.fzf/bin:$PATH" |
7 | 9 |
|
8 | 10 | # Path to your Oh My Zsh installation. |
9 | 11 | export ZSH="$HOME/.oh-my-zsh" |
@@ -64,13 +66,8 @@ alias la='eza -la --icons' |
64 | 66 | alias l='eza -la --icons --git' |
65 | 67 | alias sp='spotify_player' |
66 | 68 |
|
67 | | - |
68 | 69 | #alias zed="zeditor" |
69 | 70 |
|
70 | | -# Shell integrations |
71 | | -eval "$(fzf --zsh)" |
72 | | -eval "$(zoxide init --cmd cd zsh)" |
73 | | - |
74 | 71 | # Set list of themes to pick from when loading at random |
75 | 72 | # Setting this variable when ZSH_THEME=random will cause zsh to load |
76 | 73 | # a theme from this variable instead of looking in $ZSH/themes/ |
@@ -136,6 +133,119 @@ plugins=(git starship azure docker docker-compose history zsh-interactive-cd ss |
136 | 133 | source $ZSH/oh-my-zsh.sh |
137 | 134 | source ~/git-flow-completion.zsh |
138 | 135 |
|
| 136 | +# Shell integrations (loaded after Oh My Zsh to preserve keybindings) |
| 137 | +if [[ $- == *i* ]]; then |
| 138 | + eval "$(fzf --zsh)" |
| 139 | + eval "$(zoxide init --cmd cd zsh)" |
| 140 | +fi |
| 141 | +# Custom functions |
| 142 | +# Google search in Zen browser |
| 143 | +google-search() { |
| 144 | + local query="$*" |
| 145 | + if [[ -z "$query" ]]; then |
| 146 | + echo "Usage: ? <search query>" |
| 147 | + return 1 |
| 148 | + fi |
| 149 | + # URL encode the query |
| 150 | + local encoded=$(python3 -c "import urllib.parse; print(urllib.parse.quote('''$query'''))") |
| 151 | + local url="https://www.google.com/search?q=${encoded}" |
| 152 | + |
| 153 | + # Try Zen browser first, fall back to default browser |
| 154 | + if command -v zen-browser &> /dev/null; then |
| 155 | + zen-browser "$url" &> /dev/null & |
| 156 | + elif [[ -f "/mnt/c/Program Files/Zen Browser/zen.exe" ]]; then |
| 157 | + "/mnt/c/Program Files/Zen Browser/zen.exe" "$url" &> /dev/null & |
| 158 | + else |
| 159 | + xdg-open "$url" &> /dev/null & |
| 160 | + fi |
| 161 | +} |
| 162 | + |
| 163 | +# Claude Code query |
| 164 | +claude-query() { |
| 165 | + local attach=false |
| 166 | + |
| 167 | + # Check for -a flag |
| 168 | + if [[ "$1" == "-a" ]]; then |
| 169 | + attach=true |
| 170 | + shift |
| 171 | + fi |
| 172 | + |
| 173 | + local query="$*" |
| 174 | + if [[ -z "$query" ]]; then |
| 175 | + echo "Usage: ?? [-a] <claude code query>" |
| 176 | + echo " -a Open interactive Claude Code session" |
| 177 | + return 1 |
| 178 | + fi |
| 179 | + |
| 180 | + if [[ "$attach" == true ]]; then |
| 181 | + # Interactive mode |
| 182 | + claude "$query" |
| 183 | + else |
| 184 | + # Print mode (streaming output) |
| 185 | + claude -p "$query" |
| 186 | + fi |
| 187 | +} |
| 188 | + |
| 189 | +# Cheat sheet viewer |
| 190 | +cheat() { |
| 191 | + local cheat_file="$HOME/dotfiles/CHEATSHEET.md" |
| 192 | + |
| 193 | + if [[ ! -f "$cheat_file" ]]; then |
| 194 | + echo "Cheat sheet not found at $cheat_file" |
| 195 | + return 1 |
| 196 | + fi |
| 197 | + |
| 198 | + # Check for search flag |
| 199 | + if [[ "$1" == "-s" ]]; then |
| 200 | + shift |
| 201 | + local search_term="$*" |
| 202 | + if [[ -z "$search_term" ]]; then |
| 203 | + # Interactive search with fzf |
| 204 | + if command -v bat &> /dev/null; then |
| 205 | + grep -n "." "$cheat_file" | fzf --delimiter=: --preview 'bat --color=always --style=plain --highlight-line {1} '"$cheat_file" --preview-window=+{1}-10 |
| 206 | + else |
| 207 | + grep -n "." "$cheat_file" | fzf --delimiter=: --preview 'sed -n {1}p '"$cheat_file" |
| 208 | + fi |
| 209 | + else |
| 210 | + # Search for specific term |
| 211 | + grep -i "$search_term" "$cheat_file" --color=always |
| 212 | + fi |
| 213 | + elif [[ "$1" == "-p" ]] || [[ -n "$TMUX" && "$1" != "-f" ]]; then |
| 214 | + # Show in tmux popup (if in tmux) or with -p flag |
| 215 | + if [[ -n "$TMUX" ]]; then |
| 216 | + if command -v glow &> /dev/null; then |
| 217 | + tmux popup -E -w 85% -h 85% "glow -p '$cheat_file'" |
| 218 | + elif command -v bat &> /dev/null; then |
| 219 | + tmux popup -E -w 85% -h 85% "bat --style=full --paging=always '$cheat_file'" |
| 220 | + else |
| 221 | + tmux popup -E -w 85% -h 85% "less '$cheat_file'" |
| 222 | + fi |
| 223 | + else |
| 224 | + # Not in tmux, fall back to regular view |
| 225 | + if command -v glow &> /dev/null; then |
| 226 | + glow -p "$cheat_file" |
| 227 | + elif command -v bat &> /dev/null; then |
| 228 | + bat --style=full "$cheat_file" |
| 229 | + else |
| 230 | + less "$cheat_file" |
| 231 | + fi |
| 232 | + fi |
| 233 | + else |
| 234 | + # Regular view with glow, bat or less |
| 235 | + if command -v glow &> /dev/null; then |
| 236 | + glow -p "$cheat_file" |
| 237 | + elif command -v bat &> /dev/null; then |
| 238 | + bat --style=full "$cheat_file" |
| 239 | + else |
| 240 | + less "$cheat_file" |
| 241 | + fi |
| 242 | + fi |
| 243 | +} |
| 244 | + |
| 245 | +# Aliases with noglob to prevent glob expansion |
| 246 | +alias '?'='noglob google-search' |
| 247 | +alias '??'='noglob claude-query' |
| 248 | + |
139 | 249 | # User configuration |
140 | 250 |
|
141 | 251 | # export MANPATH="/usr/local/man:$MANPATH" |
@@ -168,9 +278,18 @@ source ~/git-flow-completion.zsh |
168 | 278 | export NVM_DIR="$HOME/.nvm" |
169 | 279 | [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm |
170 | 280 | [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion |
| 281 | + |
| 282 | +# Welcome message (only in interactive shells) |
| 283 | +if [[ $- == *i* ]]; then |
| 284 | + # Add a small delay to let terminal initialize |
| 285 | + sleep 0.1 |
| 286 | + echo "💡 Tip: Type 'cheat' to view terminal shortcuts (or Ctrl+Space+? in tmux)" |
| 287 | +fi |
| 288 | + |
171 | 289 | export PATH="/home/seano/.npm-global/bin:$PATH" |
172 | 290 |
|
173 | 291 | . "$HOME/.local/bin/env" |
174 | 292 | export PATH="$HOME/.local/bin:$PATH" |
175 | 293 | export PATH="$HOME/.local/bin:$PATH" |
176 | 294 | export PATH="$HOME/.local/bin:$PATH" |
| 295 | + |
0 commit comments