Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which editors out of Emacs, Vim and JEdit support multiple simultaneous text insertion points?

Background: JEdit (and some other text editors as well) support a feature called Multiple simultaneous text insertion points. (at least that's what I'm calling it here).

To understand what this means, take a look at the link.

Out of all the features in use in modern text editors, initial research seems to indicate that this is one feature that both Emacs and Vim do not actually support. If correct, this would be pretty exceptional since it's quite difficult to find a text editor feature that has not made its way into at least one of these two old-school editors.

Question: Has anyone ever seen or implemented this feature in either Emacs, Vim, or both? If so, please point me to a link, script, reference or summary that explains the details.

If you know an alternate way to do the same (or similar) thing, please let me know.

like image 811
dreftymac Avatar asked Dec 28 '08 18:12

dreftymac


People also ask

What is the best text editor vi or Emacs?

With over 50 billion commands collected across the Cmd user base, we were able to deep dive into the stats and figure out if Vim is actually the preferred text editor compared to Emacs. In our findings, we found 93% of the users on all our clients' projects use Vi/Vim as their primary file editor.

What is the difference between Vim and Emacs?

Emacs used to be the only editor of the two that was programmable, and while Vim has a lot of weird levels to its programmability, with the addition of Python and Ruby bindings (and more, I forget), Vim is also programmable in most ways you'd care for.

What is Vim Emacs and Nano?

Vim is like Emacs only it uses a much different form of input. Vim is modal meaning that each key means something different in a different mode. Basically, Nano is for normal users. Emacs and Vim are for programmers.

What is faster Vim or Emacs?

Productivity and Editing SpeedFile editing is usually faster with Vim than with Emacs because of Vim's purposely speed-driven interface. For example, cursor movement can be controlled through the H, J, K, and L keys in the normal mode.


3 Answers

The vim way to do this is the . command which repeats the last change. So, for instance, if I change a pointer to a reference and I have a bunch of obj->func that I want to change to obj.func then I search for obj->, do 2cw to change the obj-> to obj., then do n.n.n. until all the instances are changed.

Perhaps not a flexible as what you're talking about, but it works frequently and is very intuitive and fast when it does.

like image 110
David Norman Avatar answered Oct 14 '22 00:10

David Norman


moccur-edit.el almost does what you want. All the locations matching the regexp are displayed, and the editing the matches makes changes in the corresponding source. However, the editing is done on a single instance of the occurrence.

I imagine it'd be straight forward to extend it to allow you to edit them all simultaneously (at least in the simple case).

There is a demo of it found here.

Turns out, the newest versions of moccur-edit don't apply changes in real-time - you must apply the changes. The changes are also now undoable (nice win).

like image 35
Trey Jackson Avatar answered Oct 14 '22 01:10

Trey Jackson


In EMACS, you could/would do it with M-x find-grep and a macro. If you really insist that it be fully automatic, then you'd include the find-next in the macro.

But honestly, this strikes me as a sort of Microsoft-feature: yes, it adds to the feature list, but why bother? And would you remember it existed in six months, when you want to use it again?

like image 6
Charlie Martin Avatar answered Oct 14 '22 00:10

Charlie Martin