From 09a20db1f181c249644e4bea2848166acb855edf Mon Sep 17 00:00:00 2001 From: David Alexander Majnemer Date: Wed, 27 Oct 2010 16:20:46 -0500 Subject: [PATCH] [answerback] add suppot to vim/term for putty --- commonsh/02_term | 11 +++++++++-- install.pl | 5 +++++ vimrc | 6 ++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/commonsh/02_term b/commonsh/02_term index 91dd4ff..ce34a9d 100755 --- a/commonsh/02_term +++ b/commonsh/02_term @@ -66,8 +66,15 @@ if command -v infocmp >/dev/null 2>&1 ; then ;; esac - if [ "${COLORTERM}" = "gnome-terminal" ]; then - TERM="xterm-256color" + if [ -n "${COLORTERM}" -o -n "${XTERM_VERSION}" -o -n "${TERM_PROGRAM}" ]; then + if [ "${COLORTERM}" = "gnome-terminal" ] ; then + TERM="xterm-256color" + fi + else + if command -v answerback >/dev/null 2>&1 ; then + ANSWERBACK=`answerback` + export ANSWERBACK + fi fi TERM=`fix_term $TERM` diff --git a/install.pl b/install.pl index e3b8aa1..0647de1 100755 --- a/install.pl +++ b/install.pl @@ -84,6 +84,8 @@ my %links = ( 'git-info' => 'bin/git-info', 'git-untrack-ignored' => 'bin/git-untracked-ignored', + answerback => 'bin/answerback', + gdbinit => '.gdbinit', ); @@ -94,6 +96,9 @@ if ($contained) { ($prefix) = $prefix =~ m{^\/? (.+) [^/]+ $}x; } +`make answerback`; +warn "Could not compile answerback.\n" if ($? != 0); + my $i = 0; # Keep track of how many links we added for my $file (keys %links) { # See if this file resides in a directory, and create it if needed. diff --git a/vimrc b/vimrc index c8037c8..90f6f9a 100644 --- a/vimrc +++ b/vimrc @@ -7,8 +7,10 @@ if has('multi_byte') " Make sure we have unicode support scriptencoding utf-8 " This file is in UTF-8 " ---- Terminal Setup ---- - if (&termencoding == "" && (&term =~ "xterm" || &term =~ "putty")) || (&term =~ "rxvt-unicode") || (&term =~ "screen") - set termencoding=utf-8 + if ($ANSWERBACK !=# "PuTTY") + if (&termencoding == "" && (&term =~ "xterm" || &term =~ "putty")) || (&term =~ "rxvt-unicode") || (&term =~ "screen") + set termencoding=utf-8 + endif endif set encoding=utf-8 " Default encoding should always be UTF-8 endif