注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

我的博客

笨笨猫

 
 
 

日志

 
 

.emacs配置文件,加入M-w复制一行  

2011-09-07 16:59:54|  分类: MeeGo |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |



;; Load CEDET
;;(load-file "你存放cedet的目录/common/cedet.el")
(load-file "~/cedet-1.0/common/cedet.el")

;; Enabling various SEMANTIC minor modes.  See semantic/INSTALL for more ideas.
;; Select one of the following:

;; * This enables the database and idle reparse engines
;;(semantic-load-enable-minimum-features)

;; * This enables some tools useful for coding, such as summary mode
;;   imenu support, and the semantic navigator
(semantic-load-enable-code-helpers)

;; * This enables even more coding tools such as the nascent intellisense mode
;;   decoration mode, and stickyfunc mode (plus regular code helpers)
;; (semantic-load-enable-guady-code-helpers)

;; * This turns on which-func support (Plus all other code helpers)
;; (semantic-load-enable-excessive-code-helpers)

;; This turns on modes that aid in grammar writing and semantic tool
;; development.  It does not enable any other features such as code
;; helpers above.
;; (semantic-load-enable-semantic-debugging-helpers)


;;用于ecb
(add-to-list 'load-path "~/ecb-2.40")
(require 'ecb)




;;用于全屏显示: F12
(defun fullscreen ()
  (interactive)
  (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
    '(2 "_NET_WM_STATE_FULLSCREEN" 0)))
    
(global-set-key [f12] 'fullscreen)    

(setq make-backup-files nil);不产生备份文件
(column-number-mode t);显示列号

(show-paren-mode t);显示括号匹配

(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);光标靠近鼠标指针时,让鼠标指针自动让开
;;(setq mouse-yank-at-point t);支持中键粘贴
;;(transient-mark-mode t);允许临时设置标记

(setq x-select-enable-clipboard t);支持emacs和外部程序的粘贴
(setq frame-title-format '("" buffer-file-name "@emacs" ));在标题栏显示buffer名称
(setq default-fill-column 80);默认显示 80列就换行

;;字体大小设置
;;查看字体的方法:M-x describe-font 将后面的full name cp出来放在下面即可
(set-default-font "DejaVu Sans Mono:pixelsize=21:foundry=unknown:weight=normal:slant=normal:width=normal:spacing=100:scalable=true")


;;配色方案
(load-file "~/color-theme.el")
(require 'color-theme)
(add-hook 'c-mode-common-hook 'color-theme-taylor)
(add-hook 'c++-mode-common-hook 'color-theme-taylor)
 

;;显示行号
;;(require 'setnu)
;;用法: M-x setnu-mode即可显示行号
(require 'setnu)
(setnu-mode)

    
;;关掉开机画面    
(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.
 '(inhibit-startup-screen 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.
 )

;;将一个Tab键转成8个空格键
(setq default-tab-width 8)


;;标签浏览功能配置,使用tabber
(load-file "~/tabbar.el")
(require 'tabbar)
(tabbar-mode)
(global-set-key (kbd "") 'tabbar-backward-group)
(global-set-key (kbd "") 'tabbar-forward-group)
(global-set-key (kbd "C-`") 'tabbar-backward)
(global-set-key (kbd "C-<tab>") 'tabbar-forward)


;;复制一行的命令:M-w C-y粘贴
;; Smart copy, if no region active, it simply copy the current whole line
(defadvice kill-line (before check-position activate)
(if (member major-mode
'(emacs-lisp-mode scheme-mode lisp-mode
c-mode c++-mode objc-mode js-mode
latex-mode plain-tex-mode))
(if (and (eolp) (not (bolp)))
(progn (forward-char 1)
(just-one-space 0)
(backward-char 1)))))


(defadvice kill-ring-save (before slick-copy activate compile)
"When called interactively with no active region, copy a single line instead."
(interactive (if mark-active (list (region-beginning) (region-end))
(message "Copied line")
(list (line-beginning-position)
(line-beginning-position 2)))))


(defadvice kill-region (before slick-cut activate compile)
"When called interactively with no active region, kill a single line instead."
(interactive
(if mark-active (list (region-beginning) (region-end))
(list (line-beginning-position)
(line-beginning-position 2)))))


;; Copy line from point to the end, exclude the line break
(defun qiang-copy-line (arg)
"Copy lines (as many as prefix argument) in the kill ring"
(interactive "p")
(kill-ring-save (point)
(line-end-position))
;; (line-beginning-position (+ 1 arg)))
(message "%d line%s copied" arg (if (= 1 arg) "" "s")))


(global-set-key (kbd "M-k") 'qiang-copy-line)
  评论这张
 
阅读(917)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017