From 0efa5121a2169b1833217d27a900a701803a1c1b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 2 Nov 2020 19:16:54 +0100 Subject: Add profile+bashrc --- bash/bashrc | 32 +++++++++++++++++++++++ bash/prompt | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 bash/bashrc create mode 100755 bash/prompt (limited to 'bash') diff --git a/bash/bashrc b/bash/bashrc new file mode 100644 index 0000000..a4506c2 --- /dev/null +++ b/bash/bashrc @@ -0,0 +1,32 @@ +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +# history setup + +## append to the history file, don't overwrite it +shopt -s histappend + +## no dups+skip space-prefixed commands +HISTCONTROL=ignoreboth +HISTFILE=~/.local/var/bash/history +HISTSIZE=65536 + +# activate lesspipe +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# ls colors +if [ -x /usr/bin/dircolors ]; then + eval "`dircolors -b`" + alias ls='ls --color=auto' +fi + +# disable flow control +# XXX should this be here? +stty -ixon + +# define the prompt +. ~/.config/bash/prompt +PS1=$(__prompt_func) diff --git a/bash/prompt b/bash/prompt new file mode 100755 index 0000000..8651b6b --- /dev/null +++ b/bash/prompt @@ -0,0 +1,86 @@ +[ -r /usr/lib/git-core/git-sh-prompt ] && . /usr/lib/git-core/git-sh-prompt + +# define a fallback for __git_ps1 if git is not installed +if [ "x$(type -t __git_ps1)" != "xfunction" ]; then + __git_ps1() { + echo "" + } +fi + +__prompt_func() { + ################################################ + # THERE SHOULD BE NO NEED TO EDIT THIS SECTION # + ################################################ + + #$normal will reset the colour to the default, use it to stop using a certain colour (see "prompt parts") + local normal="\[\e[0m\]" + + # # # # # # # + #BACKGROUNDS + # # # # # # # + local blackbg=";40m\]" + local redbg=";41m\]" + local greenbg=";42m\]" + local brownbg=";43m\]" + local bluebg=";44m\]" + local purplebg=";45m\]" + local cyanbg=";46m\]" + local greybg=";47m\]" + + ############################################################################################ + # THERE SHOULD BE NO NEED TO EDIT THIS SECTION (UNLESS YOU DO NOT WANT A BLACK BACKGROUND) # + ############################################################################################ + # # # # # # # + #FOREGROUNDS + # # # # # # # + local black="\[\e[0;30$blackbg" + local redfaint="\[\e[0;31$blackbg" + local greenfaint="\[\e[0;32$blackbg" + local brownfaint="\[\e[0;33$blackbg" + local bluefaint="\[\e[0;34$blackbg" + local purplefaint="\[\e[0;35$blackbg" + local cyanfaint="\[\e[0;36$blackbg" + local greyfaint="\[\e[0;37$blackbg" + + local grey="\[\e[1;30$blackbg" + local red="\[\e[1;31$blackbg" + local green="\[\e[1;32$blackbg" + local yellow="\[\e[1;33$blackbg" + local blue="\[\e[1;34$blackbg" + local pink="\[\e[1;35$blackbg" + local cyan="\[\e[1;36$blackbg" + local white="\[\e[1;37$blackbg" + + ################################## + # EDIT THIS STUFF TO YOUR LIKING # + ################################## + # # # # # # # + #PROMPT PARTS + # # # # # # # + local prompt_opening_brace="$cyan[$normal" + local prompt_closing_brace="$cyan]$normal" + + local prompt_date="\d" + local prompt_hostname_short="$blue\h$normal" + local prompt_hostname_long="\H" + local prompt_jobs="\j" + local prompt_terminal="\l" + local prompt_shellname="\s" + local prompt_time_24="\t" + local prompt_time_12="\T" + local prompt_time_12_am_pm="\@" + local prompt_username="$greenfaint\u$normal" + local prompt_version="\v" + local prompt_version_patchlevel="\V" + local prompt_pwd_long="$cyanfaint\w$normal" + local prompt_pwd_short="$red\W$normal" + local prompt_history_number="\!" + local prompt_session_number="\#" + local prompt_usertype_sign="\\$" + local prompt_git_branch="$white\$(__git_ps1)$normal" + + # # # # # # # # + #FINAL PROMPT + # # # # # # # # + echo -n "$prompt_opening_brace $prompt_username@$prompt_hostname_short $prompt_pwd_long$prompt_git_branch$prompt_closing_brace$prompt_usertype_sign " +} -- cgit v1.2.3