xahlee / xah-fly-keys

the most efficient keybinding for emacs
http://xahlee.info/emacs/misc/xah-fly-keys.html
484 stars 83 forks source link

Open line insert #35

Closed rschmidlin closed 5 years ago

rschmidlin commented 7 years ago

As a previous Vim user I have grown very fond of the open-line functionality. Upon pressing "o", no matter where the cursor was in the line, a new line was added below the current and the insert mode was activated.

Currently, I always find myself pressing the combination <s, enter, u> (Dvorak) to achieve the same behavior but using three times more keystrokes. Since "o" was already taken with open-line, I understand if you aren't inclined to this proposal. However, I felt I should tell about its advantages and thought it would be most comfortable if you could try it out immediately.

xahlee commented 7 years ago

Is vi's open line way better? am not sure. I think we need scientific basis as much as possible.

have you been using xah-fly-keys for long? and do you still use vi?

am thinking, if you used xah-fly-keys for half a year, during which you never used vi, then, i think you might give a fair judgement which style of open line command is more frequently needed.

I initially wrote the following reply, which is more against the change. But now i think am more open minded, provided if we can be sure vi's open line behavior is actually better in some provable way. I post it below anyway, just FYI. (since am not sure you are familiar with xah-fly-keys background)


I know that vi's open line inserts a newline below current line, and move cursor there. I don't think it's better.

I think it's mostly habit. If you use xah-fly-keys for a while, and stopped using vim for a year, i bet you'd then find vi's open line weird.

More strickly speaking, i want xfk's binding to be as much scientifically based as possible. In the beginning, it's base on emacs command Statistics, see Emacs's Command Frequency Statistics http://ergoemacs.org/emacs/command-frequency.html

but now it's gone beyond those statistics can provide.

Now , the question is, what kind of editing commands creates the most optimal editing? (disregard keybinding for a moment. We only consider the number of command calls)

this question, is not a solved question. I haven't seen much of anyone study it except myself.

but i'm mentioning this is because, as far as whether we should use xah-fly-keys's open line behavior or vi's open line behavior, i do not have absolute scientific basis on which one is more efficient. (this needs to be considerd with other commands) But, am confident to say, it can easily match vi. (and if we also consider keybinding, it's then more efficient than vi.)

see more about this thought here: emacs and vi: Science of Command Efficiency http://ergoemacs.org/emacs/science_of_command_efficiency.html

rschmidlin commented 7 years ago

Thanks for the insight Xah!

I didn't use Vi for 5 years (of course I have edited some files over ssh, but that's about it). I have started with Xah-Fly-Keys about a month ago. My history is the following: Vi 2007 - 2012 Vanilla Emacs 2012 - 2013 Ergoemacs 2013 - 2017

Regarding the scientific approach, the current database had to be searched for the command sequence end-of-line -> newline for a percentage consideration of editing intent in a new line. The modal editing makes a considerable difference here because it requires you to press another key to start your editing session.

We are also making assumptions about command/key usage based on a non-modal editing style meaning activate-insert-mode was never there. It could be useful to retrieve new data.

I also noticed that you have adopted the insert after space behavior, thus I assume that you are aware of the advantage of combining some basic editing with the activation of insert.

With the introduction of an insert mode, we have to consider where editing sessions start. I'd propose assessing the position of the cursor from where the insertion mode was activated (line, paragraph, sentence, word).

Heuristically, I'd tell you that most common positions are newline, end-of-line and word border in this order. The two firsts are automatically mapped to o and A in Vi. There is no automatic binding for word border and honestly, there are rare occasions where you start your editing session inside a word.

I hope that I could give you some interesting information/ideas on modal editing.

spiderbit commented 6 years ago

hmm I also don't want to talk about binding "o". It is only good for you cause you are used to it cause of vi, and of course because its one of the 8 keys you lay your fingers onto it, but other than that it could be every other key depending on keyfrequency.

But it might be a good functionality for another key, I wonder how ofter I do that. In general sometimes its anoying to switch from text mode to command mode for 1 command and then switch back, but I am not shure when that happens most of the time that I need to do that. If that would be the most common case for that, it might be worth.

Lets say it that way, I am pretty shure I do that more often than changing the letter case of a word, and we have a key binding for that. Even depending on the position of the courser you also only need 3 keys to do it without that function delete/ text-mode / big letter, ok if you count the shift key its 4.

So such function could not hurt, if most people don't like to use it or don't need it having it on a bad keychord can't hurt that much, and if people love it and spam it, you could move it to a easy to press keychord.

So adding that functionality makes probably sense, I kind of changed my view also while I wrote this comment where I startet more sceptical about that :)

so +1 for adding that feature, I personaly still use menu + enter to start a command cause of my keyboard I guess and because I am used to it, and I think its easier to press if had your hand not on the keyboard before, but yes I know that not all have ergonomic keyboards :)