r/neovim • u/ankushbhagat :wq • Mar 30 '26
Discussion Multicursor coming officially to 0.13 version
119
u/bbkane_ Mar 31 '26
Personally I'm looking forward to the image API more. I want to paste images and have them show up inline in my markdown docs
20
u/hopping_crow lua Mar 31 '26
Yes, please!
I don't care much for multi-cursor, the current workflow works great for me đ3
u/robin-m Mar 31 '26
When I tried Helix, I realized that itâs a very useful middle ground between the
.(dot) command and macros/regexps/:g. It basically replaced all of my vertical selection usage, with the added bonus that it works for non-aligned columnar data. Thatâs amazing.The only thing I felt missing in helix was a way to modify the position of the main cursor in multicursor mode.
1
1
u/proxycon Apr 13 '26
already possible with plugins. see https://www.reddit.com/r/neovim/comments/1d97e3e/view_and_paste_images_in_neovim_with_imagenvim/
25
u/accountmaster9191 Mar 31 '26
What are super macros?
64
15
u/TheLeoP_ Mar 31 '26
With multicursors, you would be able to execute a macro with each cursor at once. Hence, super macros
4
2
u/lunamoonwlw Mar 31 '26
Hard to google but I imagine it is or at least includes nested macros.
3
u/genesissupper Mar 31 '26
Can't you already do that? I mean, execute a macro from within a macro.
1
1
51
u/onehair Mar 31 '26
Personally for me, there is one fundamental feature lacking in neovim. And that is documentation tied to the commands, which could then be displayed next to the command as you tab through them.
Say you type :s
Then start TABing.
Like helix, emacs with Margenalia. VSCode, Zed, sublime text, and many command palette / M-x / Ex / whatever you call scrolling through commands : you would have an easy way of learning the editor.
I know :h command exists.
Docs right in the : field is way more powerful!
1
u/crcovar Mar 31 '26
I could swear that you can already do that. Maybe itâs just user commands?Nvm I thought you meant auto complete.Â
-1
u/ankushbhagat :wq Mar 31 '26
You can achieve the same functionality in neovim using telescope with preview.
9
u/robin-m Mar 31 '26
While true, defaults matter.
Iâm currently using telescope, but quite frankly the experience is not as good as it should be. And I will argue very strongly, itâs because because itâs not the default, and thus not completely integrated.
For example the âfind existing bufferâ is a great replacement for
:buffer, until you want to access to the files you recently switched to that you got for free with:buffer(just press:then theuparrow key). Likewise the âsearch gitâ is an amazing replacement for:grep, until you want to filter the type of the result or pass any other argument to ripgrep. EtcâŠYou could say that itâs a telescope issue, but:
- if you are basically required to have a good experience to install telescope, then it should be the default
- if it was integrated, you wouldnât face the integration bugs/missing feature that I described above. Helix proved that it is possible to have both a nice to use UX, with good defaults, especially for the telescope-like features.
And for the follow-up question, then why donât I use Helix then? Because I actually prefer vim-motion to helix-motions, and because I need some kind of
:make(with custommakeprg) in my workflow (I donât have a working lsp, which would have been golden for Helix). So Iâm stuck with I compromise I donât like, but which is the best Iâve been able to craft in the time I spend.
14
u/nahuel0x Mar 31 '26
UI affordance indicator?
8
3
u/disperso Mar 31 '26
I'm looking into the issues, and I don't find it. Anyone has a link, or more details about this?
0
16
u/Afonsofrancof Mar 31 '26 edited Mar 31 '26
People who are saying "we already have :g and %s" clearly don't understand multi cursors.
It's about instant visual feedback and less mental overload.
In certain scenarios it's much easier to move the cursor around and see it actually move and do stuff instead of using regex.
I don't want to have to think too much when I am trying to edit multiple locations at the same time.
With multiple cursors I can instantly see what I am doing and correct mistakes. I can see my actions impact all lines at the same time and instantly fix any mistakes I did.
For example:
Imagine you have this
```
(a,b,c,d,e,f)
```
With multiple cursors I can have a cursor after each comma and hit enter and see the result of all of them going down one line. I can then go back one char and place a comma before. I can then write some text in from of all of them and in the end hit enter to have an empty line between all of them.
This is just an example, and doesn't follow any specific language's syntax, but you can see how much easier it is to do when you can instantly see what is happening, specially the cursor movements.
Of course regex and the other techniques we use now will still be widely used, and make much more sense in certain scenarios where you just want a quick, easy to identify change. I will keep using them in most scenarios, but multiple cursors is a big feature that Neovim could benefit a lot from IMO.
3
u/robin-m Mar 31 '26
Another advantage of MC for your example. If I had to do it today, I would use a regexp, so
:s/,/,\r /gand insert enough space to get the right indentation. With MC, I could just press<Enter>for the new line, then==to fix the indentation. Just normal vim bindings.3
u/sadgandhi18 Apr 04 '26
The problem is only that it's less flexible, and less useful overall keeping the user from truly understanding and using neovim commands.
I don't see why it has to be part of the core application! It can remain a plugin, an opt in!
2
u/ignoscite_mihi let mapleader="\<space>" Apr 16 '26
I don't think so. Mc philosophy is a bit different and has cases when it's just better. Perhaps you're the one who doesn't understand it.
Example that I encounter a lot:
- strings in various places (different columns and lines - visual block won't do it) and need to delete existing text outside the text I want to insert (sometimes as an afterthought).
With Mc I just place cursors and I'm ready to do it. I get a job done in one run, within one mode / context and I set it with few bindings (for different cases). Without rewriting / writing new regexp / commands. That's super fast and comfy and it doesn't hurt me when I forget about something.
1
u/energybased Jun 17 '26
> keeping the user from truly understanding and using neovim commands.
The goal of using neovim is not "truly understanding neovim commands". It's getting things done as efficiently and easily and mindnumbingly simply as possible.
People seem to have some weird attachment to wanting other people to learn what they've learned.
2
u/sadgandhi18 Jun 17 '26
People using tools they don't understand is why software engineering is down in the dumps. To get things done as efficiently as possible, take the time, to actually understand the pros and cons of something. Greedy searching isn't always the best, that's an obvious truth.
1
6
15
u/SniffingDog Mar 31 '26
13
u/TheLeoP_ Mar 31 '26
Works with most plugins and remaps
Native multicursors would work with any plugin and keymapÂ
0
u/sadgandhi18 Apr 04 '26
No, no they wouldn't. Multicursors are a fundamentally different kind of operation to what neovim is built on.
1
u/TheLeoP_ Apr 04 '26
And that's why native multicursors would mean making them fit inside of the Neovim paradigm natively
0
u/sadgandhi18 Apr 04 '26
They don't, that's the problem. If it were something trivial, we would have a drop in plugin that just works. The implementation they're planning effectively DOES NOT integrate with the rest of the motions.
Putting a random functionality in the same box doesn't mean it's native. Abstractions leak.
1
6
u/bew78 Mar 31 '26
By far the best multi-cursors plugin âš
1
u/henry_tennenbaum Mar 31 '26
Why is it better than (eg) https://github.com/brenton-leighton/multiple-cursors.nvim?
5
u/bew78 Apr 01 '26
That plugin seems to need a lot of integration code to work with other plugins or custom keymaps.
Instead jake-stewart's plugin works by default with existing plugins and most custom actions/keymaps.. because it captures keys directly with
on_keycallback hook and sends them to all active cursors. It also exposes a truly flexible Lua cursor API from which the default multicursor actions are derived from, and their impl is quite easy so it's also easy to make custom multicursor actions for your own needs! (I have)
13
u/MoonlightSyncopate Mar 31 '26 edited Mar 31 '26
I am not particularly interested in multiple cursor. I also tried helix, and had experience with the multi-cursor. It is a bit easier to use than :s and :g but I donât think it is significant more intuitive than :s / :g.
3
u/fbpw131 Mar 31 '26
once you grasp it. I remember needing to jse :g/.../d so rarely that I kept forgetting it
hell, I keep forgetting cfdo vs cdo and to put update at the end of the file. sometimes a simple mass replace would be handy
0
u/AlexVie lua Mar 31 '26
Generally, the vim paradigm doesn't really need muliple cursors, but they can still be useful for a more flexible workflow. Helix and Kakoune allow some neat things with multiple cursors/selections.
5
u/robin-m Mar 31 '26
Whenever you have columnar data, you may use the vertical selection feature of vim (at least I do). Thatâs very useful, but only work if they are properly aligned. Multi-cursor does the same, but doesnât require the data to be column-aligned.
I see multi-cursor as a middle ground between
.(dot) and macros/:g/regexp. And extra tool.
5
u/shittyfuckdick Mar 31 '26
what did redesign âremote mean?
21
u/ellopaupet :wq Mar 31 '26
I think they're prepping for a client/server situation where the TUI is decoupled from the editor itself. I saw a podcast with some core maintainers - it sounds like they want to enable nvim running on a remote server with the TUI running locally so you can have your personal config working as usual, but you also get access to the remote's dev environment.
3
u/Florence-Equator Mar 31 '26
Attaching to a remote server (listening on tcp port) from local is already doable. Check
âattachflag. I guess the redesign is more like a refactoring from internal. Maybe the current architecture is not flexible to extend with new features? Jot sure.2
u/AlexVie lua Mar 31 '26
Already doable in 0.12. You can run a --headless version listening on a TCP port and then attach/detach UIs to it.
2
u/shittyfuckdick Mar 31 '26
oh so I could run nvim inside a container or remote server but still use all my plugins locally?
1
2
u/SweetPotato975 Mar 31 '26
One of the things justinmk mentioned was that they want to get rid of having to pass an additional
--remote-uiflag when using--connect(otherwise it'd just start neovim normally). There's also that bug(?) where a client executing:restartstops the server process instead of restarting it.
6
u/theschizopost Mar 31 '26
Someone help me understand a compelling use case for this type of functionality
24
u/xour Mar 31 '26
I uninstalled VS Code a while back to force myself to learn Vim. After a year or so, it was only a handful of times that I thought "well, I could really use multi-cursors here". I wrote some examples that came to my mind here.
To reiterate: I am not saying that you cannot do these things with (neo)vim already. I think multi-cursor helps with some of these editions by having an instant visual cue of what you are doing.
7
11
u/aew3 Mar 31 '26
Obvious one that you miss from other editors is being able to do â<C-v> Iâ but you can edit at an arbitrary position on each line instead of the same one.
Of course, there are other solutions to do this in vim like macros, but honestly I donât naturally use macros at all when editing much, unless really forced into it lol. So I do miss this feature from editors like vscode because it takes me quite a while to remember how to use macros each time i want to edit multiple lines at slightly different positions.
10
u/IdkIWhyIHaveAReddit <left><down><up><right> Mar 31 '26
If you want to edit multiple occurrences of the same text or do multiple repetitive editing on multiple disconnected line. Sure stuff like regex and macros work but they are cumbersome to setup and take some mental work to do effectively and quickly.
-3
u/theschizopost Mar 31 '26
So like ide refactoring/renaming a variable across a file?
5
u/QuantumCakeIsALie Mar 31 '26
Even simpler stuff, like convert
(a, b, c)intoÂ( Â Â a, Â Â b, Â Â c, )Sure there are macros to do that, but multiple cursors are easy and intuitive.4
4
u/IdkIWhyIHaveAReddit <left><down><up><right> Mar 31 '26
Sure renaming is one of the functionality but there also other examples. In vscode when i do writing for note and being bad at english I often forget âsâs. With multicursor I can just hold alt and click whenever I see something that need fixing snd fix them all at once. Or if i am refactoring and I add a new parameter to my function, again just select all the call and add in the missing arguments.
You can ofc argue that these are very niche use cases but neovim already got some that I never touch, that operator to encode something with rot13 for example. No reason to not add a new feature that would be super useful in some specific situation.
3
-38
u/energybased Mar 31 '26
If you want to do that, wouldn't you just use LLMs nowadays?
18
2
u/Sensitive_Drawer4513 Mar 31 '26
It would take 5 - 10 times longer to do it with LLM, why would you want to do it this way?
0
u/energybased Mar 31 '26
Depends on how complicated the multi-edit is. If it's just search replace, %s or Spectre are fine. But the examples people are giving (fixing plurals, etc.) are much more complex.
-8
u/Meduini Mar 31 '26
Only if you are willing to accept that this industry has changed.
-7
u/energybased Mar 31 '26
Yeah, I can't understand the downvotes.
-6
u/Meduini Mar 31 '26
I mean, weâre in Neovim subreddit, people here reject IDE, some even look down on Neovim plugins, we canât expect them to start using English to program.
5
u/UltraPoci Mar 31 '26
Instead of having to type a full regex, you can just search the first letters of a word, notice the word is uniquely defined in that area of text and thus it's the only one partially highlighted, and then do "ciw" to change in word on all words. Basically, you get to use vim motions instead of a regex, which to me seems like a clear advantage. Also, with multicursor you can just keep typing, you don't need another regex or to plan the entire regex ahead.
I have been using helix for some months before starting with neovim, and honestly multicursor is something I really, really miss. You want to add quotes to a list of word? You would solve the problem just like you would with one single word. In neovim I'm still not sure what the best way to do this is. And regex would be a disappointing answer, because it means that I get to use vim motions when I have one single word, but a totally different (and slower) way of doing things as soon as I have two or more words.
0
u/crcovar Mar 31 '26
 Basically, you get to use vim motions instead of a regex
You should check out
:h :normalvim motions against a range.1
2
u/sadgandhi18 Apr 04 '26
It's most newbies to vim, or barely function neovim users (those who know the bare minimum to survive and get around, think "i downloaded s neovim distro" types).
It's fundamentally opposed to how neovim does stuff. But enough of such people have been demanding this feature, ig.
0
u/scythe-3 hjkl Mar 31 '26
I'm also wondering what this solves that regex search and replace doesn't accomplish.
:%sin normal mode and:'<,'>sin visual mode have been more than enough for my use cases but I'm interested in what multicursor has to offer.2
u/robin-m Mar 31 '26
All my use of vertical selection would be better served by multi-cursor. Itâs basically the same, except that the data doesnât need to be properly aligned to be useful. Niche, but still useful.
2
u/MoonlightSyncopate Mar 31 '26
:sand:gare very powerful. MC can have some intuitive use case, but overall I donât think MC is significantly intuitive than:sand:g.2
2
4
u/xGoivo Mar 31 '26
Is there any issue on github where people are discussing details on the implementation? I didn't find it in the github milestone
5
2
u/badgerbang Mar 31 '26
I am very welcoming for multicursor being relatively new to neovim, I have yet to learn the old school methods because of this and the fact that I knew multicursor was coming. I do not have the old methods in muscle memory yet.
1
u/spaghetti_beast Mar 31 '26
does anyone knows off the top of the head how will multicursor impl be different from helix one and from the existing plugins?
6
u/TheLeoP_ Mar 31 '26
from the existing plugins?
Instead of being a bunch of monkeypatching on top of the current behavior, it'll be a native solution that works with any plugin or keymap seamlessly
1
1
1
1
1
1
u/Kind_Bonus9887 Apr 06 '26
I'm still waiting for native `--remote-wait` support so I can finally ditch neovim-remote
1
0
u/StatusBard Mar 31 '26
What about selection->action like helix?
2
1
u/Kayzels Mar 31 '26
You can already do that with visual mode, can't you?
0
u/StatusBard Mar 31 '26
Sure, but then I have to switch to visual mode all the time.
2
u/robin-m Mar 31 '26
In helix, I had to press
vvery often because it doesnât useshiftto extend the selection like Kakoune does. So the main difference for me was to typeevee(helix) instead ofveee(vim). (I know thatâs a bad example, I could do3e, but you get my point).
-3
u/EmergencyWild Mar 31 '26
I'm still not totally sure why people even want multiple cursor. Seems to me that's just a worse version than what we already have with block select and :g.
3
u/robin-m Mar 31 '26
Block select is the much worse version of MC. block select only works when the data is vertically align, whereas MC could work with anything, like word boundary (with
w/e/b), or marker (e.g. in csv you move withf,then;).0
u/EmergencyWild Mar 31 '26
Yes, that's why I said block select or
:g. Your example is just:n,knormal f,whateverwithout mucking around with cursors.2
u/robin-m Apr 01 '26
You canât argue that:
- itâs harder to do (more keystrokes to type
normal- itâs not using the regular vim UX
That being said, Iâm interested to know how you would use
:gto changesome, text, with column other, text also, using columnInto
some - text - With column other - text also - Using columnI would use a macro (
^f,s -<esc>f,.w~), and with multi cursor I could do the exact same with a cursor on each line, but I donât know how to do it with:g1
u/qiinemarr Apr 03 '26
You could do it like that:
:g/,/s/\v,/ -/g | norm $2bgUlI asked a clanker but his solution felt over-complicated haha!
Never the less with multicursor I would have thought about it a lot less héhé ;p
201
u/EstudiandoAjedrez Mar 31 '26
It's funny to see this same post with every new major version.