Compare commits
4 Commits
7062581131
...
docs/readm
| Author | SHA1 | Date | |
|---|---|---|---|
| d12a1c0797 | |||
| 396c36f5a9 | |||
| d11695bcf8 | |||
| 0a7d11c6d4 |
26
.tmux.conf
26
.tmux.conf
@@ -5,6 +5,8 @@ set -g history-limit 100000
|
|||||||
|
|
||||||
# mouse
|
# mouse
|
||||||
set -g mouse on
|
set -g mouse on
|
||||||
|
set -s set-clipboard on
|
||||||
|
set -g allow-passthrough on
|
||||||
|
|
||||||
# utf8 / colors
|
# utf8 / colors
|
||||||
set -g default-terminal "screen-256color"
|
set -g default-terminal "screen-256color"
|
||||||
@@ -19,9 +21,9 @@ bind % split-window -h -c "#{pane_current_path}"
|
|||||||
bind -n S-Left if-shell "[ #{window_index} -ne $(tmux list-windows -F '##{window_index}' | head -1) ]" "previous-window"
|
bind -n S-Left if-shell "[ #{window_index} -ne $(tmux list-windows -F '##{window_index}' | head -1) ]" "previous-window"
|
||||||
bind -n S-Right if-shell "[ #{window_index} -ne $(tmux list-windows -F '##{window_index}' | tail -1) ]" "next-window"
|
bind -n S-Right if-shell "[ #{window_index} -ne $(tmux list-windows -F '##{window_index}' | tail -1) ]" "next-window"
|
||||||
|
|
||||||
# swap windows left/right with Ctrl+Shift+Arrow
|
# swap windows left/right with PgUp/PgDn (no wrap)
|
||||||
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
|
bind-key -n PgUp if-shell "[ #{window_index} -ne $(tmux list-windows -F '##{window_index}' | head -1) ]" "swap-window -t -1\; select-window -t -1"
|
||||||
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
|
bind-key -n PgDn if-shell "[ #{window_index} -ne $(tmux list-windows -F '##{window_index}' | tail -1) ]" "swap-window -t +1\; select-window -t +1"
|
||||||
|
|
||||||
# sensible defaults
|
# sensible defaults
|
||||||
set -s escape-time 10
|
set -s escape-time 10
|
||||||
@@ -31,10 +33,26 @@ set -g renumber-windows on
|
|||||||
|
|
||||||
# Auto-rename windows: directory/process
|
# Auto-rename windows: directory/process
|
||||||
set -g automatic-rename on
|
set -g automatic-rename on
|
||||||
set -g automatic-rename-format '#{pane_current_command}@#{b:pane_current_path}'
|
set -g automatic-rename-format '#{pane_current_command}@#{b:pane_current_path}#{?pane_title,: #{pane_title},}'
|
||||||
|
|
||||||
# Rename window (prefix + R)
|
# Rename window (prefix + R)
|
||||||
bind R command-prompt -I "#{window_name}" "rename-window '%%'"
|
bind R command-prompt -I "#{window_name}" "rename-window '%%'"
|
||||||
|
|
||||||
# Fuzzy window switcher (prefix + f)
|
# Fuzzy window switcher (prefix + f)
|
||||||
bind f display-popup -E "tmux list-windows -F '#{window_index}: #{window_name}' | fzf --reverse | cut -d: -f1 | xargs tmux select-window -t"
|
bind f display-popup -E "tmux list-windows -F '#{window_index}: #{window_name}' | fzf --reverse | cut -d: -f1 | xargs tmux select-window -t"
|
||||||
|
|
||||||
|
# status bar
|
||||||
|
set -g status-style "bg=colour235,fg=colour248"
|
||||||
|
set -g status-left "#[fg=colour232,bg=colour34,bold]#S#[fg=colour34,bg=colour235,nobold]"
|
||||||
|
set -g status-left-length 30
|
||||||
|
set -g status-right ""
|
||||||
|
set -g status-right-length 40
|
||||||
|
|
||||||
|
# window tabs
|
||||||
|
setw -g window-status-format "#{?#{m:*[13579],#{window_index}},#[fg=colour235]#[bg=colour236]#[fg=colour250] #I #W #[fg=colour236]#[bg=colour235],#[fg=colour235]#[bg=colour233]#[fg=colour244] #I #W #[fg=colour233]#[bg=colour235]}"
|
||||||
|
setw -g window-status-current-format "#[fg=colour235,bg=colour34]#[fg=colour232,bg=colour34,bold] #I #W #[fg=colour34,bg=colour235]"
|
||||||
|
setw -g window-status-separator ""
|
||||||
|
|
||||||
|
# pane borders
|
||||||
|
set -g pane-border-style "fg=colour238"
|
||||||
|
set -g pane-active-border-style "fg=colour34"
|
||||||
|
|||||||
5
.zshrc
5
.zshrc
@@ -112,6 +112,7 @@ zinit light starship/starship
|
|||||||
# paths
|
# paths
|
||||||
typeset -U path
|
typeset -U path
|
||||||
path=(
|
path=(
|
||||||
|
/projects/bin
|
||||||
$HOME/.local/bin
|
$HOME/.local/bin
|
||||||
$HOME/.cargo/bin
|
$HOME/.cargo/bin
|
||||||
/usr/local/go/bin
|
/usr/local/go/bin
|
||||||
@@ -171,6 +172,10 @@ function pj {
|
|||||||
dir=$(find -L ${(u)roots} -mindepth 1 -maxdepth 1 -type d 2>/dev/null | sort | awk '{printf "%3d %s\n", NR, $0}' | fzf --reverse --prompt="project> " --query="$1" --select-1 --exit-0 --with-nth=2.. | sed 's/^ *[0-9]* //') && cd "$dir"
|
dir=$(find -L ${(u)roots} -mindepth 1 -maxdepth 1 -type d 2>/dev/null | sort | awk '{printf "%3d %s\n", NR, $0}' | fzf --reverse --prompt="project> " --query="$1" --select-1 --exit-0 --with-nth=2.. | sed 's/^ *[0-9]* //') && cd "$dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clip {
|
||||||
|
echo -ne "\033]52;c;$(base64 | tr -d '\n')\a"
|
||||||
|
}
|
||||||
|
|
||||||
function mkcd {
|
function mkcd {
|
||||||
: "${1:?where?}"
|
: "${1:?where?}"
|
||||||
[[ -e $1 ]] && { echo "file exists"; return 1 }
|
[[ -e $1 ]] && { echo "file exists"; return 1 }
|
||||||
|
|||||||
132
README.md
Normal file
132
README.md
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
# dotfiles
|
||||||
|
|
||||||
|
Bare-git managed dotfiles for zsh/vim/tmux on Linux and macOS.
|
||||||
|
|
||||||
|
## How it works
|
||||||
|
|
||||||
|
This repo uses a **bare git repository** at `~/.dotgit` with the work tree set to `$HOME`. This avoids symlinks and lets dotfiles live at their native paths.
|
||||||
|
|
||||||
|
The alias that drives everything:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
alias .g='git --git-dir=$HOME/.dotgit/ --work-tree=$HOME'
|
||||||
|
```
|
||||||
|
|
||||||
|
`.g status`, `.g add`, `.g diff`, `.g commit`, `.g push` — same as git, just scoped to the dotfiles repo. Untracked files are hidden by default (`showUntrackedFiles = no` in config).
|
||||||
|
|
||||||
|
## Bootstrap on a new machine
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone --bare https://gitea.abra.me/svxf/dotfiles.git $HOME/.dotgit
|
||||||
|
alias .g='git --git-dir=$HOME/.dotgit/ --work-tree=$HOME'
|
||||||
|
.g checkout
|
||||||
|
.g config status.showUntrackedFiles no
|
||||||
|
```
|
||||||
|
|
||||||
|
If checkout conflicts with existing files, back them up first:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
.g checkout 2>&1 | grep "^\t" | xargs -I{} mv {} {}.bak
|
||||||
|
.g checkout
|
||||||
|
```
|
||||||
|
|
||||||
|
On next shell start, zinit will bootstrap itself and install all plugins automatically.
|
||||||
|
|
||||||
|
## Tracked files
|
||||||
|
|
||||||
|
| File | What it does |
|
||||||
|
|---|---|
|
||||||
|
| `.zshrc` | Shell config — plugins, aliases, functions, keybindings, PATH |
|
||||||
|
| `.vimrc` | Vim config — space-leader, persistent undo, arrow keys disabled |
|
||||||
|
| `.tmux.conf` | tmux config — mouse, green accent, fzf window switcher, auto-rename |
|
||||||
|
| `.starship.toml` | Prompt — two-line, git status, docker indicators, command duration |
|
||||||
|
| `.gitignore_global` | Global ignores — `*~`, `.DS_Store`, `__pycache__`, `.idea`, `.ipynb_checkpoints` |
|
||||||
|
|
||||||
|
## Key features
|
||||||
|
|
||||||
|
### Zinit plugin stack (`.zshrc`)
|
||||||
|
|
||||||
|
- **zsh-autosuggestions** — inline fish-style suggestions
|
||||||
|
- **zsh-syntax-highlighting** — live command coloring
|
||||||
|
- **zsh-completions** — extra completion definitions
|
||||||
|
- **zsh-history-substring-search** — up/down searches from prefix
|
||||||
|
- **starship** — installed via zinit from GitHub releases
|
||||||
|
|
||||||
|
### Async dotfiles pull
|
||||||
|
|
||||||
|
On shell start, a background job pulls `--ff-only` from origin once per day (marker at `~/.cache/.dotfiles-pull`). Silent, non-blocking.
|
||||||
|
|
||||||
|
### Starship prompt (`.starship.toml`)
|
||||||
|
|
||||||
|
Two-line layout:
|
||||||
|
- **Line 1**: docker container indicator → docker-compose status → git branch/status → (fill) → directory
|
||||||
|
- **Line 2**: `➤` character (green=ok, red=error)
|
||||||
|
- **Right**: command duration (>5s) → user@host → time
|
||||||
|
|
||||||
|
Custom modules detect `/.dockerenv` for container awareness and parse `docker compose ps` for service status.
|
||||||
|
|
||||||
|
### fzf integration (`.zshrc`)
|
||||||
|
|
||||||
|
Sources fzf keybindings and completion when available. Default opts: `--height 40% --reverse`.
|
||||||
|
|
||||||
|
### Project switcher — `pj` (`.zshrc`)
|
||||||
|
|
||||||
|
Fuzzy-finds directories under `/projects` or `~/projects` using fzf. `pj foo` pre-fills the query.
|
||||||
|
|
||||||
|
### Yazi wrapper — `y` (`.zshrc`)
|
||||||
|
|
||||||
|
Wraps the yazi file manager so the shell `cd`s to wherever you navigated on exit.
|
||||||
|
|
||||||
|
### Docker compose aliases (`.zshrc`)
|
||||||
|
|
||||||
|
| Alias | Expands to |
|
||||||
|
|---|---|
|
||||||
|
| `,dcdu` | `docker compose --profile dev up service_dev --force-recreate --detach` |
|
||||||
|
| `,dcdd` | `docker compose --profile dev down --remove-orphans` |
|
||||||
|
| `,dcdl` | `docker compose --profile dev logs -f service_dev` |
|
||||||
|
| `dcu` | `docker compose up --force-recreate --detach` |
|
||||||
|
| `dcd` | `docker compose down --remove-orphans` |
|
||||||
|
| `dcl` | `docker compose logs -f` |
|
||||||
|
|
||||||
|
### Tmux aliases (`.zshrc`)
|
||||||
|
|
||||||
|
| Alias | What it does |
|
||||||
|
|---|---|
|
||||||
|
| `tmuxr` | Attach-or-create session named "auto" |
|
||||||
|
| `tmuxn` | Same + opens a new window |
|
||||||
|
| `tmuxa NAME` | Attach-or-create a named session |
|
||||||
|
|
||||||
|
### Tmux keybindings (`.tmux.conf`)
|
||||||
|
|
||||||
|
- **Shift+Left/Right** — switch windows (no wrap)
|
||||||
|
- **PgUp/PgDn** — swap window position left/right
|
||||||
|
- **prefix+f** — fzf fuzzy window switcher
|
||||||
|
- **prefix+R** — rename window
|
||||||
|
- Splits retain current path. 1-indexed windows, auto-rename shows `command@directory`.
|
||||||
|
|
||||||
|
### Vim (`.vimrc`)
|
||||||
|
|
||||||
|
Space as leader. `jk` exits insert mode. Persistent undo in `~/.vim/undo/`. Arrow keys disabled (hjkl only). Mouse enabled. Smart case search. 8-line scroll margin.
|
||||||
|
|
||||||
|
### Utility functions (`.zshrc`)
|
||||||
|
|
||||||
|
| Function | Purpose |
|
||||||
|
|---|---|
|
||||||
|
| `clip` | Pipe stdin to system clipboard via OSC 52 (works over SSH/tmux) |
|
||||||
|
| `mkcd DIR` | mkdir + cd in one step |
|
||||||
|
| `cdtmp [label]` | Create and cd into a timestamped temp dir under `~/tmp/` |
|
||||||
|
|
||||||
|
### Other aliases (`.zshrc`)
|
||||||
|
|
||||||
|
- `c` → `claude`
|
||||||
|
- `,cd` → `claude --dangerously-skip-permissions` (with sandbox flag)
|
||||||
|
- `zshreload` → `exec zsh`
|
||||||
|
- `LATEST` — global alias expanding to `*(om[1])` (most recently modified file)
|
||||||
|
|
||||||
|
### Shell options (`.zshrc`)
|
||||||
|
|
||||||
|
Extended history (100k lines, shared, deduped). Case-insensitive globbing. Auto-pushd on cd. No flow control (Ctrl-S disabled). Emacs keybindings with Ctrl+X,E / Alt+E for `$EDITOR`.
|
||||||
|
|
||||||
|
### Machine-local overrides
|
||||||
|
|
||||||
|
`~/.zshrc-extra` is sourced at the end if it exists — for per-machine config that doesn't belong in version control.
|
||||||
Reference in New Issue
Block a user