emacs
1.设置配置文件
配置放在
~/.emacs.d/init.el
文件中
(手动建立)
M-x
load-file
设置位置
2. 插件管理系统 packages
可在菜单栏
Options
> Manage Emacs Packages
中找到
3.高级自定义
;;
关闭工具栏
(tool-bar-mode -1)
;;
关闭文件滑动控件
(scroll-bar-mode -1)
;;
显示行号
(global-linum-mode 1)
;;
关闭启动帮助画面
(setq inhibit-splash-screen 1)
;;
关闭缩进
(
第二天中被去除
)
;; (electric-indent-mode -1)
;;
更改显示字体大小
16pt
;; http://stackoverflow.com/questions/294664/how-to-set-the-font-size-in- emacs
(set-face-attribute 'default nil :height 160)
;;
快速打开配置文件
(defun open-init-file()
(interactive)
(find-file "~/.emacs.d/init.el"))
;;
这一行代码,将函数
open-init-file
绑定到
<f2>
键上
(global-set-key (kbd "<f2>") 'open-init-file)
;
; 开启全局
Company
补全
(global-company-mode 1)
;;
关闭生成配置文件
(setq make-backup-files nil)
;;
打开最近文件
(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-item 10)
(global-set-key (kbd "C-x C-r") 'recentf-open-files)
;;
启动
emacs
恢复上次编辑场景
(desktop-save-mode 1)
;;
透明度设置
(global-set-key
[(f11)] 'loop-alpha)
(setq
alpha-list '((100 100) (75 45) (65 35)(55 25)(45 15) ))
(defun
loop-alpha ()
(interactive)
(let
((h (car alpha-list))) ;; head value will set to
((lambda
(a ab)
(set-frame-parameter
(selected-frame) 'alpha (list a ab))
(add-to-list
'default-frame-alist (cons 'alpha (list a ab)))
)
(car h) (car (cdr h)))
(setq
alpha-list (cdr (append alpha-list (list h))))
)
)
;;c++
mode
;;add-hook
'smartparens-enabled-hook #'evil-smartparens-mode)
(add-hook
'c-mode-hook 'hs-minor-mode)
(add-hook
'c++-mode-hook 'hs-minor-mode)
(defun
my-c-mode-auto-pair ()
(interactive)
(make-local-variable
'skeleton-pair-alist)
(setq
skeleton-pair-alist '(
(?\"
_ "\"" >)
(?\'
_ "'" >)
(?\(
_ ")" >)
(?\[
_ "]" >)
(?\{
\n > _ \n ?} >)))
(setq
skeleton-pair t)
(local-set-key
(kbd "(") 'skeleton-pair-insert-maybe)
(local-set-key
(kbd "{") 'skeleton-pair-insert-maybe)
(local-set-key
(kbd "'") 'skeleton-pair-insert-maybe)
(local-set-key
(kbd "\"") 'skeleton-pair-insert-maybe)
(local-set-key
(kbd "[") 'skeleton-pair-insert-maybe))
(add-hook
'c-mode-hook 'my-c-mode-auto-pair)
(add-hook
'c++-mode-hook 'my-c-mode-auto-pair)
(require
'org)
(setq
org-src-fontify-natively t)
;;
素材库
(when
(>= emacs-major-version 24)
(require
'package)
;;(package-initialize)
(add-to-list
' package-archives '("melpa" .
"http://melpa.org/packages/") t)
)
(require
'cl)
(defvar
my/packages '(
company
monokai-theme
swiper
counsel
hungry-delete
smartparens
window-numbering
) "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))))
;;
Find Executable Path on OS X
(when
(memq window-system '(mac ns))
(exec-path-from-shell-initialize))