Package: plover-auto-identifier
plover-auto-identifierYou don't have to keep typingKPA*orRUPBDwhile programming.Example usageTypeTHRAEUT R*UPBD STROEBG,translate_strokeis printed.From the next time, typingTHRAEUT STROEBGwill automatically createtranslate_stroke.The first step is not necessary with editor integration.This program is available onGitHubandPyPI. Report bugs on GitHub.Note that this program uses some internal API of Plover, and thus is not guaranteed to work
on any given Plover versions.ConfigurationCreate a file namedplover_auto_identifier_config.jsonin Plover's configuration folder
with the content:{"max_size":100000000}Fields:max_size: the maximum size of a file in bytes that a file can be loaded automatically
(to read the words from).-1means unlimited.FeaturesDefine a dictionary entry mapped to=auto_identifier_markto mark the most recently typed
word as an identifier
(only works if the identifier is stroked with no more than 10 translations)Note that identifiers are also mapped automatically.Define a dictionary entry mapped to=auto_identifier_removeto unmap and revert the most recently
automatically converted identifier (only works if the translation is recent)Send to the named pipe\\.\pipe\plover_auto_identifier(Windows) or
socket/<tempdir>/plover_auto_identifier_socket(UNIX) a Python string
being the file name to read the list of identifiers from that file (withauthkey=None).The file must be encoded in UTF-8 encoding.The existing identifiers will be removed.Note that it's necessary to send onlyonemessage for each connection.For example, you can place this code into.vimrc(UNIX system):functions:NotifyPloverAutoIdentifier()pythonx<<EOF
importvimfrom multiprocessing import connection
filepath=vim.eval('expand("%:p")')iffilepath: #ifthe user editanewbuffer,filepath might be emptytry:c=connection.Client("/tmp/.plover_auto_identifier_socket")try:c.send(("file",filepath))finally:c.close()except FileNotFoundError:
		pass # the pluginisnot listening
	except OSErrorase: # weird behavior
		print(e)EOFendfunctionaugroup vimrc_notify_plover_auto_identifier
	auto!autoBufEnter,BufWritePost*calls:NotifyPloverAutoIdentifier()augroup ENDIdea:Integrate with some editor to load the word list (done)Also track the output for the word list. (done)But if the word typed is deleted, also remove that word from the word list. (TODO)That is, if there's no editor integration (TODO)Given a word list...If user stroke A/B/C -> "a b c", automatically convert it to "aBC" (assuming camel case)Then if user press*there are two optionsRevert to "a b c" (note: do not reform the word immediately!)Revert to "a b" (which is the one that makes the most sense with Plover's default meaning of undo)Note: handle the case that the last "formed" word/translation has replaced entries!Delete the whole wordIn the latter 2 cases there should be a stroke that undo the conversionDo not convert anything if there's any no-op stroke!No-op: for example delete-spaceTK-LS, camel-case, or underscore.Only change new content...?For example, if the user stroke A/B, then add aB to the word list,
then undo to the point with that content "a b" it should not be spontaneously changed to "aB".But what if the user delete the "b" then stroke it back?