#!/bin/bash _CR="\e[170D\e[1B" _E1="\e[1C" _E2="\e[2C" _E_RIGHT="\e[70C" _BOLD="\e[1m" _BLACK="\e[38;5;0m" _RED="\e[38;5;1m" _BLUE="\e[38;5;4m" _PURPLE="\e[38;5;5m" _CYAN="\e[38;5;6m" _BG_RED="\e[48;5;1m" _RESET="\e[0m" # _title [string:bg_color] [string:message] [bool:right] _title() { printf "$_CR$_E1$_BOLD$_BLACK$1" [[ ! -z $3 ]] && printf "$_E_RIGHT" for (( i=0; i<(( 10 - ${#2} / 2 )); i++ )) do printf " " done printf "$2" for (( i=0; i<(( 10 - ${#2} / 2 )); i++ )) do printf " " done (( ${#2} % 2 == 0 )) && printf " " printf "$_RESET$_CR" } # _shortcut [string:modifier] [string:key] [string:message] [bool:right] _shortcut() { _MODIFIER=$(sed "s|+|\\\e[38;5;1m+\\\e[38;5;5m|g" <<< $1) [[ ! -z $4 ]] && printf "$_E_RIGHT" printf "$_E2" printf "$_PURPLE$_MODIFIER$_RESET" [[ ! -z $1 ]] && printf "$_RED+$_RESET" printf "$_CYAN$2$_RESET" printf " $3" printf "$_CR" } _move() { printf "\e[$1;$2H" } tput civis clear _title "\e[48;5;063m" "Windows" _shortcut "" "-" "Decrease size" _shortcut "" "+" "Increase size" _shortcut "Ctrl" "Arrow" "Navigate" _shortcut "Ctrl+w" "q" "Quit" _shortcut "Ctrl+w" "v" "Vertical split" _shortcut "Ctrl+w" "s" "Horizontal split" _shortcut "Ctrl+w" "x" "Exchange withnext one" _shortcut "Ctrl+w" "=" "Reset resizing" _title "\e[48;5;035m" "Buffer" _shortcut "" "Tab" "Cycle buffer" _title "\e[48;5;191m" "tab (:tabxxx)" _shortcut "Shift" "Tab" "Cycle tables" _shortcut "Shift" "tn" "New Table" _shortcut "Leader" "tc" "Close tab" _title "\e[48;5;170m" "No Highlight" _shortcut "Leader" "nh" "Remove search highlight" _title "\e[48;5;092m" "Normal mode" _shortcut "" "w" "Move by word" _shortcut "" "0" "Move begin of line" _shortcut "" "$" "Move end of line" _shortcut "" "gg" "Move begin of buffer" _shortcut "" "G" "Move end of buffer" _title "\e[48;5;204m" "Visual mode" _title "\e[48;5;214m" "not finished yet" read -n 1 -s