diff --git a/dotfiles_template/shell/.inputrc b/dotfiles_template/shell/.inputrc index 4be2b4b20..b960b8a0d 100644 --- a/dotfiles_template/shell/.inputrc +++ b/dotfiles_template/shell/.inputrc @@ -1,6 +1,12 @@ $if Bash - "\C-l": redraw-current-line - "\e\C-j": accept-line - "\C-j": "\C-l\e\C-j" - "\C-m": "\C-l\e\C-j" + "\C-l": clear-screen + "\C-b": redraw-current-line + "\e\C-j": accept-line + "\C-j": "\C-b\e\C-j" + "\C-m": "\C-b\e\C-j" + "\C-p":previous-history + "\C-n":next-history + "\C-a.":beginning-of-line + "\C-e.":end-of-line + "\C-l":clear-screen $endif diff --git a/shell/bash/init.sh b/shell/bash/init.sh index 89176e8e5..7975f5226 100755 --- a/shell/bash/init.sh +++ b/shell/bash/init.sh @@ -1,14 +1,17 @@ -if [[ "$(ps -p $$ -ocomm=)" =~ (bash$) ]]; then - __right_prompt() { - RIGHT_PROMPT="" - [[ -n $RPS1 ]] && RIGHT_PROMPT=$RPS1 || RIGHT_PROMPT=$RPROMPT - if [[ -n $RIGHT_PROMPT ]]; then - n=$((COLUMNS - ${#RIGHT_PROMPT})) - printf "%${n}s$RIGHT_PROMPT\\r" - fi - } - export PROMPT_COMMAND="__right_prompt" -fi +#!/usr/bin/env bash +# Rigth prompt for bash definition +__right_prompt() { + RIGHT_PROMPT="" + [[ -n $RPS1 ]] && RIGHT_PROMPT=$RPS1 || RIGHT_PROMPT=$RPROMPT + if [[ -n $RIGHT_PROMPT ]]; then + n=$((COLUMNS - ${#RIGHT_PROMPT})) + printf "%${n}s$RIGHT_PROMPT\\r" + fi + + if [[ -n "${THEME_COMMAND:-}" ]] && declare -F "${THEME_COMMAND:-}" &> /dev/null; then + "${THEME_COMMAND:-}" + fi +} PATH=$( IFS=":" @@ -39,9 +42,13 @@ fi for THEME_PATH in ${themes_paths[@]}; do SLOTH_THEME="${SLOTH_THEME:-DOTLY_THEME}" THEME_PATH="${THEME_PATH}/${SLOTH_THEME:-codely}.sh" + THEME_COMMAND="" #shellcheck source=/dev/null - [ -f "$THEME_PATH" ] && . "$THEME_PATH" && break + [ -f "$THEME_PATH" ] && . "$THEME_PATH" && THEME_COMMAND="${PROMPT_COMMAND:-}" && break done +# Now we know which theme we should use, so define right prompt +PROMPT_COMMAND="__right_prompt" +export THEME_COMMAND PROMPT_COMMAND find {"${SLOTH_PATH:-${DOTLY_PATH:-}}","$DOTFILES_PATH"}"/shell/bash/completions/" -name "_*" -print0 -exec echo {} \; 2> /dev/null | xargs -0 -I _ echo _ | while read -r completion; do [[ -z "$completion" ]] && continue diff --git a/shell/bash/themes/codely.sh b/shell/bash/themes/codely.sh index 0a21383c3..9794367d5 100644 --- a/shell/bash/themes/codely.sh +++ b/shell/bash/themes/codely.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash PROMPT_COMMAND="codely_theme" MIDDLE_CHARACTER="◂" diff --git a/shell/bash/themes/codelytv.sh b/shell/bash/themes/codelytv.sh new file mode 120000 index 000000000..eb1c20de0 --- /dev/null +++ b/shell/bash/themes/codelytv.sh @@ -0,0 +1 @@ +codely.sh \ No newline at end of file diff --git a/shell/zsh/init.sh b/shell/zsh/init.sh index f02a82270..ee7065e17 100755 --- a/shell/zsh/init.sh +++ b/shell/zsh/init.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env zsh #shellcheck disable=SC2148 reverse-search() { local selected num