shell: include git branch in PS1 , add ssh-agent and add rust
This commit is contained in:
parent
9c041754b7
commit
40dcc1b24d
@ -9,9 +9,36 @@ alias ls='ls --color=auto'
|
||||
alias la='ls --color=auto -plhA'
|
||||
alias grep='grep --color=auto'
|
||||
|
||||
PS1='\n\h \w\n\$ '
|
||||
parse_git_branch() {
|
||||
local b=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
|
||||
if [ "$b" != "" ]
|
||||
then
|
||||
git diff --cached --exit-code &> /dev/null || b="${b}+"
|
||||
git diff --exit-code &> /dev/null || b="${b}*"
|
||||
fi
|
||||
echo -n "$b"
|
||||
}
|
||||
# \e[0;$(e=$?;((e))&& echo "91" || echo "0"))m\]\$\[\e[0m\]
|
||||
PS1='\n\[\e[35m\]\h \[\e[32m\]\w \[\e[35m\]$(parse_git_branch)\[\e[0m\]\n$ '
|
||||
|
||||
export PATH="$PATH:$HOME/.local/bin"
|
||||
export EDITOR=vim
|
||||
export QSYS_ROOTDIR="$HOME/.local/intelFPGA_lite/18.1/quartus/sopc_builder/bin"
|
||||
. "$HOME/.cargo/env"
|
||||
|
||||
# start ssh-agent
|
||||
if [[ ! -f "$HOME/.ssh/agent.env" ]]
|
||||
then
|
||||
ssh-agent >"$HOME/.ssh/agent.env"
|
||||
else
|
||||
. "$HOME/.ssh/agent.env" >/dev/null
|
||||
ps -p $SSH_AGENT_PID >/dev/null || ssh-agent >"$HOME/.ssh/agent.env"
|
||||
fi
|
||||
. "$HOME/.ssh/agent.env"
|
||||
export SSH_AGENT_PID;
|
||||
export SSH_AUTH_SOCK;
|
||||
|
||||
# rust
|
||||
export RUSTUP_HOME="$HOME/.local/rust/rustup"
|
||||
export CARGO_HOME="$HOME/.local/rust/cargo"
|
||||
. $HOME/.local/rust/cargo
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user