]> git.phdru.name Git - dotfiles.git/blobdiff - .profile
.profile: remove options -F and -X from LESS
[dotfiles.git] / .profile
index 9a88f80445d5de506b6c8ba253dc70d04a7532b1..0e3ffdd34fb2e413fa64487bb00306e04914b6b7 100644 (file)
--- a/.profile
+++ b/.profile
@@ -17,7 +17,7 @@ fi
 
 ### umask sets a mask for the default file permissions,
 ### umask 022 is less restrictive, 077 more paranoid
-umask 027
+umask 077
 
 PATH="$HOME"/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
 MANPATH="$HOME"/man:/usr/local/man:/usr/share/man:/usr/man
@@ -60,31 +60,47 @@ if [ -t 0 ] ; then
 
    stty sane erase ^H
 
+   if [ -n "`which less 2>/dev/null`" ]; then
+      HAS_LESS=true
+   fi
+
    case "$TERM" in
       linux)
-         # mutt, vim and python
+         # mutt, python and vim
          BACKGROUND=DARK
          export BACKGROUND
+         [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/dark_bg
       ;;
 
-      *term*|*rxvt*|vt100|screen*)
+      *rxvt*|screen*|*term*|vt100)
          BACKGROUND=LIGHT
          export BACKGROUND
+         [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/light_bg
       ;;
    esac
 
-   PAGER=less
-   LESS="-gimq"
-   case "$LC_CTYPE" in
-      *UTF-8) LESSCHARSET=utf-8
-      ;;
+   if [ -x /usr/bin/dircolors ]; then
+       test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
+   fi
 
-      *) LESSCHARSET=koi8-r
-      ;;
-   esac
-   #LESSCHARDEF=32c.
-   LESSEDIT='vim ?lm+%lm -- %f'
-   export PAGER LESS LESSCHARSET LESSEDIT # LESSCHARDEF
+   if [ -n "$HAS_LESS" ]; then
+      PAGER=less
+      LESS="Rgimq"
+      case "$LC_CTYPE" in
+         *UTF-8) LESSCHARSET=utf-8
+         ;;
+
+         *) LESSCHARSET=koi8-r
+         ;;
+      esac
+      #LESSCHARDEF=32c.
+      LESSEDIT='vim ?lt+%lt. -- %f'
+      export LESS LESSCHARSET LESSEDIT # LESSCHARDEF
+
+   else
+      PAGER=more
+   fi
+   export PAGER
 
    EDITOR="$HOME"/.vim/vim.sh
    VISUAL="$EDITOR"
@@ -111,7 +127,7 @@ if [ -t 0 ] ; then
 
    BROWSER="links2:links:elinks:w3m:lynx"
    case "$TERM" in
-      *term*|*rxvt*|vt100|screen*)
+      *rxvt*|screen*|*term*|vt100)
          BROWSER="l:$BROWSER"
       ;;
    esac
@@ -133,7 +149,24 @@ if [ -t 0 ] ; then
    case "$SHELL" in
       */bash)
          shopt -s checkwinsize
-         OPS1='\u@\h '
+         # display the user, host and current working directory
+         # in the terminal title
+         case "$TERM" in
+            *rxvt*|screen*|*term*|vt100)
+               OPS1="\[\033]0;\u@\h:\w\007\]"
+               case "$TERM" in
+                  screen*)
+                     OPS1=${OPS1}"\[\033k\u@\h:\w\033\\\\\]" # Set screen/tmux caption
+                  ;;
+               esac
+            ;;
+
+            *)
+               OPS1=""
+            ;;
+         esac
+
+         OPS1=${OPS1}"\u@\h \W "
          . "$ENV"
          ;;
       *)
@@ -141,16 +174,8 @@ if [ -t 0 ] ; then
          ;;
    esac
 
-   export OPS1
-
-   case "$TERM" in
-      *term*|*rxvt*|vt100|screen*)
-         if [ -x "`which xtitle 2>/dev/null`" ]; then
-            PROMPT_COMMAND=xtitle
-            export PROMPT_COMMAND
-         fi
-      ;;
-   esac
+   #PROMPT_DIRTRIM=2
+   export OPS1 # PROMPT_DIRTRIM
 
    ### biff controls new mail notification
    #biff n
@@ -175,6 +200,10 @@ if [ -t 0 ] ; then
    export HGUSER
 
    unset name email
+
+   if test -f .hushlogin && ! cmp -s .motd /etc/motd; then
+      tee $HOME/.motd < /etc/motd
+   fi
 fi
 
 # No need to set DISPLAY - ssh sets DISPLAY and calls xauth
@@ -182,12 +211,13 @@ fi
 #export DISPLAY
 
 if [ -n "$DISPLAY" ]; then
-   # mutt, vim and python
+   # mutt, python and vim
    BACKGROUND=LIGHT
    export BACKGROUND
+   [ -n "$HAS_LESS" ] && . "$HOME"/lib/config/less/light_bg
 
    # BROWSERs
-   BROWSER="firefox:seamonkey:google-chrome:opera:xlinks2:$BROWSER"
+   BROWSER="firefox:seamonkey:chromium:google-chrome:opera:xlinks2:$BROWSER"
 
    ### X Window System Configuration
    #XAPPLRESDIR="$HOME/lib/X11/app-defaults/"; export XAPPLRESDIR
@@ -214,6 +244,8 @@ if [ -n "$DISPLAY" ]; then
    #export __GL_FSAA_MODE
 fi
 
+[ -n "$HAS_LESS" ] && unset HAS_LESS
+
 #
 # read in usepkg function
 # . "$HOME"/lib/config/usepkg.sh