2009年4月8日星期三

Emacs与Vim初始化文件备份

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; .emacs initial file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (eq emacs-major-version 22) ;; for cygwin platform
(progn
(setq emacs_pack "~/emacs_pack")
(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t) ;; for cygwin shell invocatioin
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
(setq ansi-color-for-comint-mode t)
(setq shell-file-name "/bin/bash")
(setenv "CYGWIN" "tty")
(setenv "PS1" "\\n\\e[1;37m[\\e[m\\e[1;32m\\u\\e[m\\e[1;33m@\\e[m\\e[1;35m\\h\\e[m \\e[4m\\w\\e[m\\e[1;37m]\\e[m\\e[1;36m\\n\\e[m\\\\$ "))
;; (setenv "CDPATH" (concat ".:~:/cygdrive/" (getenv "CDPATH"))))
(progn ;; for window xp platform

(setq emacs_pack "~/emacs_pack")
(add-to-list 'load-path (concat emacs_pack "/color-theme-6.6.0"))
;;; (setq shell-file-name "C:/cygwin/bin/bash")
(require 'color-theme)
(color-theme-initialize)
(color-theme-gnome)

;;; (setenv "PATH" (concat "c:/cygwin/bin;" (getenv "PATH")))
;;; (setq exec-path (cons "c:/cygwin/bin/" exec-path))
(add-to-list 'load-path emacs_pack)
;;; (require 'cygwin-mount)
;;; (cygwin-mount-activate)
;; replace DOS shell with cygwin bash shell
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)
(add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt nil t)
;;use (defvar Variable) to impl dynamic variable
(defvar explicit-shell-file-name)
(setq explicit-shell-file-name "bash.exe")
(setq shell-file-name explicit-shell-file-name)
(setenv "PS1" "\\n[\\u@\\h \\w]\\n\\$ ") ))
;;(load-file "~/emacs_pack/rfc-mode.el")


;; Load CEDET
(load-file "~/emacs_pack/cedet-1.0pre4/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)

(global-set-key [(f5)] 'speedbar)
(global-set-key [(f9)] 'speedbar-get-focus)
(setq semantic-load-turn-everything-on t)
(setq semantic-idle-scheduler-idle-time 432000)

(global-set-key [(f1)] 'ecb-activate)
(global-set-key [(f2)] 'ecb-deactivate)
(add-to-list 'load-path (concat emacs_pack "/ecb-2.32"))
;;(require 'ecb)
(require 'ecb-autoloads)

(add-to-list 'load-path (concat emacs_pack "/cscope-15.6/contrib/xcscope"))
(require 'xcscope)
(setq cscope-do-not-update-database t)


(global-set-key [(M @)] (quote set-mark-command))
(global-set-key [(C H)] (quote view-order-manuals))
(global-set-key [(C u)] (quote undo))
(show-paren-mode t)
(setq show-paren-style 'parentheses)
(menu-bar-mode 1)
(display-time-mode 1)
(tool-bar-mode 0)
(blink-cursor-mode 0)
(global-font-lock-mode t)
(global-hl-line-mode 1)

(global-set-key [(control tab)] 'my-indent-or-complete)
(setq-default abbrev-mode t)
(setq save-abbrevs t)
(setq dired-recursive-copies 'top)
(setq dired-recursive-deletes 'top)
(fset 'yes-or-no-p 'y-or-n-p)
(setq column-number-mode t)
(setq confirm-kill-emacs 'y-or-n-p)

(desktop-save-mode 1)

(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 ansi-color-for-comint-mode t)

(defun move-to-previous-window()
"go to previous window"
(interactive)
(other-window -1))

(global-set-key "p" (quote move-to-previous-window))
(global-set-key "" (quote ibuffer))
(global-set-key [(M n)] (quote View-scroll-line-backward))
(global-set-key [(M p)] (quote View-scroll-line-forward))


(setq frame-title-format "%n%F/%b")
(setq comment-multi-line nil)

(cond
((eq emacs-major-version 22) ; for CVS Emacs 22
(set-language-environment 'Chinese-GB)
(set-keyboard-coding-system 'chinese-iso-8bit)
(set-terminal-coding-system 'chinese-iso-8bit)
(set-clipboard-coding-system 'chinese-iso-8bit)
(set-selection-coding-system 'chinese-iso-8bit))
((eq emacs-major-version 23) ; for CVS Emacs 23
(set-language-environment 'Chinese-GBK)
(set-keyboard-coding-system 'chinese-gbk)
(set-terminal-coding-system 'chinese-gbk)
(set-clipboard-coding-system 'chinese-gbk)
;; (set-election-coding-system 'chinese-gbk)
))

(setq inhibit-startup-message t
report-emacs-bug-no-explanations t
default-major-mode 'text-mode
require-final-newline t
resize-mini-windows t
track-eol t
kill-whole-line t
Man-notify-method 'pushy
woman-cache-level 2
woman-cache-filename nil
kill-ring-max 200
vc-follow-symlinks t
vc-suppress-confirm t
enable-recursive-minibuffers t
default-fill-column 60
isearch-allow-scroll t
tooltip-gud-tips-p t)

(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.
'(blink-cursor-mode nil)
'(column-number-mode t)
'(display-time-mode t)
'(ecb-layout-window-sizes nil)
'(ecb-source-path (quote (#("/cygdrive/d/linux-2.4.34" 0 24 (help-echo "Mouse-2 toggles maximizing, mouse-3 displays a popup-menu")))))
'(show-paren-mode t)
'(transient-mark-mode (quote identity)))
(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.
)


(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)

(setq initial-frame-alist '((top . 0) (left . 58)
(width . 148) (height . 61)))

(defun my-c-mode-common-hook()
(setq tab-width 4 indent-tabs-mode nil)
(setq comment-multi-line nil)
(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 [(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)

(defun my-c++-mode-hook()
(setq tab-width 4 indent-tabs-mode nil)
;; (c-set-style "stroustrup")
)

(setq semanticdb-project-roots
(list
(expand-file-name "/")))

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

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

(setq visible-bell t)

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

(define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)

(add-to-list 'load-path (concat emacs_pack "/w3/lisp"))
(require 'w3-auto)

(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)

==============================================================

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" .exrc initial file (vi & vim)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

set ic
"set number
set showmatch
set gcr=a:block-blinkon0

"filetype plugin on
"set grepprg=grep\ -nH\ $*

"runing mode: increate mode
set nocompatible
"show complete command
set showcmd
"set backup auto
if has("vms")
set nobackup
else
set backup
set backupext=.bakup
set patchmode=.orig
endif
"set cursor col and row number
set ruler
"set history list
set history=50
"set incsearch
set incsearch
"show current mode
set showmode
"show hightlight search results
set hlsearch
"hightlight syntax
syntax on
"auto indent apon on file type
filetype indent on
set autoindent
"set indent size is 4
set sw=4
"tab size is 4
set ts=4

if(has("gui_running"))
set nowrap
set guioptions+=b
else
set wrap
endif

set backspace=indent,eol,start
set whichwrap=b,s,h,l

==============================================================

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" .gvimrc initial file (GVim)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"Toggle Menu and Toolbar
set guioptions-=m
set guioptions-=T
map :if &guioptions =~# 'T'
\set guioptions-=T
\set guioptions-=m
\else
\set guioptions+=T
\set guioptions+=m
\endif

set ic
"set number
set showmatch
set gcr=a:block-blinkon0

"filetype plugin on
"set grepprg=grep\ -nH\ $*

"runing mode: increate mode
set nocompatible
"show complete command
set showcmd
"set backup auto
if has("vms")
set nobackup
else
set backup
set backupext=.bakup
set patchmode=.orig
endif
"set cursor col and row number
set ruler
"set history list
set history=50
"set incsearch
set incsearch
"show current mode
set showmode
"show hightlight search results
set hlsearch
"hightlight syntax
syntax on
"auto indent apon on file type
filetype indent on
set autoindent
"set indent size is 4
set sw=4
"tab size is 4
set ts=4

if(has("gui_running"))
set nowrap
set guioptions+=b
else
set wrap
endif

set backspace=indent,eol,start
set whichwrap=b,s,h,l


==============================================================

#############################################################
# .bash initial file
#############################################################

#PATH="/bin:$PATH"
#PATH="/cadappl/bin:/bin:/usr/X11R6/bin:$HOME/cadbin:.:$PATH"
#export PS1="\n\e[1;37m[\e[m\e[1;32m\u\e[m\e[1;33m@\e[m\e[1;35m\h\e[m \e[4m\`pwd\`\e[m\e[1;37m]\e[m\e[1;36m\n\e[m\\$ "
alias ls='ls --color'

==============================================================

Note: if you use emacs under the Cygwin platform, you must add the window env( CYGWIN = tty) and the better to set (HOME = YOU_HOME_DIR)

没有评论:

发表评论