This repository has been archived on 2022-12-11. You can view files and clone it, but cannot push or open issues or pull requests.
dot-files/.emacs.d/config/web.el

60 lines
2.2 KiB
EmacsLisp

;; (C) Copyright Collin J. Doering 2014
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;; File: web.el
;; Author: Collin J. Doering <collin.doering@rekahsoft.ca>
;; Date: Oct 22, 2014
;; Setup web browsing
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "conkeror")
(defun browse-url-before-point ()
"Find the first url before point and open it in a browser using browse-url"
(interactive)
(save-excursion
(search-backward-regexp "\(file\|ftp\\|http\\|https\)://.*\.")
(browse-url-at-point)))
(global-set-key (kbd "C-c g") 'browse-url-at-point)
(global-set-key (kbd "C-c G") 'browse-url-before-point)
;; setup php-mode
(autoload 'php-mode "php-mode.el" "Php mode." t) ;; ELPA
(setq auto-mode-alist (append '(("/*.\.php[345]?$" . php-mode)) auto-mode-alist))
;; Setup sql-mode (use mysql instead of ansi)
(setq sql-product 'mysql)
;; Setup zencoding-mode
(require 'emmet-mode)
;; Disable C-j keybinding set by zencoding-mode and replace it with 'C-c j'
(define-key emmet-mode-keymap "\C-j" nil)
(define-key emmet-mode-keymap "\C-cj" 'emmet-expand-line)
;; Add appropriate hooks to sgml-mode
(add-hook 'sgml-mode-hook 'emmet-mode) ;; Auto-start on any markup modes
(add-hook 'css-mode-hook 'emmet-mode) ;; enable Emmet's css abbreviation.
(add-hook 'emmet-mode-hook (lambda () (setq emmet-indentation 2))) ;; indent 2 spaces.
;; Setup mmm-mode for multiple mode regions in the same buffer
(require 'mmm-mode)
;;(setq mmm-global-mode 'maybe)
;; Setup rainbow-mode ;; ELPA
(require 'rainbow-mode)
(add-hook 'css-mode-hook 'rainbow-mode)