Skip to content

Instantly share code, notes, and snippets.

@ENez7
Created August 20, 2023 16:14
Show Gist options
  • Save ENez7/bf4ce58cf9b9af4a09125a9a4c2b7572 to your computer and use it in GitHub Desktop.
Save ENez7/bf4ce58cf9b9af4a09125a9a4c2b7572 to your computer and use it in GitHub Desktop.
Nord customized git bash

How to: Customize git bash terminal with Nord's look and feel

image

To change colors of the terminal in order to combine it with Nord theme, you should modify git-prompt.sh located in C:\Program Files\Git\etc\ directory

Nord's official page https://www.nordtheme.com/

Then, paste this

if test -f /etc/profile.d/git-sdk.sh
then
	TITLEPREFIX=SDK-${MSYSTEM#MINGW}
else
	TITLEPREFIX=$MSYSTEM
fi

if test -f ~/.config/git/git-prompt.sh
then
	. ~/.config/git/git-prompt.sh
else
	PS1='\[\033]0;$TITLEPREFIX:$PWD\007\]' # set window title
	# PS1="$PS1"'\n'                 # new line
	PS1="$PS1"'\[\033[32m\]'       # change to green
	PS1="$PS1"'enez7@\h'             # user@host<space>
	if test -z "$WINELOADERNOEXEC"
	then
		GIT_EXEC_PATH="$(git --exec-path 2>/dev/null)"
		COMPLETION_PATH="${GIT_EXEC_PATH%/libexec/git-core}"
		COMPLETION_PATH="${COMPLETION_PATH%/lib/git-core}"
		COMPLETION_PATH="$COMPLETION_PATH/share/git/completion"
		if test -f "$COMPLETION_PATH/git-prompt.sh"
		then
			. "$COMPLETION_PATH/git-completion.bash"
			. "$COMPLETION_PATH/git-prompt.sh"
			PS1="$PS1"'\[\033[36m\]'  # change color to cyan
			PS1="$PS1"' b:`__git_ps1 "%s" ` '   # bash function
		fi
	fi
	PS1="$PS1"'\[\033[37m\]'       # change to white
	PS1="$PS1"'\w'                 # current working directory
	PS1="$PS1"'\[\033[0m\]'        # change color
	PS1="$PS1"'\n'                 # new line
	PS1="$PS1"'$ '                 # prompt: always $
fi

MSYS2_PS1="$PS1"               # for detection by MSYS2 SDK's bash.basrc

# Evaluate all user-specific Bash completion scripts (if any)
if test -z "$WINELOADERNOEXEC"
then
	for c in "$HOME"/bash_completion.d/*.bash
	do
		# Handle absence of any scripts (or the folder) gracefully
		test ! -f "$c" ||
		. "$c"
	done
fi

Now you are done, feel free to modify colors and order or whatever you want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment