Skip to content

Instantly share code, notes, and snippets.

@crcx
Created October 17, 2012 18:56
Show Gist options
  • Save crcx/3907395 to your computer and use it in GitHub Desktop.
Save crcx/3907395 to your computer and use it in GitHub Desktop.
yet another approach
9 variable: prefix:CHAR
create prefix:TABLE
256 allot
: getc:internal ( -c ) &getc 2 + @ do ;
[ dup @prefix:CHAR == [ drop getc:internal "prefix:TABLE" find drop @d->xt + @ dup 0 <> [ dip cr ] [ drop ] if 0 ] ifTrue ] is remapKeys
: bindTo: ( quote "character" - )
getc "prefix:TABLE" find drop @d->xt + ! ;
[ cr
"? help text\n" puts
"d<word> documentation for word\n" puts
"s show stack contents\n" puts
"p<char> change trigger character to <char>\n" puts ] bindTo: ?
[ "display docs for: " puts
getToken find [ cr @d->doc 0; puts ] [ drop cr "no docs found!" puts ] if ] bindTo: d
[ "display functions matcing: " puts
getToken cr (matching) ] bindTo: m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment