Skip to content

Instantly share code, notes, and snippets.

@halcyon
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save halcyon/b4fc418d7ebdcffd6b3c to your computer and use it in GitHub Desktop.

Select an option

Save halcyon/b4fc418d7ebdcffd6b3c to your computer and use it in GitHub Desktop.
;; emacs kicker --- kick start emacs setup
;; Copyright (C) 2010 Dimitri Fontaine
;;
;; Author: Dimitri Fontaine <[email protected]>
;; URL: https://github.com/dimitri/emacs-kicker
;; Created: 2011-04-15
;; Keywords: emacs setup el-get kick-start starter-kit
;; Licence: WTFPL, grab your copy here: http://sam.zoy.org/wtfpl/
;;
;; This file is NOT part of GNU Emacs.
(require 'cl) ; common lisp goodies, loop
(require 'package)
(setenv "PATH"
(concat "/usr/local/bin:"
(getenv "PATH")))
(setq exec-path
(cons "/usr/local/bin"
exec-path))
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(add-to-list 'package-archives
;; The 't' means to append, so that MELPA comes after the more
;; stable ELPA archive.
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
(unless (require 'el-get nil t)
(with-current-buffer
(url-retrieve-synchronously
"https://github.com/dimitri/el-get/raw/master/el-get-install.el")
(end-of-buffer)
(eval-print-last-sexp)))
;; (el-get-elpa-build-local-recipes)
;; (el-get-emacswiki-refresh)
;; now either el-get is `require'd already, or have been `load'ed by the
;; el-get installer.
;; set local recipes
(setq
el-get-sources
'((:name buffer-move ; have to add your own keys
:after (progn
(global-set-key (kbd "<C-S-up>") 'buf-move-up)
(global-set-key (kbd "<C-S-down>") 'buf-move-down)
(global-set-key (kbd "<C-S-left>") 'buf-move-left)
(global-set-key (kbd "<C-S-right>") 'buf-move-right)))
(:name smex ; a better (ido like) M-x
:after (progn
(setq smex-save-file "~/.emacs.d/.smex-items")
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)))
(:name magit ; git meet emacs, and a binding
:after (progn
(global-set-key (kbd "C-x C-z") 'magit-status)))))
;; now set our own packages
(setq
my:el-get-packages
'(el-get ; el-get is self-hosting
escreen ; screen for emacs, C-\ C-h
php-mode-improved ; if you're into php...
switch-window ; takes over C-x o
auto-complete ; complete as you type with overlays
yasnippet ; powerful snippet mode
slime
evil ; evil mode
evil-matchit
smooth-scrolling
guide-key
helm
haskell-mode
cider
projectile
smartparens
rainbow-delimiters
zencoding-mode ; http://www.emacswiki.org/emacs/ZenCoding
color-theme ; nice looking emacs
color-theme-solarized)) ; check out color-theme-solarized
;;
;; Some recipes require extra tools to be installed
;;
;; Note: el-get-install requires git, so we know we have at least that.
;;
(when (ignore-errors (el-get-executable-find "cvs"))
(add-to-list 'my:el-get-packages 'emacs-goodies-el)) ; the debian addons for emacs
(when (ignore-errors (el-get-executable-find "svn"))
(loop for p in '(psvn ; M-x svn-status
)
do (add-to-list 'my:el-get-packages p)))
(setq my:el-get-packages
(append
my:el-get-packages
(loop for src in el-get-sources collect (el-get-source-name src))))
;; install new packages and init already installed packages
(el-get 'sync my:el-get-packages)
;; on to the visual settings
(setq inhibit-splash-screen t) ; no splash screen, thanks
(line-number-mode 1) ; have line numbers and
(column-number-mode 1) ; column numbers in the mode line
(tool-bar-mode -1) ; no tool bar with icons
(scroll-bar-mode -1) ; no scroll bars
(unless (string-match "apple-darwin" system-configuration)
;; on mac, there's always a menu bar drown, don't have it empty
(menu-bar-mode -1))
;; choose your own fonts, in a system dependant way
(if (string-match "apple-darwin" system-configuration)
(set-face-font 'default "Monaco-13")
(set-face-font 'default "Menlo-14"))
;; (set-face-font 'default "Monospace-10")
(global-hl-line-mode) ; highlight current line
(global-linum-mode 1) ; add line numbers on the left
;; avoid compiz manager rendering bugs
(add-to-list 'default-frame-alist '(alpha . 100))
;; copy/paste with C-c and C-v and C-x, check out C-RET too
(cua-mode)
;; under mac, have Command as Meta and keep Option for localized input
(when (string-match "apple-darwin" system-configuration)
(setq mac-allow-anti-aliasing t)
(setq mac-command-modifier 'meta)
(setq mac-option-modifier 'none))
;; Use the clipboard, pretty please, so that copy/paste "works"
(setq x-select-enable-clipboard t)
;; Navigate windows with M-<arrows>
(windmove-default-keybindings 'meta)
(setq windmove-wrap-around t)
; winner-mode provides C-<left> to get back to previous window layout
(winner-mode 1)
;; whenever an external process changes a file underneath emacs, and there
;; was no unsaved changes in the corresponding buffer, just revert its
;; content to reflect what's on-disk.
(global-auto-revert-mode 1)
;; M-x shell is a nice shell interface to use, let's make it colorful. If
;; you need a terminal emulator rather than just a shell, consider M-x term
;; instead.
(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
;; If you do use M-x term, you will notice there's line mode that acts like
;; emacs buffers, and there's the default char mode that will send your
;; input char-by-char, so that curses application see each of your key
;; strokes.
;;
;; The default way to toggle between them is C-c C-j and C-c C-k, let's
;; better use just one key to do the same.
(require 'term)
(define-key term-raw-map (kbd "C-'") 'term-line-mode)
(define-key term-mode-map (kbd "C-'") 'term-char-mode)
;; Have C-y act as usual in term-mode, to avoid C-' C-y C-'
;; Well the real default would be C-c C-j C-y C-c C-k.
(define-key term-raw-map (kbd "C-y") 'term-paste)
;; use ido for minibuffer completion
(require 'ido)
(ido-mode t)
(setq ido-save-directory-list-file "~/.emacs.d/.ido.last")
(setq ido-enable-flex-matching t)
(setq ido-use-filename-at-point 'guess)
(setq ido-show-dot-for-dired t)
(setq ido-default-buffer-method 'selected-window)
;; default key to switch buffer is C-x b, but that's not easy enough
;;
;; when you do that, to kill emacs either close its frame from the window
;; manager or do M-x kill-emacs. Don't need a nice shortcut for a once a
;; week (or day) action.
(global-set-key (kbd "C-x C-b") 'ido-switch-buffer)
(global-set-key (kbd "C-x C-c") 'ido-switch-buffer)
(global-set-key (kbd "C-x B") 'ibuffer)
;; have vertical ido completion lists
(setq ido-decorations
'("\n-> " "" "\n " "\n ..." "[" "]"
" [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]"))
;; C-x C-j opens dired with the cursor right on the file you're editing
(require 'dired-x)
;; full screen
(defun fullscreen ()
(interactive)
(set-frame-parameter nil 'fullscreen
(if (frame-parameter nil 'fullscreen) nil 'fullboth)))
(global-set-key [f11] 'fullscreen)
;; preferences
(setq-default tab-width 2 indent-tabs-mode nil)
(define-key global-map (kbd "RET") 'newline-and-indent)
;;(require 'guide-key)
;;(setq guide-key/guide-key-sequence '("C-c p"))
;;(guide-key-mode 1)
(require 'color-theme-solarized)
(color-theme-solarized-light)
(setq backup-inhibited t)
(require 'smooth-scrolling)
(setq smooth-scroll-margin 5)
(setq scroll-conservatively 9999
scroll-preserve-screen-position t)
(require 'evil)
(evil-mode 1)
(add-to-list 'evil-emacs-state-modes 'haskell-interactive-mode)
(require 'evil-matchit)
(global-evil-matchit-mode 1)
(require 'projectile)
(projectile-global-mode)
;;(setq projectile-enable-caching t)
(require 'helm)
(require 'helm-grep)
(require 'helm-files)
(require 'helm-config)
(require 'rainbow-delimiters)
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
(require 'slime-autoloads)
;; Set your lisp system and, optionally, some contribs
(global-prettify-symbols-mode 1)
(setq inferior-lisp-program "sbcl")
(slime-setup '(slime-fancy))
(smartparens-global-mode t)
(add-hook 'haskell-mode-hook 'interactive-haskell-mode)
;;(setq haskell-program-name "/opt/ghc/7.8.3/bin/ghci")
(custom-set-variables
'(haskell-process-type 'cabal-repl))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment