#!/bin/bash # source this file to load key bindings for bpresent # alt-w: # clear screen and go back to previous example _binding_alt_w=( '"\ew":"' #alt-w '\C-a\C-k' #clear line '$(( _I > 0 && _I-- ))' #decrement unless we've bottomed out '\e\C-e\C-a\C-k' #interpolate to run decrement above and clear the line '\\\n\C-l' #bring us down onto a newline and clear screen '\"$(_example.unpack \"${_examples[$_I]}\")\"' #pull the current example '\e\C-e"' #interpolate ) # alt-W: # go back to previous example without clearing the screen _binding_alt_W=( '"\eW":"' #alt-W '\C-a\C-k' #clear line '$(( _I > 0 && _I-- ))' #decrement unless we've bottomed out '\e\C-e\C-a\C-k' #interpolate to run decrement above and clear the line '\\\n' #bring us down onto a newline '\"$(_example.unpack \"${_examples[$_I]}\")\"' #pull the current example '\e\C-e"' #interpolate ) # alt-a: # clear screen and provide current example again without advancing _binding_alt_a=( '"\ea":"' #alt-a '\C-a\C-k' #clear line '\\\n\C-l' #bring us down onto a newline and clear screen '\"$(_example.unpack \"${_examples[$_I]}\")\"' #pull the current example '\e\C-e"' #interpolate ) # alt-A: # provide current example again without advancing or clearing the screen _binding_alt_A=( '"\eA":"' #alt-A '\C-a\C-k' #clear line '\\\n' #bring us down onto a newline '\"$(_example.unpack \"${_examples[$_I]}\")\"' #pull the current example '\e\C-e"' #interpolate ) # alt-e: # clear screen and advance to next example _binding_alt_e=( '"\ee":"' #alt-e '\C-a\C-k' #clear line '$(( _I < ${#_examples[@]} - 1 && _D && _I++,_D=1 ))' #increment,deinitialize '\e\C-e\C-a\C-k' #interpolate to run above and clear the line '\\\n\C-l' #bring us down onto a newline and clear screen '\"$(_example.unpack \"${_examples[$_I]}\")\"' #pull the current example '\e\C-e"' #interpolate ) # alt-E: # advance to next example without clearing the screen _binding_alt_E=( '"\eE":"' #alt-E '\C-a\C-k' #clear line ' $(( _I < ${#_examples[@]} - 1 && _D && _I++,_D=1 ))' #increment,deinitialize '\e\C-e\C-a\C-k' #interpolate to run above and clear the line '\\\n' #bring us down onto a newline '\"$(_example.unpack \"${_examples[$_I]}\")\"' #pull the current example '\e\C-e"' #interpolate ) # alt-s: # side by side diff of previous and current example _binding_alt_s=( '"\es":"' #alt-s '\C-a\C-k' #clear line '_example.ydiff' #diff command '\C-l\n"' #clear screen and execute function ) # alt-S: # syntax highlighted side by side diff of previous and current example _binding_alt_S=( '"\eS":"' #alt-S '\C-a\C-k' #clear line '_example.ydiff | hl --style clarity' #highlighted diff command '\C-l\n"' #clear screen and execute function ) # alt-h: # display current example with syntax highlighting _binding_alt_h=( '"\eh":"' #alt-h '_example.highlight' '\C-m' ) # alt-H: # display USAGE text for ariketa _binding_alt_H=( '"\eH":"' #alt-H '_ariketa.help' '\C-m' ) # alt-P: # Toggle between custom PS2 for giving example number and regular '>' prompt _binding_alt_P=( '"\eP":"' #alt-P '_ps2.swap' '\C-m"' ) #load bindings _bindings.load_from_arrays ${!_binding_*}