1
0
Fork 0

bashrc, zshrc: fix escape sequence; tmux.conf: more compatible config

This commit is contained in:
Von Random 2021-03-03 00:10:38 +03:00
parent ea9ede6627
commit 443a196f25
3 changed files with 41 additions and 30 deletions

2
bashrc
View file

@ -17,7 +17,7 @@ export LS_COLORS='no=00:fi=00:di=34:ow=34;40:ln=35:pi=30;44:so=35;44:do=35;44:bd
# {{{ prompt # {{{ prompt
prompt_command() { prompt_command() {
case "$TERM" in case "$TERM" in
(screen*) printf '\ek%s\e\' "${HOSTNAME%%.*}";; (screen*) printf '\ek%s\e\\' "${HOSTNAME%%.*}";;
(*) printf '\e]0;%s\a' "${HOSTNAME%%.*}";; (*) printf '\e]0;%s\a' "${HOSTNAME%%.*}";;
esac esac
} }

View file

@ -6,38 +6,42 @@ bind h select-pane -L
bind j select-pane -D bind j select-pane -D
bind k select-pane -U bind k select-pane -U
bind l select-pane -R bind l select-pane -R
bind r display "resize" \; switch-client -T resize
bind -T resize -r h resize-pane -L 5
bind -T resize -r j resize-pane -D 5
bind -T resize -r k resize-pane -U 5
bind -T resize -r l resize-pane -R 5
bind p command-prompt -p "ssh:" "new-window 's %%'"
bind t command-prompt -p "attach pane to:" "join-pane -t '%%'"
bind y command-prompt break-pane bind y command-prompt break-pane
bind N new-session bind N new-session
bind -n M-w next-window bind -n M-w next-window
bind -n M-q previous-window bind -n M-q previous-window
set -g prefix C-g set -g prefix C-g
set -g terminal-overrides "*:Tc"
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
set -g mode-keys "vi" set -g mode-keys "vi"
set -g set-titles "on"
set -g set-titles-string "[#h:#S] #W"
set -g escape-time "0" set -g escape-time "0"
set -g history-limit "10000" set -g history-limit "10000"
# newer options, not universally compatible
bind p command-prompt -p "ssh:" "new-window 's %%'"
bind t command-prompt -p "attach pane to:" "join-pane -t '%%'"
set -g terminal-overrides "*:Tc"
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
set -g default-terminal "tmux-256color" set -g default-terminal "tmux-256color"
set -g message-style "bg=colour11,fg=colour15" bind r display "resize" \; switch-client -T resize
set -g message-command-style "bg=colour1,fg=colour15" bind -T resize -r h resize-pane -L 5
bind -T resize -r j resize-pane -D 5
bind -T resize -r k resize-pane -U 5
bind -T resize -r l resize-pane -R 5
set -g set-titles "on"
set -g set-titles-string "[#h:#S] #W"
set -g automatic-rename on
set -g automatic-rename-format "#T"
# styling, new incompatible format
set -g pane-border-status "off" set -g pane-border-status "off"
set -g pane-border-style "fg=colour11" set -g pane-border-style "fg=colour11"
set -g pane-active-border-style "fg=colour4" set -g pane-active-border-style "fg=colour4"
set -g message-style "bg=colour4,fg=colour7"
set -g message-command-style "bg=colour1,fg=colour7"
set -g status on set -g status on
set -g status-style "bg=colour7,fg=colour11" set -g status-style "bg=default,fg=default"
set -g status-format[0] "#[fg=colour15,bg=colour4] #h #[fg=colour15,bg=colour14] #S #[default]#{W: #I:#W ,#[reverse] #I:#W #[default]}#[align=right]#[fg=colour15,bg=colour14] %a %e #[fg=colour7,bg=colour11] %k:%M " set -g status-format[0] "#[bg=colour4,fg=colour7] #h[#S] #[default]#{W: #I:#W ,#[reverse] #I:#W #[default]}#[align=right]#[fg=colour7,bg=colour2] %a %e %k:%M "
set -g status-interval 2 set -g status-interval 2
set -g status-position "bottom" set -g status-position "bottom"
set -g status-justify "left" set -g status-justify "left"
set -g status-left-length "100" set -g status-left-length "100"
set -g status-right-length "100" set -g status-right-length "100"
set -g automatic-rename on
set -g automatic-rename-format "#T"

31
zshrc
View file

@ -83,7 +83,7 @@ PROMPT3='%k%f[ ?# ] '
PROMPT4='%k%f[ +%N:%i ] ' PROMPT4='%k%f[ +%N:%i ] '
precmd.title() { precmd.title() {
case $TERM in case $TERM in
(screen*) printf '\033k%s\033\' ${HOST%%.*};; (screen*) printf '\033k%s\033\\' ${HOST%%.*};;
(*) printf '\033]2;%s\007' ${HOST%%.*};; (*) printf '\033]2;%s\007' ${HOST%%.*};;
esac esac
} }
@ -182,8 +182,18 @@ rscreen() { command screen -Dr }
scr() { command screen sudo -Es } scr() { command screen sudo -Es }
# vim # vim
vi() { $(whence -p nvim || whence -p vim || return 1) $@ } vi() { command vim $@ }
vim() { vi $@ }
# package management
if [[ -x $(whence -p paru) ]]; then
pacman() { command paru $@ }
yay() { pacman $@ }
fi
# because old servers don't have new termcap dbs :<
if [[ -x $(whence -p termcompat) ]]; then
ssh() { command termcompat ssh $@ }
fi
# }}} # }}}
# {{{ plugins # {{{ plugins
# grc # grc
@ -198,15 +208,12 @@ if [[ -x $(whence -p grc) ]]; then
unset cmds cmd unset cmds cmd
fi fi
# some cool git stuff # some cool git stuff
gdiff() { /usr/bin/git diff --color $@; } gdiff() { command git diff --color $@; }
gdf() { if [[ -x $(whence -p diff-so-fancy) ]]; then
typeset difftool gdf() { gdiff $@ | command diff-so-fancy | command less --tabs=4 -RSFX }
if difftool=$(whence -p diff-so-fancy); then else
gdiff $@ | $difftool | less --tabs=4 -RSFX gdf() { gdiff $@ }
else fi
gdiff $@
fi
}
greset() { greset() {
echo "OK to reset and clean teh repo?" echo "OK to reset and clean teh repo?"
read -sq _ read -sq _