Something I've found useful in other editors is the ability to:
- take the selected text
- run an external command and pass the selection to its
stdin
- take the external commands
stdout
and replace the current selection with it.
This way you can write useful text tools which operate on the selection using any language that can do basic io.
How can this be done with emacs using the selection? ... a single character, word, paragraph... etc.
(Directly in the command line, or via a key binding?)
Note
The reason I'm asking this question is because I would like to operate on the selection. (i.e., the text that would be removed if x
was pressed).
In evil-mode !sort
for example only works on a line-level.
shell-command-on-region
.