Mercurial > dotfiles
annotate dot_bashrc @ 787:489b44423527
feat: add tcl treesitter
author | zegervdv <zegervdv@me.com> |
---|---|
date | Sat, 06 May 2023 17:01:46 +0200 |
parents | 36ba70d17fd6 |
children |
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 | |
475
6788bd8d86c5
Disable hyperlinks in ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
467
diff
changeset
|
16 alias ls="ls" |
6788bd8d86c5
Disable hyperlinks in ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
467
diff
changeset
|
17 alias ll="ls -lAvhtr --color" |
257 | 18 alias l=ll |
19 alias fgrep='fgrep -nrI --color --exclude-dir=.hg --exclude=*.log --exclude=*.dup --exclude=*.orig --exclude=transcript --exclude=tags --exclude=Session.vim' | |
20 alias xclip='xclip -selection clipboard' | |
21 alias mvim=gvim | |
22 | |
23 export HISTCONTROL=erasedups | |
24 export HISTSIZE=10000 | |
25 export HISTFILESIZE=20000 | |
26 shopt -s histappend | |
27 shopt -s cmdhist | |
28 export HISTINGORE="pwd:ls:history" | |
29 | |
258 | 30 export XDG_CONFIG_HOME=$HOME/.config |
31 | |
257 | 32 PATH=$HOME/bin:$PATH |
294 | 33 PATH=$HOME/.cargo/bin:$PATH |
314
205d82eb93b4
Add local installs to path
Zeger Van de Vannet <zegervdv@me.com>
parents:
294
diff
changeset
|
34 PATH=$HOME/.local/bin:$PATH |
436
cf524a68bebc
Add local-global npm install folder to path
Zeger Van de Vannet <zegervdv@me.com>
parents:
351
diff
changeset
|
35 PATH=$HOME/.npm-global/bin:$PATH |
257 | 36 |
37 cd_func () | |
38 { | |
39 local x2 the_new_dir adir index | |
40 local -i cnt | |
41 | |
42 if [[ $1 == "--" ]]; then | |
43 dirs -v | |
44 return 0 | |
45 fi | |
46 | |
47 the_new_dir=$1 | |
48 [[ -z $1 ]] && the_new_dir=$HOME | |
49 | |
50 if [[ ${the_new_dir:0:1} == '-' ]]; then | |
51 # | |
52 # Extract dir N from dirs | |
53 index=${the_new_dir:1} | |
54 [[ -z $index ]] && index=1 | |
55 adir=$(dirs +$index) | |
56 [[ -z $adir ]] && return 1 | |
57 the_new_dir=$adir | |
58 fi | |
59 | |
60 # | |
61 # '~' has to be substituted by ${HOME} | |
62 [[ ${the_new_dir:0:1} == '~' ]] && the_new_dir="${HOME}${the_new_dir:1}" | |
63 | |
64 # | |
65 # Now change to the new dir and add to the top of the stack | |
66 pushd "${the_new_dir}" > /dev/null | |
67 [[ $? -ne 0 ]] && return 1 | |
68 the_new_dir=$(pwd) | |
69 | |
70 # | |
71 # Trim down everything beyond 11th entry | |
72 popd -n +11 2>/dev/null 1>/dev/null | |
73 | |
74 # | |
75 # Remove any other occurence of this dir, skipping the top of the stack | |
76 for ((cnt=1; cnt <= 10; cnt++)); do | |
77 x2=$(dirs +${cnt} 2>/dev/null) | |
78 [[ $? -ne 0 ]] && return 0 | |
79 [[ ${x2:0:1} == '~' ]] && x2="${HOME}${x2:1}" | |
80 if [[ "${x2}" == "${the_new_dir}" ]]; then | |
81 popd -n +$cnt 2>/dev/null 1>/dev/null | |
82 cnt=cnt-1 | |
83 fi | |
84 done | |
85 | |
86 return 0 | |
87 } | |
88 | |
89 cd_min () { | |
90 cd -$1 | |
91 } | |
92 | |
93 _cd_min() { | |
94 local cur opts | |
95 cur="${COMP_WORDS[COMP_CWORD]}" | |
96 opts=$(dirs -v) | |
97 COMPREPLY=($(compgen -W "${opts}" --${cur})) | |
98 } | |
99 complete -F _cd_min cd_min | |
100 | |
101 alias cd=cd_func | |
102 | |
103 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' | |
104 | |
105 export EDITOR=nvim | |
106 export HGEDITOR=nvim | |
107 | |
504 | 108 export RIPGREP_CONFIG_PATH=$HOME/.config/ripgrep/ripgreprc |
506 | 109 export BAT_CONFIG_PATH=$HOME/.config/bat/config |
504 | 110 |
257 | 111 stty > /dev/null |
112 | |
113 # Options | |
114 shopt -s globstar | |
115 shopt -s autocd | |
116 shopt -s cdspell | |
117 shopt -s dirspell | |
118 shopt -s histverify | |
119 shopt -s nocaseglob | |
291
450e01f9d3bd
Use direxpand to expand variables into paths on tab
zegervdv <zegervdv@me.com>
parents:
259
diff
changeset
|
120 shopt -s direxpand |
257 | 121 |
122 set -o vi | |
123 | |
124 # Load mercurial autocompletion | |
125 if [ -f /etc/bash_completion ]; then | |
126 source /etc/bash_completion | |
127 fi | |
128 | |
129 | |
130 [ -f ~/.fzf.bash ] && source ~/.fzf.bash | |
131 export FZF_DEFAULT_COMMAND='ag -g ""' | |
132 source ~/.config/bash/fzf_aliases | |
133 | |
134 | |
135 export NVM_DIR="$HOME/.nvm" | |
136 [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
137 [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
138 | |
139 [ -f ~/.bashrc.local ] && source ~/.bashrc.local | |
351
7838713fd3b4
Add color configuration for ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
314
diff
changeset
|
140 |
491
f1d1eab204aa
Fix paths to nvim for SUDO_EDITOR
zegervdv <zegervdv@me.com>
parents:
490
diff
changeset
|
141 # Must run after local paths are added |
f1d1eab204aa
Fix paths to nvim for SUDO_EDITOR
zegervdv <zegervdv@me.com>
parents:
490
diff
changeset
|
142 export SUDO_EDITOR=$(which nvim) |
f1d1eab204aa
Fix paths to nvim for SUDO_EDITOR
zegervdv <zegervdv@me.com>
parents:
490
diff
changeset
|
143 |
351
7838713fd3b4
Add color configuration for ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
314
diff
changeset
|
144 if [ ! -f ~/.lscolors.parsed.sh ]; then |
7838713fd3b4
Add color configuration for ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
314
diff
changeset
|
145 echo 'Generating ls colors' |
7838713fd3b4
Add color configuration for ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
314
diff
changeset
|
146 dircolors --sh ~/.lscolors > ~/.lscolors.parsed.sh |
7838713fd3b4
Add color configuration for ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
314
diff
changeset
|
147 fi |
7838713fd3b4
Add color configuration for ls
Zeger Van de Vannet <zegervdv@me.com>
parents:
314
diff
changeset
|
148 source ~/.lscolors.parsed.sh |