开发者

How to bind numeric keypad keys in TextMate?

开发者 https://www.devze.com 2023-02-06 13:53 出处:网络
I often use TextMate on a desktop Mac with a full (old-style) Macintosh keyboard with a full numeric keypad.I\'d like to be able to bind menu item keys, ma开发者_StackOverflow中文版cro key triggers an

I often use TextMate on a desktop Mac with a full (old-style) Macintosh keyboard with a full numeric keypad. I'd like to be able to bind menu item keys, ma开发者_StackOverflow中文版cro key triggers and other actions to some of those numeric keypad keys.

I understand I can do this for some Cocoa (?) text editing commands in a ~/Library/KeyBindings/DefaultKeyBinding.dict file, but for Macros the TextMate dialog box doesn't distinguish between numeric keypad and main keypad keys with the same name. Ditto for the OS/X keyboard shortcuts preference pane used to change TextMate menu item keys.

Should I be trying to customize some of the core bundles instead?

Any advice much appreciated,

Stu


I understand I can do this for some Cocoa (?) text editing commands in a ~/Library/KeyBindings/DefaultKeyBinding.dict file

This is the key. TextMate does use this file, but in addition it has its own version that may be used to override settings or provide unique actions. You can even call some TextMate functions (selectors) directly through this method.

I recommend copying the default version from /Applications/TextMate.app/Contents/Resources/KeyBindings.dict to ~/Library/Application Support/TextMate/KeyBindings.dict and modifying it there.

Unfortunately, calling Bundle macros is a challenge... but I think it may be possible through some clever combinations of commands...

("insertText:"," keypad1.sh","selectWord:","executeCommand:")

Then, if you add into your source bundle the default values of the commands (in Support/bin) --- keypad1.sh returns 1... --- you can have customized commands in the Bundles you're interested in modifying.

I haven't tried this, but I think it may just work...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号