From e996890bc24a00aec75008d4cf08267817a6c614 Mon Sep 17 00:00:00 2001 From: Ahir Reddy Date: Sun, 3 Aug 2014 23:27:39 -0700 Subject: [PATCH] JAVASCRIPT --- .emacs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.emacs b/.emacs index ef1af110e..ea7502f5d 100644 --- a/.emacs +++ b/.emacs @@ -2,7 +2,7 @@ (setq package-list '(auctex expand-region gist magit magithub markdown-mode paredit projectile python sass-mode rainbow-mode scss-mode solarized-theme anything volatile-highlights evil evil-leader scala-mode2 sbt-mode flx-ido - js2-mode js2-refactor tern tern-auto-complete)) + js2-mode js2-refactor tern tern-auto-complete yasnippet auto-complete)) ; list the repositories containing them (setq package-archives '(("elpa" . "http://tromey.com/elpa/") @@ -78,6 +78,22 @@ (setq js2-highlight-level 3) (add-to-list 'auto-mode-alist '("\\.json$" . js-mode)) +;;; yasnippet +;;; should be loaded before auto complete so that they can work together +(require 'yasnippet) +(yas-global-mode 1) + +;;; auto complete mod +;;; should be loaded after yasnippet so that they can work together +(require 'auto-complete-config) +(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict") +(ac-config-default) +;;; set the trigger key so that it can work together with yasnippet on tab key, +;;; if the word exists in yasnippet, pressing tab will cause yasnippet to +;;; activate, otherwise, auto-complete will +(ac-set-trigger-key "TAB") +(ac-set-trigger-key "") + ; Tern auto completion, install tern ; sudo npm install -g tern (add-hook 'js-mode-hook (lambda () (tern-mode t)))