代码改变世界

emacs21.4 ssh终端连接方式配置文件

2010-09-02 21:50  Logic0  阅读(2321)  评论(0编辑  收藏  举报
我顶 字号:
;;author:Logic0
;;time:2009-7-27


;;启动窗口最大化
;;(setq default-frame-alist
;;'(
;;(top . 0)
;;(left . 0)
;;(height . 67)
;;(width . 138)
;;))

(fset 'yes-or-no-p 'y-or-n-p)
(display-time)
(transient-mark-mode t)
(show-paren-mode t)

;;隐藏工具条
;;(tool-bar-mode -1)
;;显示在右边
;;(set-scroll-bar-mode 'right)
;;不要临时文件
(setq-default make-backup-files nil)



(setq inhibit-startup-message t)
(setq default-major-mode 'text-mode)
(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)

(show-paren-mode t)
(setq show-paren-style 'parentheses)

;;(require 'ido)
;;(ido-mode t)
(setq ido-save-directory-list-file nil)
(require 'recentf)
(recentf-mode t)

;;括号匹配
(global-set-key "%" 'match-paren)
(defun match-paren (arg)
"Go to the matching paren if on a paren; otherwise insert %."
(interactive "p")
(cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
((looking-at "\\s\)") (forward-char 1) (backward-list 1))
(t (self-insert-command (or arg 1)))))
;;vim中fx的替代品
(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 a") 'wy-go-to-char)

(add-to-list 'load-path "/root/lisp")
(setq tramp-default-method "scp")
(setq tramp-auto-save-directory "/root/lisp")
(setq auto-save-file-name-transforms
      '(("\\`/[^/]*:\\(.+/\\)*\\(.*\\)" "/tmp/\\2")))
(setq tramp-chunksize 328)
(require 'ange-ftp)
(require 'tramp)

;;主题选择
(setq load-path (append load-path (list "/root/lisp/color-theme-6.6.0"))) 
(require 'color-theme)
;;(color-theme-oswald)
;;(color-theme-dark-blue)
;;(color-theme-blue-mood)
;;(color-theme-sitaramv-solaris)

;;设置编码格式
(prefer-coding-system 'utf-8)
;;设置字体
;;(create-fontset-from-fontset-spec
;;"-adobe-courier-medium-r-*-*-14-*-*-*-*-*-fontset-ifree",
;;"chinese-gb2312:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1",\
;;"chinese-gbk:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1",\
;;"chinese-gb18030:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1",\
;;"chinese-cns11643-5:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1",\
;;"chinese-cns11643-6:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1",\
;;"chinese-cns11643-7:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1")
;;(set-default-font "yaheiMonaco")
;;(add-to-list 'after-make-frame-functions
;;(lambda (new-frame) (select-frame new-frame)
;;(set-default-font "fontset-ifree")))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;test here;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;使用cedet工具
;;(add-to-list 'load-path
;;"/usr/local/share/emacs/site-lisp/cedet-1.0pre3")
;;(load-file "/usr/local/share/emacs/site-lisp/cedet-1.0pre3/common/cedet.el")
;;(semantic-load-enable-code-helpers)

;;for ecb ,speedbar
;;(add-to-list 'load-path
;;"/root/lisp/speedbar")
;;(require 'speedbar)

;;for ecb ,eieio
;;(add-to-list 'load-path
;;"/root/lisp/eieio")
;;(require 'eieio)

;;for ecb , senmantic
;;(add-to-list 'load-path
;;"/root/lisp/semantic")
;;(require 'semantic)
;;(setq semantic-load-turn-everything-on t)

;;using ecb
;;(add-to-list 'load-path
;;"/root/lisp/ecb-2.40")
;;(require 'ecb)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;test end;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;new test;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;cedet
(add-to-list 'load-path
"/root/lisp/cedet-1.0")
(load-file "~/lisp/cedet-1.0/common/cedet.el")
;;

;;ecb
(add-to-list 'load-path
"/root/lisp/ecb")
(require 'ecb)
(global-set-key [M-left] 'windmove-left)
(global-set-key [M-right] 'windmove-right)
(global-set-key [M-up] 'windmove-up)
(global-set-key [M-down] 'windmove-down)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;end new test;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;using xcscope
(setq load-path (append load-path (list "/root/lisp/cscope-15.7/contrib/xcscope")))
(require 'xcscope) 
 
(setq track-eol t)
;; 当光标在行尾上下移动的时候,始终保持在行尾。

(setq Man-notify-method 'pushy)
;; 当浏览 man page 时,直接跳转到 man buffer。

(setq-default kill-whole-line t)
;; 在行首 C-k 时,同时删除该行。



(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.
 '(display-time-mode t nil (time))
 '(ecb-compile-window-height nil)
 '(ecb-mouse-click-destination (quote last-point))
 '(ecb-options-version "2.32")
 '(ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2))
 '(ecb-tip-of-the-day nil)
 '(ecb-tree-buffer-style (quote ascii-guides))
 '(ecb-tree-indent 1)
 '(ecb-tree-truncate-lines nil)
 '(ecb-truncate-long-names t)
 '(show-paren-mode t nil (paren)))

;;(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.
 ;;'(default ((t (:inherit nil :stipple nil :background "DodgerBlue4" :foreground "white smoke" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 109 :width normal :foundry "apple" :family "Monaco")))))

(setq truncate-partial-width-windows nil)

(require 'xcscope)


;;有关c语言编程方面的设置
;;;; CC-mode配置 http://cc-mode.sourceforge.net/
(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)

;;;我的C/C++语言编辑策略
(defun my-c-indent-setup()
    (setq c-basic-offset 4)
    (setq indent-tabs-mode nil))
(add-hook 'c-mode-hook 'my-c-indent-setup)
(defun my-c-mode-common-hook()
(setq tab-width 4 indent-tabs-mode t)
;;; hungry-delete and auto-newline
(c-toggle-auto-hungry-state 1)
;;按键定义
(define-key c-mode-base-map [(control \`)] 'hs-toggle-hiding)
(define-key c-mode-base-map [(return)] 'newline-and-indent)
(define-key c-mode-base-map [(f7)] 'compile)
(define-key c-mode-base-map [(meta \`)] 'c-indent-command)
;; (define-key c-mode-base-map [(tab)] 'hippie-expand)
;;(define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)

;;预处理设置
;;(setq c-macro-shrink-window-flag t)
(setq c-macro-preprocessor "cpp")
(setq c-macro-cppflags " ")
(setq c-macro-prompt-flag t)
(setq hs-minor-mode t)
(setq abbrev-mode t)
)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

;;;;我的C++语言编辑策略
;;(defun my-c++-mode-hook()
;;(setq tab-width 4 indent-tabs-mode t)
;;(c-set-style "stroustrup")
;; (define-key c++-mode-map [f3] 'replace-regexp)
;;)

;;配置semantic检索的范围
(setq semanticdb-project-roots
(list
(expand-file-name "/")))

(defun my-indent-or-complete ()
(interactive)
(if (looking-at "\\>")
(hippie-expand nil)
(indent-for-tab-command))
)

(global-set-key [(control tab)] 'my-indent-or-complete)

(autoload 'senator-try-expand-semantic "senator")

(setq hippie-expand-try-functions-list
'(
senator-try-expand-semantic
try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-expand-list
try-expand-list-all-buffers
try-expand-line
try-expand-line-all-buffers
try-complete-file-name-partially
try-complete-file-name
try-expand-whole-kill
)
)
(defun eshell/clear ()
"04Dec2001 - sailor, to clear the eshell buffer."
(interactive)
(let ((inhibit-read-only t))
(erase-buffer)))

;;加入对auctex以方便对latex文件的编辑
;;(load "auctex.el" nil t t)
;;(setq TeX-auto-save t)
;;(setq TeX-parse-self t)
;;(setq-default TeX-master nil


;;color set 2010-9-2 13:47

;;(ansi-color-for-comint-mode-on)

;;(set-cursor-color "red")
;;(set-face-foreground 'font-lock-comment-face "#95917E")
;;(set-face-foreground 'font-lock-string-face "#61ce3c")
;;(set-face-foreground 'font-lock-keyword-face "#f8dd2d")
;;(set-face-foreground 'font-lock-function-name-face "#e3611f")
;;(set-face-foreground 'font-lock-variable-name-face "#98fbff")
;;(set-face-foreground 'font-lock-type-face "#A6E22E")
;;(set-face-foreground 'region "#272822")
;;(set-face-background 'region "#66D9EF")
;;(set-face-foreground 'font-lock-constant-face "#66d9ef")

;;(setq default-frame-alist
;;      '((background-color . "#0b0f20")
;;        (foreground-color . "#f8f8f2")
;;        (cursor-color . "red")
;;        (cursor-type . bar)))
;;------------------------------end-------------------------------
(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.
 )