Welcome fleshlings! You'll find things like my dotfiles and some of my scripts or programs that I'd like to showcase. I hope you enjoy your stay!
These dotfiles has configuration files for:
The repository of these dotfiles can be found over on Github
To easily bootstrap my dotfiles, you can use one of these one liners using the terminal/TTY:
curl -s -L https://smeueg.github.io/smeueger -o /tmp/smeueger && sh /tmp/smeueger
Or if you don't have curl installed but instead have wget:
wget -q https://smeueg.github.io/smeueger -O /tmp/smeueger && sh /tmp/smeueger
There are amazing prompts out there for your shell like Starship,
Spaceship, and etc...
But, you can also make your own prompt just the way you would like it. It's as simple as making a
shell
function and setting that to the PS1
variable. Example:
# In ~/.bashrc
prompt() {
ret=${?} # Store return code
printf '\001\033[1;33m\002%s\n' "${PWD}" | sed "s|${HOME}|~|"
if [ ${ret} -eq 0 ]; then
printf '\001\033[1;32m\002' # If ret = 0 (success) then print green
else
printf '\001\033[1;31m\002' # Else (failed) then print red
fi
printf '> \001\033[0m\002'
}
export PS1="\$(prompt)"
Output:
~/Projects/ytpl-sync
>
Do keep in mind that in bash
specifically, you need to put \001
and \002
around every ansi-escape sequences. In zsh
it would be
%{
and %}
instead. Of course you can also add other information
like time, the hostname, the current git branch (if you're in a git repo), etc. As long as
that information can be gotten using a simple shell script, you can display that in the
prompt. For example, if you want to add the current git repo:
# In ~/.bashrc
prompt() {
ret=${?} # Store return code
printf '\001\033[1;33m\002%s' "${PWD}" | sed "s|${HOME}|~|"
branch=$(git branch | grep "^*" | sed "s/* \(.*\)/\1/")
[ "${branch}" ] && printf ' [ \001\033[1;32m\002%s\001\033[0m\002 ]\n' "${branch}"
if [ ${ret} -eq 0 ]; then
printf '\001\033[1;32m\002' # If ret = 0 (success) then print green
else
printf '\001\033[1;31m\002' # Else (failed) then print red
fi
printf '> \001\033[0m\002'
}
export PS1="\$(prompt)"
Output:
~/Projects/ytpl-sync [ main ]
>