From df73585ccc6532b6f22ee72276e14e7d078e73fb Mon Sep 17 00:00:00 2001 From: crossorbit Date: Tue, 10 Jan 2017 13:39:45 +0800 Subject: [PATCH] Modify package manager to cask --- .gitignore | 1 + emacs.d/Cask | 119 +++++++++++++ emacs.d/lisp/custom.el | 2 +- emacs.d/lisp/init-dev.el | 43 ++--- emacs.d/lisp/init-package.el | 322 ++++++++++++++++------------------- emacs.d/lisp/init-theme.el | 28 ++- setup.sh | 20 +++ 7 files changed, 326 insertions(+), 209 deletions(-) create mode 100644 .gitignore create mode 100644 emacs.d/Cask create mode 100644 setup.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7bcdc57 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*/.cask diff --git a/emacs.d/Cask b/emacs.d/Cask new file mode 100644 index 0000000..e3a4de9 --- /dev/null +++ b/emacs.d/Cask @@ -0,0 +1,119 @@ +;; 源定义 +(source "gnu" "http://elpa.emacs-china.org/gnu/") +(source "melpa" "http://elpa.emacs-china.org/melpa/") +(source "org" "http://epla.emacs-china.org/org/") + +;; 包管理 +(depends-on "cask") +(depends-on "use-package") + +;; 快捷键 +(depends-on "bind-key") + +;; 界面 +(depends-on "gruvbox-theme") +;; 缩进 +(depends-on "indent-guide") +(depends-on "aggressive-indent") +;; 图标 +(depends-on "all-the-icons") +(depends-on "mode-icons") +;; 窗口操作 +(depends-on "popwin") +;; 首页 +(depends-on "init-open-recentf") +;; 高亮当前行和列 +(depends-on "crosshairs") + +;; 按键提示 +(depends-on "which-key") +;; 文件列表 +(depends-on "neotree") +;; 标签页 +(depends-on "tabbar") +;; 自动保存 +(depends-on "super-save") +;; bookmarks +(depends-on "bm") +;; 目录增强 +(depends-on "dired+") +(depends-on "direx") +;; 打开外部应用 +(depends-on "crux") +;; undo +(depends-on "undo-tree") +;; exec form path +(depends-on "exec-path-from-shell") + +;; editorconfig +(depends-on "editorconfig") +;; 扩展选择区域 +(depends-on "expand-region") +;; 自动添加匹配括号 +(depends-on "smartparens") +;; 高亮括号 +(depends-on "highlight-parentheses") +;;多光标 +(depends-on "iedit") + + +;;快速操作 +(depends-on "swiper") +(depends-on "counsel") +;; (if (eq system-type 'darwin) + (depends-on "counsel-osx-app") ;;) + +;; 搜索 +(depends-on "fzf") +(depends-on "avy") +(depends-on "ag") +(depends-on "ace-jump-mode") + +;; 开发 +;; 智能提示 +(depends-on "company") +(depends-on "company-ycmd") +(depends-on "company-web") +(depends-on "company-go") +(depends-on "company-c-headers") +;; 代码帮助 +;; (if (eq system-type 'darwin) + (depends-on "dash-at-point") +;; (depends-on "zeal-at-point")) + +;; 代码片段补全 +(depends-on "yasnippet") +;;代码跳转 +(depends-on "ggtags") +(depends-on "xcscope") + +;; git +(depends-on "magit") +(depends-on "git-gutter") + +;; 代码检查 +(depends-on "flycheck") +(depends-on "flycheck-cask") +(depends-on "flycheck-ycmd") +;; google +(depends-on "flycheck-google-cpplint") +(depends-on "google-c-style") + +;; 项目管理 +(depends-on "projectile") + +;; python +(depends-on "elpy") +(depends-on "anaconda-mode") + +;; web +(depends-on "js2-mode") +(depends-on "web-mode") +(depends-on "emmet-mode") + +;; markdown +(depends-on "markdown-mode") + +;; go +(depends-on "go-mode") +(depends-on "company-go") diff --git a/emacs.d/lisp/custom.el b/emacs.d/lisp/custom.el index 893dbf1..af46b25 100644 --- a/emacs.d/lisp/custom.el +++ b/emacs.d/lisp/custom.el @@ -13,7 +13,7 @@ '(nil nil t) '(package-selected-packages (quote - (gruvbox-theme dashboard counsel-gtags fzf py-autopep8 counsel counsel-osx-app counsel-projectile swiper crosshairs bm init-open-recentf mode-icons all-the-icons xcscope window-numbering which-key web-mode tabbar super-save smartparens popwin popup neotree molokai-theme markdown-mode magit js2-mode indent-guide iedit highlight-parentheses google-c-style git-gutter ggtags flycheck-ycmd flycheck-google-cpplint expand-region exec-path-from-shell evil emmet-mode elpy editorconfig ecb dracula-theme direx dired+ dash-at-point crux company-ycmd company-web company-quickhelp company-go company-c-headers command-log-mode cmake-mode avy anaconda-mode aggressive-indent ag ace-jump-mode)))) + (use-package gruvbox-theme dashboard counsel-gtags fzf py-autopep8 counsel counsel-osx-app counsel-projectile swiper crosshairs bm init-open-recentf mode-icons all-the-icons xcscope window-numbering which-key web-mode tabbar super-save smartparens popwin popup neotree molokai-theme markdown-mode magit js2-mode indent-guide iedit highlight-parentheses google-c-style git-gutter ggtags flycheck-ycmd flycheck-google-cpplint expand-region exec-path-from-shell evil emmet-mode elpy editorconfig ecb dracula-theme direx dired+ dash-at-point crux company-ycmd company-web company-quickhelp company-go company-c-headers command-log-mode cmake-mode avy anaconda-mode aggressive-indent ag ace-jump-mode)))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. diff --git a/emacs.d/lisp/init-dev.el b/emacs.d/lisp/init-dev.el index 15888e6..ad78c45 100644 --- a/emacs.d/lisp/init-dev.el +++ b/emacs.d/lisp/init-dev.el @@ -5,36 +5,41 @@ (setq-default tab-width 4) (setq-default indent-tabs-mode nil) -(require 'yasnippet) -(yas-global-mode t) -(setq-default tab-width 4) -(setq-default indent-tabs-mode nil) +(use-package yasnippet + :config + (yas-global-mode t)) + +;; (setq-default tab-width 4) +;; (setq-default indent-tabs-mode nil) ;; editorconfig -(require 'editorconfig) -(editorconfig-mode t) +(use-package editorconfig + :config + (editorconfig-mode t)) ;; $PATH -(require 'exec-path-from-shell) -(exec-path-from-shell-initialize) +(use-package exec-path-from-shell + :config + (exec-path-from-shell-initialize)) ;; 缩进线 -(indent-guide-global-mode) - -(require 'git-gutter) -(global-git-gutter-mode t) -(git-gutter:linum-setup) +;; (indent-guide-global-mode) -;; (require 'projectile) -;; (projectile-global-mode) +(use-package git-gutter + :config + (global-git-gutter-mode t) + (git-gutter:linum-setup)) -(cscope-minor-mode t) +(use-package cscope + :config + (cscope-minor-mode t)) (ggtags-mode t) ;;(ggtags-global-mode t) -(require 'flycheck) -(global-flycheck-mode t) -(flycheck-ycmd-setup) +(use-package flycheck + :config + (global-flycheck-mode t) + (flycheck-ycmd-setup)) ;;(require 'company) ;;(require 'company-clang) diff --git a/emacs.d/lisp/init-package.el b/emacs.d/lisp/init-package.el index 3d31577..915d161 100644 --- a/emacs.d/lisp/init-package.el +++ b/emacs.d/lisp/init-package.el @@ -8,183 +8,161 @@ ;;{{VERSION}} ;;设置插件服务器 -(require 'package) +(if (eq system-type 'darwin) + (require 'cask) + (require 'cask "~/.cask/cask.el")) +(cask-initialize) + +;; (require 'package) ;; (add-to-list 'package-archives '("marmalade" . "http://marmalade-rpo.org/packages/")) ;; (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) ;; (add-to-list 'package-archives '("orgmode" . "http://orgmode.org/elpa/")) -(setq package-archives - '(("gnu-cn" . "http://elpa.emacs-china.org/gnu/") - ("org-cn" . "http://elpa.emacs-china.org/org/") - ("melpa-cn" . "http://elpa.emacs-china.org/melpa/"))) +;; (setq package-archives +;; '(("gnu-cn" . "http://elpa.emacs-china.org/gnu/") +;; ("org-cn" . "http://elpa.emacs-china.org/org/") +;; ("melpa-cn" . "http://elpa.emacs-china.org/melpa/"))) ;; (add-to-list 'package-archives '("popkit" . "http://elpa.popkit.org/packages/")) ;; (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) -(setq package-enable-at-startup nil) -(package-initialize) - -(require 'cl-lib) - -(defvar *install-packages* '( - tabvar - popwin - dracula-theme - company - company-ycmd - which-key - editorconfig - ) - "Default package") - -(defun cross/packages-installed-p () - - (loop for pkg in *install-packages* - when (not (package-installed-p pkg)) do (return nil) - finally (return t))) - -;;(unless (cross/packages-installed-p) -;; (message "%s" "Refreshing package database...") -;; (package-refresh-contents) -;; (dolist (pkg *install-packages*) -;; (when (not (package-installed-p pkg)) -;; (package-install pkg)))) - -;;(mapc #'(lambda (package) -;; (unless (package-install-p package) -;; (package-install package)) -;; *install-packages*)) - -(defun install-custom-package () - - "安装插件" - (interactive) - - (package-list-packages) - ;;(package-menu-mark-upgrades) - - ;;查找我用的包有没有安装 - - ;; molokai 配色 - (package-install 'molokai-theme) - (package-install 'dracula-theme) - (package-install 'druvbox-theme) - ;; powerline - ;; (package-install 'spaceline) - ;; 图标 - (package-install 'all-the-icons) - (package-install 'mode-icons) - ;; 首页 - ;;(package-install 'init-open-recentf) - (package-install 'dashboard) - ;; 高亮当前行和列 - (package-install 'crosshairs) - ;; 文件列表 - (package-install 'neotree) - ;; 标签页 - ;;(package-install 'tabbar) - ;; 自动保存 - (package-install 'super-save) - ;; 窗口操作 - (package-install 'popwin) - ;; 窗口跳转 - (package-install 'window-numbering) - ;; bookmarks - (package-install 'bm) - ;; 目录增强 - (package-install 'dired+) - ;; 打开当前文件目录 - (package-install 'direx) - ;; 打开外部应用 - (package-install 'crux) - ;; undo - (package-install 'undo-tree) - ;; editorconfig - (package-install 'editorconfig) - ;; exec form path - (package-install 'exec-path-from-shell) - - ;;快速操作 - ;;(package-install 'helm) - (package-install 'swiper) - (package-install 'counsel) - (if (eq system-type 'darwin) - (package-install 'counsel-osx-app)) - ;; 搜索 - (package-install 'fzf) - ;;(package-install 'ecb) - ;;(package-install 'smex) - ;; vim 模式 - ;;(package-install 'evil) - ;; 按键提示 - (package-install 'which-key) - - ;; 代码片段补全 - (package-install 'yasnippet) - ;; 智能提示 - (package-install 'company) - (package-install 'company-ycmd) - (package-install 'company-web) - (package-install 'company-c-headers) - - ;; 项目管理 - (package-install 'projectile) - ;; 代码帮助 - (if (eq system-type 'darwin) - (package-install 'dash-at-point) - (package-install 'zeal-at-point)) - ;;代码跳转 - (package-install 'xcscope) - (package-install 'ggtags) - ;;代码检查 - (package-install 'flycheck) - (package-install 'flycheck-ycmd) - (package-install 'flycheck-google-cpplint) - ;;google c style - (package-install 'google-c-style) - ;;git - (package-install 'magit) - (package-install 'git-gutter) - - ;; 自动添加匹配括号 - (package-install 'smartparens) - ;; 高亮括号 - (package-install 'highlight-parentheses) - ;; 缩进线 - (package-install 'indent-guide) - ;; 缩进对齐 - (package-install 'aggressive-indent) - ;; 扩展选择区域 - (package-install 'expand-region) - - ;;搜索 - (package-install 'avy) - (package-install 'ag) - (package-install 'ace-jump-mode) - ;;(package-install 'helm-ag) - - ;;python - (package-install 'anaconda-mode) - (package-install 'elpy) - ;;markdown - (package-install 'markdown-mode) - ;;web - (package-install 'web-mode) - (package-install 'emmet-mode) - ;;js - (package-install 'js2-mode) - ;;go - (package-install 'go-mode) - (package-install 'company-go) - - ;;多光标 - (package-install 'iedit) - - ;;中文输入法 - ;;(package-install 'chinese-pyim) - - ;;彩虹猫 - ;;(package-install 'nyan-mode) - - (kill-emacs) - ) +;; (setq package-enable-at-startup nil) +;; (package-initialize) + +;; (require 'cl-lib) + +;; (defun install-custom-package () + +;; "安装插件" +;; (interactive) + +;; (package-list-packages) +;; ;;(package-menu-mark-upgrades) + +;; ;;查找我用的包有没有安装 +;; (package-install 'cask) +;; (package-install 'use-package) + +;; ;; molokai 配色 +;; (package-install 'molokai-theme) +;; (package-install 'dracula-theme) +;; (package-install 'gruvbox-theme) +;; ;; powerline +;; ;; (package-install 'spaceline) +;; ;; 图标 +;; (package-install 'all-the-icons) +;; (package-install 'mode-icons) +;; ;; 首页 +;; (package-install 'init-open-recentf) +;; (package-install 'dashboard) +;; ;; 高亮当前行和列 +;; (package-install 'crosshairs) +;; ;; 文件列表 +;; (package-install 'neotree) +;; ;; 标签页 +;; ;;(package-install 'tabbar) +;; ;; 自动保存 +;; (package-install 'super-save) +;; ;; 窗口操作 +;; (package-install 'popwin) +;; ;; 窗口跳转 +;; (package-install 'window-numbering) +;; ;; bookmarks +;; (package-install 'bm) +;; ;; 目录增强 +;; (package-install 'dired+) +;; ;; 打开当前文件目录 +;; (package-install 'direx) +;; ;; 打开外部应用 +;; (package-install 'crux) +;; ;; undo +;; (package-install 'undo-tree) +;; ;; editorconfig +;; (package-install 'editorconfig) +;; ;; exec form path +;; (package-install 'exec-path-from-shell) + +;; ;;快速操作 +;; ;;(package-install 'helm) +;; (package-install 'swiper) +;; (package-install 'counsel) +;; (if (eq system-type 'darwin) +;; (package-install 'counsel-osx-app)) +;; ;; 搜索 +;; (package-install 'fzf) +;; ;;(package-install 'ecb) +;; ;;(package-install 'smex) +;; ;; vim 模式 +;; ;;(package-install 'evil) +;; ;; 按键提示 +;; (package-install 'which-key) + +;; ;; 代码片段补全 +;; (package-install 'yasnippet) +;; ;; 智能提示 +;; (package-install 'company) +;; (package-install 'company-ycmd) +;; (package-install 'company-web) +;; (package-install 'company-c-headers) + +;; ;; 项目管理 +;; (package-install 'projectile) +;; ;; 代码帮助 +;; (if (eq system-type 'darwin) +;; (package-install 'dash-at-point) +;; (package-install 'zeal-at-point)) +;; ;;代码跳转 +;; (package-install 'xcscope) +;; (package-install 'ggtags) +;; ;;代码检查 +;; (package-install 'flycheck) +;; (package-install 'flycheck-ycmd) +;; (package-install 'flycheck-google-cpplint) +;; ;;google c style +;; (package-install 'google-c-style) +;; ;;git +;; (package-install 'magit) +;; (package-install 'git-gutter) + +;; ;; 自动添加匹配括号 +;; (package-install 'smartparens) +;; ;; 高亮括号 +;; (package-install 'highlight-parentheses) +;; ;; 缩进线 +;; (package-install 'indent-guide) +;; ;; 缩进对齐 +;; (package-install 'aggressive-indent) +;; ;; 扩展选择区域 +;; (package-install 'expand-region) + +;; ;;搜索 +;; (package-install 'avy) +;; (package-install 'ag) +;; (package-install 'ace-jump-mode) +;; ;;(package-install 'helm-ag) + +;; ;;python +;; (package-install 'anaconda-mode) +;; (package-install 'elpy) +;; ;;markdown +;; (package-install 'markdown-mode) +;; ;;web +;; (package-install 'web-mode) +;; (package-install 'emmet-mode) +;; ;;js +;; (package-install 'js2-mode) +;; ;;go +;; (package-install 'go-mode) +;; (package-install 'company-go) + +;; ;;多光标 +;; (package-install 'iedit) + +;; ;;中文输入法 +;; ;;(package-install 'chinese-pyim) + +;; ;;彩虹猫 +;; ;;(package-install 'nyan-mode) + +;; (kill-emacs) +;; ) (provide 'init-package) diff --git a/emacs.d/lisp/init-theme.el b/emacs.d/lisp/init-theme.el index fe04231..71ff798 100644 --- a/emacs.d/lisp/init-theme.el +++ b/emacs.d/lisp/init-theme.el @@ -10,27 +10,21 @@ ;;(setq speedbar-show-unknown-files t) ;;(setq speedbar-use-images nil) -(require 'highlight-parentheses) +;; (require 'highlight-parentheses) +(use-package highlight-parentheses + :config + (global-highlight-parentheses-mode t)) -(global-highlight-parentheses-mode t) +(use-package all-the-icons + :config + (mode-icons-mode t)) -;; (global-hl-line-mode t) +(use-package popwin + :config + (popwin-mode t)) -;; (crosshairs-mode t) +(use-package gruvbox-theme) -(require 'all-the-icons) -(mode-icons-mode t) - -;;(nyan-mode t) - -(require 'popwin) -(popwin-mode t) - -;; (if window-system -;; (require 'dracula-theme) -;; (require 'molokai-theme)) - -(require 'gruvbox-theme) ;; 暗色主题下光标颜色设置一下 (set-cursor-color "White") diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..19541b1 --- /dev/null +++ b/setup.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# author: cnsworder +# email: cnsworder@gmail.com + + +set -e + +if which brew; then + brew install cask +elif [ ! -d ~/.cask ]; then + git clone https://github.com/cask/cask.git ~/.cask +fi + +if [ ! -d ~/.emacs.d ]; then + ln -s `pwd`/emacs.d ~/.emacs.d +fi + +cd ~/.emacs.d +cask install +echo "Cask installed package..."