.yashrc (2339B)
1 #!/bin/yash 2 3 [ -f $HOME/.profile ] && . $HOME/.profile 4 5 HISTFILE=~/.yash_history 6 HISTSIZE=65536 7 8 set --brace-expand 9 set --extended-glob 10 set --no-clobber 11 set --no-unset 12 set --hist-space 13 set --notify-le 14 set --le-no-conv-meta 15 set --le-predict 16 set --vi 17 18 bindkey --vi-insert '\^D' eof-or-delete 19 bindkey --vi-insert '\#' eof-or-delete 20 bindkey --vi-insert '\^F' forward-char 21 bindkey --vi-insert '\^K' forward-kill-line 22 bindkey --vi-insert '\^N' beginning-search-forward 23 bindkey --vi-insert '\^O' clear-candidates 24 bindkey --vi-insert '\^P' beginning-search-backward 25 bindkey --vi-insert '\^U' backward-kill-line 26 bindkey --vi-insert '\$' backward-kill-line 27 bindkey --vi-insert '\^W' backward-delete-viword 28 bindkey --vi-insert '\^Y' put-left 29 bindkey --vi-insert '\^_' accept-prediction 30 bindkey --vi-insert '\^L' forward-bigword 31 bindkey --vi-command '\^N' beginning-search-forward 32 bindkey --vi-command '\^P' beginning-search-backward 33 34 # ensure job control works as expected 35 case $- in (*m*) 36 trap - TSTP TTIN TTOU 37 esac 38 39 # emulate bash's $SHLVL 40 if [ "${_old_shlvl+set}" != set ]; then 41 _old_shlvl=${SHLVL-} 42 fi 43 SHLVL=$((_old_shlvl+1)) 2>/dev/null || SHLVL=1 44 export SHLVL 45 46 # initialize event handlers 47 COMMAND_NOT_FOUND_HANDLER=() 48 PROMPT_COMMAND=() 49 YASH_AFTER_CD=() 50 51 ## define prompt 52 : ${LOGNAME:=$(logname)} ${HOSTNAME:=$(uname -n)} 53 if [ -n "${SSH_CONNECTION-}" ]; then 54 _hc='\fy.' # yellow hostname for SSH remote 55 else 56 _hc='\fg.' # green hostname for local 57 fi 58 if [ "$(id -u)" -eq 0 ]; then 59 _uc='\fr.' # red username for root 60 _2c='\fr.' # red PS2 for root 61 elif [ "$(id -un)" = "ad" ]; then 62 _uc='\fg.' # green username 63 _2c= # PS2 in normal color for non-root user 64 else 65 _uc='\fy.' 66 _2c= # PS2 in normal color for non-root user 67 fi 68 # The main prompt ($YASH_PS1) contains the username, hostname, working 69 # directory, last exit status (only if non-zero), and $SHLVL (only if 70 # non-one). 71 YASH_PS1=$_uc'${LOGNAME}'$_hc'@${HOSTNAME%%.*}\fd. '\ 72 '\fb.${${${PWD:/~/\~}/$HOME/\~}:-$PWD}\fd. ${{?:/0/}:+\\fr.$?\\fd. }${{SHLVL-0}:/1}\$ ' 73 #YASH_PS1R='\fc.${_vcs_info}' 74 #YASH_PS1R='\fb.${PWD}' 75 YASH_PS1S='\fo.' 76 YASH_PS2=$_2c'> ' 77 #YASH_PS2R= 78 YASH_PS2S=$YASH_PS1S 79 YASH_PS4='\fm.+ ' 80 YASH_PS4S='\fmo.' 81 unset _hc _uc _2c 82 # No escape sequences allowed in the POSIXly-correct mode. 83 PS1='${LOGNAME}@${HOSTNAME%%.*} '$PS1