Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

personal keybindings #5

Open
rjkroege opened this issue Mar 30, 2018 · 8 comments
Open

personal keybindings #5

rjkroege opened this issue Mar 30, 2018 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@rjkroege
Copy link
Owner

I need to add back the keybindings that I've hacked into my own fork of p9p acme in a way that multiple different bindings can exist in the same binary.

@rjkroege rjkroege self-assigned this Mar 30, 2018
@paul-lalonde
Copy link
Collaborator

How can we do this without icky config files? I can see an easy enough scheme where the fragments in the Type switch are selected through a map, but I can't figure out a nice way to initialize that map without becoming Emacs.

@rjkroege
Copy link
Owner Author

Serialize / de-serialize the map to the dump file? Then edit externally.

@paul-lalonde
Copy link
Collaborator

A Bind command could be interesting. Bind to an external command?

@rjkroege
Copy link
Owner Author

Can you expand on what the Bind command would do?

@paul-lalonde
Copy link
Collaborator

The simple version takes all the key switch cases in text.go, drops them into named closures/funcs (because you have too much shared state in there?), and indexes them based on a bind table of keystrokes. Bind ties the name of func to the key.
Bind to external could throw the selected keystroke to an external app (instead of just typed text as the current event file does) for resolution. Perhaps a "keystrokes" file.

@rjkroege
Copy link
Owner Author

Conceivably over-engineered proposal:

  • map is writable from filesystem (so no need to define how to enter keys in the UI)
  • bindings in filesystem directory
  • write to the bindings a sequence of or more *key*' '*command*'\n'` to bind key to command
  • write key \n to remove the binding for key
  • per above: key is the index of a map of command functions
  • an external binding simply wraps the specified string
  • a key without binding inserts itself. In particular: instead of switch statement: lookup key in map. Run if command if present else insert key.
  • space and \n can't be bound to keys other than inserting themselves.
  • Read bindings shows them (key ' ' command)
  • bindings would be persisted in the dump file

Example

Middle-clicking something like this:

echo 👍 eraseWord | 9p write acme/bindings

would make the unicode delete a word. And

; 9p read acme/bindings
PJW eraseWord
PJW eraseChar
PJW tickUp
. . .

I suppose that the map could be per-Window.

@paul-lalonde
Copy link
Collaborator

I would not like to see the map be per-window unless we found a compelling use case.
I could live with that proposal.

@rjkroege rjkroege added the enhancement New feature or request label Apr 1, 2018
@rjkroege rjkroege added the in progress Work has started... label Jul 15, 2018
rjkroege added a commit that referenced this issue Jul 20, 2018
More typing code relocation for #5.
rjkroege added a commit that referenced this issue Jul 20, 2018
More code motion for #5.
rjkroege added a commit that referenced this issue Jul 20, 2018
More code relocation for #5
rjkroege added a commit that referenced this issue Jul 20, 2018
More typing code motion to address #5
rjkroege added a commit that referenced this issue Jul 20, 2018
Refactor typing code further in pursuit of #5
rjkroege added a commit that referenced this issue Jul 20, 2018
@rjkroege rjkroege removed the in progress Work has started... label Nov 24, 2018
@camsn0w
Copy link
Contributor

camsn0w commented Jul 7, 2021

An additional thought I had is having the option to bind keyboard shortcuts to tagbar applications, for example a user could bind ctrl+shift+f to a find and replace app they wrote.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants