kakoune icon indicating copy to clipboard operation
kakoune copied to clipboard

[Discussion] Swap Space and Comma commands

Open alexherbo2 opened this issue 5 years ago • 18 comments

Current positions

Space → Clear multiple selections Alt Space → Remove a selection , → Enter in User mode ; → Reduce selections to their cursor

Changes

Space → Enter in User mode ; → Clear multiple selections Alt ; → Remove a selection , → Reduce selections to their cursor

Updates from the thread

In addition to an easy second move from Space, , (Clear multiple selections) is a good pair (although not physical) with ; (Reduce selections to their cursor).

If that change happens, how about in the same occasion swap ; (Clear multiple selections) and , (Reduce selections to their cursor) commands?

I think that clearing multiple selections (;) is a way more common operation than reducing selections to their cursor (,). So it would make sense to have it more accessible.

alexherbo2 avatar Oct 25 '18 15:10 alexherbo2

map global normal <space> ,
map global normal , <space>

Or there are some consequences?

andreyorst avatar Oct 26 '18 11:10 andreyorst

Question is more about defaults, I swapped the mappings, presumably others did too, if the majority prefers to swap then perhaps it makes sense to rethink the default mappings.

maximbaz avatar Oct 26 '18 11:10 maximbaz

Question is more about defaults

Ah, sorry.

if the majority prefers to swap then perhaps it makes sense to rethink the default mappings.

Well, I've noticed that some of keybindings were changed since when gifs for kakoune.org were recorded, for example Alt+' was replaced with Alt+Shift+9. Which confused be, because at first launch of Kakoune I've tried to do the same stuff as shown in gifs and was wondering why isn't it working.

So in my opinion mappings should be changed only if the change has strong meaningful explanation or sane mnemonic meaning. Like recent change of Alt+M - it was moved to Alt+_ to make Alt+M backward Alt+m. This makes sense, but for me there's no so strong excuse for swapping Space and ,. I'm actually clearing multiple selections more often than entering user mode, so current Space behavior is more comfortable for me. However this may be the result of such an awkward position of user mode key.

andreyorst avatar Oct 26 '18 11:10 andreyorst

I like one quote from some talk on Vim meetup:

You can change any key in Vim to do anything you want. It's wonderful. It's horrible. You'll never know, if you sit down on someone else's Vim, what's gonna happen when you hit any key. If that's doesn't just fill your heart with thrill and terror then... don't use Vim.

That's one more point from me to leave it as is and just use mappings. I'm not highly against the change, just skeptic about the need, when we have map and basically use our editor only by ourselves. And mapping it once will work forever.

If those keys will be swapped I think some of current users will swap them back (me included, maybe). New users, that will come after the change probably will be ok with it, because again I've never thought about swapping Alt+' and Alt+Shift+9 back as it was before I started to use Kakoune.

andreyorst avatar Oct 26 '18 12:10 andreyorst

In addition to an easy second move from Space, , (Clear multiple selections) is a good pair (although not physical) with ; (Reduce selections to their cursor).

alexherbo2 avatar Oct 26 '18 14:10 alexherbo2

Maybe we should post this discussion on reddit and discuss, so we get more feedback on this? not all users have github accounts.

andreyorst avatar Oct 26 '18 15:10 andreyorst

If that change happens, how about in the same occasion swap ; (Clear multiple selections) and , (Reduce selections to their cursor) commands?

alexherbo2 avatar Oct 26 '18 15:10 alexherbo2

So the final keys would look like: Space: enter user ;: clear multiple selections ,: reduce selection to cursor ?

Why do you think that this is needed to be like so? It looks for me like change in sake of change.

andreyorst avatar Oct 26 '18 15:10 andreyorst

I think that clearing multiple selections (;) is a way more common operation than reducing selections to their cursor (,). So it would make sense to have it more accessible.

alexherbo2 avatar Oct 26 '18 15:10 alexherbo2

Isn't clearing multiple selections is far more common than user mode?

andreyorst avatar Oct 26 '18 15:10 andreyorst

We can guess as much as we want but without any statistic data it's worth nothing. Personally I use reducing selection to single char quite a lot.

So in my opinion mappings should be changed only if the change has strong meaningful explanation or sane mnemonic meaning.

It's easy to remap keys but updating docs, videos on kakoune.org, golf solutions requires more work. So IMO - it's not broken - don't touch it .

TeddyDD avatar Oct 26 '18 16:10 TeddyDD

I support both these changes, especially swapping space and ,. Having made that last change myself, this wouldn't affect me personally, but I think these are much better defaults for new users.

I found the wording of the issue a little confusing with regards to the current and proposed actions of , and ;.

net avatar Oct 26 '18 20:10 net

@TeddyDD In addition to the statistics, there is the Alt chording (Remove a selection) to consider.

Alt ; is more accessible than Alt ,.

alexherbo2 avatar Oct 26 '18 23:10 alexherbo2

This proposal is based on assumption that everybody is using qwerty keyboard layout, so I put my objection here.

When I started using kakoune I swapped defaults straight away to the following:

map global normal <space> ,
map global normal , <space>

But after some time, I've gained some experience and understood why space was chosen as key for remove all selections except main. Because indeed it is most common operation, at least in my experience. But I didn't want to give up using space for user mode, so I found a trade off in order to maintain space as a leader and easy access to remove all selections except main:

map global user <space> <space> -docstring 'remove selections except main'
map global normal <space> ,

Pressing double space is easier and is keyboard layout agnostic.

vbauerster avatar Oct 27 '18 13:10 vbauerster

Hi, I missed that discussion,

I must say that on principle, I quite like the proposed change, I think ;, , and <a-;> would form a nice group of related commands, and are pretty accessible. Additionally, I like the idea of freeing space to the user, as it seems spacemacs shown it can be pretty powerful to have space as a complex command introducer.

Regarding the qwerty-centeredness of those mapping, Kakoune is qwerty centered by design, think of / and ?, [ and {...

We have however history to take into account, and <space> is one of the oldest Kakoune command, lots of scripts depend on it, and this would be a huge breaking change. On that ground, I am not sure it would be worth it to change that now.

mawww avatar Nov 15 '18 00:11 mawww

@mawww Regarding breaking changes, how about giving a name to commands?


Example

sTchou<ret>

Proposal

<select>Tchou<return>

Pros

  • It removes pressure for breaking changes.
  • It makes scripts easier to understand.

Pros / Cons

  • It removes pressure on the keyboard.

alexherbo2 avatar Nov 15 '18 09:11 alexherbo2

I kinda like the Idea of that EVERYTHING is a named function in Emacs. So moving cursor to next line is a function, mowing to next word is a function. It allows users to implement their own functions to replace builtin ones, or wrap builtins to another functions. I understand that in Emacs it is possible, because Emacs is just an interpreter of Lisp, so maybe it isn't possible to do in Kakoune.

andreyorst avatar Nov 15 '18 10:11 andreyorst

I'm using master and commit 2d8456db102e13f37a5cd271868c330d73580f6d seems to have introduced this change as the , and Space keys seems to have been swapped.

Some feedback about the change: TBH, I prefer the old behavior, I use user mappings a lot more than I clear selections.

It feels a lot easier to use , than Space, , is closer to the home row, and, pressing Space feels weird when not typing. Pressing it with the left hand makes my hand go in a weird position, and pressing it with the right hate makes me move it away from the home row.

noonien avatar Aug 15 '22 13:08 noonien

I was very surprised with these changes also, I was presenting an internal company talk and updated the system earlier that day and didn't really use kakoune until the talk as I didn't expect my editor to break of all things. :D (I am not angry, it's more like a funny anecdote)

Pressing space is extremely ergonomic and clearing selections is an extremely common task for most people, I reckon.

I prefer the idea from @vbauerster as it is layout agnostic. I use CZ QWERTZ, my semicolon is above the tab key, my comma is next to M, and other things are different too, but that's beside the point.

If nothing else, it would be nice to include config snippets for how to get old behavior back when making a breaking change release (if it exists, I am sorry, I must have missed it)

luciusmagn avatar Dec 15 '22 19:12 luciusmagn

I was also surprised. It can be reverted with:

map global normal , <space>
map global normal <space> ,

stonewareslord avatar Dec 29 '22 18:12 stonewareslord

Should this be closed now? It seems there will be no coming back. I personally don't mind the current mappings. They make more sense semantically.

lobre avatar Apr 19 '24 07:04 lobre