Skip to content

Commit

Permalink
Add git-prompt and default editor=vim in profile.d to silverblue-base…
Browse files Browse the repository at this point in the history
… image.
  • Loading branch information
thwiest-celonis committed Nov 1, 2023
1 parent e12ea0f commit 78392f5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions silverblue-base/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,10 @@ ADD files/polkitd/50-twiest-rpm-ostree-allow-update-from-all-users.rules /usr/sh

# Make sure fstrim works on luks devices including root
ADD files/config.d/00-add-luks-fstrim-kargs.sh /etc/config.d/00-add-luks-fstrim-kargs.sh

# Set vim as default editor
RUN rm /etc/profile.d/nano-default-editor.sh
ADD files/profile.d/vim-default-editor.sh /etc/profile.d/vim-default-editor.sh

# Enable git prompt
ADD files/profile.d/git-prompt.sh /etc/profile.d/git-prompt.sh
14 changes: 14 additions & 0 deletions silverblue-base/files/profile.d/git-prompt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# shellcheck shell=sh
# Initialization script for bash

if [ -f /usr/share/git-core/contrib/completion/git-prompt.sh ]
then
source /usr/share/git-core/contrib/completion/git-prompt.sh

export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export GIT_PS1_SHOWSTASHSTATE=true
export GIT_PS1_SHOWUPSTREAM="auto"

export PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
fi
5 changes: 5 additions & 0 deletions silverblue-base/files/profile.d/vim-default-editor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ensure vim is set as EDITOR if it isn't already set

if [ -z "$EDITOR" ]; then
export EDITOR="/usr/bin/vim"
fi

0 comments on commit 78392f5

Please sign in to comment.