我的.emacs文件,用于C/C++及shell编程。
1. [代码]我的.emacs文件,用于C/C++及shell编程。
;;我的配置
;;1.基本配置
;;外观配置***************
;;禁用启动画面
(setq inhibit-startup-message t)
;;设置字体大小 参考http://www.linuxsir.org/bbs/thread326299.html
(set-default-font "-unknown-DejaVu Sans Mono-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1")
(add-to-list 'default-frame-alist '(font, "-unknown-DejaVu Sans Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1"))
;;设定启动时窗口大小
(setq default-frame-alist
'((height . 20) (width . 85) (top . 20) (left . 20) (menu-bar-lines . 0) (tool-bar-lines . 0)))
;;去掉工具栏
(tool-bar-mode nil)
;;去掉滚动条
(scroll-bar-mode nil)
;;键绑定****************
;;WIN+s进入shell
(global-set-key (kbd "s-s") 'shell)
;;缓冲区****************
;;设定行距
(setq default-line-spacing 4)
;;页宽
(setq default-fill-column 80)
;;缺省模式
(setq default-mojor-mode 'text-mode)
;;语法加亮
(global-font-lock-mode t)
;;高亮显示区域选择
(transient-mark-mode t)
;;页面平滑滚动
(setq scroll-margin 3
scroll-conservatively 10000)
;;高亮显示成对括号,但不来回弹跳
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;;鼠标指针规避光标
(mouse-avoidance-mode 'animate)
;;在标题栏提示目前我的位置
(setq frame-title-format "zym@%b")
;;状态栏******************
;;标题栏显示%f缓冲区完整路径%p页面百分数%l行号
(setq frame-title-format "%f")
;;编辑器设定***************
;;使用X剪贴板
(setq x-select-enable-clipboard t)
;;设定剪贴板内容格式 适应firefox
(set-clipboard-coding-system 'ctext)
;;其它设置****************
;;打开图片显示功能
(auto-image-file-mode t)
;;.颜色设置 参考http://www.nongnu.org/color-theme/
(add-to-list 'load-path' "/usr/share/emacs/23.1/site-lisp/emacs-goodies-el")
(require 'color-theme) ;导入主题
;(eval-after-load "color-theme"
; '(progn
; (color-theme-initialize)
; (color-theme-hober)))
;(color-theme-initialize);初始化
;(load-file "/usr/share/emacs/23.1/lisp/color-theme.el")
(color-theme-calm-forest);选用的主题
(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.
'(ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2)))
(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.
)
;;以下参考http://www.douban.com/group/topic/12115962/
;;退出gdb,term,compilation时关闭对应的buffer
;;关闭函数
(defun kill-buffer-when-shell-command-exit ()
"Close current buffer when `shell-command' exit."
(let ((process (ignore-errors (get-buffer-process (current-buffer)))))
(when process
(set-process-sentinel process
(lambda (proc change)
(when (string-match "\\(finished\\|exited\\)" change)
(kill-buffer (process-buffer proc))))))))
(add-hook 'gdb-mode-hook 'kill-buffer-when-shell-command-exit)
(add-hook 'term-mode-hook 'kill-buffer-when-shell-command-exit)
(defun kill-buffer-when-compile-success (process)
"Close current buffer when `shell-command' exit."
(set-process-sentinel process
(lambda (proc change)
(when (string-match "finished" change)
(delete-windows-on (process-buffer proc))))))
;;编译成功后自动关闭"compilation* buffer
(add-hook 'compilation-start-hook 'kill-buffer-when-compile-success)
;;2.C/C++编程设置,参考:http://www.caole.net/diary/emacs_write_cpp.html
;;CC-mode配置***************
(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)
;;C/C++语言编辑策略**********
(defun my-c-mode-common-hook()
(setq tab-width 4 indent-tabs-mode nil)
(setq c-basic-offset 4)
;;饥饿删除(hungry-delete)和自动新行
;;(c-toggle-auto-hungry-state 1)
;;按键定义
(define-key c-mode-base-map [(control \`)] 'hs-toggle-hiding)
(define-key c-mode-base-map [(return)] 'newline-and-indent)
(define-key c-mode-base-map [(f9)] 'compile)
(define-key c-mode-base-map [(f10)] 'gdb)
(define-key c-mode-base-map [(meta \`)] 'c-indent-command)
;;预处理设置
(setq c-macro-shrink-window-flag t)
(setq c-macro-preprocessor "cpp")
(setq c-macro-cppflags " ")
(setq c-macro-prompt-flag t)
(setq hs-minor-mode t)
(setq abbrev-mode t)
)
;;C/C++语言编辑策略**********
(defun my-c-mode-common-hook()
(setq tab-width 4 indent-tabs-mode nil)
(setq c-basic-offset 4)
(setq gdb-many-windows t)
;;饥饿删除(hungry-delete)和自动新行
;;(c-toggle-auto-hungry-state 1)
;;按键定义
(define-key c-mode-base-map [(control \`)] 'hs-toggle-hiding)
(define-key c-mode-base-map [(return)] 'newline-and-indent)
(define-key c-mode-base-map [(f3)] 'gdb-many-windows)
(define-key c-mode-base-map [(f9)] 'compile)
(define-key c-mode-base-map [(f10)] 'gdb)
(define-key c-mode-base-map [(meta \`)] 'c-indent-command)
;;预处理设置
(setq c-macro-shrink-window-flag t)
(setq c-macro-preprocessor "cpp")
(setq c-macro-cppflags " ")
(setq c-macro-prompt-flag t)
(setq hs-minor-mode t)
(setq abbrev-mode t)
)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
;;gdb按键绑定 参考http://emacser.com/emacs-gdb.htm
(add-hook 'gdb-mode-hook '(lambda()
(define-key c-mode-base-map [(f4)] 'gud-go)
(define-key c-mode-base-map [(f5)] 'gud-next)
(define-key c-mode-base-map [(f6)] 'gud-step)
(define-key c-mode-base-map [(f7)] 'gud-finish)
(define-key c-mode-base-map [(f8)] 'gud-until)))
;;C++语言编辑策略**********
(defun my-c++-mode-hook()
(setq tab-width 4 indent-tabs-mode nil)
(c-set-style "BSD")
)
;;自动补全设置*************
(add-to-list 'load-path "/usr/share/emacs/23.1/lisp/company"
"/usr/share/emacs/23.1/lisp/cedet-1.0/common") ;拓展文件(插件)目录
(load "/usr/share/emacs/23.1/lisp/cedet-1.0/common/cedet" nil t)
(autoload 'company-mode "company" nil t)
(setq company-idle-delay t)
http://www.enterdesk.com/special/huangguantp/
;;semantic配置皇冠图片
(setq semanticdb-default-save-director "~/.emacs.d/semanticdb")
(semantic-load-enable-code-helpers)
(semantic-load-enable-gaudy-code-helpers)
;自动补全快捷键
(define-key c-mode-base-map (kbd "M-n") 'semantic-ia-complete-symbol-menu)
;代码跳转快捷键
(global-set-key [f12] 'semantic-ia-fast-jump)
;跳转后再跳回原来的地方
(global-set-key [f11]
(lambda()
(interactive)
(if (ring-empty-p (oref semantic-mru-bookmark-ring ring))
(error "Semantic Bookmark ring is currently empty"))
(let* ((ring (oref semantic-mru-bookmark-ring ring))
(alist (semantic-mrub-ring-to-assoc-list ring))
(first (cdr (car alist))))
(if (semantic-equivalent-tag-p (oref first tag)
(semantic-current-tag))
(setq first (cdr (car (cdr alist)))))
(semantic-mrub-switch-tags first))))
;设置semantic检索范围
(setq semanticdb-project-roots
(list
(expand-file-name "/")))
;;设置semantic cache临时文件的路径
(setq semanticdb-default-save-directory "~/.emacs.d/")
;;避免semantic占用CPU过多
(setq-default semantic-idle-scheduler-idle-time 432000)
;;配置cscope
(require 'xcscope)
;;跳转到全局定义
(global-set-key "\C-xg" 'cscope-find-global-definition-no-prompting)
;;配置ecb
(add-to-list 'load-path "/usr/share/emacs/23.1/site-lisp/ecb-2.40/")
;(load-file "/usr/share/emacs/23.1/site-lisp/ecb-2.40/ecb.el")
(require 'ecb)
(setq ecb-auto-activate nil
ecb-tip-of-the-day nil
ecb-free-indent 4
ecb-windows-height 0.5
ecb-windows-width 0.20)
ecb-auto-compatibility-check nil
ecb-version-check nil
inhibit-startup-message t
我的.emacs文件,用于C/C++及shell编程。的更多相关文章
- 创建.emacs.d目录和.emacs文件
1.双击bin下的addpm.exe 2.HKEY_CURRENT_USER->Software->GNU->Emacs 新建字符串值HOME,数值数据为emacs的安装路径 3.创 ...
- Linux中的.emacs文件
刚开始的时候在Windows下使用emacs,那个时候配置 .emacs文件直接去C盘里\Users\(username)\AppData\Roaming 路径下查找就可以了(最开始的时候可以打开em ...
- emacs window版环境配置(设置默认的.emacs文件,指向自定义.emacs达到自定义home的目的)
1.下载解压包 下载地址 ,下载之后我是直接解压到E:\emacs中的,E:\emacs中就有bin,libexec…等文件; 2.点击bin中的addpm.exe文件进行安装emacs; 3.就会 ...
- 在Web.Config文件中使用configSource,避免动态修改web.config导致asp.net重启(另添加一个Config文件用于管理用户数据)
原文:在Web.Config文件中使用configSource,避免动态修改web.config导致asp.net重启(另添加一个Config文件用于管理用户数据) 我们都知道,在asp.net中修改 ...
- ROS(indigo) 用于机器人控制的图形化编程工具--code_it robot_blockly
0 简介: 编程语言有汇编,高级语言,解释语言等,现在图形化编程也越来越流行.图形化编程简单易学.8年前,微软推出了VPL用于机器人程序设计,如Python和JavaScript都可以用图形化框图实现 ...
- [ SHELL编程 ] 远程服务器传输文件
在shell编程中经常需要获取远程服务器文件.手工操作中使用scp命令完成.为避免脚本执行scp输入密码进行交互,需先建立本机服务器当前用户和远程服务器指定用户的信任关系.具体代码见操作实例,重点关注 ...
- Linux Shell编程第5章——文件的排序、合并和分割
目录 sort命令 sort命令的基本用法 uniq命令 join命令 cut命令 paste命令 split命令 tr命令 tar命令 sort命令 sort命令是Linux系统一种排序工具,它将输 ...
- Linux shell编程02 shell程序的执行 及文件权限
第一个shell脚本 1. shell编程的方式 交互式shell编程 非交互式shell编程:执行的语句存放到一个文件 shell脚本:可以任意文件名,建议扩展名为sh 2. ...
- (C#)Windows Shell 编程系列1 - 基础,浏览一个文件夹
原文 (C#)Windows Shell 编程系列1 - 基础,浏览一个文件夹 (本系列文章由柠檬的(lc_mtt)原创,转载请注明出处,谢谢-) Windows Shell 编程,即 Windows ...
随机推荐
- dos下连接mysql,显示表结构
C:\Windows\system32>mysql -hlocalhoset -uroot -p Enter password: ***** mysql> use ssh Database ...
- iReport+jasperreport创建子表的几种方式(1)
在制作报表的过程中,子表是不可缺少的.今天就研究了一下制作子表的几种方式 一.连接数据库创建子表 以MySQL为例: 我的数据源数据库中的表 watermark/2/text/aHR0cDovL2Js ...
- 有关SQL注入的知识
SQL注入攻击是非常令人讨厌的安全漏洞,是所有的web开发人员,不管是什么平台,技术,还是数据层,需要确信他们理解和防止的东西.不幸的是,开发人员往往不集中花点时间在这上面,以至他们的应用,更糟糕的是 ...
- Makefile调用shell应该注意的地方
转载:http://blog.csdn.net/ninlei0115/article/details/9732191 1.在Makefile中只能在target中调用Shell脚本,其他地方是不能输出 ...
- programming review (c++): (3)graph, binary search
I.graph #include <iostream> #include <vector> using namespace std; vector<vector<, ...
- 多通道(比方RGB三通道)卷积过程
今天一个同学问 卷积过程好像是对 一个通道的图像进行卷积, 比方10个卷积核,得到10个feature map, 那么输入图像为RGB三个通道呢,输出就为 30个feature map 吗, 答案肯定 ...
- python 基础 7.6 sys 模块
一.sys 模块 sys 模块主要功能是获取参数 [root@www pythonscripts]# cat 2.py #!/usr/bin/python #coding=utf-8 im ...
- python 基础及资料汇总
Python 包.模块.类以及代码文件和目录的一种管理方案 Numpy 小结 用 Python 3 的 async / await 做异步编程 K-means 在 Python 中的实现 ...
- meaven环境变量配置
首先,先到官网去下载maven.这里是官网的地址:http://maven.apache.org/download.cgi 请选择最新的版本下载,这里咱们下载的是apache-maven-3.1.1 ...
- 九度OJ 1005:Graduate Admission (排序)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:5646 解决:1632 题目描述: It is said that in 2011, there are about 100 graduat ...