linux-qubasis
linux oasis port as a qubes template
git clone https://9o.is/git/linux-qubasis.git
commit 014eda514915d93a6e4df2d083e207a573e1667a parent afdf33c6a9f3100dfbcd603680d9e41b411e6c61 Author: Jul <jul@9o.is> Date: Thu, 17 Jul 2025 20:50:48 -0400 add user yash config Diffstat:
| M | pkg/yash/build | | | 7 | ++++++- |
| A | pkg/yash/config/00-general | | | 148 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | pkg/yash/config/rc | | | 13 | +++++++++++++ |
3 files changed, 167 insertions(+), 1 deletion(-)
diff --git a/pkg/yash/build b/pkg/yash/build @@ -5,10 +5,11 @@ # asciidoc repodir="$srcdir/repo" +configdir="$outdir/home/user/.config/yash" ( cd $repodir - ./configure --prefix= + ./configure --prefix=/usr ) rm -rf "$outdir" @@ -16,3 +17,7 @@ cp "$srcdir/config.h" "$repodir" make -C "$repodir" make DESTDIR="$outdir" -C "$repodir" install + +mkdir -p "$configdir/rc.d" +cp "$srcdir/config/rc" "$configdir" +cp "$srcdir/config/00-general" "$configdir/rc.d" diff --git a/pkg/yash/config/00-general b/pkg/yash/config/00-general @@ -0,0 +1,148 @@ +set --brace-expand +set --extended-glob +set --no-clobber +set --no-unset +set --hist-space +set --notify-le +set --le-no-conv-meta +set --le-predict + +bindkey --vi-insert --vi-command '\^[[1;5C' forward-viword # C-<Right> +bindkey --vi-insert --vi-command '\^[[1;6C' forward-bigword # C-S-<Right> +bindkey --vi-insert --vi-command '\^[[1;5D' backward-viword # C-<Left> +bindkey --vi-insert --vi-command '\^[[1;6D' backward-bigword # C-S-<Left> +bindkey --vi-insert '\^O' clear-candidates +bindkey --vi-insert '\^L' clear-and-redraw-all +bindkey --vi-command '\^L' clear-and-redraw-all + +alias -- -='cd - >/dev/null' +alias l='ls -alhGL --group-directories-first --time-style "+%Y-%m-%d"' ll='l' +alias tree='tree -a -L 4 --filesfirst --gitignore' +alias se='sudoedit' +alias h='fc -l' +alias j='jobs' +alias o='xdg-open' +alias g='grep' +alias --global L='|$PAGER' +alias --global N='>/dev/null 2>&1' N1='>/dev/null' N2='2>/dev/null' + +cp() if [ -t 0 ]; then command cp -r "$@"; else command cp "$@"; fi +rm() if [ -t 0 ]; then command rm -r "$@"; else command rm "$@"; fi +df() if [ -t 0 ]; then command df -h "$@"; else command df "$@"; fi +du() if [ -t 0 ]; then command du -h "$@"; else command du "$@"; fi +mkdir() if [ -t 0 ]; then command mkdir -p "$@"; else command mkdir "$@"; fi +vi() { nvim "$@"; } +view() { nvim -R "$@"; } +sh() { yash --posix "$@"; } +yash() { command yash "$@"; } + + +# define some basic variables if missing +: ${PAGER:=less} ${EDITOR:=vi} ${FCEDIT:=$EDITOR} +: ${LOGNAME:=$(logname)} ${HOSTNAME:=$(uname -n)} + +# set up history +HISTFILE=~/.local/state/yash/history +HISTSIZE=5000 +! [ -d "${HISTFILE%/*}" ] && mkdir -p "${HISTFILE%/*}" + +# disable confusing treatment of arguments in the echo command +: ${ECHO_STYLE:=RAW} + +# ensure job control works as expected +case $- in (*m*) + trap - TSTP TTIN TTOU +esac + +# if the terminal supports color... +if [ "$(tput colors 2>/dev/null || echo 0)" -ge 8 ]; then + + # make command output colorful + if ls --color=auto -d / >/dev/null 2>&1; then + ls() { command ls --color=auto "$@"; } + fi + if grep --color=auto -q X <<<X 2>/dev/null; then + grep() { command grep --color=auto "$@"; } + fi + if ggrep --color=auto -q X <<<X 2>/dev/null; then + ggrep() { command ggrep --color=auto "$@"; } + fi + +fi + +# initialize event handlers +COMMAND_NOT_FOUND_HANDLER=() +PROMPT_COMMAND=() +POST_PROMPT_COMMAND=() +YASH_AFTER_CD=() + +# 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 "$@"') + +# treat command names starting with % as "fg" +_autofg() +if [ $# -eq 1 ]; then + case $1 in (%*) + HANDLED=true + fg "$1" + break -i + esac +fi +COMMAND_NOT_FOUND_HANDLER=("$COMMAND_NOT_FOUND_HANDLER" '_autofg "$@"') + +# 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 "$@"') + +_update_short_pwd() { + local path="${PWD/$HOME/\~}" + local result="" + + if [ "$path" = "/" ] || [ "$path" = "~" ]; then + _short_pwd="$path" + return + fi + + if [ "${path[1]}" = "~" ]; then + result="~" + fi + + while [ "${path#[/~]*}" != "$path" ]; do + path="${path#[/~]*}" + done + + while [ -n "$path" ]; do + component="${path%%/*}" + + if [ "$path" = "$component" ]; then + result="$result/$component" + break + fi + + if [ -n "$component" ]; then + if [ "${component[1]}" = "." ]; then + result="$result/.${component[2]}" + else + result="$result/${component[1]}" + fi + fi + + path="${path#*/}" + done + _short_pwd="$result" +} +PROMPT_COMMAND=("$PROMPT_COMMAND" '_update_short_pwd') + +YASH_PS1='\fb.${_short_pwd}\fd.${{?:/0/}:+\\fr. [$?]\\fd.}> ' +YASH_PS1P='\fi.' + +# vim: set et sw=2 sts=2 tw=78 ft=sh: diff --git a/pkg/yash/config/rc b/pkg/yash/config/rc @@ -0,0 +1,13 @@ +rcd=~/.config/yash/rc.d + +if [ -d $rcd ]; then + for rc in $rcd/*; do + if [ -f "$rc" ]; then + . "$rc" + fi + done +fi + +unset rc rcd + +# vim: set et sw=2 sts=2 tw=78 ft=sh: