Browse Source

Add new command prelude-youtube

custom
Bozhidar Batsov 12 years ago
parent
commit
7cae1b3427
  1. 1
      README.md
  2. 10
      core/prelude-core.el
  3. 1
      core/prelude-mode.el

1
README.md

@ -218,6 +218,7 @@ Keybinding | Description
-------------------|------------------------------------------------------------ -------------------|------------------------------------------------------------
<kbd>C-c o</kbd> | Open the currently visited file with an external program. <kbd>C-c o</kbd> | Open the currently visited file with an external program.
<kbd>C-c g</kbd> | Search in Google for the thing under point (or an interactive query). <kbd>C-c g</kbd> | Search in Google for the thing under point (or an interactive query).
<kbd>C-c y</kbd> | Search in YouTube for the thing under point (or an interactive query).
<kbd>C-S-RET</kbd> or <kbd>M-o</kbd> | Insert an empty line above the current line and indent it properly <kbd>C-S-RET</kbd> or <kbd>M-o</kbd> | Insert an empty line above the current line and indent it properly
<kbd>S-RET</kbd> or <kbd>M-O</kbd> | Insert an empty line and indent it properly (as in most IDEs). <kbd>S-RET</kbd> or <kbd>M-O</kbd> | Insert an empty line and indent it properly (as in most IDEs).
<kbd>C-S-up</kbd> | Move the current line up. <kbd>C-S-up</kbd> | Move the current line up.

10
core/prelude-core.el

@ -71,6 +71,16 @@ With a prefix ARG always prompt for command to use."
(buffer-substring (region-beginning) (region-end)) (buffer-substring (region-beginning) (region-end))
(read-string "Google: ")))))) (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) (defun prelude-indent-rigidly-and-copy-to-clipboard (begin end arg)
"Indent region between BEGIN and END by ARG columns and copy to clipboard." "Indent region between BEGIN and END by ARG columns and copy to clipboard."
(interactive "r\nP") (interactive "r\nP")

1
core/prelude-mode.el

@ -37,6 +37,7 @@
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
(define-key map (kbd "C-c o") 'prelude-open-with) (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 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 ;; 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 [(shift return)] 'prelude-smart-open-line)
(define-key map (kbd "M-o") 'prelude-smart-open-line) (define-key map (kbd "M-o") 'prelude-smart-open-line)

Loading…
Cancel
Save