dot

packages and services management
Log | Files | Refs | README

commit a329f93bc15b125af859d4ed6798721f9906e65f
parent 8e227c363412fce5b8a65417b0d9600a45fd44a6
Author: Josuah Demangeon⠠⠵ <mail@josuah.net>
Date:   Mon,  6 Mar 2017 02:50:33 +0100

Simplified .profile

Diffstat:
M.profile | 139+++++++++++++++++++++++++------------------------------------------------------
Mbin/git-prompt | 1-
2 files changed, 44 insertions(+), 96 deletions(-)

diff --git a/.profile b/.profile @@ -1,72 +1,58 @@ +#!/bin/sh # Shell configuration for any POSIX shells # Prevents to be run twice per session -[ "$PROFILE" ] && return 0 || PROFILE=1 - - -export CONFIG= +[ "$PROFILE" ] && return 0 || PROFILE='1' + +# build(1) package manager runtime variables +[ "$(dirname "$(readlink ~/.profile)")/bin/build" ] && . "$(dirname "$(readlink ~/.profile)")/bin/build" + export PATH="$(dirname "$(readlink ~/.profile)")/bin:$PATH" -export ENV="$HOME/.profile" -export TZ='Europe/Paris' +export ENV="$HOME/.profile" +export TZ='Europe/Paris' # mail -export NAME='Josuah Demangeon' +export NAME='Josuah Demangeon' export EMAIL='mail@josuah.net' -export MAIL="$HOME/mail/INBOX" +export MAIL="$HOME/mail/INBOX" # default commands -export EDITOR='vi' VISUAL="$EDITOR" FCEDIT="$EDITOR" -export PAGER='less' MANPAGER='less -R' - -# dvtm -export DVTM_TERM='screen' -export DVTM_PAGER='less -R' - -# xdg base directory -export XDG_DATA_HOME="$HOME/.local/share" -export XDG_CONFIG_HOME="$HOME/.config" -export XDG_CACHE_HOME="$HOME/.cache" -export XDG_RUNTIME_DIR="$HOME/.cache" +export EDITOR='vi' VISUAL='vi' +export PAGER='less' MANPAGER='less -R' DVTM_PAGER='less -R' # prompt export PS1='$( - [ $? -eq 0 ] && color=2 || color=1 - [ -z "${PWD##$HOME*}" ] && pwd="~${PWD#$HOME}" || pwd="$PWD" - - printf "\a" # bell - printf "\033[?6c" # TTY cursor shape - printf "\033]0;%s\007" "$pwd" # terminal name - - printf "\n\033[1;3%dm_\033[m %s%s\n─ " "$color" "$pwd" "$(git-prompt)" + [ "$?" -gt 0 ] && color="1" || color="7" + [ "${PWD##$HOME*}" ] && pwd="$PWD" || pwd="~${PWD#$HOME}" || pwd + printf "\033[?6c" # TTY cursor shape + printf "\033]0;%s\007" "$pwd" # terminal name + printf "\n%s \033[1;3%dm•\033[m%s " "$(git-prompt)" "$color" )' export PS2=': ' export PS3=': ' # coreutils -alias p='page' -alias l='list' -alias la='ls -Alhp --color' +alias p='[ "${PWD##$HOME*}" ] && pwd || printf "~%s\n" "${PWD#$HOME}"' +alias l='ls -lhp' +alias la='ls -lhpA' alias cl='printf "\033[H\033[2J"' -alias bh='page busybox --help' -alias grep='page grep' alias ..='cd ..' # iomenu alias a='io-abduco' alias r='io-run' -alias g='io-grep' alias v='io-files' alias m='io-man' alias mb='io-mblaze' alias f='find ! -path "*/.git/*" -type f | iomenu' alias d='find ! -path "*/.git/*" -type d | iomenu' -alias c='cd "$(d)"' +alias c='cd "$(find ! -path "*/.git/*" -type d | iomenu)"' # scripts alias i='ii-client' @@ -77,79 +63,40 @@ alias t='tmux attach &>/dev/null || tmux new' # utilities alias myip='curl icanhazip.com' alias lines='find . -name "*.[ch]" | xargs wc -l' - - -echo() -{ - printf '%s\n' "$*" -} - - -page() -{ - "$@" | more -} - - -list() -{ - if [ ! -f "$1" ] || [ ! $# -eq 1 ] - then - page ls -lhp --color "$@" - else - less -NS "$@" - fi -} - - -color() -{ - for i in 1 2 3 4 5 6 7 - do printf ' \033[3%sm___\033[1m___\033[0m' $i - done - printf '\n' -} +alias ix='curl -F "f:1=<-" ix.io' +alias mnt='sudo mount -o uid="$USER" -o rw' extract() { case "$1" in - ( *.tar.gz ) tar -xzf "$1" ;; - ( *.tgz ) tar -xzf "$1" ;; - ( *.tar.bz2 ) tar -xjf "$1" ;; - ( *.tbz2 ) tar -xjf "$1" ;; - ( *.tar ) tar -xf "$1" ;; - ( *.bz2 ) bunzip2 "$1" ;; - ( *.rar ) unrar x "$1" ;; - ( *.zip ) unzip "$1" ;; - ( *.gz ) gunzip "$1" ;; - ( *.Z ) uncompress "$1" ;; - ( *.7z ) 7z x "$1" ;; - ( *.xz ) xz -d "$1" ;; - ( *.deb ) ar vx "$1" ;; - ( * ) printf 'extract: Unknown archive extension\n';; + ( *.tar.gz | *.tgz ) tar -xzf "$1" ;; + ( *.tar.bz2 | *.tbz2 ) tar -xjf "$1" ;; + ( *.tar ) tar -xf "$1" ;; + ( *.bz2 ) bunzip2 "$1" ;; + ( *.gz ) gunzip "$1" ;; + ( *.rar ) unrar x "$1" ;; + ( *.zip ) unzip "$1" ;; + ( *.Z ) uncompress "$1" ;; + ( *.7z ) 7z x "$1" ;; + ( *.xz ) xz -d "$1" ;; + ( *.deb ) ar vx "$1" ;; + ( * ) exit 1 ;; esac } -# Sudo, sudo, sudo, sudo, sudo, screen brightness, sudo, sudo... +# set screen brightness, using sudo light() { - printf '%s\n' "$1" | sudo tee "$( - sudo find -L /sys/class/backlight -maxdepth 2 -name brightness | - head -n 1 + printf %s "$1" | sudo tee -a "$( + find -L /sys/class/backlight -maxdepth 2 -name brightness )" } -mnt() -{ - sudo mount -o uid="$USER" -o rw "${1-/dev/sdb1}" "${2-/mnt}" -} - - -# Works only in TTY and with sudo, unfortunately. +# works only in TTY and with sudo, unfortunately rotate() { @@ -159,7 +106,7 @@ rotate() } -# FrameBuffer Video player based on mplayer +# frameBuffer video player based on mplayer fbv() { @@ -192,8 +139,10 @@ rfc() main() { - [ "$TERM" = 'linux' ] && - setfont ~/.local/share/consolefonts/terminus-16n.psf + if [ "$TERM" = 'linux' ] + then + setfont ~/.local/share/consolefonts/terminus-16n.psf + fi } diff --git a/bin/git-prompt b/bin/git-prompt @@ -43,5 +43,4 @@ END { if (behind ) printf " \033[31m↓\033[0m%d", behind ; if (ahead ) printf " \033[36m↑\033[0m%d", ahead ; } - printf(" "); }'