eye icon indicating copy to clipboard operation
eye copied to clipboard

Feature request: multi-cursor as in sublime text

Open e3krisztian opened this issue 7 years ago • 5 comments

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

e3krisztian avatar Dec 16 '17 17:12 e3krisztian

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 avatar Dec 16 '17 23:12 hydrargyrum

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

hydrargyrum avatar Dec 17 '17 00:12 hydrargyrum

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:

  • select the first instance of the word, or simply press ctrl-D inside the word, which selects it
  • pressing ctrl-D selects the next instance of the selection and drops a cursor at the end
  • when I think all of them is selected I do the name-editing with the cursors

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

e3krisztian avatar Dec 17 '17 17:12 e3krisztian

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.

hydrargyrum avatar Dec 18 '17 22:12 hydrargyrum

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

  • search by word under cursor (vim: *, sublime text: ctrl-d)
  • search by currently selected text (sublime text: ctrl-d)
  • find next
  • drop cursor, find next

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

e3krisztian avatar Dec 25 '17 21:12 e3krisztian