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,15 +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.
|
||||
|
||||
@@ -99,18 +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
|
||||
|
||||
@@ -22,7 +22,6 @@ vim/autoload/ pathogen loader (committed)
|
||||
vim/colors/ molokai colorscheme (committed)
|
||||
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)
|
||||
@@ -32,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`. 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. 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.
|
||||
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.
|
||||
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.
|
||||
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/`)
|
||||
|
||||
|
||||
@@ -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:"*) ;;
|
||||
|
||||
@@ -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:"*) ;;
|
||||
|
||||
+10
-63
@@ -152,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"
|
||||
}
|
||||
|
||||
@@ -418,56 +418,6 @@ setup_macos_shell() {
|
||||
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() {
|
||||
@@ -595,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
|
||||
@@ -655,11 +608,6 @@ 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)"
|
||||
@@ -678,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
|
||||
|
||||
@@ -1,271 +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"
|
||||
|
||||
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).
|
||||
if-shell 'command -v pbcopy >/dev/null' \
|
||||
'bind -Tcopy-mode-vi y 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 -Tcopy-mode-vi y send -X copy-selection-and-cancel ; bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-selection-no-clear ; bind p 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
|
||||
|
||||
bind-key -T copy-mode-vi MouseDown1Pane select-pane\; send-keys -X clear-selection
|
||||
bind -n MouseDrag1Pane if -Ft= '#{mouse_any_flag}' 'if -Ft= \"#{pane_in_mode}\" \"copy-mode -eM\" \"send-keys -M\"' 'copy-mode -eM'
|
||||
# (note) {{{
|
||||
# The `bind-key -T copy-m...` let a single click do selection clearing for us.
|
||||
# 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
|
||||
# }}}
|
||||
|
||||
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'
|
||||
|
||||
@@ -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:"*) ;;
|
||||
|
||||
Reference in New Issue
Block a user