brenton-leighton / multiple-cursors.nvim

A multi-cursor plugin for Neovim that works in normal, insert/replace, or visual modes, and with almost every command
Apache License 2.0
152 stars 4 forks source link

Feature: go to commands #70

Closed brenton-leighton closed 1 month ago

brenton-leighton commented 1 month ago

Add support for go to commands (G and gg)

brenton-leighton commented 1 month ago

@danrasmuson can you tell me if this is OK? Thanks.

danrasmuson commented 1 month ago

Thank you for your work on this plugin @brenton-leighton. Multiple cursors are a brilliant feature and similar to you I haven't found what I'm looking for in any other neovim plugin.

The functionality I'm anticipating with these commands is that each cursor will receive the command in the same way as if it was the only cursor. Take this example from sublime when I press CMD + ↓ both cursors go to the last line. Once this happens the cursors merge

CleanShot 2024-06-02 at 08 23 51

Here is a demonstration of what I mean

CleanShot 2024-06-02 at 08 31 27

The functionality in this PR right now is that when I press G one cursor goes to the last line and the other cursor goes to the line before the last. I would expect both cursors to go to the last line and for them to merge into one another so just one cursor remains.

CleanShot 2024-06-02 at 08 24 54

brenton-leighton commented 1 month ago

I would expect both cursors to go to the last line and for them to merge into one another so just one cursor remains.

@danrasmuson can you just exit multiple cursors, then execute G? If you want to have this bound to the G command you could add this to custom_key_maps:

{"n", "G", function()
  require("multiple-cursors").normal_escape()
  vim.api.nvim_feedkeys("G", "n", false)
end},

Does that do what you want?

danrasmuson commented 1 month ago

Yes I can. This will work. I do the the functionality as explained is more intuitive but this alternative style is not a show stopper and I can adapt my workflow here.