aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2016-12-06 20:59:58 +0100
committerDuncaen <mail@duncano.de>2016-12-06 20:59:58 +0100
commitb6d470da3742beff17be3f5102239f4a2b4fcd2c (patch)
tree1905c6d710b542601281e175bb987ee164e8dc5f
parent7538519d35f698daff3662b97d4f4961beb2c437 (diff)
downloaddotfiles-b6d470da3742beff17be3f5102239f4a2b4fcd2c.tar.gz
mksh: simplify config by using less files
-rw-r--r--aliases23
-rwxr-xr-xinstall.sh2
-rw-r--r--mkshrc14
-rwxr-xr-xmkshrc.d/00-browser.sh4
-rwxr-xr-xmkshrc.d/00-django.sh7
-rwxr-xr-xmkshrc.d/00-editor.sh3
-rwxr-xr-xmkshrc.d/00-git.sh14
-rwxr-xr-xmkshrc.d/00-go.sh4
-rwxr-xr-xmkshrc.d/00-ls.sh5
-rwxr-xr-xmkshrc.d/00-misc.sh53
-rw-r--r--mkshrc.d/00-nmap.sh3
-rwxr-xr-xmkshrc.d/00-pager.sh15
-rwxr-xr-xmkshrc.d/00-ssh-agent.sh9
-rw-r--r--mkshrc.d/00-sudo.sh4
-rwxr-xr-xmkshrc.d/00-xbps.sh9
-rwxr-xr-xmkshrc.d/01-fzy.sh28
-rwxr-xr-xmkshrc.d/90-prompt.sh1
-rw-r--r--profile18
18 files changed, 46 insertions, 170 deletions
diff --git a/aliases b/aliases
new file mode 100644
index 0000000..b9680fe
--- /dev/null
+++ 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
index f86afbb..c40fdb3 100755
--- 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
index 450357e..25c5863 100644
--- 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
deleted file mode 100755
index c15e95d..0000000
--- a/mkshrc.d/00-browser.sh
+++ /dev/null
@@ -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
deleted file mode 100755
index 2d28e82..0000000
--- a/mkshrc.d/00-django.sh
+++ /dev/null
@@ -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
deleted file mode 100755
index d60a65f..0000000
--- a/mkshrc.d/00-editor.sh
+++ /dev/null
@@ -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
deleted file mode 100755
index 34c64b9..0000000
--- a/mkshrc.d/00-git.sh
+++ /dev/null
@@ -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
deleted file mode 100755
index cb261af..0000000
--- a/mkshrc.d/00-go.sh
+++ /dev/null
@@ -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
deleted file mode 100755
index 62ac69a..0000000
--- a/mkshrc.d/00-ls.sh
+++ /dev/null
@@ -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
deleted file mode 100755
index 9227b31..0000000
--- a/mkshrc.d/00-misc.sh
+++ /dev/null
@@ -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
deleted file mode 100644
index 5e266bb..0000000
--- a/mkshrc.d/00-nmap.sh
+++ /dev/null
@@ -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
deleted file mode 100755
index 16497c9..0000000
--- a/mkshrc.d/00-pager.sh
+++ /dev/null
@@ -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
deleted file mode 100755
index f480da7..0000000
--- a/mkshrc.d/00-ssh-agent.sh
+++ /dev/null
@@ -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
deleted file mode 100644
index 5abf549..0000000
--- a/mkshrc.d/00-sudo.sh
+++ /dev/null
@@ -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
deleted file mode 100755
index c80276f..0000000
--- a/mkshrc.d/00-xbps.sh
+++ /dev/null
@@ -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
deleted file mode 100755
index d773ba1..0000000
--- a/mkshrc.d/01-fzy.sh
+++ /dev/null
@@ -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
deleted file mode 100755
index 50290c9..0000000
--- a/mkshrc.d/90-prompt.sh
+++ /dev/null
@@ -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
index 428fccb..c82bbfe 100644
--- 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