term != "screen"

screenでvimがこける。

% echo $TERM
xterm-color
% screen
% echo $TERM
vt100
% vi
E437: terminal capability "cm" required
Press ENTER or type command to continue

なので



~/.screenrc

term    ansi


~/.vimrc

" if &term =~ "screen"
if &term !~ "xterm-color"
  autocmd BufEnter * if bufname("") !~ "^?[A-Za-z0-9?]*://" | silent! exe '!echo -n "^[k[`basename %`]^[??"' | endif
  autocmd VimLeave * silent! exe '!echo -n "^[k`dirs`^[??"'
endif


~/.zshrc

## カレントディレクトリをコマンドステータス行に
# if [[ "$TERM" = "screen" ]]; then
if [[ "$TERM" != "xterm-color" ]]; then
    precmd() {
        print -nP '?ek%24<*<%~%<<?e??'
    }
fi

## 最後に打ったコマンドステータス行に
#if [ "$TERM" = "screen" ]; then
if [ "$TERM" != "xterm-color" ]; then
 preexec() {
   # see [zsh-workers:13180]
   # http://www.zsh.org/mla/workers/2000/msg03993.html
   emulate -L zsh
   local -a cmd; cmd=(${(z)2})
   echo -n "^[k$cmd[1]:t^[??"
 }
fi

適当


^[は制御文字(ctl + v + esc)