all repos — dotfiles @ 2706a909731d1bd0fffa9200b5f5f6153f31a96b

my *nix dotfiles

Create .bashrc.d/

Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>
Anirudh Oppiliappan x@icyphox.sh
Sun, 05 Jan 2020 23:05:51 +0530
commit

2706a909731d1bd0fffa9200b5f5f6153f31a96b

parent

1002c03c8a437d04f2dd7a2a5914e3fcafe256a0

M bash/.bashrcbash/.bashrc

@@ -1,18 +1,3 @@

-# export thingys -export ZSH=/home/$USER/.oh-my-zsh -export BROWSER=/usr/bin/firefox -export EDITOR=/usr/bin/nvim -export SSH_KEY_PATH="~/.ssh/id_rsa" -export PATH=$HOME/bin:$PATH -export GPG_TTY=$(tty) -export INPUTRC=~/.inputrc -#export PATH=$PATH:$HOME/leet/Nim/bin -export PATH=$PATH:$HOME/.nimble/bin -export PATH=$PATH:$HOME/.local/bin -export PATH=$PATH:/usr/local/go/bin -export PW_DIR=~/passwords -export PW_KEY=x@icyphox.sh - # better history syncing shopt -s histappend export HISTCONTROL=ignoreboth:erasedups

@@ -46,15 +31,9 @@ . /etc/bash_completion

fi fi -# source aliases and prompt -source ~/.bash/aliases -if [ "$(id -u)" != 0 ]; then - source ~/.bash/prompt -fi - # z -export _Z_CMD="j" source ~/leet/z/z.sh -# title -#trap 'echo -ne "\033]0;$BASH_COMMAND\007"' DEBUG +for i in ~/.bashrc.d/[0-9]*; do + . "$i" +done
A bash/.bashrc.d/04-exports.bash

@@ -0,0 +1,15 @@

+# export thingys +export ZSH=/home/$USER/.oh-my-zsh +export BROWSER=/usr/bin/firefox +export EDITOR=/usr/bin/nvim +export SSH_KEY_PATH="~/.ssh/id_rsa" +export PATH=$HOME/bin:$PATH +export GPG_TTY=$(tty) +export INPUTRC=~/.inputrc +#export PATH=$PATH:$HOME/leet/Nim/bin +export PATH=$PATH:$HOME/.nimble/bin +export PATH=$PATH:$HOME/.local/bin +export PATH=$PATH:/usr/local/go/bin +export PW_DIR=~/passwords +export PW_KEY=x@icyphox.sh +export _Z_CMD="j"
A bash/.bashrc.d/90-aliases.bash

@@ -0,0 +1,36 @@

+alias gah='sudo $(fc -ln -1)' +alias nvime="nvim ~/.config/nvim/init.vim" +alias socks="ssh -D 8008 emerald -fN" +alias o="xdg-open" +alias gc="git commit -v -s" +alias gst="git status --short" +alias ga="git add" +alias gd="git diff --minimal" +alias gl="git log --oneline --decorate --graph" +alias ls="ls --color" +alias vim="nvim" +alias xi="sudo xbps-install -S" +alias xr="sudo xbps-remove -R" +alias xs="xbps-query -Rs" + +function up { + ~/bin/icyup.sh "$1" +} + +function nvmon { + source ~/.nvm/nvm.sh +} + +function envac { + source .env/bin/activate +} + +function vpn { + ~/bin/vpnon.sh +} + +function f() { + fff "$@" + cd "$(cat "${XDG_CACHE_HOME:=${HOME}/.cache}/fff/.fff_d")" +} +
A bash/.bashrc.d/99-prompt.bash

@@ -0,0 +1,49 @@

+red="\e[31m" +grn="\e[32m" +ylw="\e[33m" +cyn="\e[36m" +blu="\e[34m" +prp="\e[35m" +bprp="\e[35;1m" +gry="\e[94m" +rst="\e[0m" + +git_branch() { + local git_status="$(git status 2> /dev/null)" + local on_branch="On branch ([^${IFS}]*)" + local on_commit="HEAD detached at ([^${IFS}]*)" + + if [[ $git_status =~ $on_branch ]]; then + local branch=${BASH_REMATCH[1]} + echo -ne "${ylw} $branch ${rst}" + elif [[ $git_status =~ $on_commit ]]; then + local commit=${BASH_REMATCH[1]} + echo -ne "${cyn} $commit ${rst}" + fi +} + +dirtyorclean() { + status="$(git status --porcelain 2> /dev/null)" + local exit="$?" + if [[ "$exit" -eq 0 ]]; then + if [[ ${#status} -eq 0 ]]; then + echo -ne "${grn}•${rst}" + else + echo -ne "${red}×${rst}" + fi + else + echo -ne "" + fi +} + +prompt_pwd() { + echo -ne "\001${cyn}\002$(dirs +0)\001${rst}\002" +} + +rootornot() { + [[ "$(id -u)" -eq 0 ]] && + echo -ne "\001${red}\002#\001${rst}\002" +} + +PS1='\n$(prompt_pwd)$(git_branch)$(dirtyorclean)\n▲$(rootornot) ' +PS2="> "
D bash/aliases

@@ -1,38 +0,0 @@

-#!/usr/bin/env bash - -alias gah='sudo $(fc -ln -1)' -alias nvime="nvim ~/.config/nvim/init.vim" -alias socks="ssh -D 8008 emerald -fN" -alias o="xdg-open" -alias gc="git commit -v -s" -alias gst="git status --short" -alias ga="git add" -alias gd="git diff --minimal" -alias gl="git log --oneline --decorate --graph" -alias ls="ls --color" -alias vim="nvim" -alias xi="sudo xbps-install -S" -alias xr="sudo xbps-remove -R" -alias xs="xbps-query -Rs" - -function up { - ~/bin/icyup.sh "$1" -} - -function nvmon { - source ~/.nvm/nvm.sh -} - -function envac { - source .env/bin/activate -} - -function vpn { - ~/bin/vpnon.sh -} - -function f() { - fff "$@" - cd "$(cat "${XDG_CACHE_HOME:=${HOME}/.cache}/fff/.fff_d")" -} -
D bash/prompt

@@ -1,51 +0,0 @@

-#!/usr/bin/env bash - -red="\e[31m" -grn="\e[32m" -ylw="\e[33m" -cyn="\e[36m" -blu="\e[34m" -prp="\e[35m" -bprp="\e[35;1m" -gry="\e[94m" -rst="\e[0m" - -git_branch() { - local git_status="$(git status 2> /dev/null)" - local on_branch="On branch ([^${IFS}]*)" - local on_commit="HEAD detached at ([^${IFS}]*)" - - if [[ $git_status =~ $on_branch ]]; then - local branch=${BASH_REMATCH[1]} - echo -ne "${ylw} $branch ${rst}" - elif [[ $git_status =~ $on_commit ]]; then - local commit=${BASH_REMATCH[1]} - echo -ne "${cyn} $commit ${rst}" - fi -} - -dirtyorclean() { - status="$(git status --porcelain 2> /dev/null)" - local exit="$?" - if [[ "$exit" -eq 0 ]]; then - if [[ ${#status} -eq 0 ]]; then - echo -ne "${grn}•${rst}" - else - echo -ne "${red}×${rst}" - fi - else - echo -ne "" - fi -} - -prompt_pwd() { - echo -ne "\001${cyn}\002$(dirs +0)\001${rst}\002" -} - -rootornot() { - [[ "$(id -u)" -eq 0 ]] && - echo -ne "\001${red}\002#\001${rst}\002" -} - -PS1='\n$(prompt_pwd)$(git_branch)$(dirtyorclean)\n▲$(rootornot) ' -PS2="> "
M bin/bat.shbin/bat.sh

@@ -7,7 +7,7 @@ cap=$(cat /sys/class/power_supply/BAT0/capacity)

status=$(cat /sys/class/power_supply/BAT0/status) if [[ "$1" == "-n" ]]; then - echo "$cap" + echo "$cap%" else if [[ "$status" = "Charging" ]] then