换源
;;my self-made config
(tool-bar-mode -1)
(scroll-bar-mode -1)
(setq inhibit-startup-screen t)
;;source change and confirm
(setq package-enable-at-startup nil)
(require 'package)
(setq package-archives '(("gnu" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")
("org" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/org/")
("melpa" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")))
;;initialize and refresh
(unless (bound-and-true-p package--initialized)
(package-initialize))
(unless package-archive-contents
(package-refresh-contents))
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
更改默认文件夹
(cd "你希望的路径")
("setq default-directory “你希望的路径")
更改字体和主题
-
字体使用menu-bar
-
主题~/.emacs.d/themes,更改.emacs
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/") (load-theme 'monokai t)
其他配置
(tool-bar-mode -1);关闭工具栏
(scroll-bar-mode -1);关闭侧边滚动条
(setq inhibit-startup-screen t);不显示启动界面
(global-linum-mode t);全局行号开启
C++代码风格
;; C++代码风格设置
(defconst cobbcpp
'("linux" ; this is inheritance from the linux style
(c-basic-offset . 4);使用+、-、++、--、*、/表示在上一行基础上缩进1、-1、2、-2、0.5、-0.5倍,数字是几个空格,0表示不缩进
(c-offsets-alist .
((innamespace . [0])))))
(c-add-style "cobbcpp" cobbcpp)
(defun CobbCppHook()
(c-set-style "cobbcpp")
(setq indent-tabs-mode nil)
(setq default-tab-width 4)
(setq tab-width 4)
(setq global-hl-line-mode t)
)
(add-hook 'c++-mode-hook 'CobbCppHook)
(elpy-enable)
标签:bar,package,配置,Emacs,mode,edu,cobbcpp,Kyana,setq
From: https://www.cnblogs.com/kyana/p/18016169