Skip to content

Instantly share code, notes, and snippets.

@chrisbarrett
Last active December 12, 2015 03:08
Show Gist options
  • Save chrisbarrett/4704610 to your computer and use it in GitHub Desktop.
Save chrisbarrett/4704610 to your computer and use it in GitHub Desktop.
;; Initialize packages.
(require 'package)
(dolist (source '(("melpa" . "http://melpa.milkbox.net/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")))
(add-to-list 'package-archives source))
(package-initialize)
(unless package-archive-contents
(package-refresh-contents))
(defun require-package (p)
(unless (package-installed-p p)
(package-install p))
(require p))
(require-package 'auto-complete)
(require-package 'yasnippet)
;; ------------------------------------------------------------------------------
;; Themeing
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
(load-theme 'Nico t)
(set-face-attribute 'default nil :font "DejaVu Sans Mono-11")
;; Default windows size
(add-to-list 'default-frame-alist '(height . 24))
(add-to-list 'default-frame-alist '(width . 80))
(global-linum-mode t)
(setq-default inhibit-startup-screen t)
(setq-default initial-scratch-message nil)
(show-paren-mode 1)
(setq ring-bell-function 'ignore)
(setq-default c-basic-offset 4)
;; ido-mode
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode 1)
;; yes or no becomes y or n
(defalias 'yes-or-no-p 'y-or-n-p)
;;yasnippet
(yas-global-mode 1)
;; auto-complete
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/elpa/auto-complete/dict")
(set-default 'ac-sources
'(ac-source-abbrev
ac-source-dictionary
ac-source-yasnippet
ac-source-words-in-buffer
ac-source-words-in-same-mode-buffers
ac-source-semantic))
(ac-config-default)
(dolist (m '(c-mode c++-mode java-mode))
(add-to-list 'ac-modes m))
(global-auto-complete-mode t)
@jjrussell
Copy link

Very cool. Thanks for the tips.

I'm not sure how you got this to work but (ac-config-default) calls (set-default 'ac-sources...) so if you call it after your set-default it clobbers the value you just set.

@prathamesh-sonpatki
Copy link

Cool :)

@CodeSammich
Copy link

Works great!

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