From 1b67396957fc2337d4417c551349a922e5d6369a Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sun, 30 Nov 2008 22:01:57 -0600 Subject: [PATCH 1/6] various changes of various flavors --- Xresources | 3 +++ vimrc | 16 ++++++++-------- zshrc | 24 ++++++++++++++++++------ 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/Xresources b/Xresources index 5f4566d..c7557d7 100644 --- a/Xresources +++ b/Xresources @@ -88,3 +88,6 @@ URxvt*color12: #729FCF URxvt*color13: #AD7FA8 URxvt*color14: #34E2E2 URxvt*color15: #EEEEEC + +/* Rxvt */ +Rxvt*termName: rxvt diff --git a/vimrc b/vimrc index 2e5b7c7..04c3a7f 100644 --- a/vimrc +++ b/vimrc @@ -274,18 +274,18 @@ imap :silent set number! " Don't force column 0 for # inoremap # X# -" Force to be backspace except when in interix mode -" because interix uses that for forward delete... -" and always accept as a backspace key -" Let interix use ^[[U for end and ^[[H for home +" Always map to backspace +" Both interix and cons use C-? as forward delete, +" besides those two exceptions, always set it to backspace +" Also let interix use ^[[U for end and ^[[H for home map map! -if (&term !~ "interix") - map - map! -else +if (&term =~ "interix") map  map  +elseif (&term !~ "cons") + map + map! endif " Python specific stuff diff --git a/zshrc b/zshrc index a2b3659..82b1ba5 100644 --- a/zshrc +++ b/zshrc @@ -86,19 +86,25 @@ export LESS=' -R' # aliases alias cd..='cd ..' +# handles per OS aliases, fixes a few terms case `uname -s` in Linux|CYGWIN*) alias ls="ls -h --color=auto" alias grep='grep -d skip --color=auto' ;; FreeBSD|Darwin|DragonFly) - # we must lie to the mac, for it is dumb export LSCOLORS=ExGxFxDxCxDxDxHbaDacec alias ls="ls -Gh" alias grep='grep -d skip --color=auto' ;; Interix) alias ls="ls --color" + + # sorta hacky, but I cannot find a better way to do this :/ + if [[ `which infocmp` = /usr/local/bin/infocmp ]] ; then + export TERMINFO=/usr/local/share/terminfo + export TERM=$TERM + fi ;; SunOS) if (which gls &> /dev/null) ; then @@ -169,6 +175,10 @@ case $TERM in bindkey '^[[5D' emacs-backward-word bindkey '^[OC' emacs-forward-word bindkey '^[OD' emacs-backward-word + bindkey '^[Oc' emacs-forward-word + bindkey '^[Od' emacs-backward-word + bindkey '^[[c' emacs-forward-word + bindkey '^[[d' emacs-backward-word ;; linux) bindkey '^[[1~' beginning-of-line @@ -184,11 +194,17 @@ case $TERM in bindkey '^[[7~' beginning-of-line bindkey '^[[8~' end-of-line ;; + cons*) + bindkey '^[[H' beginning-of-line + bindkey '^[[F' end-of-line + bindkey '^?' delete-char + ;; interix) bindkey '^[[H' beginning-of-line bindkey '^[[U' end-of-line + bindkey '^?' delete-char ;; - cygwin) + cygwin*) bindkey '^[[1~' beginning-of-line bindkey '^[[4~' end-of-line ;; @@ -208,9 +224,6 @@ precmd() { local termtitle - ## Changing IFS breaks a few things otherwise, especially clear-zle-screen - IFS=$' \t\n' - termtitle=$(print -P "%n@%m") title zsh "$termtitle" } @@ -267,7 +280,6 @@ function title # Use these two for GNU Screen: print -nR $'\ek'$1$'\e'"\\" shift -# print -nR $'\e]0;'$*$'\a' print -nR $'\e_screen \005 | '$*$'\e'"\\" ;; xterm*|rxvt*|cygwin|interix) From a3de9e653034a5d7ef099ac53cbc6dac3e91e30c Mon Sep 17 00:00:00 2001 From: David Alexander Majnemer Date: Tue, 2 Dec 2008 23:28:52 -0600 Subject: [PATCH 2/6] add more rxvt support --- vimrc | 3 --- zshrc | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vimrc b/vimrc index 2e5b7c7..1fd58f1 100644 --- a/vimrc +++ b/vimrc @@ -131,9 +131,6 @@ if has('eval') elseif &t_Co == 256 set background=light " We use a light background here call LoadColorScheme("wombat:inkpot") " Set the colorscheme - elseif &t_Co == 88 - set background=dark " We use a dark background here - call LoadColorScheme("inkpot:zellner") " Set the colorscheme else set background=dark " We use a dark background here call LoadColorScheme("zellner") " Set the colorscheme diff --git a/zshrc b/zshrc index d8d07d5..d886923 100644 --- a/zshrc +++ b/zshrc @@ -73,6 +73,9 @@ if (which infocmp &> /dev/null) ; then xterm*) ( infocmp $TERM &> /dev/null ) || export TERM=xterm ;; + rxvt*) + ( infocmp $TERM &> /dev/null ) || export TERM=rxvt + ;; esac fi From 3226d4f06bf36dd3d6e9bc506e927fd0a740b32f Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Wed, 3 Dec 2008 02:47:37 -0600 Subject: [PATCH 3/6] nice implementation of terminal fallback --- zshrc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/zshrc b/zshrc index 788e383..c1f5e0d 100644 --- a/zshrc +++ b/zshrc @@ -68,16 +68,28 @@ elif ( which gdircolors &> /dev/null ) ; then fi # terminal fallback stuff -if (which infocmp &> /dev/null) ; then - case "${TERM}" in +function fix_term +{ + case "$1" in + xterm) + ( ( infocmp $1 &> /dev/null ) && echo "xterm" ) || echo "vt100" + ;; + rxvt) + ( ( infocmp $1 &> /dev/null ) && echo "rxvt" ) || fix_term xterm + ;; xterm*) - ( infocmp $TERM &> /dev/null ) || export TERM=xterm + ( ( infocmp $1 &> /dev/null ) && echo $1 ) || fix_term xterm ;; rxvt*) - ( infocmp $TERM &> /dev/null ) || export TERM=rxvt + ( ( infocmp $1 &> /dev/null ) && echo $1 ) || fix_term rxvt + ;; + *) + ( ( infocmp $1 &> /dev/null ) && echo $1 ) || echo "vt100" ;; esac -fi +} + +export TERM=$(fix_term $TERM) ( which lesspipe &> /dev/null ) && eval $(lesspipe) export LESS=' -R' From 383fcaa867d4a5d230b44c055a3128b5d0599433 Mon Sep 17 00:00:00 2001 From: dave Date: Thu, 4 Dec 2008 00:49:06 -0600 Subject: [PATCH 4/6] cleanup zshrc, add support for screen --- screenrc | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ zshrc | 32 +++++++++++++++++++--------- 2 files changed, 86 insertions(+), 10 deletions(-) create mode 100644 screenrc diff --git a/screenrc b/screenrc new file mode 100644 index 0000000..7fb3896 --- /dev/null +++ b/screenrc @@ -0,0 +1,64 @@ +# Originally by Deason +# Modified by Majnematic + +# turn on visual bell +vbell on + +# default scrollback to 5000 lines +defscrollback 5000 + +# turn off visual bell +termcapinfo * vb@ + +# see, it's a bell, get it? +vbell_msg "Ring Ring Ring Ring Ring Ring" + +# make screen even more fun +nethack on + +# mess with bold +attrcolor b ".I" + +# get screen to go for 256 colors +termcapinfo xterm-256color 'Co#256' + +# erase background with current bg color +defbce on + +# turn on utf8 +defutf8 on + +# set the term to 256 color, maybe +term "screen${SCREEN_COLOR}-bce" + +# changes from the default binding " to `windowlist -b', so we don't create +# a new empty window +bind \" windowlist + +# includes window title name in activity/bell messages +activity "Activity in window %n (%t)" +bell_msg "Bell in window %n (%t)" + +# Argh, choosing a hardstatus line is difficult +# This can only be explained by example, but it takes too much damn space. +# The screen man page is actually good documentation for this, but it takes +# a little while to read. Look for "STRING ESCAPES', and that section will +# explain what all this line noise means. +# +# White background, black text, underlined bold current window +#hardstatus alwayslastline "%{= Wk}%-w%50>%{=ub dd}%n %t%?(%u)%?%{-}%+w%<" +# Normal text, underlined bold current window +#hardstatus alwayslastline "%{= dd}%-w%50>%{=ub}%n %t%?(%u)%?%{-}%+w%<" +# Blue background, white text, underlined bold current window +hardstatus alwayslastline "%{= bw}%-w%50>%{=ub dd}%n %t%?(%u)%?%{-}%+w%<" + +startup_message off + +# Show the screen version just for a second +msgwait 1 +version + +# how many seconds a message appears when we don't press any keys +msgwait 2 + +altscreen on diff --git a/zshrc b/zshrc index c1f5e0d..d7af1b8 100644 --- a/zshrc +++ b/zshrc @@ -89,8 +89,21 @@ function fix_term esac } +# sorta hacky, but I cannot find a better way to do this :/ +function fix_terminfo_db +{ + if [[ `which infocmp` = "$1/bin/infocmp" ]] ; then + export TERMINFO="$1/share/terminfo" + export TERM=$TERM + fi +} + export TERM=$(fix_term $TERM) +if [[ $TERM == *256* ]] ; then + export SCREEN_COLOR="-256color" +fi + ( which lesspipe &> /dev/null ) && eval $(lesspipe) export LESS=' -R' @@ -117,11 +130,7 @@ case `uname -s` in Interix) alias ls="ls --color" - # sorta hacky, but I cannot find a better way to do this :/ - if [[ `which infocmp` = /usr/local/bin/infocmp ]] ; then - export TERMINFO=/usr/local/share/terminfo - export TERM=$TERM - fi + fix_terminfo_db "/usr/local" ;; SunOS) if (which gls &> /dev/null) ; then @@ -140,11 +149,7 @@ case `uname -s` in alias locate='glocate' fi - # sorta hacky, but I cannot find a better way to do this :/ - if [[ `which infocmp` = /opt/csw/bin/infocmp ]] ; then - export TERMINFO=/opt/csw/share/terminfo - export TERM=$TERM - fi + fix_terminfo_db "/opt/csw" ;; esac @@ -197,6 +202,13 @@ case $TERM in bindkey '\e[c' emacs-forward-word bindkey '\e[d' emacs-backward-word ;; + screen*) + bindkey '\e[1~' beginning-of-line + bindkey '\e[4~' end-of-line + bindkey '\e[1;5C' emacs-forward-word + bindkey '\e[1;5D' emacs-backward-word + bindkey '\e[3~' delete-char + ;; linux) bindkey '\e[1~' beginning-of-line bindkey '\e[4~' end-of-line From e2356a5696e827d3fa0392240c5ae51f70cd446e Mon Sep 17 00:00:00 2001 From: dave Date: Thu, 4 Dec 2008 00:56:42 -0600 Subject: [PATCH 5/6] more complete screen support --- zshrc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/zshrc b/zshrc index d7af1b8..7d13972 100644 --- a/zshrc +++ b/zshrc @@ -72,10 +72,13 @@ function fix_term { case "$1" in xterm) - ( ( infocmp $1 &> /dev/null ) && echo "xterm" ) || echo "vt100" + ( ( infocmp $1 &> /dev/null ) && echo $1 ) || echo "vt100" ;; rxvt) - ( ( infocmp $1 &> /dev/null ) && echo "rxvt" ) || fix_term xterm + ( ( infocmp $1 &> /dev/null ) && echo $1 ) || fix_term xterm + ;; + screen) + ( ( infocmp $1 &> /dev/null ) && echo $1 ) || echo "vt100" ;; xterm*) ( ( infocmp $1 &> /dev/null ) && echo $1 ) || fix_term xterm @@ -83,6 +86,12 @@ function fix_term rxvt*) ( ( infocmp $1 &> /dev/null ) && echo $1 ) || fix_term rxvt ;; + screen-256color-bce) + ( ( infocmp $1 &> /dev/null ) && echo $1 ) || fix_term screen-256color + ;; + screen*) + ( ( infocmp $1 &> /dev/null ) && echo $1 ) || fix_term screen + ;; *) ( ( infocmp $1 &> /dev/null ) && echo $1 ) || echo "vt100" ;; From 92d24da06a6e8278d8d6ea1a65fd714d3feb1726 Mon Sep 17 00:00:00 2001 From: dave Date: Thu, 4 Dec 2008 01:04:13 -0600 Subject: [PATCH 6/6] cleaned it up even further --- zshrc | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/zshrc b/zshrc index 7d13972..8cae06c 100644 --- a/zshrc +++ b/zshrc @@ -71,24 +71,15 @@ fi function fix_term { case "$1" in - xterm) + xterm|screen) ( ( infocmp $1 &> /dev/null ) && echo $1 ) || echo "vt100" ;; - rxvt) - ( ( infocmp $1 &> /dev/null ) && echo $1 ) || fix_term xterm - ;; - screen) - ( ( infocmp $1 &> /dev/null ) && echo $1 ) || echo "vt100" - ;; - xterm*) + rxvt|xterm*) ( ( infocmp $1 &> /dev/null ) && echo $1 ) || fix_term xterm ;; rxvt*) ( ( infocmp $1 &> /dev/null ) && echo $1 ) || fix_term rxvt ;; - screen-256color-bce) - ( ( infocmp $1 &> /dev/null ) && echo $1 ) || fix_term screen-256color - ;; screen*) ( ( infocmp $1 &> /dev/null ) && echo $1 ) || fix_term screen ;;