mac版 init.el 配置(2019-11-12)

(setq package-archives '(("gnu" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")
  ("marmalade" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/marmalade/")
  ("melpa" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")))
(package-initialize)

(require 'helm)
(helm-mode 1)
(require 'ivy)
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(setq ivy-height 10)
(setq ivy-count-format "%d/%d")
(setq projectile-completion-system 'ivy)

(require 'evil)
;; (evil-mode 1)
;; (require 'neotree)
;; (neotree-mode 1)
(require 'magit)
;; (magit-mode t)
(require 'projectile)
(projectile-mode t)
;; 添加最近打开的文件
(require 'recentf)
(recentf-mode t)
(setq recentf-max-menu-item 10)
(setq recentf-max-saved-items 30)
(setq package-check-signature nil)

;; 显示行号
(global-linum-mode t)
;; 状态栏显示行列信息
(column-number-mode t)
;; 括号匹配高亮
(show-paren-mode t)
;; 关闭工具栏
(tool-bar-mode -1)
;; 高亮当前行
;; (global-hl-line-mode 1)
(menu-bar-mode -1)
;; (tool-bar-mode -1)
;; 自动补全括号
(electric-pair-mode t)
;; 关闭自动生成文件备份
(setq make-backup-files nil)
;; 关闭启动帮助画面
(setq inhibit-splash-screen 1)
;; 更改字体大小
(set-face-attribute 'default nil :height 140)
;; 编辑时禁用触摸板与鼠标
(global-disable-mouse-mode)

;; 删除换行符
(defun remove-dos-eol ()
  "Replace DOS eolns CR LF with Unix eolns CR"
  (interactive)
  (goto-char (point-min))
  (while (search-forward "\r" nil t) (replace-match "")))

;; 设置缩进
(setq indent-tabs-mode nil)
(setq c-basic-offset 2)
(setq default-tab-width 2)
(setq web-mode-code-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(setq web-mode-code-indent-offset 2)
(setq css-indent-offset 2)
(setq javascript-indent-level 2)
(setq js-indent-level 2)
(setq typescript-indent-level 2)
(setq ts-indent-level 2)
(setq tsx-indent-offset 2)
(setq rust-indent-unit 2)
(setq rust-indent-offset 2)

;; 设置主题
(load-theme 'dracula t)

;; 绑定快捷键
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
(global-set-key (kbd "") 'shell)
(global-set-key (kbd "") 'ivy-switch-buffer)
(global-set-key (kbd "") 'neotree-toggle)
(global-set-key (kbd "") 'evil-mode)

;; web-mode
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.jsx?$" . web-mode))
;; (add-to-list 'auto-mode-alist '("components\\/.*\\.js\\'" . rjsx-mode))

(defun my-web-mode-hook ()
  "Hooks for Web mode."
  (setq web-mode-markup-indent-offset 2)
  (setq web-mode-markup-indent-offset 2)
  (setq web-mode-css-indent-offset 2)
  (setq web-mode-code-indent-offset 2)
  (setq web-mode-attr-indent-offset 2)
  (setq web-mode-markup-indent-offset 2)
)
(add-hook 'web-mode-hook  'my-web-mode-hook)

你可能感兴趣的:(mac版 init.el 配置(2019-11-12))