Svtter
9/5/2016 - 8:45 AM

emacs config

emacs config

(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.
 '(default ((t (:family "Consolas" :foundry "outline" :slant normal :weight normal :height 98 :width normal)))))

;; ----------------------------------------------------------------------
;; Default-dir
(cd "c:/Users/svtte")
(setq default-directory "c:/Users/svtte/" )
;; ----------------------------------------------------------------------


;; ----------------------------------------------------------------------
;; use proxy server
(when (>= emacs-major-version 24)
  (require 'package)
  (add-to-list
   'package-archives
   '("melpa" . "http://elpa.zilongshanren.com/melpa/")
   t)
  (package-initialize))

(setq package-archives '(("gnu"   . "http://elpa.zilongshanren.com/gnu/")
                         ("melpa" . "http://elpa.zilongshanren.com/melpa/")))

;; ----------------------------------------------------------------------
;; evil
(require 'evil)
(evil-mode 1)
(load-file "~/.emacs.d/evil.el") ;; must be pre


;; ----------------------------------------------------------------------
;; smex
;; M-x enhancement for Emacs.
(require 'smex) ; Not needed if you use package.el
(smex-initialize) ; Can be omitted. This might cause a (minimal) delay
                  ; when Smex is auto-initialized on its first run.

(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
;; This is your old M-x.
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)

;; ----------------------------------------------------------------------

;; company-mode
(add-hook 'after-init-hook 'global-company-mode)

;; ----------------------------------------------------------------------
;; windows-numbering
(setq window-numbering-assign-func
      (lambda () (when (equal (buffer-name) "*Calculator*") 9)))

;; ----------------------------------------------------------------------
;; powerline
(require 'powerline)
(powerline-default-theme)
;; ----------------------------------------------------------------------

;; git-gutter
(global-git-gutter-mode +1)
;; ----------------------------------------------------------------------

;; default setting
(load-theme 'monokai t)

;; remove nouse bar
(tool-bar-mode 0)  
(menu-bar-mode 0)  
(scroll-bar-mode 0)

;;去掉Emacs和gnus启动时的引导界面
(setq inhibit-startup-message t)
(setq gnus-inhibit-startup-message t)

;; ----------------------------------------------------------------------
;; multiple-cursors

(require 'multiple-cursors)
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)

;; company-web
;; (add-to-list 'company-backends 'company-web-html)
;; (add-to-list 'company-backends 'company-web-jade)
;; (add-to-list 'company-backends 'company-web-slim)

(require 'ido)
(ido-mode t)

;; full screen
(custom-set-variables
 '(initial-frame-alist (quote ((fullscreen . maximized)))))
;; line number
(global-linum-mode t)
;; evil leader
(require 'evil-leader)
(evil-escape-mode)

(global-evil-leader-mode)
(evil-leader/set-leader ",")
(evil-leader/set-key
  "d" 'ido-list-directory
  "e" 'ido-find-file
  "b" 'ido-switch-buffer
  "k" 'kill-buffer
  "ci" 'evilnc-comment-or-uncomment-lines
  "cl" 'evilnc-quick-comment-or-uncomment-to-the-line
  "ll" 'evilnc-quick-comment-or-uncomment-to-the-line
  "cc" 'evilnc-copy-and-comment-lines
  "cp" 'evilnc-comment-or-uncomment-paragraphs
  "cr" 'comment-or-uncomment-region
  "cv" 'evilnc-toggle-invert-comment-line-by-line
  "\\" 'evilnc-comment-operator ; if you prefer backslash key
)

(define-key evil-normal-state-map "c" nil)
(define-key evil-motion-state-map "cc" 'smex)

;; compile
(evil-leader/set-key-for-mode 'emacs-lisp-mode "b" 'byte-compile-file)

;; Esc key
(setq-default evil-escape-key-sequence "df")