emacs 配置

个人的Emacs配置,环境是archlinux,参考了不少网上资料,因为太多,就不一一列举了,在这里感谢那些作者的辛苦经验劳动。


(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.
‘(column-number-mode t)
‘(ecb-options-version "2.40")
‘(size-indication-mode t))
(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.
)

;;按F11全屏
(global-set-key [f11] ‘my-fullscreen)

;全屏
(defun my-fullscreen ()
(interactive)
(x-send-client-message
nil 0 nil "_NET_WM_STATE" 32
‘(2 "_NET_WM_STATE_FULLSCREEN" 0))
)

;最大化
(defun my-maximized ()
(interactive)
(x-send-client-message
nil 0 nil "_NET_WM_STATE" 32
‘(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
(x-send-client-message
nil 0 nil "_NET_WM_STATE" 32
‘(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
)
;启动时最大化
(my-maximized)

;;cedet-1.1 配置
;忽略目前cedet的一个issue
(setq byte-compile-warnings nil)

(load-file "~/.emacs.d/plugins/cedet-1.1/common/cedet.el")
(semantic-load-enable-minimum-features) ; 自动分析buffer内容 保存分析后的内容 可以利用ebrowse的结果
(semantic-load-enable-code-helpers) ; 这个feature可以让imenu显示semantic分析出的类,函数等tags。
;(semantic-load-enable-guady-code-helpers) ; 根据光标位置把当前函数名显示在buffer顶上 semantic会在类/函数等tag上方加一条蓝色的线
(semantic-load-enable-excessive-code-helpers) ; 其中包含上条被注释的功能
(global-ede-mode t)
(require ‘semantic)
(require ‘semantic-ia)
(global-semantic-stickyfunc-mode 0)
(require ‘semantic-gcc)
(require ‘semanticdb)
(global-srecode-minor-mode 1)

;;EAssist 配置 文件包含在cedet中
(add-to-list ‘load-path "~/.emacs.d/plugins/cedet-1.1/contrib/")
(defun my-c-mode-common-hook ()
(define-key c-mode-base-map (kbd "M-o") ‘eassist-switch-h-cpp)
(define-key c-mode-base-map (kbd "M-m") ‘eassist-list-methods))
(add-hook ‘c-mode-common-hook ‘my-c-mode-common-hook)

;;ecb-2.4 配置
(add-to-list ‘load-path "~/.emacs.d/plugins/ecb-master/")
(require ‘ecb)
(setq ecb-tip-of-the-day nil) ;启动ECB时不显示每日提示
(ecb-activate)

;;cscope 配置
(require ‘xcscope)

;;color-theme-6.6.0
(add-to-list ‘load-path "~/.emacs.d/plugins/color-theme-6.6.0/")
(require ‘color-theme)
(color-theme-initialize)
;(color-theme-arjen)
(color-theme-matrix)

;;YASnippet 配置
(add-to-list ‘load-path "~/.emacs.d/plugins/yasnippet")
(require ‘yasnippet)
(yas-global-mode 1)

;;switch-window 配置
(load-file "~/.emacs.d/plugins/switch-window.el")
(require ‘switch-window)
(global-set-key (kbd "C-x o") ‘switch-window)

;;auto-complete 配置
(add-to-list ‘load-path "~/.emacs.d/plugins/auto-complete/lib/fuzzy/")
(add-to-list ‘load-path "~/.emacs.d/plugins/auto-complete/lib/popup/")
(add-to-list ‘load-path "~/.emacs.d/plugins/auto-complete/lib/ert/lisp/emacs-lisp/")
(add-to-list ‘load-path "~/.emacs.d/plugins/auto-complete/")

(require ‘auto-complete-config)
(ac-config-default)
(add-to-list ‘ac-dictionary-directories "~/.emacs.d/plugins/auto-complete/dict")

;;highlight-symbol 配置
(add-to-list ‘load-path "~/.emacs.d/plugins/highlight-symbol/")
(require ‘highlight-symbol)
(global-set-key [(control f3)] ‘highlight-symbol-at-point)
(global-set-key [f3] ‘highlight-symbol-next)
(global-set-key [(shift f3)] ‘highlight-symbol-prev)
(global-set-key [(meta f3)] ‘highlight-symbol-query-replace)

;;tabbar 配置
(add-to-list ‘load-path "~/.emacs.d/plugins/tabbar/")
(require ‘tabbar)
(tabbar-mode 1)

;;session 配置
(add-to-list ‘load-path "~/.emacs.d/plugins/session/lisp/")
(require ‘session)
(add-hook ‘after-init-hook ‘session-initialize)

;;desktop 配置
(require ‘desktop)
(desktop-save-mode 1)
;(setq-default desktop-load-locked-desktop t);;解决pid错误问题

;;doxymacs 配置
(add-to-list ‘load-path "~/.emacs.d/plugins/doxymacs-1.8.0/lisp/")
(require ‘doxymacs)
(doxymacs-mode)
(defun my-doxymacs-font-lock-hook ()
(if (or (eq major-mode ‘c-mode) (eq major-mode ‘c++-mode))
(doxymacs-font-lock)))
(add-hook ‘font-lock-mode-hook ‘my-doxymacs-font-lock-hook)
(setq doxymacs-doxygen-style "C++")
(add-hook ‘c++-mode-common-hook ‘doxymacs-mode)
(add-hook ‘c++-mode-common-hook ‘doxymacs-mode)

;;multi-term 配置
(add-to-list ‘load-path "~/.emacs.d/plugins/multi-term/")
(require ‘multi-term)
(setq multi-term-program "/bin/bash")
(setq multi-term-buffer-name "term")
;for solve term-sned-raw: Wrong type arguement: charactor,tab
(add-hook ‘term-mode-hook (lambda()
(yas-minor-mode -1)))

(global-set-key "\C-x." ‘multi-term)
(global-set-key "\C-x," ‘multi-term-dedicated-open)

;;sourcepair 配置
(add-to-list ‘load-path "~/.emacs.d/plugins/sourcepair/")
(require ‘sourcepair)
(define-key global-map "\C-xz" ‘sourcepair-jump-to-headerfile)
(setq sourcepair-source-path ‘( "." "../*" "../../*" ))
(setq sourcepair-header-path ‘( "." "include" "../include" "../*" "../../*"))
(setq sourcepair-recurse-ignore ‘( ".git" "Debug" "Release" ))

;;dired+ 配置
(add-to-list ‘load-path "~/.emacs.d/plugins/diredPlus/")
(require ‘dired+)

;;[ 高亮当前行 ]
;;----------------------------------------------------------------------------
(require ‘hl-line)
(global-hl-line-mode t)

;;[ 其他基本配置 ]
;;----------------------------------------------------------------------------
(iswitchb-mode 1) ;;Buffer便捷提示
(setq-default cursor-type ‘bar) ;;光标显示为一竖线
(set-default-font "-unknown-DejaVu Sans Mono-normal-normal-normal-*-16-*-*-*-m-0-iso10646-1")
(icomplete-mode t)
(global-font-lock-mode t)
(fset ‘yes-or-no-p ‘y-or-n-p) ;;‘y‘/‘n‘代替‘yes‘/‘no‘
(setq x-select-enable-clipboard t) ;;支持emacs和外部程序的粘贴
(show-paren-mode t) ;;设置让光标指到某个括号与它匹配的括号
(setq show-paren-style ‘parentheses)
(tool-bar-mode nil)
(scroll-bar-mode nil)
(setq kill-ring-max 1024)
(setq max-lisp-eval-depth 40000) ;;lisp最大执行深度
(setq max-specpdl-size 10000) ;;最大容量
(setq undo-outer-limit 5000000) ;;撤销限制

;;[ 编码设置]
;;----------------------------------------------------------------------------
(setq default-buffer-file-coding-system ‘utf-8-unix) ;缓存文件编码
(setq default-file-name-coding-system ‘utf-8-unix) ;文件名编码
(setq default-keyboard-coding-system ‘utf-8-unix) ;键盘输入编码
(setq default-process-coding-system ‘(utf-8-unix . utf-8-unix)) ;进程输出输入编
(setq default-sendmail-coding-system ‘utf-8-unix) ;发送邮件编码
(setq default-terminal-coding-system ‘utf-8-unix) ;终端编码

;;[ 不产生备份、不自动保存 ]
;;----------------------------------------------------------------------------
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq auto-save-mode nil)

;;[ 显示行号 ]
;;----------------------------------------------------------------------------
(setq linum-format "%4d ")
(require ‘linum)
(global-linum-mode 1)

;;[ 设置缩进 ]
;;----------------------------------------------------------------------------
(setq indent-tabs-mode t)
(setq default-tab-width 4)
(setq tab-width 4)

;;隐藏tool bar
(tool-bar-mode 0)

;;配置w3m 基础配置
(setq browse-url-browser-function ‘w3m-browse-url)
(autoload ‘w3m-browse-url "w3m" "Ask a WWW browser to show a URL." t)
; optional keyboard short-cut 全局快捷键
(global-set-key "\C-xm" ‘browse-url-at-point)
;开启cookies
(setq w3m-use-cookies t)

;;干死semantic-stickyfunc-mode 要卸载ecb后,因为ecb启动后才会加载想应功能,此mode与tabber冲突
(global-semantic-stickyfunc-mode nil)

其中需要注意的就是ecb和cedet的加载顺序,ecb必须要写在cedet后面,否则可能出现ecb无法检测到cedet而不能正常启动的问题,但是ecb写在后面会导致ecb加载后依然会加载semantic-stickyfunc-mode,此mode与tabber冲突,所以在最后禁用之,其实不一定要加在最后,主要是加载顺序问题,能解决就好,就这样~新手才用emacs半年左右,这里贴出来是为了帮助其他和我一样的新鸟们~~老鸟们别在意啦~~

emacs 配置,布布扣,bubuko.com

时间: 2024-10-12 02:47:32

emacs 配置的相关文章

emacs配置eslint 语法检查.找不到node解决

使用emacs配置eslint 当调用语法检查时报错 Suspicious state from syntax checker javascript-eslint: Checker javascript-eslint returned non-zero exit code 127, but no errors from output: /usr/bin/env: "node": 没有那个文件或目录 但是我检查env环境使用 M-x getenv path 结果里面是有 user/bin

绝世emacs配置for Ubuntu

反正过不了几天就要退役了,把emacs配置放出来造福(祸害)大众? 浓浓的OIER风格,除了方便打代码就没别的用处(F8并不这样认为?),只可惜windows下的弄丢了,只有Ubuntu下的. F1不解释谁用谁知道. F2是个好东西,没有一键编译都不能没有它,谁用谁知道. F3和F4对处理码农题有奇效,眼不见心不烦. F5开O2,可以测数组越界或者什么奇怪的东西,或者加快拍的速度.Iria同学用血的教训告诉我们:O2会自动把一些没定义初始值的东西自动赋值成0,所以一些可能打挂的地方,嗯哼,拍不出

emacs 配置.emacs

emacs 配置.emacs (require 'package) (package-initialize) (add-to-list'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) (require 'auto-complete-config) (ac-config-default) (setq make-backup-files nil) (setq auto-save-

有用的东西(emacs配置和bzoj数据下载网址)

bzoj数据 emacs配置,就是我们CSP考试时用的那个 ;; 本 emacs 配置在 emacs26 起效 ;; via iotang ;; t = True ;; nil = False (package-initialize) ;; 默认编码环境. (set-language-environment "UTF-8") (set-default-coding-systems 'utf-8) ;; 不显示欢迎页面. (setq-default inhibit-startup-scr

我的第一份 emacs 配置

~/.emacs.d/init.el ;; 一打开就起用 org 模式. (setq default-major-mode 'org-mode);;(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)) ;; 语法高亮(global-font-lock-mode t) ;; 以 y/n代表 yes/no(fset 'yes-or-no-p 'y-or-n-p) ;; 显示括号匹配 (show-paren-mode t)(setq

Emacs 配置 Python 编程环境

python编程环境设置涉及到:自动完成.语法检查.虚拟环境. 为了不把系统搞乱,在python的虚拟环境中安装相关的插件. 一.安装python虚拟环境 virtualenvwrapper sudo apt-get virtualenvwrapper 然后创建一个虚拟环境: $ mkvirtualenv -p /usr/bin/python3 test 下面开始在test这个虚拟环境中操作:先看看有哪些包: $ pip list pip (1.5.6) setuptools (5.5.1) 可

ubuntu 下emacs 配置

(set-language-environment 'Chinese-GB) (set-keyboard-coding-system 'utf-8) (set-clipboard-coding-system 'utf-8) (set-terminal-coding-system 'utf-8) (set-buffer-file-coding-system 'utf-8) (set-default-coding-systems 'utf-8) (set-selection-coding-syste

emacs配置

; 指针颜色设置为白色(set-cursor-color "white");; 鼠标颜色设置为白色(set-mouse-color "white") ;; 从color-theme中获取;; 网上下载color-theme.el,放到加载路径(/usr/share/emacs/site-lisp )下;; M-x color-theme-select,鼠标左键选中,回车查看效果;; d查看信息,将出现如下信息:;; color-theme-matrix is an

Emacs配置(考场必备)(Emacs)

最近有几次离开自己一直坐着的座位,去别的机房考试了. 于是猛然想起来要记一记Emacs的简洁配置了. 算是把NOIP残存的记忆再拾一点起来...... 附上一些解释 (global-set-key [f9] 'compile-file);;一键编译(弄Devcpp留下来的习惯) (global-set-key (kbd "C-z") 'undo);;一键撤销(Like Windows) (global-set-key (kbd "C-q") 'kill-this-b