-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Ctrl, Alt, Shift + arrow keys #79
Conversation
Do you mean move the cursor, or move actual lines of text? I don't think you need a special keybinding to move the cursor by line – you can just use the up and down arrows right? Or am I missing something? |
These mappings include Alt+arrows and Shift+arrows and Alt+Shift+arrows This commit also switches the version of tcell that micro uses to my fork which supports alt, shift, and ctrl + arrows.
e748735
to
6c99eea
Compare
I'll reword it to be more clear. I mean move the cursor to the start and end of lines. |
Ah ok yep that makes sense, sorry, don't know why I didn't read it that way! |
Never seen that behavior on windows or linux. There, it's ctrl+arrows to move by word, alt+arrows doesn't do anything. Also, I tested this branch. At the moment, ctrl+arrows does nothing and alt+arrows inserts |
Ok, that's good to know. Ctrl keys don't do anything on the branch yet, but it seems like alt sends a different keycode on Linux than on Mac. It seems like the alt+arrows keycodes are not consistent across terminals, so it might be better to use ctrl+arrows instead. |
Linux and Windows applications use ctrl+left/right to move to the previous/next word break, and holding down shift selects according to the cursor movement. There aren't any universal conventions around alt+arrows or ctrl+up/down. On my current machine (GTK):
I suspect that these are rarely used, so Ctrl+Left/Right and Shift should cover 99% of use cases. |
On Mac, |
Alternative would be to use
Pressing I agree with using |
@Leeds-eBooks Unfortunately, it is impossible to detect |
Ah yes ok. Are you planning to make these keybindings configurable, like those already in micro? If so then all we're talking about is the defaults so it doesn't really matter too much. |
Yeah, all these keybindings will be configurable. |
The current keybindings are as follows: {
"ShiftLeft": "SelectLeft",
"ShiftRight": "SelectRight",
"AltLeft": "WordLeft",
"AltRight": "WordRight",
"AltShiftRight": "SelectWordRight",
"AltShiftLeft": "SelectWordLeft",
"CtrlLeft": "StartOfLine",
"CtrlRight": "EndOfLine",
"CtrlShiftLeft": "SelectToStartOfLine",
"CtrlShiftRight": "SelectToEndOfLine",
"CtrlUp": "CursorStart",
"CtrlDown": "CursorEnd",
"CtrlShiftUp": "SelectToStart",
"CtrlShiftDown": "SelectToEnd",
} You can rebind these however you'd like using the |
This pull request adds bindings for ctrl, alt, and shift + arrows. Here are the current bindings I plan on using.
shift+arrows: select
alt+arrows (left and right): move by word
alt+shift+arrows: select by word
ctrl+arrows (left and right): move to beginning and end of lines
ctrl+arrows (up and down): move to beginning and end of file
ctrl+shift+arrows: select according to movement
Let me know if you think the keybindings should be different.
Ref #21.