Sublime Forum

MultiBind - Simple multi-layered keybinding

#1

It’s only a prototype at the moment as I have never touched python before but will keep adding what I need.
Thought I’d post it as it could still be usable in some shape or form to someone at this stage and to see if there where any feature requests and ideas.

All it does is add a context barrier and a toggle command to control which barrier to disable.
No setup required (except plugin install). Just start assigning keybindings to any context barrier name and assign a toggle button.

[code]Toggle:
{“keys”:“whatever”], “command”:“multibind_toggle”, “args”:{ “layout”: “BARRIERNAME” }}

Barrier:
… “context”: {“key”:“multibind.BARRIERNAME”}] …[/code]

Developed and tested on ST3

Install:
Only manual available at this moment

Examples:
There are usage examples on github

Update (30.04.2013):
another example added. Tired atm so see reply for now.
http://www.sublimetext.com/forum/viewtopic.php?f=5&t=11625&p=47939#p47939

GitHub:
http://github.com/KonTrax/MultiBind

0 Likes

Dynamic Key Bindings?
Request for commands
Key input not handled correctly
#2

This is really neat. I was just fiddling with creating some modal keybindings last night and your plugin is a lot more elegant than what I’d cooked up.

I threw together some basic navigation keys loosely based on MiniGuru for a Colemak layout, in case anyone is interested: gist.github.com/alehandrof/5183332

I’m not quite happy with these. If anyone has any suggestions for home row navigation on a Colemak layout, I’m all ears.

Alex

0 Likes

#3

Good to hear. Still in constant search for the perfect keyboard setup myself so I love new opportunities. Will give your setup a go tomorrow if I have the time for sure. Just call out if you come across anything that could make the plugin better.

0 Likes

#4

I did the same thing before as well with a plugin called ShortcutPlus:

viewtopic.php?f=5&t=9931&start=0&hilit=shortcutplus

No one ever showed much interest, but the idea is the same. Shortcuts with profiles. Toggle different profiles.

0 Likes

#5

Well now we know there are at least 3 people interested. I will give your code a look tomorrow. In the end maybe we can spark some interest.

0 Likes

#6

Just updated mine. It had an unnecessary complicated step. Now it is really straight forward. It is good to see other people with the same idea. I will check out yours as well.

0 Likes

#7

You should put it on Package Control. I like it. Does the same as mine, but honestly, I have too many plugins to support as is ; I would love to get behind another developers plugin.

0 Likes

#8

@facelessuser I had seen ShortcutPlus in your sublime settings (among other things [1]), but I hadn’t tried to implement it. I’ve been meaning to look at it again, as I’m planning to fold all my OS settings into one config (and, if memory serves, I think that’s what I had seen you were using it for).

[1] Do I recall a calendar!?

Alex

0 Likes

#9

If you try anything from the settings repo, stick to the ST3, the most up to date stuff is there since I am using ST3 currently. I play around with stuff all the time in there. I have a bunch of random stuff in there.

You mean this thing? :smile:


I was playing around seeing if I could write my own enum library, and then wrote a calendar plugin to test it out with. Turns out I liked the calendar plugin: I pull it up at work all the time. You can even use shortcuts to toggle through the months. I was going to write something where you could define holidays and such…but I have never gotten around to that yet.

If you think the calendar is useful, I may throw it up on a repo. I didn’t know if people would care for it or not.

0 Likes

#10

At work I use a Win computer without admin rights, which locks me out of the taskbar’s date & time. (Grrr.) So this is useful to me as it is. I don’t want to ask you to maintain more packages :smile:

It there a way to use the calendar to input a date that I didn’t figure out?

Incidentally, there’s a community-supported holiday dataset in various formats (for Taskwarrior) here: holidata.net/locale_index.htm.

Alex

0 Likes

#11

Here are my Calendar shortcuts. The one you want for inputting a certain date is calendar_lookup. The date format is month/day/year (I realize this is not the format in all countries, but this could probably be updated to be more configurable in the future.

[pre=#2D2D2D] //////////////////////////////////////////////////////////////
// Calendar Shortcuts
//////////////////////////////////////////////////////////////
{
“keys”: “ctrl+super+alt+c”],
“command”: “calendar”
},
{
“keys”: “ctrl+super+alt+shift+c”],
“command”: “calendar_lookup”
},
{
“keys”: “alt+right”],
“command”: “calendar_month_nav”,
“context”:

        {
            "key": "calendar_view"
        }
    ],
    "args": {"reverse": false}
},
{
    "keys": "alt+left"],
    "command": "calendar_month_nav",
    "context":
    
        {
            "key": "calendar_view"
        }
    ],
    "args": {"reverse": true}
},[/pre]

I add this to my color scheme file to highlight days (granted I don’t do anything with holidays yet, but in the future I plan on it.

[pre=#2D2D2D]
name
Calendar Selected Day
scope
selected_day
settings

foreground
#2D2D2D
background
#F2777A



name
Calendar Holiday
scope
holiday
settings

foreground
#2D2D2D
background
#66CCCC

[/pre]

NIce, it even comes in easy to parse formats. I will look into adding support for this.

If you want, open another thread so we can discuss this; I don’t want to clutter up the authors plugin thread with unrelated discussion. I might just move calendar to a repo and open a thread myself…

0 Likes

#12

@quodlibet QuickCal thread is here viewtopic.php?f=5&t=11654&start=0

0 Likes

#13

Weird… I made something like this too. (It never really got fully fleshed out and was really buggy and tailored only to me so I never released it) Funny how everyone was thinking the same thing. Nice job.

0 Likes

#14

Great minds think alike :smile: . I wouldn’t be surprised though if more people don’t eventually start buying into this because there are only so many free shortcuts…

0 Likes

#15

It’s also good to remember to rely on the palette rather than binding everything.

0 Likes

#16

Update
I have rewritten the whole code. Still not 100% finished but its on git if someone was interested.

Will have to fill in with more information tomorrow as I’m barely awake. In short it’s restructured and added support for basic dynamic/environmental/automatic barriers as seen in facelessuser’s module

0 Likes

#17

I have made a quick example keymap section for MultiBind that enables quick wasd navigation (shift selection not added yet) and numbers acting as their shift / altgr counterparts on single click while maintaining numpad functionality.

NOTE: I am using a Norwegian keyboard layout but since it is mainly meant as an example for now It serves it’s purpose.

BEFORE:

click: 1 2 3 4 5 6 7 8 9 0 shift: ! " # ¤ % & / ( ) = altgr: @ £ $ € { ] }

AFTER:

click: ! " # $ % & / ( ) = shift: ! @ £ ¤ € & { ] } altgr: @ £ $ € { ] }

Gist url:
https://gist.github.com/KonTrax/5490205

Nordic keyboard layout image: (for reference)
http://www.qpad.se/uploads2/MK80/QPADMK80-NORDIC-Layout.png

0 Likes