To reference a word or a line in .samrc, sam on steroids
jacksonbenete opened this issue · 0 comments
Hello there,
I was thinking if there is a way to reference a word or a line in the .samrc file.
We have a "delete previous word" command, meaning that we can detect a "last word" boundary.
We also know the reference of the current line and selected lines, because we can for example select lines on a file and executing a s/pattern/pattern/g
on the command window will take effect on the selected lines.
I was thinking that if we manage to have a variable on .samrc to reference the current line or word, we could write very nice commands.
A bind C x send %line
for example would allow for you to easily navigate on the command window lines and repeat commands.
A bind C <key> send %word
or bind C <key> send %selection
would allow to execute commands interactively.
In Acme we can select a text and a Button 2 click will execute the select portion as a command, if you "Button 2 click" on a word, it'll also execute the word as a command.
In Ecmas we can execute a line (or evaluate an Elisp expression) with something like C-x C-e
, there are others keybindings for evaluation portions of a line or a word as well.
I'm not trying to transform Sam on Acme or Emacs, of course. I just thought that this would open a lot of possibilities and give us a lot of power.
This is possible to do at some extent on the command window, the Button 2 menu will have a send
option that you can send the selected text to command window. What I'm proposing is to either have the same function as a keyboard action or to enable the send
option on Button 2 menu for file windows as well, or both.
What do you think?