Mercurial > dotfiles
annotate dot_bashrc @ 319:b93f12d23fbd
Rename init.lua to config.lua
init.lua is now automatically sourced, and runs before init.vim causing
issues like lspconfig that cannot be found.
Renaming to something that will not be sourced automatically and
manually load it from init.vim when all plugins are loaded
author | Zeger Van de Vannet <zegervdv@me.com> |
---|---|
date | Thu, 17 Dec 2020 17:49:14 +0100 |
parents | 205d82eb93b4 |
children | 7838713fd3b4 |
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 |
314
205d82eb93b4
Add local installs to path
Zeger Van de Vannet <zegervdv@me.com>
parents:
294
diff
changeset
|
33 PATH=$HOME/.local/bin:$PATH |
257 | 34 |
35 cd_func () | |
36 { | |
37 local x2 the_new_dir adir index | |
38 local -i cnt | |
39 | |
40 if [[ $1 == "--" ]]; then | |
41 dirs -v | |
42 return 0 | |
43 fi | |
44 | |
45 the_new_dir=$1 | |
46 [[ -z $1 ]] && the_new_dir=$HOME | |
47 | |
48 if [[ ${the_new_dir:0:1} == '-' ]]; then | |
49 # | |
50 # Extract dir N from dirs | |
51 index=${the_new_dir:1} | |
52 [[ -z $index ]] && index=1 | |
53 adir=$(dirs +$index) | |
54 [[ -z $adir ]] && return 1 | |
55 the_new_dir=$adir | |
56 fi | |
57 | |
58 # | |
59 # '~' has to be substituted by ${HOME} | |
60 [[ ${the_new_dir:0:1} == '~' ]] && the_new_dir="${HOME}${the_new_dir:1}" | |
61 | |
62 # | |
63 # Now change to the new dir and add to the top of the stack | |
64 pushd "${the_new_dir}" > /dev/null | |
65 [[ $? -ne 0 ]] && return 1 | |
66 the_new_dir=$(pwd) | |
67 | |
68 # | |
69 # Trim down everything beyond 11th entry | |
70 popd -n +11 2>/dev/null 1>/dev/null | |
71 | |
72 # | |
73 # Remove any other occurence of this dir, skipping the top of the stack | |
74 for ((cnt=1; cnt <= 10; cnt++)); do | |
75 x2=$(dirs +${cnt} 2>/dev/null) | |
76 [[ $? -ne 0 ]] && return 0 | |
77 [[ ${x2:0:1} == '~' ]] && x2="${HOME}${x2:1}" | |
78 if [[ "${x2}" == "${the_new_dir}" ]]; then | |
79 popd -n +$cnt 2>/dev/null 1>/dev/null | |
80 cnt=cnt-1 | |
81 fi | |
82 done | |
83 | |
84 return 0 | |
85 } | |
86 | |
87 cd_min () { | |
88 cd -$1 | |
89 } | |
90 | |
91 _cd_min() { | |
92 local cur opts | |
93 cur="${COMP_WORDS[COMP_CWORD]}" | |
94 opts=$(dirs -v) | |
95 COMPREPLY=($(compgen -W "${opts}" --${cur})) | |
96 } | |
97 complete -F _cd_min cd_min | |
98 | |
99 alias cd=cd_func | |
100 | |
101 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' | |
102 | |
103 export EDITOR=nvim | |
104 export HGEDITOR=nvim | |
105 | |
106 stty > /dev/null | |
107 | |
108 # Options | |
109 shopt -s globstar | |
110 shopt -s autocd | |
111 shopt -s cdspell | |
112 shopt -s dirspell | |
113 shopt -s histverify | |
114 shopt -s nocaseglob | |
291
450e01f9d3bd
Use direxpand to expand variables into paths on tab
zegervdv <zegervdv@me.com>
parents:
259
diff
changeset
|
115 shopt -s direxpand |
257 | 116 |
117 set -o vi | |
118 | |
119 # Load mercurial autocompletion | |
120 if [ -f /etc/bash_completion ]; then | |
121 source /etc/bash_completion | |
122 fi | |
123 | |
124 | |
125 [ -f ~/.fzf.bash ] && source ~/.fzf.bash | |
126 export FZF_DEFAULT_COMMAND='ag -g ""' | |
127 source ~/.config/bash/fzf_aliases | |
128 | |
129 | |
130 export NVM_DIR="$HOME/.nvm" | |
131 [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
132 [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
133 | |
134 [ -f ~/.bashrc.local ] && source ~/.bashrc.local |