initial commit
This commit is contained in:
59
.config/yash/rc
Normal file
59
.config/yash/rc
Normal file
@@ -0,0 +1,59 @@
|
||||
# enable bash-like extended expansion
|
||||
set --brace-expand
|
||||
|
||||
# enable completion of hidden files
|
||||
set --dot-glob
|
||||
|
||||
# enable recursive pathname expansion
|
||||
set --extended-glob
|
||||
|
||||
# don't implicitly expand non-existent variables to empty strings
|
||||
set --no-unset
|
||||
|
||||
# don't save commands starting with a space in history
|
||||
set --hist-space
|
||||
|
||||
# emacs bindings
|
||||
set --emacs
|
||||
|
||||
# Load aliases
|
||||
[ -f "$HOME/.config/yash/aliasrc" ] && . "$HOME/.config/yash/aliasrc"
|
||||
|
||||
# define some basic variables if missing
|
||||
SHELL=$(command -v yash)
|
||||
: ${PAGER:=less} ${EDITOR:=nvim}
|
||||
: ${LOGNAME:=$(logname)} ${HOSTNAME:=$(uname -n)}
|
||||
|
||||
# variables needed for command history
|
||||
if ! [ "${HISTFILE-}" ]; then
|
||||
HISTFILE=$HOME/.local/state/yash/history
|
||||
fi
|
||||
|
||||
# create HISTFILE parent directory if missing
|
||||
! [ -d "${HISTFILE%/*}" ] && mkdir -p "${HISTFILE%/*}"
|
||||
|
||||
HISTSIZE=5000
|
||||
|
||||
# initialize event handlers
|
||||
COMMAND_NOT_FOUND_HANDLER=()
|
||||
PROMPT_COMMAND=()
|
||||
POST_PROMPT_COMMAND=()
|
||||
YASH_AFTER_CD=()
|
||||
|
||||
YASH_PS1='\fg.$(whoami)\fc. ${PWD/#$HOME/\~} \fD.\$ '
|
||||
|
||||
# when a directory name is entered as a command, treat as "cd"
|
||||
_autocd()
|
||||
if [ -d "$1" ]; then
|
||||
HANDLED=true
|
||||
cd -- "$@"
|
||||
break -i
|
||||
fi
|
||||
COMMAND_NOT_FOUND_HANDLER=("$COMMAND_NOT_FOUND_HANDLER" '_autocd "$@"')
|
||||
|
||||
# print file type when executing non-executable files
|
||||
_file_type()
|
||||
if [ -e "$1" ] && ! [ -d "$1" ]; then
|
||||
file -- "$1"
|
||||
fi
|
||||
COMMAND_NOT_FOUND_HANDLER=("$COMMAND_NOT_FOUND_HANDLER" '_file_type "$@"')
|
||||
Reference in New Issue
Block a user