安装Homebrew/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
卸载命令为:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
brew install emacs --with-cocoa
brew linkapps emacs
pip3 install ipython
配置python环境,elpy准备
必备python包
# Either of these
pip3 install rope
pip3 install jedi
# flake8 for code checks
pip3 install flake8
# and autopep8 for automatic PEP8 formatting
pip3 install autopep8
# and yapf for code formatting
pip3 install yapf
neotree
cd ~/.emacs.d/
mkdir emacs-plugins
cd emacs-pllugins
git clone https://github.com/jaypei/emacs-neotree.git neotree
vim ~/.emacs.d/init.el,并加入配置
;; init.el --- Emacs configuration
;;;;;;;;;;;;;;;;;;;;;;;;;;begin python;;;;;;;;;;;;;;;;;;;
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(require 'package)
(add-to-list 'package-archives
'("elpy" . "https://jorgenschaefer.github.io/packages/"))
(setq elpy-rpc-python-command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3")
(setq python-shell-interpreter "/Library/Frameworks/Python.framework/Versions/3.6/bin/ipython"
python-shell-interpreter-args "-i --simple-prompt")
(package-initialize)
(when (require 'elpy nil t)
(elpy-enable))
(setq elpy-rpc-backend "jedi")
;;;;;;;;;;;;;;;;;;;;;;;;;;end python;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin neotree;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/neotree")
(require 'neotree)
(global-set-key [f8] 'neotree-toggle)
;;;;;;;;;;;;;;;;;;;;;;;;;;end neotree;;;;;;;;;;;;;;;;;;;;;;;
;; init.el ends here
(custom-set-variables
;; custom-set-variables 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.
'(package-selected-packages (quote (## elpy))))
(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.
)
启动Emacs,等待一会,要点时间,需要下载插件,执行M-x package-install RET elpy RET安装elpy,M是alt键,RET是回车
neotree 简单教程
### Shortcut (Only in Neotree Buffer)
* `n` next line , `p` previous line。
* `SPC` or `RET` or `TAB` Open current item if it is a file. Fold/Unfold current item if it is a directory.
* `g` Refresh
* `A` Maximize/Minimize the [NeoTree](https://www.emacswiki.org/emacs/NeoTree) Window
* `H` Toggle display hidden files
* `C-c C-n` Create a file or create a directory if filename ends with a ‘/’
* `C-c C-d` Delete a file or a directory.
* `C-c C-r` Rename a file or a directory.
* `C-c C-c` Change the root directory.
* `C-c C-p` Copy a file or a directory.
### Commands(Global)
* `neotree-dir` show [NeoTree](https://www.emacswiki.org/emacs/NeoTree) window and specify a directory as its root
* `neotree-show` or `neotree` show [NeoTree](https://www.emacswiki.org/emacs/NeoTree) window using current directory as its root
* `neotree-hide` Hide [NeoTree](https://www.emacswiki.org/emacs/NeoTree) window
* `neotree-toggle` toggle/hide [NeoTree](https://www.emacswiki.org/emacs/NeoTree) window
* `neotree-find` show [NeoTree] (https://www.emacswiki.org/emacs/NeoTree) window and use the directory of current buffer as its root
### Command(Only in NeoTree Buffer)
* `neotree-enter` Open File / Unfold Directory
* `neotree-refresh` Refresh
* `neotree-stretch-toggle` Maximize / Minimize
* `neotree-change-root` Switch Root Directory
* `neotree-hidden-file-toggle` Toggle hidden files
* `neotree-rename-node` Rename a Node
* `neotree-delete-node` Delete a Node
* `neotree-create-node` Create a file or a directory (if filename ends with ‘/’)
emacs窗口操作
C-x 0关闭当前窗口
C-x 4 0关闭当前窗口和缓冲
C-x 0关闭当前窗口
C-x 2垂直划分窗口
f8 显示隐藏neotree
C-c C-c运行python文件
配置java环境
准备
cd ~/.emacs.d/emacs-plugins
git clone https://github.com/flycheck/flycheck.git
git clone https://github.com/emacsmirror/exec-path-from-shell.git
git clone https://github.com/skeeto/emacs-memoize.git
git clone https://github.com/magnars/dash.el.git
git clone https://github.com/jdee-emacs/jdee/
git clone https://github.com/jdee-emacs/jdee-server.git
git clone https://github.com/auto-complete/popup-el.git
git clone https://github.com/auto-complete/auto-complete.git
安装maven,jdee-server需要maven进行编译
cd jdee-server
mvn -Dmaven.test.skip=true package
此时jdee-server已经编译好了,把它从target目录拷贝出来cp ./target/jdee-bundle-1.1-SNAPSHOT.jar.jar ./
配置init.el
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin java config;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;start popup;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/popup-el")
(require 'popup)
;;;;;;;;;;;;;;;;;;;;;;;;;;end popup;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;start auto-complete;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/auto-complete")
(require 'auto-complete-config)
;;;;;;;;;;;;;;;;;;;;;;;;;;end auto-complete;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin flycheck;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/flycheck")
(global-flycheck-mode)
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/exec-path-from-shell")
(exec-path-from-shell-initialize)
;;;;;;;;;;;;;;;;;;;;;;;;;;end flycheck;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin memoize;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/emacs-memoize")
(require 'memoize)
;;;;;;;;;;;;;;;;;;;;;;;;;;end memoize;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin dash;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/dash.el")
(require 'dash)
;;;;;;;;;;;;;;;;;;;;;;;;;;end dash;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin jdee;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/jdee")
(require 'jdee)
(custom-set-variables
;;在这里设置你的jdk路径
;; custom-set-variables 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.
'(jde-jdk
(quote
("/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home")))
'(jde-jdk-registry
(quote
(("1.8" . "/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home"))))
'(jdee-jdk-registry
(quote
(("1.8" . "/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home"))))
'(jdee-server-dir "/Users/micocube/.emacs.d/emacs-plugins/jdee-server/")
'(package-selected-packages (quote (## elpy))))
;;;;;;;;;;;;;;;;;;;;;;;;;;end jdee;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;end java config;;;;;;;;;;;;;;;;;;;;;;
自动完成,Auto Java complete
cd ~/.emacs.d/emacs-plugins/
git clone https://github.com/emacs-java/auto-java-complete.git
cd auto-java-complete
bunzip2 java_base.tag.bz2
配置init.el
;;;;;;;;;;;;;;;;;;;;;;;;;;bengin auto-java-complete;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs- plugins/auto-java-complete")
(require 'ajc-java-complete-config)
(add-hook 'java-mode-hook 'ajc-java-complete-mode)
(add-hook 'find-file-hook 'ajc-4-jsp-find-file-hook)
;;;;;;;;;;;;;;;;;;;;;;;;;;bengin auto-java-complete;;;;;;;;;;;;
重启emacs,此时还没有自动提示,因为tag文件找不到,M - x customize-variable RET ajc-tag-file RET 在窗口的输入框中输入tag文件的路径,比如/Users/micocube/.emacs.d/emacs-plugins/auto-java-complete/java_base.tag,点击apply and save按钮,重启之后就有了
配置go环境,教程原址
安装前准备
安装golang
设置GOROOT和GOPATH:vim ~/.bash_profile,非常重要
#GO_HOME
GOROOT=/usr/local/go
export GOROOT
export PATH=$PATH:$GOROOT/bin
GOPATH=/Users/micocube/go
export PATH=$PATH:$GOPATH/bin
cd ~/.emacs.d/emacs-plugins
git clone https://github.com/dominikh/go-mode.el.gitgo-mode
go get github.com/rogpeppe/godef
go get -u github.com/dougm/goflymakego 代码检查
go get -u github.com/nsf/gocode这一步我是出错了的,执行之后代码从git上下载下来了,但是go install的时候出错:go install crypto/cipher: open /usr/local/go/pkg/darwin_amd64/crypto/cipher.a: permission denied,所以手动安装了一波,sudo go install github.com/nsf/gocode/搞定,使用gocode --help检查gocode是否安装完成,如果gocode没有安装,后面的配置都会失效
gocode set propose-builtins true
cp ${GOPATH}/src/github.com/dougm/goflymake ~/.emacs.d/emacs-plugins/
+cp ${GOPATH}/src/github.com/nsf/gocode ~/.emacs.d/emacs-plugins/
配置init.el
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin go config;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin go-mode;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/go-mode.el")
(require 'go-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;end go-mode;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin goflymake;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/goflymake")
(require 'go-flymake)
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/goflymake")
(require 'go-flycheck)
(add-hook 'flymake-mode-hook
(lambda()
(local-set-key (kbd "C-c C-e n") 'flymake-goto-next-error)))
(add-hook 'flymake-mode-hook
(lambda()
(local-set-key (kbd "C-c C-e p") 'flymake-goto-prev-error)))
(add-hook 'flymake-mode-hook
(lambda()
(local-set-key (kbd "C-c C-e m") 'flymake-popup-current-error-menu)))
;;;;;;;;;;;;;;;;;;;;;;;;;;end goflymake;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin gocode;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/gocode/emacs")
(require 'go-autocomplete)
(ac-config-default)
(add-hook 'before-save-hook #'gofmt-before-save)
;;;;;;;;;;;;;;;;;;;;;;;;;;end gocode;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;end go config;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
最终配置文件
;; init.el --- Emacs configuration
;;;;;;;;;;;;;;;;;;;;;;;;;;begin python;;;;;;;;;;;;;;;;;;;
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(require 'package)
(add-to-list 'package-archives
'("elpy" . "https://jorgenschaefer.github.io/packages/"))
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize)
(setq elpy-rpc-python-command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3")
(setq python-shell-interpreter "/Library/Frameworks/Python.framework/Versions/3.6/bin/ipython"
python-shell-interpreter-args "-i --simple-prompt")
(package-initialize)
(when (require 'elpy nil t)
(elpy-enable))
(setq elpy-rpc-backend "jedi")
(setq inhibit-startup-message t) ;; hide the startup message
(global-linum-mode t) ;; enable line numbers globally
;;;;;;;;;;;;;;;;;;;;;;;;;;end python;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin neotree;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/neotree")
(require 'neotree)
(global-set-key [f8] 'neotree-toggle)
(setq neo-smart-open t)
;;;;;;;;;;;;;;;;;;;;;;;;;;end neotree;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;start popup;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/popup-el")
(require 'popup)
;;;;;;;;;;;;;;;;;;;;;;;;;;end popup;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;end auto-complete;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/auto-complete")
(require 'auto-complete-config)
;;;;;;;;;;;;;;;;;;;;;;;;;;end auto-complete;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin java config;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin flycheck;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/flycheck")
(global-flycheck-mode)
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/exec-path-from-shell")
(exec-path-from-shell-initialize)
;;;;;;;;;;;;;;;;;;;;;;;;;;end flycheck;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin memoize;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/emacs-memoize")
(require 'memoize)
;;;;;;;;;;;;;;;;;;;;;;;;;;end memoize;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin dash;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/dash.el")
(require 'dash)
;;;;;;;;;;;;;;;;;;;;;;;;;;end dash;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin jdee;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/jdee")
(require 'jdee)
(custom-set-variables
;; custom-set-variables 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.
'(ajc-tag-file
"/Users/micocube/.emacs.d/emacs-plugins/auto-java-complete/java_base.tag")
'(jde-jdk
(quote
("/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home")))
'(jde-jdk-registry
(quote
(("1.8" . "/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home"))))
'(jdee-jdk-registry
(quote
(("1.8" . "/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home"))))
'(jdee-server-dir "/Users/micocube/.emacs.d/emacs-plugins/jdee-server/")
'(package-selected-packages (quote (## elpy))))
;;;;;;;;;;;;;;;;;;;;;;;;;;end jdee;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;bengin auto-java-complete;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/auto-java-complete")
(require 'ajc-java-complete-config)
(add-hook 'java-mode-hook 'ajc-java-complete-mode)
(add-hook 'find-file-hook 'ajc-4-jsp-find-file-hook)
;;;;;;;;;;;;;;;;;;;;;;;;;;bengin auto-java-complete;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;end java config;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin go config;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin go-mode;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/go-mode.el")
(require 'go-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;end go-mode;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin goflymake;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/goflymake")
(require 'go-flymake)
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/goflymake")
(require 'go-flycheck)
(add-hook 'flymake-mode-hook
(lambda()
(local-set-key (kbd "C-c C-e n") 'flymake-goto-next-error)))
(add-hook 'flymake-mode-hook
(lambda()
(local-set-key (kbd "C-c C-e p") 'flymake-goto-prev-error)))
(add-hook 'flymake-mode-hook
(lambda()
(local-set-key (kbd "C-c C-e m") 'flymake-popup-current-error-menu)))
;;;;;;;;;;;;;;;;;;;;;;;;;;end goflymake;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;begin gocode;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/gocode/emacs")
(require 'go-autocomplete)
(ac-config-default)
(add-hook 'before-save-hook #'gofmt-before-save)
;;;;;;;;;;;;;;;;;;;;;;;;;;end gocode;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;end go config;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;begin material-theme;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "/Users/micocube/.emacs.d/emacs-plugins/emacs-material-theme")
(require 'material-theme)
(load-theme 'material t)
;;;;;;;;;;;;;;;;;;;;;;;;;end material-theme;;;;;;;;;;;;;;;;;;;;
;; init.el ends here
(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.
)