Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06b892172f |
@@ -131,16 +131,3 @@ Docker; staying on zsh w/o config. Status: merged develop 7d5dabd.
|
||||
lines). deploy_zsh_config: if ~/.zshrc differs from repo copy (cmp -s) → timestamped mv in $HOME; identical → no
|
||||
backup (rerun no dup). Machine-specific lines → ~/.zshrc.local (sourced). Same flaw still on .bashrc/.vim (open,
|
||||
not fixed). Status: done.
|
||||
|
||||
## BDR-017 — tmux pane moves on ctrl+u/h/j/k, not hjkl nor option+arrows
|
||||
2026-10-06. u/h/j/k laid out as arrows (u up, h left, j down, k right): same key positions on AZERTY and QWERTY US,
|
||||
control exists on every keyboard (option does not, cmd never reaches tmux). Alternatives rejected: ctrl+i/j/k/m
|
||||
(C-i = Tab, C-m = Enter, same bytes, would break completion); option+arrows (needs iTerm2 "Left Option = Esc+",
|
||||
no option key on some keyboards). Cost: shell loses C-u (readline clear-line). Gain: C-l free, clears screen again.
|
||||
Resize mirrors it with prefix. Status: done (tmux.conf).
|
||||
|
||||
## BDR-018 — Linux tmux clipboard = tmux buffer + OSC 52, no xsel/xclip
|
||||
2026-10-06. tmux.conf clipboard via `if-shell 'command -v pbcopy'`: macOS → pbcopy/pbpaste; else `y` =
|
||||
copy-selection-and-cancel, `p` = paste-buffer, tmux hands the buffer to the terminal through OSC 52 (set-clipboard),
|
||||
reaches the local clipboard over ssh from iTerm2. xsel/xclip rejected: headless servers have no X display (xsel
|
||||
errors), xclip keeps STDOUT open and hangs tmux. Status: done.
|
||||
|
||||
@@ -84,30 +84,3 @@ Local main 15 commits behind develop → worked off develop. install.sh Darwin b
|
||||
gaps report), bashrc-osx = bashrc-linux + macOS deltas, dt portable, zsh option (oh-my-zsh + bchanot theme). Tested:
|
||||
shellcheck, bash 3.2/5 + zsh -n, bashrc/zshrc/theme live in shells, dt with real dtach session, stub harness both
|
||||
choices. Full install.sh not run on this Mac. BDR-015/016, LRN-014, BLK-007. Merged develop 7d5dabd, not pushed.
|
||||
|
||||
## 2026-10-06
|
||||
- Cut v1.0.0: first tagged release, develop → main via /release-candidate. CHANGELOG.md bootstrapped from 31 develop commits, version.txt created. Tag pushed. Pre-existing shellcheck SC2148 on bashrc files untouched.
|
||||
|
||||
## 2026-10-06 (pm) — macOS tmux config + cloudpex offer
|
||||
Done: tmux.conf (sohorx vi-style, tpm) deployed on macOS → ~/.config/tmux, tpm cloned + plugins fetched headless, libtmux via pip --user (PEP 668 fallback). XDG_CACHE_HOME exported in osx rc files (config needs it, else resurrect dir = "/tmux/"). cloudpex: unconditional install → [y/N] offer with the other Linux extras. Verified: shellcheck, temp-HOME run x3, tmux parses config. Branch feature/tmux-config → develop.
|
||||
|
||||
## 2026-10-06 (pm, 2) — tmux keys + Linux
|
||||
Done: tmux.conf fixes (pbcopy, C-a passthrough, is_vim via pane_current_command), pane moves ctrl+u/h/j/k (AZERTY/QWERTY invariant; C-i/C-m = Tab/Enter, rejected), splits prefix i / -, deploy on Linux too (clipboard if-shell: pbcopy else tmux buffer + OSC 52). Verified in Ubuntu 24.04 container. Merged bugfix/tmux-macos-keys → develop (e3be25f).
|
||||
|
||||
## 2026-10-06 (pm, 3) — tmux selection, keep tmux over iTerm2 splits
|
||||
Done: mode-style yellow/black (black bg invisible on dark iTerm2), mouse drag release copies (pbcopy / tmux buffer) without leaving copy-mode. Merged bugfix/tmux-selection → develop (b73ee08). Decided (chat, AskUserQuestion): keep tmux, not iTerm2/Terminator/WezTerm splits — ssh persistence, GNOME Terminal has no splits. BDR offered, not written yet. Wheel issue was a stale iTerm2 session: restart fixed it.
|
||||
|
||||
## 2026-10-06 (pm, 4) — tmux click exit + alt copy/paste
|
||||
Done: plain click leaves copy-mode (MouseUp1Pane cancel; MouseDown cancel was wrong, killed drag after scroll), alt+c = y, alt+v = paste, per OS. Merged bugfix/tmux-click-exit → develop (8b5e936). Open: iTerm2 "Left Option = Esc+" is manual (US Intl PC layout coming); dynamic-profile deploy offered, not asked. GNOME Terminal OSC 52 support unverified.
|
||||
|
||||
## 2026-10-06 (pm, 5) — identity asked at install
|
||||
Done: USER/EMAIL no longer hardcoded in tracked rc files (@USER@/@EMAIL@ placeholders, rendered by install.sh; existing rc export reused, else IDENTITY_* env, else prompt). vimrc reads $USER/$EMAIL. Merged feature/identity-prompt → develop (0687f6a). Open: old values remain in git history (rewrite not done, destructive); deployed ~/.bashrc/.zshrc on this Mac still hold bchanot@gmail.fr.
|
||||
|
||||
## 2026-10-06 — tmux wheel halved, dtach mac/termux checked
|
||||
Done: copy-mode-vi WheelUp/DownPane rebound `-N 2` (stock 5), live reload OK. Merged bugfix/tmux-wheel-half → develop (ec9d0ed). Checked: dtach master on macOS reparents to launchd, survives parent SIGKILL + SIGHUP (sessions outlive shell crash). Termux: dtach 0.9 in official repo, scripts need `pkg install dtach fzf procps`; install.sh NOT Termux-safe (apt-get path); app kill = sessions lost, needs termux-wake-lock. Untested on device.
|
||||
|
||||
## 2026-10-06 (pm, 7) — tmux ctrl+h/j/k/u in copy-mode
|
||||
Done: copy-mode-vi table had stock C-h cursor-left, C-u halfpage-up, C-j copy, so no-prefix pane moves became text nav once scrolled. Four keys rebound select-pane in copy-mode-vi, live reload OK. Merged bugfix/tmux-copy-mode-ctrl-nav → develop (8b6ed6b). Open: deployed ~/.config/tmux/tmux.conf on this Mac predates alt+v/wheel/this fix, `./install.sh` not re-run.
|
||||
|
||||
## 2026-10-06 (pm, 8) — tmux drag "syntax error" in claude panes
|
||||
Done: MouseDrag1Pane binding had `\"` inside '...' (literal since tmux 3.0); branch for mouse-tracking panes (claude fullscreen, vim mouse=a) failed to parse → "syntax error", no selection. Backslashes dropped, pitfall noted in conf. Deployed to ~/.config/tmux/tmux.conf + source-file, live binding verified (`forwarded-to-app`). Merged bugfix/tmux-drag-syntax-error → develop (2245247). Closes the "deployed conf stale" open item.
|
||||
|
||||
@@ -99,27 +99,3 @@ Same branch. Prompt at start of Darwin block (MACOS_SHELL=bash|zsh env overrides
|
||||
- [x] README + CLAUDE.md layout
|
||||
- [x] Verify: shellcheck, bash -n, render to temp HOME, `git config --file` reads values
|
||||
- [x] `git-delta` added to apt + brew lists (gitconfig pager = delta)
|
||||
|
||||
## Feature — macOS tmux config (tmux.conf + tpm) ; cloudpex becomes an offer (2026-10-06)
|
||||
Branch: feature/tmux-config (off develop, "met ca dans develop" = finish into develop). tmux already in the brew list.
|
||||
- [x] install.sh `deploy_tmux_config` (Darwin): tmux.conf → ~/.config/tmux/tmux.conf (differing one → .backup-<date>, stray ~/.tmux.conf moved aside since tmux reads it first), clone tpm, headless `install_plugins`, libtmux for tmux-window-name (non-fatal)
|
||||
- [x] bashrc-osx + zshrc-osx: export XDG_CACHE_HOME (tmux.conf resurrect dir needs it, else "/tmux/")
|
||||
- [x] README macOS step + CLAUDE.md layout
|
||||
- [x] shellcheck, bash -n, zsh -n; run deploy_tmux_config against a temp HOME; tmux parses the config
|
||||
- [x] cloudpex: `install_cloudpex` → `offer_cloudpex` ([y/N] via confirm, with the other Linux offers); README/CLAUDE.md wording
|
||||
|
||||
## tmux follow-ups (2026-10-06, branch bugfix/tmux-macos-keys)
|
||||
- [x] tmux.conf: pbcopy/pbpaste, `bind C-a send-prefix`, is_vim via pane_current_command
|
||||
- [x] pane moves ctrl+u/h/j/k (arrow layout, AZERTY/QWERTY invariant), resize mirrors with prefix; C-l free
|
||||
- [x] splits: prefix i (side by side) and prefix - (stacked), h/j/k/l kept
|
||||
- [x] Linux: deploy_tmux_config on both OSes (gated on tmux), clipboard if-shell (pbcopy else tmux buffer + OSC 52), XDG_CACHE_HOME in bashrc-linux
|
||||
- [x] Verified: shellcheck/bash -n, macOS test server, Ubuntu 24.04 container (tmux 3.4) full deploy + bindings + split + plugins + libtmux
|
||||
|
||||
## Feature — identity asked at install, no hardcoded USER/EMAIL in tracked rc files (2026-10-06)
|
||||
Branch: feature/identity-prompt (off develop). Values were visible to anyone reading the repo.
|
||||
- [x] rc templates (bashrc-linux, bashrc-osx, zshrc-osx): `export USER="@USER@"` / `export EMAIL="@EMAIL@"`
|
||||
- [x] install.sh resolve_identity: existing ~/.bashrc / ~/.zshrc export wins silently → IDENTITY_USER/IDENTITY_EMAIL env → prompt (TTY) → default (id -un, empty email)
|
||||
- [x] install.sh: render_identity_template (generic, replaces render_gitconfig); bashrc + zshrc rendered, gitconfig unchanged (reads the rendered bashrc)
|
||||
- [x] vim/vimrc: g:_author / g:_email from $USER / $EMAIL
|
||||
- [x] README, CLAUDE.md (CHANGELOG left to the release step, like the tmux work)
|
||||
- [x] Verify: shellcheck, bash -n, zsh -n; temp-HOME render (env preset, existing rc reuse); vim reads the env
|
||||
|
||||
@@ -20,10 +20,8 @@ install.sh one-shot installer (OS auto-detected)
|
||||
vim/vimrc vim config (pathogen, molokai, syntastic, NERDTree)
|
||||
vim/autoload/ pathogen loader (committed)
|
||||
vim/colors/ molokai colorscheme (committed)
|
||||
bash/bashrc-{linux,osx} OS-detected bashrc; USER/EMAIL identity = @USER@/@EMAIL@ placeholders,
|
||||
asked at install (reused from an existing rc), never tracked
|
||||
bash/bashrc-{linux,osx} OS-detected bashrc (exports USER/EMAIL identity)
|
||||
gitconfig user-scope ~/.gitconfig template, @USER@/@EMAIL@ filled at install
|
||||
tmux.conf tmux config (vi keys, tpm plugins) → ~/.config/tmux/tmux.conf, both OSes (tmux ≥ 3.1)
|
||||
zsh/{zshrc-osx,bchanot.zsh-theme} macOS zsh option: oh-my-zsh zshrc + theme porting the bash prompt
|
||||
bin/{dt,dtach-router,claude-provider} CLI scripts deployed to ~/.local/bin
|
||||
etc/profile.d/disk-usage-warning.sh login-time low-disk warning → /etc/profile.d (Linux only)
|
||||
@@ -33,7 +31,7 @@ etc/default/earlyoom earlyoom args, spare sshd / kill node fi
|
||||
etc/fail2ban/jail.d/local.conf sshd jail: journal backend, all-ports ban, LAN ignored (always)
|
||||
etc/apt/apt.conf.d/20auto-upgrades unattended security upgrades on (always)
|
||||
etc/ssh/sshd_config.d/20-hardening.conf sshd limits that cannot lock out, sshd -t gated (always)
|
||||
cloudpex/{cloudpex,install.sh,README.md} on-demand SMB mount helper → /usr/local/bin, offered [y/N]; site values
|
||||
cloudpex/{cloudpex,install.sh,README.md} on-demand SMB mount helper → /usr/local/bin; site values
|
||||
prompted at install → /etc/cloudpex.conf, never in the script (FR docs)
|
||||
.claude/{tasks,memory,audits}/ Claude working state
|
||||
```
|
||||
|
||||
@@ -16,9 +16,8 @@ curl -fsSL https://git.bchanot.fr/bchanot/config/raw/branch/master/remote-instal
|
||||
|
||||
| Path | Purpose |
|
||||
| -------------------- | -------------------------------------------------------------- |
|
||||
| `install.sh` | Linux: installs apt packages + Docker + code-server + RDP (gnome-remote-desktop), backs up old config, deploys vim + bashrc (OS-detected), installs CLI scripts, pipx tools and a low-disk login warning; ends by offering three extras (`/tmp` on disk, SSH memory guard, the `cloudpex` NAS mount helper). macOS: same tooling through Homebrew (see [macOS](#macos)), deploys the tmux config, then prints what was not installed compared with Linux. |
|
||||
| `tmux.conf` | tmux config (vi keys, mouse, status bar, tpm plugins: resurrect + continuum session restore, window-name). Deployed on both OSes to `~/.config/tmux/tmux.conf` (tmux ≥ 3.1). |
|
||||
| `cloudpex/` | On-demand SMB mount of a NAS share (`cloudpex` command + its installer, offered `[y/N]` at the end of a Linux install). Site values (host, share, SMB user, mount point, SMB version) are prompted at install and stored in `/etc/cloudpex.conf`, never in the script. French README inside. |
|
||||
| `install.sh` | Linux: installs apt packages + Docker + code-server + RDP (gnome-remote-desktop), backs up old config, deploys vim + bashrc (OS-detected), installs CLI scripts, pipx tools, a low-disk login warning and the `cloudpex` NAS mount helper; ends by offering two system changes (`/tmp` on disk, SSH memory guard). macOS: same tooling through Homebrew (see [macOS](#macos)), then prints what was not installed compared with Linux. |
|
||||
| `cloudpex/` | On-demand SMB mount of a NAS share (`cloudpex` command + its installer). Site values (host, share, SMB user, mount point, SMB version) are prompted at install and stored in `/etc/cloudpex.conf`, never in the script. French README inside. |
|
||||
| `etc/tmpfiles.d/tmp.conf` | Cleanup rules for a disk-backed `/tmp` (wiped at boot, 10-day purge). Deployed by the `/tmp` on disk offer. |
|
||||
| `etc/systemd/ssh.service.d/override.conf` | `ssh.service` drop-in: sshd exempt from the OOM killer + memory reclaim protection. Deployed by the SSH memory guard offer. |
|
||||
| `etc/default/earlyoom` | earlyoom arguments: spare sshd/systemd, kill node/java first. Deployed by the SSH memory guard offer. |
|
||||
@@ -66,13 +65,13 @@ What it does:
|
||||
3. Moves any existing `~/.vim`, `~/.vimrc`, `~/.bashrc`, `~/.Sublivim` to `~/Oldconfig`.
|
||||
4. Clones the `syntastic` and `nerdtree` vim plugins into `~/.vim/bundle/`.
|
||||
5. Copies the tracked vim files into `~/.vim` and symlinks `~/.vimrc`.
|
||||
6. Picks the bashrc by OS: macOS → `bashrc-osx` (falls back to `bashrc-linux` if missing), everything else → `bashrc-linux`. Renders it into `~/.bashrc` with the identity asked at the very start: a name and an email for git commits and vim headers. An `export USER=` / `export EMAIL=` already present in `~/.bashrc` or `~/.zshrc` is reused without asking, so a re-run never prompts twice; `IDENTITY_USER` / `IDENTITY_EMAIL` preset them; with no terminal attached it falls back to the login name and an empty email. The values live only in the deployed files, never in the repo. Then renders `gitconfig` into `~/.gitconfig` with the same `USER` / `EMAIL`. A different existing `~/.gitconfig` is saved as `~/.gitconfig.backup-<date>`; an identical one is left alone. It is the global level only: a repo's own `.git/config` still overrides it. `core.excludesfile` points at `~/.gitignore`, ignored by git when the file does not exist. Then deploys `tmux.conf` to `~/.config/tmux/tmux.conf` (both OSes, tmux ≥ 3.1: Ubuntu 22.04+, brew), clones [tpm](https://github.com/tmux-plugins/tpm) and fetches the listed plugins headlessly; details under [macOS](#macos) step 6, the step is the same. On Linux, `y` copies into tmux's buffer and the terminal clipboard through OSC 52; macOS uses `pbcopy`/`pbpaste`.
|
||||
6. Picks the bashrc by OS: macOS → `bashrc-osx` (falls back to `bashrc-linux` if missing), everything else → `bashrc-linux`. Copies it to `~/.bashrc`. Then renders `gitconfig` into `~/.gitconfig` with that bashrc's `USER` / `EMAIL`. A different existing `~/.gitconfig` is saved as `~/.gitconfig.backup-<date>`; an identical one is left alone. It is the global level only: a repo's own `.git/config` still overrides it. `core.excludesfile` points at `~/.gitignore`, ignored by git when the file does not exist.
|
||||
7. Installs Python CLIs via `pipx` (`PyMuPDF` → `pymupdf`, `Markdown` → `markdown_py`) — skipped if `pipx` is absent.
|
||||
8. Copies the `bin/` scripts (`dt`, `dtach-router`, `claude-provider`) into `~/.local/bin`. The dtach session-resume menu ships in the deployed bashrc (both OSes), so every interactive shell offers it — including VS Code Remote-SSH terminals, which are non-login and never read `~/.profile`. The installer also strips any older dtach block left in `~/.profile` so a plain SSH login doesn't prompt twice.
|
||||
9. On Linux, installs `etc/profile.d/disk-usage-warning.sh` to `/etc/profile.d/` (needs `sudo`) so each login warns when `/` or `/home` cross 85% usage.
|
||||
10. On Linux, installs **code-server** (VS Code in the browser) via its vendor script — skipped if already present — and enables the `code-server@<login>` systemd service (login from `id -un`: the bashrc overrides `$USER`).
|
||||
11. On Linux, installs **`ubuntu-desktop-minimal`** (GDM + GNOME Shell, ~1.5 GB): the RDP remote login below hands out a GNOME session, which a bare server install does not have. Then sets up **RDP remote login** via `gnome-remote-desktop` (Wayland-native): installs the daemon + `openssl`, generates a self-signed TLS cert once, and prompts interactively for shared "gate" credentials (skipped when no terminal is attached, or already set). Disables `xrdp` if present; opens UFW port `3389` only when UFW is already active. Finally, when `lspci` sees an NVIDIA GPU, runs `ubuntu-drivers install` to put on the driver the distro recommends for the card (no version pinned; loads at the next reboot). Skipped on machines without an NVIDIA GPU.
|
||||
12. On Linux, at the very end, **offers** (`[y/N]`) to install the **`cloudpex`** NAS mount helper to `/usr/local/bin` via `cloudpex/install.sh`, which prompts for the NAS host, share name, SMB user, mount point and SMB version and writes them to `/etc/cloudpex.conf` (root, `0600`; an existing config is shown and kept unless you say `n`; skipped when no terminal is attached). Nothing is mounted, no password stored, see [`cloudpex/README.md`](cloudpex/README.md).
|
||||
12. On Linux, installs the **`cloudpex`** NAS mount helper to `/usr/local/bin` via `cloudpex/install.sh`, which prompts for the NAS host, share name, SMB user, mount point and SMB version and writes them to `/etc/cloudpex.conf` (root, `0600`; an existing config is shown and kept unless you say `n`; skipped when no terminal is attached). Nothing is mounted, no password stored, see [`cloudpex/README.md`](cloudpex/README.md).
|
||||
13. On Linux, installs the **security baseline**, always, no prompt: **fail2ban** (+ `nftables`) with `etc/fail2ban/jail.d/local.conf` (sshd jail reading the journal, bans the offending IP on every port so the SSH port does not matter, 5 failures in 10 min → 1 h ban, loopback and private LAN ranges never banned); **unattended-upgrades** enabled through `etc/apt/apt.conf.d/20auto-upgrades`; and the **sshd drop-in** `etc/ssh/sshd_config.d/20-hardening.conf` (`PermitRootLogin no`, `MaxAuthTries 3`, `LoginGraceTime 20`), checked with `sshd -t` and removed again if sshd rejects it, then `reload ssh`. Authentication methods, port and user lists are left as they are.
|
||||
14. On Linux, at the very end, **offers** (`[y/N]`, skipped when no terminal is attached) to move **`/tmp` to disk**: Ubuntu mounts `/tmp` as a RAM-backed tmpfs capped at 50% of RAM, which agent runs fill, halving the RAM and breaking every shell with "No space left on device". Accepting masks `tmp.mount` and installs `etc/tmpfiles.d/tmp.conf` (wipe at boot, 10-day purge). Effective at the next reboot.
|
||||
15. On Linux, at the very end, **offers** to keep **SSH reachable under memory pressure**: installs the `ssh.service` drop-in (`OOMScoreAdjust=-1000`, `MemoryMin=256M`) and `earlyoom` with `etc/default/earlyoom` (kills the largest process, `node`/`java` first and never `sshd`, once free RAM and swap both drop under 10%). Restarting `ssh` keeps open sessions. Note: `MemoryMin` protects the sshd daemon only; login sessions live in `user.slice`, so no setting can reserve RAM for a future shell. earlyoom acting in time is the real protection.
|
||||
@@ -105,10 +104,9 @@ The same `./install.sh` detects macOS and replaces `apt-get` with Homebrew. It f
|
||||
3. Docker: `colima` (the Linux VM) + `docker docker-compose docker-buildx`. Writes `~/.docker/config.json` with `cliPluginsExtraDirs` so `docker compose` works, only when that file does not exist yet (otherwise prints the line to add).
|
||||
4. Starts `colima`, `code-server` and `mariadb` as `brew services` (the `systemctl enable --now` equivalent), skipping any already started.
|
||||
5. Deploys `bashrc-osx`, then appends one line to `~/.bash_profile` that sources `~/.bashrc`: macOS terminals open login shells, which never read `~/.bashrc` on their own. Done for both choices, so `bash` stays usable.
|
||||
6. Deploys `tmux.conf` to `~/.config/tmux/tmux.conf` (same step on Linux), clones [tpm](https://github.com/tmux-plugins/tpm) into `~/.config/tmux/plugins/tpm` and fetches the listed plugins headlessly (resurrect + continuum restore your sessions, window-name renames windows after what runs in them). A `~/.tmux.conf` would be read instead, so one found is moved to `~/.tmux.conf.backup-<date>`; a differing `~/.config/tmux/tmux.conf` becomes `tmux.conf.backup-<date>`. `libtmux` (needed by window-name) goes in the python user site; brew's python blocks that by default, so the install retries with `--break-system-packages`. Both plugin steps only warn on failure: `prefix` + `I` inside tmux fetches the plugins. Prefix is `C-a`.
|
||||
7. **bash** chosen: makes brew's bash 5 the login shell (adds it to `/etc/shells` with `sudo`, then `chsh`, which asks for your password). macOS ships bash 3.2, too old for the bashrc.
|
||||
**zsh** chosen: installs oh-my-zsh with its official script (unattended, skipped if `~/.oh-my-zsh` exists), renders `zsh/zshrc-osx` into `~/.zshrc` (same identity as the bashrc) and deploys the `bchanot` theme to `~/.oh-my-zsh/custom/themes/`, then makes `/bin/zsh` the login shell. An existing `~/.zshrc` that differs from the repo's is saved as `~/.zshrc.backup-<date>` (outside `~/Oldconfig`, which every run wipes). Move your machine-specific lines (nvm, bun, tokens) into `~/.zshrc.local`: the deployed zshrc loads it.
|
||||
8. Ends with the list of what the Linux install has and this one does not: `gcc` (Apple clang answers to `gcc`), `valgrind`, `dkms`, `net-tools`, `openssh-server` and the RDP desktop (both built into macOS, switched on in System Settings > Sharing), `cifs-utils`, `php-imagick`, the NVIDIA driver, the disk-usage warning, `cloudpex`, the security baseline and the two end-of-install offers.
|
||||
6. **bash** chosen: makes brew's bash 5 the login shell (adds it to `/etc/shells` with `sudo`, then `chsh`, which asks for your password). macOS ships bash 3.2, too old for the bashrc.
|
||||
**zsh** chosen: installs oh-my-zsh with its official script (unattended, skipped if `~/.oh-my-zsh` exists), deploys `zsh/zshrc-osx` to `~/.zshrc` and the `bchanot` theme to `~/.oh-my-zsh/custom/themes/`, then makes `/bin/zsh` the login shell. An existing `~/.zshrc` that differs from the repo's is saved as `~/.zshrc.backup-<date>` (outside `~/Oldconfig`, which every run wipes). Move your machine-specific lines (nvm, bun, tokens) into `~/.zshrc.local`: the deployed zshrc loads it.
|
||||
7. Ends with the list of what the Linux install has and this one does not: `gcc` (Apple clang answers to `gcc`), `valgrind`, `dkms`, `net-tools`, `openssh-server` and the RDP desktop (both built into macOS, switched on in System Settings > Sharing), `cifs-utils`, `php-imagick`, the NVIDIA driver, the disk-usage warning, `cloudpex`, the security baseline and the two end-of-install offers.
|
||||
|
||||
### CLI scripts (`bin/`)
|
||||
|
||||
|
||||
+3
-7
@@ -7,9 +7,6 @@ alias grep='grep --color=auto'
|
||||
# colored GCC warnings and errors
|
||||
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# XDG cache dir: tmux.conf saves resurrect/continuum sessions under it
|
||||
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||
|
||||
# Ensure ~/.local/bin is on PATH (pipx CLIs + personal scripts from bin/)
|
||||
case ":$PATH:" in
|
||||
*":$HOME/.local/bin:"*) ;;
|
||||
@@ -28,10 +25,9 @@ fi
|
||||
#export LANG=en_US.UTF-8
|
||||
|
||||
|
||||
# Identity for git commits and vim headers. Filled by install.sh (asked once,
|
||||
# reused from an existing ~/.bashrc / ~/.zshrc on re-runs), never stored here.
|
||||
export USER="@USER@"
|
||||
export EMAIL="@EMAIL@"
|
||||
# Identity for the vim header; install.sh also writes it into ~/.gitconfig
|
||||
export USER=bchanot
|
||||
export EMAIL=bchanot@gmail.fr
|
||||
|
||||
## Activate and custom bash completion
|
||||
#bind 'TAB:menu-complete'
|
||||
|
||||
+3
-7
@@ -17,9 +17,6 @@ alias grep='grep --color=auto'
|
||||
# colored GCC warnings and errors
|
||||
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# XDG cache dir: tmux.conf saves resurrect/continuum sessions under it
|
||||
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||
|
||||
# Ensure ~/.local/bin is on PATH (pipx CLIs + personal scripts from bin/)
|
||||
case ":$PATH:" in
|
||||
*":$HOME/.local/bin:"*) ;;
|
||||
@@ -38,10 +35,9 @@ fi
|
||||
#export LANG=en_US.UTF-8
|
||||
|
||||
|
||||
# Identity for git commits and vim headers. Filled by install.sh (asked once,
|
||||
# reused from an existing ~/.bashrc / ~/.zshrc on re-runs), never stored here.
|
||||
export USER="@USER@"
|
||||
export EMAIL="@EMAIL@"
|
||||
# Identity for the vim header; install.sh also writes it into ~/.gitconfig
|
||||
export USER=bchanot
|
||||
export EMAIL=bchanot@gmail.fr
|
||||
|
||||
## Activate and custom bash completion
|
||||
#bind 'TAB:menu-complete'
|
||||
|
||||
+27
-111
@@ -6,9 +6,6 @@ set -euo pipefail
|
||||
# Resolve the repo root so the script works from any working directory.
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
# Helpers are defined below; the identity itself is resolved right before the
|
||||
# OS-specific steps, so every prompt comes before the long package installs.
|
||||
|
||||
# Set up Docker's official Ubuntu apt repo, then install the engine + compose plugin.
|
||||
# Idempotent: skips entirely if docker is already on PATH. Ubuntu-only (uses the ubuntu repo).
|
||||
install_docker() {
|
||||
@@ -155,11 +152,11 @@ unwire_dtach_profile() {
|
||||
' "$profile" > "$profile.tmp" && mv "$profile.tmp" "$profile"
|
||||
}
|
||||
|
||||
# NAS helper, on request: deploys the on-demand CloudPex SMB mount command to
|
||||
# /usr/local/bin (see cloudpex/README.md). Nothing is mounted and no credential is
|
||||
# stored. Linux-only (cifs-utils); the helper's own installer is idempotent.
|
||||
offer_cloudpex() {
|
||||
confirm "Install the cloudpex NAS mount helper (on-demand SMB mount)?" || return 0
|
||||
# NAS helper: deploys the on-demand CloudPex SMB mount command to /usr/local/bin
|
||||
# (see cloudpex/README.md). Nothing is mounted and no credential is stored.
|
||||
# Linux-only (cifs-utils); the helper's own installer is idempotent.
|
||||
install_cloudpex() {
|
||||
echo "Installing the cloudpex mount helper"
|
||||
bash "$SCRIPT_DIR/cloudpex/install.sh"
|
||||
}
|
||||
|
||||
@@ -395,84 +392,32 @@ install_oh_my_zsh() {
|
||||
# ~/.zshrc.backup-<date>, not in ~/Oldconfig: that dir is wiped on every run, so
|
||||
# a second run would destroy the original (and its nvm/bun lines).
|
||||
deploy_zsh_config() {
|
||||
local name="$1" email="$2" rendered backup
|
||||
local themes="$HOME/.oh-my-zsh/custom/themes"
|
||||
local backup
|
||||
backup="$HOME/.zshrc.backup-$(date +%Y%m%d-%H%M%S)"
|
||||
rendered="$(render_identity_template "$SCRIPT_DIR/zsh/zshrc-osx" "$name" "$email")"
|
||||
if [ -e "$HOME/.zshrc" ] && ! printf '%s\n' "$rendered" | cmp -s - "$HOME/.zshrc"; then
|
||||
if [ -e "$HOME/.zshrc" ] && ! cmp -s "$HOME/.zshrc" "$SCRIPT_DIR/zsh/zshrc-osx"; then
|
||||
echo "Saving the current ~/.zshrc to $backup"
|
||||
mv "$HOME/.zshrc" "$backup"
|
||||
fi
|
||||
echo "Deploying zsh/zshrc-osx + bchanot theme ($name <$email>)"
|
||||
printf '%s\n' "$rendered" > "$HOME/.zshrc"
|
||||
echo "Deploying zsh/zshrc-osx + bchanot theme"
|
||||
cp "$SCRIPT_DIR/zsh/zshrc-osx" "$HOME/.zshrc"
|
||||
mkdir -p "$themes"
|
||||
cp "$SCRIPT_DIR/zsh/bchanot.zsh-theme" "$themes/"
|
||||
}
|
||||
|
||||
# The chosen macOS shell ($1): zsh gets oh-my-zsh + its config rendered with the
|
||||
# identity ($2 name, $3 email); bash needs brew's bash 5 (macOS ships 3.2, too
|
||||
# old for the bashrc). Either way it becomes the login shell, so new terminals
|
||||
# load the matching config.
|
||||
# The chosen macOS shell: zsh gets oh-my-zsh + its config; bash needs brew's
|
||||
# bash 5 (macOS ships 3.2, too old for the bashrc). Either way it becomes the
|
||||
# login shell, so new terminals load the matching config.
|
||||
setup_macos_shell() {
|
||||
if [ "$1" = zsh ]; then
|
||||
install_oh_my_zsh
|
||||
deploy_zsh_config "$2" "$3"
|
||||
deploy_zsh_config
|
||||
set_login_shell /bin/zsh
|
||||
else
|
||||
set_login_shell "$(brew --prefix)/bin/bash"
|
||||
fi
|
||||
}
|
||||
|
||||
# tmux, both OSes: tmux.conf goes to ~/.config/tmux/tmux.conf (read there since
|
||||
# tmux 3.1: Ubuntu 22.04+, brew) with tpm, which the config runs, in
|
||||
# ~/.config/tmux/plugins/tpm. tmux reads a ~/.tmux.conf first, so one found is
|
||||
# moved aside; a differing config is kept as tmux.conf.backup-<date>, outside
|
||||
# ~/Oldconfig which every run wipes. Idempotent.
|
||||
deploy_tmux_config() {
|
||||
local dir="$HOME/.config/tmux" stamp
|
||||
stamp="$(date +%Y%m%d-%H%M%S)"
|
||||
mkdir -p "$dir"
|
||||
if [ -e "$HOME/.tmux.conf" ]; then
|
||||
echo "Moving ~/.tmux.conf to ~/.tmux.conf.backup-$stamp (it would shadow $dir/tmux.conf)"
|
||||
mv "$HOME/.tmux.conf" "$HOME/.tmux.conf.backup-$stamp"
|
||||
fi
|
||||
if [ -e "$dir/tmux.conf" ] && ! cmp -s "$dir/tmux.conf" "$SCRIPT_DIR/tmux.conf"; then
|
||||
echo "Saving the current tmux.conf to $dir/tmux.conf.backup-$stamp"
|
||||
mv "$dir/tmux.conf" "$dir/tmux.conf.backup-$stamp"
|
||||
fi
|
||||
echo "Deploying tmux.conf to $dir"
|
||||
cp "$SCRIPT_DIR/tmux.conf" "$dir/tmux.conf"
|
||||
install_tmux_plugins "$dir/plugins/tpm"
|
||||
}
|
||||
|
||||
# tpm plus the plugins tmux.conf lists, fetched now so the first tmux start is
|
||||
# complete. tpm's script starts a tmux server to read @tpm_plugins, and the config
|
||||
# expects XDG_CACHE_HOME (exported by the rc files, not loaded by this script).
|
||||
# Failures only warn: prefix+I fetches the plugins from inside tmux.
|
||||
install_tmux_plugins() {
|
||||
local tpm="$1"
|
||||
if [ ! -d "$tpm" ]; then
|
||||
echo "Cloning tpm"
|
||||
git clone --quiet https://github.com/tmux-plugins/tpm "$tpm"
|
||||
fi
|
||||
echo "Installing tmux plugins"
|
||||
XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" "$tpm/bin/install_plugins" \
|
||||
|| echo "tmux plugins not installed — press prefix+I inside tmux" >&2
|
||||
install_libtmux
|
||||
}
|
||||
|
||||
# tmux-window-name (a listed plugin) is a python script importing libtmux. Brew's
|
||||
# python and Ubuntu 23.04+ refuse pip installs outside a venv (PEP 668), so the
|
||||
# user-site install is retried with that guard lifted. Non-fatal: without it,
|
||||
# windows keep tmux's own automatic-rename.
|
||||
install_libtmux() {
|
||||
python3 -c 'import libtmux' 2>/dev/null && return 0
|
||||
echo "Installing libtmux (tmux-window-name plugin)"
|
||||
python3 -m pip install --quiet --user libtmux 2>/dev/null \
|
||||
|| python3 -m pip install --quiet --user --break-system-packages libtmux \
|
||||
|| echo "libtmux not installed — tmux-window-name stays inactive" >&2
|
||||
}
|
||||
|
||||
# macOS terminals open LOGIN shells, which read ~/.bash_profile and never ~/.bashrc.
|
||||
# Appends one line sourcing ~/.bashrc. Idempotent: skipped when already present.
|
||||
wire_bash_profile() {
|
||||
@@ -491,36 +436,15 @@ rc_export_value() {
|
||||
sed -n "s/^export $1=//p" "$2" | tail -n 1 | tr -d "\"'"
|
||||
}
|
||||
|
||||
# Print the template $1 with @USER@ and @EMAIL@ replaced by $2 and $3. Bash
|
||||
# substitution, so the values need no sed escaping.
|
||||
render_identity_template() {
|
||||
local file="$1" name="$2" email="$3" line
|
||||
# Print the repo gitconfig template with @USER@ and @EMAIL@ replaced by $1 and
|
||||
# $2. Bash substitution, so the values need no sed escaping.
|
||||
render_gitconfig() {
|
||||
local name="$1" email="$2" line
|
||||
while IFS= read -r line || [ -n "$line" ]; do
|
||||
line="${line//@USER@/$name}"
|
||||
line="${line//@EMAIL@/$email}"
|
||||
printf '%s\n' "$line"
|
||||
done < "$file"
|
||||
}
|
||||
|
||||
# One identity value (USER or EMAIL, $1) for git commits, vim headers and the rc
|
||||
# exports. Never stored in the repo. An export already in ~/.bashrc or ~/.zshrc
|
||||
# wins silently (a re-run never asks twice), else IDENTITY_<VAR> from the
|
||||
# environment, else a prompt ($2 label, $3 default) when a terminal is attached,
|
||||
# else the default. Prints the value.
|
||||
resolve_identity() {
|
||||
local var="$1" label="$2" default="$3" value="" rc envvar="IDENTITY_$1"
|
||||
for rc in "$HOME/.bashrc" "$HOME/.zshrc"; do
|
||||
[ -f "$rc" ] && value="$(rc_export_value "$var" "$rc")"
|
||||
if [ -n "$value" ] && [ "$value" != "@$var@" ]; then
|
||||
printf '%s\n' "$value"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
value="${!envvar:-}"
|
||||
if [ -z "$value" ] && [ -t 0 ]; then
|
||||
read -rp "$label [$default]: " value || true
|
||||
fi
|
||||
printf '%s\n' "${value:-$default}"
|
||||
done < "$SCRIPT_DIR/gitconfig"
|
||||
}
|
||||
|
||||
# Install the user-scope ~/.gitconfig (a repo's own .git/config still wins).
|
||||
@@ -536,7 +460,7 @@ deploy_gitconfig() {
|
||||
echo "USER/EMAIL not exported by $rc — skipping ~/.gitconfig" >&2
|
||||
return 0
|
||||
fi
|
||||
rendered="$(render_identity_template "$SCRIPT_DIR/gitconfig" "$name" "$email")"
|
||||
rendered="$(render_gitconfig "$name" "$email")"
|
||||
if printf '%s\n' "$rendered" | cmp -s - "$HOME/.gitconfig"; then
|
||||
echo "$HOME/.gitconfig already up to date — skipping"
|
||||
return 0
|
||||
@@ -579,11 +503,6 @@ as brew services instead of systemd units.
|
||||
EOF
|
||||
}
|
||||
|
||||
# Identity for git, vim and the rc exports: reused from an existing rc, else asked.
|
||||
identity_name="$(resolve_identity USER "Name for git commits and vim headers" "$(id -un)")"
|
||||
identity_email="$(resolve_identity EMAIL "Email for git commits and vim headers" "")"
|
||||
echo "Identity: $identity_name <${identity_email:-no email}>"
|
||||
|
||||
# System packages: apt-get on Debian/Ubuntu, Homebrew on macOS.
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
sudo apt-get update
|
||||
@@ -626,6 +545,9 @@ if command -v apt-get >/dev/null 2>&1; then
|
||||
# Low-disk login warning (system-wide profile.d snippet).
|
||||
install_disk_warning
|
||||
|
||||
# On-demand NAS mount helper (cloudpex/).
|
||||
install_cloudpex
|
||||
|
||||
# Security baseline: brute-force bans, automatic security updates, sshd limits.
|
||||
install_fail2ban
|
||||
install_unattended_upgrades
|
||||
@@ -680,17 +602,12 @@ if [ "$(uname -s)" = "Darwin" ] && [ -f "$SCRIPT_DIR/bash/bashrc-osx" ]; then
|
||||
else
|
||||
bashrc="bash/bashrc-linux"
|
||||
fi
|
||||
echo "Deploying $bashrc ($identity_name <$identity_email>)"
|
||||
render_identity_template "$SCRIPT_DIR/$bashrc" "$identity_name" "$identity_email" > "$HOME/.bashrc"
|
||||
echo "Deploying $bashrc"
|
||||
cp "$SCRIPT_DIR/$bashrc" "$HOME/.bashrc"
|
||||
|
||||
# User-scope git config, identity taken from the bashrc just deployed.
|
||||
deploy_gitconfig "$SCRIPT_DIR/$bashrc"
|
||||
|
||||
# tmux config + plugins (tmux comes from the apt or brew list above).
|
||||
if command -v tmux >/dev/null 2>&1; then
|
||||
deploy_tmux_config
|
||||
fi
|
||||
|
||||
# Python CLIs via pipx (run as the user, never sudo). Skipped if pipx is absent.
|
||||
if command -v pipx >/dev/null 2>&1; then
|
||||
echo "Installing pipx CLIs (PyMuPDF -> pymupdf, Markdown -> markdown_py)"
|
||||
@@ -709,12 +626,11 @@ chmod +x "$HOME"/.local/bin/dt "$HOME"/.local/bin/dtach-router "$HOME"/.local/bi
|
||||
# Remove any stale dtach wiring from ~/.profile (the menu now ships in ~/.bashrc; see above).
|
||||
unwire_dtach_profile
|
||||
|
||||
# Optional pieces, offered last so the base install is complete even when
|
||||
# declined. Linux only. Each prompts [y/N] on a terminal, is skipped otherwise.
|
||||
# Optional system changes, offered last so the base install is complete even when
|
||||
# declined. Linux/systemd only. Each prompts [y/N] on a terminal, is skipped otherwise.
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
offer_tmp_on_disk
|
||||
offer_ssh_memory_guard
|
||||
offer_cloudpex
|
||||
fi
|
||||
|
||||
# macOS: login shells skip ~/.bashrc unless ~/.bash_profile sources it (kept even
|
||||
@@ -722,7 +638,7 @@ fi
|
||||
# Linux install has that this one does not.
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
wire_bash_profile
|
||||
setup_macos_shell "${macos_shell:-bash}" "$identity_name" "$identity_email"
|
||||
setup_macos_shell "${macos_shell:-bash}"
|
||||
print_macos_gaps
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,290 +0,0 @@
|
||||
# --------------------------------------------------------------------------- #
|
||||
# #
|
||||
# Module: tmux.conf By: sohorx <banlin.adrien@gmail.com> #
|
||||
# #
|
||||
# Created: 2015/04/01 18:17:25 Updated: 2016/04/01 18:17:25 #
|
||||
# #
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Note: {{{ #
|
||||
# minimalist tmux configuration which behave a bit like vi #
|
||||
# }}} #
|
||||
# --------------------------------------------------------------------------- #
|
||||
|
||||
# Global options: {{{
|
||||
# --------------
|
||||
set -g bell-action none # make it Shut up!
|
||||
set-option -g default-shell $SHELL # set shell
|
||||
set -g default-terminal "screen-256color" # term colors
|
||||
#set -ga terminal-overrides ",*256col*:Tc" # term cap only
|
||||
set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q,*256col*:Tc' # cursor control
|
||||
setw -g mode-keys vi # vi mode
|
||||
set -s escape-time 1 # Fix terminal name issues
|
||||
set -g set-titles on # Turn on window titles
|
||||
setw -g automatic-rename on # Automatically set window title
|
||||
set -g mouse on # mouse cap
|
||||
set-window-option -g clock-mode-colour brightwhite # set colour clock
|
||||
set -g focus-events on # for vim (?)
|
||||
set-option -g automatic-rename on # auto rename session
|
||||
set-option -g status-interval 5 # rename session interval
|
||||
set -g status on # enable status bar at start
|
||||
|
||||
# https://github.com/3rd/image.nvim/?tab=readme-ov-file#tmux
|
||||
set -gq allow-passthrough on # image.nvim requirements
|
||||
set -g visual-activity off # image.nvim requirements
|
||||
|
||||
# ------------------------------------------------------------------------- }}}
|
||||
# Change default strings: {{{
|
||||
# ----------------------
|
||||
# Set window title string
|
||||
set -g set-titles-string '#S :: #W :: #F#P #{pane_current_command}'
|
||||
#set-option -g automatic-rename-format "#{b:pane_current_path}"
|
||||
|
||||
# ------------------------------------------------------------------------- }}}
|
||||
# Variables: {{{
|
||||
# ---------
|
||||
|
||||
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
|
||||
# is_vim Note: {{{
|
||||
# The pane's foreground command, as tmux sees it. The older variant read a
|
||||
# "@tmux_vim_<pane>" variable that a vim plugin had to set; nothing sets it
|
||||
# here, so C-h/j/k/l never reached vim.
|
||||
# }}}
|
||||
|
||||
resurrect_root_dir="$XDG_CACHE_HOME/tmux/resurect"
|
||||
|
||||
# chunk of status bar variables and coloration
|
||||
#sep_st='#[fg=brightwhite,bg=brightblue]'
|
||||
#sep_c='#[fg=black]'
|
||||
#
|
||||
#sep_d='#[fg=brightwhite,bold]'
|
||||
#sep_e='#[default,fg=brightblack]#[bg=brightblack]#[fg=brightwhite]'
|
||||
#sep_f='#[fg=black]'
|
||||
#
|
||||
#sep_g='#[fg=blue,bold]'
|
||||
#sep_h='#[default,fg=brightwhite]#[fg=blue,bg=brightwhite,bold]'
|
||||
#sep_i='#[default,bg=brightwhite,fg=black]'
|
||||
#
|
||||
#sep_b='#[fg=brightyellow]#[default, bg=brightyellow, fg=black]'
|
||||
#sep_a='#[fg=yellow]#[bg=yellow, fg=black]'
|
||||
#
|
||||
#sep_off="#[fg=brightred]#[bg=brightred, fg=brightwhite, bold] OFF"
|
||||
#sep_on="#[fg=green]#[bg=green, fg=brightwhite, bold] ON"
|
||||
#
|
||||
#brightwhite_fg="#[fg=brightwhite]"
|
||||
##
|
||||
|
||||
sep_st='#[fg=brightwhite,bg=brightblue]'
|
||||
sep_c='#[fg=black] '
|
||||
|
||||
sep_d='#[fg=brightwhite,bold] '
|
||||
sep_e='#[default,fg=brightblack] #[bg=brightblack]#[fg=brightwhite]'
|
||||
sep_f='#[fg=black]'
|
||||
|
||||
sep_g='#[fg=brightblue,bold] '
|
||||
sep_h='#[default,fg=brightwhite] #[fg=black,bg=brightwhite,bold]'
|
||||
sep_i='#[default,bg=brightwhite,fg=black]'
|
||||
|
||||
sep_b='#[fg=brightyellow] #[default, bg=brightyellow, fg=black]'
|
||||
sep_a='#[fg=yellow] #[bg=yellow, fg=black]'
|
||||
|
||||
sep_off="#[fg=brightred] #[bg=brightred, fg=brightwhite, bold] OFF"
|
||||
sep_on="#[fg=green]#[bg=green, fg=brightwhite, bold] ON"
|
||||
|
||||
brightwhite_fg="#[fg=brightwhite]"
|
||||
|
||||
# ------------------------------------------------------------------------- }}}
|
||||
# Key bindings: {{{
|
||||
# ------------
|
||||
|
||||
# Unbindings
|
||||
unbind [
|
||||
unbind C-b # (prefix)
|
||||
unbind C-n # (nav)
|
||||
unbind l
|
||||
unbind C-p
|
||||
unbind v # (selection)
|
||||
unbind y # (copy)
|
||||
unbind p # (pasting)
|
||||
unbind % # (sp)
|
||||
unbind '"' # (vs)
|
||||
unbind-key -T copy-mode-vi MouseDragEnd1Pane # (mouse setting) {{{
|
||||
# stock binding = "release the drag: copy AND leave copy-mode", which loses
|
||||
# the selection on screen. Rebound below (clipboard section) as copy without
|
||||
# leaving, so a drag is enough and y stays available.
|
||||
# ref: https://github.com/tmux/tmux/issues/140
|
||||
# }}}
|
||||
|
||||
set -g prefix C-a # bind screen like prefix
|
||||
bind C-a send-prefix # C-a C-a = literal C-a (shell home)
|
||||
|
||||
# specific commands
|
||||
bind-key C-o command-prompt "new-session -s %1 -c ~"
|
||||
bind R source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded..."
|
||||
|
||||
# Resizing key bindings (same arrow layout as the moves below, with prefix)
|
||||
bind-key -r C-u resize-pane -U 5
|
||||
bind-key -r C-h resize-pane -L 5
|
||||
bind-key -r C-j resize-pane -D 5
|
||||
bind-key -r C-k resize-pane -R 5
|
||||
bind-key -r C-n next-window \; set status on
|
||||
bind-key -r C-p previous-window \; set status on
|
||||
|
||||
# Moving across panes (and vim), no prefix: ctrl + u/h/j/k laid out as arrows
|
||||
# (u up, h left, j down, k right). These keys sit at the same place on AZERTY
|
||||
# and QWERTY US, and need no option key. Each one still reaches vim when vim
|
||||
# runs in the pane. C-l is free, so it clears the shell screen again.
|
||||
# Shell cost: C-u (readline "clear the line") is taken.
|
||||
bind -n C-u if-shell "$is_vim" "send-keys C-u" "select-pane -U"
|
||||
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
|
||||
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
|
||||
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -R"
|
||||
# Copy-mode has its own key table, where stock tmux turns these keys into text
|
||||
# navigation (C-h cursor-left, C-u halfpage-up, C-j copy). Arrows do that job;
|
||||
# the four keys keep switching panes there too.
|
||||
bind -T copy-mode-vi C-u select-pane -U
|
||||
bind -T copy-mode-vi C-h select-pane -L
|
||||
bind -T copy-mode-vi C-j select-pane -D
|
||||
bind -T copy-mode-vi C-k select-pane -R
|
||||
|
||||
bind Escape copy-mode # bind vi-like 'normal' mode
|
||||
bind -Tcopy-mode-vi 'v' send -X begin-selection # bind vi-like visual mode
|
||||
# Clipboard: pbcopy/pbpaste on macOS. Elsewhere tmux's own buffer, which tmux
|
||||
# also hands to the terminal through OSC 52 (set-clipboard), so it reaches the
|
||||
# local clipboard over ssh. xsel/xclip dropped: headless servers have no X.
|
||||
# Releasing a mouse drag copies too (selection kept on screen, copy-mode stays).
|
||||
# alt+c (in a selection) = y, alt+v (anywhere, no prefix) = prefix p: cmd-less
|
||||
# keyboards. GNOME Terminal: keep "Enable mnemonics" off or alt+v opens View.
|
||||
if-shell 'command -v pbcopy >/dev/null' \
|
||||
'bind -Tcopy-mode-vi y send -X copy-pipe-and-cancel pbcopy ; bind -Tcopy-mode-vi M-c send -X copy-pipe-and-cancel pbcopy ; bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-pipe-no-clear pbcopy ; bind p run "pbpaste | tmux load-buffer - ; tmux paste-buffer" ; bind -n M-v run "pbpaste | tmux load-buffer - ; tmux paste-buffer"' \
|
||||
'bind -Tcopy-mode-vi y send -X copy-selection-and-cancel ; bind -Tcopy-mode-vi M-c send -X copy-selection-and-cancel ; bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-selection-no-clear ; bind p paste-buffer ; bind -n M-v paste-buffer'
|
||||
bind-key -Tcopy-mode-vi Escape send -X cancel # cancel v mode
|
||||
bind-key -Tcopy-mode-vi ^v send -X rectangle-toggle # cancel v mode
|
||||
|
||||
# Wheel: stock tmux scrolls 5 lines per tick, too fast on a trackpad (one flick =
|
||||
# dozens of ticks). Halved to 2; applies to history scrolling (copy-mode) only.
|
||||
bind -T copy-mode-vi WheelUpPane select-pane \; send-keys -X -N 2 scroll-up
|
||||
bind -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 2 scroll-down
|
||||
bind-key -T copy-mode-vi MouseDown1Pane select-pane -t = \; send-keys -X clear-selection
|
||||
bind-key -T copy-mode-vi MouseUp1Pane select-pane -t = \; send-keys -X cancel
|
||||
bind -n MouseDrag1Pane if -Ft= '#{mouse_any_flag}' 'if -Ft= "#{pane_in_mode}" "copy-mode -eM" "send-keys -M"' 'copy-mode -eM'
|
||||
# (note) {{{
|
||||
# A plain click (MouseDown then MouseUp, no drag) leaves copy-mode: back to
|
||||
# the prompt, selection dropped. A drag sends MouseDrag/MouseDragEnd instead
|
||||
# of MouseUp, so it keeps the scroll position and selects as usual. A click
|
||||
# on another pane still switches to it.
|
||||
# The `bind -n MouseDrag1Pane if -Ft= ...` changes the default binding of
|
||||
# MouseDrag1Pane, the only difference is that we use `copy-mode -eM` instead
|
||||
# of `copy-mode -M`, so that WheelDownPane can trigger copy-mode to exit when
|
||||
# copy-mode is entered by MouseDrag1Pane
|
||||
# Inner quotes stay plain: `\"` is literal inside '...' since tmux 3.0, and the
|
||||
# mouse-app branch (claude, vim) then dies with "syntax error" on every drag.
|
||||
# }}}
|
||||
|
||||
bind-key k "split-window -v -b -c '#{pane_current_path}'"
|
||||
bind-key h "split-window -h -b -c '#{pane_current_path}'"
|
||||
bind-key j "split-window -v -c '#{pane_current_path}'"
|
||||
bind-key l "split-window -h -c '#{pane_current_path}'"
|
||||
bind-key i "split-window -h -c '#{pane_current_path}'" # i: side by side (vertical bar)
|
||||
bind-key - "split-window -v -c '#{pane_current_path}'" # -: stacked (horizontal bar)
|
||||
|
||||
bind q kill-window # Kill window
|
||||
bind Q kill-session # Kill the session (not server)
|
||||
bind C-c neww \; set status on # enable status bar
|
||||
bind c neww \; set status on # disable status bar
|
||||
|
||||
# Enable disable bindings and change status bar with it {{{
|
||||
bind -T root F10 set status off
|
||||
bind -T root F9 set status on
|
||||
bind -T root F12 \
|
||||
set prefix None \; \
|
||||
set key-table off \;\
|
||||
set focus-events off \; \
|
||||
set status-right '#{brightwhite_fg} #h #{sep_b} %a %d/%m/%Y #{sep_a} %H:%M #{sep_off} : #{continuum_status} ' \;\
|
||||
set status on\; \
|
||||
refresh-client -S\;
|
||||
|
||||
bind -T off F11 \
|
||||
set -u prefix \;\
|
||||
set -u key-table \;\
|
||||
set -u focus-events \;\
|
||||
set status-right '#{brightwhite_fg} #h #{sep_b} %a %d/%m/%Y #{sep_a} %H:%M #{sep_on} : #{continuum_status} ' \;\
|
||||
set status on\;\
|
||||
refresh-client -S\;
|
||||
# }}}
|
||||
|
||||
# ------------------------------------------------------------------------- }}}
|
||||
# Plugins: {{{
|
||||
# -------
|
||||
# To make plugins works, the run tpm must be done by the main file.
|
||||
#
|
||||
# run '~/.config/tmux/plugins/tpm/tpm'
|
||||
##
|
||||
|
||||
set -g @tpm_plugins ' \
|
||||
tmux-plugins/tpm \
|
||||
ofirgall/tmux-window-name \
|
||||
tmux-plugins/tmux-sensible \
|
||||
tmux-plugins/tmux-resurrect \
|
||||
tmux-plugins/tmux-continuum \
|
||||
'
|
||||
|
||||
# plugins options
|
||||
set -g @resurrect-strategy-vim 'session'
|
||||
set -g @resurrect-capture-pane-contents 'on'
|
||||
set -g @resurrect-processes ' \
|
||||
irb \
|
||||
ipython \
|
||||
~ranger \
|
||||
pry \
|
||||
ri \
|
||||
"~bundle exec ri" \
|
||||
"~bundle exec pry" \
|
||||
"~pipenv shell" \
|
||||
"~pipenv run" \
|
||||
glow \
|
||||
"~vaas-infra ssh" \
|
||||
"~vaas-cli -s vaas-infra.dev.alphalink.fr ssh" \
|
||||
ssh \
|
||||
mosh \
|
||||
tig \
|
||||
'
|
||||
|
||||
set -g @resurrect-strategy-session 'always'
|
||||
set -g @continuum-restore 'on'
|
||||
set -g @continuum-save-interval '15' # save every minutes
|
||||
set -g @resurrect-dir "$XDG_CACHE_HOME/tmux/$TMUX_SOCKET_NAME"
|
||||
|
||||
# ------------------------------------------------------------------------- }}}
|
||||
# Status Bar: {{{
|
||||
# ----------
|
||||
|
||||
set -wg mode-style bg=yellow,fg=black # selection: same accent as the status bar
|
||||
set-window-option -g window-status-separator ''
|
||||
set -g status-position bottom
|
||||
set -g status-left-length 42
|
||||
set -g status-right-length 80
|
||||
set -g status-justify left
|
||||
#setw -g status-style bg=black
|
||||
setw -g status-style bg=default
|
||||
|
||||
set -g status-left '#{sep_st} λ #S #{sep_c}'
|
||||
# setw -g window-status-format '#{sep_d} #I #{sep_e} #W #{sep_f}'
|
||||
# setw -g window-status-current-format '#{sep_g} #I #{sep_h} #W #{sep_i}'
|
||||
# set -g status-right '#{brightwhite_fg} #h #{sep_b} %a %d/%m/%Y #{sep_a} %H:%M #{sep_on} : #{continuum_status} '
|
||||
setw -g window-status-format '#{sep_e} #W #{sep_f}'
|
||||
setw -g window-status-current-format '#{sep_h} #W #{sep_i}'
|
||||
set -g status-right '#{sep_b} #h #{sep_e}#{sep_on} : #{continuum_status} '
|
||||
|
||||
|
||||
# set Panel borders
|
||||
set -g pane-active-border-style fg=white,bg=white
|
||||
set -g pane-border-style fg=white,bg=default
|
||||
|
||||
# set Message text
|
||||
set-option -g message-style bg=default,fg=red
|
||||
set-option -g message-command-style bg=default,fg=brightwhite
|
||||
|
||||
# ------------------------------------------------------------------------- }}}
|
||||
|
||||
run '~/.config/tmux/plugins/tpm/tpm'
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
" Uset compatibility with Vii
|
||||
set nocompatible
|
||||
|
||||
" user info from the shell identity (USER / EMAIL exported by the deployed rc)
|
||||
let g:_author = $USER
|
||||
let g:_email = exists('$EMAIL') ? $EMAIL : ''
|
||||
" add user info variable
|
||||
let g:_author = "Bastien Chanot"
|
||||
let g:_email = "chanot.bastien@gmail.com"
|
||||
|
||||
" Enable pathogen for plugins
|
||||
execute pathogen#infect()
|
||||
|
||||
+3
-7
@@ -26,9 +26,6 @@ alias grep='grep --color=auto'
|
||||
# colored GCC warnings and errors
|
||||
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# XDG cache dir: tmux.conf saves resurrect/continuum sessions under it
|
||||
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||
|
||||
# Ensure ~/.local/bin is on PATH (pipx CLIs + personal scripts from bin/)
|
||||
case ":$PATH:" in
|
||||
*":$HOME/.local/bin:"*) ;;
|
||||
@@ -44,10 +41,9 @@ else
|
||||
SAVEHIST=10000000
|
||||
fi
|
||||
|
||||
# Identity for git commits and vim headers. Filled by install.sh (asked once,
|
||||
# reused from an existing ~/.bashrc / ~/.zshrc on re-runs), never stored here.
|
||||
export USER="@USER@"
|
||||
export EMAIL="@EMAIL@"
|
||||
# Identity for the vim header; install.sh also writes it into ~/.gitconfig
|
||||
export USER=bchanot
|
||||
export EMAIL=bchanot@gmail.fr
|
||||
|
||||
# claude-dans-dtach : creer une session (claude tournant dans dtach, detache via Ctrl-\).
|
||||
# Usage : cd ~/projets/seo && cc seo -> session nommee "seo".
|
||||
|
||||
Reference in New Issue
Block a user