User:Andrew Nikitin/namecomplete
Jump to navigation
Jump to search
Name completion
The verb completename extracts partial name to the left from the caret from Jwd session manager, then looks up all matching names in current locale and all locales listed in current locale's path and present them in the matching box for final confirmation.
Bind this verb to a key and use the key as a shortcut to complete partially typed names.
Installation
Add line
load 'path/to/namecomplete.ijs'
to ~config/startup.ijs
Binding
In the menu Edit|Configure select FKey category. Then choose Add and
- Function key=F3
- Output=Quiet
- Label=Complete name
- Code=
completename_jijs_ (,copath) coname''
Script
P1 Portable bitmap ASCII
NB. NB. Place call to this script in: NB. j601, jade: ~config/startup.ijs NB. j601, console: don't; console not supported NB. NB. y = list of locale names where to look for candidates for completion completename_jijs_=:3 : 0 if. ''-:y do. y=.<'base' end. smselact'' pos=. {. smgetsel'' txt=. smread'' NB. smreplace '' try. w=.>{:;: ''''-.~utf8 _80{.pos{.txt lw=.w (({.@E. > )"_ 0 # ]) ;(3 : '<nl__y ''''')"> y cpl=.(#w)}. ; (({.@] # ({~ {:)) >@wdselect)^:(1<#) lw catch. cpl=.'' end. smsetselect 1,~2#(pos) smreplace cpl smsetselect 1,~2#(pos+#cpl) ) NB. Code for FKey: NB. completename_jijs_ (,copath) coname''