Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun shell-command-on-region-or-line ()
- "Run selected text in a terminal or use the current line."
- (interactive)
- (shell-command
- (concat
- "gnome-terminal -e "
- (if (use-region-p)
- ;; current selection
- (buffer-substring (region-beginning) (region-end))
- ;; current line
- (thing-at-point 'line t)))))
- ;; Execute text in a terminal, no questions! (ctrl-alt-shift-enter to avoid accidents!)
- (global-set-key (kbd "<c-m-s-return>") 'term-shell-command-on-region-or-line)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement