文档章节

我的emacs配置文件

quanwei9958
 quanwei9958
发布于 2016/12/09 14:03
字数 477
阅读 50
收藏 0

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

(defun require-package (package &optional min-version no-fresh)
  (if (package-installed-p package min-version)
      t
    (if (or (assoc package package-archive-contents) no-fresh)
	(package-install package)
      (progn
	(package-refresh-contents)
	(require-package package min-version t)))))
(package-initialize)

;; package install
(require-package 'smartparens)
(require-package 'helm-dash)
(require-package 'company)
(require-package 'dumb-jump)
(require-package 'web-mode)
(require-package 'emmet-mode)
(require-package 'moe-theme)
(require-package 'helm)
(require-package 'helm-ls-git)
(require-package 'magit)
(require-package 'mmm-mode)
(require-package 'js2-mode)
(require-package 'whitespace-cleanup-mode)
(require-package 'flycheck)
(require-package 'exec-path-from-shell)
(require-package 'find-file-in-project)
(require-package 'js-auto-beautify)
(require-package 'avy)
(require-package 'ag)
(require-package 'projectile)
(require-package 'company-tern)
(require-package 'json-mode)
(require-package 'js-doc)

;; global config

(require 'find-file-in-project)
(require 'projectile)
(setq projectile-enable-caching t)
(setq projectile-require-project-root nil)

(require 'whitespace-cleanup-mode)
(whitespace-cleanup-mode)

(require 'smartparens-config)
(smartparens-mode t)
(smartparens-strict-mode)

(require 'helm-dash)
(setq helm-dash-min-length 2)
(setq helm-dash-browser-funnc 'browse-url)
(setq helm-dash-common-docsets '("C++" "JavaScript" "HTML" "jQuery"))

(require 'company)
(require 'company-tern)
(add-hook 'after-init-hook 'global-company-mode)
(with-eval-after-load 'company
  (define-key company-active-map (kbd "M-n") nil)
  (define-key company-active-map (kbd "M-p") nil)
  (define-key company-active-map (kbd "C-n") #'company-select-next)
  (define-key company-active-map (kbd "<tab>") #'company-select-next)
  (define-key company-active-map (kbd "C-p") #'company-select-previous)
  (setq company-dabbrev-downcase nil)
  (add-to-list 'company-backends 'company-tern))

(require 'js2-mode)
(require 'js2-refactor)
(require 'web-mode)
(require 'emmet-mode)
(add-hook 'web-mode-hook 'emmet-mode)
(add-hook 'web-mode-hook #'js2-refactor-mode)
(add-hook 'web-mode-hook 'js-auto-beautify-mode)
(add-hook 'web-mode-hook (lambda ()
                           (define-key web-mode-map "\C-c i" 'js-doc-insert-function-doc)))

(require 'json-mode)
(add-hook 'json-mode-hook 'flycheck-mode)

(require 'mmm-mode)

(require 'dumb-jump)
(dumb-jump-mode)

(require 'moe-theme)
(setq moe-theme-highlight-buffer-id t)
(moe-theme-set-color 'cyan)
(moe-dark)

(require 'helm-config)
(helm-mode 1)
(define-key helm-find-files-map (kbd "TAB") 'helm-execute-persistent-action)
(define-key helm-read-file-map (kbd "TAB") 'helm-execute-persistent-action)

;;; web-mode
(setq web-mode-content-types-alist
      '(("json" . "\\.json")
	("jsx" . ".\\.js[x]?\\'")))
(defun my-web-mode-hook ()
  (setq web-mode-markup-indent-offset 2)
  (setq web-mode-css-indent-offset 2)
  (setq web-mode-code-indent-offset 2))
(add-hook 'web-mode-hook 'my-web-mode-hook)
(add-hook 'web-mode-hook 'smartparens-mode)

;;; react-mode
(setq emmet-expand-jsx-className? t)

;;; lint tool
(require 'flycheck)
(require 'exec-path-from-shell)
(setq-default flycheck-disabled-checkers
	      (append flycheck-disabled-checkers '(javascript-jshint)))
(add-hook 'web-mode-hook 'flycheck-mode)
(flycheck-add-mode 'javascript-eslint 'web-mode)
(setq-default flycheck-temp-prefix ".flycheck")
(setq-default flycheck-disable-checkers
	      (append flycheck-disabled-checkers '(json-jsonlist)))
(when (memq window-system '(mac ns))
  (exec-path-from-shell-initialize))

;; file association
(add-to-list 'auto-mode-alist '("\.jsx" . web-mode))
(add-to-list 'auto-mode-alist '("\.html" . web-mode))
(add-to-list 'auto-mode-alist '("\.css" .web-mode))
(add-to-list 'auto-mode-alist '("\.js" . web-mode))
(add-to-list 'auto-mode-alist '("\.json" . json-mode))

;; key binging
(global-set-key (kbd "C-c C-v q") 'helm-dash-at-point)
(global-set-key (kbd "C-c C-v a") 'helm-dash-activate-docset)
(global-set-key (kbd "C-j") 'emmet-expand-line)
(global-set-key (kbd "C-^") 'helm-ls-git-ls)
(global-set-key (kbd "C-c g s") 'magit-status)
(global-set-key (kbd "C-c g p u") 'magit-push-current)
(global-set-key (kbd "C-c g p l") 'magit-pull)
(global-set-key (kbd "C-c g l") 'magit-log)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
(global-set-key (kbd "M-1") 'avy-goto-char)
(global-set-key (kbd "M-2") 'avy-goto-char-2)
(global-set-key (kbd "M-l") 'avy-goto-line)
(global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c c") 'org-capture)
(global-set-key (kbd "C-x C-b") 'helm-buffers-list)
(global-set-key (kbd "C-c C-f") 'find-file-in-project)

(setq backup-by-copying t
      backup-directory-alist
      '(("." . "~/.saves"))
      delete-old-versions t
      kept-new-versions 6
      kept-old-versions 2
      version-control t)
;;; org-mode custom config
(setq org-clock-into-drawer t)
(setq org-agenda-include-diary t)

;;; emacs custom
(show-paren-mode 1)
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq js-indent-level 2)
(setq standard-indent 2)

(defun copy-from-osx ()
  (shell-command-to-string "pbpaste"))

(defun paste-to-osx (text &optional push)
  (let ((process-connection-type nil))
    (let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
      (process-send-string proc text)
      (process-send-eof proc))))

(setq interprogram-cut-function 'paste-to-osx)
(setq interprogram-paste-function 'copy-from-osx)




© 著作权归作者所有

共有 人打赏支持
上一篇: 关闭博客
下一篇: 陪伴式编辑器
quanwei9958

quanwei9958

粉丝 29
博文 79
码字总数 36250
作品 0
程序员
私信 提问
我的emacs 配置

其实和很多人的emacs配置文件一样,我的配置文件也是在网上来回copy过来的,不过大家都是在copy来copy去的,所以我就不在写参考自哪里了:) 我的emacs版本: [laolang@laolang ~]$ pacman -Q...

小代码2016
2015/10/12
690
0
Linux编程基础-emacs简单配置

最近笔者又回到了Linux~浪了一圈又回来了 不过emacs确实不错,看起来也高大上(哈哈),今天就把我的配置文件贴上吧 要修改.emacs配置文件的话,只需要在emacs界面中按住control+X,松开后再按Con...

不高不富不帅的陈政_
2015/08/26
0
0
EMACS下 弹出窗口式的 Auto-Complete 自动补全工具简单介绍

EMACS下 弹出窗口式的 Auto-Complete 自动补全工具简单介绍 auto-complete 是一个很不错的自动补全工具,弹出窗口显示补全列表,比较不错的是自定义的函数,只要在这个编辑缓冲区出现过短语,...

FreeBlues
2012/11/16
0
0
Windows上安装Spacemacs

emacs安装 下载地址emacs 安装比较简单,解压后执行binaddpm.exe即可 emacs配置 emacs的默认配置文件路径和.emacs.d文件夹都是在Windows主目录下的 C:UsersAdministratorAppDataRoaming 如果...

yxmsw2007
09/24
0
0
将Emacs配置成一个C/C++的IDE编程环境

1.写在前面 Linux下的编程,业界多数人士并不喜欢,尤其是习惯了在windows下编程的程序员,认为windows的IDE各种好,而linux下没有一个好 的IDE ,估计很多人就是卡在这个门槛上了(PS:听说...

鉴客
2012/06/06
37.2K
13

没有更多内容

加载失败,请刷新页面

加载更多

Netty 备录 (一)

入职新公司不久,修修补补1个月的bug,来了点实战性的技术---基于netty即时通信 还好之前对socket有所使用及了解,入手netty应该不是很难吧,好吧,的确有点难,刚看这玩意的时候,可能都不知道哪里...

_大侠__
昨天
4
0
Django简单介绍和用户访问流程

Python下有许多款不同的 Web 框架。Django是重量级选手中最有代表性的一位。许多成功的网站和APP都基于Django。 Django是一个开放源代码的Web应用框架,由Python写成。 Django遵守BSD版权,初...

枫叶云
昨天
7
0
EOS错误代码及中文释义

本文集汇总了EOS区块链常见错误代码及其含义,完整错误代码集请查看 EOS错误代码集 - 汇智网 EOS错误代码列表如下, <table class="table table-striped"> <thead> <tr><th>错误代码</th><t......

汇智网教程
昨天
2
0
Spring Cloud Stream消费失败后的处理策略(四):重新入队(RabbitMQ)

应用场景 之前我们已经通过《Spring Cloud Stream消费失败后的处理策略(一):自动重试》一文介绍了Spring Cloud Stream默认的消息重试功能。本文将介绍RabbitMQ的binder提供的另外一种重试...

程序猿DD
昨天
4
0
kiss原则

KISS 原则是用户体验的高层境界,简单地理解这句话,就是要把一个产品做得连白痴都会用,因而也被称为“懒人原则”。换句话说来,”简单就是美“。KISS 原则源于 David Mamet(大卫马梅)的电...

NB-One
昨天
14
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部