emacs 基本配置

(C = ctrl键)   (M=alt键)


C + n 下

C + p 上

C  + b 左

C + f 右


新建文件  C + x , C + f 输入文件名


---

配置init.el文件     emacs加载初始化配置

路径~/.emacs/init.el

vim ~/.emacs/init.el

;; 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.

;;c-h c-v 查找变量 c-h c-f 查找变量定义 c-h c-k 查看(你输入的快捷键)的解释


;;引入包(安装compangy等package 自动生成)
(package-initialize)


(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)

;;emacs源配置http://melpa.org/#/?sort=downloads&asc=false
(when (>= emacs-major-version 24)
  (require 'package)
  (package-initialize)
  (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
)

(require 'cl)
(defvar zhangyusheng/packages '(
                company
                monokai-theme
                atom-one-dark-theme
                hungry-delete
                swiper
                counsel
                js2-mode
                exec-path-from-shell
                ) "Default packages")

(setq package-selected-packages zhangyusheng/packages)

(defun zhangyusheng/packages-installed-p ()
  (loop for pkg in zhangyusheng/packages
    when (not (package-installed-p pkg)) do (return nil)
    finally (return t)
  )
)

(unless (zhangyusheng/packages-installed-p)
  (message "%s" "正在更新包...")
  (package-refresh-contents)
  (dolist (pkg zhangyusheng/packages)
    (when (not (package-installed-p pkg))
      (package-install pkg)
      )
    )
)

;;智能backspace删除
(require 'hungry-delete)
(global-hungry-delete-mode)
;;菜单栏 滚动 关闭
(tool-bar-mode -1)
(scroll-bar-mode -1)

;;开启行标
(global-linum-mode t)

;;
(setq inhibit-splash-screen t)


(defun open-my-init-file()
  (interactive)
  (find-file "~/.emacs.d/init.el")
)

;;按F1调用open-my-init-file函数
(global-set-key (kbd "<f2>") 'open-my-init-file)

;;completion mode  自动补全
(global-company-mode t)

;;指针模式
(setq-default cursor-type 'bar)

;;开启最近的文件
(require 'recentf)
   (recentf-mode 1)
(setq recentf-max-menu-items 25)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)

;;可视化选中 d 删除
(delete-selection-mode t)

;;全屏
(setq initial-frame-alist (quote ((fullscreen . maximized))))

;;括号匹配(用hook勾住lisp 的major-mode  追加一个mode  ctrl h m 可以看到当前mode)
(add-hook 'emacs-lisp-mode-hook 'show-paren-mode)

;;高亮当前行
(global-hl-line-mode)

;;主题
(load-theme 'atom-one-dark t)


;;搜索更骚
(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)

;;配置js major-mode 主模式
(setq auto-mode-alist
      (append
       '(("\\.js\\'" . js2-mode))
       auto-mode-alist))

;;让emacs 可以找到macs的可执行bin文件
(when (memq window-system '(mac ns))
  (exec-path-from-shell-initialize)
  )

(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.
 '(custom-safe-themes
   (quote
    ("c3d4af771cbe0501d5a865656802788a9a0ff9cf10a7df704ec8b8ef69017c68" default))))

(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.
 '(js2-external-variable ((t (:foreground "brown2")))))

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值