Skip to content
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

Sane keybinds and switches #422

Closed
jarun opened this issue Dec 29, 2019 · 84 comments
Closed

Sane keybinds and switches #422

jarun opened this issue Dec 29, 2019 · 84 comments
Assignees

Comments

@jarun
Copy link
Owner

jarun commented Dec 29, 2019

I spent a lot of time today on having some sanity in our keybinds & program switches. Came up with commit 146da59.

Keybinds: https://github.com/jarun/nnn/wiki/Usage#keyboard-and-mouse

Options: https://github.com/jarun/nnn/wiki/Usage#command-line-options

I need all of you to review this and suggest any further changes or discuss if you have anything in mind. From the next release these keys will be fixed.

@annagrram

This comment has been minimized.

@jarun

This comment has been minimized.

@maximbaz
Copy link
Contributor

One idea: if / is filter, it feels very intuitive that ^/ would be some sort of "extended filter" mode, which is "nav-as-you-type" in nnn. I would therefore suggest to keep b for bookmarks and move ^/ to "nav-as-you-type".

@maximbaz
Copy link
Contributor

I would recommend changing N Context N to 1 2 3 4 Context, because (unless I'm mistaken?) it is hardcoded that we can have only 4 contexts, and the current help message misleads you into thinking that you must press N, while in fact you must press 1 or 2 or 3 or 4.

@jarun
Copy link
Owner Author

jarun commented Dec 29, 2019

I would therefore suggest to keep b for bookmarks and move ^/ to "nav-as-you-type"

I did that in an intermediate check-in. There are several points against it:

  • I need to provide a Ctrl shortcut for people who use the nav-as-you-type mode all the time to pick bookmarks. The 2 keys in ^B are too far from each other. I was having difficulties myself.
  • Users are already used to these keys.
  • ^N goes well with Nav-as-you-type toggle.
  • The option to start in nav-as-you-type is also -n.

and the current help message misleads you into thinking that you must press N

We can have 1-4 Context 1-4

@maximbaz
Copy link
Contributor

I was thinking b ^B for bookmarks and ^N ^/ for nav-as-you-type, but I see your reasoning for ^B being difficult to press... 🤔 OK I don't have a better suggestion at the moment.

We can have 1-4 Context 1-4

👍

@jarun
Copy link
Owner Author

jarun commented Dec 29, 2019

We can have 1-4 Context 1-4

Commit c1f168c

@maximbaz
Copy link
Contributor

I noticed a new keybinding and flag v for version sort, and I wanted to ask, did you consider updating the existing algorithm for this scenario, instead of providing a choice for sorting approaches?

I simply noticed that xstricmp is already customized to provide intuitive results for files that are numbered (so we don't have two algorithms for that, which I approve 👍), why don't we customize xstricmp further to provide intuitive results when these numbers are versions?

Basically I'd like to propose to merge these two functions in one and remove v toggle.

@jarun
Copy link
Owner Author

jarun commented Dec 29, 2019

xstricmp() works with pure-numeric (values), it's crude and not necessarily version sort:

 01/
 1/
 +1/
 02/
 10/
 11/
 101/
 111/
 0aa
  111
 111a
 123
 1111
 aaa
  abc
   abc
 (abc
 ( abc
 [abc
 { abc
 Abc
  Abc
 abc10
abc2

The version sort algo in xstrverscmp() is from standard GLIBC GNU extensions with minor modifications:

 00/
 01/
 02/
 0/
 1/
 10/
 11/
 101/
 111/
  abc
  111
  Abc
  abc
 ( abc
 (abc
 0aa
 111a
 123
 1111
 aaa
 Abc
 abc2
 abc10
  1. As you see from the results, both have distinct purposes. xstricmp() considers locale.
  2. The amount of testing required to test any attempt to merge these functions is significant and (I feel) unnecessary.

@jarun jarun closed this as completed Dec 29, 2019
@jarun jarun reopened this Dec 29, 2019
@jarun
Copy link
Owner Author

jarun commented Dec 29, 2019

Please stick to keybinds and options in this thread. I accidentally closed the issue thinking it was a new one.

@jarun
Copy link
Owner Author

jarun commented Jan 6, 2020

@0xACE, @KlzXS, @annagrram need your input on this one. We have to free the keybinds in the next release.

@KlzXS
Copy link
Collaborator

KlzXS commented Jan 6, 2020

We have to free the keybinds

I hope that means to freeze them, I'm still getting used to things moving around and keybinds seem to be magically changing every few weeks.

I'm okay with keeping them as they are now, but do we maybe want to move range selection to something like Y as other selection options are also bound to that letter? Maybe it's too many things on a single key I don't know. Also what's the reason for archiving being on i? Would it make more sense for it to be on t like tar and sorting by time to be T.

Just throwing things out there. More than anything I think that the freeze needs to happen.

@jarun
Copy link
Owner Author

jarun commented Jan 6, 2020

Yes, this thread is meant to freeze the assigned keybinds.

Range selection belongs to the group:

Space ^J  (Un)select           m ^K  Select range, clear
a  Select all

The y stuff are for selection list related functionality. Maybe the following represents that better?

Space ^J  (Un)select           a Select all
m ^K  Select range, clear

Would it make more sense for it to be on t like tar

We support several archive formats by default (whatever's supported on a standard installation). I selected the i from iving, kind of the central letter with a stress.

and sorting by time to be T

This is a very frequent operation. If you see, I have limited capital keybinds to infrequent operations.

@jarun
Copy link
Owner Author

jarun commented Jan 6, 2020

Maybe the following represents that better?

This makes the spacing look very bad.

@jarun
Copy link
Owner Author

jarun commented Jan 6, 2020

I have re-ordered the help. Please take a look: https://github.com/jarun/nnn/wiki/Usage#keyboard-and-mouse

@KlzXS
Copy link
Collaborator

KlzXS commented Jan 6, 2020

Physically separating them makes it more obvious, yes. I didn't realize that that's how they were grouped. They seem to make sense when you think about them for a second or two.

@annagrram
Copy link
Collaborator

@jarun I like the simplicity of the new keybinds, and personally can either get used to new sets or set my own keys, so I don't have a strong opinion on which key does what, as long as it has some logic that I can use when learning it.

@jarun
Copy link
Owner Author

jarun commented Jan 7, 2020

We owe this to end-users, who would only want to install and use the utility. If you see the popular terminal FMs are at least a decade old, nnn is pretty young (2y 8m) in that respect. But I think now the initial instability is over and we can arrive at designated keys.

@jarun
Copy link
Owner Author

jarun commented Jan 8, 2020

I have changed the option -t (disable dir auto-select in nav-as-you-type mode) to -A to be in sync with other disable options.

@jarun
Copy link
Owner Author

jarun commented Jan 9, 2020

I have added R abd ^T for reverse order.

@jarun jarun pinned this issue Jan 10, 2020
@jarun jarun unpinned this issue Jan 10, 2020
@jarun
Copy link
Owner Author

jarun commented Jan 13, 2020

I keep the ^ shortcuts for people who use nav-as-you-type. ^ chars break away from filterentries().

@jarun
Copy link
Owner Author

jarun commented Jan 13, 2020

We should rename "Order toggle". Maybe "Sort by"?

@maximbaz
Copy link
Contributor

"Sort by" is not bad, it helped to know that those keys are in fact toggles, i.e. if I select the same sort twice, it will be reversed. Maybe "Sort toggles"?

@jarun
Copy link
Owner Author

jarun commented Jan 13, 2020

Yes!

@jarun
Copy link
Owner Author

jarun commented Jan 13, 2020

How about ^F for file details?

@maximbaz
Copy link
Contributor

Both sound very intuitive for me, go for ^F 👍

@jarun
Copy link
Owner Author

jarun commented Jan 13, 2020

Cool!

@jarun
Copy link
Owner Author

jarun commented Jan 13, 2020

From nav-as-you-type mode, Shift keys are horrible. You have to Esc to come out and then press 2 more keys. ^ keys are as good as a single key.

Looks like we don't have any compelling shift key anymore.

@maximbaz
Copy link
Contributor

Makes sense.

I feel like "copy/move/delete sel" are so important operations that they absolutely must have Ctrl shortcuts as well, otherwise nav-as-you-type is not as powerful mode.

Ideally we would assign ^P, ^V, ^X keys to them in addition to p, v, x, but this conflicts with other existing shortcuts (which we could maybe think to remap?)

@jarun
Copy link
Owner Author

jarun commented Jan 13, 2020

Let's try!

@jarun
Copy link
Owner Author

jarun commented Jan 13, 2020

^V Copy/move sel as can have w ^W coming from write and cp/mv.

Delete entry needs a ^ key. What would it be?

@jarun
Copy link
Owner Author

jarun commented Jan 13, 2020

And plugin needs a ^ key too! I have to go to sleep now. 4 here. Think about these.

@maximbaz
Copy link
Contributor

There you go: #436

As a user I particularly like how even less keys there are now to remember when Ctrl keys use the same letter as regular mapping (e.g. p ^P, m ^M, etc.)

@jarun
Copy link
Owner Author

jarun commented Jan 14, 2020

I think we can settle with:

D - file details
f ^F - Fire plugin

@jarun
Copy link
Owner Author

jarun commented Jan 14, 2020

Let's have:

f ^F - file details
; ^S - select plugin

@jarun
Copy link
Owner Author

jarun commented Jan 14, 2020

I am pushing the changes. Please review.

@jarun
Copy link
Owner Author

jarun commented Jan 14, 2020

Please review commit 1b252b6.

@jarun jarun mentioned this issue Jan 14, 2020
14 tasks
@maximbaz
Copy link
Contributor

Nice catch about ^;, I'll play a bit more just to confirm your finding that it won't be possible to support it.

Delete with prompt is nice, one ask - in the specific case when I select a couple of files, press x and choose c (current) - can we not refresh screen, so that selection marker + is preserved?

Otherwise I think it already looks very very pleasant to me. 👍

@jarun
Copy link
Owner Author

jarun commented Jan 14, 2020

in the specific case when I select a couple of files, press x and choose c (current) - can we not refresh screen, so that selection marker + is preserved?

We have to remove the entry that's deleted, so we need to reload the directory. Also there are other reasons, say there was a link to the file, that gets orphaned and so on. When you change the directory contents, we should always reload. If it helps, I don't end the selection so you can continue selecting.

@maximbaz
Copy link
Contributor

maximbaz commented Jan 14, 2020

I can now see that ; and ^; are both recorded by getch() as just ;, once again - nice catch :)

I have no more suggestions for the key bindings, everything looks very reasonable to me.

@jarun
Copy link
Owner Author

jarun commented Jan 14, 2020

everything looks very reasonable to me.

Same here! Fewer keybinds, quite meaningful...

@annagrram @KlzXS please review the latest set of keybinds. We are making a release tomorrow.

@jarun
Copy link
Owner Author

jarun commented Jan 14, 2020

Current set:

 NAVIGATION
         Up k  Up                PgUp ^U  Scroll up
         Dn j  Down              PgDn ^D  Scroll down
         Lt h  Parent            ~ ` @ -  HOME, /, start, last
     Ret Rt l  Open                    '  First file
         g ^A  Top                     .  Toggle hidden
         G ^E  End                     0  Lock terminal
         b ^/  Bookmark key            ,  Pin CWD
          1-4  Context 1-4        (B)Tab  Cycle context
            /  Filter                 ^N  Nav-as-you-type toggle
          Esc  Exit prompt            ^L  Redraw/clear prompt
            ?  Help, conf             ^G  QuitCD
         Q ^Q  Quit                    q  Quit context
 FILES
         o ^O  Open with...            n  Create new/link
         f ^F  File details            d  Detail view toggle
           ^R  Rename/dup              r  Batch rename
            z  Archive                 *  Toggle exe
     Space ^J  (Un)select           m ^K  Mark range/clear
         p ^P  Copy sel here           a  Select all
         v ^V  Move sel here        w ^W  Copy/move sel as
         x ^X  Delete                  e  Edit sel
 MISC
         ; ^S  Select plugin           =  Launch app
         ! ^]  Shell                   ]  Cmd prompt
            c  Connect remote          u  Unmount
         t ^T  Sort toggles            s  Manage session
optional args:
 -a      use access time
 -A      no dir auto-select
 -b key  open bookmark key
 -c      cli-only opener
 -d      detail mode
 -E      use EDITOR for undetached edits
 -g      regex filters [default: string]
 -H      show hidden files
 -K      detect key collision
 -n      nav-as-you-type mode
 -o      open files only on Enter
 -p file selection file [stdout if '-']
 -Q      no quit confirmation
 -r      use advcpmv patched cp, mv
 -R      no rollover at edges
 -s name load session by name
 -S      du mode
 -v      version sort
 -V      show version
 -x      notis, sel to system clipboard
 -h      show help

@jarun
Copy link
Owner Author

jarun commented Jan 14, 2020

Closing the defect.

@jarun jarun closed this as completed Jan 14, 2020
@lock lock bot locked and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants