dot

packages and services management
Log | Files | Refs | README

commit 078fdae6aa3cd62fe3cf0582c4453a2b85f25179
parent a4810b9db33421bbff6cb3c91c8f4daf359df21f
Author: josuah <mail@josuah.net>
Date:   Tue, 22 Nov 2016 18:41:16 +0100

Moved a few stuff

Diffstat:
M.cache/buffer/history | 1+
M.local/bin/status | 26++++++++++++++++----------
M.profile | 19++++++++-----------
3 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/.cache/buffer/history b/.cache/buffer/history @@ -1 +1,2 @@ addpart b +barkdown + diff --git a/.local/bin/status b/.local/bin/status @@ -6,28 +6,35 @@ # Plain text status line for wherever useful -SEPARATOR=' ' -START=' ' -STOP=' ' +SEPARATOR=' ' +START=' ' +STOP=' ' # -# Current directory git status, +# Current path, with "$HOME" replaced by '~' # status_path() { local pwd="$1" [ -z "${pwd##$HOME*}" ] && printf ~%s "${pwd#$HOME}" || printf %s "$pwd" +} - cd "$pwd" + +# +# Current directory git status, +# +status_git() +{ + cd "$1" git rev-parse 2> /dev/null || return 0 git status --porcelain -b | awk ' /^## / { branch = $0; - sub(/^##/, "", branch); + sub(/^## /, "", branch); sub(/\.\.\..*/, "", branch); if ($0 ~ /ahead /) { @@ -56,7 +63,7 @@ status_path() m == 1 { m = 0; } END { - printf(" \033[1m%s\033[0m", branch); + printf("\033[1m%s\033[0m", branch); if (untracked + conflicts + changed + staged + behind + ahead \ == 0) { @@ -136,14 +143,13 @@ main() { local segment - printf "$START" while [ "$#" -gt 0 ] do case "$1" in - path ) + path | git ) segment="$(status_$1 $2)" - shift 1 + shift ;; * ) segment="$(status_$1)" diff --git a/.profile b/.profile @@ -35,17 +35,17 @@ export PS1='$( # status line printf "\n%$(stty size | cut -d " " -f 2)s\r%s\n" \ - "$(status)" "$(status path "$PWD")" + "$(status)" "$(status path "$PWD" git "$PWD")" # prompt character - printf "\033[1;3%sm ─── \033[0m" "$color" + printf "\033[1;3%sm─── \033[0m" "$color" )' export PS2=' > ' export PS3=' > ' -alias l='ls -lhF --color' -alias la='ls -AlhF --color' +alias l='ls -lh --color' +alias la='ls -Alh --color' alias p='$PAGER' alias a='buffer' alias b='buffer' @@ -56,6 +56,7 @@ alias f='find . -type f ! -path "*/.git/*" | cut -c 3- | sort | iomenu' alias d='find . -type d ! -path "*/.git/*" | cut -c 3- | sort | iomenu' alias c='cd "$(d)"' alias g='grep --color=always' +alias .p='. ~/.profile' alias cl='printf "\033[s\033[255;0H\033[1J\033[u\033[3A"' alias bh='busybox --help' alias myip='curl icanhazip.com' @@ -64,15 +65,11 @@ alias lines='find . -name "*.[ch]" | xargs wc -l' color() { - for in in in in + for i in 1 2 3 4 5 6 7 do - for i in 1 2 3 4 5 6 7 - do - printf ' \033[3%sm███\033[1m█\033[0m\033[3%sm███' $i $i - done - printf '\n' + printf ' \033[3%sm███\033[1m███\033[0m' $i done - + printf '\n' }