-
-
Save piecyk/9acb2a6daec03086219d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'ansi-color) | |
(defvar karma-buffer | |
"*karma-node-specs-buffer*") | |
(defun karma-compile () | |
"Run Karma" | |
(interactive) | |
(shell-command "karma run" (get-buffer-create karma-buffer)) | |
(display-buffer karma-buffer) | |
(with-current-buffer karma-buffer | |
(ansi-color-apply-on-region (point-min) (point-max)) | |
(save-excursion | |
(while (re-search-forward "^.*\n\\[1A\\[2K" nil t) | |
(replace-match "" nil nil) | |
(beginning-of-buffer))))) | |
;; bind to key (M-r) in js-mode, adapt to your liking | |
(add-hook 'js-mode-hook | |
(lambda () | |
(local-set-key (kbd "M-r") 'karma-compile))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment