From adeeeb95de76b392e5a221fb4f450207da501876 Mon Sep 17 00:00:00 2001 From: Von Random Date: Thu, 28 Jun 2018 19:58:52 +0300 Subject: [PATCH] window titles for tmux --- bashrc | 16 +++++++--------- vimrc | 8 +++++++- zshrc | 4 ++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bashrc b/bashrc index 7ccfec2..0f7339a 100644 --- a/bashrc +++ b/bashrc @@ -21,35 +21,33 @@ for color in \ gray6 red green yellow blue magenta cyan gray1 \ black orange gray5 gray4 gray3 purple gray2 white do - eval "p${color}='\[\e[38;5;${color_number}m\]'" - eval "${color}='\e[38;5;${color_number}m'" + eval "p${color}='\\[\\e[38;5;${color_number}m\\]'" + eval "${color}='\\e[38;5;${color_number}m'" (( color_number++ )) done unset color_number preset='\[\e[0m\]' -pbold='\[\e[1m\]' reset='\e[0m' -bold='\e[1m' prompt_command() { case ${TERM} in rxvt*|st*|xterm*) - printf "\033]0;%s\007" "${HOSTNAME%%.*}" + printf '\033]0;%s\007' "${HOSTNAME%%.*}" ;; screen*|tmux*) - printf "\033k%s\033\\" "${HOSTNAME%%.*}" + printf '\033k%s\033\' "${HOSTNAME%%.*}" ;; esac if ((UID)); then - prompt_user="${pblack}\u${preset} " + prompt_user="${pblack}\\u${preset} " bang="${pblack}>${preset}" else - prompt_user="${pred}\u${preset} " + prompt_user="${pred}\\u${preset} " bang="${pred}>${preset}" fi ps_line1="[ bash-$BASH_VERSINFO | ${prompt_user}${HOSTNAME}:${pblack}$(pwd)${preset} ]" ps_line2="${bang} " - PS1="${ps_line1}\n${ps_line2}" + PS1="${ps_line1}\\n${ps_line2}" } PROMPT_COMMAND=prompt_command # }}} diff --git a/vimrc b/vimrc index 4f65cfc..93dfc43 100644 --- a/vimrc +++ b/vimrc @@ -12,9 +12,10 @@ set noerrorbells visualbell t_vb= set tabstop=3 softtabstop=4 shiftwidth=4 smarttab expandtab " termcap fixes 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 statusline=[%F]\ %R%H%W%M\ %=[%{&fenc}/%{&ff}]\ %y\ [%4l/%L:%3v] +set title titlestring=[%{hostname()}]\ %t\ -\ vim " enable case indentation let g:sh_indent_case_labels=1 " version specific settings @@ -52,6 +53,11 @@ noremap q nnoremap q :q nnoremap s :w +if $TERM =~ '^\(screen\|tmux\)' + set t_ts=k + set t_fs=\ +endif + if v:version >= 800 set breakindent diff --git a/zshrc b/zshrc index c70c082..45322dc 100644 --- a/zshrc +++ b/zshrc @@ -76,10 +76,10 @@ PROMPT4='%b%f+%N:%i%(!.%F{red}.%F{black})>%f%b ' precmd.title() { case $TERM in st*|xterm*|rxvt*) - printf "\033]0;%s\007" ${HOST%%.*} + printf '\033]0;%s\007' ${HOST%%.*} ;; screen*|tmux*) - printf "\033k%s\033\\" ${HOST%%.*} + printf '\033k%s\033\' ${HOST%%.*} ;; esac }