1
0
Fork 0

window titles for tmux

This commit is contained in:
Von Random 2018-06-28 19:58:52 +03:00
parent 7cfec077c1
commit adeeeb95de
3 changed files with 16 additions and 12 deletions

16
bashrc
View file

@ -21,35 +21,33 @@ for color in \
gray6 red green yellow blue magenta cyan gray1 \ gray6 red green yellow blue magenta cyan gray1 \
black orange gray5 gray4 gray3 purple gray2 white black orange gray5 gray4 gray3 purple gray2 white
do do
eval "p${color}='\[\e[38;5;${color_number}m\]'" eval "p${color}='\\[\\e[38;5;${color_number}m\\]'"
eval "${color}='\e[38;5;${color_number}m'" eval "${color}='\\e[38;5;${color_number}m'"
(( color_number++ )) (( color_number++ ))
done done
unset color_number unset color_number
preset='\[\e[0m\]' preset='\[\e[0m\]'
pbold='\[\e[1m\]'
reset='\e[0m' reset='\e[0m'
bold='\e[1m'
prompt_command() prompt_command()
{ {
case ${TERM} in case ${TERM} in
rxvt*|st*|xterm*) rxvt*|st*|xterm*)
printf "\033]0;%s\007" "${HOSTNAME%%.*}" printf '\033]0;%s\007' "${HOSTNAME%%.*}"
;; ;;
screen*|tmux*) screen*|tmux*)
printf "\033k%s\033\\" "${HOSTNAME%%.*}" printf '\033k%s\033\' "${HOSTNAME%%.*}"
;; ;;
esac esac
if ((UID)); then if ((UID)); then
prompt_user="${pblack}\u${preset} " prompt_user="${pblack}\\u${preset} "
bang="${pblack}>${preset}" bang="${pblack}>${preset}"
else else
prompt_user="${pred}\u${preset} " prompt_user="${pred}\\u${preset} "
bang="${pred}>${preset}" bang="${pred}>${preset}"
fi fi
ps_line1="[ bash-$BASH_VERSINFO | ${prompt_user}${HOSTNAME}:${pblack}$(pwd)${preset} ]" ps_line1="[ bash-$BASH_VERSINFO | ${prompt_user}${HOSTNAME}:${pblack}$(pwd)${preset} ]"
ps_line2="${bang} " ps_line2="${bang} "
PS1="${ps_line1}\n${ps_line2}" PS1="${ps_line1}\\n${ps_line2}"
} }
PROMPT_COMMAND=prompt_command PROMPT_COMMAND=prompt_command
# }}} # }}}

8
vimrc
View file

@ -12,9 +12,10 @@ set noerrorbells visualbell t_vb=
set tabstop=3 softtabstop=4 shiftwidth=4 smarttab expandtab set tabstop=3 softtabstop=4 shiftwidth=4 smarttab expandtab
" termcap fixes " termcap fixes
set t_Co=256 t_ut= termencoding=utf-8 encoding=utf-8 set t_Co=256 t_ut= termencoding=utf-8 encoding=utf-8
" status line " status line and title
set wildmenu showcmd ruler laststatus=2 set wildmenu showcmd ruler laststatus=2
set statusline=[%F]\ %R%H%W%M\ %=[%{&fenc}/%{&ff}]\ %y\ [%4l/%L:%3v] set statusline=[%F]\ %R%H%W%M\ %=[%{&fenc}/%{&ff}]\ %y\ [%4l/%L:%3v]
set title titlestring=[%{hostname()}]\ %t\ -\ vim
" enable case indentation " enable case indentation
let g:sh_indent_case_labels=1 let g:sh_indent_case_labels=1
" version specific settings " version specific settings
@ -52,6 +53,11 @@ noremap q <NOP>
nnoremap <Leader>q :q<CR> nnoremap <Leader>q :q<CR>
nnoremap <Leader>s :w<CR> nnoremap <Leader>s :w<CR>
if $TERM =~ '^\(screen\|tmux\)'
set t_ts=k
set t_fs=\
endif
if v:version >= 800 if v:version >= 800
set breakindent set breakindent

4
zshrc
View file

@ -76,10 +76,10 @@ PROMPT4='%b%f+%N:%i%(!.%F{red}.%F{black})>%f%b '
precmd.title() { precmd.title() {
case $TERM in case $TERM in
st*|xterm*|rxvt*) st*|xterm*|rxvt*)
printf "\033]0;%s\007" ${HOST%%.*} printf '\033]0;%s\007' ${HOST%%.*}
;; ;;
screen*|tmux*) screen*|tmux*)
printf "\033k%s\033\\" ${HOST%%.*} printf '\033k%s\033\' ${HOST%%.*}
;; ;;
esac esac
} }