Browse Source

*kicks out zsh and yash* /bin/mksh is my new friend now

trunk
Nova 2 months ago
parent
commit
1ea79dfa79
  1. 45
      .mkshrc
  2. 281
      .yash/common
  3. 41
      .yashrc
  4. 52
      .zshrc
  5. 2
      README.md
  6. 49
      etc/apk/world

45
.mkshrc

@ -0,0 +1,45 @@
# Aliases
## Begin: abuild shorthands
alias abc='abuild checksum'
alias abcl='abuild clean'
alias abde='abuild deps'
alias abf='abuild fetch'
alias abr='abuild -r'
alias abrf='abuild -r -f'
alias abud='abuild undeps'
## End: abuild shorthands
## Begin: lucidiot's aliases
alias aliasless='alias | less'
alias l='ls -lah'
alias la='ls -lAh'
alias ll='ls -lh'
alias md='mkdir'
alias mdp='mkdir -p'
alias nuke='kill -9'
alias please='doas' # in lucidiot's site it's actually sudo
alias rd='rm -r'
alias :q='exit'
alias :wq='exit'
## End: lucidiot's aliases
## Begin: personal aliases
alias ytogg='youtube-dl -x --audio-format vorbis $@'
alias ytopus='youtube-dl -x --audio-format opus $@'
## End: personal aliases
# End: Aliases
# Environment variables
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$HOME/.opam/default/bin:$HOME/.local/bin:$HOME/.cabal/bin:/usr/lib/9base/bin"
DATE=$(ddate +'Today is %{%A, the %e of %B%}, %Y. %N%nCelebrate %H')
# Prompts
PS1='[$(whoami)@$(hostname)]:[$(pwd | sed "s,^$HOME,~,")] [$(echo $?)] '
PS2="-> "
# opam configuration
test -r $HOME/.opam/opam-init/init.sh && . $HOME/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
# vim: set et sw=2 sts=2 tw=78 ft=sh:

281
.yash/common

@ -0,0 +1,281 @@
##### Common Yashrc #####
# This file is in the public domain.
# enable bash-like extended expansion
set --brace-expand
# enable recursive pathname expansion
set --extended-glob
# prevent redirections from overwriting existing files
set --no-clobber
# don't implicitly expand non-existent variables to empty strings
set --no-unset
# if yash is built with command history enabled...
if command --identify --builtin-command history >/dev/null; then
# don't save commands starting with a space in history
set --hist-space
# prevent clearing history by accident
history()
if [ -t 0 ] && (
for arg do
case "${arg}" in
(-[drsw]?* | --*=*) ;;
(-*c*) exit;;
esac
done
false
) then
printf 'history: seems you are trying to clear the whole history.\n' >&2
printf 'are you sure? (yes/no) ' >&2
case "$(head -n 1)" in
([Yy]*) command history "$@";;
(*) printf 'history: cancelled.\n' >&2;;
esac
else
command history "$@"
fi
fi
# if yash is built with line-editing enabled...
if command --identify --builtin-command bindkey >/dev/null; then
# print job status update ASAP, but only while line-editing
set --notify-le
# some terminfo data are broken; meta flags have to be ignored for UTF-8
set --le-no-conv-meta
# most users are more familiar with emacs mode than vi mode
if [ -o vi ]; then
set --emacs
fi
# some useful key bindings
bindkey --emacs '\^N' beginning-search-forward
bindkey --emacs '\^O' clear-candidates
bindkey --emacs '\^P' beginning-search-backward
bindkey --emacs '\N' complete-next-column
bindkey --emacs '\P' complete-prev-column
# key bindings for vi mode, some of which are from emacs mode
bindkey --vi-insert '\^A' beginning-of-line
bindkey --vi-insert '\^B' backward-char
bindkey --vi-insert '\^D' eof-or-delete
bindkey --vi-insert '\#' eof-or-delete
bindkey --vi-insert '\^E' end-of-line
bindkey --vi-insert '\^F' forward-char
bindkey --vi-insert '\^K' forward-kill-line
bindkey --vi-insert '\^N' beginning-search-forward
bindkey --vi-insert '\^O' clear-candidates
bindkey --vi-insert '\^P' beginning-search-backward
bindkey --vi-insert '\^U' backward-kill-line
bindkey --vi-insert '\$' backward-kill-line
bindkey --vi-insert '\^W' backward-delete-viword
bindkey --vi-insert '\^Y' put-left
bindkey --vi-insert '\N' complete-next-column
bindkey --vi-insert '\P' complete-prev-column
bindkey --vi-command '\^N' beginning-search-forward
bindkey --vi-command '\^P' beginning-search-backward
fi
# some useful shortcuts
alias -- -='cd -'
alias la='ls -a' ll='ls -l' lla='ll -a'
alias r='fc -s'
# avoid removing/overwriting existing files by accident
cp() if [ -t 0 ]; then command cp -i "$@"; else command cp "$@"; fi
mv() if [ -t 0 ]; then command mv -i "$@"; else command mv "$@"; fi
rm() if [ -t 0 ]; then command rm -i "$@"; else command rm "$@"; fi
# normally yash is more POSIX-compliant than /bin/sh :-)
sh() { yash --posix "$@"; }
yash() { command yash "$@"; }
# By re-defining 'yash' using the 'command' built-in, the 'jobs' built-in
# prints a command name that exposes the arguments like
# 'yash --posix -n foo.sh' rather than a command name that hides the
# arguments like 'yash --posix "${@}"'. This applies to the 'yash' command
# invoked via the 'sh' function.
# 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
# avoid removing existing crontab by accident
crontab()
if [ -t 0 ] && (
for arg do
case "${arg}" in
(-*r*) exit;;
esac
done
false
) then
printf 'crontab: seems you are trying to clear your crontab.\n' >&2
printf 'are you sure? (yes/no) ' >&2
case "$(head -n 1)" in
([Yy]*) command crontab "$@";;
(*) printf 'crontab: cancelled.\n' >&2;;
esac
else
command crontab "$@"
fi
# an alias that opens a file
if command --identify xdg-open >/dev/null 2>&1; then
alias o='xdg-open'
elif command --identify cygstart >/dev/null 2>&1; then
alias o='cygstart'
elif [ "$(uname)" = Darwin ] 2>/dev/null; then
alias o='open'
fi
# define some basic variables if missing
: ${PAGER:=less} ${EDITOR:=vi} ${FCEDIT:=$EDITOR}
: ${LOGNAME:=$(logname)} ${HOSTNAME:=$(uname -n)}
# disable confusing treatment of arguments in the echo command
: ${ECHO_STYLE:=RAW}
# variables needed for command history
HISTFILE=~/.yash_history HISTSIZE=0
# HISTRMDUP makes prediction less accurate
# HISTRMDUP=500
# default mail check interval is too long
MAILCHECK=0
# emulate bash's $SHLVL
if [ "${_old_shlvl+set}" != set ]; then
_old_shlvl=${SHLVL-}
fi
SHLVL=$((_old_shlvl+1)) 2>/dev/null || SHLVL=1
export SHLVL
# initialize event handlers
COMMAND_NOT_FOUND_HANDLER=()
PROMPT_COMMAND=()
YASH_AFTER_CD=()
# define prompt
if [ -n "${SSH_CONNECTION-}" ]; then
_hc='\fy.' # yellow hostname for SSH remote
else
_hc='\fg.' # green hostname for local
fi
if [ "$(id -u)" -eq 0 ]; then
_uc='\fr.' # red username for root
_2c='\fr.' # red PS2 for root
else
_uc=$_hc _hc= # same username color as hostname for non-root user
_2c= # PS2 in normal color for non-root user
fi
# The main prompt ($YASH_PS1) contains the username, hostname, working
# directory, last exit status (only if non-zero), and $SHLVL (only if
# non-one).
YASH_PS1=$_uc'${LOGNAME}'$_hc'@${HOSTNAME%%.*}\fd. '\
'${${${PWD:/~/\~}##*/}:-$PWD} ${{?:/0/}:+\\fr.$?\\fd. }${{SHLVL-0}:/1}\$ '
YASH_PS1R='\fc.${_vcs_info}'
YASH_PS1S='\fo.'
YASH_PS2=$_2c'> '
#YASH_PS2R=
YASH_PS2S=$YASH_PS1S
YASH_PS4='\fm.+ '
YASH_PS4S='\fmo.'
unset _hc _uc _2c
# No escape sequences allowed in the POSIXly-correct mode.
PS1='${LOGNAME}@${HOSTNAME%%.*} '$PS1
# find escape sequence to change terminal window title
case "$TERM" in
(xterm|xterm[+-]*|gnome|gnome[+-]*|putty|putty[+-]*|cygwin)
_tsl='\033];' _fsl='\a' ;;
(*)
_tsl=$( (tput tsl 0; echo) 2>/dev/null |
sed -e 's;\\;\\\\;g' -e 's;;\\033;g' -e 's;;\\a;g' -e 's;%;%%;g')
_fsl=$( (tput fsl ; echo) 2>/dev/null |
sed -e 's;\\;\\\\;g' -e 's;;\\033;g' -e 's;;\\a;g' -e 's;%;%%;g') ;;
esac
# if terminal window title can be changed...
if [ "$_tsl" ] && [ "$_fsl" ]; then
# set terminal window title on each prompt
_set_term_title()
if [ -t 2 ]; then
printf "$_tsl"'%s@%s:%s'"$_fsl" "${LOGNAME}" "${HOSTNAME%%.*}" \
"${${PWD:/$HOME/\~}/#$HOME\//\~\/}" >&2
fi
PROMPT_COMMAND=("$PROMPT_COMMAND" '_set_term_title')
# reset window title when changing host or user
ssh() {
if [ -t 2 ]; then printf "$_tsl"'ssh %s'"$_fsl" "$*" >&2; fi
command ssh "$@"
}
su() {
if [ -t 2 ]; then printf "$_tsl"'su %s'"$_fsl" "$*" >&2; fi
command su "$@"
}
sudo() {
if [ -t 2 ]; then printf "$_tsl"'sudo %s'"$_fsl" "$*" >&2; fi
command sudo "$@"
}
doas() {
if [ -t 2 ]; then printf "$_tsl"'doas %s'"$_fsl" "$*" >&2; fi
command doas "$@"
}
fi
# 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 "$@"')
# vim: set et sw=2 sts=2 tw=78 ft=sh:

41
.yashrc

@ -0,0 +1,41 @@
# Aliases
## Begin: abuild shorthands
alias abc="abuild checksum"
alias abcl="abuild clean"
alias abde="abuild deps"
alias abf="abuild fetch"
alias abr="abuild -r"
alias abrf="abuild -r -f"
alias abud="abuild undeps"
## End: abuild shorthands
## Begin: lucidiot's aliases
alias aliasless="alias | less"
alias nuke="kill -9"
alias please="doas"
alias :q="exit"
alias :wq="exit"
## End: lucidiot's aliases
## Begin: personal aliases
alias ytogg="youtube-dl -x --audio-format vorbis $@"
alias ytopus="youtube-dl -x --audio-format opus $@"
## End: personal aliases
# End: Aliases
# Environment variables
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$HOME/.opam/default/bin:$HOME/.local/bin:$HOME/.cabal/bin:/usr/lib/9base/bin"
DATE=$(ddate +'Today is %{%A, the %e of %B%}, %Y. %N%nCelebrate %H')
# opam configuration
test -r $HOME/.opam/opam-init/init.sh && . $HOME/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
# Begin: yash-specific configs
HISTFILE=~/.yash_history
HISTSIZE=0
. --autoload --no-alias ~/.yash/common
# End: yash-specific configs
# vim: set et sw=2 sts=2 tw=78 ft=sh:

52
.zshrc

@ -1,23 +1,18 @@
# The following lines were added by compinstall
zstyle :compinstall filename '/home/novaburst/.zshrc'
autoload -Uz compinit
# Begin: zsh-specific config
autoload -Uz compinit promptinit
compinit
promptinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
## Command history
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
# End of lines configured by zsh-newuser-install
# The following lines were added by novaburst
# Source of this prompt : https://scriptingosx.com/2019/07/moving-to-zsh-06-customizing-the-zsh-prompt/
PROMPT='%(?.%F{green}√.%F{red}?%?)%f %B%F{240}%1~%f%b %# '
HISTSIZE=0
SAVEHIST=5
# Integration with version control systems
# like git or whatever
## Prompt
prompt fade red
## Integration with version control systems
## Requires: zsh-vcs
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
@ -25,21 +20,19 @@ setopt prompt_subst
RPROMPT=\$vcs_info_msg_0_
zstyle ':vcs_info:git:*' formats '%F{240}(%b)%r%f'
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:hg:*' formats '%F{240}(%b)%r%f'
zstyle ':vcs_info:*' enable hg
# Setting up some environment variables
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$HOME/.opam/default/bin:$HOME/.local/bin"
ddate="$(ddate +'Today is %{%A, the %e of %B%}, %Y. %N%nCelebrate %H')"
# End: zsh-specific config
# Environment variables
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$HOME/.opam/default/bin:$HOME/.local/bin:$HOME/.cabal/bin"
DATE="$(ddate +'Today is %{%A, the %e of %B%}, %Y. %N%nCelebrate %H')"
# opam configuration
test -r /home/novaburst/.opam/opam-init/init.zsh && . /home/novaburst/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true
# The following lines were copied from HeckOverflow
alias bat='upower -i /org/freedesktop/UPower/devices/battery_BAT1 | egrep "state|to\ full|percentage"'
# End of lines copied from HeckOverflow
# Begin: Aliases
# Shorthands for 'abuild' commands
## Begin: shorthands for 'abuild' commands
alias abc="abuild checksum"
alias abcl="abuild clean"
alias abde="abuild deps"
@ -47,12 +40,19 @@ alias abf="abuild fetch"
alias abr="abuild -r"
alias abrf="abuild -r -f"
alias abud="abuild undeps"
## End: shorthands for 'abuild' commands
# The following lines were copied from https://tilde.town/~lucidiot
## Begin: ~lucidiot's aliases
alias aliasless="alias | less"
alias nuke="kill -9"
alias please="doas"
alias :q="exit"
alias :wq="exit"
## End: ~lucidiot's aliases
## Begin: personal aliases
alias ytogg="youtube-dl -x --audio-format vorbis $@"
alias ytopus="youtube-dl -x --audio-format opus $@"
## End: personal aliases
alias fullwidth='sed "y/!\"#\$%&'"'"'()*+,-.\/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~¢£¬¯¦¥ /!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¢£¬ ̄¦¥ /"'
# End: Aliases

2
README.md

@ -26,9 +26,11 @@
- world
- issue
- motd
- .mkshrc
- .tmux.conf
- .vimrc
- .xinitrc
- .yashrc
- .zshrc
- [COPYING](./COPYING) => [LICENSE](./LICENSE)
- [LICENSE](./LICENSE)

49
etc/apk/world

@ -7,23 +7,23 @@ alpine-baselayout
alpine-conf
alpine-keys
alpine-sdk
alsa-utils
angou
apk-tools
autoconf
automake
bash
bind-tools
binutils
bison
bombadillo
brightnessctl
bsd-games
btrfs-progs
build-base
busybox
bzip2
cabal
cdrkit
cmake
checkbashisms
chromium
command-not-found
coreutils
cowsay
@ -39,7 +39,6 @@ dune
dvd+rw-tools
e2fsprogs
e2fsprogs-extra
elogind
eudev
exfatprogs
f2fs-tools
@ -57,8 +56,9 @@ gcompat
gettext
git
git-email
gmrun><Q1nHslbblfSOP/ogui25Dj23Vlrc8=
go
go-md2man
gomuks
gpm
gptfdisk
grep
@ -71,6 +71,7 @@ gzip
htop
i2pd
icewm
imagemagick
irssi
iw
jfsutils
@ -78,27 +79,24 @@ jq
kbd
kbd-misc
less
lf
libc-utils
libtool
links
linux-headers
linux-lts
lm-sensors
lxappearance-gtk2><Q1WeBYaFUOyBA/t/Ch4/Csemnw/jQ=
lxappearance-gtk2
makepasswd
mandoc-apropos
meson
mksh
mosh
mpv
mtools
mupdf
mupdf-x11
musl-dev
mutt
nano
ncdu
ncftp
ncurses
nedit
neomutt
net-tools
nginx-vim
nss-tools
@ -107,7 +105,6 @@ ntfs-3g-progs
ocaml
ocaml-compiler-libs
ocaml-findlib
ocaml-ocamldoc
opam
openntpd
openrc
@ -123,6 +120,7 @@ perl-app-cpanminus
perl-module-build
pfetch
pm-utils
pnmixer
posix-sh-tools
procps
profanity
@ -131,7 +129,6 @@ python3
redshift
rsync
ruby
samurai
scrot
sed
setxkbmap
@ -139,44 +136,42 @@ shadow
shinkirou-keys><Q1LFxXkkpz6RFbEh+MHeDYqIRjtx8=
signify
smartmontools
spacefm-gtk2><Q16KPoEX+T3FbnbO0SaBeQ5EpRewA=
speedtest-cli
squashfs-tools
ssh-tools
st><Q1JVD+KuVVf0PJe82aLv2l4Hj8QKk=
sudo
st@personal
sxiv
syslog-ng
tabbed><Q11meK7yDXGDD9xT3HkDhhUN6+A+U=
tabbed@personal
tcc
tmux
tor
translate-shell
txtnish
tzdata
udevil
unbound
unrar
upower
usbutils
util-linux
vim
vimb
wget
wireguard-tools
wireless-tools
wpa_supplicant
xarchiver-gtk2><Q1SZ2opbBh1olvjK0lvWMoxivfnYM=
xdg-user-dirs
xdg-utils
xf86-input-libinput
xf86-input-synaptics
xf86-video-modesetting
xfsprogs
xfsprogs-extra
xinit
xkill
xorg-cf-files
xorg-server
xorriso
xz
youtube-dl
zathura
zathura-pdf-mupdf
zip
zsh
zsh-vcs
zstd
Loading…
Cancel
Save