1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-05-16 17:23:24 -07:00

many tmux tweaks

This commit is contained in:
Connor Olding 2019-06-13 03:48:02 -07:00
parent 7e6e46813e
commit bbd06ac340
2 changed files with 26 additions and 12 deletions

View File

@ -15,12 +15,18 @@ setw -g mode-keys vi
# remove delay on escape key
set -sg escape-time 0
# automatically set terminal titles (not tmux windows)
# set the terminal title to the current window's
set -g set-titles on
set -g set-titles-string '#T'
set -g set-titles-string '#{host}: #{pane_title}'
# set the default terminal to tmux instead of pretending to be screen.
# NOTE: netbsd-curses requires a terminfo.cdb to be built with tmux support.
# for my own convenience:
# curl https://eaguru.guru/t/terminfo.cdb -o /usr/share/terminfo.cdb
set -g default-terminal "tmux-256color"
# set right-hand status line text, default: "#{=21:pane_title}" %H:%M %d-%b-%y
set -g status-right "#{=21:pane_title} %R %B %e, '%y "
set -g status-right "#{=21:host} %Y/%m/%d %R"
# increase scrollback lines from 2000
set -g history-limit 10000

View File

@ -1,5 +1,7 @@
[ -e /etc/profile ] && emulate sh -c "source /etc/profile"
if [ "$SHLVL" -le 1 ] && ! expr "$TERM" : screen >/dev/null; then
if [ "$SHLVL" -le 1 ] && [[ "$TERM" != screen* ]] && [[ "$TERM" != tmux* ]]
then
if which tmux >/dev/null 2>/dev/null; then
# create a new session called "what" or attach if it already exists
LANG="en_US.UTF-8" TZ=":/etc/localtime" tmux new -A -s what && exit
@ -94,6 +96,8 @@ bindkey '^[[3~' delete-char
bindkey ';5D' emacs-backward-word # ctrl+left
bindkey ';5C' emacs-forward-word # ctrl+right
#bindkey '^[[D' emacs-backward-word # ctrl+left
#bindkey '^[[D' emacs-forward-word # ctrl+right
bindkey ';3D' dirprev # alt+left
bindkey ';3C' dirnext # alt+right
bindkey ';3A' dirup # alt+up
@ -134,15 +138,19 @@ tw() {
twitch "$@" OMFG STFU &
}
if [[ "$TERM" = xterm* ]]; then
# set window title
precmd() { print -Pn "\e]2;%M: %~\a" }
else
precmd() {}
fi
function {
if [[ "$TERM" != xterm* ]] && [[ "$TERM" != screen* ]]; then
local t="${TERM%%-*}"
if [ "$t" = xterm ] || [ "$t" = screen ] || [ "$t" = tmux ]; then
# set window title
if [ "$t" = tmux ]; then
# don't include host, tmux prepends it
precmd() { print -Pn "\e]2;%~\a" }
else
precmd() { print -Pn "\e]2;%M: %~\a" }
fi
else
# act dumb
precmd() {}
PROMPT="%# "
return
fi