sublime-emacs/sublemacspro

Home and End keys do not work like Emacs

MGarvinNYC opened this issue · 8 comments

The Home and End keys (7 and 1 keys, resp, on the normal numeric keypad) go to the start or end of -file-.

In Emacs, they move to the start or end of -line-.

Is there any easy way to fix this?

You can create a pair of bindings for "keypad1" and "keypad7" I think. Something like this:

{"keys": ["keypad1"], "command": "sbp_move_to", "args": {"to": "eof"}},
{"keys": ["keypad7"], "command": "sbp_move_to", "args": {"to": "bof"}},

Let me know if this actually works!

@canoeberry Don't you mean this:

    {"keys": ["keypad1"], "command": "move_to", "args": {"to": "hardbol", "extend": false }},
    {"keys": ["keypad7"], "command": "move_to", "args": {"to": "hardeol", "extend": false }},

I think he is saying the numeric keys move to the beginning and end of the line. I don't have a keyboard I can check if this will work.

I don't know if you mean hardbol or soft bol but this can be changed easily to just bol or eol if you mean the soft eol/bol.

Wow - I misread it even after you told me what it actually said.

Yes - you are right.

Yes, in regular Emacs (and Epsilon and similar), the keypad home and end navigate to the start and end of line. In Sublime, they go to the start and end of the file (not very useful, IMO, and frustrating for those of us who use those reflexively and end up losing our place in the file)

I'll try the suggested patch. Thanks.

OK then...I tried it. No change in behavior. I tried both 'hardbol' and 'bol'. I verified that the changes were indeed added to the file: Default (Linux).sublime-keymap

Any other ideas?

Can you open the console and type:

sublime.log_input(True)

What is the output when pressing the keypad1 key and the keypad7 key (to verify what keys it is actually pressing then.) I assume if you change the commands above to noop that it still goes to the beginning of the file:

{"keys": ["keypad1"], "command": "noop"}

What system are you on as that might help. I know in the forums I saw problems posted with setting numeric keypad keys in windows. Maybe you could get more help if you posted in the sublime forums about this as you are just putting this in the user key bindings file. Technically, from the Sublime documentation that should work properly to override the numeric keypad keys though as can be checked at this link: (http://docs.sublimetext.info/en/latest/reference/key_bindings.html). I don't have a numeric keyboard to test though and only have OSX.

Edited the comment above sorry for the changes.

The console monitor was helpful. Seems that the home and end keys are just called 'home' and 'end' (Doh!). I never use the numlock, so perhaps referring to it as the numeric keypad was misleading.

In any case, it does appear to be working. Thanks for taking the time to follow up on this.