Mercurial > dotfiles
annotate dot_bashrc @ 294:8651c133a990
Add cargo bin folder to path
author | zegervdv <zegervdv@me.com> |
---|---|
date | Wed, 04 Nov 2020 17:41:57 +0100 |
parents | 450e01f9d3bd |
children | 205d82eb93b4 |
rev | line source |
---|---|
259 | 1 # vim:ft=bash |
257 | 2 export TERM=xterm-256color |
3 export SHELL=bash | |
4 | |
5 prompt_env() { | |
6 prompt_jobs=$(jobs | wc -l) | |
7 prompt_branch=$(hg branch 2> /dev/null | awk -- '{print "on "$1}') | |
8 | |
259 | 9 PS1="\[\e[36m\]\A \[\e[1;34m\]\[\e[31m\]\H\[\e[1;34m\] \w\[\e[0m\] \[\e[32m\]$prompt_branch\[\e[0m\]\n$prompt_jobs > \[\e[0m\]" |
257 | 10 } |
11 | |
12 PROMPT_COMMAND=prompt_env | |
259 | 13 PS1="\[\e[36m\]\A \[\e[1;34m\]\[\e[31m\]\H\[\e[1;34m\] \w\[\e[0m\] \[\e[32m\]$prompt_branch\[\e[0m\]\n$prompt_jobs > \[\e[0m\]" |
257 | 14 |
15 | |
16 alias ll="ls -lAvhtr --color" | |
17 alias l=ll | |
18 alias fgrep='fgrep -nrI --color --exclude-dir=.hg --exclude=*.log --exclude=*.dup --exclude=*.orig --exclude=transcript --exclude=tags --exclude=Session.vim' | |
19 alias xclip='xclip -selection clipboard' | |
20 alias mvim=gvim | |
21 | |
22 export HISTCONTROL=erasedups | |
23 export HISTSIZE=10000 | |
24 export HISTFILESIZE=20000 | |
25 shopt -s histappend | |
26 shopt -s cmdhist | |
27 export HISTINGORE="pwd:ls:history" | |
28 | |
258 | 29 export XDG_CONFIG_HOME=$HOME/.config |
30 | |
257 | 31 PATH=$HOME/bin:$PATH |
294 | 32 PATH=$HOME/.cargo/bin:$PATH |
257 | 33 |
34 cd_func () | |
35 { | |
36 local x2 the_new_dir adir index | |
37 local -i cnt | |
38 | |
39 if [[ $1 == "--" ]]; then | |
40 dirs -v | |
41 return 0 | |
42 fi | |
43 | |
44 the_new_dir=$1 | |
45 [[ -z $1 ]] && the_new_dir=$HOME | |
46 | |
47 if [[ ${the_new_dir:0:1} == '-' ]]; then | |
48 # | |
49 # Extract dir N from dirs | |
50 index=${the_new_dir:1} | |
51 [[ -z $index ]] && index=1 | |
52 adir=$(dirs +$index) | |
53 [[ -z $adir ]] && return 1 | |
54 the_new_dir=$adir | |
55 fi | |
56 | |
57 # | |
58 # '~' has to be substituted by ${HOME} | |
59 [[ ${the_new_dir:0:1} == '~' ]] && the_new_dir="${HOME}${the_new_dir:1}" | |
60 | |
61 # | |
62 # Now change to the new dir and add to the top of the stack | |
63 pushd "${the_new_dir}" > /dev/null | |
64 [[ $? -ne 0 ]] && return 1 | |
65 the_new_dir=$(pwd) | |
66 | |
67 # | |
68 # Trim down everything beyond 11th entry | |
69 popd -n +11 2>/dev/null 1>/dev/null | |
70 | |
71 # | |
72 # Remove any other occurence of this dir, skipping the top of the stack | |
73 for ((cnt=1; cnt <= 10; cnt++)); do | |
74 x2=$(dirs +${cnt} 2>/dev/null) | |
75 [[ $? -ne 0 ]] && return 0 | |
76 [[ ${x2:0:1} == '~' ]] && x2="${HOME}${x2:1}" | |
77 if [[ "${x2}" == "${the_new_dir}" ]]; then | |
78 popd -n +$cnt 2>/dev/null 1>/dev/null | |
79 cnt=cnt-1 | |
80 fi | |
81 done | |
82 | |
83 return 0 | |
84 } | |
85 | |
86 cd_min () { | |
87 cd -$1 | |
88 } | |
89 | |
90 _cd_min() { | |
91 local cur opts | |
92 cur="${COMP_WORDS[COMP_CWORD]}" | |
93 opts=$(dirs -v) | |
94 COMPREPLY=($(compgen -W "${opts}" --${cur})) | |
95 } | |
96 complete -F _cd_min cd_min | |
97 | |
98 alias cd=cd_func | |
99 | |
100 alias psm='/bin/ps -u $USER --sort pgid,time,size,time,pcpu -o pid,pgid,state,user,start_time,time,size:9,pcpu,command --forest' | |
101 | |
102 export EDITOR=nvim | |
103 export HGEDITOR=nvim | |
104 | |
105 stty > /dev/null | |
106 | |
107 # Options | |
108 shopt -s globstar | |
109 shopt -s autocd | |
110 shopt -s cdspell | |
111 shopt -s dirspell | |
112 shopt -s histverify | |
113 shopt -s nocaseglob | |
291
450e01f9d3bd
Use direxpand to expand variables into paths on tab
zegervdv <zegervdv@me.com>
parents:
259
diff
changeset
|
114 shopt -s direxpand |
257 | 115 |
116 set -o vi | |
117 | |
118 # Load mercurial autocompletion | |
119 if [ -f /etc/bash_completion ]; then | |
120 source /etc/bash_completion | |
121 fi | |
122 | |
123 | |
124 [ -f ~/.fzf.bash ] && source ~/.fzf.bash | |
125 export FZF_DEFAULT_COMMAND='ag -g ""' | |
126 source ~/.config/bash/fzf_aliases | |
127 | |
128 | |
129 export NVM_DIR="$HOME/.nvm" | |
130 [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
131 [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
132 | |
133 [ -f ~/.bashrc.local ] && source ~/.bashrc.local |