完成第二章时候


;; 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.
(package-initialize)

;; 关闭修改备份功能
(setq make-backup-files 0)

;;绑定F1为inil.el的快捷键
(defun open-init-file()
  (interactive)
  (find-file "~/.emacs.d/init.el"))
(global-set-key (kbd "<f1>") 'open-init-file)

(setq package-archives '(("gnu"   . "http://elpa.emacs-china.org/gnu/")
			 ("melpa" . "http://elpa.emacs-china.org/melpa/")))
(require 'cl)
(defvar my/packages '(
		      company
		      monokai-theme
		      hungry-delete
		      swiper
		      counsel
		      smartparens
		      js2-mode
         		      ) "Default packages")
(setq package-selected-packages my/packages)
(defun my/packages-installed-p ()
  (loop for pkg in my/packages
	when (not (package-installed-p pkg)) do (return nil)
	finally (return t)))

(unless (my/packages-installed-p)
  (message "%s" "Refreshing package database...")
  (package-refresh-contents)
  (dolist (pkg my/packages)
    (when (not (package-installed-p pkg))
      (package-install pkg))))

;; (add-to-list 'my/packages 'monokai-theme)
(load-theme 'monokai 1)

;; ----------------------------- melpa -----------------------------------

;; 备注问题&提示
;; M-x info 学习lisp


;; 显示时间
(display-time-mode 1)
;; 显示24小时制
(setq display-time-24hr-format 1)
;; 显示日期
(setq display-time-day-and-date 1)

;; 关闭保存备份
(setq make-backup-files 0)

;; 高亮当前行
(global-hl-line-mode 1)
 
;; 取消工具栏
(tool-bar-mode 0)
 
;; 取消菜单栏
;; (menu-bar-mode 0)
 
;; 取消侧面滚轮
(scroll-bar-mode 0)
 
;; 关闭开机动画
(setq inhibit-splash-screen 1)
 
;; 打开行号
(global-linum-mode 1)

;; 绑定f4关不窗口
(global-set-key (kbd "<f4>") 'delete-window)

;; 改变光标样式
(setq-default cursor-type 'bar)

;; 启动括号自动匹配
(add-hook 'emacs-lisp-mode-hook 'show-paren-mode)

(global-set-key (kbd "C-h C-f") 'find-function)
(global-set-key (kbd "C-h C-v") 'find-variable)
(global-set-key (kbd "C-h C-k") 'find-function-on-key)


;; 绑定全部运行当前buffer
;; (global-set-key (kbd "<f5>") 'eval-buffer)

(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.
 '(company-idle-delay 0.1)
 '(company-minimum-prefix-length 1)
 '(custom-safe-themes
   (quote
    ("f0c98535db38af17e81e491a77251e198241346306a90c25eb982b57e687d7c0" default)))
 '(display-time-mode t)
 '(package-selected-packages (quote (company)))
 '(show-paren-mode t)
 '(tool-bar-mode nil))
(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.
 '(default ((t (:family "新宋体" :foundry "outline" :slant normal :weight normal :height 120 :width normal)))))
;; 开启company补全
(global-company-mode 1)

(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-item 10)
;; 这个快捷键绑定可以用之后的插件 counsel 代替
 (global-set-key (kbd "C-x C-r") 'recentf-open-files)

;; 替换光标选择文本
(delete-selection-mode 1)

;; 启动 hungry-delete
(global-hungry-delete-mode 1)

(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 "C-h f") 'counsel-describe-function)
(global-set-key (kbd "C-h v") 'counsel-describe-variable)

(require 'smartparens-config)
;; (add-hook 'emacs-lisp-mode-hook 'smartparens-mode)
(smartparens-global-mode 1)

(global-set-key (kbd "<f9>") 'org-mode)

(setq auto-mode-alist
      (append
       '(("\\.js\\'" . js2-mode))
       auto-mode-alist))

(require 'org)
(setq org-src-fontify-natively t)

;; 设置默认 Org Agenda 文件目录
(setq org-agenda-files '("~/org"))

;; 设置 org-agenda 打开快捷键
(global-set-key (kbd "C-c a") 'org-agenda)

 

转载于:https://my.oschina.net/xphouziyu/blog/1789039

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值