Mercurial > repos > other > linux
annotate bashrc @ 143:51d857786c5a
Switch to using "*" for "local changes" in hg prompt
This matches the Git prompt script
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 19 Jan 2020 10:57:21 +0000 |
parents | f5dd593cc018 |
children | 39abe6b6233f |
rev | line source |
---|---|
6
013543014cc9
Make sure we import a default bashrc file
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
1 if [ -f /etc/bashrc ]; then |
013543014cc9
Make sure we import a default bashrc file
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
2 . /etc/bashrc |
013543014cc9
Make sure we import a default bashrc file
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
3 fi |
013543014cc9
Make sure we import a default bashrc file
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
4 |
8 | 5 # Use bash-completion, if available |
6 if [ -f /etc/bash_completion ]; then | |
7 . /etc/bash_completion | |
8 fi | |
9 | |
20
ea572e660598
Fix Thunderbird dates and add more comments
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
10 # Use a sane editor |
0 | 11 export EDITOR=/usr/bin/nano |
24
acbc487533ab
Consistently fix Thunderbird time settings by moving some bits to profile, not bashrc
IBBoard <dev@ibboard.co.uk>
parents:
20
diff
changeset
|
12 |
47 | 13 # Set 256-colour terminal support |
51
6b1492d34562
Switch from xterm to screen to fix Nano scrolling
IBBoard <dev@ibboard.co.uk>
parents:
47
diff
changeset
|
14 export TERM="screen-256color" |
47 | 15 |
24
acbc487533ab
Consistently fix Thunderbird time settings by moving some bits to profile, not bashrc
IBBoard <dev@ibboard.co.uk>
parents:
20
diff
changeset
|
16 #Import aliases |
0 | 17 test -s ~/.alias && . ~/.alias || true |
20
ea572e660598
Fix Thunderbird dates and add more comments
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
18 |
ea572e660598
Fix Thunderbird dates and add more comments
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
19 # Add sbins to path to make life easier (e.g. /sbin/ifconfig) |
0 | 20 export PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH |
20
ea572e660598
Fix Thunderbird dates and add more comments
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
21 |
ea572e660598
Fix Thunderbird dates and add more comments
IBBoard <dev@ibboard.co.uk>
parents:
19
diff
changeset
|
22 #Disable man page number prompts - where there's more than one, we normally want the default (user command) version |
0 | 23 export MAN_POSIXLY_CORRECT=1 |
24 | |
19
170de0d0d6dd
Stop less creating a history file
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
25 #Disable less history, because do I really search the same things enough to use it across sessions? |
170de0d0d6dd
Stop less creating a history file
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
26 export LESSHISTFILE=- |
170de0d0d6dd
Stop less creating a history file
IBBoard <dev@ibboard.co.uk>
parents:
8
diff
changeset
|
27 |
24
acbc487533ab
Consistently fix Thunderbird time settings by moving some bits to profile, not bashrc
IBBoard <dev@ibboard.co.uk>
parents:
20
diff
changeset
|
28 export XDG_CACHE_HOME="$HOME/.cache" |
acbc487533ab
Consistently fix Thunderbird time settings by moving some bits to profile, not bashrc
IBBoard <dev@ibboard.co.uk>
parents:
20
diff
changeset
|
29 |
0 | 30 if [ "$PS1" != "" -a "${STARTED_TMUX:-x}" = x -a "${SSH_TTY:-x}" != x ] |
31 then | |
32 STARTED_TMUX=1; export STARTED_TMUX | |
33 sleep 1 | |
34 ( (tmux has-session -t remote && tmux attach-session -t remote) || (tmux new-session -s remote) ) && exit 0 | |
35 echo "tmux failed to start" | |
6
013543014cc9
Make sure we import a default bashrc file
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
36 fi |
27
c67aa2af6ff2
Switch to ibus, because it is simpler than uim but does XCompose
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
37 |
49
8f4076fd85a9
Export LS_OPTION from bashrc because profile doesn't seem to work on Tumbleweed
IBBoard <dev@ibboard.co.uk>
parents:
47
diff
changeset
|
38 export GTK_IM_MODULE=ibus |
56
3c48c5671f1a
Make the prompt more visible and fix "less" highlighting
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
39 export LS_OPTIONS="$LS_OPTIONS -p" |
3c48c5671f1a
Make the prompt more visible and fix "less" highlighting
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
40 |
64
39b07c5f8785
Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
41 function vcs_status { |
39b07c5f8785
Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
42 GIT_PS1_SHOWDIRTYSTATE=1 |
39b07c5f8785
Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
43 GIT_PS1_SHOWUPSTREAM=verbose |
39b07c5f8785
Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
44 . /etc/bash_completion.d/git-prompt.sh |
39b07c5f8785
Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
45 VCS_EXTRA=$(__git_ps1 "%s") |
39b07c5f8785
Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
46 |
39b07c5f8785
Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
47 if [[ "x$VCS_EXTRA" == "x" ]]; then |
138 | 48 VCS_EXTRA=$(hg prompt "{branch}{ {status|modified}}" 2>/dev/null) |
69
78b4a74a5452
Fix mercurial status spacing, make it show like Git
IBBoard <dev@ibboard.co.uk>
parents:
67
diff
changeset
|
49 HG_EXTRA=$(hg prompt "{-{incoming|count}}{+{outgoing|count}}" 2>/dev/null) |
78b4a74a5452
Fix mercurial status spacing, make it show like Git
IBBoard <dev@ibboard.co.uk>
parents:
67
diff
changeset
|
50 if [[ "x$HG_EXTRA" != "x" ]]; then |
78b4a74a5452
Fix mercurial status spacing, make it show like Git
IBBoard <dev@ibboard.co.uk>
parents:
67
diff
changeset
|
51 VCS_EXTRA="${VCS_EXTRA} u${HG_EXTRA}" |
140
f5dd593cc018
Only show "u=" for hg when we're in a VCS'd directory
IBBoard <dev@ibboard.co.uk>
parents:
138
diff
changeset
|
52 elif [[ "x$VCS_EXTRA" != "x" ]]; then |
138 | 53 VCS_EXTRA="${VCS_EXTRA} u=" |
69
78b4a74a5452
Fix mercurial status spacing, make it show like Git
IBBoard <dev@ibboard.co.uk>
parents:
67
diff
changeset
|
54 fi |
64
39b07c5f8785
Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
55 fi |
39b07c5f8785
Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
56 if [[ "x$VCS_EXTRA" != "x" ]]; then |
66
091d9fc4698b
Limit path length and fix a colouring/wrapping bug that it highlighted
IBBoard <dev@ibboard.co.uk>
parents:
64
diff
changeset
|
57 echo -n " ($VCS_EXTRA)" |
64
39b07c5f8785
Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
58 fi |
39b07c5f8785
Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
59 } |
39b07c5f8785
Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
60 |
66
091d9fc4698b
Limit path length and fix a colouring/wrapping bug that it highlighted
IBBoard <dev@ibboard.co.uk>
parents:
64
diff
changeset
|
61 # Limit long paths |
091d9fc4698b
Limit path length and fix a colouring/wrapping bug that it highlighted
IBBoard <dev@ibboard.co.uk>
parents:
64
diff
changeset
|
62 PROMPT_DIRTRIM=2 |
56
3c48c5671f1a
Make the prompt more visible and fix "less" highlighting
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
63 # Bold the command prompt and standardise on SUSE format |
57
28317d15a4cf
Colourise prompt (PS1) based on Ubuntu default colours
IBBoard <dev@ibboard.co.uk>
parents:
56
diff
changeset
|
64 # With colour! |
70
3b6eae8d3801
Deal with spaces in current path when making $PS1
IBBoard <dev@ibboard.co.uk>
parents:
69
diff
changeset
|
65 export PS1='\[\033[01;38;5;34m\]\u\[\033[01;38;5;28m\]@\[\033[01;38;5;34m\]\h\[\033[39m\]:\[\033[01;38;5;26m\]\w$(test "$PWD" != / && echo -n /)\[\033[39m\]\[\033[01;38;5;247m\]$(vcs_status)\[\033[39m\]>\[\033[00m\] ' |
56
3c48c5671f1a
Make the prompt more visible and fix "less" highlighting
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
66 |
3c48c5671f1a
Make the prompt more visible and fix "less" highlighting
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
67 # Fix "less" highlighting |
59
2a3670fb2ef2
Improve highlighting background for "less"
IBBoard <dev@ibboard.co.uk>
parents:
57
diff
changeset
|
68 export LESS_TERMCAP_so=$'\033[30;48;5;247m' |
71
fed933b2b8f5
Fix Steam bug where overlay doesn't work
IBBoard <dev@ibboard.co.uk>
parents:
70
diff
changeset
|
69 export LESS_TERMCAP_se=$'\033[0m' |
fed933b2b8f5
Fix Steam bug where overlay doesn't work
IBBoard <dev@ibboard.co.uk>
parents:
70
diff
changeset
|
70 |
72
21d5b52ae36f
Configure default Go path to be sensible
IBBoard <dev@ibboard.co.uk>
parents:
71
diff
changeset
|
71 export GOPATH="$HOME/.golang" |
21d5b52ae36f
Configure default Go path to be sensible
IBBoard <dev@ibboard.co.uk>
parents:
71
diff
changeset
|
72 |
71
fed933b2b8f5
Fix Steam bug where overlay doesn't work
IBBoard <dev@ibboard.co.uk>
parents:
70
diff
changeset
|
73 # Possible fix for Steam - https://github.com/ValveSoftware/steam-for-linux/issues/5000#issuecomment-305937612 |
125
1320f85d46d2
Steam runtime libs variable seems unnecessary, so remove it
IBBoard <dev@ibboard.co.uk>
parents:
114
diff
changeset
|
74 #export STEAM_RUNTIME_PREFER_HOST_LIBRARIES=0 |
112
87de05d9f75f
Add hidden default R package path
IBBoard <dev@ibboard.co.uk>
parents:
72
diff
changeset
|
75 |
87de05d9f75f
Add hidden default R package path
IBBoard <dev@ibboard.co.uk>
parents:
72
diff
changeset
|
76 # Set a hidden R package directory |
114
ef4c3848be18
Make sure that we actually EXPORT the R lib path!
IBBoard <dev@ibboard.co.uk>
parents:
113
diff
changeset
|
77 export R_LIBS_USER=~/.R/ |
113
77768e1e9d49
Stop R prompting to save the workspace after each session
IBBoard <dev@ibboard.co.uk>
parents:
112
diff
changeset
|
78 # And stop it asking us to save the workspace |
127
724d0e149569
Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents:
125
diff
changeset
|
79 alias R='R --no-save' |
724d0e149569
Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents:
125
diff
changeset
|
80 |
724d0e149569
Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents:
125
diff
changeset
|
81 conda_activate() { |
724d0e149569
Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents:
125
diff
changeset
|
82 __conda_setup="$(~/.anaconda3/bin/conda 'shell.bash' 'hook' 2> /dev/null)" |
724d0e149569
Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents:
125
diff
changeset
|
83 if [ $? -eq 0 ]; then |
724d0e149569
Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents:
125
diff
changeset
|
84 eval "$__conda_setup" |
724d0e149569
Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents:
125
diff
changeset
|
85 else |
724d0e149569
Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents:
125
diff
changeset
|
86 if [ -f ~"/.anaconda3/etc/profile.d/conda.sh" ]; then |
724d0e149569
Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents:
125
diff
changeset
|
87 . ~"/.anaconda3/etc/profile.d/conda.sh" |
724d0e149569
Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents:
125
diff
changeset
|
88 else |
724d0e149569
Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents:
125
diff
changeset
|
89 export PATH=~"/.anaconda3/bin:$PATH" |
724d0e149569
Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents:
125
diff
changeset
|
90 fi |
724d0e149569
Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents:
125
diff
changeset
|
91 fi |
724d0e149569
Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents:
125
diff
changeset
|
92 unset __conda_setup |
131
5f6e4aa53501
Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents:
127
diff
changeset
|
93 |
5f6e4aa53501
Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents:
127
diff
changeset
|
94 if [ $# -eq 1 ]; then |
5f6e4aa53501
Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents:
127
diff
changeset
|
95 if [ "x$1" == "x." ]; then |
5f6e4aa53501
Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents:
127
diff
changeset
|
96 _conda_env=$(basename $(readlink -f .)) |
5f6e4aa53501
Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents:
127
diff
changeset
|
97 else |
5f6e4aa53501
Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents:
127
diff
changeset
|
98 _conda_env=$1 |
5f6e4aa53501
Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents:
127
diff
changeset
|
99 fi |
5f6e4aa53501
Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents:
127
diff
changeset
|
100 conda activate $_conda_env |
5f6e4aa53501
Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents:
127
diff
changeset
|
101 fi |
5f6e4aa53501
Let Conda activation use the local directory as a name
IBBoard <dev@ibboard.co.uk>
parents:
127
diff
changeset
|
102 unset _conda_env |
127
724d0e149569
Add a function for base Conda activation
IBBoard <dev@ibboard.co.uk>
parents:
125
diff
changeset
|
103 } |