zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
24.85k stars 1.17k forks source link

Feature request: marker-based selection #1174

Open int19h opened 6 years ago

int19h commented 6 years ago

The ability to use Shift+arrows etc to select text is arguably one of the best features of micro. The problem is that it's very much contingent on terminal support, and some terminals don't provide any means of detecting modifiers on navigation keys at all (e.g. FreeBSD vt).

Currently, working around this requires rebinding a bunch of selection commands to some arbitrary keys; however, when those keys aren't navigation keys + modifier because such aren't supported by the terminal, it's nearly impossible to remember those bindings.

The traditional way to handle selection in Unix text-mode editors is to use selection markers a la WordStar - basically a single keybinding to enter selection mode, in which all navigation keys without modifiers select stuff; and another keybinding to exit that mode, accepting current selections. Some editors, like mcedit, use a single keybinding for both operations.

It would be nice to have this as a bindable command in micro, for use with those funky terminals without having to abandon micro entirely.

JPLeBreton commented 1 week ago

"Selection mode" isn't just useful for certain terminal compatibility cases; for some editors it's the default and preferred behavior. In Emacs, I press ctrl-space once to start selecting, then navigate to the end of the search, then do a command operation. This is one of the only keybinding-related behaviors I can't replicate in micro. So there are multiple reasons to support this.