Skip to content

Commit

Permalink
Try blesh + oh-my-posh
Browse files Browse the repository at this point in the history
  • Loading branch information
bigbruno committed May 21, 2024
1 parent 873075e commit 35d3dad
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 45 deletions.
3 changes: 2 additions & 1 deletion pkgbuild/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ depends=('fzf'
'grc'
'ripgrep'
'ttf-meslo-nerd-font-powerlevel10k'
'ttf-nerd-fonts-symbols-with-biglinux')
'ttf-nerd-fonts-symbols-with-biglinux'
'oh-my-posh')
# makedepends=('')
# conflicts=('')
pkgver=$(date +%y.%m.%d)
Expand Down
16 changes: 9 additions & 7 deletions usr/share/biglinux/bash-config/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,15 @@ export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

# FZF Configuration
if [ -f /usr/share/fzf/key-bindings.bash ]; then
_ble_contrib_fzf_base=/usr/share/fzf/
. /usr/share/fzf/completion.bash
. /usr/share/fzf/key-bindings.bash
fi
# if [ -f /usr/share/fzf/key-bindings.bash ]; then
# _ble_contrib_fzf_base=/usr/share/fzf/
# . /usr/share/fzf/completion.bash
# . /usr/share/fzf/key-bindings.bash
# fi

# Attach Blesh if available
# Attach Blesh with oh my posh if available
if [[ ${BLE_VERSION-} ]]; then
eval "$(oh-my-posh init bash --config /usr/share/biglinux/bash-config/oh-my-posh.json)"
ble-attach
else
# tty
Expand All @@ -168,6 +169,7 @@ else
nameFg="\[\e[38;5;248m\]"

# one line PS1
PS1="$systemBg$greenFg $systemFg$greenBg$blackFg$greenBg\w $fmtReset$greenFg$fmtReset "
PS1="$systemBg$greenFg $systemFg$greenBg$blackFg$greenBg\w $fmtReset$greenFg$fmtReset "
fi
fi

38 changes: 1 addition & 37 deletions usr/share/biglinux/bash-config/blerc
Original file line number Diff line number Diff line change
Expand Up @@ -147,32 +147,6 @@ bleopt history_lazyload=1
## "prompt_ps1_transient" is effective only when the current working directory
## did not change since the last command line.

blueBg="\[\e[44m\]"
blueFg="\[\e[34m\]"

blackFg="\[\e[30m\]"
whiteFg="\[\e[37m\]"

# Reset
fmtReset="\[\e[0m\]"

systemBg="\[\e[48;5;237m\]"
systemFg="\[\e[38;5;237m\]"

nameBg="\[\e[48;5;248m\]"
nameFg="\[\e[38;5;248m\]"

# one line PS1
if [[ -n $CHROME_DESKTOP ]]; then
PS1="$systemBg$blueFg \u@\h $systemFg$blueBg$blackFg$blueBg\w $fmtReset$blueFg$fmtReset "
else
PS1="$systemBg$blueFg$systemFg$blueBg$blackFg$blueBg\w $fmtReset$blueFg$fmtReset "
fi


# two lines PS1
# PS1="\n$systemBg$blueFg  \u $systemFg$blueBg $blackFg$blueBg\w $fmtReset$blueFg$fmtReset\n$systemBg$whiteFg $systemFg$fmtReset$systemFg "

# bleopt prompt_ps1_final="\D{%H:%M:%S} "
# bleopt prompt_ps1_transient=trim

Expand Down Expand Up @@ -306,7 +280,7 @@ bleopt exec_errexit_mark=$'\e[91m[exit=%d]\e[m'
## history is shared with the other Bash ble.sh sessions with the history
## sharing turned on.

#bleopt history_share=
bleopt history_share=1


## This option controls the target range in the command history for
Expand Down Expand Up @@ -514,7 +488,6 @@ bleopt grapheme_cluster=extended

#bleopt decode_abort_char=28


## The following settings sets up the behavior for errors while user input
## decoding. "error_char" is the decoding error for the current character
## encoding. "error_cseq" indicates the unrecognized CSI sequences.
Expand All @@ -534,13 +507,11 @@ bleopt grapheme_cluster=extended
#bleopt decode_error_kseq_vbell=1
#bleopt decode_error_kseq_discard=1


## This variable sets the limit to the count of recursive calls of keyboard
## macros.

#bleopt decode_macro_limit=1024


## When a non-empty value is specified to this settings, the terminal's
## Bracketed Paste Mode (DEC mode 2004) is enabled. This setting is
## synchronized with the readline variable "enable-bracketed-paste".
Expand Down Expand Up @@ -608,7 +579,6 @@ bleopt complete_auto_delay=300

#bleopt complete_auto_wordbreaks=$' \t\n/'


## The setting "complete_auto_complete_opts" is a colon-separated list of
## options:
##
Expand All @@ -628,15 +598,13 @@ bleopt complete_auto_delay=300

#bleopt complete_auto_menu=500


## When there are user inputs while generating completion candidates, the
## candidates generation will be canceled to process the user inputs. The
## following setting controls the interval of checking user inputs while
## generating completion candidates.

#bleopt complete_polling_cycle=50


## A hint on the maximum acceptable size of any data structure generated during
## the completion process, beyond which the completion may be prematurely
## aborted to avoid excessive processing time. "complete_limit" is used for
Expand All @@ -649,7 +617,6 @@ bleopt complete_auto_delay=300
#bleopt complete_limit_auto=200
#bleopt complete_limit_auto_menu=100


## The following setting controls the timeout for the pathname expansions
## performed in auto-complete. When the word contains a glob pattern that
## takes a long time to evaluate the pathname expansion, auto-complete based on
Expand All @@ -659,7 +626,6 @@ bleopt complete_auto_delay=300

#bleopt complete_timeout_auto=5000


## The following setting controls the timeout for the pathname expansions to
## prepare COMP_WORDS and COMP_LINE for progcomp. When the word contains a
## glob pattern that takes a long time to evaluate, the pathname expansion is
Expand All @@ -669,7 +635,6 @@ bleopt complete_auto_delay=300

#bleopt complete_timeout_compvar=200


## The following setting specifies the style of the menu to show completion
## candidates. The value "dense" and "dense-nowrap" shows candidates separated
## by spaces. "dense-nowrap" is different from "dense" in the behavior that it
Expand All @@ -682,7 +647,6 @@ bleopt complete_auto_delay=300

#bleopt complete_menu_style=align-nowrap


## When a non-empty value is specified to this setting, the matching text on
## the right of the cursor is removed on the insertion of the completion. This
## setting is synchronized with the readline variable "skip-completed-text".
Expand Down
116 changes: 116 additions & 0 deletions usr/share/biglinux/bash-config/oh-my-posh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"$schema": "https://raw.githubusercontent.com/biglinux/biglinux-bash-config/main/usr/share/biglinux/bash-config/oh-my-posh.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "#0077c2",
"foreground": "#ffffff",
"leading_diamond": "\u256d\u2500\ue0b6",
"trailing_diamond": "",
"style": "diamond",
"template": "",
"type": "shell"
},
{
"background": "#006199",
"foreground": "#ffffff",
"style": "diamond",
"template": " {{ .UserName }} ",
"type": "shell"
},
{
"background": "#ef5350",
"foreground": "#FFFB38",
"properties": {
"root_icon": "\uf292"
},
"style": "diamond",
"template": "<parentBackground>\ue0b0</> \uf0e7 ",
"type": "root"
},
{
"background": "#444444",
"foreground": "#E4E4E4",
"powerline_symbol": "\ue0b0",
"properties": {
"style": "full"
},
"style": "powerline",
"template": " {{ .Path }} ",
"type": "path"
},
{
"background": "#686235",
"background_templates": [
"{{ if or (.Working.Changed) (.Staging.Changed) }}#396b3d{{ end }}",
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}#c5e478{{ end }}",
"{{ if gt .Ahead 0 }}#C792EA{{ end }}",
"{{ if gt .Behind 0 }}#C792EA{{ end }}"
],
"foreground": "#55f300",
"powerline_symbol": "\ue0b0",
"properties": {
"branch_icon": "\ue725 ",
"fetch_status": true,
"fetch_upstream_icon": true
},
"style": "powerline",
"template": " {{ .HEAD }} {{ if .Working.Changed }}{{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }}<#ecef34> \uf046 {{ .Staging.String }}</>{{ end }} ",
"type": "git"
}
],
"type": "prompt"
},
{
"alignment": "right",
"segments": [
{
"background": "#303030",
"foreground": "#3C873A",
"leading_diamond": " \ue0b6",
"properties": {
"fetch_package_manager": true,
"npm_icon": " <#cc3a3a>\ue5fa</> ",
"yarn_icon": " <#348cba>\ue6a7</>"
},
"style": "diamond",
"template": "\ue718 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }}",
"trailing_diamond": "\ue0b4",
"type": "node"
},
{
"type": "time"
}
],
"type": "prompt"
},
{
"alignment": "left",
"newline": true,
"segments": [
{
"foreground": "#0077c2",
"style": "plain",
"template": "\u2570\u2500 ",
"type": "text"
},
{
"foreground": "#e0f8ff",
"foreground_templates": [
"{{ if gt .Code 0 }}#ef5350{{ end }}"
],
"properties": {
"always_enabled": true
},
"style": "plain",
"template": "\u276f ",
"type": "status"
}
],
"type": "prompt"
}
],
"version": 2
}

0 comments on commit 35d3dad

Please sign in to comment.