diff --git a/mksh/mkshrc b/mksh/mkshrc index 198f6d0..8d7053c 100644 --- a/mksh/mkshrc +++ b/mksh/mkshrc @@ -1,5 +1,5 @@ -export HISTFILESIZE=10000 -export HISTCONTROL=ignoredups +export HISTSIZE=10000 # mksh uses HISTSIZE; HISTFILESIZE is bash-only +export HISTCONTROL=ignoredups # bash-only, mksh ignores it (kept for other shells) export HISTFILE=$HOME/.cache/mksh_history export PAGER="less" export FCEDIT=nvim @@ -11,7 +11,10 @@ ulimit -c unlimited stty -ixon bind '^l'=clear-screen bind '^k'=kill-line -bind '^j'=kill-to-eol +# Do NOT bind ^J: it is LF, i.e. the newline the line editor needs to submit a +# command. Rebinding it makes Enter silently do nothing whenever the terminal +# sends LF instead of CR (tmux extended-keys/CSI-u, pasted input, scripts) and +# the shell looks hung. kill-to-eol is unbound now; ^U still does kill-line. bind '^e'=edit-line # alias dot='/usr/bin/git --work-tree=$DOTS --git-dir=$DOTS/.git' diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 0e46b7a..6755117 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -8,11 +8,21 @@ set -s escape-time 0 set -g detach-on-destroy on set -g destroy-unattached off +# Keep the server alive with zero sessions. Grouped sessions share "main"'s +# window list, so closing the last window empties "main" too; with the default +# `exit-empty on` that killed the whole server out from under every other +# attached client. The client command below rebuilds "main" on next connect. +set -s exit-empty off + # bare `tmux` (no subcommand, e.g. from mkshrc's auto-attach) gets its own # session grouped with "main" - shared panes/windows, independent per-client # current-window navigation. Self-cleans on detach via destroy-unattached. -new-session -d -s main -set -g default-client-command "new-session -t main ; set-option destroy-unattached on" +# +# `new-session -A -d -s main` is a no-op when "main" exists and recreates it +# detached when it does not. It is one tmux command, so it is ordered before +# the `-t main` group join - unlike if-shell/run-shell, which are not. +new-session -A -d -s main +set -g default-client-command "new-session -A -d -s main ; new-session -t main ; set-option destroy-unattached on" # set -g default-terminal "screen-256color" set -g default-terminal "tmux-256color" set -g history-limit 50000 @@ -23,7 +33,6 @@ set -g set-titles-string "#W #T" set -g display-time 8000 set -g status-interval 2 # set -g set-remain-on-exit off -set -g terminal-overrides 'xterm*:smcup@:rmcup@' set -g window-size latest set-option -sa terminal-overrides ',screen-256color:RGB' set-option -sa terminal-overrides ',st-256color:RGB' @@ -38,7 +47,6 @@ set-option -sa terminal-overrides ',foot:RGB' # keybinds unbind-key -a -set -g default-terminal "xterm-256color" # set-option -ga terminal-overrides ',xterm-256color:Tc set-option -sa terminal-features ',xterm-256color:RGB' @@ -122,7 +130,6 @@ setw -g window-status-current-format '#[fg=black]>#[fg=yellow]#W' # fix ncurses crash set -as terminal-overrides ',st*:Ss@' -set-option -sa terminal-overrides ",xterm*:Tc" # Undercurl # set -g default-terminal '${TERM}' set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support