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

Update commands based on Kakoune 2022.10.31 #281

Closed
71 opened this issue Oct 31, 2022 · 13 comments
Closed

Update commands based on Kakoune 2022.10.31 #281

71 opened this issue Oct 31, 2022 · 13 comments

Comments

@71
Copy link
Owner

71 commented Oct 31, 2022

Kakoune 2022.10.31 remaps several commands available in Dance. Should we update these commands in Dance as well? IMO, we should.

@pomdtr
Copy link
Contributor

pomdtr commented Nov 2, 2022

The <-> , switch is a great touch, I added configured dance to replicate it. Here is the config (using the whichkey extension)

  {
    "key": ",",
    "command": "dance.selections.clear.secondary",
    "when": "editorTextFocus && dance.mode == 'normal'"
  },
  {
    "key": "space",
    "command": "-dance.selections.clear.secondary",
    "when": "editorTextFocus && dance.mode == 'normal'"
  },
  {
    "key": "alt+,",
    "command": "dance.selections.clear.main",
    "when": "editorTextFocus && dance.mode == 'normal'"
  },
  {
    "key": "alt+space",
    "command": "-dance.selections.clear.main",
    "when": "editorTextFocus && dance.mode == 'normal'"
  },
  {
    "key": "space",
    "command": "whichkey.show",
    "when": "editorTextFocus && dance.mode == 'normal'"
  },

@arrufat
Copy link

arrufat commented Nov 4, 2022

What about the other changes?

  • <esc> no longer stops recording a macro, just Q.
  • Kakoune's current: x → Dance: <a-x>
  • Kakoune's current: <a-x> → Dance <a-X>

Then X and <a-X> should be removed. According to Kakoune's author, this change simplifies the editing model, by not having the weird old behavior of x (select line, but if already selected, select next line instead).

Also, p and P should select the inserted text now.

I've been using Kakoune from master for some time now, and when I have to use VS Code, there's a bit of friction.

Thank you for this plugin!

@71
Copy link
Owner Author

71 commented Nov 4, 2022

I'd like to somehow keep both old and new Kakoune keybindings (or document the previous ones). I personally like (and use) the old x a lot, so I'd like to keep it in some form.

Given that macros still are kinda experimental in Dance, I'd like to keep esc as the universal "abort" key, at least for now.

I use a-{p,P} a lot more than {p,P}, so that change makes sense.

Thanks for listing the different changes!

@arrufat
Copy link

arrufat commented Nov 4, 2022

I think maybe keeping X makes sense, since there's no equivalent.

That's the only thing I miss from the latest Kakoune release: selecting lines with X.

Now we have to J n times and then x to expand, so there's 1 extra keystroke.

I've mapped X to Jx in my kakrc to keep something similar to the old behavior.

@arrufat
Copy link

arrufat commented Nov 4, 2022

I personally like (and use) the old x a lot, so I'd like to keep it in some form.

Do you use it even to go down the lines, selecting one at a time, or do you use the X to keep expanding the selection?

I've never used x when I wanted to select the line below when the previous one was already selected, personally. But I used X a lot, too.

@victorz
Copy link

victorz commented Nov 4, 2022

I'm one of the people who use the "real" kakoune for basic editing, and this vscode extension when I'm coding (for work and hobbies).

I'd like to propose using the same bindings as kakoune, for consistency. I realize that it might not be a goal of this extension to be compatible or consistent with kakoune proper, but just to mimic it. But from my perspective it's very useful to be as similar as possible, for consistency. Hear me out.

So old behavior would be:

  1. Stand on first line you'd like to select
  2. Press x
  3. Keep pressing X to select as many lines as you'd like, below it.

In this method, there's no way to use x or X (that I know of) to select lines above the current line. You'd have to possibly first do <a-;> then do a bunch of consecutive K, and maybe even further adjust your selection once you get to the top. Even clunkier than normal vanilla vscode, honestly.

In the new method by kakoune upstream, you'd just do this:

  1. Stand on first line you'd like to select
  2. Keep pressing J or K to expand selection into the lines you prefer to select.
  3. Press x to select the full lines (including first and last, which may or may not be fully selected).

The workflow becomes similar for both directions which makes it easy to remember, thus worth relearning.

This is my two cents, I hope I made somewhat of a strong case and that you agree -- because this is by far the best kakoune "emulator" on the marketplace right now in my honest opinion. You've done a great job with it so far!

@tshort
Copy link
Contributor

tshort commented Nov 4, 2022

Good explanation. Now that I understand, I like the idea of the new x workflow.

@71
Copy link
Owner Author

71 commented Nov 4, 2022

@victorz Thanks for the thorough explanation! I definitely see the advantage in the new workflow now.

To be clear, in any case I'd like to stay consistent with Kakoune. My objective for Dance 0.6 is to have different layouts you can choose from, Kakoune being one of them (and later perhaps Helix, and a "Dance-flavored Kakoune" (edit: for instance, for the new .seek.leap command)). I started working on it in 1341210, which adds "categories" of keybindings, but please don't expect it any time soon.

For the time being, the new usage of x sounds good. Same for p/P/!/a-!. Any opinion on keeping Esc to stop recording a macro?

71 added a commit that referenced this issue Nov 4, 2022
Also fix issues with `.selections.trimLines` and
`.selections.expandToLines` and upgrade `typescript`.
@71
Copy link
Owner Author

71 commented Nov 4, 2022

Only p/s-p are left AFAIK. It's not a trivial change as p / a-p may not be correctly implemented in Dance right now (more precisely, I'm not sure it handles the difference between "paste all" and "paste").

@victorz
Copy link

victorz commented Nov 4, 2022

@victorz Thanks for the thorough explanation! I definitely see the advantage in the new workflow now.

Amazing, thank you! And my pleasure!

To be clear, in any case I'd like to stay consistent with Kakoune. My objective for Dance 0.6 is to have different layouts you can choose from, Kakoune being one of them (and later perhaps Helix, and a "Dance-flavored Kakoune" (edit: for instance, for the new .seek.leap command)). I started working on it in 1341210, which adds "categories" of keybindings, but please don't expect it any time soon.

That sounds great! No worries, I have a whole career to wait for it. ☺️

For the time being, the new usage of x sounds good. Same for p/P/!/a-!. Any opinion on keeping Esc to stop recording a macro?

I do actually! A really good reason to not have Esc stopping recording is the simple fact that a macro might want to include changing modes to normal mode to do other operations. The same reason why macros in vim are also handled this way -- only the key that starts defining a macro can also stop defining a macro.

I hope that makes sense! 🙂

@arrufat
Copy link

arrufat commented Nov 4, 2022

do actually! A really good reason to not have Esc stopping recording is the simple fact that a macro might want to include changing modes to normal mode to do other operations. The same reason why macros in vim are also handled this way -- only the key that starts defining a macro can also stop defining a macro.

I just tried that, and if you are recording a macro and are in insert mode, won't stop recording the macro, but put you in normal mode instead.

@71
Copy link
Owner Author

71 commented Nov 4, 2022

Ah, right, as @arrufat said esc only stops the recording in normal mode (so switching to normal from insert while recording a macro is possible). I'm not sure if that works for you.

Macros are kinda broken in Dance, so even though removing the esc keybinding would be easy, I'm not sure the macro "engine" behind it would work well with mode changes (in theory it does, in practice...), so I don't want to "encourage it" by changing that keybinding (at least for now).

@71
Copy link
Owner Author

71 commented Nov 11, 2022

ec90111 fixes p (and friends), updates the key-bindings, and should be available in the pre-release version of Dance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants