Skip to content

Instantly share code, notes, and snippets.

@pratul
Created August 10, 2009 13:48
Show Gist options
  • Save pratul/165195 to your computer and use it in GitHub Desktop.
Save pratul/165195 to your computer and use it in GitHub Desktop.
;;; ---------------------
;;; dot emacs
;;; Pratul Kalia (lut4rp)
;;; ---------------------
;;;
;; Mac full screen mode
;;;
(defun mac-toggle-max-window ()
(interactive)
(set-frame-parameter nil 'fullscreen (if (frame-parameter nil 'fullscreen) nil 'fullboth))
)
(define-key global-map [M-return] 'mac-toggle-max-window)
(mac-toggle-max-window)
;;;
;; standard stuff
;;;
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(auto-revert-verbose nil)
'(backup-inhibited t t)
'(column-number-mode t)
'(confirm-kill-emacs (quote yes-or-no-p))
'(desktop-save-mode t)
'(display-battery-mode t)
'(display-time-mode t)
'(global-hl-line-mode t)
'(grep-command "grep -rn")
'(ido-mode t nil (ido))
'(inhibit-startup-screen t)
'(menu-bar-mode t)
'(scroll-bar-mode nil)
'(show-paren-mode t)
'(show-trailing-whitespace t)
'(tool-bar-mode nil)
'(transient-mark-mode t))
(blink-cursor-mode -1) ; blink nay, o noble cursor
(savehist-mode 1) ; save all my M-x history
(cua-selection-mode 1) ; let me select text using <shift>
(global-auto-revert-mode 1) ; file changed! RELOAD!
(set-fill-column 80) ; people use tiny screens too
;;;
;; move across split buffers using meta
;;;
(windmove-default-keybindings 'meta)
;;;
;; for use with emacsclient
;;;
(server-start)
;;;
;; Setting the default plugin load path.
;;;
(add-to-list 'load-path "~/.emacs.d/plugins")
;;;
;; Set default font
;;;
(set-default-font "-apple-monaco-medium-r-normal--12-120-72-72-m-120-mac-roman")
;(set-default-font "-apple-inconsolata-medium-r-normal--0-0-0-0-m-0-mac-roman")
;(set-default-font "-apple-profont-medium-r-normal--10-100-72-72-m-100-mac-roman")
;;;
;; Global shortcut for comment-region
;;;
(define-key global-map "\C-c\C-c" 'comment-region)
(define-key global-map "\C-c\C-d" 'uncomment-region)
;;;
;; yasnippet
;;;
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas/initialize)
(yas/load-directory "~/.emacs.d/plugins/yasnippet/snippets")
;;;
;; Set default color theme
;;;
;(require 'color-theme)
(load-file "~/.emacs.d/plugins/color-theme-almost-monokai.el")
(color-theme-almost-monokai)
;; (set-background-color "black")
;; (set-foreground-color "white")
;; (set-cursor-color "#0066cc")
;;;
;; drupal-mode, see http://drupal.org/node/59868
;;;
(defun drupal-mode ()
"Drupal php-mode."
(interactive)
(php-mode)
(message "Drupal mode activated.")
(set 'tab-width 2)
(set 'c-basic-offset 2)
(set 'indent-tabs-mode nil)
(c-set-offset 'case-label '+)
(c-set-offset 'arglist-intro '+) ; for FAPI arrays and DBTNG
(c-set-offset 'arglist-cont-nonempty 'c-lineup-math) ; for DBTNG fields and values
; More Drupal-specific customizations here
)
(defconst my-php-style
'((c-offsets-alist . (
(arglist-close . c-lineup-close-paren) ; correct arglist closing parenthesis
)))
"My PHP Programming style"
)
(c-add-style "my-php-style" my-php-style)
(defun my-php-mode ()
"My personal php-mode customizations."
(c-set-style "my-php-style")
; More generic PHP customizations here
)
(defun setup-php ()
; PHP
(add-hook 'php-mode-hook 'my-php-mode)
; Drupal
(add-to-list 'auto-mode-alist '("\\.\\(module\\|test\\|install\\|theme\\)$" . drupal-mode))
(add-to-list 'auto-mode-alist '("/drupal.*\\.\\(php\\|inc\\)$" . drupal-mode))
(add-to-list 'auto-mode-alist '("\\.info" . conf-windows-mode))
)
(setup-php)
;;;
;; tackling whitespace
;;;
(add-hook 'write-file-functions 'delete-trailing-whitespace)
;;;
;; textile mode
;;;
(require 'textile-mode)
(add-to-list 'auto-mode-alist '("\\.textile\\'" . textile-mode))
;;;
;; smooth scrolling
;;;
(require 'smooth-scrolling)
;;;
;; highlight 80+
;; needs `M-x highlight-80+`
;;;
(require 'highlight-80+)
;(if highlight-80+-mode () (highlight-80+-mode))
;;;
;; everywhere is utf-8
;;;
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
;;;
;; Mac OS X anti aliasing setting
;;;
(setq mac-allow-anti-aliasing t)
;;;
;; set frame title
;;;
(setq frame-title-format "Emacs - %f")
;;;
;; uniquify
;;;
(require 'uniquify)
(setq uniquify-buffer-name-style 'reverse)
(setq uniquify-separator "/")
(setq uniquify-after-kill-buffer-p t)
(setq uniquify-ignore-buffers-re "^\\*")
;;;
;; Boo ya, skeleton
;;;
(setq skeleton-pair t)
(global-set-key "[" 'skeleton-pair-insert-maybe)
(global-set-key "(" 'skeleton-pair-insert-maybe)
(global-set-key "{" 'skeleton-pair-insert-maybe)
(global-set-key "\"" 'skeleton-pair-insert-maybe)
(global-set-key "'" 'skeleton-pair-insert-maybe)
;;; ---------------------
;;; end dotemacs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment