vim以及emacs配置备份

仅供存放个人的配置文件,不要在本版发问。
回复
风间星魂
帖子: 490
注册时间: 2009-06-20 23:53

vim以及emacs配置备份

#1

帖子 风间星魂 » 2010-01-23 19:22

代码: 全选

" Author:封建叔叔
" Email:fuzhengxiong#gmail.com
"=========================================================

" ================================================================
"vimim设置
let g:vimim_chinese_frequency=20 
"===============================================================================
"python设置
let g:pydiction_location = "D:/Program Files (x86)/Vim/vimfiles/ftplugin/pydiction/complete-dict" "补全文件路径
let g:pydiction_menu_height = 20 "补全菜单高度
"================================================================================
"自动补全设置
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType java set omnifunc=javacomplete#Complete
"====================================================================================
"autocmd FileType text setlocal textwidth=78
"set tw=78 fo+=Mm "78字符自动断行
autocmd BufReadPost * if line("'\"") && line("'\"") <= line("$") | exe "normal `\"" | endif  "光标位置记忆
"输入[,/]正向search,[,?]反向
vnoremap <silent> ,/ y/<C-R>=escape(@", '\\/.*$^~[]')<CR><CR>  
vnoremap <silent> ,? y?<C-R>=escape(@", '\\/.*$^~[]')<CR><CR>
 "绘图快捷键
map <F1> :call ToggleSketch()<CR>   

"编译快捷键
map <F5> :call CompileRun()<CR>
map <C-F5> :call Debug()<CR> 
"界面设置
set guioptions-=r  "移除滚动条"
set guioptions-=L "去掉右分割窗口的滚动条"

set guioptions-=T "移除菜单"

"set guioptions-=m

let g:html_tag_case = "lowercase"    "html小写

set fileformats=unix,dos,mac "文件os类型
set sessionoptions+=unix,slash "unix-Windows 兼容方式

"================================================================================
autocmd GUIEnter * simalt ~x "开机全屏

set novisualbell
" 启动的时候不显示那个援助索马里儿童的提示
"set shortmess=atI
" 与windows共享剪贴板
set clipboard+=unnamed
" 高亮显示普通txt文件(需要txt.vim脚本)

"au BufRead,BufNewFile *  setfiletype txt


"==============================================================================
"ctags 快捷键
map <F7> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q
map :!ctags -R --c-kinds=+p --fields=+S
map <F6> :!ctags -R --c-kinds=+p --fields=+iaS --extra=+q "D:/文档/"
map <F2> :NERDTree<CR>
"ctags 设置
"===============================================================================
set path+=.,D:/MinGW/include/ 
"set path+=.,D:/文档/
set tags=tags;
set autochdir

set tags+=./tags,D:/文档/tags,D:/MinGW/include/tags
if has('multi_byte_ime')
	    highlight Cursor guibg=Green guifg=NONE
	    highlight CursorIM guibg=Purple guifg=NONE
	endif

set encoding=utf-8
"解决菜单乱码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
language message zh_CN.UTF-8
set fileencodings=utf-8,gb18030,ucs-bom,gbk,gb2312,cp936,big5,euc-jp,euc-kr,latin1
set termencoding=utf-8,gb18030,ucs-bom,gbk,cp936,gb2312,big5,euc-jp,euc-kr,latin1
" 英文字体
set guifont=Consolas:h11
"中文字体
set guifontwide=youyuan:h12
set tabstop=4 " 设置tab键的宽度
set backspace=2 " 设置退格键可用
set nu! " 显示行号
set guioptions-=brl "不显示右滚动条
"set vbt_vb= " vim进行编辑时,如果命令错误,会发出一个响声,该设置去掉响声
"set wrap " 自动换行
"set nowrap " 不自动换行
"set linebreak " 整词换行
set whichwrap=b,s,<,>,[,] " 光标从行首和行末时可以跳到另一行去
set list " 显示制表符
"set listchars = tab:>-,trail:- " 将制表符显示为'>---',将行尾空格显示为'-'
set listchars=tab:.\ ,trail:. " 将制表符显示为'. '
set autochdir " 自动设置目录为正在编辑的文件所在的目录
set hidden " 没有保存的缓冲区可以自动被隐藏
set scrolloff=5
colors blackboard "配色

"let g:SuperTabRetainCompletionType = 2
"let g:SuperTabDefaultCompletionType = "<C-X><C-O>" 
let Tlist_Ctags_Cmd="ctags.exe"
let c_support="D:/Program Files (x86)/Vim/vim72/c-support"
set cursorline      " 增加鼠标水平线
"set cursorcolumn    " 增加鼠标直线
"--------------------------------------------------------------------------------
" 查找/替换相关的设置
"--------------------------------------------------------------------------------
set hlsearch " 高亮显示搜索结果
set incsearch " 查询时非常方便,如要查找book单词,当输入到/b时,会自动找到
" 第一个b开头的单词,当输入到/bo时,会自动找到第一个bo开头的
" 单词,依次类推,进行查找时,使用此设置会快速找到答案,当你
" 找要匹配的单词时,别忘记回车
set gdefault " 替换时所有的行内匹配都被替换,而不是只有第一个

"--------------------------------------------------------------------------------
" 状态栏相关的设置
"--------------------------------------------------------------------------------
set statusline=[%F]%y%r%m%*%=%k[%{(&fenc==\"\")?&enc:&fenc}%{(&bomb?\",BOM\":\"\")}].[%{&ff}].ASCII=[\%03.3b\].HEX=[\%02.2B\].[行:%l/%L,列:%c][%p%%] 
set laststatus=2 "状态栏数
set ruler " 在编辑过程中,在右下角显示光标位置的状态行

"--------------------------------------------------------------------------------
" 编程相关的设置
"--------------------------------------------------------------------------------
set completeopt=longest,menu " 关掉智能补全时的预览窗口
filetype plugin indent on " 加了这句才可以用智能补全


syn on " 打开语法高亮
set showmatch " 设置匹配模式,类似当输入一个左括号时会匹配相应的那个右括号
set smartindent " 智能对齐方式
set shiftwidth=4 " 换行时行间交错使用4个空格
set autoindent " 自动对齐
set ai! " 设置自动缩进
set makeprg=gcc\ -Wall "手动设置编译器
"定义CompileRun函数,用来调用进行编译和运行
func CompileRun()
exec "w"
"C程序
if &filetype == 'c'
exec "!gcc % -g -o %<"
exec "!%<"
endif
endfunc
"结束定义CompileRun

"定义Debug函数,用来调试程序
func Debug()
exec "w"
"C程序
if &filetype == 'c'
exec "!gcc % -g -o %<"
exec "!gdb %<"
endif
endfunc
"结束定义Debug 

"--------------------------------------------------------------------------------
" 代码折叠
"--------------------------------------------------------------------------------
"set foldmarker={,}
"set foldmethod=marker
set foldmethod=syntax
set foldlevel=100 " Don't autofold anything (but I can still fold manually)
"set foldopen-=search " don't open folds when you search into them
"set foldopen-=undo " don't open folds when you undo stuff
"set foldcolumn=4
set foldmethod=manual "手动折叠


"--------------------------------------------------------------------------------
" 模仿MS Windows中的快捷键
"--------------------------------------------------------------------------------
"vmap <C-c> "yy
"vmap <C-x> "yd
"nmap <C-v> "yp
"vmap <C-v> "yp
"nmap <C-a> ggvG$

"--------------------------------------------------------------------------------
" 窗口操作的快捷键
"--------------------------------------------------------------------------------
nmap wv <C-w>v " 垂直分割当前窗口
nmap wc <C-w>c " 关闭当前窗口
nmap ws <C-w>s " 水平分割当前窗口

"--------------------------------------------------------------------------------
" 模仿MS Windows中的保存命令: Ctrl+S
"--------------------------------------------------------------------------------
"imap <C-s> <Esc>:wa<cr>i<Right>
"nmap <C-s> :wa<cr>

"###############################################################################
" The following is the Plugins' setting
"###############################################################################

"--------------------------------------------------------------------------------
" TagList :Tlist
"--------------------------------------------------------------------------------
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow = 1
"let Tlist_Use_Right_Window=1

"--------------------------------------------------------------------------------
" netrw 文件浏览器 :e <PATH>
"--------------------------------------------------------------------------------
"let g:netrw_winsize = 30 " 浏览器宽度
"--------------------------------------------------------------------------------
" QuickFix
"--------------------------------------------------------------------------------
nmap cn :cn<cr> " 切换到下一个结果

nmap cp :cp<cr> " 切换到上一个结果

"--------------------------------------------------------------------------------
" WinManager :WMToggle
"--------------------------------------------------------------------------------
let g:winManagerWindowLayout='FileExplorer|TagList'
"let g:winManagerWidth = 30
"let g:defaultExplorer = 0
"nmap <C-w><C-b> :BottomExplorerWindow<cr> " 切换到最下面一个窗格
"nmap <C-w><C-f> :FirstExplorerWindow<cr> " 切换到最上面一个窗格
nmap wm :WMToggle<cr> " 是nomal模式的命令,不是Ex模式的

"--------------------------------------------------------------------------------
" MiniBufExp
"--------------------------------------------------------------------------------
"let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
"let g:miniBufExplModSelTarget = 1

"--------------------------------------------------------------------------------
" cscope
"--------------------------------------------------------------------------------
cs add /home/pavio/CAD/CAD_R/cscope.out /home/pavio/CAD/CAD_R
set cscopequickfix=s-,c-,d-,i-,t-,e-
set cscopetag
" 按下面这种组合键有技巧,按了<C-_>后要马上按下一个键,否则屏幕一闪
" 就回到nomal状态了
" <C-_>s的按法是先按"Ctrl+Shift+-",然后很快再按"s"
nmap <C-_>s :cs find s <C-R>=expand("<cword>")<cr><cr> :cw<cr>
nmap <C-g> :cs find g <C-R>=expand("<cword>")<cr><cr> :cw<cr>
nmap <C-f> :cs find c <C-R>=expand("<cword>")<cr><cr> :cw<cr>
nmap <C-_>t :cs find t <C-R>=expand("<cword>")<cr><cr> :cw<cr>
nmap <C-_>e :cs find e <C-R>=expand("<cword>")<cr><cr> :cw<cr>
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<cr><cr>
nmap <C-_>i :cs find i <C-R>=expand("<cfile>")<cr><cr> :cw<cr>
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<cr><cr> :cw<cr>

"--------------------------------------------------------------------------------
" Grep
"--------------------------------------------------------------------------------
"直接按下<F3>键来查找光标所在的字符串
nnoremap <silent> <F3> :Rgrep<CR>

"--------------------------------------------------------------------------------
" A
"--------------------------------------------------------------------------------
"nnoremap <silent> <F12> :A<CR>

"--------------------------------------------------------------------------------
" NERD_commenter
"--------------------------------------------------------------------------------
let NERD_c_alt_style = 1 " 将C语言的注释符号改为//, 默认是/**/
"nmap <F5> ,cc

"--------------------------------------------------------------------------------
" SuperTab :SuperTabHelp
"--------------------------------------------------------------------------------
let g:SuperTabRetainCompletionType = 1 "SuperTab纪录补全操作
let g:SuperTabDefaultCompletionType = "<C-X><C-O>" "设置初时补全方式

"--------------------------------------------------------------------------------
" CVim :help csupport
"--------------------------------------------------------------------------------
let g:C_Comments = "no" " 用C++的注释风格
let g:C_BraceOnNewLine = "no" " '{'是否独自一行
let g:C_AuthorName = "pavio"
let g:C_Project="F9"
let g:Cpp_Template_Function = "c++-function-description-fengjian"
let g:C_TypeOfH = "c++" " *.h文件的文件类型是C还是C++

" REQUIRED. This makes vim invoke latex-suite when you open a tex file.
filetype plugin on

" IMPORTANT: win32 users will need to have 'shellslash' set so that latex
" can be called correctly.
set shellslash

" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse latex-suite. Set your grep
" program to alway generate a file-name.
set grepprg=grep\ -nH\ $*

" OPTIONAL: This enables automatic indentation as you type.
filetype indent on

"新建.c,.h,.sh,.java文件,自动插入文件头
autocmd BufNewFile *.[ch],*.sh,*.java exec ":call SetTitle()" 

"定义函数SetTitle,自动插入文件头
func SetTitle()
"如果文件类型为.sh文件
if &filetype == 'sh'
call setline(1, "\#########################################################################")
call append(line("."), "\# Author: WilliamChang")
call append(line(".")+1, "\# Created Time: ".strftime("%c"))
call append(line(".")+2, "\# File Name: ".expand("%"))
call append(line(".")+3, "\# Description: ")
call append(line(".")+4, "\#########################################################################")
call append(line(".")+5, "\#!/bin/bash")
call append(line(".")+6, "")
else
call setline(1, "/*************************************************************************")
call append(line("."), " Author: WilliamChang")
call append(line(".")+1, " Created Time: ".strftime("%c"))
call append(line(".")+2, " File Name: ".expand("%"))
call append(line(".")+3, " Description: ")
call append(line(".")+4, " ************************************************************************/")
call append(line(".")+5, "")
endif
endfunc
map <F4> :Tlist<cr>
    let Tlist_Use_Right_Window=1
    let Tlist_File_Fold_Auto_Close=1

let g:winManagerWindowLayout='FileExplorer|TagList'
nmap wm :WMToggle<cr> 
"WMToggle 工具


""""""""""""""""""""""""""""""
   " showmarks setting
   """"""""""""""""""""""""""""""
   " Enable ShowMarks
   let showmarks_enable = 0
   " Show which marks
   let showmarks_include = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
   " Ignore help, quickfix, non-modifiable buffers
   let showmarks_ignore_type = "hqm"
   " Hilight lower & upper marks
   "let showmarks_hlline_lower = 1
   "let showmarks_hlline_upper = 1
""""""""""""""""""""""""""""""
" Tag list (ctags)
""""""""""""""""""""""""""""""

let g:EclimTaglistEnabled=0 "停止使用Eclim

"##################################################################
"########################## End Of Vimrc ##########################
"##################################################################



上次由 风间星魂 在 2010-02-04 14:23,总共编辑 1 次。
风间星魂
帖子: 490
注册时间: 2009-06-20 23:53

Re: vim以及emacs配置备份

#2

帖子 风间星魂 » 2010-01-23 19:29

代码: 全选

map A <Nop>
map <C-q> <Nop>
map <C-o> <Nop>
map <C-i> <Nop>
map <C-z> <Nop>
map <C-p> <Nop>
map < <C-6>
noremap > g$
map U :ju<CR>
map <C-.> :tabm<CR>


noremap ] ]]
noremap [ [[
noremap h H
noremap l L
noremap j <C-d>
noremap k <C-u>
noremap a gt
noremap s gT
noremap <C-V> <C-v>
noremap <C-Z> <C-z>
noremap <C-c> <C-v><C-c>
noremap <C-a> <C-v><C-a>
cnoremap <C-c> <C-v><C-c>
cnoremap <C-v> <C-v><C-v>
cnoremap <C-x> <C-v><C-x>
inoremap <C-a> <C-v><C-a>
inoremap <C-c> <C-v><C-c>
inoremap <C-v> <C-v><C-v>
inoremap <C-x> <C-v><C-x>
inoremap <C-z> <C-v><C-z>
inoremap <C-y> <C-v><C-y>
noremap <C-b> <C-v><C-b>
noremap <C-y> <C-v><C-y>


set guioptions-=brl
" 不显示右边的滚动条
" 自动翻页,也可以用FF的别的插件实现。用[[ 是上一页,]]是下一页。
set nextpattern=\s*下一页|下一张|下页\s*,\bnext\b,^>$,^(>>|»)$,^(>|»),(>|»)$,\bmore\b
set previouspattern=\s*上一页|上一张|上页\s*,\bprev|previous\b,^<$,^(<<|«)$,^(<|«),(<|«)$
:set editor=gvim\ -f

" 用F2显示工具条,因为用xyzproxy这个插件,要打开代理还是要让他出来的。
""" == javascript ==
js<<EOF
// Toggle Tool bar
liberator.globalVariables['sx_gopt'] = 'T'  
toggle_bar = function () {
    toggle_status = liberator.globalVariables['sx_gopt'];
    liberator.globalVariables['sx_gopt'] = (toggle_status == ''? 'T': '');
    liberator.execute('set guioptions=' + toggle_status);
}
EOF

" map to js functions 
map <silent> <F2> :js toggle_bar() <CR>

上次由 风间星魂 在 2010-02-07 18:21,总共编辑 1 次。
风间星魂
帖子: 490
注册时间: 2009-06-20 23:53

Re: vim以及emacs配置备份

#3

帖子 风间星魂 » 2010-01-23 19:33

代码: 全选

;##################################################
;#           fengjian'.emacs                      #
;##################################################
;========Auto-down========

(add-to-list 'load-path "~/.emacs.d/emplugin")
(require 'auto-install)

(add-to-list 'load-path
             "~/.emacs.d/emplugins")
(require 'yasnippet-bundle)

(require 'auto-complete)
(global-auto-complete-mode t)


(setq auto-install-directory"~/.emacs.d/emplugin/auto-install")

;(auto-install-update-emacswiki-package-name t)
;(setq url-proxy-services '(("http" . "localhost:8339")))

(require 'anything-auto-install)
(setq auto-install-save-confirm nil)
(auto-install-compatibility-setup)
;================EDIT======================
(setq bookmark-default-file "~/.emacs.d/.emacs.bmk") ;书签目录
(setq abbrev-file-name "~/.emacs.d/.abbrev_defs") 
(setq custom-file "~/.emacs.d/elisp/hvj-custom.el") ;菜单目录 
(setq backup-directory-alist '(("." . "D:/txt")));自动备份目录

;---------Set-key-----------
(global-set-key [?\S- ] 'set-mark-command) ;绑定mark命令到S-SPC

;浏览剪贴板中的内容,绑定到 'C-c k'.
;(require 'browse-kill-ring)
;(global-set-key [(control c)(k)] 'browse-kill-ring)
;(browse-kill-ring-default-keybindings)



;----------------------
(setq current-language-environment "UTF-8")
;(setq local-coding-system 'utf-8)
;(set-keyboard-coding-system 'utf-8)
;(set-terminal-coding-system 'utf-8)
;(set-selection-coding-system 'utf-8)
;(prefer-coding-system 'utf-8))

;----------END------------
(scroll-bar-mode nil);去掉滚动条
;----------字体-----------

;(set-default-font "dejavu sans yuanti mono") ;默认字体
;(set-fontset-font (frame-parameter nil 'font)
;             'han'("dejavu sans yuanti"."unicode-bmp"))

;-------------------
;;===================设置支待中文=========================
;(set-terminal-coding-system 'chinese-iso-8bit)
;(set-keyboard-coding-system 'chinese-iso-8bit)
;(set-language-environment 'chinese-gb)
;(set-clipboard-coding-system 'chinese-iso-8bit)
;(set-selection-coding-system 'chinese-iso-8bit)
;(setq locale-coding-system 'chinese-iso-8bit)
;(setq current-language-environment "Chinese-GB")

;;----------------中文字体-----------------------------
(setq w32-charset-info-alist(cons '("gbk" w32-charset-gb2312 . 936) w32-charset-info-alist))
(setq default-frame-alist(append'((font . "fontset-gbk")) default-frame-alist))
(create-fontset-from-fontset-spec
    "-outline-Courier New-normal-r-normal-normal-16-97-96-96-c-*-fontset-gbk")
(set-fontset-font    "fontset-default" nil
    "-outline-新宋体-normal-r-normal-*-14-*-96-96-c-*-iso10646-1" nil 'prepend)
(set-fontset-font "fontset-gbk" 'kana
    "-outline-新宋体-normal-r-normal-*-14-*-96-96-c-*-iso10646-1" nil 'prepend)
(set-fontset-font    "fontset-gbk" 'han
    "-outline-新宋体-normal-r-normal-*-14-*-96-96-c-*-iso10646-1" nil 'prepend)
(set-fontset-font "fontset-gbk" 'cjk-misc
    "-outline-新宋体-normal-r-normal-*-14-*-96-96-c-*-iso10646-1" nil 'prepend)
(set-fontset-font "fontset-gbk" 'symbol
    "-outline-新宋体-normal-r-normal-*-14-*-96-96-c-*-iso10646-1" nil 'prepend)
(set-default-font "fontset-gbk") 

;=========================================================
(require 'unicad);编码识别
;================Edit-end=====================

(setq default-directory "D:/txt");工作目录
;================basic========================
;-----------------X------------------
(tool-bar-mode -1);去掉工具栏

(show-paren-mode t);高亮显示成对括号,但不来回弹
(setq show-paren-style 'parentheses)
(fset 'yes-or-no-p 'y-or-n-p);使用 y or n 提问
;显示时间以及格式
 (display-time)
 (setq display-time-24hr-format t)
 (setq display-time-day-and-date t)
 (setq display-time-interval 10)

(setq x-select-enable-clipboard t);; 支持emacs和外部程序的粘贴
(blink-cursor-mode nil);;光标不闪
(setq-default cursor-type 'bar);;光标显示为一竖线
(setq x-select-enable-clipboard t);;使用X剪贴板
(set-clipboard-coding-system 'ctext);;设定剪贴板内容格式,适应Firefox
(column-number-mode t);显示列号
(auto-image-file-mode t);打开图片显示
(global-auto-revert-mode) ;自动load新文件
(require 'hl-line) ;高亮当前行
(global-hl-line-mode t)

(set-scroll-bar-mode nil)
 
(setq scroll-margin 3 scroll-conservatively 10000)
(setq-default auto-fill-function 'do-auto-fill)
(setq default-fill-column 120)

;(require 'wb-line-number)
;(wb-line-number-enable);显示行号

(if window-system
    (autoload 'keisen-mode "keisen-mouse" "MULE table" t)
  (autoload 'keisen-mode "keisen-mule" "MULE table" t)) ;表格


(setq frame-title-format "fengjian@%f%b");标题栏显示 %f 缓冲区完整路径 %p 页面百分数 %l 行号
(setq default-major-mode 'text-mode);打开为text
(setq default-tab-width 4);tab宽度为4
(setq tab-width 4 indent-tabs-mode nil);tab为4,预排版
(show-paren-mode t);显示括号匹配
(add-hook 'write-file-hooks 'time-stamp)
(setq time-stamp-format "%:u %02m/%02d/%04y %02H:%02M:%02S");记录修改时间
(transient-mark-mode t);高亮选择
(setq-default make-backup-files nil);不要生成临时文件
(setq visible-bell t);去掉tab声音
(condition-case err
     (progn
     (require 'xxx) )
   (error
    (message "Can't load xxx-mode %s" (cdr err))));忽视启动错误
;====================basic-end======================

(setq dired-recursive-copies t);可以删除目录
(setq dired-recursive-deletes t) 

;-------------------版本控制-------------
(setq version-control t)
(setq kept-new-versions 3)
(setq delete-old-versions t)
(setq kept-old-versions 2)
(setq dired-kept-versions 1)

;----------------------------------
(require 'color-theme)
(color-theme-tty-dark);色彩主题
;====================w3m====================

(setq w3m-default-display-inline-images t);打开w3m图片显示

;====================w3m-end================



;---------Email-----------
(setq message-cite-function 'message-cite-original-without-signature)
(add-hook 'mail-citation-hook 'sc-cite-original) 
;----------------------------------
;(require 'bbdb) ;地址
;(bbdb-initialize 'gnus 'message) 

;---------email-end-------

;---------------------
;(setq ps-printer-name t)
;     (setq ps-lpr-command "D:/CTEX/GSview/gsview/gsview.exe")
;     (setq ps-lpr-switches '("-q" "-dNOPAUSE" "-dBATCH"
;     			"-sDEVICE=mswinpr2"
;     			"-sPAPERSIZE=a4"))





;---------------------
(setq kill-ring-max 200) ;删除纪录
;------------------;编码顺序

(setq font-encoding-alist
(append '(("MuleTibetan-0" (tibetan . 0))
("GBK" (chinese-gbk . 0))
("JISX0208" (japanese-jisx0208 . 0))
("JISX0212" (japanese-jisx0212 . 0))
("VISCII" (vietnamese-viscii-lower . 0))
("KSC5601" (korean-ksc5601 . 0))
("MuleArabic-0" (arabic-digit . 0))
("MuleArabic-1" (arabic-1-column . 0))
("MuleArabic-2" (arabic-2-column . 0))) font-encoding-alist)) 
;-------------------

;================日历==================
(setq calendar-week-start-day 1) ;星期一开始
(setq mark-holidays-in-calendar t) 
;(setq view-calendar-holidays-initially t) 
(setq general-holidays '((holiday-fixed 1 1 "元旦")
(holiday-fixed 3 8 "妇女节")
(holiday-fixed 4 1 "愚人节")
(holiday-fixed 7 1 "我的生日")
(holiday-fixed 5 1 "劳动节")
(holiday-fixed 10 1 "国庆节")
(holiday-fixed 12 25 "圣诞节")
(holiday-float 5 0 2 "母亲节")
(holiday-float 6 0 3 "父亲节")
))
;=================TIME============== 
;----------------------------------------
;(setq gnus-default-charset 'chinese-gbk
;gnus-group-name-charset-group-alist '((".*" . chinese-gbk))
;gnus-summary-show-article-charset-alist '((1 . chinese-gbk) (2 . utf-8) (3 . big5) (4 . gb18030))
;gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown iso-8859-1)
;gnus-group-posting-charset-alist '((".*" gb18030 (gb2312))))
;(define-coding-system-alias 'gb18030 'gb2312) 

;(set-language-environment 'Chinese-GB) 
;(set-keyboard-coding-system 'chinese-iso-8bit-with-esc) 
;(set-terminal-coding-system 'chinese-iso-8bit-with-esc) 
;(set-buffer-file-coding-system 'chinese-iso-8bit-with-esc) 
;(modify-coding-system-alist 'process "*" 'chinese-iso-8bit-with-esc)
;(setq default-process-coding-system '(chinese-iso-8bit-with-esc . chinese-iso-8bit-with-esc))
;(setq-default pathname-coding-system 'chinese-iso-8bit-with-esc) 
;(set-selection-coding-system 'chinese-iso-8bit-with-esc)
;(set-clipboard-coding-system 'chinese-iso-8bit-with-esc) 

;--------------------------------


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


(minibuffer-electric-default-mode 1) 
(partial-completion-mode 1) 
(icomplete-mode 1) 

(setq scroll-step 1
scroll-margin 3
scroll-conservatively 10000) 
;--------------------;不显示启动信息
(setq inhibit-startup-message t)
(setq gnus-inhibit-startup-message t) 
;---------------------
;=================词典==================
(setq dictionary-server "http://www.dict.org")
 (setq dictionary-coding-systems-for-dictionaries '(("cdict" . gbk)
("xdict" . gbk)
("stardic" . gbk))) 
(setq dictionary-tooltip-dictionary "wn") 
;--------------------------------
(autoload 'dictionary-search "dictionary"
"Ask for a word and search it in all dictionaries" t)
(autoload 'dictionary-match-words "dictionary"
"Ask for a word and search all matching words in the dictionaries" t)
(autoload 'dictionary-lookup-definition "dictionary"
"Unconditionally lookup the word at point." t)
(autoload 'dictionary "dictionary"
"Create a new dictionary buffer" t)
(autoload 'dictionary-mouse-popup-matching-words "dictionary"
"Display entries matching the word at the cursor" t)
(autoload 'dictionary-popup-matching-words "dictionary"
"Display entries matching the word at the point" t)
(autoload 'dictionary-tooltip-mode "dictionary"
"Display tooltips for the current word" t)
(autoload 'global-dictionary-tooltip-mode "dictionary"
"Enable/disable dictionary-tooltip-mode for all buffers" t) 
;======================================
;-------------------

;(load "D:/Program Files (x86)/Maxima-5.19.2/share/maxima/5.19.2/emacs
;         /setup-imaxima-imath.el");windows-maxima-patch

(set-keyboard-coding-system 'chinese-iso-8bit);解决剪切乱码 
(set-selection-coding-system 'chinese-iso-8bit)




;ido mode. 超强的buffer切换工具, Emacs 也有通常编辑器的那种
;在 Tab 中选择 buffer 的 mode,但是用了ido 以后,我再也不需要
;他它了,ido mode 是我见过最方便的 buffer 切换模式。
;(require 'ido)
;(ido-mode t)


;;加载xcscope
;(add-to-list 'load-path "D:\ntemacs\site-lisp\xcscope")
;(require 'xcscope)
;(global-set-key [(control ?\=)] 'cscope-find-global-definition-no-prompting) ;;搜索定义
;(global-set-key [(control ?\/)] 'cscope-find-called-functions)
;(global-set-key [(control ?\,)] 'cscope-pop-mark) ;; 跳出转向


;;cedet
(load-file "~/.emacs.d/emplugin/cedet/common/cedet.el")
(require 'cedet)
(global-set-key [(f4)]'speedbar-get-focus) ;f4打开speedbar

;;ecb
(add-to-list 'load-path "~/.emacs.d/emplugin/ecb-2.40/")

(require 'ecb)
(require 'ecb-autoloads)
(setq ecb-tip-of-the-day nil)
(global-set-key [f12] 'ecb-activate) ;;定义F12键为激活ecb
(global-set-key [C-f12] 'ecb-deactivate) ;;定义Ctrl+F12为停止ecb
(global-set-key [(meta ?/)] 'semantic-ia-complete-symbol-menu) ;;设置Alt+Enter为自动补全菜单
;(global-set-key [(control ?\;)] 'ecb-goto-window-edit-last) ;;切换到编辑窗口
;(global-set-key [(control ?\')] 'ecb-goto-window-methods) ;;切换到函数窗口

(eval-after-load "semantic-c" 
'(dolist (d (list "D:/MinGW/include"
 )) 
(semantic-add-system-include d)))

(setq semanticdb-default-save-directory 
(expand-file-name "~/.emacs.d/semanticdb")) 

;(add-hook 'c-mode-common-hook 
;'(lambda() 
;(require 'cedet) 
;(ede-minor-mode t)

(semantic-load-enable-gaudy-code-helpers) 
;;	 (semantic-load-enable-code-helpers) 
;;(semantic-load-enable-minimum-features) 
(local-set-key (kbd "M-/") 'semantic-complete-analyze-inline) 


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


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

;(enable-visual-studio-bookmarks) ;; 启动VS书签子程序
;(setq semanticdb-project-roots (list "D:\MinGW\include")) ;; 设置cemanticdb的扫描根目录


;-----------code--------------

(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
        )
)
;(define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
;  (define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)

;(define-key c-mode-base-map [(f7)] 'compile)
(setq compile-command "gcc")

(setq gdb-many-windows t)
(load-library "multi-gud.el")
(load-library "multi-gdb-ui.el")

;------------html----------------
(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
(setq auto-mode-alist (cons '("\\.html$" . html-helper-mode) auto-mode-alist))
(setq tempo-interactive t)

;----------------------------
(add-to-list 'load-path "~/.emacs.d/emplugin/company")

(require 'company)

(dolist (hook (list
			   'html-helper-mode-hook

               'emacs-lisp-mode-hook

               'lisp-mode-hook

               'lisp-interaction-mode-hook

               'scheme-mode-hook

               'c-mode-common-hook

               'python-mode-hook

               'haskell-mode-hook

               'asm-mode-hook

               'emms-tag-editor-mode-hook

               'sh-mode-hook))

  (add-hook hook 'company-mode))
(autoload 'company-mode "company" nil t)


(mapcar
(function (lambda (setting)
(setq auto-mode-alist
(cons setting auto-mode-alist))))
'(("\\.\\(xml\\|rdf\\)\\'" . sgml-mode)
("\\.\\([ps]?html?\\|cfm\\|asp\\)\\'" . html-helper-mode)
("\\.css\\'" . css-mode)
("\\.\\(emacs\\|session\\|gnus\\)\\'" . emacs-lisp-mode)
("\\.wiki\\'" . emacs-wiki-mode)
("\\.\\(jl\\|sawfishrc\\)\\'" . sawfish-mode)
("\\.scm\\'" . scheme-mode)
("\\.py\\'" . python-mode)
("\\.\\(ba\\)?sh\\'" . sh-mode)
("\\.l\\'" . c-mode)
("\\.max\\'" . maxima-mode))) 
;;;;; Esay Edit for C++/C programming
;; TAB and RET auto align and indent
;(add-hook 'c++-mode-hook
;   (lambda ()
;     (c-set-style "k&r") ;;bsd
;     (hs-minor-mode)
;     (local-set-key "\C-c\t" 'complete-symbol)
;     (local-set-key "\C-m" 'newline-and-indent)
;     (setq mslk-c++-key (make-keymap))
;     (local-set-key "\C-j" mslk-c++-key)
;     (define-key mslk-c++-key "\C-j" 'complete-symbol)
;     (define-key mslk-c++-key "\C-o" 'hs-hide-all)
;     (define-key mslk-c++-key "\C-p" 'hs-show-all)
;     (define-key mslk-c++-key "\C-h" 'hs-hide-block)
;     (define-key mslk-c++-key "\C-u" 'hs-show-block)
;     (define-key mslk-c++-key "\C-l" 'hs-hide-level)
;     (define-key mslk-c++-key "\C-m" 'hs-toggle-hiding)
;     ))

;(add-hook 'c-mode-hook 'c++-mode)
;(defun my-indent-or-complete ()
;     (interactive)
;      (if (looking-at "\\>")
;          (hippie-expand nil)
;          (indent-for-tab-command)))
;    (add-hook 'c-mode-common-hook
;          (function (lambda ()
;                      (define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
;                      (define-key c-mode-base-map [(control m)] 'align-newline-and-indent)
;                      (c-toggle-auto-state))))


;;加载session
;(add-to-list 'load-path "~/.emacs.d/emplugin/")
;(require 'session)

;; 启动时初始化session
;(add-hook 'after-init-hook 'session-initialize)

;; 启动doxymacs
;(add-to-list 'load-path "~/.emacs.d/emplugin")
;(require 'doxymacs)
;(add-hook 'c-mode-common-hook 'doxymacs-mode) ;; 启动doxymacs-mode
;(add-hook 'c++-mode-common-hook 'doxymacs-mode) ;; 启动doxymacs-mode



;; 保存最近打开的文件    
(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)



;(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.
; '(ecb-gzip-setup (quote cons))
; '(ecb-options-version "2.32")
; '(ecb-tar-setup (quote cons))
; '(ecb-wget-setup (quote cons)))
;(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 'desktop)
;(desktop-save-mode t)
;(desktop-load-default)
;(desktop-read)

;-----------
(setq tags-file-name "~/.emacs.d/tags")
;--------------
(require 'erc)

;(require 'erc-auto)
;(autoload 'erc-select "erc" "IRC irc4.eastgame.net:6669". t)

(add-to-list 'auto-mode-alist '("\\.css\\'" . css-mode))
(autoload 'css-mode "css-mode" nil t)

头像
bobo4548
帖子: 661
注册时间: 2007-07-17 22:52
来自: cn,shandong

Re: vim以及emacs配置备份

#4

帖子 bobo4548 » 2010-02-07 9:42

留字顶贴备用,谢谢楼主共享!
回复