Skip to content

Instantly share code, notes, and snippets.

@winny-
Last active February 10, 2016 16:36
Show Gist options
  • Save winny-/618701f4b082857dfe1c to your computer and use it in GitHub Desktop.
Save winny-/618701f4b082857dfe1c to your computer and use it in GitHub Desktop.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; custom-set-*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(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.
'(ansi-color-faces-vector
[default default default italic underline success warning error])
'(ansi-color-names-vector
["#212526" "#ff4b4b" "#b4fa70" "#fce94f" "#729fcf" "#e090d7" "#8cc4ff" "#eeeeec"])
'(custom-enabled-themes (quote (wheatgrass)))
'(custom-safe-themes
(quote
("f0d8af755039aa25cd0792ace9002ba885fd14ac8e8807388ab00ec84c9497d7" "c86f868347919095aa44d2a6129dd714cbcf8feaa88ba954f636295b14ceff8f" default)))
'(show-paren-mode t)
'(tool-bar-mode nil)
'(transmission-host "192.168.1.23")
'(transmission-rpc-auth
(quote
(:username "transmission" :password "NOPE NOPE NOPE")))
'(show-trailing-whitespace t)
)
(custom-set-faces
;; custom-set-faces 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.
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; MELPA+ELPA package setup
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Package requires / system loads
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "~/.emacs.d/site-lisp/")
(require 'dired+)
(require 'web-mode)
(require 'coffee-mode)
(require 'python-mode)
(load "scribble.el" nil t t)
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Built-in configuration
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Sane backup file settings
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
;; Disable tabs
(setq-default indent-tabs-mode nil)
;; Font
(let ((my-font "Droid Sans Mono Slashed-11"))
(add-to-list 'default-frame-alist (cons 'font my-font))
(set-face-attribute 'default t :font my-font))
;; Enable word-wrap for org-mode.
(add-hook 'org-mode-hook (lambda ()
(setq word-wrap t)))
;; c-mode
(add-hook 'c-mode-hook (lambda ()
(setq indent-tabs-mode t)
(c-set-style "bsd")))
;; javascript-mode
(setq js-indent-level 2)
;; Suppress startup welcome message
(setq inhibit-startup-screen t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Package configuration
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; web-mode
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.jsx$" . web-mode))
(defadvice web-mode-highlight-part (around tweak-jsx activate)
(if (equal web-mode-content-type "jsx")
(let ((web-mode-enable-part-face nil))
ad-do-it)
ad-do-it))
(add-hook 'web-mode-hook (lambda ()
(setq web-mode-markup-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(setq web-mode-code-indent-offset 2)))
;; coffeescript
(setq coffee-tab-width 2)
;; enh-ruby-mode
(autoload 'enh-ruby-mode "enh-ruby-mode" "Major mode for ruby files" t)
(add-to-list 'auto-mode-alist '("\\.rb$" . enh-ruby-mode))
(add-to-list 'interpreter-mode-alist '("ruby" . enh-ruby-mode))
;; auctex
(add-hook 'TeX-mode-hook (lambda ()
(setq word-wrap t)))
;; python-mode
(add-hook 'python-mode-hook (lambda ()
(setq-local column-number-mode t)))
(require 'transmission)
(define-key transmission-mode-map (kbd "A")
(lambda ()
(interactive)
(transmission-add (read-string "Magnet URI: "))))
;; cyberpunk theme
(add-hook 'after-init-hook
(lambda () (load-theme 'cyberpunk t)))
(global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "C-x M-g") 'magit-dispatch-popup)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Custom interactive functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun revert-all-buffers ()
"Refreshes all open buffers from their respective files"
(interactive)
(let* ((list (buffer-list))
(buffer (car list)))
(while buffer
(when (and (buffer-file-name buffer)
(not (buffer-modified-p buffer)))
(set-buffer buffer)
(revert-buffer t t t))
(setq list (cdr list))
(setq buffer (car list))))
(message "Refreshed open files"))
(defun toggle-word-wrap ()
"Toggle word wrap"
(interactive)
(message (format
"Word wrap %s."
(if (setq word-wrap (not word-wrap))
"enabled"
"disabled"))))
(defun show-file-name ()
"Show the full path file name in the minibuffer."
(interactive)
(message (buffer-file-name)))
(defun todo ()
"Open the todo.org file"
(interactive)
(find-file "~/docs/orgs/todo.org"))
@maxywb
Copy link

maxywb commented Feb 10, 2016

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment