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

后端 未结 10 2142
心在旅途
心在旅途 2021-02-12 12:06

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 callin

相关标签:
10条回答
  • 2021-02-12 12:52

    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?

    0 讨论(0)
  • 2021-02-12 12:56

    It should be something like this in vim:

    %s/paint.\((.*),/\1.paint(/ 
    

    Or something like that, I am really bad at "mock" regular expressions.

    The idea is substitute the pattern:

    /paint(object,/ 
    

    with

    /object.paint(/ 
    

    So, yes, it is "supported"

    0 讨论(0)
  • 2021-02-12 12:58

    Another slight similarity: In Emacs, the rectangle editing features provided by cua-selection-mode (or cua-mode) automatically gives you multiple insertion points down the left or right edge of the marked rectangle, so that you can type a common prefix or suffix to all of those lines.

    e.g.:
    M-x cua-selection-mode RET (enable the global minor mode, if you don't already use this or cua-mode)
    C-RET down down down (marks a 1x3 character rectangle)
    type prefix here
    C-RET (unmark the rectangle to return to normal editing)

    0 讨论(0)
  • 2021-02-12 13:05

    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).

    0 讨论(0)
提交回复
热议问题