Getting tab copy and paste right with rxvt-unicode option

I  have always liked xterm, but moved to rxvt years ago for a couple of its features.  Recently I moved to urxvt256c for all my terminal needs.
When I use the AWS cli tools, which output tabs as whitespace, my double click selection has started including the tabs.  Maybe it has done this for a while, I don't know exactly when it started, but it is annoying since a double click selection which grabs a tab can screw up a command line paste if there is 1 file in the directory.
So you get:
ssh $(i2ip thisisthe1localfile.txt i-1234567)
instead of
ssh $(i2ip i-1234567)
thanks to bash's autocomplete.
After some googling I found what I should have found originally:
https://github.com/jhelwig/rxvt-unicode-ppa/blob/master/doc/rxvt.1.pod
-ptab|+ptabIf enabled (default), "Horizontal Tab" characters are being stored as actual wide characters in the screen buffer, which makes it possible to select and paste them. Since a horizontal tab is a cursor movement and not an actual glyph, this can sometimes be visually annoying as the cursor on a tab character is displayed as a wide cursor; resource pastableTabs.
adding +ptab seems to have fixed it.
Now my urxvt start script looks like this:
#!/bin/bash
#
cd || ( echo "can't cd to ${HOME}" > /dev/console; exit 127)
COLOR[0]=cyan
COLOR[1]=green
COLOR[2]=orange
COLOR[3]=red
COLOR[4]=white
COLOR[5]=yellow
COLOR[6]=lightskyblue
COLOR[7]=#B94949
COLOR[8]=#FDCB54
COLOR[9]=mistyrose
COLOR[10]=GhostWhite
COLOR[11]=khaki
COLOR[12]=SlateGray
COLOR[13]=mediumaquamarine
COLOR[14]=#7459C5
COLOR[15]=violet
COLOR[16]=orangered
COLOR[17]=cornsilk
COLOR[18]=gold
COLOR[19]=LightSlateGrey
#
XBINS=/usr/bin
BINNAME=urxvt256c
#
GEOMETRY=${GEOMETRY:-95x25}
LINEBUFFER=${LINEBUFFER:-2000}
CURSORCOLOR=${CURSORCOLOR:-red}
#
TERMCOLOR="`echo "\`date '+%S'\`%20"  | bc`"
if [ ${TERMNAME:-foo} = "foo" ]; then
        DATE="`date '+%H:%M:%S'`"
        TERMNAME="${COLOR[${TERMCOLOR:-0}]:-white}-${DATE:-0}"
fi

for DIR in ${XBINS} ; do

        if [ -x "${DIR}/${BINNAME}" ]; then
                cd
                ${DIR}/${BINNAME}                      \
                  -sl ${LINEBUFFER}                    \
                  -cr ${CURSORCOLOR}                   \
                  -bg black                            \
                  -geometry ${GEOMETRY}                \
                  -fg ${COLOR[${TERMCOLOR:-0}]:-white} \
                  -n "${TERMNAME}"                     \
                  -T "${TERMNAME}"                     \
                  -fn 6x13                             \
                  -fb 6x13bold                         \
                  -tn rxvt                             \
                  +ptab                                \
                  -e bash &
        fi
done
exit $?

Comments

Popular posts from this blog

Xubuntu Home Server on Dell XPS 13 9370

Cygwin + syslog-ng

Installing Fedora 21 on a (late 2014) Mac Mini