Skip to content

Commit 7431a78

Browse files
authored
Merge pull request #2 from seanoAvani/main
Changes
2 parents e719681 + 93ea0ad commit 7431a78

7 files changed

Lines changed: 280 additions & 8 deletions

File tree

CHEATSHEET.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# My Terminal Cheat Sheet
2+
3+
## Custom Commands
4+
5+
### Search & AI
6+
- `?` - Google search in Zen browser
7+
- Example: `? how to use tmux`
8+
- `??` - Claude Code query (streaming output)
9+
- Example: `?? explain this code`
10+
- `?? -a` - Claude Code interactive session
11+
- Example: `?? -a help me refactor`
12+
13+
## Tmux Keybindings
14+
15+
### Prefix Key
16+
- `Ctrl+Space` - Prefix key (instead of default Ctrl+b)
17+
18+
### Special Popups
19+
- `Ctrl+Space + g` - Lazygit popup (90% window)
20+
- `Ctrl+Space + ?` - This cheat sheet popup (85% window)
21+
22+
### Menus & Tools
23+
- `Ctrl+Space + \` - Tmux-menus main menu (navigate all tmux features)
24+
- Also accessible via right-click on panes, windows, status bar
25+
- `Ctrl+Space + Ctrl+f` - Tmux-fzf menu (fuzzy search sessions, windows, commands)
26+
- `Ctrl+Space + Backspace` - Command palette (shows all available keybindings)
27+
- `Ctrl+Space + Alt+m` - Command list palette (shows tmux commands)
28+
29+
### Session Management
30+
- `Ctrl+Space + d` - Detach from session
31+
- `Ctrl+Space + Ctrl+Space` - Switch to last client
32+
- `Ctrl+Space + Space` - Switch to last window
33+
34+
### Window Management
35+
- `Ctrl+Space + c` - New window (in current path)
36+
- `Ctrl+Space + ,` - Rename window
37+
- `Ctrl+Space + <` - Move window left
38+
- `Ctrl+Space + >` - Move window right
39+
- `Ctrl+Space + w` - List windows
40+
41+
### Pane Management
42+
- `Ctrl+Space + |` - Split horizontally
43+
- `Ctrl+Space + -` - Split vertically
44+
- `Ctrl+Space + \` - Full height split horizontal
45+
- `Ctrl+Space + _` - Full width split vertical
46+
47+
### Pane Navigation (Vim-style)
48+
- `Ctrl+Space + h` - Move to left pane
49+
- `Ctrl+Space + j` - Move to down pane
50+
- `Ctrl+Space + k` - Move to up pane
51+
- `Ctrl+Space + l` - Move to right pane
52+
53+
### Pane Resizing
54+
- `Ctrl+Space + Ctrl+h` - Resize pane left
55+
- `Ctrl+Space + Ctrl+j` - Resize pane down
56+
- `Ctrl+Space + Ctrl+k` - Resize pane up
57+
- `Ctrl+Space + Ctrl+l` - Resize pane right
58+
59+
### Pane Actions
60+
- `Ctrl+Space + j` - Join pane from another window
61+
- `Ctrl+Space + z` - Zoom/unzoom pane
62+
- `Ctrl+Space + x` - Kill pane
63+
64+
### Configuration
65+
- `Ctrl+Space + r` - Reload tmux config
66+
67+
## Zsh Keybindings
68+
69+
### History Search
70+
- `Ctrl+r` - FZF history search (fuzzy search all commands)
71+
- `Ctrl+p` - Previous command in history (matching current input)
72+
- `Ctrl+n` - Next command in history (matching current input)
73+
74+
### FZF Integrations
75+
- `Ctrl+t` - Search files/directories (paste to command line)
76+
- `Alt+c` - Change directory with fzf
77+
- `**<TAB>` - Fuzzy completion for files
78+
79+
### Navigation
80+
- `cd <dir>` - Change directory (zoxide enhanced)
81+
- `cd -` - Go to previous directory
82+
83+
## Shell Aliases
84+
85+
### File Listing (eza)
86+
- `ls` - Tree view with icons
87+
- `ll` - Long list with icons
88+
- `la` - Long list with hidden files
89+
- `l` - Long list with git status
90+
91+
### Utilities
92+
- `vim` - Opens helix editor
93+
- `c` - Clear screen
94+
- `sp` - Spotify player
95+
96+
## Tmux Plugins
97+
98+
### Installed Plugins
99+
- `tpm` - Tmux Plugin Manager
100+
- `tmux-sensible` - Sensible default settings
101+
- `dracula/tmux` - Dracula theme
102+
- `tmux-resurrect` - Save/restore sessions
103+
- `tmux-command-palette` - Command palette
104+
- `tmux-tilish` - Tiling window manager keybindings
105+
- `tmux-menus` - Context menus
106+
- `tmux-fzf` - FZF integration
107+
108+
### Plugin Management
109+
- `Ctrl+Space + Shift+I` - Install plugins
110+
- `Ctrl+Space + Shift+U` - Update plugins
111+
- `Ctrl+Space + Alt+u` - Uninstall plugins
112+
113+
## Git (via Oh My Zsh)
114+
115+
### Common Aliases
116+
- `gst` - git status
117+
- `ga` - git add
118+
- `gc` - git commit
119+
- `gp` - git push
120+
- `gl` - git pull
121+
- `gco` - git checkout
122+
- `gcb` - git checkout -b (new branch)
123+
- `glog` - git log with graph
124+
125+
## Tips & Tricks
126+
127+
### Cheat Sheet
128+
- `cheat` - View this cheat sheet
129+
- `cheat -s <term>` - Search cheat sheet for term
130+
131+
### Terminal Multiplexing
132+
- Run `tmux` to start a new session
133+
- Run `tmux attach` or `tmux a` to attach to existing session
134+
- Sessions persist even after closing terminal
135+
136+
### FZF Power User
137+
- Use `Ctrl+r` for fuzzy command history
138+
- Use `**<TAB>` after any command for fuzzy file completion
139+
- Example: `vim **<TAB>` then type part of filename
140+
141+
### Dotfiles Location
142+
- Zsh config: `~/.zshrc` (source: `~/dotfiles/zsh/.zshrc`)
143+
- Tmux config: `~/.config/tmux/tmux.conf` (source: `~/dotfiles/tmux/.config/tmux/tmux.conf`)
144+
- Lazygit config: `~/.config/lazygit/config.yml`

tmux/.config/tmux/plugins/tmux

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 3323120e1705a9f4591870c9900e8a4b7c7e760d
1+
Subproject commit 7ac15370df67124562d3857ab3a0f2eb9a55765d
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 1f5967791184bfde616cd2bbc2c8a541588d8e37
1+
Subproject commit dbcaf7666a05b7af34f3ba38c0a67a751188df7a

tmux/.config/tmux/plugins/tmux-fzf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 05af76daa2487575b93a4f604693b00969f19c2f
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 879f56df1b9703ac277fa16b9bbaf8705f2e6a1c

tmux/.config/tmux/tmux.conf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ bind-key j select-pane -D
5555
bind-key k select-pane -U
5656
bind-key l select-pane -R
5757

58+
# joins pane from another window
59+
bind-key j command-prompt -p "Join pane from window:" "join-pane -h -s '%%'"
5860

5961
# List of plugins
6062
set -g @plugin 'tmux-plugins/tpm'
@@ -63,6 +65,8 @@ set -g @plugin 'dracula/tmux'
6365
set -g @plugin 'tmux-plugins/tmux-resurrect'
6466
set -g @plugin 'lost-melody/tmux-command-palette'
6567
set -g @plugin 'jabirali/tmux-tilish' # https://github.com/jabirali/tmux-tilish?tab=readme-ov-file#keybindings
68+
set -g @plugin 'jaclu/tmux-menus'
69+
set -g @plugin 'sainnhe/tmux-fzf'
6670

6771
set -g @dracula-show-powerline false
6872
set -g @dracula-show-flags false
@@ -91,4 +95,7 @@ set -g @dracula-show-location false
9195
#Lazygit popup
9296
bind -r g popup -d '#{pane_current_path}' -E -w 90% -h 90% lazygit
9397

94-
run '~/.tmux/plugins/tpm/tpm'
98+
#Cheat sheet popup
99+
bind -r ? popup -E -w 85% -h 85% "glow -p ~/dotfiles/CHEATSHEET.md"
100+
101+
run '~/.config/tmux/plugins/tpm/tpm'

zsh/.zshrc

Lines changed: 124 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
export QT_QPA_PLATFORMTHEME=qt5ct
55
export QT_QPA_PLATFORMTHEME=qt6ct
66

7+
# Add fzf to PATH
8+
export PATH="$HOME/.fzf/bin:$PATH"
79

810
# Path to your Oh My Zsh installation.
911
export ZSH="$HOME/.oh-my-zsh"
@@ -64,13 +66,8 @@ alias la='eza -la --icons'
6466
alias l='eza -la --icons --git'
6567
alias sp='spotify_player'
6668

67-
6869
#alias zed="zeditor"
6970

70-
# Shell integrations
71-
eval "$(fzf --zsh)"
72-
eval "$(zoxide init --cmd cd zsh)"
73-
7471
# Set list of themes to pick from when loading at random
7572
# Setting this variable when ZSH_THEME=random will cause zsh to load
7673
# 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
136133
source $ZSH/oh-my-zsh.sh
137134
source ~/git-flow-completion.zsh
138135

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+
139249
# User configuration
140250

141251
# export MANPATH="/usr/local/man:$MANPATH"
@@ -168,9 +278,18 @@ source ~/git-flow-completion.zsh
168278
export NVM_DIR="$HOME/.nvm"
169279
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
170280
[ -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+
171289
export PATH="/home/seano/.npm-global/bin:$PATH"
172290

173291
. "$HOME/.local/bin/env"
174292
export PATH="$HOME/.local/bin:$PATH"
175293
export PATH="$HOME/.local/bin:$PATH"
176294
export PATH="$HOME/.local/bin:$PATH"
295+

0 commit comments

Comments
 (0)