guest@dotshare [~/groups/emacs/config] $ ls Blasphemous/ | cat

Blasphemous (scrot) (+5 likes)

crshd Aug 25, 2011 (emacs/config)

.emacs(raw, dl)

SCROT

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
;; -------~-------~--~------------------~------
;; E M A C S
;; -------~-------~--~------------------~------
;; 
;; Software used
;; `-> Emacs 23.3-1
;; `-> Color-Theme 6.6.0     (http://www.nongnu.org/color-theme)
;; `-> Lua-mode 20110428     (http://luaforge.net/projects/lua-mode)
;; `-> Markdown-mode 1.8.1   (http://jblevins.org/projects/markdown-mode)
;; `-> Minimap 0.7           (http://randomsample.de/minimap.el)
;; `-> Smooth-Scrolling 1.10 (http://adamspiers.org/computing/elisp/smooth-scrolling.el)
;; `-> Vimpulse 0.5          (http://www.emacswiki.org/emacs/Vimpulse)
;; `-> WhizzyTex 1.3.2       (http://gallium.inria.fr/whizzytex)
;; `-> YaSnippet 0.6.1c      (http://code.google.com/p/yasnippet)
;; 
;; -------~-------~--~------------------~------

;; -------~-------~--~------------------~------
;; PLUGINS
;; -------~-------~--~------------------~------
(add-to-list 'load-path "~/.emacs.d/modules")
(require 'vimpulse)
(require 'minimap)

;; -------~-------~--~------------------~------
;; SEPARATE CONFIGS
;; -------~-------~--~------------------~------

(add-to-list 'load-path "~/.emacs.d/custom")
(load "keybinds")
(load "mode-line")
(load "filetypes")
(load "line-numbers")

;; -------~-------~--~------------------~------
;; APPEARANCE
;; -------~-------~--~------------------~------

(add-to-list 'load-path "~/.emacs.d/themes")
(require 'color-theme-julie)
(color-theme-julie)

;; -------~-------~--~------------------~------
;; SYNTAX
;; -------~-------~--~------------------~------
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)

;; -------~-------~--~------------------~------
;; MISC
;; -------~-------~--~------------------~------

;; scroll margin
(require 'smooth-scrolling)
(setq smooth-scroll-margin 10)

;; no...
(tool-bar-mode 0)
(scroll-bar-mode 0)
(menu-bar-mode 0)
(blink-cursor-mode 0)
(setq make-backup-files nil)
(setq auto-save-default nil)

;; show matching parens
(show-paren-mode t)

;; no splash
(setq inhibit-splash-screen t)

;; hilight current line
(global-hl-line-mode 1)

;; indent
(setq standard-indent 2)
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil)

;; always end a file with a newline
(setq require-final-newline nil)

;; line numbers
(defvar linum-is-relative 1)
(toggle-linum)

;; -------~-------~--~------------------~------
;; WHITESPACE
;; -------~-------~--~------------------~------
(require 'whitespace)

(setq whitespace-display-mappings
      '(
        (newline-mark 10 [60 10]) ; newlne, <
        (tab-mark 9 [187 9] [92 9]) ; tab, »
))

(setq
 whitespace-space 'whitespace-space
 whitespace-tab 'whitespace-tab
 whitespace-trailing 'whitespace-trailing
 whitespace-newline 'whitespace-newline
 whitespace-emtpy 'whitespace-empty)

;; -------~-------~--~------------------~------
;; YASNIPPET
;; -------~-------~--~------------------~------
(add-to-list 'load-path "~/.emacs.d/modules/yasnippet")
(require 'yasnippet)
(yas/initialize)
(yas/load-directory "~/.emacs.d/modules/yasnippet/snippets")

;; -------~-------~--~------------------~------
;; TeX
;; -------~-------~--~------------------~------
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)

(require 'whizzytex)

CLICK TO VIEW

x

custom_filetypes.el(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
(require 'yaml-mode)
(setq auto-mode-alist
             (nconc
              '(("COMMIT_EDITMSG$"  . diff-mode))
              '(("\.fsh$"          . c++-mode))
              '(("\.vsh$"          . c++-mode))
              '(("\.lua$"          . lua-mode))
              '(("\.md$"           . markdown-mode))
              '(("\.markdown$"     . markdown-mode))
              '(("\.xml$"          . nxml-mode))
              '(("\.html$"         . nxml-mode))
              '(("\.coffee$"       . coffee-mode))
              '(("\.hbs$"          . mustache-mode))
              '(("\.m$"            . objc-mode))
              '(("\.haml$"         . haml-mode))
              '(("\.scss$"         . css-mode))
              '(("\.yml$"          . yaml-mode))
              '(("\.yaml$"         . yaml-mode))
              '(("\.json$"         . yaml-mode))
              '(("\.mustache$"     . mustache-mode))
              '(("\.rb$"           . ruby-mode))
              '(("\.gemspec$"      . ruby-mode))
              '(("\.md$"           . markdown-mode))
              '(("\.textile$"      . textile-mode))
              '(("\.zsh$"          . sh-mode))
              '(("\.sass$"         . sass-mode))
              '(("\.js$"           . js2-mode))
              '(("\.js.erb$"       . js2-mode))
              '(("\.j$"            . objj-mode))
              '(("\.rake$"         . ruby-mode))
              '(("emfile$"         . ruby-mode))
              '(("akefile$"        . ruby-mode))
              '(("\.js\\.erb$"     . js2-mode))
              '(("\.coffee\\.erb$" . coffee-mode))
              '(("\xresources*"    . conf-xdefaults-mode))
              auto-mode-alist))

(setq magic-mode-alist ())

(autoload 'lua-mode "lua-mode" "Lua editing mode." t)
(autoload 'markdown-mode "markdown-mode" "Major mode for editing Markdown files" t)

;; Perl
(add-hook 'perl-mode-hook '(lambda ()
                             (setq perl-indent-level 2)))

;; Ruby
(add-hook 'ruby-mode-hook '(lambda ()
                             (setq ruby-indent-level 2)))

(fset 'ruby-insert-end
      [?e ?n ?d ?  tab backspace return])
(fset 'ruby-method-definition
      [tab ?d ?e ?f ?  ?a return ?e ?n ?d ?  tab backspace ?\C-p ?\C-e backspace])
 

x

custom_keybinds.el(raw, dl)

1
2
3
4
5
;; Move Alt-x to Ctrl-X/Ctrl-M
(global-set-key "\C-x\C-m" 'execute-extended-command)
(global-set-key "\C-c\C-m" 'execute-extended-command)

;; Also check out ~/.viper for Viper keybinds!
 

x

custom_line-numbers.el(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
;; -------~-------~--~------------------~------
;; LINE NUMBERS
;; -------~-------~--~------------------~------
;; line #s
(line-number-mode 1)
(global-linum-mode 1)

(defun linum-absolute-numbers ()
  "Set linum numbers to absolute values"
  (setq linum-is-relative 0)
  (setq linum-format
        (lambda (line)
          (propertize (format
                       (let ((w (length (number-to-string
                                         (count-lines (point-min) (point-max))))))
                         (concat " %" (number-to-string w) "d "))
                       line)
                      'face 'linum))))

(defun linum-relative-numbers ()
  "Set linum numbers to relative values"
  (defvar my-linum-current-line-number 0)
  (setq linum-is-relative 1)
  (setq linum-format
        (lambda (line-number)
          (propertize (format
                       (let ((w (length (number-to-string (count-lines (point-min) (point-max))))))
                         (concat " %" (number-to-string (+ w 1)) "s "))
                       (let ((relative-line (1+ (- line-number my-linum-current-line-number))))
                         (number-to-string (cond ((/= relative-line 0) (- relative-line 1))
                                                 ((= relative-line 0) -1)))))
                      'face 'linum))))

(defadvice linum-update (around my-linum-update)
  (let ((my-linum-current-line-number (line-number-at-pos)))
    ad-do-it))
(ad-activate 'linum-update)

(defun toggle-linum ()
  "Toggle line number display between absolute and relative numbers"
  (interactive)
  (if (= linum-is-relative 1)
      (linum-absolute-numbers)
    (linum-relative-numbers)))
 

x

custom_mode-line.el(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
;; mode line
(setq-default mode-line-format
              (quote
               (" "
                ;; mode string
                (:propertize global-mode-string face 'mode-line-mode-string)

                ;; file path
                (:propertize (:eval (if (> (length default-directory) 17)
                                        (concat "..." (substring default-directory -20))
                                      default-directory))
                             face 'mode-line-folder-face)

                ;; file name
                (:propertize mode-line-buffer-identification face 'mode-line-buffer-name)
                (:propertize mode-line-modified face 'mode-line-modified-face)
                "  "
                ;; value of 'mode-name'
                (:propertize "%m" face 'mode-line-mode-name)
                " :: "
                ;; line #
                "line %l, %p")))
 

x

.viper(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
(define-key viper-vi-basic-map  "Q"      'toggle-kbd-macro-recording-on)
(define-key viper-vi-basic-map  "q"      'call-last-kbd-macro)

(define-key viper-vi-basic-map  "\C-k"   'move-text-up)
(define-key viper-vi-basic-map  "\C-j"   'move-text-down)

(define-key viper-vi-global-user-map "C" 'comment-dwim-line)

(define-key viper-vi-basic-map  [f5]     'whitespace-mode)
(define-key viper-vi-basic-map  [f6]     'toggle-linum)
(define-key viper-vi-basic-map  [f7]     'toggle-minimap)
(define-key viper-vi-basic-map  [f11]    'dbl:insert-date)
(define-key viper-vi-basic-map  [f12]    'whizzytex-mode)


;;
;; Functions
;;

(defvar minimap-is-on 0)
(defun toggle-minimap ()
  "toggle minimap on/off"
  (interactive)
  (if (= minimap-is-on 1)
      (progn
        (minimap-kill)
        (setq minimap-is-on 0))
    (progn
      (minimap-create)
      (setq minimap-is-on 1))))
  

(defun toggle-kbd-macro-recording-on ()
  "One-key keyboard macros: turn recording on."
  (interactive)
  (define-key viper-vi-basic-map (this-command-keys) 'toggle-kbd-macro-recording-off)
  (start-kbd-macro nil))

(defun toggle-kbd-macro-recording-off ()
  "One-key keyboard macros: turn recording off."
  (interactive)
  (define-key viper-vi-basic-map (this-command-keys) 'toggle-kbd-macro-recording-on)
  (end-kbd-macro))

(defun move-text-internal (arg)
  (cond
   ((and mark-active transient-mark-mode)
    (if (> (point) (mark))
        (exchange-point-and-mark))
    (let ((column (current-column))
          (text (delete-and-extract-region (point) (mark))))
      (forward-line arg)
      (move-to-column column t)
      (set-mark (point))
      (insert text)
      (exchange-point-and-mark)
      (setq deactivate-mark nil)))
   (t
    (beginning-of-line)
    (when (or (> arg 0) (not (bobp)))
      (forward-line)
      (when (or (< arg 0) (not (eobp)))
        (transpose-lines arg))
      (forward-line -1)))))
(defun move-text-down (arg)
  "Move region (transient-mark-mode active) or current line arg lines down."
   (interactive "*p")
   (move-text-internal arg))
(defun move-text-up (arg)
  "Move region (transient-mark-mode active) or current line arg lines up."
   (interactive "*p")
   (move-text-internal (- arg)))


;; Original idea from
;; http://www.opensubscriber.com/message/emacs-devel@gnu.org/10971693.html
(defun comment-dwim-line (&optional arg)
  "Replacement for the comment-dwim command. If no region is selected and current
   line is not blank and we are not at the end of the line,
   then comment current line.
   Replaces default behaviour of comment-dwim, when it inserts comment at the end of the line."
  (interactive "*P")
  (comment-normalize-vars)
  (if (and (not (region-active-p)) (not (looking-at "[ \t]*$")))
    (comment-or-uncomment-region (line-beginning-position) (line-end-position))
    (comment-dwim arg)))
 

x

Notes