Skip to content

Instantly share code, notes, and snippets.

@oh-sky
Last active August 29, 2015 14:03
Show Gist options
  • Save oh-sky/bf9e9eb9ce3fd83c926b to your computer and use it in GitHub Desktop.
Save oh-sky/bf9e9eb9ce3fd83c926b to your computer and use it in GitHub Desktop.
CakePHP2使いの.emacs
;;display settings
(tool-bar-mode nil) ;ツールバーを消す
(show-paren-mode t) ; 対応する括弧のハイライト
(display-time)
(setq-default truncate-lines t) ;右端で折り返さない
(setq-default truncate-partial-width-windows t) ;右端で折り返さない
;; 行番号
(global-linum-mode t)
(set-face-attribute 'linum nil
:foreground "#800"
:height 0.9)
(setq linum-format "%3d")
;; 文字の色づけ
(defface my-face-fwsp '((t (:background "medium aquamarine"))) nil)
(defface my-face-tab '((t (:background "cyan"))) nil)
(defface my-face-eolsp '((t (:foreground "SteelBlue" :underline t))) nil)
(defvar my-face-fwsp 'my-face-fwsp)
(defvar my-face-tab 'my-face-tab)
(defvar my-face-eolsp 'my-face-eolsp)
(defadvice font-lock-mode (before my-font-lock-mode ())
(font-lock-add-keywords
major-mode
'(
(" " 0 my-face-fwsp append) ;全角スペース
("\t" 0 my-face-tab append) ;タブ
("[ ]+$" 0 my-face-eolsp append) ;行末のスペース
)))
(ad-enable-advice 'font-lock-mode 'before 'my-font-lock-mode)
(ad-activate 'font-lock-mode)
(add-hook 'find-file-hooks '(lambda ()
(if font-lock-mode
nil
(font-lock-mode t))))
;;global key bind settings
(global-set-key "\C-h" 'delete-backward-char)
(global-set-key "\M-?" 'help-command)
(global-set-key "\C-c\C-r" 'query-replace-regexp)
(global-set-key "\C-c\C-i" 'indent-region)
;; dired
(add-hook 'dired-load-hook
'(lambda ()
;return(enter)押下で別バッファで開くように
(define-key dired-mode-map "\C-m" 'dired-find-file-other-window)
))
;; \C-b で anything bufferを起動
(require 'anything-config)
(global-set-key "\C-xb" 'anything-for-buffers)
(put 'erase-buffer 'disabled nil)
(load-library "php-mode")
(require 'php-mode)
(add-hook 'php-mode-hook
'(lambda()
(c-set-offset 'arglist-intro '+) ;配列のインデント
(c-set-offset 'arglist-close 0) ;配列のインデント
(setq tab-width 4)
(setq indent-tabs-mode t)
(setq c-basic-offset 4)
))
;; CakePHP View template
(setq auto-mode-alist
(cons (cons "\\.ctp$" 'php-mode) auto-mode-alist))
;; Minor mode for cakephp2 https://github.com/k1LoW/emacs-cake2/
(require 'cake2)
(global-cake2 t)
(cake2-set-default-keymap)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment