sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

D1371.bashrc2.sh (835B)


      1 # blerc -*- mode: sh; mode: sh-bash -*-
      2 
      3 # from https://github.com/akinomyoga/ble.sh/issues/60
      4 
      5 blehook PRECMD+=__prompt_command
      6 ansi[blue=4]=$'\e[34m'
      7 ansi[yellow=3]=$'\e[33m'
      8 
      9 abbreviate_path() { ble/util/put "${1##*/}"; }
     10 __prompt_command() {
     11   local _exit="$?"             # This needs to be first
     12   local _logo=
     13 
     14   local _last_command="$(fc -l -1)"
     15 
     16   if [ $_exit -ne 0 ] && [[ "$_exit_notified_for" != "${_last_command}" ]]; then
     17     _logo="𐔴"
     18     _exit_notified_for="${_last_command}"
     19   fi
     20 
     21   bleopt prompt_rps1=
     22   bind 'set show-mode-in-prompt on'
     23   bind "set vi-ins-mode-string \"\1\e[6 q\2${_logo}${ansi[blue]}$(abbreviate_path "$PWD")${ansi[yellow]}→${ansi[yellow]}\""
     24   bind "set vi-cmd-mode-string \"\1\e[2 q\2${_logo}${ansi[blue]}$(abbreviate_path "$PWD")${ansi[blue]}:${ansi[yellow]}\""
     25   
     26   PS1=" "
     27   PS2="... "
     28 }