我的 .emacs

(global-linum-mode 1)

;;color theme
(require 'color-theme)
(color-theme-gnome2)

;;session
;;(add-to-list 'load-path "/usr/share/emacs/extension/")
(require 'session)
  (add-hook 'after-init-hook 'session-initialize)

(load "desktop")
(desktop-load-default)
(desktop-read)

(require 'ibuffer)
(global-set-key (kbd "C-x C-b") 'ibuffer)

(require 'ido)
(ido-mode t)

;;swbuff
(add-to-list 'load-path "/usr/share/emacs/extension/")
(require 'swbuff)
(global-set-key (kbd "") 'swbuff-switch-to-previous-buffer)
(global-set-key (kbd "") 'swbuff-switch-to-next-buffer)
(setq swbuff-exclude-buffer-regexps
     '("^ " "\\*.*\\*"))
(setq swbuff-status-window-layout 'scroll)
(setq swbuff-clear-delay 1)
(setq swbuff-separator "|")
(setq swbuff-window-min-text-height 1)

(require 'tabbar)
(tabbar-mode)
(global-set-key [s-up] 'tabbar-backward-group)
(global-set-key [s-down] 'tabbar-forward-group)
(global-set-key [s-left] 'tabbar-backward)
(global-set-key [s-right] 'tabbar-forward)

(global-set-key (kbd "<f6>") 'speedbar)

(require 'recentf)
(recentf-mode 1)
(defun recentf-open-files-compl ()
  (interactive)
  (let* ((all-files recentf-list)
     (tocpl (mapcar (function
         (lambda (x) (cons (file-name-nondirectory x) x))) all-files))
     (prompt (append '("File name: ") tocpl))
     (fname (completing-read (car prompt) (cdr prompt) nil nil)))
    (find-file (cdr (assoc-ignore-representation fname tocpl)))))
(global-set-key [(control x)(control r)] 'recentf-open-files-compl)

(global-set-key [(meta ?/)] 'hippie-expand)
(setq hippie-expand-try-functions-list
      '(try-expand-dabbrev
    try-expand-dabbrev-visible
    try-expand-dabbrev-all-buffers
    try-expand-dabbrev-from-kill
    try-complete-file-name-partially
    try-complete-file-name
    try-expand-all-abbrevs
    try-expand-list
    try-expand-line
    try-complete-lisp-symbol-partially
    try-complete-lisp-symbol))

;;mark
(global-set-key [(control ?\.)] 'ska-point-to-register)
(global-set-key [(control ?\,)] 'ska-jump-to-register)
(defun ska-point-to-register()
  "Store cursorposition _fast_ in a register.
Use ska-jump-to-register to jump back to the stored
position."
  (interactive)
  (setq zmacs-region-stays t)
  (point-to-register 8))

(defun ska-jump-to-register()
  "Switches between current cursorposition and position
that was stored with ska-point-to-register."
  (interactive)
  (setq zmacs-region-stays t)
  (let ((tmp (point-marker)))
        (jump-to-register 8)
    (set-register 8 tmp)))

(defun wy-go-to-char (n char)
  "Move forward to Nth occurence of CHAR.
Typing `wy-go-to-char-key' again will move forwad to the next Nth
occurence of CHAR."
  (interactive "p\ncGo to char: ")
  (search-forward (string char) nil nil n)
  (while (char-equal (read-char)
         char)
    (search-forward (string char) nil nil n))
  (setq unread-command-events (list last-input-event)))
(define-key global-map (kbd "C-c f") 'wy-go-to-char)

(require 'ctypes)
(ctypes-auto-parse-mode 1)

;;simple happy config
(setq visible-bell t)
(setq inhibit-startup-message t)
(setq column-number-mode t)
(setq mouse-yank-at-point t)
(setq kill-ring-max 200)
(setq default-fill-column 80)
(setq scroll-margin 3
      scroll-conservatively 10000)
(show-paren-mode t)
(setq show-paren-style 'parentheses)
(mouse-avoidance-mode 'animate)
(setq frame-title-format "emacs@%b")
(auto-image-file-mode)
(global-font-lock-mode t)
(put 'set-goal-column 'disabled nil)
(put 'narrow-to-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'LaTeX-hide-environment 'disabled nil)
(setq user-full-name "Airead Fan")
(setq user-mail-address "fgh1987168@gmail.com")

(global-set-key [(f5)] 'gud-go)
(add-hook 'gdb-mode-hook '(lambda ()
            (define-key c-mode-base-map [(f5)] 'gud-go)
                            (define-key c-mode-base-map [(f7)] 'gud-step)
                            (define-key c-mode-base-map [(f8)] 'gud-next)))

(defun linux-c-mode ()
  "C mode with adjusted defaults for use with the Linux kernel."
  (interactive)
  (c-mode)
  (c-set-style "K&R")
  (setq tab-width 8)
  (setq indent-tabs-mode t)
  (setq c-basic-offset 8))
(add-to-list 'auto-mode-alist '("\.c$" . linux-c-mode))

(add-to-list 'load-path "/usr/share/emacs/extension" t)
(require 'smart-compile)
(global-set-key (kbd "<f9>") 'smart-compile)
(put 'dired-find-alternate-file 'disabled nil)

;; orgmode
(add-to-list 'load-path "/home/airead/org")
 (require 'org)                                   
 (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
 (add-hook 'org-mode-hook 'turn-on-font-lock);;ont need when global-font-lock-mode is on
 (define-key global-map "\C-cl" 'org-store-link)
 (define-key global-map "\C-ca" 'org-agenda)
 (define-key global-map "\C-cb" 'org-iswitchb)
 (setq org-log-done t)
;;自动换行
(add-hook 'org-mode-hook
    (lambda () (setq truncate-lines nil)))

;;CEDET
(add-to-list 'load-path "/home/airead/cedet/common" t)
(require 'cedet)
(require 'semantic-ia)
(semantic-load-enable-code-helpers)
(semantic-load-enable-semantic-debugging-helpers)
(global-set-key (kbd "M-n") 'semantic-ia-complete-symbol-menu)

(setq comment-style 'multi-line)


(defun insert-main ()
  "Insert head and main"
  (interactive)
  (insert "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>
#include <errno.h>\n#include <fcntl.h>\n#include <unistd.h>
#include <sys/types.h>\n#include <sys/stat.h>\n\nint main(int argc, char *argv[])
{\n\n}")
  (backward-char 2)
)
(global-set-key (kbd "C-c m") 'insert-main)

(global-set-key (kbd "M-]") 'delete-blank-lines)

(defun insert-author ()
  "Insert author and date"
  (interactive)
  (insert "/********************************************************\n")
  (insert " * @author  Airead Fan <fgh1987168@gmail.com>\t\t*\n")
  (insert " * @date    ")
  (insert (format-time-string "%Y%b %d %H:%M:%S %Z\t\t\t*" (current-time)))
  (insert "\n")
  (insert " ********************************************************\n")
  (insert " *\t\tafter studying C ")
  (insert (format "%d " (- (time-to-days (current-time)) (time-to-days (encode-time 0 0 0 18 7 2011 +0800)))))
  (insert "days\t\t*\n")
  (insert " *\t\tafter studying APUE ")
  (insert (format "%d " (- (time-to-days (current-time)) (time-to-days (encode-time 0 0 0 22 8 2011 +0800)))))
  (insert "days\t\t*\n")
  (insert " ********************************************************/\n")
  )
(global-set-key (kbd "C-c c") 'insert-author)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值