Skip to content

Instantly share code, notes, and snippets.

@camhine
Last active January 3, 2016 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save camhine/8465055 to your computer and use it in GitHub Desktop.
Save camhine/8465055 to your computer and use it in GitHub Desktop.
;; Start in server mode
;; (server-start)
;;;;;;;;;;;;;;;;;;
;; Key Bindings ;;
;;;;;;;;;;;;;;;;;;
;; invoke M-x without Alt
(global-set-key "\C-x\C-m" 'execute-extended-command)
;; Prefer backword-kill-word over Backspace
(global-set-key "\C-w" 'backward-kill-word)
(global-set-key "\C-x\C-k" 'kill-region)
;; Macro to easily jump to a line number
(global-set-key "\C-cg" 'goto-line)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Variables Set within Emacs ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(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.
'(blink-cursor-mode nil)
'(column-number-mode t)
'(custom-safe-themes (quote ("4aee8551b53a43a883cb0b7f3255d6859d766b6c5e14bcb01bed572fcbef4328" "8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" default)))
'(package-enable-at-startup nil)
'(safe-local-variable-values (quote ((encoding . utf-8))))
'(tool-bar-mode nil))
(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.
)
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
;;;;;;;;;;;;;;;
;; Packaging ;;
;;;;;;;;;;;;;;;
(setq package-enable-at-startup nil)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
;; Call package-initialize explicitly so that packages can be
;; customized.
(package-initialize)
;;;;;;;;;;;;;
;; Visuals ;;
;;;;;;;;;;;;;
;; Set the font face (if window system)
(if window-system
(set-face-font 'default "Consolas-13") ;; "Inconsolata-12")
nil)
;; Theme
(load-theme 'solarized-dark t)
;; (load-theme 'solarized-light t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Misc. Package Customisation ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'exec-path "/usr/local/bin")
;; ido everywhere
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode 1)
;; Ispell is dead, long live Aspell
(setq-default ispell-program-name "aspell")
;; Use british english
(setq ispell-dictionary "british")
;; Personal dictionary location
(setq ispell-personal-dictionary "~/.dict")
;; tab width
(setq default-tab-width 2)
;; spaces not tabs
(setq-default indent-tabs-mode nil)
;; Calendar Settings
(setq european-calendar-style t)
(color-theme-initialize)
;; Move cursor by logical line, not visual line.
(setq line-move-visual nil)
;; (set-default 'truncate-lines t)
;; Make diredp use same buffer when opening oter directories
(toggle-diredp-find-file-reuse-dir 1)
;; show surrounding parenthesis
(show-paren-mode 1)
;; use ibuffer instead of list-buffers
(defalias 'list-buffers 'ibuffer)
;; ruby indentation within parens acts weird
(setq ruby-deep-indent-paren nil)
;; Put saves in a dedicated directory. Don't clutter up my dirs.
(setq backup-directory-alist `(("." . "~/.saves")))
(eval-after-load "ruby-mode"
'(add-hook 'ruby-mode-hook 'ruby-electric-mode))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Yank to OS X clipboard ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun copy-from-osx ()
(shell-command-to-string "pbpaste"))
(defun paste-to-osx (text &optional push)
(let ((process-connection-type nil))
(let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
(process-send-string proc text)
(process-send-eof proc))))
(setq interprogram-cut-function 'paste-to-osx)
(setq interprogram-paste-function 'copy-from-osx)
;;;;;;;;;;;;;;;
;; Ruby mode ;;
;;;;;;;;;;;;;;;
(add-to-list 'auto-mode-alist
'("\\.\\(?:gemspec\\|irbrc\\|gemrc\\|rake\\|rb\\|ru\\|thor\\)\\'" . ruby-mode))
(add-to-list 'auto-mode-alist
'("\\(Capfile\\|Gemfile\\(?:\\.[a-zA-Z0-9._-]+\\)?\\|[rR]akefile\\)\\'" . ruby-mode))
(add-hook 'ruby-mode-hook
(lambda ()
(define-key ruby-mode-map "{" nil)
(define-key ruby-mode-map "}" nil)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment