Skip to content

Commit 52f4155

Browse files
author
Ira Abramov
committed
Merge branch 'master' into gaelic-plugins
* master: remove superfluous function and pick better var names for readability Update base.theme.bash Update base.theme.bash Update base.theme.bash Update base.theme.bash Fix for 2323 issue Apply fixes Add `.git-blame-ignore-revs` Clean themes A-L Update powerline-multiline.base.bash Fix a couple bugs introduced by last commit Fix bad merge important syntax correction from the owenr of ble.sh only the correct FZF integration loads, sepending on whether the blesh plugin is enabled as well. readonly HIST* variables is a bit extreme and clashes with ble.sh and other tools. Fix node and ruby colors Update themes/base.theme.bash lib/theme: use `_command_exists()` `node_version_prompt` should work without NVM
2 parents bcc2d58 + da80656 commit 52f4155

20 files changed

Lines changed: 224 additions & 191 deletions

.git-blame-ignore-revs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore shfmt related commits
2+
003b0ce802c10ab6e161d7ba5a7d9b6722312cc5
3+
7c2c2a5525557cbfee98e73de921fd7f7e6811a1
4+
d37505b636ca7bc95301d8daaf9c58a3186ce57a
5+
d7695d5456b980190b6d1c4a4715b13d1b63c332

clean_files.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ themes/atomic
4343
themes/axin
4444
themes/bakke
4545
themes/barbuk
46-
themes/base.theme.bash
4746
themes/binaryanomaly
4847
themes/bira
4948
themes/bobby
@@ -55,19 +54,28 @@ themes/clean
5554
themes/codeword
5655
themes/cooperkid
5756
themes/cupcake
57+
themes/demula
58+
themes/dos
5859
themes/doubletime
5960
themes/doubletime_multiline
6061
themes/doubletime_multiline_pyonly
6162
themes/dulcie
6263
themes/duru
6364
themes/easy
6465
themes/elixr
66+
themes/emperor
67+
themes/envy
6568
themes/essential
66-
themes/githelpers.theme.bash
69+
themes/font
70+
themes/gallifrey
6771
themes/gitline
72+
themes/hawaii50
6873
themes/inretio
74+
themes/iterate
75+
themes/kitsune
6976
themes/lambda
7077
themes/liquidprompt
78+
themes/luan
7179
themes/modern
7280
themes/norbu
7381
themes/oh-my-posh

plugins/available/blesh.plugin.bash

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ _bash_it_ble_path=${XDG_DATA_HOME:-$HOME/.local/share}/blesh/ble.sh
1010
if [[ -f $_bash_it_ble_path ]]; then
1111
# shellcheck disable=1090
1212
source "$_bash_it_ble_path" --attach=prompt
13+
if _bash-it-component-item-is-enabled plugin fzf; then
14+
ble-import -d integration/fzf-key-bindings
15+
ble-import -d integration/fzf-completion
16+
fi
1317
else
1418
_log_error "Could not find ble.sh in $_bash_it_ble_path"
1519
_log_error "Please install using the following command:"

plugins/available/fzf.plugin.bash

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
cite about-plugin
66
about-plugin 'load fzf, if you are using it'
77

8-
if [ -r ~/.fzf.bash ]; then
9-
# shellcheck disable=SC1090
10-
source ~/.fzf.bash
11-
elif [ -r "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash ]; then
12-
# shellcheck disable=SC1091
13-
source "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash
14-
fi
8+
if ! _bash-it-component-item-is-enabled plugin blesh; then
9+
if [ -r ~/.fzf.bash ]; then
10+
# shellcheck disable=SC1090
11+
source ~/.fzf.bash
12+
elif [ -r "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash ]; then
13+
# shellcheck disable=SC1091
14+
source "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash
15+
fi
16+
fi # only sources the keybindings and integration if blesh is not integrated already
1517

1618
# No need to continue if the command is not present
1719
_command_exists fzf || return

plugins/available/history-eternal.plugin.bash

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ fi
1010
# truncating the history file early.
1111

1212
# "Numeric values less than zero result in every command being saved on the history list (there is no limit)"
13-
readonly HISTSIZE=-1 2> /dev/null || true
13+
HISTSIZE=-1 2> /dev/null || true
1414

1515
# "Non-numeric values and numeric values less than zero inhibit truncation"
16-
readonly HISTFILESIZE='unlimited' 2> /dev/null || true
16+
HISTFILESIZE='unlimited' 2> /dev/null || true
1717

1818
# Use a custom history file location so history is not truncated
1919
# if the environment ever loses this "eternal" configuration.
2020
HISTDIR="${XDG_STATE_HOME:-${HOME?}/.local/state}/bash"
2121
[[ -d ${HISTDIR?} ]] || mkdir -p "${HISTDIR?}"
22-
readonly HISTFILE="${HISTDIR?}/history" 2> /dev/null || true
22+
HISTFILE="${HISTDIR?}/history" 2> /dev/null || true

themes/agnoster/agnoster.theme.bash

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ prompt_histdt() {
235235
}
236236

237237
git_status_dirty() {
238-
dirty=$(git status -s 2> /dev/null | tail -n 1)
238+
local dirty
239+
dirty=$(git status --porcelain 2> /dev/null | tail -n 1)
239240
[[ -n $dirty ]] && echo ""
240241
}
241242

themes/barbuk/barbuk.theme.bash

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ GIT_THEME_PROMPT_CLEAN=" ${bold_green?}✓"
5050
GIT_THEME_PROMPT_PREFIX="${cyan?}"
5151
GIT_THEME_PROMPT_SUFFIX="${cyan?}"
5252
SCM_THEME_BRANCH_TRACK_PREFIX="${normal?}${cyan?}"
53-
SCM_THEME_CURRENT_USER_PREFFIX=''
54-
SCM_GIT_SHOW_CURRENT_USER='false'
5553
NVM_THEME_PROMPT_PREFIX=''
5654
NVM_THEME_PROMPT_SUFFIX=''
5755
RVM_THEME_PROMPT_PREFIX=''
@@ -61,7 +59,7 @@ RBENV_THEME_PROMPT_SUFFIX=''
6159
RBFU_THEME_PROMPT_PREFIX=''
6260
RBFU_THEME_PROMPT_SUFFIX=''
6361

64-
function _git-uptream-remote-logo() {
62+
function __git-uptream-remote-logo_prompt() {
6563
[[ -z "$(_git-upstream)" ]] && SCM_GIT_CHAR="${SCM_GIT_CHAR_DEFAULT:-}"
6664

6765
local remote remote_domain
@@ -83,22 +81,7 @@ function _git-uptream-remote-logo() {
8381

8482
function git_prompt_info() {
8583
git_prompt_vars
86-
echo -e " on ${SCM_GIT_CHAR_ICON_BRANCH:-} ${SCM_PREFIX:-}${SCM_BRANCH:-}${SCM_STATE:-}${SCM_GIT_AHEAD:-}${SCM_GIT_BEHIND:-}${SCM_GIT_STASH:-}${SCM_SUFFIX:-}"
87-
}
88-
89-
function _exit-code() {
90-
if [[ "${1:-}" -ne 0 ]]; then
91-
exit_code=" ${purple?}${EXIT_CODE_ICON:-}${yellow?}${exit_code:-}${bold_orange?}"
92-
else
93-
exit_code="${bold_green?}"
94-
fi
95-
}
96-
97-
function _prompt() {
98-
local exit_code="$?" wrap_char=' ' dir_color=$green ssh_info='' python_venv='' host command_duration=
99-
local scm_char scm_prompt_info
100-
101-
command_duration="$(_command_duration)"
84+
echo -e "on $SCM_GIT_CHAR_ICON_BRANCH $SCM_PREFIX$SCM_BRANCH$SCM_STATE$SCM_GIT_AHEAD$SCM_GIT_BEHIND$SCM_GIT_STASH$SCM_SUFFIX "
10285
}
10386

10487
function __exit_prompt() {
@@ -165,21 +148,17 @@ function __ssh_prompt() {
165148
else
166149
host="\h"
167150
fi
168-
ssh_info="${bold_blue?}\u${bold_orange?}@${cyan?}$host ${bold_orange?}in"
151+
echo "${bold_blue?}\u${bold_orange?}@${cyan?}$host ${bold_orange?}in "
169152
fi
170153
}
171154

172155
function __python_venv_prompt() {
173156
# Detect python venv
174-
if [[ -n "${CONDA_DEFAULT_ENV:-}" ]]; then
175-
python_venv="${PYTHON_VENV_CHAR:-}${CONDA_DEFAULT_ENV:-} "
176-
elif [[ -n "${VIRTUAL_ENV:-}" ]]; then
177-
python_venv="$PYTHON_VENV_CHAR${VIRTUAL_ENV##*/} "
157+
if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then
158+
echo "${bold_purple?}$PYTHON_VENV_CHAR${normal?}${CONDA_DEFAULT_ENV} "
159+
elif [[ -n "${VIRTUAL_ENV}" ]]; then
160+
echo "${bold_purple?}$PYTHON_VENV_CHAR${normal?}$(basename "${VIRTUAL_ENV}") "
178161
fi
179-
180-
scm_char="$(scm_char)"
181-
scm_prompt_info="$(scm_prompt_info)"
182-
PS1="\\n${ssh_info} ${purple}${scm_char}${python_venv}${dir_color}\\w${normal}${scm_prompt_info}${command_duration}${exit_code}"
183162
}
184163

185164
function __path_prompt() {

themes/base.theme.bash

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ function scm_prompt_vars() {
175175
scm_prompt_char
176176
SCM_DIRTY=0
177177
SCM_STATE=''
178+
SCM_BRANCH=''
178179

179180
local prompt_vars="${SCM}_prompt_vars"
180181
_is_function "${prompt_vars}" && "${prompt_vars}"
@@ -393,20 +394,30 @@ function hg_prompt_vars() {
393394
fi
394395
}
395396

397+
function node_command_version_prompt() {
398+
local node_version
399+
if _command_exists node; then
400+
node_version="$(node --version 2> /dev/null)"
401+
if [[ -n ${node_version} ]]; then
402+
echo -e "${NVM_THEME_PROMPT_PREFIX}${node_version}${NVM_THEME_PROMPT_SUFFIX}"
403+
fi
404+
fi
405+
}
406+
396407
function nvm_version_prompt() {
397-
local node
408+
local nvm_ver
398409
if _is_function nvm; then
399-
node=$(nvm current 2> /dev/null)
400-
[[ "${node}" == "system" ]] && return
401-
echo -ne "${NVM_THEME_PROMPT_PREFIX-}${node}${NVM_THEME_PROMPT_SUFFIX-}"
410+
nvm_ver=$(nvm current 2> /dev/null)
411+
[[ "${nvm_ver}" == "system" ]] && return
412+
echo -ne "${NVM_THEME_PROMPT_PREFIX-}${nvm_ver}${NVM_THEME_PROMPT_SUFFIX-}"
402413
fi
403414
}
404415

405416
function node_native_version_prompt() {
406-
local node
417+
local node_ver
407418
if _command_exists node; then
408-
node=$(node --version 2> /dev/null)
409-
echo -ne "${NODE_THEME_PROMPT_PREFIX-}${node}${NODE_THEME_PROMPT_SUFFIX-}"
419+
node_ver=$(node --version 2> /dev/null)
420+
echo -ne "${NODE_THEME_PROMPT_PREFIX-}${node_ver}${NODE_THEME_PROMPT_SUFFIX-}"
410421
fi
411422
}
412423

themes/demula/demula.theme.bash

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!/usr/bin/env bash
1+
# shellcheck shell=bash
2+
# shellcheck disable=SC2034 # Expected behavior for themes.
23

34
# Theme inspired on:
45
# - Ronacher's dotfiles (mitsuhikos) - http://github.com/mitsuhiko/dotfiles/tree/master/bash/
@@ -10,40 +11,40 @@
1011
# Screenshot: http://goo.gl/VCmX5
1112
# by Jesus de Mula <jesus@demula.name>
1213

13-
# For the real Monokai colors you should add these to your .XDefaults or
14-
# terminal configuration:
15-
#! ----------------------------------------------------------- TERMINAL COLORS
16-
#! monokai - http://www.monokai.nl/blog/2006/07/15/textmate-color-theme/
17-
#*background: #272822
18-
#*foreground: #E2DA6E
19-
#*color0: black
20-
#! mild red
21-
#*color1: #CD0000
22-
#! light green
23-
#*color2: #A5E02D
24-
#! orange (yellow)
25-
#*color3: #FB951F
26-
#! "dark" blue
27-
#*color4: #076BCC
28-
#! hot pink
29-
#*color5: #F6266C
30-
#! cyan
31-
#*color6: #64D9ED
32-
#! gray
33-
#*color7: #E5E5E5
14+
## For the real Monokai colors you should add these to your .XDefaults or
15+
## terminal configuration:
16+
## ! ----------------------------------------------------------- TERMINAL COLORS
17+
## ! monokai - http://www.monokai.nl/blog/2006/07/15/textmate-color-theme/
18+
## *background: #272822
19+
## *foreground: #E2DA6E
20+
## *color0: black
21+
## ! mild red
22+
## *color1: #CD0000
23+
## ! light green
24+
## *color2: #A5E02D
25+
## ! orange (yellow)
26+
## *color3: #FB951F
27+
## ! "dark" blue
28+
## *color4: #076BCC
29+
## ! hot pink
30+
## *color5: #F6266C
31+
## ! cyan
32+
## *color6: #64D9ED
33+
## ! gray
34+
## *color7: #E5E5E5
3435

3536
# ----------------------------------------------------------------- COLOR CONF
36-
D_DEFAULT_COLOR="${normal}"
37-
D_INTERMEDIATE_COLOR="${white}"
38-
D_USER_COLOR="${purple}"
39-
D_SUPERUSER_COLOR="${red}"
40-
D_MACHINE_COLOR="${cyan}"
41-
D_DIR_COLOR="${green}"
42-
D_SCM_COLOR="${yellow}"
43-
D_BRANCH_COLOR="${yellow}"
44-
D_CHANGES_COLOR="${white}"
45-
D_CMDFAIL_COLOR="${red}"
46-
D_VIMSHELL_COLOR="${cyan}"
37+
D_DEFAULT_COLOR="${normal?}"
38+
D_INTERMEDIATE_COLOR="${white?}"
39+
D_USER_COLOR="${purple?}"
40+
D_SUPERUSER_COLOR="${red?}"
41+
D_MACHINE_COLOR="${cyan?}"
42+
D_DIR_COLOR="${green?}"
43+
D_SCM_COLOR="${yellow?}"
44+
D_BRANCH_COLOR="${yellow?}"
45+
D_CHANGES_COLOR="${white?}"
46+
D_CMDFAIL_COLOR="${red?}"
47+
D_VIMSHELL_COLOR="${cyan?}"
4748

4849
# ------------------------------------------------------------------ FUNCTIONS
4950
case $TERM in
@@ -56,7 +57,7 @@ case $TERM in
5657
esac
5758

5859
is_vim_shell() {
59-
if [ ! -z "$VIMRUNTIME" ]; then
60+
if [ -n "$VIMRUNTIME" ]; then
6061
echo "${D_INTERMEDIATE_COLOR}on ${D_VIMSHELL_COLOR}\
6162
vim shell${D_DEFAULT_COLOR} "
6263
fi
@@ -72,7 +73,7 @@ $code ${D_DEFAULT_COLOR}"
7273

7374
# vcprompt for scm instead of bash_it default
7475
demula_vcprompt() {
75-
if [ ! -z "$VCPROMPT_EXECUTABLE" ]; then
76+
if [ -n "$VCPROMPT_EXECUTABLE" ]; then
7677
local D_VCPROMPT_FORMAT="on ${D_SCM_COLOR}%s${D_INTERMEDIATE_COLOR}:\
7778
${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}"
7879
$VCPROMPT_EXECUTABLE -f "$D_VCPROMPT_FORMAT"
@@ -81,7 +82,8 @@ ${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}"
8182

8283
# -------------------------------------------------------------- PROMPT OUTPUT
8384
prompt() {
84-
local LAST_COMMAND_FAILED=$(mitsuhikos_lastcommandfailed)
85+
local LAST_COMMAND_FAILED
86+
LAST_COMMAND_FAILED=$(mitsuhikos_lastcommandfailed)
8587
local SAVE_CURSOR='\033[s'
8688
local RESTORE_CURSOR='\033[u'
8789
local MOVE_CURSOR_RIGHTMOST='\033[500C'

themes/dos/dos.theme.bash

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
# shellcheck shell=bash
2+
# shellcheck disable=SC2034 # Expected behavior for themes.
13
PROMPT="\w>>"

0 commit comments

Comments
 (0)