hydrargyrum / eye

Edit Your Editor: a scriptable Qt-based text editor - mirror of https://gitlab.com/hydrargyrum/eye
Do What The F*ck You Want To Public License
15 stars 1 forks source link

Feature request: multi-cursor as in sublime text #15

Open e3krisztian opened 6 years ago

e3krisztian commented 6 years ago

as seen here: https://www.sublimetext.com/ and described here: https://www.sublimetext.com/docs/2/multiple_selection_with_the_keyboard.html

scintilla seems to support it: https://stackoverflow.com/questions/38850277/multi-cursor-editing-with-qscintilla #

hydrargyrum commented 6 years ago

It's already possible, you can have a rectangular selection with (default scintilla shortcuts) holding alt+shift+<arrow keys> (see list of qscintilla commands, these commands can be configured in ~/.config/eyeditor/keyboard.ini BTW).

I personally have this in my config:

@defaultEditorConfig
def selectionConfig(ed):
    ed.setMultipleSelection(True)
    ed.setMultipaste(True)
    ed.setAdditionalSelectionTyping(True)

It allows to type and paste in multiple lines at a time.

There are some interesting ideas on the sublime text page you linked that could be borrowed, thanks.

hydrargyrum commented 6 years ago

BTW, it's funny you point at this stackoverflow answer because I'm the one who wrote it :)

e3krisztian commented 6 years ago

I was not aware, it was you :)

Having multiple cursors is different from rectangular selection, I mostly use it for rename refactoring and in place of keyboard macros.

It is quite powerful and easy to use.

This is how it goes for rename refactoring:

It is also possible to skip an instance with a keypress (ctrl-K ctrl-D) or undo the last cursor drop/skip operation (ctrl-U).

hydrargyrum commented 6 years ago

The search feature in eye is currently under rework, but I thought the search could optionally select all found/highlighted results, what do you think?

It is also possible to skip an instance with a keypress (ctrl-K ctrl-D) or undo the last cursor drop/skip operation (ctrl-U).

Good idea, a bunch of selection functions (like "unselect a selection") could be provided, to be easily bound to keys in config.

e3krisztian commented 6 years ago

I use a text editor for its interactivity, so I would not use the select all matches feature - in fear that some non-visible instance is selected and edited, I would use sed for mass editing, but it might be just me.

For me the search functions that matter are

If there is multi-cursor support there should rarely be any need for replace. Regexp search/replace is nice sometimes, but is usually non-trivial to use due to differing regexp dialects - have to remember which dialect the editor uses, how it differs from sed, Perl, Python, Emacs, ...