Skip to main content

Plover plugin to make typing identifier in programming languages easier

Project description

plover-auto-identifier

You don't have to keep typing KPA* or RUPBD while programming.

Example usage

  • Type THRAEUT R*UPBD STROEBG, translate_stroke is printed.
  • From the next time, typing THRAEUT STROEBG will automatically create translate_stroke.
  • The first step is not necessary with editor integration.

This program is available on GitHub and PyPI. 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.

Configuration

Create a file named plover_auto_identifier_config.json in 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). -1 means unlimited.

Features

  • Define a dictionary entry mapped to =auto_identifier_mark to 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_remove to 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 (with authkey=None).

    The file must be encoded in UTF-8 encoding.

    The existing identifiers will be removed.

    Note that it's necessary to send only one message for each connection.

For example, you can place this code into .vimrc (UNIX system):

function s:NotifyPloverAutoIdentifier()
pythonx << EOF
import vim
from multiprocessing import connection
filepath=vim.eval('expand("%:p")')
if filepath: #if the user edit a new buffer, filepath might be empty
	try:
		c=connection.Client("/tmp/.plover_auto_identifier_socket")
		try:
			c.send(("file", filepath))
		finally:
			c.close()
	except FileNotFoundError:
		pass # the plugin is not listening
	except OSError as e: # weird behavior
		print(e)

EOF
endfunction

augroup vimrc_notify_plover_auto_identifier
	auto!
	auto BufEnter,BufWritePost * call s:NotifyPloverAutoIdentifier()
augroup END

Idea:

  • 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 options
      • Revert 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 word
    • In the latter 2 cases there should be a stroke that undo the conversion
    • Do not convert anything if there's any no-op stroke!
      • No-op: for example delete-space TK-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?

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plover_auto_identifier-0.1.2.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

plover_auto_identifier-0.1.2-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file plover_auto_identifier-0.1.2.tar.gz.

File metadata

  • Download URL: plover_auto_identifier-0.1.2.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.6.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.3

File hashes

Hashes for plover_auto_identifier-0.1.2.tar.gz
Algorithm Hash digest
SHA256 bce5ccce802e58d79f25e50ed953b4a5a241d5301f652cf7e8536477d9c1d4e2
MD5 ea36587243abb6523757850632108313
BLAKE2b-256 5663ba22c874659717a2b426096ef6bc39fc35030ebd0a6db29d1904e6801f26

See more details on using hashes here.

File details

Details for the file plover_auto_identifier-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: plover_auto_identifier-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 22.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.6.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.3

File hashes

Hashes for plover_auto_identifier-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bdef334bd0a4bdbe77f23e634a2678fd8174ae0d8008914c03c20695d50edb2e
MD5 86b307eede988ac2753f3c05cb3796ae
BLAKE2b-256 5cbf0a9eeebab5ed29b080983ae177c2a3d7ab0f0d3cc9eb69bc858bf3980bbf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page