forked from 0k/0k-charms
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.2 KiB
58 lines
1.2 KiB
#!/bin/bash
|
|
|
|
## Requires kal-script
|
|
|
|
|
|
##
|
|
## More shell configurations (prompt, functions)
|
|
##
|
|
|
|
mkdir -p /etc/prompt
|
|
|
|
cat <<EOF > /etc/prompt/prompt.1.rc
|
|
PROMPT_COMMAND=""
|
|
parse_git_branch() {
|
|
ref=\$(git symbolic-ref HEAD 2> /dev/null) || return
|
|
echo -en ' (\033[0;32m'\${ref#refs/heads/}'\033[0m)'
|
|
}
|
|
export PS1="\[\033[0;37m\][\[\033[1;30m\]\u\[\033[0;37m\]@\[\033[1;30m\]\H\[\033[0;37m\]]-[\[\033[1;34m\]\w\[\033[0;37m\]]\\\$(parse_git_branch)\n\[\033[1;37m\]\\$ \[\033[0;37m\]"
|
|
EOF
|
|
|
|
if [ -f /root/.bashrc.pre-install ]; then
|
|
cp /root/.bashrc.pre-install /root/.bashrc
|
|
else
|
|
cp /root/.bashrc /root/.bashrc.pre-install
|
|
fi
|
|
|
|
cat <<EOF >> /root/.bashrc
|
|
|
|
## History management
|
|
|
|
export HISTCONTROL=ignoredups
|
|
export HISTSIZE=50000
|
|
shopt -s histappend
|
|
PROMPT_COMMAND='history -a'
|
|
|
|
|
|
## Prompt easy management
|
|
|
|
prompt() {
|
|
prompt_name="prompt.\$1.rc"
|
|
|
|
for i in /etc/prompt ~/.prompt; do
|
|
[ -f "\$i/\$prompt_name" ] &&
|
|
. "\$i/\$prompt_name"
|
|
done
|
|
}
|
|
|
|
|
|
## Git log command
|
|
|
|
function glog() {
|
|
git log --graph --pretty=tformat:%C\(yellow\ normal\)%h%Creset\ %C\(blue\ normal\)%an%Creset\ %s\ %Cgreen%d%Creset -n 20 "\$@"
|
|
}
|
|
|
|
prompt 1
|
|
|
|
EOF
|
|
|