Chinaunix首页 | 论坛 | 博客
  • 博客访问: 204069
  • 博文数量: 34
  • 博客积分: 885
  • 博客等级: 准尉
  • 技术积分: 305
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-16 09:31
文章分类

全部博文(34)

文章存档

2013年(3)

2012年(3)

2011年(17)

2010年(4)

2009年(7)

我的朋友

分类: LINUX

2009-10-16 12:50:23

1. Emacs 基本配置
系统: ubuntu 8.04
Emacs 22

;;-------------------------括号匹配--------------------------
;;括号匹配时显示另一端的括号,而不是跳过去
(show-paren-mode t)
(setq show-paren-style 'parentheses)

;;-------------------------语法加亮--------------------------
(global-font-lock-mode t)
;;C默认格式为linux
(add-hook 'c-mode-hook
'(lambda()
(c-set-style "linux"))) 
;;取消开机画面
(setq inhibit-startup-message t)
;;-------------------------显示列号--------------------------
;;(setq column-number-mode t)
;;display the column number and line number
(setq column-number-mode t)
(setq line-number-mode t)
;;-------------------------标题拦显示buffer的名字------------
;;(setq frame-title-format "emacs@%b")
;Emacs title bar to reflect file name
;(defun frame-title-string ()
;"Return the file name of current buffer, using ~ if under home directory"
;(let
;((fname (or
;(buffer-file-name (current-buffer))
;(buffer-name))))
;;let body
;(when (string-match (getenv "HOME") fname)
;(setq fname (replace-match "~" t t fname)) )
;   fname))
; (defun display-buffer-name ()  
;   (interactive)  
;  (message (buffer-file-name (current-buffer))))  
;;; Title = 'system-name File: foo.bar'
;(setq frame-title-format '("" system-name " File: "(:eval (frame-title-string))))
(defun frame-title-string ()
"Return the file name of current buffer, using ~ if under home directory"
(let ((fname (or (buffer-file-name (current-buffer)) (buffer-name))))
;;let body
(when (string-match (getenv "HOME") fname)
(setq fname (replace-match "~" t t fname)) )
fname))
;;; Title = 'system-name File: foo.bar'
(setq frame-title-format '("" system-name " File: "(:eval (frame-title-string))))
;;-------------------------设置emacs启动时初始化大小-------------------------
;;(setq initial-frame-alist '((top . 0) (left . 0) (width . 1280) (height . 1024)))

;字体设置
;(set-default-font "YaHeiConsolas-13")
;(set-fontset-font "fontset-default"
;                  'unicode '("YaHeiConsolas-13" . "unicode-bmp"))
;(setq default-frame-alist
;      (append '((font . "YaHeiConsolas-13")) default-frame-alist))


;解决emacs shell 乱码
(setq ansi-color-for-comint-mode t)
(customize-group 'ansi-colors)
(kill-this-buffer);关闭customize窗口


;自定义按键
(global-set-key [f1] 'shell);F1进入Shell
(global-set-key [f5] 'gdb);F5调试程序
(setq compile-command "make -f Makefile")
(global-set-key [f7] 'do-compile);F7编译文件
(global-set-key [f8] 'other-window);F8窗口间跳转
(global-set-key [C-return] 'kill-this-buffer);C-return关闭当前buffer
(global-set-key [f10] 'split-window-vertically);F10分割窗口
(global-set-key [f11] 'delete-other-windows);F11 关闭其它窗口
(global-set-key [f12] 'my-fullscreen);F12 全屏
(global-set-key (kbd "C-,") 'backward-page);文件首
(global-set-key (kbd "C-.") 'forward-page);文件尾

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

;最大化
(defun my-maximized-horz ()
  (interactive)
  (x-send-client-message
   nil 0 nil "_NET_WM_STATE" 32
   '(1 "_NET_WM_STATE_MAXIMIZED_HORZ" 0)))
(defun my-maximized-vert ()
  (interactive)
  (x-send-client-message
   nil 0 nil "_NET_WM_STATE" 32
   '(1 "_NET_WM_STATE_MAXIMIZED_VERT" 0)))
(defun my-maximized ()
  (interactive)
  (x-send-client-message
   nil 0 nil "_NET_WM_STATE" 32
   '(1 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
  (interactive)
  (x-send-client-message
   nil 0 nil "_NET_WM_STATE" 32
   '(1 "_NET_WM_STATE_MAXIMIZED_VERT" 0)))
(my-maximized)
;;-------------------------设置Emacs的前景色和背景色(手工设置)-------------------------
(setq default-frame-alist
'(
  (foreground-color . "Wheat")
  (background-color . "DarkSlateGray")
  (cursor-color . "green1")
  ) ls
)
;; -------------------------将文件模式和文件后缀关联起来。append表示追加-------------------------
(
setq auto-mode-alist
    ( append
        '(("\\.py\\'" . python-mode)
        ("\\.s?html?\\'" . html-helper-mode)
        (" \\.asp\\'" . html-helper-mode)
        ("\\.phtml\\'" . html-helper-mode)
        ("\\.css\\'" . css-mode)
        ("\\.pc$" . c-mode)
    )
auto-mode-alist))
;;------------------------------------其它设置---------------------------------------
;;(setq default-major-mode 'text-mode);一打开就起用 text 模式。
(auto-image-file-mode t);打开图片显示功能
(fset 'yes-or-no-p 'y-or-n-p);以 y/n代表 yes/no,可能你觉得不需要,呵呵。
(display-time-mode 1);显示时间,格式如下
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
;(tool-bar-mode nil);去掉那个大大的工具栏
;(scroll-bar-mode nil);去掉滚动条,因为可以使用鼠标滚轮了 ^_^
(mouse-avoidance-mode 'animate);光标靠近鼠标指针时,让鼠标指针自动让开
(transient-mark-mode t);
(setq x-select-enable-clipboard t);支持emacs和外部程序的粘贴
(setq default-fill-column 80);默认显示 80列就换行
;;(setq-default make-backup-files nil);不要生成临时文件
(setq track-eol t);當光標在行尾上下移動的時候,始終保持在行尾。
(setq scroll-margin 3 scroll-conservatively 10000);防止頁面滾動時跳動  scroll-margin 3 可以在靠近屏幕边沿3行时就开始滚动,可以很好的看到上下文。
(setq mouse-yank-at-point t);中鍵粘貼
;;(setq require-final-newline t);; 自动的在文件末增加一新行

(prefer-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)

(setq load-path (cons "/home/black/.emacs.d/" load-path))
(setq auto-mode-alist
      (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist
      (cons '("python" . python-mode)
    interpreter-mode-alist))
(autoload 'python-mode "python-mode" "Python editing mode." t)
;;; add these lines if you like color-based syntax highlighting

;(global-font-lock-mode t)

;(setq font-lock-maximum-decoration t)

;(set-language-environment 'Chinese-GB)

;(set-keyboard-coding-system 'euc-cn)

;(set-clipboard-coding-system 'euc-cn)

;(set-terminal-coding-system 'euc-cn)

;(set-buffer-file-coding-system 'euc-cn)

;(set-selection-coding-system 'euc-cn)

;(modify-coding-system-alist 'process "*" 'euc-cn)

;(setq default-process-coding-system 

; '(euc-cn . euc-cn))

;(setq-default pathname-coding-system 'euc-cn)


2. Emacs + etags
另外, 利用emacs看源代码时,可以加etag,以方便多个文件之间的函数跳转。
简单的: find ./ -name "*.[ch]" | xargs etags -a
atl + . 看函数或者变量定义
ctrl + * 跳回上一层
ctrl + u alt + . 跳到下一个定义处, 如果有更多的话

3. TO BE DONE
加快捷键,如果光标放在函数上,直接有另外一个窗口显示函数的定义,那就更好了, 不需要跳转, 因为有些函数很小,跳转也是比较繁琐, 能直接看到就OK了。利用Emacs看阿拉伯文字,还有收发邮件, 看bbs, 应该要去尝试一下。 
阅读(1053) | 评论(1) | 转发(0) |
0

上一篇:没有了

下一篇:grub (1)

给主人留下些什么吧!~~

chinaunix网友2009-10-19 17:45:18

娇娇上门按摩13761689698,13391266868, www.shanghaimassage.cn 全天24小时为您提供全国各城市(上海,深圳,南京,杭州,苏州,成都,重庆,宁波,大连)市区上门按摩服务,为追求健康与美好生活的您送去真诚与温暖。用我们的双手为您解除肌肉疲劳,使您得到身心的放松 。我们本着“诚信第一,服务至上”的服务理念,竭诚为您提供优质服务。 QQ:191937218 预约热线:137-6168-9698/ 133-9126-6868 公司网址:www.shanghaimassage.cn 邮箱:shanghaimassagecn@yahoo.com.cn