Created
January 29, 2020 02:29
-
-
Save szg251/c5811f96799ac16fa233375a0fde4028 to your computer and use it in GitHub Desktop.
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
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
restore_prompt_after_nix_shell() { | |
if [ "$PS1" != "$NIX_PROMPT" ]; then | |
PS1=$NIX_PROMPT | |
PROMPT_COMMAND="" | |
fi | |
} | |
NIX_PROMPT="\e[1;33m[λ \w/ $(parse_git_branch)]\e[00m " | |
BASH_PROMPT="\e[1;31mbash \w/ \e[33m$(parse_git_branch)\e[00m " | |
if [[ -n "$IN_NIX_SHELL" && "$IN_NIX_SHELL" != "pure" ]]; then | |
# fzf | |
if [[ "$IN_NIX_SHELL" != "pure" ]]; then | |
test -e "$HOME/.fzf-key-bindings.bash" && source "$HOME/.fzf-key-bindings.bash" | |
fi | |
# bash-completion | |
test -f "/nix/store/znggj81iiaz5rgfd4y016908yvniy479-bash-completion-2.9/share/bash-completion/bash_completion" && source "/nix/store/znggj81iiaz5rgfd4y016908yvniy479-bash-completion-2.9/share/bash-completion/bash_completion" | |
# custom prompt | |
PROMPT_COMMAND=restore_prompt_after_nix_shell | |
export PS1=$NIX_PROMPT | |
elif [[ -z "$IN_NIX_SHELL" && "$0" == "bash" ]]; then | |
#fzf | |
test -e "$HOME/.fzf-key-bindings.bash" && source "$HOME/.fzf-key-bindings.bash" | |
# bash-completion | |
test -f "/nix/store/znggj81iiaz5rgfd4y016908yvniy479-bash-completion-2.9/share/bash-completion/bash_completion" && source "/nix/store/znggj81iiaz5rgfd4y016908yvniy479-bash-completion-2.9/share/bash-completion/bash_completion" | |
export PS1=$BASH_PROMPT | |
fi | |
export NIX_IGNORE_SYMLINK_STORE=1 | |
alias oni2='/Applications/Onivim2.app/Contents/MacOS/Oni2' | |
alias vim=nvim | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment