Skip to content

Instantly share code, notes, and snippets.

@cwndrws
Created March 4, 2015 15:28
Show Gist options
  • Save cwndrws/6df2ccb34fff91997d21 to your computer and use it in GitHub Desktop.
Save cwndrws/6df2ccb34fff91997d21 to your computer and use it in GitHub Desktop.
(setq custom-file "~/.emacs-custom.el")
(load custom-file)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")
("e6h" . "http://www.e6h.org/packages/")))
(package-initialize)
(setq
backup-by-copying t ; don't clobber symlinks
backup-directory-alist
'(("." . "~/.saves")) ; don't litter my fs tree
delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t)
(global-linum-mode 1)
;; efff the chrome
(tool-bar-mode -1)
(scroll-bar-mode -1)
(menu-bar-mode -1)
;; load environment variables on mac
(when (memq window-system '(mac ns))
(exec-path-from-shell-initialize))
;; tramp
(require 'tramp)
;; theme load
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes.d")
;; colors
(load-theme 'smyx)
;;(load-theme 'solarized-dark t)
;; set text size of current buffer
;; Font size key bindings
(global-set-key (kbd "s-=") 'text-scale-increase)
(global-set-key (kbd "s--") 'text-scale-decrease)
;; set some path stuff
(setenv "GOROOT"
(concat
(getenv "HOME")
"/go1.4"))
(setenv "PATH"
(concat
(getenv "GOROOT")
"/bin" ":"
(getenv "PATH")))
(setenv "GOPATH"
(concat
(getenv "HOME")
"/src/go"))
(setenv "PATH"
(concat
(getenv "GOPATH")
"/bin" ":"
(getenv "PATH")))
(setq exec-path (append exec-path '((concat (getenv "GOPATH") "/bin"))))
;; go stuff
(add-to-list 'load-path "~/src/go/src/github.com/dougm/goflymake")
(require 'go-flymake)
(add-to-list 'load-path "~/src/go/src/github.com/dougm/goflymake")
(require 'go-flycheck)
(add-hook 'before-save-hook #'gofmt-before-save)
(add-hook 'go-mode-hook (lambda ()
(local-set-key (kbd "M-.") 'godef-jump)))
;; org-mode stuff
(require 'org)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)
(setq org-agenda-files '("~/Dropbox/org"))
(eval-after-load "org"
'(require 'ox-md nil t))
(global-unset-key (kbd "<left>"))
(global-unset-key (kbd "<right>"))
(global-unset-key (kbd "<up>"))
(global-unset-key (kbd "<down>"))
(global-unset-key (kbd "<C-left>"))
(global-unset-key (kbd "<C-right>"))
(global-unset-key (kbd "<C-up>"))
(global-unset-key (kbd "<C-down>"))
(global-unset-key (kbd "<M-left>"))
(global-unset-key (kbd "<M-right>"))
(global-unset-key (kbd "<M-up>"))
(global-unset-key (kbd "<M-down>"))
(define-key global-map (kbd "M-a") 'backward-paragraph)
(define-key global-map (kbd "M-e") 'forward-paragraph)
;; javascript stuff
(require 'flycheck)
(setq js-indent-level 2)
(add-hook 'js-mode-hook
(lambda () (flycheck-mode t)))
;; SLIME!!!
;; setup load-path and autoloads
(add-to-list 'load-path "~/src/lisp/slime")
(require 'slime-autoloads)
;; Set your lisp system and, optionally, some contribs
(setq inferior-lisp-program "/usr/local/bin/sbcl")
(setq slime-contribs '(slime-fancy))
;; paredit stuff
(autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
(add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
(add-hook 'ielm-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
(add-hook 'scheme-mode-hook #'enable-paredit-mode)
(add-hook 'slime-repl-mode-hook (lambda () (paredit-mode +1)))
;; Stop SLIME's REPL from grabbing DEL,
;; which is annoying when backspacing over a '('
(defun override-slime-repl-bindings-with-paredit ()
(define-key slime-repl-mode-map
(read-kbd-macro paredit-backward-delete-key) nil))
(add-hook 'slime-repl-mode-hook 'override-slime-repl-bindings-with-paredit)
(defvar electrify-return-match
"[\]}\)\"]"
"If this regexp matches the text after the cursor, do an \"electric\"
return.")
(defun electrify-return-if-match (arg)
"If the text after the cursor matches `electrify-return-match' then
open and indent an empty line between the cursor and the text. Move the
cursor to the new line."
(interactive "P")
(let ((case-fold-search nil))
(if (looking-at electrify-return-match)
(save-excursion (newline-and-indent)))
(newline arg)
(indent-according-to-mode)))
;; Using local-set-key in a mode-hook is a better idea.
(global-set-key (kbd "RET") 'electrify-return-if-match)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment