Skip to content

Instantly share code, notes, and snippets.

@pratul
Created January 26, 2011 15:53
Show Gist options
  • Save pratul/796885 to your computer and use it in GitHub Desktop.
Save pratul/796885 to your computer and use it in GitHub Desktop.
lut4rp's dot emacs file
;;; ---------------------
;;; 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
'(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 nil)
'(display-time-mode t)
'(global-hl-line-mode 0)
'(grep-command "grep -rn")
'(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 0) ; blink! 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!
(setq frame-title-format "Emacs - %f") ; i liek renamed buffers
(setq-default indent-tabs-mode nil) ; spaces ftw
(setq-default line-spacing 0.20) ; kthx sid0
(c-set-offset 'topmost-intro-cont 0 nil); won't indent toplevel construct introduction
(c-set-offset 'statement-cont 0 nil) ; won't indent toplevel...
;; (setq-default cursor-type 'hbar) ; horizontal underline as cursor
;; (set-fill-column 80) ; people use tiny screens too
;;;
;; ido mode
(require 'ido)
(ido-mode t)
(setq ido-enable-flex-matching t) ; enable fuzzy matching
;;;
;; move across split buffers using meta
(windmove-default-keybindings 'meta)
;;;
;; for use with emacsclient
(server-start)
;;;
;; Set default font
(set-default-font "-apple-droid sans mono-medium-r-normal--0-0-0-0-m-0-mac-roman")
;(set-default-font "-apple-menlo-medium-r-normal--0-0-0-0-m-0-iso10646-1")
;(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")
;;;
;; Setting the default plugin load path.
(add-to-list 'load-path "~/.emacs.d/plugins")
;; autopair.el
(require 'autopair)
(autopair-global-mode t)
(setq autopair-blink nil)
;; yasnippet
;; (add-to-list 'load-path "~/.emacs.d/plugins/yasnippet-0.6.1c")
;; (require 'yasnippet)
;; (yas/initialize)
;; (yas/load-directory "~/.emacs.d/plugins/yasnippet-0.6.1c/snippets")
;;;
;; Set default color theme
(require 'color-theme)
(load-file "~/.emacs.d/plugins/color-theme-almost-monokai.el")
(color-theme-almost-monokai)
;; (color-theme-initialize)
;; (color-theme-charcoal-black)
;;;
;; Misc file loads
;; (load-file "~/.emacs.d/plugins/django-html-mode.el") ; Django syntax awesomeness
;; (load-file "~/.emacs.d/plugins/textmate.el") ; TextMate mode
;;;
;; 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)
;;;
;; uniquify
(require 'uniquify)
(setq uniquify-buffer-name-style 'reverse)
(setq uniquify-separator "/")
(setq uniquify-after-kill-buffer-p t)
(setq uniquify-ignore-buffers-re "^\\*")
;;;
;; Quick select an entire line
(fset 'select-line
(lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([1 67108896 5] 0 "%d")) arg)))
(global-set-key (kbd "C-M-;") 'select-line)
(setq max-mini-window-height 4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment