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.

71 lines
2.8 KiB

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
# Show all colors:
# https://askubuntu.com/a/1309434
# for colour in {1..225}; do echo -en "\033[38;5;${colour}m38;5;${colour} \n"; done | column -x
# Powerline prompts require a powerline (PL) supporting font such as Microsoft's Cascadia/Cascadia Code
# https://github.com/microsoft/cascadia-code
# POWERLINE PROMPTS
# HOSTTEXT=HOST TEXT COLOR
# USERTEXT=USER TEXT COLOR # NOT IMPLEMENTED
# COLORA = PATH BACKGROUND
# COLORB = PATH TEXT COLOR
# COLORC = HOST BACKGROUND
# COLORD = USER BACKGROUND
## RED
#hosttext="5;15m";colora="5;203m"; colorb="5;15m"; colorc="5;124m"; colord="5;160m"
## BLUE
#hosttext="5;15m";colora="5;250m"; colorb="5;15m"; colorc="5;27m"; colord="5;39m"
## GREEN
#hosttext="5;15m"; colora="5;15m"; colorb="5;00m"; colorc="5;22m"; colord="5;28m"
## BEACHY
hosttext="5;15m"; colora="5;250m"; colorb="5;00m"; colorc="5;214m"; colord="5;39m"
## ORANGE
#hosttext="5;15m"; colora="5;15m"; colorb="5;00m"; colorc="5;214m"; colord="5;220m"
## DARK
#hosttext="5;15m"; colora="5;250m"; colorb="5;00m"; colorc="5;234m"; colord="5;239m"
## PORMPT MAGIX
_me=`/bin/whoami`
[ "$_me" == "root" ] && _home=/root || _home=/home/$_me
resetpl="\[\033[00m\]"
promptfg="\[\033[38;${hosttext}\]"
pathfg="\[\033[38;${colorb}\]"
hostbg="\[\033[48;${colorc}\]"
hostuserpl="\[\033[48;${colord}\]\[\033[38;${colorc}\]"
userpathpl="\[\033[48;${colora}\]\[\033[38;${colord}\]"
pathpromptpl="${resetpl}\[\033[38;${colora}\]"
PROMPT_COMMAND='_dir=`pwd | sed "s|^$_home|~|g"`;if [ ${#_dir} -ge 35 ]; then _mydir=`pwd | cut -c1-16`; _mydir=${_mydir}.../`pwd | rev | cut -d/ -f1 | rev`; else _mydir=`pwd`; fi; _mydir=`echo $_mydir | sed "s|^$_home|~|g"`; PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}${hostbg}${promptfg}\h${hostuserpl}${promptfg}\u${userpathpl}${pathfg}${_mydir}${resetpl}${pathpromptpl}${resetpl} "'
# https://stackoverflow.com/a/19152051 (for pipes in sed ^^)
# Useful for WSL to open windows file explorer in the current directory (e.g. explorer .)
alias explorer="explorer.exe"