Sunday, June 5, 2016

Cool Little Plover Trick

A cool Plover trick invented by my longtime friend and recent Plover learner Martin:
Someone else may find this useful; I created a new version of my dictionary update stroke. What this does is copy the word immediately before the cursor to the clipboard, then pop up the Add Translation window, paste the copied word into the "Translation" field, then puts focus back in the "Strokes" field:

{#Control_L(Shift_L(Left) Control_L(c) Control_L(Right)}{PLOVER:ADD_TRANSLATION}{#Tab Control_L(v) Shift_L(Tab)}

In other words, hit control-shift-left to highlight the word immediately preceding, then hit control-C to copy to clipboard, then control-right to return to the starting position. Open the "Add Translation" window. Hit tab once to get to the "Translation" field, control-V to paste the word, and then shift-tab to return to the "Strokes" field.

For example, you're typing the following text: "First you must arrange the broongle in alphabetical order." Since you expect "broongle" to be a common term you'll need a lot, you decide you want to brief it. After fingerspelling "broongle", you can use this new dictionary update stroke. The Add Translation window will appear with "broongle" already in the "Translation" box. Now you just need to stroke PWRAOPBG/*L and hit R-R; the definition is saved. No need to fingerspell "broongle" more than once.

Three caveats:

  • Obviously this stroke will overwrite whatever else you had in your clipboard.

  • This stroke is dependent on the exact layout of the "Add Translation" form, and thus it may well stop working properly in future Plover versions.

  • This stroke doesn't work when you're dealing with multiple words separated by a space or a hyphen - if you try it with "foongle-broongle", only "broongle" will wind up in the translation box. In that case, you'll need to either fingerspell it again or select the text and copy it yourself. (Unfortunately, there is no control-shift-left or control-shift-right defined in the standard Plover dictionary, and while it is in the modifiers.json dictionary, it requires three strokes for each word you want to move backwards.)
  • Nice, dude. Very nice. Definitely gonna try that one out.

    4 comments:

    1. Just to clarify: it looks like although modifiers.json is not part of the default Plover installation it is available in this repository on GitHub:

      https://github.com/morinted/plover-modifiers

      And so there is also a Python script available (make-modifiers.py) which one could use to make a custom modifiers.json file in an automated way.

      When I didn't see it there I wasn't sure what was being referred to and so just did a Google search for: "plover modifiers.json" and saw the repository.

      ReplyDelete
    2. One other comment that I could make is that that method seemed to work pretty well. I have been going and manually editing user.json and then closing and restarting Plover. I think I even saw a feature request to have dictionary reloading from the file; however, when I tried that method which uses the dictionary editor:

      1) The new definition was then available without a restart.
      2) It was possible to just do the strokes to make the definition, and it could handle multi-stroke entries.
      3) One can see existing definitions.
      4) It added the definition to user.json which is where I have been putting my customizations.

      And so using the dictionary editor like that seems better than manually editing and then restarting.

      I don't know how it decides which file to add the definition to, but adding it to user.json is what I was doing before manually.

      I'm also not sure how it picks where in the file to add it, but I suppose that isn't too critical if one is basically using the dictionary editor built into the software.

      Here is the link for the feature request to have manual reloading of the dictionary file.

      https://github.com/openstenoproject/plover/issues/474

      ReplyDelete
    3. A few more comments on this method of using TKUPT:

      1. It's possible to use it also for the purpose of doing a lookup of a word. This can be a lot faster than going through the GUI.

      2. I also made another similar entry which can be used for multiple words.

      "TK*UPT": "{PLOVER:ADD_TRANSLATION}{#Tab Control_L(v) Shift_L(Tab)}",

      One can then go and copy all the words that one is either seeking to define or to lookup to the clipboard.

      It's also possible to go and use TA*B to tab through the input boxes in the window.

      3. One other comment is that it's not clear that one really needs to necessarily go and delete previous entries but could just overwrite them using TKUPT.

      For example I had made a definition in terms of:

      "RAO*EUT" : "right :)",

      which I figured could be used in the course of doing online tutoring.

      However, I decided to try doing a transcription of a recorded discussion related to religion and so I made this entry also using TKUPT.

      "RAO*EUT" : "rite",

      which is actually what the regular dictionary has.

      But it was a lot faster to just go and overwrite using TKUPT than it was to delete the one I had added earlier for "right :)".

      And I'm not sure that there is really any issue with such a practice.

      In fact when I looked in user.json I saw that the previous entry for "right :)" wasn't present at all.

      If one then decided to change it back it would be possible to do so again using TKUPT.

      ReplyDelete
    4. This is very useful :)
      Just a note, the first little bit of that shortcut should be:

      {#Control_L(Shift_L(Left))

      In the original post, there's a missing closing parenthesis and it throws up an error.

      ReplyDelete