Skip to content

Instantly share code, notes, and snippets.

@sivy
Created September 20, 2010 17:03
Show Gist options
  • Save sivy/588228 to your computer and use it in GitHub Desktop.
Save sivy/588228 to your computer and use it in GitHub Desktop.
;; ===============================
;; SIVY .emacs setup
(setq user-mail-address "[email protected]")
;; misc environmental settings
;; hilite current line
(global-hl-line-mode 1)
;; Show line-number in the mode line
(line-number-mode 1)
;; new buffers are text
(setq default-major-mode 'text-mode)
(iswitchb-mode t)
(require 'ido)
(ido-mode 'both)
(setq max-lisp-eval-depth 1200)
(setq split-width-threshold 200)
(normal-erase-is-backspace-mode 1)
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
;; GIT!
(setq exec-path (append exec-path '("/usr/local/git/bin")))
;; color-themes
;; (add-to-list 'load-path ".emacs.d/plugins/color-theme-6.6.0/")
;; (require 'color-theme)
;; (eval-after-load "color-theme"
;; '(progn
;; (color-theme-initialize)
;; (color-theme-aliceblue)))
;; -------------------------------
;; textmate-mode
(add-to-list 'load-path "~/.emacs.d/vendor/textmate.el")
(require 'textmate)
(textmate-mode)
(add-to-list 'load-path
"~/.emacs.d/plugins/")
(add-to-list 'load-path
"~/.emacs.d/plugins/sivy-emacs-toys")
(add-to-list 'load-path
"~/.emacs.d/plugins/sivy-emacs-toys/mt-modes")
;; pastie
(autoload 'pastie-buffer "pastie" nil t)
(autoload 'pastie-region "pastie" nil t)
;; -------------------------------
;; yasnippet
(add-to-list 'load-path
"~/.emacs.d/plugins/yasnippet-0.6.1c")
(require 'yasnippet) ;; not yasnippet-bundle
(yas/initialize)
(yas/load-directory "~/.emacs.d/plugins/yasnippet-0.6.1c/snippets")
(yas/load-directory "~/.emacs.d/plugins/sivy-emacs-toys/snippets")
;; -------------------------------
;; cperl for the win
(defalias 'perl-mode 'cperl-mode)
(setq cperl-hairy t)
(setq cperl-electric-keywords t)
(add-to-list 'auto-mode-alist '("\\.t$" . perl-mode))
;; -------------------------------
;; perltidy
(autoload 'perltidy "perltidy-mode" nil t)
(autoload 'perltidy-mode "perltidy-mode" nil t)
; Makes perltidy-mode automatic for cperl-mode
(eval-after-load "perl-mode"
'(add-hook 'perl-mode-hook 'perltidy-mode))
(eval-after-load "cperl-mode"
'(add-hook 'cperl-mode-hook 'perltidy-mode))
; Run perltidy when the C-ct key sequence is used.
; (global-set-key "\C-t" 'perltidy)
;; http://notes.timeghost.net/2010/03/perltidy-and-pbp.html
(setq perltidy-bin "perltidy -q -l=115 -i=4 -ci=4 -st -se -vt=2 -cti=0 -pt=1 -bt=1 -sbt=1 -bbt=1 -nsfs -nolq -wbb='% + - * / x != == >= <= =~ < > | & **= += *= &= <<= &&= -='")
;; ------------------------------
;; perlcrit!
(require 'perlcritic)
;; ------------------------------
;; mt-mode
(require 'mt-util)
(autoload 'mt-mode "mt-mode" nil t)
(autoload 'mt-test-mode "mt-test-mode" nil t)
;; (global-set-key (kbd "C-c c") 'mt-perl-compile)
;; (global-set-key (kbd "C-c t") 'mt-run-test)
;; (global-set-key (kbd "C-c a") 'mt-run-all-tests)
(eval-after-load "cperl-mode"
'(add-hook 'cperl-mode-hook 'load-mt-mode-conditionally))
(eval-after-load "cperl-mode"
'(add-hook 'cperl-mode-hook 'load-mt-test-mode-conditionally))
(setq mt-home "/Library/WebServer/Documents/testsites/advance/mte-2010-2")
(setq mt-config (concat mt-home "/mt-config.cgi"))
(add-to-list 'auto-mode-alist '("\\.tmpl$" . html-mode))
(yas/load-directory "~/.emacs.d/plugins/sivy-emacs-toys/snippets")
;; mode-compile
(autoload 'mode-compile "mode-compile"
"Command to compile current buffer file based on the major mode" t)
(global-set-key "\C-xc" 'mode-compile)
(autoload 'mode-compile-kill "mode-compile"
"Command to kill a compilation launched by `mode-compile'" t)
(global-set-key "\C-xk" 'mode-compile-kill)
;;; Python!
;; Electric Pairs
(add-hook 'python-mode-hook
(lambda ()
(define-key python-mode-map "\"" 'electric-pair)
(define-key python-mode-map "\'" 'electric-pair)
(define-key python-mode-map "(" 'electric-pair)
(define-key python-mode-map "[" 'electric-pair)
(define-key python-mode-map "{" 'electric-pair)))
(defun electric-pair ()
"Insert character pair without sournding spaces"
(interactive)
(let (parens-require-spaces)
(insert-pair)))
;; bind RET to py-newline-and-indent
(add-hook 'python-mode-hook '(lambda ()
(define-key python-mode-map "\C-m" 'newline-and-indent)))
;;; how to set these only for python?
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
;; -------------------------------
;; yaml!
(require 'yaml-mode)
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
(add-to-list 'auto-mode-alist '("\\.yaml$" . yaml-mode))
;; -------------------------------
;; markdown!
(autoload 'markdown-mode "markdown-mode.el"
"Major mode for editing Markdown files" t)
(setq auto-mode-alist
(cons '("\\.mdown" . markdown-mode) auto-mode-alist))
(setq auto-mode-alist
(cons '("\\.md" . markdown-mode) auto-mode-alist)) ; github-flavored markdown
;; -------------------------------
;; textile!
(require 'textile-mode)
(setq auto-mode-alist
(cons '("\\.txt" . textile-mode) auto-mode-alist))
(setq auto-mode-alist
(cons '("\\.textile" . textile-mode) auto-mode-alist))
;; ORG MODE
;; "i'm telling you, those chickens are OOOORGANIZED!"
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(define-key global-map "\C-cr" 'org-remember)
(setq org-todo-keywords (quote ((sequence "TODO(t)" "STARTED(s!)" "|" "DONE(d!/!)")
(sequence "WAITING(w@/!)" "SOMEDAY(S!)" "|" "CANCELLED(c@/!)"))))
(setq org-todo-keyword-faces (quote (("TODO" :foreground "red" :weight bold)
("STARTED" :foreground "blue" :weight bold)
("DONE" :foreground "dark green" :weight bold)
("WAITING" :foreground "orange" :weight bold)
("SOMEDAY" :foreground "magenta" :weight bold)
("CANCELLED" :foreground "dark green" :weight bold))))
(setq org-use-fast-todo-selection t)
(setq org-treat-S-cursor-todo-selection-as-state-change nil)
;; MISC
(global-set-key "\C-f" 'find-grep-dired)
;; JSMODE
(autoload 'js2-mode "js2" nil t)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
;; Custom
(setq custom-file "~/.emacs.d/custom.el") (load custom-file)
;; gist
(add-to-list 'load-path "~/.emacs.d/vendor/gist.el")
(require 'gist)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment