dotfiles

configuration files
git clone https://pi.duncano.de/git/dotfiles.git
Log | Files | Refs | README

commit b6d470da3742beff17be3f5102239f4a2b4fcd2c
parent 7538519d35f698daff3662b97d4f4961beb2c437
Author: Duncaen <mail@duncano.de>
Date:   Tue,  6 Dec 2016 20:59:58 +0100

mksh: simplify config by using less files

Diffstat:
aliases | 23+++++++++++++++++++++++
install.sh | 2+-
mkshrc | 14+++++---------
mkshrc.d/00-browser.sh | 4----
mkshrc.d/00-django.sh | 7-------
mkshrc.d/00-editor.sh | 3---
mkshrc.d/00-git.sh | 14--------------
mkshrc.d/00-go.sh | 4----
mkshrc.d/00-ls.sh | 5-----
mkshrc.d/00-misc.sh | 53-----------------------------------------------------
mkshrc.d/00-nmap.sh | 3---
mkshrc.d/00-pager.sh | 15---------------
mkshrc.d/00-ssh-agent.sh | 9---------
mkshrc.d/00-sudo.sh | 4----
mkshrc.d/00-xbps.sh | 9---------
mkshrc.d/01-fzy.sh | 28----------------------------
mkshrc.d/90-prompt.sh | 1-
profile | 18+++++++++++++++++-
18 files changed, 46 insertions(+), 170 deletions(-)

diff --git a/aliases b/aliases @@ -0,0 +1,23 @@ +alias ga='git add' +alias gc='git commit' +alias gp='git pull' +alias gs='git status -sb' +alias gb='git branch' +alias gd='git diff' +alias gl='git l' + +alias ls='ls -hF --color' +alias sl='ls' +alias ltoday='lr -1 -t "mtime >= \"00:00:00\"" -t "! name =~ \"^[.]{1,2}$\""' +alias lftoday='ltoday -t "type == f"' + +alias portscan='nmap -Pn' +alias wanip='curl ipinfo.io/ip' + +alias xi='doas xbps-install' +alias xr='doas xbps-remove' +alias xlock='doas xbps-pkgdb -m repolock' +alias xunlock='doas xbps-pkgdb -m repounlock' +alias xhold='doas xbps-pkgdb -m hold' +alias xunhold='doas xbps-pkgdb -m unhold' +alias xq='xbps-query' diff --git a/install.sh b/install.sh @@ -25,12 +25,12 @@ _xorg() { _mksh() { msg "INSTALL" "mksh config" _ln_home "mkshrc" ".mkshrc" - _ln_home "mkshrc.d" ".mkshrc.d" } _shell() { msg "INSTALL" "shell config" _ln_home "profile" ".profile" _ln_home "inputrc" ".inputrc" + _ln_home "aliases" ".aliases" } _git() { msg "INSTALL" "git config" diff --git a/mkshrc b/mkshrc @@ -390,17 +390,13 @@ function setenv { HISTFILE=$HOME/.mksh_history HISTSIZE=1000 SHELL=$MKSH -PATH="$HOME/bin:$PATH" -export HISTFILE HISTSIZE SHELL PATH +export HISTFILE HISTSIZE SHELL -# fix del key -# printf '\033[?1h\033=' >/dev/tty +[ -z "$SSH_AUTH_SOCK" ] && [ -r ~/.cache/ssh-agent-info ] && \ + . ~/.cache/ssh-agent-info +[ -r ~/.aliases ] && . ~/.aliases -if [ -d ~/.mkshrc.d ]; then - for f in ~/.mkshrc.d/*.sh; do - [ -x "$f" ] && . "$f" - done -fi +PS1='$(d=${PWD/$HOME/\~};print ${d##*/})$([ "$SSH_CONNECTION" ]&&print "@${HOSTNAME:=$(hostname)}")$(((r=$?))&&print "?\e[0;31;40m$r\e[0m")$(((USER_ID))&&print \$||print \#) ' : place customisations above this line diff --git a/mkshrc.d/00-browser.sh b/mkshrc.d/00-browser.sh @@ -1,4 +0,0 @@ -if [ -x /usr/bin/firefox ]; then - BROWSER="/usr/bin/firefox" -fi -export BROWSER diff --git a/mkshrc.d/00-django.sh b/mkshrc.d/00-django.sh @@ -1,7 +0,0 @@ -if [ -x /usr/bin/python -o -x /usr/bin/python3 ]; then - alias djrs="python manage.py runserver 0.0.0.0:8000" - alias djcs="python manage.py collectstatic" - alias djm="python manage.py migrate" - alias djmm="python manage.py makemigrations" - alias djcu="python manage.py createsuperuser" -fi diff --git a/mkshrc.d/00-editor.sh b/mkshrc.d/00-editor.sh @@ -1,3 +0,0 @@ -EDITOR=$(command -v vim) -VISUAL="$EDITOR" -export EDITOR VISUAL diff --git a/mkshrc.d/00-git.sh b/mkshrc.d/00-git.sh @@ -1,14 +0,0 @@ -[ -x /usr/bin/git ] || return -alias ga='git add' -alias gc='git commit' -alias gca='git commit --amend' -alias gp='git pull' -alias gpr='git pull --rebase' -alias gs='git status -sb' -alias gb='git branch' -alias gd='git diff' -alias gl='git l' - -fzgl() { - git show $(git log --pretty=oneline -n 20 --abbrev-commit | fzy | awk '{print $1}') -} diff --git a/mkshrc.d/00-go.sh b/mkshrc.d/00-go.sh @@ -1,4 +0,0 @@ -GOPATH="$HOME/go" -GOBIN="$GOPATH/bin" -PATH="$PATH:$GOBIN" -export GOPATH GOBIN PATH diff --git a/mkshrc.d/00-ls.sh b/mkshrc.d/00-ls.sh @@ -1,5 +0,0 @@ -alias ls='ls -hF --color' -alias sl='ls' - -alias ltoday='lr -1 -t "mtime >= \"00:00:00\"" -t "! name =~ \"^[.]{1,2}$\""' -alias lftoday='ltoday -t "type == f"' diff --git a/mkshrc.d/00-misc.sh b/mkshrc.d/00-misc.sh @@ -1,53 +0,0 @@ -alias wanip='curl ipinfo.io/ip' - -psgrep() { ps up $(pgrep -f $@) 2>&-; } - -psofgrep() { lsof -p $(pgrep -f $@ | tr '\012' ,); } -lsofgrep() { lsof $@; } - -function urlencode { - typeset decoded=$1 encoded= rest= c= - typeset rest2= bug='rest2=${rest}' - - if [[ -z ${BASH_VERSION} ]]; then - # bug /usr/bin/sh HP-UX 11.00 - typeset _decoded='xyz%26xyz' - rest="${_decoded#?}" - c="${_decoded%%${rest}}" - if (( ${#c} != 1 )); then - typeset qm='????????????????????????????????????????????????????????????????????????' - typeset bug='(( ${#rest} > 0 )) && typeset -L${#rest} rest2="${qm}" || rest2=${rest}' - fi - fi - - rest="${decoded#?}" - eval ${bug} - c="${decoded%%${rest2}}" - decoded="${rest}" - - while [[ -n ${c} ]]; do - case ${c} in - [-a-zA-z0-9.]) - ;; - ' ') - c='+' - ;; - *) - c=$(printf "%%%02X" "'$c") - ;; - esac - - encoded="${encoded}${c}" - - rest="${decoded#?}" - eval ${bug} - c="${decoded%%${rest2}}" - decoded="${rest}" - done - - if [[ -n ${BASH_VERSION:-} ]]; then - \echo -E "${encoded}" - else - print -r -- "${encoded}" - fi -} diff --git a/mkshrc.d/00-nmap.sh b/mkshrc.d/00-nmap.sh @@ -1,3 +0,0 @@ -if [ -x /usr/bin/nmap ]; then - alias portscan='nmap -Pn' -fi diff --git a/mkshrc.d/00-pager.sh b/mkshrc.d/00-pager.sh @@ -1,15 +0,0 @@ -PAGER=$(command -v less) -LESS="-FXRi" -# LESSHISTFILE=- -MANWIDTH=80 - -# colored man pages: -LESS_TERMCAP_md=$'\e[1;31m' # start bold -LESS_TERMCAP_so=$'\e[1;40;37m' # start standout -LESS_TERMCAP_se=$'\e[0m' # end standout -LESS_TERMCAP_us=$'\e[0;34m' # start underlining -LESS_TERMCAP_ue=$'\e[0m' # end underlining -LESS_TERMCAP_me=$'\e[0m' # end all modes]']']']']']' - -export PAGER LESS LESSHISTFILE MANWIDTH LESS_TERMCAP_md LESS_TERMCAP_so \ - LESS_TERMCAP_se LESS_TERMCAP_us LESS_TERMCAP_ue LESS_TERMCAP_me diff --git a/mkshrc.d/00-ssh-agent.sh b/mkshrc.d/00-ssh-agent.sh @@ -1,9 +0,0 @@ -source_ssh_agent() { - [ -r ~/.cache/ssh-agent-info ] && . ~/.cache/ssh-agent-info -} - -check_ssh_agent() { - test -e "/proc/${SSH_AUTH_SOCK#*.}" -} - -[ ! "$SSH_AUTH_SOCK" ] && source_ssh_agent diff --git a/mkshrc.d/00-sudo.sh b/mkshrc.d/00-sudo.sh @@ -1,4 +0,0 @@ -if [ -x "$(command -v /usr/bin/sudo)" ]; then - alias sudovi="EDITOR=vi sudoedit $@" - alias sudovim="EDITOR=vim sudoedit $@" -fi diff --git a/mkshrc.d/00-xbps.sh b/mkshrc.d/00-xbps.sh @@ -1,9 +0,0 @@ -if [ -x /usr/bin/xbps-install ]; then - alias xi='doas xbps-install' - alias xr='doas xbps-remove' - alias xlock='doas xbps-pkgdb -m repolock' - alias xunlock='doas xbps-pkgdb -m repounlock' - alias xhold='doas xbps-pkgdb -m hold' - alias xunhold='doas xbps-pkgdb -m unhold' - alias xq='xbps-query' -fi diff --git a/mkshrc.d/01-fzy.sh b/mkshrc.d/01-fzy.sh @@ -1,28 +0,0 @@ -[ $(command -v fzy) ] || return - -function fzpsgrep { - psgrep "$@" | \ - while read -r l; do - printf '%s\n' "$l" >2 - fzy | awk '{print $2}' - break - done -} - -function fzxq { - echo ${fzy_opts:-"--prompt='xbps-query $@ > '"} - xq "$@" | fzy ${fzy_opts:-"--prompt='xbps-query $@ > '"} | awk '{print $2}' -} - -function fzxi { - local opt q - for opt; do - case $opt in - -*) break; ;; - *) q+=" $opt"; shift 1 ;; - esac - done - q=$(fzxq -Rs "$q") - [ -n "$q" ] || return $? - xi "$@" "$q" -} diff --git a/mkshrc.d/90-prompt.sh b/mkshrc.d/90-prompt.sh @@ -1 +0,0 @@ -PS1='$(d=${PWD/$HOME/\~};print ${d##*/})$([ "$SSH_CONNECTION" ]&&print "@${HOSTNAME:=$(hostname)}")$(((r=$?))&&print "?\e[0;31;40m$r\e[0m")$(((USER_ID))&&print \$||print \#) ' diff --git a/profile b/profile @@ -1,2 +1,18 @@ # load system profile -. /etc/profile +[ -r /etc/profile ] && . /etc/profile + +: ${BROWSER:=$(command -v firefox 2>/dev/null)} +: ${BROWSER:=$(command -v chromium 2>/dev/null)} + +: ${EDITOR:=$(command -v vim 2>/dev/null)} +: ${EDITOR:=$(command -v vi 2>/dev/null)} +: ${VISUAL:="$EDITOR"} + +: ${GOPATH:="$HOME/go"} + +: ${PAGER:=$(command -v less 2>/dev/null)} +: ${MANWIDTH:=80} + +PATH="$HOME/bin:$PATH:$GOPATH/bin" + +export BROWSER EDITOR GOPATH MANWIDTH PAGER PATH VISUAL