Skip to content

Instantly share code, notes, and snippets.

@charliek
Created March 5, 2010 16:58
Show Gist options
  • Save charliek/322915 to your computer and use it in GitHub Desktop.
Save charliek/322915 to your computer and use it in GitHub Desktop.
;(require 'python-mode)
;; our dtd mode
(autoload 'dtd-mode "tdtd" "Major mode for SGML and XML DTDs." t)
(autoload 'dtd-etags "tdtd"
"Execute etags on FILESPEC and match on DTD-specific regular expressions."
t)
;; setup js2 mode
(setq load-path (append (list (expand-file-name "~/.emacs.d/js2")) load-path))
(autoload 'js2-mode "js2" nil t)
;;(require 'generic-x)
;(load "C:\\Program Files\\emacs-21.3\\lisp\\nxml-mode-20041004\\rng-auto.el")
;(load "C:\\Program Files\\emacs-21.3\\lisp\\scala\\scala-mode.el")
;set up initial editor frame colors
(set-background-color "white")
(set-foreground-color "black")
(set-cursor-color "green")
;setup initial environment
(setq inhibit-startup-message t)
(display-time)
;set default mode for new files of unknown types to text
(setq default-major-mode 'text-mode)
;(setq ps-print-color-p 't)
;; don't make backup files
(setq make-backup-files nil)
;set the file name in title bar
(setq frame-title-format "%b")
;love the line numbers
(setq line-number-mode t)
(show-paren-mode)
;; sets the Scheme interpreter to be run to UMB Scheme
;(setq scheme-program-name "umb-scheme")
;(setq scheme-program-name "mzscheme")
;set the fontset....
(setq standard-fontset-spec
"-Misc-Fixed-Medium-R-Normal--13-120-75-75-C-70-ISO8859-1")
;shortcut keys are good
(global-set-key "\C-c\C-v" 'goto-line)
;(global-set-key "\C-c\C-m" 'compile)
;(global-set-key "\C-x\C-m" 'compile)
;syntax highlighting pretty much rules
;from here down I swiped from john gardner
(cond ((fboundp 'global-font-lock-mode)
;; Turn on font-lock in all modes that support it
(global-font-lock-mode t) ;; Maximum colors
(setq font-lock-maximum-decoration t) ;; Customize face
(setq font-lock-face-attributes
;; Symbol-for-Face Foreground Background Bold Italic Underline
'(
(font-lock-comment-face "maroon")
(font-lock-string-face "red")
(font-lock-keyword-face "blue")
(font-lock-function-name-face "purple")
(font-lock-variable-name-face "brown")
(font-lock-type-face "black")
(font-lock-reference-face "royalblue")
(font-lock-error-face "cyan")
(font-lock-warning-face "navyblue")
(font-lock-active-error-face "forestgreen")))
;(font-lock-include-face "red")))
;; Create the faces from the attributes
;; (font-lock-make-faces)
)
)
(setq auto-mode-alist '(("\\.ad[bs]\\'" . ada-mode)
("\\.awk\\'" . awk-mode)
("\\.lex\\'" . c-mode)
("\\.js\\'" . js2-mode)
("\\.[cy]\\'" . c++-mode)
("\\.h\\'" . c++-mode)
("\\.[CH]\\'" . c++-mode)
("\\.java\\'" . java-mode)
("\\.scala\\'" . scala-mode)
("\\.pc\\'" . c++-mode)
("\\.sql\\'" . c++-mode)
("\\.ctl\\'" . c++-mode)
("\\.cc\\'" . c++-mode)
("\\.hh\\'" . c++-mode)
("\\.cpp\\'" . c++-mode)
("\\.rc\\'" . c++-mode) ;; resource files
("\\.rcv\\'" . c++-mode)
("\\.p[lm]\\'" . perl-mode)
("\\.cgi\\'" . perl-mode)
("\\.py\\'" . python-mode)
("\\.php\\'" . php-mode)
("\\.f\\'" . fortran-mode)
("\\.el\\'" . emacs-lisp-mode)
("\\.emacs\\'" . emacs-lisp-mode)
("\\.scm\\'" . scheme-mode)
("\\.tex\\'" . LaTeX-mode)
("\\.bib\\'" . bibtex-mode)
("[Mm]akefile\\'" . makefile-mode)
("\\.mak\\'" . makefile-mode)
("\\[Mm]akefile.\\'" . makefile-mode)
("\\.bat\\'" . shell-script-mode)
("\\.tar\\'" . tar-mode)
("\\.html\\'" . html-mode)
("\\.htm\\'" . html-mode)
("\\.cf[cm]\\'" . html-mode)
("\\.xml\\'" . nxml-mode)
("\\.xsl\\'" . nxml-mode)
("\\.dtd\\'" . dtd-mode)
)
)
(defun up-slightly () (interactive) (scroll-up 5))
(defun down-slightly () (interactive) (scroll-down 5))
(global-set-key [mouse-4] 'down-slightly)
(global-set-key [mouse-5] 'up-slightly)
(defun up-one () (interactive) (scroll-up 1))
(defun down-one () (interactive) (scroll-down 1))
(global-set-key [S-mouse-4] 'down-one)
(global-set-key [S-mouse-5] 'up-one)
(defun up-a-lot () (interactive) (scroll-up))
(defun down-a-lot () (interactive) (scroll-down))
(global-set-key [C-mouse-4] 'down-a-lot)
(global-set-key [C-mouse-5] 'up-a-lot)
;; Whith this function you can switch to next buffer by typing Shift-tab.
(defalias 'switch-to-next-buffer 'bury-buffer)
;; Whith this function you can switch to previous buffer by typing Ctrl-tab
(defun switch-to-previous-buffer ()
"Switches to previous buffer"
(interactive)
(switch-to-buffer (nth (- (length (buffer-list)) 1)(buffer-list)))
)
(global-set-key "\C-x\C-a" 'switch-to-next-buffer)
(defun del-to-beginning ()
(interactive)
(kill-region (point) (progn (beginning-of-line) (point))))
(global-set-key "\C-u" 'undo)
(global-set-key "\C-b" 'del-to-beginning)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment