Add new command prelude-youtube

This commit is contained in:
Bozhidar Batsov 2013-08-26 17:58:02 +03:00
parent 0dfb6c9287
commit 7cae1b3427
3 changed files with 12 additions and 0 deletions

View file

@ -71,6 +71,16 @@ With a prefix ARG always prompt for command to use."
(buffer-substring (region-beginning) (region-end))
(read-string "Google: "))))))
(defun prelude-youtube ()
"Search YouTube with a query or region if any."
(interactive)
(browse-url
(concat
"http://www.youtube.com/results?search_query="
(url-hexify-string (if mark-active
(buffer-substring (region-beginning) (region-end))
(read-string "Search YouTube: "))))))
(defun prelude-indent-rigidly-and-copy-to-clipboard (begin end arg)
"Indent region between BEGIN and END by ARG columns and copy to clipboard."
(interactive "r\nP")

View file

@ -37,6 +37,7 @@
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-c o") 'prelude-open-with)
(define-key map (kbd "C-c g") 'prelude-google)
(define-key map (kbd "C-c y") 'prelude-youtube)
;; mimic popular IDEs binding, note that it doesn't work in a terminal session
(define-key map [(shift return)] 'prelude-smart-open-line)
(define-key map (kbd "M-o") 'prelude-smart-open-line)