文档章节

我的emacs配置文件

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

精选30+云产品,助力企业轻松上云!>>>


;; 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
1K
0
CentOS安装EMACS文件夹树型图插件与颜色插件

我的EMACS是CentOS7自带的,版本号24.3。 依照https://www.emacswiki.org/emacs/SrSpeedbar的方法需要寻找load-path。 load-path按照https://www.emacswiki.org/emacs/LoadPath的描述并没有顺......

临江仙卜算子
2018/03/27
26
0
EMACS下 弹出窗口式的 Auto-Complete 自动补全工具简单介绍

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

FreeBlues
2012/11/16
1W
0
Linux编程基础-emacs简单配置

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

不高不富不帅的陈政_
2015/08/26
399
0
Windows上安装Spacemacs

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

yxmsw2007
2018/09/24
751
0

没有更多内容

加载失败,请刷新页面

加载更多

设计模式(6) 适配器模式

结构型模式 适配器模式 类适配器和对象适配器 结构型模式 结构型模式的重点在于如何通过灵活的体系组织不同的对象,并在此基础上完成更为复杂的类型(或者类型系统),而参与组合的各类型之间...

zhixin9001
12分钟前
11
0
《Kubernetes设计与实现》DaemonSet概述

TODO

恋恋美食
17分钟前
11
0
在打印预览模式下使用Chrome的Element Inspector? - Using Chrome's Element Inspector in Print Preview Mode?

问题: I am working on developing a website and need to work on the print view. 我正在开发一个网站,需要处理打印视图。 Typically when I have layout issues I use Chrome's Element......

javail
21分钟前
22
0
性能测试神器 wrk 使用教程

原文连接:https://blog.fengjx.com/wrk/ wrk 是一个类似 ab(apache bench)、jmeter 的压力测试工具,底层基于 epoll 和 kqueue 实现,能充分利用服务器 cpu 资源,降低测试工具本身性能开销...

ws-小铁匠
31分钟前
18
0
Pandas 秘籍·翻译完成

协议:CC BY-NC-SA 4.0 欢迎任何人参与和完善:一个人可以走的很快,但是一群人却可以走的更远。 在线阅读 ApacheCN 面试求职交流群 724187166 ApacheCN 学习资源 目录 Pandas 秘籍 零、前言...

布客飞龙
38分钟前
24
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部