使用emacs是因为有几个功能其他编辑器没有(或者不怎么好用)
- 全电脑任意切换文件,目录等(甚至可以用ssh,全网切换)
- evil模式,vim的主要功能全都有了,方便
- M-x 命令补全
- swiper插件迅速扫描,找文件,找字符串;速度一流
配置如下,~/.emacs.d/init.el
(package-initialize)
(setq
make-backup-files nil)
(fset 'yes-or-no-p 'y-or-n-p)
(global-auto-revert-mode t)
(setq tab-always-indent 'complete)
(blink-cursor-mode 0)
(load-theme 'dichromacy)
;; the package manager
(require 'package)
(setq
package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("org" . "http://orgmode.org/elpa/")
("melpa" . "http://melpa.org/packages/")
("melpa-stable" . "http://stable.melpa.org/packages/"))
package-archive-priorities '(("melpa-stable" . 1)));; the package manager
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package)
(add-to-list 'exec-path "/usr/local/bin")
(use-package evil
:ensure t
:config
(evil-mode 1)
(use-package evil-leader
:ensure t
:config
(progn
(global-evil-leader-mode)
(setq evil-leader/in-all-states t)
(evil-leader/set-leader ",")
(evil-leader/set-key
"co" 'evilnc-comment-or-uncomment-lines
"cc" 'evilnc-copy-and-comment-lines
"cp" 'evilnc-comment-or-uncomment-paragraphs)))
)
(use-package evil-nerd-commenter
:ensure t)
(use-package projectile
:demand
:init (setq projectile-use-git-grep t)
:config
(projectile-global-mode t)
(setq projectile-completion-system 'ivy)
:bind (("s-f" . projectile-find-file)
("s-F" . projectile-grep)))
(use-package company
:ensure t
:bind (("C-c /". company-complete))
:diminish company-mode
:commands company-mode
:init
(setq
company-dabbrev-ignore-case nil
company-dabbrev-code-ignore-case nil
company-dabbrev-downcase nil
company-idle-delay 0
company-minimum-prefix-length 4)
:config
;; disables TAB in company-mode, freeing it for yasnippet
(global-company-mode)
(define-key company-active-map [tab] nil)
(define-key company-active-map (kbd "TAB") nil))
(use-package smex
:ensure t
:config
(global-set-key (kbd "M-x") 'smex))
(use-package super-save
:ensure t
:config
;; (setq super-save-idle-duration 0.3)
(setq super-save-auto-save-when-idle t)
(super-save-mode +1))
(use-package youdao-dictionary
:ensure t
:init
(setq url-automatic-caching t)
:config
(global-set-key (kbd "C-c y") 'youdao-dictionary-search-at-point+))
(use-package counsel
:ensure t)
(use-package swiper
:ensure t
:config
(progn
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(global-set-key "\C-s" 'swiper)
(global-set-key (kbd "C-c C-r") 'ivy-resume)
(global-set-key (kbd "<f6>") 'ivy-resume)
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
(global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
(global-set-key (kbd "C-c g") 'counsel-git)
(global-set-key (kbd "C-c j") 'counsel-git-grep)
(global-set-key (kbd "C-c k") 'counsel-ag)
(global-set-key (kbd "C-x l") 'counsel-locate)
(global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
(define-key read-expression-map (kbd "C-r") 'counsel-expression-history)
(advice-add 'swiper :after #'recenter)))
(use-package scala-mode
:ensure t)
(use-package markdown-mode
:ensure t)
(use-package magit
:ensure t)
(use-package neotree
:ensure t)
(use-package exec-path-from-shell ;; otherwise "C-g k" not work
:ensure t
:config
(when (memq window-system '(mac ns))
(exec-path-from-shell-initialize)))
网友评论