Shell: Update old TERM code

master
Pierre Neidhardt 2016-10-11 09:23:33 +05:30
parent f3c48de930
commit 40aba20b8c
3 changed files with 25 additions and 23 deletions

View File

@ -33,7 +33,7 @@ mkcd () {
cd "$1" cd "$1"
} }
## Quick search. ## Quick search. More flexible alternative: 'ff -di'.
search () { search () {
find . -iname "*$1*" find . -iname "*$1*"
} }

View File

@ -2,28 +2,18 @@
## Shell configuration ## Shell configuration
## Terminal ## Terminal
## WARNING: this is often a bad idea! ## WARNING: This is often a bad idea!
## FreeBSD urxvt $TERM variable is not set properly for some reasons. ## FreeBSD urxvt $TERM variable is not set properly for some reasons.
if [ ! "$(uname -o)" = "GNU/Linux" ]; then # if [ ! "$(uname -o)" = "GNU/Linux" ]; then
case "$TERM" in # case "$TERM" in
*rxvt*) export TERM="rxvt-unicode-256color";; # *rxvt*) export TERM="rxvt-unicode-256color";;
esac # esac
fi # fi
## Most xterm-based terminals support 256 colors, so let's turn this on. ## Most xterm-based terminals support 256 colors, so let's turn this on.
if [ "$TERM" = "xterm" ]; then # if [ "$TERM" = "xterm" ]; then
export TERM="xterm-256color" # export TERM="xterm-256color"
fi # fi
## Title: If this is an xterm set the title to user@host:dir
## Enable color support of ls.
if [ "$TERM" != "dumb" ] && [ "$OSTYPE" = "linux-gnu" ]; then
eval "$(dircolors "$HOME/.shell.d/dircolorsdb")"
elif [ "$TERM" != "dumb" ]; then
export LSCOLORS="Ex"
# export LSCOLORS="ExfxcxDxCxdxdxCxCxECEh"
fi
## Title
## If this is an xterm set the title to user@host:dir
#case "$TERM" in #case "$TERM" in
#xterm*|rxvt*) #xterm*|rxvt*)
# PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"' # PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
@ -31,3 +21,13 @@ fi
#*) #*)
# ;; # ;;
#esac #esac
## Enable color support of ls.
if [ "$TERM" != "dumb" ]; then
if [ "$OSTYPE" = "linux-gnu" ]; then
eval "$(dircolors "$HOME/.shell.d/dircolorsdb")"
else
export LSCOLORS="Ex"
# export LSCOLORS="ExfxcxDxCxdxdxCxCxECEh"
fi
fi

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
## This file is sourced by some DM and should not contain any desktop execution. ## This file is sourced by some DM and should not contain any desktop execution.
## Internet browsers. They need X to run. ## Internet browsers that need X to run.
for i in qutebrowser dwb luakit chromium google-chrome; do for i in qutebrowser dwb luakit chromium google-chrome; do
command -v $i >/dev/null 2>&1 && export BROWSER=$i && break command -v $i >/dev/null 2>&1 && export BROWSER=$i && break
done done
@ -29,7 +29,9 @@ fi
## This env variable is used by some programs (e.g. ranger, awesome) to get the ## This env variable is used by some programs (e.g. ranger, awesome) to get the
## terminal executable name. ## terminal executable name.
export TERMCMD="urxvt" for i in urxvt xterm; do
command -v $i >/dev/null 2>&1 && export TERMCMD=$i && break
done
## Hook. Should be sourced last. ## Hook. Should be sourced last.
[ -f ~/.xprofile_hook ] && . ~/.xprofile_hook [ -f ~/.xprofile_hook ] && . ~/.xprofile_hook