diff --git a/shells/zsh/includes/lfcd.zsh b/shells/zsh/includes/lfcd.zsh index ee16f193..64ee2f9b 100644 --- a/shells/zsh/includes/lfcd.zsh +++ b/shells/zsh/includes/lfcd.zsh @@ -9,4 +9,4 @@ lfcd () { fi } alias lf="lfcd" -bindkey -s '^o' 'lf\n' +#bindkey -s '^o' 'lf\n' diff --git a/shells/zsh/includes/paging.zsh b/shells/zsh/includes/paging.zsh new file mode 100644 index 00000000..5520b943 --- /dev/null +++ b/shells/zsh/includes/paging.zsh @@ -0,0 +1,36 @@ +# Modify the input line before it runs +function page() { + #commands=(${(@s:/:)BUFFER}) + + # Gets the words + words=(${(z)BUFFER}) + + # If there isn't anythng typed, fall back to old tab binding + if [ ${#words} -lt 1 ]; then + zle ${enterBehaviour:-accept-line} + return + fi + + + lastCommand="$(printf "%s\n" words | tac | sed -E '/^(\||\&\&|\|\|)$/,$d' | tac)" + lastCommand="${(s:\n:)lastCommand}" + + case "$BUFFER" in + *"--help" | *"-h" ) + BUFFER="$BUFFER | bat" + ;; + esac + + + zle ${enterBehaviour:-accept-line} +} + +enterBehaviour="accept-line" +binding=$(bindkey '^M') +[[ $binding =~ 'undefined-key' ]] || enterBehaviour=$binding[(s: :w)2] + +unset original_binding + +zle -N page +# Bind to the Enter key +bindkey '^M' page diff --git a/shells/zsh/includes/promptconfig.zsh b/shells/zsh/includes/promptconfig.zsh index 333ccbc9..0f9e91d6 100644 --- a/shells/zsh/includes/promptconfig.zsh +++ b/shells/zsh/includes/promptconfig.zsh @@ -98,7 +98,7 @@ function prompt_project() { local current_project_name="$(project current)" local background="" if [[ "$parent_process" == "/usr/bin/script" ]]; then - segment_content="辶" + segment_content=" " fi # If there is a current project if [ -n "$current_project_name" ]; then @@ -157,6 +157,14 @@ prompt_git(){ echo "$color" } +prompt_edinburughairport(){ + if [ -n "$(find ~/.local/share/airportwait -mmin '+1')" ]; then + https https://blip-api.edinburghairport.com/blip-api/blip | jq -r '" " + (.queue | tostring) + "  " + (.minutes | tostring)' > ~/.local/share/airportwait + fi + cat ~/.local/share/airportwait + echo "yellow3" +} + prompt_last_exit_code() { local LAST_EXIT_CODE="$1" if [[ $LAST_EXIT_CODE -ne 0 ]]; then @@ -262,6 +270,13 @@ set_prompts(){ PROMPT="$PROMPT$(echo "$segment" | sed -n '1p')" background="$(echo "$segment" | sed -n '2p')" fi + # + # Airport + #segment="$(draw_segment "prompt_edinburughairport" "$background")" + #if [ -n "$(echo "$segment" | sed -n '1p')" ];then + # PROMPT="$PROMPT$(echo "$segment" | sed -n '1p')" + # background="$(echo "$segment" | sed -n '2p')" + #fi PROMPT="$PROMPT $(seperator "$background")$(resetColor)"