Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions clean_files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ themes/atomic
themes/axin
themes/bakke
themes/barbuk
themes/base.theme.bash
themes/binaryanomaly
themes/bira
themes/bobby
Expand Down Expand Up @@ -74,14 +75,25 @@ themes/kitsune
themes/lambda
themes/liquidprompt
themes/luan
themes/mairan
themes/mbriggs
themes/metal
themes/minimal
themes/modern
themes/modern-t
themes/modern-time
themes/morris
themes/n0qorg
themes/newin
themes/norbu
themes/nwinkler
themes/oh-my-posh
themes/p4helpers.theme.bash
themes/pete
themes/powerline
themes/powerline-multiline
themes/powerline-naked
themes/powerline-plain
themes/pure
themes/purity
themes/rjorgenson
Expand Down
42 changes: 23 additions & 19 deletions themes/mairan/mairan.theme.bash
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# shellcheck shell=bash
# shellcheck disable=SC2034
# Mairan Bash Prompt, inspired by "Zork"

if tput setaf 1 &> /dev/null; then
Expand Down Expand Up @@ -34,11 +36,11 @@ BRACKET_COLOR=$ORANGE
SCM_THEME_PROMPT_PREFIX=""
SCM_THEME_PROMPT_SUFFIX=""

SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}"
SCM_GIT_CHAR="${bold_green}±${normal}"
SCM_SVN_CHAR="${bold_cyan}⑆${normal}"
SCM_HG_CHAR="${bold_red}☿${normal}"
SCM_THEME_PROMPT_DIRTY=" ${bold_red?}✗${normal?}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}"
SCM_GIT_CHAR="${bold_green?}±${normal?}"
SCM_SVN_CHAR="${bold_cyan?}⑆${normal?}"
SCM_HG_CHAR="${bold_red?}☿${normal?}"

#Mysql Prompt
export MYSQL_PS1="(\u@\h) [\d]> "
Expand All @@ -55,44 +57,46 @@ esac
PS3=">> "

__my_rvm_ruby_version() {
local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}')
local gemset
gemset=$(echo "$GEM_HOME" | awk -F'@' '{print $2}')
[ "$gemset" != "" ] && gemset="@$gemset"
local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}')
local version
version=$(echo "$MY_RUBY_HOME" | awk -F'-' '{print $2}')
local full="$version$gemset"
[ "$full" != "" ] && echo "[$full]"
}

is_vim_shell() {
if [ ! -z "$VIMRUNTIME" ]; then
echo "[${cyan}vim shell${normal}]"
if [ -n "$VIMRUNTIME" ]; then
echo "[${cyan?}vim shell${normal?}]"
fi
}

# show chroot if exist
chroot() {
if [ -n "$debian_chroot" ]; then
my_ps_chroot="${bold_cyan}$debian_chroot${normal}"
my_ps_chroot="${bold_cyan?}$debian_chroot${normal?}"
echo "($my_ps_chroot)"
fi
}

# show virtualenvwrapper
my_ve() {
if [ -n "$VIRTUAL_ENV" ]; then
my_ps_ve="${bold_purple}$ve${normal}"
my_ps_ve="${bold_purple?}$ve${normal?}"
echo "($my_ps_ve)"
fi
echo ""
}

prompt() {
SCM_PROMPT_FORMAT="[%s$GREEN%s]"
my_ps_host="$BOLD$ORANGE\h${normal}"
my_ps_host="$BOLD$ORANGE\h${normal?}"
# yes, these are the the same for now ...
my_ps_host_root="$ORANGE\h${normal}"
my_ps_host_root="$ORANGE\h${normal?}"

my_ps_user="$BOLD$GREEN\u${normal}"
my_ps_root="${bold_red}\u${normal}"
my_ps_user="$BOLD$GREEN\u${normal?}"
my_ps_root="${bold_red?}\u${normal?}"

if [ -n "$VIRTUAL_ENV" ]; then
ve=$(basename "$VIRTUAL_ENV")
Expand All @@ -101,12 +105,12 @@ prompt() {
# nice prompt
case "$(id -u)" in
0)
PS1="\n${TITLEBAR}${BRACKET_COLOR}┌─${normal}$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(scm_prompt)$(__my_rvm_ruby_version)[${green}\w${normal}]$(is_vim_shell)${BRACKET_COLOR}
└─▪ ${prompt_symbol} ${normal}"
PS1="\n${TITLEBAR}${BRACKET_COLOR}┌─${normal?}$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(scm_prompt)$(__my_rvm_ruby_version)[${green?}\w${normal?}]$(is_vim_shell)${BRACKET_COLOR}
└─▪ ${prompt_symbol} ${normal?}"
;;
*)
PS1="\n${TITLEBAR}${BRACKET_COLOR}┌─${normal}$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(scm_prompt)${normal}$(__my_rvm_ruby_version)[${green}\w${normal}]$(is_vim_shell)${BRACKET_COLOR}
└─▪ ${prompt_symbol} ${normal}"
PS1="\n${TITLEBAR}${BRACKET_COLOR}┌─${normal?}$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(scm_prompt)${normal?}$(__my_rvm_ruby_version)[${green?}\w${normal?}]$(is_vim_shell)${BRACKET_COLOR}
└─▪ ${prompt_symbol} ${normal?}"
;;
esac
}
Expand Down
21 changes: 13 additions & 8 deletions themes/mbriggs/mbriggs.theme.bash
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
# shellcheck shell=bash
# shellcheck disable=SC2034
# ------------------------------------------------------------------#
# FILE: mbriggs.zsh-theme #
# BY: Matt Briggs ([email protected]) #
# BASED ON: smt by Stephen Tudor ([email protected]) #
# ------------------------------------------------------------------#

SCM_THEME_PROMPT_DIRTY="${red}⚡${reset_color}"
SCM_THEME_PROMPT_AHEAD="${red}!${reset_color}"
SCM_THEME_PROMPT_CLEAN="${green}✓${reset_color}"
SCM_THEME_PROMPT_DIRTY="${red?}⚡${reset_color?}"
SCM_THEME_PROMPT_AHEAD="${red?}!${reset_color?}"
SCM_THEME_PROMPT_CLEAN="${green?}✓${reset_color?}"
SCM_THEME_PROMPT_PREFIX=" "
SCM_THEME_PROMPT_SUFFIX=""
GIT_SHA_PREFIX=" ${yellow}"
GIT_SHA_SUFFIX="${reset_color}"
GIT_SHA_PREFIX=" ${yellow?}"
GIT_SHA_SUFFIX="${reset_color?}"

function git_short_sha() {
SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$GIT_SHA_PREFIX$SHA$GIT_SHA_SUFFIX"
}

function prompt() {
local return_status=""
local ruby="${red}$(ruby_version_prompt)${reset_color}"
local user_host="${green}\h${reset_color}"
local ruby
ruby="${red?}$(ruby_version_prompt)${reset_color?}"
local user_host
user_host="${green?}\h${reset_color?}"
Comment on lines +25 to +26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? When the right-hand side contains command substitutions $(...), Shellcheck will complain that the exit status of the command is masked. However, this line doesn't contain any command substitutions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but shellcheck did complain. you prefer I disable a few more checks?

Copy link
Contributor

@akinomyoga akinomyoga Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of error does Shellcheck produce?

I tried it in my environments, but Shellcheck doesn't complain about this. Which version of Shellcheck do you use?

$ shellcheck --version
ShellCheck - shell script analysis tool
version: 0.10.0
license: GNU General Public License, version 3
website: https://www.shellcheck.net

In another host,

$ shellcheck --version
ShellCheck - shell script analysis tool
version: 0.11.0
license: GNU General Public License, version 3
website: https://www.shellcheck.net

local current_path="\w"
local n_commands="\!"
local git_branch="$(git_short_sha)$(scm_prompt_info)"
local git_branch
git_branch="$(git_short_sha)$(scm_prompt_info)"
local prompt_symbol='λ'
local open='('
local close=')'
Expand Down
21 changes: 11 additions & 10 deletions themes/metal/metal.theme.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# shellcheck shell=bash
# shellcheck disable=SC2034

# Emoji-based theme to display source control management and
# virtual environment info beside the ordinary bash prompt.
Expand All @@ -21,20 +22,20 @@ VIRTUALENV_THEME_PROMPT_SUFFIX=""
# SCM prompts
SCM_NONE_CHAR=""
SCM_GIT_CHAR="[±] "
SCM_GIT_BEHIND_CHAR="${red}↓${normal}"
SCM_GIT_AHEAD_CHAR="${bold_green}↑${normal}"
SCM_GIT_BEHIND_CHAR="${red?}↓${normal?}"
SCM_GIT_AHEAD_CHAR="${bold_green?}↑${normal?}"
SCM_GIT_UNTRACKED_CHAR="⌀"
SCM_GIT_UNSTAGED_CHAR="${bold_yellow}•${normal}"
SCM_GIT_STAGED_CHAR="${bold_green}+${normal}"
SCM_GIT_UNSTAGED_CHAR="${bold_yellow?}•${normal?}"
SCM_GIT_STAGED_CHAR="${bold_green?}+${normal?}"

SCM_THEME_PROMPT_DIRTY=""
SCM_THEME_PROMPT_CLEAN=""
SCM_THEME_PROMPT_PREFIX=""
SCM_THEME_PROMPT_SUFFIX=""

# Git status prompts
GIT_THEME_PROMPT_DIRTY=" ${red}✗${normal}"
GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}"
GIT_THEME_PROMPT_DIRTY=" ${red?}✗${normal?}"
GIT_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}"
GIT_THEME_PROMPT_PREFIX=""
GIT_THEME_PROMPT_SUFFIX=""

Expand All @@ -61,19 +62,19 @@ function virtualenv_prompt {

# Rename tab
function tabname {
printf "\e]1;$1\a"
printf '\e]1;%s\a' "$1"
}

# Rename window
function winname {
printf "\e]2;$1\a"
printf '\e]2;%s\a' "$1"
}

# PROMPT OUTPUT ===============================================================

# Displays the current prompt
function prompt_command() {
PS1="\n${icon_start}$(virtualenv_prompt)${icon_user}${bold_green}\u${normal}${icon_host}${bold_cyan}\h${normal}${icon_directory}${bold_purple}\W${normal}\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on ${icon_branch} \")${white}$(scm_prompt_info)${normal}\n${icon_end}"
PS1="\n${icon_start}$(virtualenv_prompt)${icon_user}${bold_green?}\u${normal?}${icon_host}${bold_cyan?}\h${normal?}${icon_directory}${bold_purple?}\W${normal?}\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on ${icon_branch} \")${white?}$(scm_prompt_info)${normal?}\n${icon_end}"
PS2="${icon_end}"
}

Expand Down
13 changes: 7 additions & 6 deletions themes/minimal/minimal.theme.bash
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env bash
# shellcheck shell=bash
# shellcheck disable=SC2034

SCM_THEME_PROMPT_PREFIX="${cyan}(${green}"
SCM_THEME_PROMPT_SUFFIX="${cyan})"
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
SCM_THEME_PROMPT_CLEAN=" ${green}✓"
SCM_THEME_PROMPT_PREFIX="${cyan?}(${green?}"
SCM_THEME_PROMPT_SUFFIX="${cyan?})"
SCM_THEME_PROMPT_DIRTY=" ${red?}✗"
SCM_THEME_PROMPT_CLEAN=" ${green?}✓"

prompt() {
PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} "
PS1="$(scm_prompt_info)${reset_color?} ${cyan?}\W${reset_color?} "
}

safe_append_prompt_command prompt
25 changes: 14 additions & 11 deletions themes/modern-t/modern-t.theme.bash
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# shellcheck shell=bash
# shellcheck disable=SC2034
# The "modern-t" theme is a "modern" theme variant with support
# for "t", the minimalist python todo list utility by Steve Losh.
# Get and install "t" at https://github.com/sjl/t#installing-t
Expand All @@ -8,11 +10,11 @@
SCM_THEME_PROMPT_PREFIX=""
SCM_THEME_PROMPT_SUFFIX=""

SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}"
SCM_GIT_CHAR="${bold_green}±${normal}"
SCM_SVN_CHAR="${bold_cyan}⑆${normal}"
SCM_HG_CHAR="${bold_red}☿${normal}"
SCM_THEME_PROMPT_DIRTY=" ${bold_red?}✗${normal?}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}"
SCM_GIT_CHAR="${bold_green?}±${normal?}"
SCM_SVN_CHAR="${bold_cyan?}⑆${normal?}"
SCM_HG_CHAR="${bold_red?}☿${normal?}"

case $TERM in
xterm*)
Expand All @@ -26,21 +28,22 @@ esac
PS3=">> "

is_vim_shell() {
if [ ! -z "$VIMRUNTIME" ]; then
echo "[${cyan}vim shell${normal}]"
if [ -n "$VIMRUNTIME" ]; then
echo "[${cyan?}vim shell${normal?}]"
fi
}

prompt() {
local last_status=$?
SCM_PROMPT_FORMAT='[%s][%s]'
if [ $? -ne 0 ]; then
if [ "$last_status" -ne 0 ]; then
# Yes, the indenting on these is weird, but it has to be like
# this otherwise it won't display properly.

PS1="${TITLEBAR}${bold_red}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]${reset_color}$(scm_prompt)[${cyan}\W${normal}]$(is_vim_shell)
${bold_red}└─▪${normal} "
PS1="${TITLEBAR}${bold_red?}┌─[${cyan?}$(t | wc -l | sed -e's/ *//')${reset_color?}]${reset_color?}$(scm_prompt)[${cyan?}\W${normal?}]$(is_vim_shell)
${bold_red?}└─▪${normal?} "
else
PS1="${TITLEBAR}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]$(scm_prompt)[${cyan}\W${normal}]$(is_vim_shell)
PS1="${TITLEBAR}┌─[${cyan?}$(t | wc -l | sed -e's/ *//')${reset_color?}]$(scm_prompt)[${cyan?}\W${normal?}]$(is_vim_shell)
└─▪ "
fi
}
Expand Down
25 changes: 14 additions & 11 deletions themes/modern-time/modern-time.theme.bash
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# shellcheck shell=bash
# shellcheck disable=SC2034
# Modified version of the original modern theme in bash-it
# Removes the battery charge and adds the current time

SCM_THEME_PROMPT_PREFIX=""
SCM_THEME_PROMPT_SUFFIX=""

SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}"
SCM_GIT_CHAR="${bold_green}±${normal}"
SCM_SVN_CHAR="${bold_cyan}⑆${normal}"
SCM_HG_CHAR="${bold_red}☿${normal}"
SCM_THEME_PROMPT_DIRTY=" ${bold_red?}✗${normal?}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓${normal?}"
SCM_GIT_CHAR="${bold_green?}±${normal?}"
SCM_SVN_CHAR="${bold_cyan?}⑆${normal?}"
SCM_HG_CHAR="${bold_red?}☿${normal?}"

case $TERM in
xterm*)
Expand All @@ -22,8 +24,8 @@ esac
PS3=">> "

is_vim_shell() {
if [ ! -z "$VIMRUNTIME" ]; then
echo "[${cyan}vim shell${normal}]"
if [ -n "$VIMRUNTIME" ]; then
echo "[${cyan?}vim shell${normal?}]"
fi
}

Expand All @@ -33,14 +35,15 @@ modern_current_time_prompt() {

prompt() {
SCM_PROMPT_FORMAT='[%s][%s]'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SCM_PROMPT_FORMAT='[%s][%s]'
local last_status=$?
SCM_PROMPT_FORMAT='[%s][%s]'

if [ $? -ne 0 ]; then
local last_status=$?
if [ $last_status -ne 0 ]; then
Comment on lines +38 to +39
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local last_status=$?
if [ $last_status -ne 0 ]; then
if ((last_status != 0)); then

# Yes, the indenting on these is weird, but it has to be like
# this otherwise it won't display properly.

PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(scm_prompt)$(modern_current_time_prompt)[${cyan}\W${normal}]$(is_vim_shell)
${bold_red}└─▪${normal} "
PS1="${TITLEBAR}${bold_red?}┌─${reset_color?}$(scm_prompt)$(modern_current_time_prompt)[${cyan?}\W${normal?}]$(is_vim_shell)
${bold_red?}└─▪${normal?} "
else
PS1="${TITLEBAR}┌─$(scm_prompt)$(modern_current_time_prompt)[${cyan}\W${normal}]$(is_vim_shell)
PS1="${TITLEBAR}┌─$(scm_prompt)$(modern_current_time_prompt)[${cyan?}\W${normal?}]$(is_vim_shell)
└─▪ "
fi
}
Expand Down
10 changes: 6 additions & 4 deletions themes/morris/morris.theme.bash
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# shellcheck shell=bash
# shellcheck disable=SC2034
# prompt theming

# added TITLEBAR for updating the tab and window titles with the pwd
Expand All @@ -18,9 +20,9 @@ function prompt_command() {
}

# scm theming
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓"
SCM_THEME_PROMPT_PREFIX="${green}("
SCM_THEME_PROMPT_SUFFIX="${green})${reset_color}"
SCM_THEME_PROMPT_DIRTY=" ${red?}✗"
SCM_THEME_PROMPT_CLEAN=" ${bold_green?}✓"
SCM_THEME_PROMPT_PREFIX="${green?}("
SCM_THEME_PROMPT_SUFFIX="${green?})${reset_color?}"

safe_append_prompt_command prompt_command
Loading
Loading