all repos — dotfiles @ 052db51396ff6a9ef0149d309c3e4a1e0d4dead6

my *nix dotfiles

bash: Minimaler prompt

Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>
Anirudh Oppiliappan x@icyphox.sh
Sun, 01 Mar 2020 21:17:11 +0530
commit

052db51396ff6a9ef0149d309c3e4a1e0d4dead6

parent

412a0aece5ecf9198975ed80f163a56ec86457c5

3 files changed, 19 insertions(+), 21 deletions(-)

jump to
M 2bwm/config.h2bwm/config.h

@@ -37,7 +37,7 @@ "#7a8c5c",

"#ff6666", "#cc9933", "#0d131a", - "#000000" + "#FAFAFA" }; /* if this is set to true the inner border and outer borders colors will be swapped */
M bash/.bashrc.d/99-prompt.bashbash/.bashrc.d/99-prompt.bash

@@ -12,38 +12,38 @@ 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="$?" + color="" + if [[ "$exit" -eq 0 ]]; then - if [[ ${#status} -eq 0 ]]; then - echo -ne "${grn}•${rst}" + if [[ "${#status}" -eq 0 ]]; then + color="${grn}" else - echo -ne "${red}×${rst}" + color="${red}" fi else - echo -ne "" + printf '' + fi + + + if [[ $git_status =~ $on_branch ]]; then + local branch=${BASH_REMATCH[1]} + printf '%b' "$color $branch $rst" + elif [[ $git_status =~ $on_commit ]]; then + local commit=${BASH_REMATCH[1]} + printf '%b' "$color $commit $rst" fi } prompt_pwd() { - echo -ne "\001${cyn}\002$(dirs +0)\001${rst}\002" + printf '%b' "\001${cyn}\002$(dirs +0)\001${rst}\002" } rootornot() { [[ "$(id -u)" -eq 0 ]] && - echo -ne "\001${red}\002#\001${rst}\002" + printf '%b' "\001${red}\002#\001${rst}\002" } -PS1='\n$(prompt_pwd)$(git_branch)$(dirtyorclean)\n▲$(rootornot) ' +PS1='\n$(prompt_pwd)$(git_branch)\n▲$(rootornot) ' PS2="> "
M home/.vimrchome/.vimrc

@@ -11,11 +11,9 @@ Plug 'airblade/vim-gitgutter'

Plug 'NerdyPepper/vim-colors-plain', { 'branch': 'duotone' } " plugins for writing {{{ Plug 'reedes/vim-pencil', { 'for': ['text', 'markdown'] } -Plug 'reedes/vim-wordy', { 'for': ['text', 'markdown'] } Plug 'plasticboy/vim-markdown', { 'for': ['text', 'markdown'] } " }}} Plug 'ervandew/supertab' -Plug 'zah/nim.vim' Plug 'wellle/targets.vim' call plug#end()