1.0.0 - Remade structure for GNU Stow

This commit is contained in:
2020-09-30 10:39:09 +02:00
parent d5c2147ed1
commit af44571593
766 changed files with 131648 additions and 18 deletions

63
bash/.bash_profile Normal file
View File

@@ -0,0 +1,63 @@
# Add `~/bin` to the `$PATH`
export PATH="$HOME/bin:$PATH";
# Load the shell dotfiles, and then some:
# * ~/.path can be used to extend `$PATH`.
# * ~/.extra can be used for other settings you dont want to commit.
for file in ~/.{path,bash_prompt,exports,aliases,functions,extra}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file";
done;
unset file;
# Case-insensitive globbing (used in pathname expansion)
shopt -s nocaseglob;
# Append to the Bash history file, rather than overwriting it
shopt -s histappend;
# Autocorrect typos in path names when using `cd`
shopt -s cdspell;
# Enable some Bash 4 features when possible:
# * `autocd`, e.g. `**/qux` will enter `./foo/bar/baz/qux`
# * Recursive globbing, e.g. `echo **/*.txt`
for option in autocd globstar; do
shopt -s "$option" 2> /dev/null;
done;
# timestamps for later analysis. www.debian-administration.org/users/rossen/weblog/1
export HISTTIMEFORMAT='%F %T '
# keep history up to date, across sessions, in realtime
# http://unix.stackexchange.com/a/48113
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
export HISTSIZE=100000 # big big history (default is 500)
export HISTFILESIZE=$HISTSIZE # big big history
which shopt > /dev/null 2>&1 && shopt -s histappend # append to history, don't overwrite it
# ^ the only downside with this is [up] on the readline will go over all history not just this bash session.
# Save and reload the history after each command finishes
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
# mc theme
export MC_SKIN=$HOME/.mc/solarized.ini
# Add tab completion for many Bash commands
if [ -f "$HOME/usr/share/bash-completion" ]; then
source "$HOME/usr/share/bash-completion";
fi;
# Enable tab completion for `g` by marking it as an alias for `git`
if type _git &> /dev/null && [ -f "$HOME/usr/etc/bash_completion.d/git-completion.bash" ]; then
complete -o default -o nospace -F _git g;
fi;
# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards
[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2- | tr ' ' '\n')" scp sftp ssh;
[ -e "$HOME/.z.sh" ] && . $HOME/.z.sh
true

42
bash/.bash_prompt Normal file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/env bash
prompt_git_and_status() {
local ps1_exit=$?
local s='';
local branchName='';
if [ $ps1_exit -eq 0 ]; then
ps1_status="${3}"
else
ps1_status="${4}"
fi
# Check if the current directory is in a Git repository.
if [ $(git rev-parse --is-inside-work-tree &>/dev/null; echo "${?}") == '0' ]; then
dirty=$(git diff --quiet --ignore-submodules HEAD &>/dev/null; [ $? -eq 1 ]&& echo -e "*")
branchName=`git symbolic-ref -q --short HEAD`
printf "%s" "${1}${branchName}${2}${dirty} "
fi;
printf "%s" "${ps1_status}\$"
}
# Set the terminal title to the current working directory.
PS1="\[\033]0;\W\007\]"; # working directory base name
#PS1+="\[${bold}\]";
#PS1+="\[${userStyle}\]\u"; # username
#PS1+="\[${white}\]@";
#PS1+="\[${hostStyle}\]\h"; # host
#PS1+="\[${white}\] : ";
PS1+="\[${green}\]\w"; # working directory full path
PS1+="\$(prompt_git_and_status \"\[${white}\] on \[${violet}\]\" \"\[${blue}\]\" \"\[${white}\]\" \"\[${red}\]\")"; # Git repository details and $
PS1+=" \[${reset}\]"; # and reset color
export PS1;
PS2="\[${yellow}\]→ \[${reset}\]";
export PS2;
# hack: fix slow startup of mc
alias mc="PS1= PROMPT_COMMAND= mc"

6
bash/.bashrc Normal file
View File

@@ -0,0 +1,6 @@
if [ -n "$PS1" ]
then
source ~/.bash_profile;
else
[ -r ~/.path ] && [ -f ~/.path ] && source ~/.path;
fi