Notepad3: change default keys for move line up/down

Created on 23 Jan 2020  Β·  33Comments  Β·  Source: rizonesoft/Notepad3

ATM moving lines up/down is done with Ctrl+Shift+Up/Down

Visual Studio and visual studio code (and possibly others) are doing this with Alt+up and Alt+down

These are now familiar keys (at least to me) and a much shorter combination that makes moving lines easier to use.

Can we change the default key combinations to Alt+up/Down ?

change request discussion

Most helpful comment

Based on @engelhro 's suggestion:

  • new: Altβ€―+β€―+ (Plus) and Altβ€―+β€―- (Minus) for jumping to next/prev fold
  • keep: Alt + β†’, Alt + ← for expand/collapse folds
  • change: Ctrl+Shift + ↑, Ctrl+Shift + ↓ to Alt + ↑, Alt + ↓ (move line up/down)
  • options: keep Ctrl+Shift + ↑, Ctrl+Shift + ↓ (move line up/down) OR clear this Shortcut
  • alternate: toggle meaning of Alt + β†’, Alt + ← & Altβ€―+β€―+ (Plus) and Altβ€―+β€―- (Minus)
    (expand/collapse & jump up/down folds)

All 33 comments

Hello @kofifus ,
You have already asked exactly the same question on issue #1810 πŸ˜‰

@hpwamr that was to ask for the move line feature which I then found out was already implemented so I closed the issue, this is for changing the key combination .. sorry for the confusion!

One remark to consider:
Alt+Up/Down has been chosen for "Fold Jumping", cause Alt+Left/Right is used for "Fold/Unfold Control", which makes this handling easier.
We would break this workflow ("Jump & Fold/Unfold").
(Ctrl+Shift+Left/Right is long lasting bound to "Extend Selection by Word-Jump" and should not be changed).

We would break this workflow ("Jump & Fold/Unfold").
(Ctrl+Shift+Left/Right is long lasting bound to "Extend Selection by Word-Jump" and should not be changed).

I understand and agree with your arguments ! πŸš€ πŸ’―

Is Jump and fold a useful thing ? Are you aware of people used to that ? Seems to me to be two unrelated activities

@kofifus : e.g. (see e.g. @engelhro 's comment)

Ok well is the decision then that alt up&down are taken ? If yes can there be another one modifier with up and down for moving lines maybe ?

Hello @kofifus ,
These movement shortcuts exist from Notepad2 and Notepad2-mod and are used in Notepad++, etc...

Honestly, without serious and very solid arguments to convince us of the need for change, we will not change anything in this area ! πŸ˜‰

Fair enough .. I'm just so used to the visual studio family shortcuts now ..

I would like to change the Shortcut too, I am using the Folding feature very seldom.
But if there is a vote (especially @engelhro) against changing, we should keep the old ones.
So let's wait a little bit...

Well, I indeed still use the folding feature, but to be honest I even more often use the move feature for lines myself… So I could live with a change here (as proposed to Alt + ↑ and Alt + ↓) and would not oppose.

The question would then be what other key combos to use instead for jumping between folded sections? And for sake of consistency, the fold and expand actions (currently Alt + β†’ and Alt + ←) should then be adapted accordingly (i.β€―e., same modifier together with the four arrow keys).

I have no good solution for changing the Shortcuts - only split party of "Alt + ↑, Alt + ↓, Alt + β†’, Alt + ←" (exchange only Alt + ↑, Alt + ↓ with Ctrl+Shift + ↑, Ctrl+Shift + ↓ πŸ€”

So far, I don't see a good solution for swapping the shortcuts, just an ugly mix of movement keys". 😟

The only way I foresee everyone everyone being totally happy would to make all the shortcut keys configurable, and I'd imagine this would be quite a large undertaking.

I'll make a suggestion here since it isn't totally off-topic, what I would really like to see is all the menu commands have a ID# assigned (or similar), then you set what shortcut keys you want for each ID#, another benefit of this approach would be that hopefully this could lead to being able to make custom toolbar buttons and assign them a menu command, because it is getting slower navigating the menus as each new entry gets added.

Why not move all folding to ctrl+shift+arrows ? I understand this a breaking change but to me moving lines is such a common thing to do that having it with one modifier and the same as in other environments is worth it ..

Hello @kofifus
My opinion is that Ctrl+R/L arrows and Ctrl+Shift+R/L arrows are basic keyboard shortcuts available in almost all Windows applications and moving them around will be a big mistake. 😬

@hpwamr I got confused you are totally correct about Ctrl+Shift+R/L arrows

What about Win+arrows or is there a reason for not using the Win modifier ?

Sorry, that should be clear, we are NOT using the "Windows" keys. 😟

The decision has to come down to whether moving lines is more or less useful than folding (btw the folding shortcuts dont seem to be documented ie here https://www.rizonesoft.com/documents/notepad3/keyboard-shortcuts/)

No one so far has said they prefer the folding shortcuts and a few said they prefer the line moving alt+up and down .. so I think we need to come out with replacement for the folding keys.

My feeling we should not even use alt left+right for something that is not often used like keyboard folding control

Sublime text uses Ctrl + Shift + [ to fold and
Ctrl + Shift + ] to unfold

Visual studio uses
Collapse to definitions CTRL + M, O
Expand all outlining CTRL + M, X
Expand or collapse everything CTRL + M, L

Any thoughts ?

I want to add this to feed the thinking about the moving of the folding shortcuts: πŸ€”

Restrictions:

  • Ctrl+Shift+[ - Fold (collapse) region --> works only on Querty US keyboard πŸ‘Ž
  • Ctrl+Shift+] - Unfold (uncollapse) region --> works only on Querty US keyboard πŸ‘Ž

As @hpwamr stated, special character shortcuts are a little bit problematic, because of different keyboard layouts. E.g on my German keyboard (and many other languages) the Right-Alt key is replaced by a AltGr, which combines a Alt+Ctrl in a single keystroke. Unfortunately this key is used to reach the square-brackets ([]) (same for curly-brackets). (see e.g. https://github.com/jeremyramin/terminal-plus/issues/137#issuecomment-329919145).
Microsoft advice: Ctrl+Alt should not be used as Shortcuts.

Also out of scope are control-sequence combinations (e.g. Ctrl+M,O), cause they are not used in Notepad3 yet and I don't like them to be introduced for this issue.

Ed.: Win+Left/Right are out of scope, cause they are intercepted by Win10 for window positioning...

What about ctrl + [ and ctrl + ] for folding ?

What about ctrl + [ and ctrl + ] for folding ?

Nope ! πŸ‘Ž

As already said in the 2 answers above, "[" and "]" is directly accessible ONLY by some "Qwerty US" keyboard!
For "Non Qwerty US" keyboard, "[" and "]" are formed with the "AltGr" key (Alt Graph)

This would lead to an infamous "Ctrl+AltGr+[" (which does NOT work)! πŸ‘Ž

Please see:

right, I'm curious how does VScode and sublime handle those funky keyboards ?
.
anyways maybe someone else can chip in here ..

those funky keyboards ?

"Qwerty US keyboard" and "English language" are not the Navel of the World ! 😁

Anyway, we are trying to find a solution to make everyone happy. πŸ˜ƒ

@kofifus : I just can't use these Shortcuts (fortunately VS Code has a full blown Keyboard configuration system, which is missing in Notepad2/Notepad3).

Another suggestion:

What about Ctrlβ€―+β€―Shiftβ€―+β€―+ (Plus) and Ctrlβ€―+β€―Shiftβ€―+β€―- (Minus) for folding? The first combo seems not be used in NP3, and the second one just inserts a special character (US) for me. Not sure where that comes from (I couldn't find the respective regular menu entry for that combo?), but maybe this one could be remapped as it seems of even less importance?

I'm aware that we would lose the consistency for folding and moving (one modifier together with the four arrow keys) which was proposed above (by myself :wink:). But although this handling of folds is a use case for me, it's a less regular one than shifting lines, and I could live with Altβ€―+ ↑ and Altβ€―+ ↓ for this task. I guess my brain and fingers could be retrained and get familiar with new key combos here :smile:.

Based on @engelhro 's suggestion:

  • new: Altβ€―+β€―+ (Plus) and Altβ€―+β€―- (Minus) for jumping to next/prev fold
  • keep: Alt + β†’, Alt + ← for expand/collapse folds
  • change: Ctrl+Shift + ↑, Ctrl+Shift + ↓ to Alt + ↑, Alt + ↓ (move line up/down)
  • options: keep Ctrl+Shift + ↑, Ctrl+Shift + ↓ (move line up/down) OR clear this Shortcut
  • alternate: toggle meaning of Alt + β†’, Alt + ← & Altβ€―+β€―+ (Plus) and Altβ€―+β€―- (Minus)
    (expand/collapse & jump up/down folds)
  • options: keep Ctrl+Shift + ↑, Ctrl+Shift + ↓ (move line up/down) OR clear this Shortcut
  • alternate: toggle meaning of Alt + β†’, Alt + ← & Altβ€―+β€―+ (Plus) and Altβ€―+β€―- (Minus)
    (expand/collapse & jump up/down folds)

My opinion is:

  • "Clear" this Shortcuts "Ctrl+Shift + ↑", "Ctrl+Shift + ↓" and keep them in reserve.
  • "Alternate:" do you mean an inversion between the Shortcuts for "jumping to next/prev fold" and "expand/collapse folds" πŸ€”

Edit:

  • From a first pre-build, It seems to me OK.
  • I propose to rename the Shortcuts in "menu_xx_yy.rc"

A few ideas

  1. why do we need separate keys for fold and unfold ? I thought maybe it was so I could fold an internal section by clicking ie alt+left multiple times (which would have been nice!) but that does not work. if we break the flow with jumping anyway then can't we use one toggle shortcut (Alt+F ?) instead of Alt+left and alt + right ? then alt+plus alt+minus for jumping ?
    Notye that visual studio toggles folding with Ctrl+M+M

  2. also if we switch keys to '+' and '-' we can modify them also with ctrl, which gives us 4 functions for two keys

  3. Also what about using alt + ',' and '.' ? on most keyboard they are much closer to the alt button than '-' and '+' and also they usually have '<' and '>' on them so they look like movement keys ...,
    so we can do alt + ',' and '.' for folding and ctrl + ',' and '.' for jumping
    .

  4. Maybe we can we still also add ctrl+alt+arrows for fold movement as an alternative for those that don't have the altgr issue (which is by far most ?) fold movement is very handy for code editing (just less than moving lines)

Thanks

@kofifus ,
Thanks for all your suggestions.
We will take the time to study them. πŸ€”

As far as I'm concerned, I think you (requester) can close this issue...

Hello @kofifus ,

Feel free to test the BETA version "Notepad3Portable_5.20.204.2722_BETA.paf.exe.7z" or higher.
See "Notepad3 BETA-channel access #1129" or here Notepad3Portable_5.20.204.2722_BETA.paf.exe.7z.

Note: "Notepad3Portable BETA" can be used in "2 flavors" (with or without the extension ".7z").

Your comments and suggestions are welcome... πŸ˜ƒ

@hpwamr thanks and thanks to everyone who commented - that works great.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wmsrww picture wmsrww  Β·  3Comments

hpwamr picture hpwamr  Β·  3Comments

blackcrack picture blackcrack  Β·  3Comments

RaffaeleBianc0 picture RaffaeleBianc0  Β·  3Comments

valhristov picture valhristov  Β·  3Comments