Last active
July 5, 2022 15:19
-
-
Save thautwarm/53ee8f8d5137955375cd3c3c1c8f392b to your computer and use it in GitHub Desktop.
msys2 on windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PYTHONIOENCODING=utf8 | |
# PROMPT_COMMAND="prompt-command" | |
# cache init | |
source activate base | |
if [[ -z "$my_pragma_once" ]]; then | |
source ~/.bashfiles/color.sh # available at https://gist.github.com/thautwarm/d43e17a6c2e48ac7d420281779e9399b | |
source "$(scoop prefix git)\etc\profile.d\git-prompt.sh" | |
source /usr/share/bash-completion/bash_completion | |
export PATH=$HOME/scoop/shims:$PATH | |
export my_pragma_once=1 | |
fi | |
HISTSIZE=100000 | |
HISTFILESIZE=200000 | |
HOME=~ | |
HISTFILE=~/.bashistory | |
bind 'set show-all-if-ambiguous on' | |
bind 'TAB:menu-complete' | |
bind '"\e[A": history-search-backward' | |
bind '"\e[B": history-search-forward' | |
bind '"\eOA": history-search-backward' | |
bind '"\eOB": history-search-forward' | |
function setup-bash-git(){ | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
git config --global core.editor "emacs" | |
git clone https://github.com/powerline/fonts.git --depth=1 | |
pacman -S make | |
# install | |
cd fonts | |
./install.sh | |
# git config --global core.editor "code --wait" | |
echo "Manually install Caskaydia Nerd fonts!" | |
} | |
STATUS_THEME_PROMPT_BAD="${bold_red}💢${reset_color}${normal} " | |
STATUS_THEME_PROMPT_OK="${bold_green}✅${reset_color}${normal} " | |
function mode-simple(){ | |
SIMPLE_PROMPT=1 | |
} | |
function mode-pretty(){ | |
SIMPLE_PROMPT= | |
} | |
function j(){ | |
cd "$(ajmp complete $@)" | |
} | |
function chpwd(){ | |
ajmp update "$PWD" | |
} | |
function prompt-command(){ | |
# record history | |
history -a | |
# apply chpwd | |
if [[ "$LASTWD" != "$PWD" ]]; then | |
chpwd | |
fi | |
LASTWD=$PWD | |
# set prompt status | |
if [ $? -eq 0 ] | |
then | |
my_status=" $STATUS_THEME_PROMPT_OK" | |
else | |
my_status=" $STATUS_THEME_PROMPT_BAD" | |
fi | |
# compute PS1 | |
local git_ps branch untracked dirty py | |
if [[ -z "$SIMPLE_PROMPT" ]]; then | |
if command -v python &> /dev/null | |
then | |
py=" ${blue} $(python --version | sed 's/[[:alpha:]|(|[:space:]]//g')${reset_color}" | |
fi | |
git rev-parse 2> /dev/null | |
if [[ $? -eq 0 ]]; then | |
branch=$(git branch 2>/dev/null | grep '*' | sed 's/* \(.*\)/\1/') | |
if [[ -n $(git status -s) ]]; then | |
untracked="${yellow}●${reset_color}" | |
fi | |
git diff --quiet || dirty="${red}✘${reset_color}" | |
git_ps=" ${cyan} (${branch}${reset_color}${dirty}${untracked}${cyan})${reset_color}" | |
fi | |
fi | |
PS1="\n${blue} \u ${reset_color}${yellow} \D{}${reset_color}${git_ps}${py}${my_status}${blue} \w\n ${normal}" | |
PS2=" " | |
} | |
export CLASSPATH=".:/usr/local/lib/antlr-4.9.2-complete.jar:$CLASSPATH" | |
alias antlr4='java -jar /usr/local/lib/antlr-4.9.2-complete.jar' | |
alias grun='java org.antlr.v4.gui.TestRig' | |
bind '"\C-H":backward-kill-word' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment