summaryrefslogtreecommitdiff
path: root/roles/shell/bash/templates
diff options
context:
space:
mode:
Diffstat (limited to 'roles/shell/bash/templates')
-rw-r--r--roles/shell/bash/templates/bash_profile.j24
-rw-r--r--roles/shell/bash/templates/bashrc.j220
2 files changed, 16 insertions, 8 deletions
diff --git a/roles/shell/bash/templates/bash_profile.j2 b/roles/shell/bash/templates/bash_profile.j2
index 8ffd818..4bcd09c 100644
--- a/roles/shell/bash/templates/bash_profile.j2
+++ b/roles/shell/bash/templates/bash_profile.j2
@@ -1,6 +1,8 @@
1# Some variables are loaded via pam (see .config/pam_environment) 1# Some variables are loaded via pam (see .config/pam_environment)
2# This file is loaded thanks to as line in /etc/profile
3# test "$BASH" && test -r "$XDG_CONFIG_HOME/bash/bash_profile" && . $XDG_CONFIG_HOME/bash/bash_profile
2 4
3[[ -f ~/.bashrc ]] && . ~/.bashrc 5[[ -f $XDG_CONFIG_HOME/bash/bashrc ]] && . $XDG_CONFIG_HOME/bash/bashrc
4{% if "graphical_vt" in features.get(profile, []) %} 6{% if "graphical_vt" in features.get(profile, []) %}
5 7
6if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then 8if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
diff --git a/roles/shell/bash/templates/bashrc.j2 b/roles/shell/bash/templates/bashrc.j2
index 08518c9..b717f0e 100644
--- a/roles/shell/bash/templates/bashrc.j2
+++ b/roles/shell/bash/templates/bashrc.j2
@@ -27,7 +27,7 @@ alias mv="mv -i"
27alias cp="cp -i" 27alias cp="cp -i"
28alias rm="rm -i" 28alias rm="rm -i"
29alias psp="pstree -aUp $USER" 29alias psp="pstree -aUp $USER"
30alias dotdrop="dotdrop --cfg $XDG_CONFIG_HOME/dotdrop/config.yaml" 30alias info='info -v active-link-style=yellow,bold -v link-style=yellow'
31 31
32[[ -f /usr/share/stgit/completion/stgit-completion.bash ]] && . /usr/share/stgit/completion/stgit-completion.bash 32[[ -f /usr/share/stgit/completion/stgit-completion.bash ]] && . /usr/share/stgit/completion/stgit-completion.bash
33 33
@@ -125,6 +125,7 @@ function git_prompt() {
125 echo -e "($gitinfo) " 125 echo -e "($gitinfo) "
126 fi 126 fi
127} 127}
128{% set ps1_git = '\[$(git_prompt_color)\]$(git_prompt)' %}
128 129
129function error_code() { 130function error_code() {
130 ret=$? 131 ret=$?
@@ -139,14 +140,19 @@ function running_jobs() {
139 echo "[$ret] " 140 echo "[$ret] "
140 fi 141 fi
141} 142}
143{% set ps1_status = '\[\\033[01;31m\]$(error_code)\[\\033[00;00m\]$(running_jobs)' -%}
142 144
143{% if role.get(profile) == "fretlink" %} 145{# Ensure new line before the prompt #}
144PS1='\[\033[01;31m\]$(error_code)\[\033[00;00m\]$(running_jobs)\[\033[01;32m\]$(dev_prompt)\[$(git_prompt_color)\]$(git_prompt)\[\033[00;32m\]\u@\h\[\033[94m\] \w \$\[\033[00m\] ' 146{% set ps1_newline = '$(printf "%$((`tput cols`-1))s\\r")' -%}
145{% else %} 147
146PS1='\[\033[01;31m\]$(error_code)\[\033[00;00m\]$(running_jobs)\[$(git_prompt_color)\]$(git_prompt)\[\033[00;32m\]\u@\h\[\033[94m\] \w \$\[\033[00m\] ' 148{% set ps1_other = '' %}
147{% endif %} 149{% if role.get(profile) == "fretlink" -%}
150 {% set ps1_other = '\[\\033[01;32m\]$(dev_prompt)' %}
151{%- endif %}
152
153PS1='{{ ps1_newline }}{{ ps1_status }}{{ ps1_other }}{{ ps1_git }}\[\033[00;32m\]\u@\h\[\033[94m\] \w \$\[\033[00m\] '
148 154
149PROMPT_COMMAND="[[ -f "$XDG_STATE_HOME/bash/bashrc_temp" ]] && . $XDG_STATE_HOME/bash/bashrc_temp" 155PROMPT_COMMAND="[[ -f $XDG_STATE_HOME/bash/bashrc_temp ]] && . $XDG_STATE_HOME/bash/bashrc_temp"
150 156
151{% if "nodejs" in features.get(profile, []) %} 157{% if "nodejs" in features.get(profile, []) %}
152source /usr/share/nvm/init-nvm.sh 158source /usr/share/nvm/init-nvm.sh