Skip to content

Instantly share code, notes, and snippets.

@nhunzaker
Created February 5, 2014 00:45
Show Gist options
  • Save nhunzaker/8815412 to your computer and use it in GitHub Desktop.
Save nhunzaker/8815412 to your computer and use it in GitHub Desktop.
;;; bash.el -- Sets some key bindings for shell-script-mode
;;; Commentary:
;;; Code:
(defun current-buffer-to-string ()
"Get the contents of the current buffer as a string."
(interactive)
(buffer-substring (point-min) (point-max)))
(defun shell-script-mode-eval-buffer()
"Evaluate the current buffer in the shell."
(interactive)
(message (shell-command-to-string (current-buffer-to-string))))
(defun local-keys ()
"Set up local keys for `shell-script-mode'."
(local-unset-key [(hyper return)])
(local-set-key [(hyper return)] 'shell-script-mode-eval-buffer))
(add-hook 'sh-mode-hook 'local-keys)
;;; bash.el ends here
say "awwww yiss"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment