Merge branch 'master' of github.com:bbatsov/prelude
This commit is contained in:
commit
08494c79db
6 changed files with 24 additions and 27 deletions
|
@ -71,21 +71,17 @@ PROMPT sets the `read-string prompt."
|
||||||
(buffer-substring (region-beginning) (region-end))
|
(buffer-substring (region-beginning) (region-end))
|
||||||
(read-string prompt))))))
|
(read-string prompt))))))
|
||||||
|
|
||||||
(defun prelude-google ()
|
(defmacro prelude-install-search-engine (search-engine-name search-engine-url search-engine-prompt)
|
||||||
"Googles a query or region if any."
|
"Given some information regarding a search engine, install the interactive command to search through them"
|
||||||
(interactive)
|
`(defun ,(intern (format "prelude-%s" search-engine-name)) ()
|
||||||
(prelude-search "http://www.google.com/search?q=" "Google: "))
|
,(format "Search %s with a query or region if any." search-engine-name)
|
||||||
|
(interactive)
|
||||||
|
(prelude-search ,search-engine-url ,search-engine-prompt)))
|
||||||
|
|
||||||
(defun prelude-youtube ()
|
(prelude-install-search-engine "google" "http://www.google.com/search?q=" "Google: ")
|
||||||
"Search YouTube with a query or region if any."
|
(prelude-install-search-engine "youtube" "http://www.youtube.com/results?search_query=" "Search YouTube: ")
|
||||||
(interactive)
|
(prelude-install-search-engine "github" "https://github.com/search?q=" "Search GitHub: ")
|
||||||
(prelude-search "http://www.youtube.com/results?search_query="
|
(prelude-install-search-engine "duckduckgo" "https://duckduckgo.com/?t=lm&q=" "Search DuckDuckGo: ")
|
||||||
"Search YouTube: "))
|
|
||||||
|
|
||||||
(defun prelude-github ()
|
|
||||||
"Search GitHub with a query or region if any."
|
|
||||||
(interactive)
|
|
||||||
(prelude-search "https://github.com/search?q=" "Search GitHub: "))
|
|
||||||
|
|
||||||
(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."
|
||||||
|
@ -405,6 +401,7 @@ Doesn't mess with special buffers."
|
||||||
"Press <C-c g> to search in Google."
|
"Press <C-c g> to search in Google."
|
||||||
"Press <C-c G> to search in GitHub."
|
"Press <C-c G> to search in GitHub."
|
||||||
"Press <C-c y> to search in YouTube."
|
"Press <C-c y> to search in YouTube."
|
||||||
|
"Press <C-c U> to search in DuckDuckGo."
|
||||||
"Press <C-c r> to rename the current buffer and file it's visiting."
|
"Press <C-c r> to rename the current buffer and file it's visiting."
|
||||||
"Press <C-c t> to open a terminal in Emacs."
|
"Press <C-c t> to open a terminal in Emacs."
|
||||||
"Press <C-c k> to kill all the buffers, but the active one."
|
"Press <C-c k> to kill all the buffers, but the active one."
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
(define-key map (kbd "C-c g") 'prelude-google)
|
(define-key map (kbd "C-c g") 'prelude-google)
|
||||||
(define-key map (kbd "C-c G") 'prelude-github)
|
(define-key map (kbd "C-c G") 'prelude-github)
|
||||||
(define-key map (kbd "C-c y") 'prelude-youtube)
|
(define-key map (kbd "C-c y") 'prelude-youtube)
|
||||||
|
(define-key map (kbd "C-c U") 'prelude-duckduckgo)
|
||||||
;; 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)
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
"coffee-mode-defaults"
|
"coffee-mode-defaults"
|
||||||
|
|
||||||
;; CoffeeScript uses two spaces.
|
;; CoffeeScript uses two spaces.
|
||||||
(set (make-local-variable 'tab-width) 2)
|
(setq coffee-tab-width 2)
|
||||||
|
|
||||||
;; If you don't have js2-mode
|
;; If you don't have js2-mode
|
||||||
(setq coffee-js-mode 'javascript-mode)
|
(setq coffee-js-mode 'javascript-mode)
|
||||||
|
|
|
@ -44,17 +44,17 @@
|
||||||
;; use pdflatex
|
;; use pdflatex
|
||||||
(setq TeX-PDF-mode t)
|
(setq TeX-PDF-mode t)
|
||||||
|
|
||||||
(setq TeX-view-program-selection
|
;; sensible defaults for OS X, other OSes should be covered out-of-the-box
|
||||||
'((output-dvi "DVI Viewer")
|
(when (eq system-type 'darwin)
|
||||||
(output-pdf "PDF Viewer")
|
(setq TeX-view-program-selection
|
||||||
(output-html "HTML Viewer")))
|
'((output-dvi "DVI Viewer")
|
||||||
|
(output-pdf "PDF Viewer")
|
||||||
|
(output-html "HTML Viewer")))
|
||||||
|
|
||||||
;; this section is good for OS X only
|
(setq TeX-view-program-list
|
||||||
;; TODO add sensible defaults for Linux/Windows
|
'(("DVI Viewer" "open %o")
|
||||||
(setq TeX-view-program-list
|
("PDF Viewer" "open %o")
|
||||||
'(("DVI Viewer" "open %o")
|
("HTML Viewer" "open %o"))))
|
||||||
("PDF Viewer" "open %o")
|
|
||||||
("HTML Viewer" "open %o")))
|
|
||||||
|
|
||||||
(defun prelude-latex-mode-defaults ()
|
(defun prelude-latex-mode-defaults ()
|
||||||
(turn-on-auto-fill)
|
(turn-on-auto-fill)
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
(add-to-list 'auto-mode-alist '("Thorfile\\'" . ruby-mode))
|
(add-to-list 'auto-mode-alist '("Thorfile\\'" . ruby-mode))
|
||||||
(add-to-list 'auto-mode-alist '("Vagrantfile\\'" . ruby-mode))
|
(add-to-list 'auto-mode-alist '("Vagrantfile\\'" . ruby-mode))
|
||||||
(add-to-list 'auto-mode-alist '("\\.jbuilder\\'" . ruby-mode))
|
(add-to-list 'auto-mode-alist '("\\.jbuilder\\'" . ruby-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("Podfile\\'" . ruby-mode))
|
||||||
|
|
||||||
;; We never want to edit Rubinius bytecode
|
;; We never want to edit Rubinius bytecode
|
||||||
(add-to-list 'completion-ignored-extensions ".rbc")
|
(add-to-list 'completion-ignored-extensions ".rbc")
|
||||||
|
|
|
@ -49,8 +49,6 @@
|
||||||
(eval-after-load 'web-mode
|
(eval-after-load 'web-mode
|
||||||
'(progn
|
'(progn
|
||||||
(defun prelude-web-mode-defaults ()
|
(defun prelude-web-mode-defaults ()
|
||||||
;; Disable whitespace-mode when using web-mode
|
|
||||||
(whitespace-mode -1)
|
|
||||||
;; Customizations
|
;; Customizations
|
||||||
(setq web-mode-markup-indent-offset 4)
|
(setq web-mode-markup-indent-offset 4)
|
||||||
(setq web-mode-css-indent-offset 2)
|
(setq web-mode-css-indent-offset 2)
|
||||||
|
|
Loading…
Reference in a new issue