Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6320760
  • 博文数量: 2759
  • 博客积分: 1021
  • 博客等级: 中士
  • 技术积分: 4091
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-11 14:14
文章分类

全部博文(2759)

文章存档

2019年(1)

2017年(84)

2016年(196)

2015年(204)

2014年(636)

2013年(1176)

2012年(463)

分类: LINUX

2014-01-08 04:37:04

原文地址:.emacs 文件配置备份 作者:wangspace

;;M-x irc 聊天
;;shell 环境查询单词:sdcv
;;ubuntu下命令行打开pdf文件
;;evince filename.pdf
;;============================basic setting ==========================
;;load other set
(add-to-list 'load-path
              "~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas/global-mode 1)
(add-to-list 'load-path
              "~/.emacs.d/plugins/cedet-1.1")
(add-to-list 'load-path
              "~/.emacs.d/plugins/semanticdb")
(add-to-list 'load-path
              "~/.emacs.d/plugins/cscope-15.8a")
(add-to-list 'load-path "~/.emacs.d/")
(require 'color-theme)
(color-theme-initialize)
(color-theme-calm-forest)
(add-to-list 'load-path "/home/wangxigang/.emacs.d/plugins/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "/home/wangxigang/.emacs.d/plugins//ac-dict")
(ac-config-default)


;-----------------------------end basic setting -----------------------
;;===========================color setting =======================
;;指针颜色设置为白色
(set-cursor-color "white")
;;鼠标颜色设置为白色
(set-mouse-color "white")
;;显示背景颜色
(set-background-color "black")
(set-foreground-color "white")
;;设置另外一些颜色:语法高亮读的背景和主题
(set-face-foreground 'highlight "white")
(set-face-background 'highlight "blue")
(set-face-foreground 'region "cyan")
(set-face-background 'region "blue")
(set-face-foreground 'secondary-selection "skyblue")
(set-face-background 'secondary-selection "darkblue")
;;设置日历的一些颜色
(setq calendar-load-hook
'(lambd ()
(set-face-foreground 'diary-face "skyblue")
(set-face-background 'holiday-face "slate blue")
(set-face-foreground 'holiday-face "white")))
;;---------------------------end color setting------------------------
;;===============================功能设置================================
;;打开就启用 text 模式
(setq default-major-mode 'text-mode)
;;禁用启用信息
(setq inhibit-startup-message t)
;;取消工具栏
(tool-bar-mode nil)
;;去掉滚动条
(scroll-bar-mode nil)
;;光标显示为竖线
(setq-default cursor-type 'bar)
;;显示全屏效果
(global-set-key[f11] 'my-fullscreen)
;;定义函数
(defun my-fullscreen()
(interactive)
(x-send-client-message
nil 0 nil
"_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_FULLSCREEN" 0))
)
;;emacs 当前行高亮显示
;(global-hl-line-mode 1)
;;字体配置
(require 'font-settings)
;;显示行数
(require 'linum-setting)
;;括号匹配
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;;在标题栏显示当前位置
(setq frame-title-format "Welcome to Emacs world!")
;;禁止终端响铃
(setq visiable-bell t)
;;设置TAB为4个空格的宽度
;;(setq default-tab-width 4)
;;(setq tab-width 4 indent-tabs-mode nil)
(setq c-basic-offset 4)
;;显示80列换行
(setq default-full-column 80)
;;打开图片显示功能
(auto-image-file-mode t)
;;使用y or n提问
(fset 'yes-or-no-p 'y-or-n-p)
;;关闭出错提示音
(setq visible-bell t)
;;高亮显示区域选择
(transient-mark-mode t)
;;支持emacs和外部的拷贝粘贴
(setq x-select-enable-clipboard t)
;;显示行号
(global-linum-mode t)
(column-number-mode t)
;;不要生成临时文件
(setq-default make-backup-files nil)
;;字体设置
(set-default-font "10x20")
;;启动时的大小和屏幕中的位置
(setq default-frame-alist
     '((height . 35)(width . 100)(menuber-lines . 20)(tool-bar-lines . 0)))
;;代码折叠
(load-library "hideshow")
(add-hook 'java-mode-hook 'hs-minor-mode)
(add-hook 'perl-mode-hook 'hs-minor-mode)
;;插入预订的文本
(add-hook 'find-file-hooks 'auto-insert)
;;(add-hook 'php-mode-hook 'hs-minor-mode)
(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
;;窗口设置
(gnus-add-configuration '(article (vertical 1.0 (summary .35 point) (article1.0))))
;;显示语法高亮度
(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)
;;启动emacs报错,如何忽略错误
(condition-case err
    (progn
      (require 'xxx))
(error
 (message "Can't load xxx-mode %s" (cdr err))))


;;--------------------------功能设置-----------------------------
;;=========================插入当前的时间=========================
;; insert-date
(defun insert-date ()
  "Insert date at point."
  (interactive)
  (insert (format-time-string "%Y年%m月%e日 %l:%M %a %p")))
;;========================= end ==============================
;;=======================  time setting  ======================
;;显示时间设置
;;显示时间包括日期和具体时间
(setq diaplay-time-day-and-date t)
;;时间栏旁启用邮件设置
(setq display-time-use-mail-icon t)
;;时间的变化频率
(setq display-time-interval 10)
;;显示时间格式:
(display-time-mode 1)
(setq display-time-24hr-format t)
;(setq display-time-day-and-data t)
;;---------------------------------end time setting --------------------
;;显示行号
;;(linum-mode)
;;======================    字体解码优先顺序         =====================;
;;从王垠那拷过来的,不用怎么再改吧。
(setq font-encoding-alist
(append '(("MuleTibetan-0" (tibetan . 0))
("GB2312" (chinese-gb2312 . 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 font-encoding-alist
(append '(("MuleTibetan-0" (tibetan . 0))
("GB2312" (chinese-gb2312 . 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))
;;----------------------    字体解码优先顺序        ---------------------
;;---------------------------------------c和cpp环境设定------------------------------------------
(add-hook 'c-mode-hook 'linux-c-mode)
(add-hook 'c++-mode-hook 'linux-cpp-mode)
(defun linux-c-mode()
  ;; 将回车代替C-j的功能,换行的同时对齐
  (define-key c-mode-map [return] 'newline-and-indent)
  (interactive)
  ;; 设置C程序的对齐风格
  (c-set-style "K&R")
  ;; 自动模式,在此种模式下当你键入{时,会自动根据你设置的对齐风格对齐
  (c-toggle-auto-state)
  ;; 此模式下,当按Backspace时会删除最多的空格
  (c-toggle-hungry-state)
  ;; TAB键的宽度设置为8
  (setq c-basic-offset 8)
  ;; 在菜单中加入当前Buffer的函数索引
  (imenu-add-menubar-index)
  ;; 在状态条上显示当前光标在哪个函数体内部
  (which-function-mode)
  )
(defun linux-cpp-mode()
  (define-key c++-mode-map [return] 'newline-and-indent)
  (define-key c++-mode-map [(control c) (c)] 'compile)
  (interactive)
  (c-set-style "K&R")
  (c-toggle-auto-state)
  (c-toggle-hungry-state)
  (setq c-basic-offset 8)
  (imenu-add-menubar-index)
  (which-function-mode)
  )
;;智能编译
(defun smart-compile()
  ;;  "比较智能的C/C++编译命令,如果当前目录有makefile则用make -k编译,否则,如果是
  ;;处于c-mode,就用gcc -Wall编译,如果是c++-mode就用g++ -Wall编译"
  (interactive)
  ;; 查找 Makefile
  (let ((candidate-make-file-name '("makefile" "Makefile" "GNUmakefile"))
        (command nil))
    (if (not (null
              (find t candidate-make-file-name :key
                    '(lambda (f) (file-readable-p f)))))
        (setq command "make -k ")
      ;; 没有找到 Makefile ,查看当前 mode 是否是已知的可编译的模式
      (if (null (buffer-file-name (current-buffer)))
          (message "Buffer not attached to a file, won't compile!")
        (if (eq major-mode 'c-mode)
            (setq command
                  (concat "gcc -g -Wall -o "
                          (file-name-sans-extension
                           (file-name-nondirectory buffer-file-name))
                          " "
                          (file-name-nondirectory buffer-file-name)
                          ;;               " -lm "
                          ))
          (if (eq major-mode 'c++-mode)
              (setq command
                    (concat "g++ -g -Wall -o "
                            (file-name-sans-extension
                             (file-name-nondirectory buffer-file-name))
                            " "
                            (file-name-nondirectory buffer-file-name)
                            ;;             " -lm "
                            ))
            (if (eq major-mode 'fortran-mode)
                (setq command
                      (concat "ifort "
                              ;;                (file-name-nondirectory buffer-file-name))
                              ;;                (file-name-sans-extension
                              (file-name-nondirectory buffer-file-name)
                              " -o "
                              ))
              (message "Unknow mode, won't compile!"))))))
    (if (not (null command))
        (let ((command (read-from-minibuffer "Compile command: " command)))
          (compile command)))))
;;=====================================  end ==========================
;;============================== cedet-1.1 ============================
(add-to-list 'load-path "path-of-cedet/common")
(require 'cedet)
(require 'semantic-ia)
 
;; Enable EDE (Project Management) features
(global-ede-mode 1)
 
(semantic-load-enable-excessive-code-helpers)
(semantic-load-enable-semantic-debugging-helpers)
 
;; Enable SRecode (Template management) minor-mode.
(global-srecode-minor-mode 1)
;;============================== cedet-1.1 end ===========================
;;============================== semantic 配置 ============================
(setq semantic-default-submodes '(global-semantic-idle-scheduler-mode
                                  global-semanticdb-minor-mode
                                  global-semantic-idle-summary-mode
                                  global-semantic-mru-bookmark-mode))
(semantic-mode 1)
;;============================== end ======================================
(add-to-list 'load-path " ~/.emacs.d/plugins")
                 (require 'yasnippet-bundle)
(setq yas/root-directory "~/.emacs.d/snippets")                                                                                                          
(yas/load-directory yas/root-directory)
;;============================== end =====================================
;;============================== cscope ==================================
(require 'xcscope)
 ;; 设置仅在打开c/c++文件时打开 
(add-hook 'c-mode-common-hook '(lambda() (require 'xcscope))) 


;; 打开cscope时不更新,提高索引速度 
(setq cscope-do-not-update-database t) 
;;============================= end ======================================
;;============================= stardict.el ==============================
: (require 'stardict)
: (global-set-key (kbd "C-c-d") 'view-stardict-in-buffer)
;;=============================== end ================================



阅读(650) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~