我的.emacs(Ubuntu版)
来源:互联网 发布:mac 图标大小 编辑:程序博客网 时间:2024/04/29 23:43
(custom-set-variables
'(show-paren-mode t))
(custom-set-faces
'(default ((t (:family "Andale Mono" :foundry "monotype" :slant normal :weight normal :height 113 :width normal)))))
;;Load site-lisp
(add-to-list 'load-path "~/.emacs.d/site-lisp")
(setenv "PATH" (concat "/usr/local/Gambit-C/bin/:" (getenv "PATH")))
(setq exec-path (append '("/usr/local/Gambit-C/bin/") exec-path))
(require 'gambit)
;;显示行号
(add-to-list 'load-path "/usr/share/emacs/site-lisp")
(require 'linum)
(global-linum-mode t)
(setq column-number-mode t);显示列号
(global-set-key [f3] 'find-name-dired)
(global-set-key [(f4)] 'grep-find)
(global-set-key [f5] 'compile)
(global-set-key [(f6)] 'replace-regexp)
;;显示括号匹配, 而不是匹配后短暂的跳到另一个括号
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;;ido的配置,这个可以使你在用C-x C-f打开文件的时候在后面有提示;
;;(ido-mode t)
;;让Emacs可以直接打开和显示图片。
(setq auto-image-file-mode t)
;打开压缩文件时自动解压缩。
(auto-compression-mode 1)
;自动保存模式
;;(setq auto-save-mode t)
;;不生成临时文件
(setq-default make-backup-files nil)
;;exit shell后,buffer自动关闭
(add-hook 'shell-mode-hook 'wcy-shell-mode-hook-func)
(global-set-key (kbd "C-j") 'goto-line)
(global-set-key (kbd "C-1") 'edirs)
;; (set-background-color "black") ;; 使用黑色背景
;; (set-foreground-color "white") ;; 使用白色前景
(set-face-foreground 'region "green") ;; 区域前景颜色设为绿色
(set-face-background 'region "blue") ;; 区域背景色设为蓝色
;;窗口全屏
(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))
)
(global-set-key [f12] 'my-maximized)
(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))
)
;; ;; 启动emacs时窗口最大化
(my-maximized)
;;自动补全全部括号
(electric-pair-mode 1)
(setq electric-pair-pairs '(
(?\" . ?\")
(?\{ . ?\})
) )
;;切换输入法: Ctrl + \
;;自动补全
(add-to-list 'load-path "/home/iton/.emacs.d/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "/home/iton/.emacs.d/ac-dict")
(add-to-list 'load-path "/home/iton/.emacs.d/git-emacs")
(require 'git-emacs)
;;查找中文
(require 'git-find-file)
;;(global-set-key (kbd "C-x C-M-f") 'git-find-file)
(global-set-key [f7] 'git-find-file)
;; 支持emacs和外部程序的粘贴
(setq x-select-enable-clipboard t)
;; 设置字体
;; 方法为: emacs->options->Set Default Font->"M-x describe-font"查看当前使用的字体名称、字体大小
(set-default-font " -bitstream-Courier 10 Pitch-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1")
;; 设置默认tab宽度为2
(setq tab-width 2
indent-tabs-mode t
c-basic-offset 2)
;;保存上次打开的文件记录
(desktop-save-mode t)
(load "desktop")
(desktop-load-default)
(desktop-read)
;;cscope
(require 'cc-mode)
(require 'xcscope)
;;但是如果工程十分庞大,即使是判断文件更新与否也很费时,可以告诉 Emacs 别自动更新 cscope.out:
(setq cscope-do-not-update-database t)
;;绑定快捷键
;;创建索引
(define-key global-map [(control f3)] 'cscope-index-files)
;;查找调用
(define-key global-map [(control f4)] 'cscope-find-this-symbol)
;;查找定义
(define-key global-map [(control f5)] 'cscope-find-global-definition)
;;回到查找函数
(define-key global-map [(control f6)] 'cscope-pop-mark)
;;直接跳到查找定义
(define-key global-map [(control f7)] 'cscope-find-global-definition-no-prompting)
;;meta + f9(在f9之后的数字才有效)
;;(define-key global-map [(meta f9)] 'compile)
;;python
(require 'python-mode)
(global-set-key [f8] 'py-execute-buffer)
(display-time-mode t)
(setq display-time-24hr-format t);;时间使用24小时制
(setq display-time-day-and-date t);;时间显示包括日期和具体时间
(setq inhibit-startup-message t);;关闭emacs启动时的画面
(ansi-color-for-comint-mode-on);;真正shell-mode乱码解决
(mouse-avoidance-mode 'animate);;光标靠近鼠标指针时,让鼠标指针自动让开,别挡住视线
;;双重补全,好用的很呐
(global-set-key (kbd "M-/") 'hippie-expand)
;;对付重命名的buffer
(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)
;;高亮当前行
(global-set-key [f1] 'hl-line-mode)
(global-set-key [f2] 'eval-buffer)
;;Add find-name-dired and find-grep-dired Command.
(add-hook 'shell-mode-hook 'wcy-shell-mode-hook-func) ;;;每当我在M-x shell启动shell ,然后执行 exit 退出 shell 之后,buffer 并不自动关 闭,很不爽, 下面的指令,可以让其自动关闭。
(defun wcy-shell-mode-hook-func ()
(set-process-sentinel (get-buffer-process (current-buffer))
#'wcy-shell-mode-kill-buffer-on-exit)
)
(defun wcy-shell-mode-kill-buffer-on-exit (process state)
(message "%s" state)
(if (or
(string-match "exited abnormally with code.*" state)
(string-match "finished" state))
(kill-buffer (current-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))))))))
;;自动添加c/c++头文件宏定义
(setq auto-insert t)
(setq auto-insert-query t)
(add-hook 'find-file-hooks 'auto-insert)
(setq auto-insert-directory "~/insert/")
(define-auto-insert '("^build\\.xml\\'" . "Ant编译脚本") "build.xml")
;;去掉工具条
(tool-bar-mode -1)
;;解决emacs23以前无法正常拷贝-粘贴中文
'(show-paren-mode t))
(custom-set-faces
'(default ((t (:family "Andale Mono" :foundry "monotype" :slant normal :weight normal :height 113 :width normal)))))
;;Load site-lisp
(add-to-list 'load-path "~/.emacs.d/site-lisp")
(setenv "PATH" (concat "/usr/local/Gambit-C/bin/:" (getenv "PATH")))
(setq exec-path (append '("/usr/local/Gambit-C/bin/") exec-path))
(require 'gambit)
;;显示行号
(add-to-list 'load-path "/usr/share/emacs/site-lisp")
(require 'linum)
(global-linum-mode t)
(setq column-number-mode t);显示列号
(global-set-key [f3] 'find-name-dired)
(global-set-key [(f4)] 'grep-find)
(global-set-key [f5] 'compile)
(global-set-key [(f6)] 'replace-regexp)
;;显示括号匹配, 而不是匹配后短暂的跳到另一个括号
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;;ido的配置,这个可以使你在用C-x C-f打开文件的时候在后面有提示;
;;(ido-mode t)
;;让Emacs可以直接打开和显示图片。
(setq auto-image-file-mode t)
;打开压缩文件时自动解压缩。
(auto-compression-mode 1)
;自动保存模式
;;(setq auto-save-mode t)
;;不生成临时文件
(setq-default make-backup-files nil)
;;exit shell后,buffer自动关闭
(add-hook 'shell-mode-hook 'wcy-shell-mode-hook-func)
(global-set-key (kbd "C-j") 'goto-line)
(global-set-key (kbd "C-1") 'edirs)
;; (set-background-color "black") ;; 使用黑色背景
;; (set-foreground-color "white") ;; 使用白色前景
(set-face-foreground 'region "green") ;; 区域前景颜色设为绿色
(set-face-background 'region "blue") ;; 区域背景色设为蓝色
;;窗口全屏
(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))
)
(global-set-key [f12] 'my-maximized)
(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))
)
;; ;; 启动emacs时窗口最大化
(my-maximized)
;;自动补全全部括号
(electric-pair-mode 1)
(setq electric-pair-pairs '(
(?\" . ?\")
(?\{ . ?\})
) )
;;切换输入法: Ctrl + \
;;自动补全
(add-to-list 'load-path "/home/iton/.emacs.d/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "/home/iton/.emacs.d/ac-dict")
(ac-config-default)
;;git-emacs(add-to-list 'load-path "/home/iton/.emacs.d/git-emacs")
(require 'git-emacs)
;;查找中文
(require 'git-find-file)
;;(global-set-key (kbd "C-x C-M-f") 'git-find-file)
(global-set-key [f7] 'git-find-file)
;; 支持emacs和外部程序的粘贴
(setq x-select-enable-clipboard t)
;; 设置字体
;; 方法为: emacs->options->Set Default Font->"M-x describe-font"查看当前使用的字体名称、字体大小
(set-default-font " -bitstream-Courier 10 Pitch-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1")
;; 设置默认tab宽度为2
(setq tab-width 2
indent-tabs-mode t
c-basic-offset 2)
;;保存上次打开的文件记录
(desktop-save-mode t)
(load "desktop")
(desktop-load-default)
(desktop-read)
;;cscope
(require 'cc-mode)
(require 'xcscope)
;;但是如果工程十分庞大,即使是判断文件更新与否也很费时,可以告诉 Emacs 别自动更新 cscope.out:
(setq cscope-do-not-update-database t)
;;绑定快捷键
;;创建索引
(define-key global-map [(control f3)] 'cscope-index-files)
;;查找调用
(define-key global-map [(control f4)] 'cscope-find-this-symbol)
;;查找定义
(define-key global-map [(control f5)] 'cscope-find-global-definition)
;;回到查找函数
(define-key global-map [(control f6)] 'cscope-pop-mark)
;;直接跳到查找定义
(define-key global-map [(control f7)] 'cscope-find-global-definition-no-prompting)
;;meta + f9(在f9之后的数字才有效)
;;(define-key global-map [(meta f9)] 'compile)
;;python
(require 'python-mode)
(global-set-key [f8] 'py-execute-buffer)
(display-time-mode t)
(setq display-time-24hr-format t);;时间使用24小时制
(setq display-time-day-and-date t);;时间显示包括日期和具体时间
(setq inhibit-startup-message t);;关闭emacs启动时的画面
(ansi-color-for-comint-mode-on);;真正shell-mode乱码解决
(mouse-avoidance-mode 'animate);;光标靠近鼠标指针时,让鼠标指针自动让开,别挡住视线
;;双重补全,好用的很呐
(global-set-key (kbd "M-/") 'hippie-expand)
;;对付重命名的buffer
(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)
;;高亮当前行
(global-set-key [f1] 'hl-line-mode)
(global-set-key [f2] 'eval-buffer)
;;Add find-name-dired and find-grep-dired Command.
(add-hook 'shell-mode-hook 'wcy-shell-mode-hook-func) ;;;每当我在M-x shell启动shell ,然后执行 exit 退出 shell 之后,buffer 并不自动关 闭,很不爽, 下面的指令,可以让其自动关闭。
(defun wcy-shell-mode-hook-func ()
(set-process-sentinel (get-buffer-process (current-buffer))
#'wcy-shell-mode-kill-buffer-on-exit)
)
(defun wcy-shell-mode-kill-buffer-on-exit (process state)
(message "%s" state)
(if (or
(string-match "exited abnormally with code.*" state)
(string-match "finished" state))
(kill-buffer (current-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))))))))
;;自动添加c/c++头文件宏定义
(setq auto-insert t)
(setq auto-insert-query t)
(add-hook 'find-file-hooks 'auto-insert)
(setq auto-insert-directory "~/insert/")
(define-auto-insert '("^build\\.xml\\'" . "Ant编译脚本") "build.xml")
;;去掉工具条
(tool-bar-mode -1)
;;解决emacs23以前无法正常拷贝-粘贴中文
;;(set-clipboard-coding-system 'ctext)
0 0
- 我的.emacs(Ubuntu版)
- 我的.emacs(Mac版)
- 我的emacs配置.emacs
- 我的Emacs配置文件 (windows版)
- 我的emacs配置文件
- 我的.emacs文件
- 我的Emacs配置
- 我的 Emacs 配置文件
- 我的.emacs
- 我的 .emacs配置文件
- 我的.emacs文件
- 我的emacs配置
- 我的emacs配置
- 我的emacs配置
- 我的.emacs文件
- 我的Emacs配置
- 我的.emacs配置
- 我的emacs配置文件
- Drizzle、MariaDB和Percona Server_超越MySQL:三个流行MySQL分支的对比
- mysql将去重以后的记录导入新表
- 安卓自定义视图 - 手写签名的实现
- Node.js开发实战详解实践3.3错误
- 字符数组与指针的用法
- 我的.emacs(Ubuntu版)
- shell ... 动画
- 《视频直播技术详解》系列之八:直播云 SDK 性能测试模型
- Android sensor架构(一)应用如何使用sensor(and5.1)
- 【Unity&NPC&UI】如何使得鼠标悬浮NPC对象,进而响应对应的函数
- Pattern和Matcher详解
- 配置安装Apache主服务发生错误:"(OS 5)拒绝访问。 : AH00369: Failed to open the Windows service manager, perh······ "
- 机器学习——模型评估与选择二
- Servlet篇之 HttpServlet的工作流程