天天看点

emacs配置--包括gdb像vs2003一样多个可拉伸窗口和快捷键

;; .emacs

;;; uncomment this line to disable loading of "default.el" at startup

;; (setq inhibit-default-init t)

;; turn on font-lock mode

(when (fboundp 'global-font-lock-mode)

  (global-font-lock-mode t))

;;---------------china font-------------------------

;(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)

;;---------set F5 and so on----------------------------start-----------------

;;(setq gdb-many-windows t)

;;(global-set-key [f5] 'gdb)

;;(global-set-key [C-f5] 'gud-run)

;;(global-set-key [S-f5] 'gud-cont)

;;(global-set-key [f7] 'compile)

;;(global-set-key [f8] 'gud-print)

;;(global-set-key [C-f8] 'gud-pstar)

;;(global-set-key [f9] 'gud-break)

;;(global-set-key [C-f9] 'gud-remove)

;;(global-set-key [f10] 'gud-next)

;;(global-set-key [C-f10] 'gud-until)

;;(global-set-key [S-f10] 'gud-jump)

;;(global-set-key [f11] 'gud-step)

;;(global-set-key [C-f11] 'gud-finish)

(global-set-key [(f1)] (lambda () (interactive) (manual-entry (current-word))))

(require 'gdb-ui)                                                           

(defun gdb-or-gud-go ()                                                     

  "If gdb isn't running; run gdb, else call gud-go."                        

  (interactive)                                                             

  (if (and gud-comint-buffer                                                

           (buffer-name gud-comint-buffer)                                  

           (get-buffer-process gud-comint-buffer)                           

           (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)))

      (gud-call (if gdb-active-process "continue" "run") "")                

    (gdb (gud-query-cmdline 'gdb))))                                        

(defun gud-break-remove ()                                                  

  "Set/clear breakpoin."                                                    

  (interactive)                                                             

  (save-excursion                                                           

    (if (eq (car (fringe-bitmaps-at-pos (point))) 'breakpoint)              

        (gud-remove nil)                                                    

      (gud-break nil))))                                                    

(defun gud-kill ()                                                          

  "Kill gdb process."                                                       

  (interactive)                                                             

  (with-current-buffer gud-comint-buffer (comint-skip-input))               

  (kill-process (get-buffer-process gud-comint-buffer)))                    

(setq gdb-many-windows t)                                                   

(global-set-key [f5] 'gdb-or-gud-go)                                        

;; (global-set-key [S-f5] '(lambda () (interactive) (gud-call "quit" nil))) 

(global-set-key [S-f5] 'gud-kill)                                           

(global-set-key [f7] '(lambda () (interactive) (compile compile-command)))  

(global-set-key [f8] 'gud-print)                                            

(global-set-key [C-f8] 'gud-pstar)                                          

(global-set-key [f9] 'gud-break-remove)                                     

;; (global-set-key [f9] 'gud-break)                                         

;; (global-set-key [C-f9] 'gud-remove)                                      

(global-set-key [f10] 'gud-next)                                            

(global-set-key [C-f10] 'gud-until)                                         

(global-set-key [S-f10] 'gud-jump)                                          

(global-set-key [f11] 'gud-step)                                            

(global-set-key [C-f11] 'gud-finish)

;; disp time

(setq display-time-24hr-format t)

(setq display-time-day-and-date t)

(display-time)

(global-set-key [f4] 'other-window) 

(global-set-key [(f12)] 'speedbar-get-focus)

(define-key-after (lookup-key global-map [menu-bar tools])

        [speedbar] '("Speedbar" . speedbar-frame-mode) [calendar])

 ;; the four key sequence map to the numpad up,down,left,right on 101 keyboard

;;(global-set-key "/eOr" 'shrink-window)

;;(global-set-key "/eOx" 'enlarge-window)

(global-set-key [f2] 'shrink-window)

(global-set-key [f3] 'enlarge-window)

(global-set-key "/eOt" 'shrink-window-horizontally)

;; (global-set-key "/eOv" 'enlarge-window-horizontally)

;; two syntax, here for example

(global-set-key [(meta O)(v)] 'enlarge-window-horizontally)

;; toggle gdb-many-windows

(add-hook 'gdb-mode-hook

      '(lambda ()

         (local-set-key [(f6)] 'gdb-many-windows)

         )

      )

;;--------- set quick key----------------------------end-----------------

;; enable visual feedback on selections

;(setq transient-mark-mode t)

;; default to better frame titles

(setq frame-title-format

      (concat  "%b - emacs@" system-name))

(custom-set-variables

 '(tab-width 4))

(put 'upcase-region 'disabled nil)

;; disp line num

;;(setq column-number-mode t)

;;(setq line-number-mode t)

;;(load-file "~/.emacs.d/tiger-emacs/wb-line-number.el")

;;(require 'wb-line-number)

;;(wb-line-number-toggle)

(load-file "~/.emacs.d/tiger-emacs/linum.el")

(require 'linum)

(add-hook 'find-file-hook 'linum-mode)

(add-to-list 'load-path  "~/.emacs.d/tiger-emacs/color-theme-6.6.0")

(load-file "~/.emacs.d/tiger-emacs/color-theme-6.6.0/color-theme.el")

(require 'color-theme)

(color-theme-initialize)

(color-theme-tty-dark)

;;(color-theme-comidia)

;;(color-theme-dark-laptop)

;;(color-theme-arjen)

;;(color-theme-beige-diff)

;;(color-theme-blue-erc)

;;(color-theme-blue-gnus)

;;ecb config

(custom-set-variables

  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!

  ;; Your init file should contain only one such instance.

 '(auto-compression-mode t nil (jka-compr))

 '(c-backspace-function (quote delete-backward-char))

 '(c-default-style (quote ((c-mode . "stroustrup") (c++-mode . "stroustrup") (objc-mode . "stroustrup") (java-mode . "stroustrup") (other . "stroustrup"))))

 '(c-tab-always-indent nil)

 '(case-fold-search t)

 '(compilation-window-height 15)

 '(compile-command "make ")

 '(ecb-auto-activate t)

 '(ecb-layout-name "right1")

 '(ecb-options-version "2.32")

 '(ecb-source-path (quote ("~/")))

 '(ecb-toggle-layout-sequence (quote ("left8" "left9" "left7" "top1" "top2")))

 '(ecb-tree-indent 1)

 '(ecb-windows-width 0.23)

 '(grep-command "grep -n ")

 '(kill-read-only-ok nil)

 '(kill-whole-line t)

 '(next-screen-context-lines 5)

 '(scroll-conservatively 300)

 '(tab-width 4)

 '(truncate-partial-width-windows nil)

 '(uniquify-buffer-name-style (quote forward) nil (uniquify)))

(add-hook 'c++-mode-hook 'hs-minor-mode)

(add-hook 'c-mode-hook 'hs-minor-mode)

(add-to-list 'auto-mode-alist '("//.h//'" . c++-mode))

;;(custom-set-faces

  ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!

  ;; Your init file should contain only one such instance.

 ;;'(ecb-default-highlight-face ((((class color) (background light)) (:background "blue" :foreground "yellow" :weight bold))))

 ;;'(font-lock-builtin-face ((((type tty) (class color)) (:foreground "blue" :weight semi-light))))

 ;;'(font-lock-comment-face ((t (:foreground "green" :weight bold))))

 ;;'(font-lock-constant-face ((((type tty) (class color)) (:foreground "red"))))

 ;;'(font-lock-function-name-face ((((type tty) (class color)) (:foreground "blue" :weight extra-light))))

 ;;'(font-lock-keyword-face ((((type tty) (class color)) (:foreground "blue" :weight extra-light))))

 ;;'(font-lock-string-face ((((type tty) (class color)) (:foreground "magenta"))))

 ;;'(font-lock-type-face ((((type tty) (class color)) (:foreground "yellow" :weight bold))))

 ;;'(font-lock-variable-name-face ((t (:foreground "red" :weight bold))))

 ;;'(font-lock-warning-face ((((type tty) (class color)) (:foreground "magenta" :weight bold))))

 ;;'(mode-line ((t (:background "yellow" :foreground "black"))))

 ;;)

(global-set-key [(meta O)(q)] 'ecb-goto-window-directories)

(global-set-key [(meta O)(s)] 'ecb-goto-window-sources)   

(global-set-key [(meta O)(w)] 'ecb-goto-window-methods)   

(global-set-key [(meta O)(y)] 'ecb-goto-window-history)

(global-set-key [(meta O)(u)] 'ecb-goto-window-edit1)

;;speedbar config

(add-to-list 'load-path "~/.emacs.d/tiger-emacs/speedbar-0.14beta4")

(autoload 'speedbar-frame-mode "speedbar" "Popup a speedbar frame" t)

(autoload 'speedbar-get-focus "speedbar" "Jump to speedbar frame" t)

;;eieio config

(add-to-list 'load-path "~/.emacs.d/tiger-emacs/eieio-0.17")

;;semantic config

(add-to-list 'load-path "~/.emacs.d/tiger-emacs/semantic-1.4.4")

(setq semantic-load-turn-everything-on t)

(require 'semantic-load)

(setq semantic-change-hooks nil)

;;ecb config

(add-to-list 'load-path "~/.emacs.d/tiger-emacs/ecb-2.32")

;(require 'ecb)

;(require 'ecb-autoloads)

下一篇: emacs backup

继续阅读