个人的Emacs配置文件

我的Emacs版本:GNU Emacs 23.1.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.18.9)

1:下载http://ftp.twaren.net/Unix/NonGNU/color-theme/color-theme-6.6.0.tar.gz  然后自己解压

2:把color-theme-6.6.0.tar.gz解压后的 color-theme.el和 theme文件夹 复制到 ~/.emacs.d文件夹内(如果~/.emacs.d文件夹不存在请先建立)。

3:创建配置文件 .emacs。目录在你的家目录,用户目录下。

配置文件为:

;;将~/.emacs.d/添加到加载路径
(add-to-list 'load-path "~/.emacs.d/")
(require 'color-theme)
(color-theme-initialize)
;; 这个是你选择的主题,后面的calm forest就是它的名字,注意使用小写。
(color-theme-calm-forest)

;;竖线光标
(setq-default cursor-type 'bar) 

;;自动换行缩进
(global-set-key (kbd "RET") 'newline-and-indent)
;;; ### Indent ###
;;; --- 缩进设置
(setq-default indent-tabs-mode t)       ;默认不用空格替代TAB
(setq default-tab-width 4)              ;设置TAB默认的宽度
(dolist (hook (list                     ;设置用空格替代TAB的模式
               'emacs-lisp-mode-hook
               'lisp-mode-hook
               'lisp-interaction-mode-hook
               'scheme-mode-hook
               'c-mode-hook
               'c++-mode-hook
               'java-mode-hook
               'haskell-mode-hook
               'asm-mode-hook
               'emms-tag-editor-mode-hook
               'sh-mode-hook
               ))
  (add-hook hook '(lambda () (setq indent-tabs-mode nil))))

;;设置程序的对齐风格
;(c-set-style "K&R") 

;;撤消
(global-set-key (kbd "C-z") 'undo)
;;全选
(global-set-key (kbd "C-a") 'mark-whole-buffer)
;;保存
(global-set-key (kbd "C-s") 'save-buffer)  

;;支持emacs和外部程序的粘贴
(setq x-select-enable-clipboard t)

;显示匹配括号
(show-paren-mode t)
(setq show-paren-style 'parentheses)  

;;设置光标闪烁或者不闪
;;(blink-cursor-mode l)  

;;设置tab宽度为4
(setq-default indent-tabs-mode  nil)
(setq tab-width 4 c-basic-offset 4)
(setq tab-width 4 indent-tabs-mode nil)  

;;不要生成临时文件
(setq-default make-backup-files nil)  

;;hanghao
(global-linum-mode 'linum-mode)

;;高亮c中的宏定义
;;(load-file "/home/.emacs.d/ctypes.el")
(require 'ctypes)
(ctypes-auto-parse-mode 1)

;;Buffer管理
;; 按下C-x k立即关闭掉当前的buffer
(global-set-key (kbd "C-x k") 'kill-this-buffer)

;; 一打开就起用 text 模式。
(setq default-major-mode 'c-mode)

;;去掉欢迎界面
(setq inhibit-startup-message t)

;;buffer分割模式
(defun toggle-window-split ()
  "Vertical split shows more of each line, horizontal split shows
more lines. This code toggles between them. It only works for
frames with exactly two windows."
  (interactive)
  (if (= (count-windows) 2)
      (let* ((this-win-buffer (window-buffer))
             (next-win-buffer (window-buffer (next-window)))
             (this-win-edges (window-edges (selected-window)))
             (next-win-edges (window-edges (next-window)))
             (this-win-2nd (not (and (<= (car this-win-edges)
                                         (car next-win-edges))
                                     (<= (cadr this-win-edges)
                                         (cadr next-win-edges)))))
             (splitter
              (if (= (car this-win-edges)
                     (car (window-edges (next-window))))
                  'split-window-horizontally
                'split-window-vertically)))
        (delete-other-windows)
        (let ((first-win (selected-window)))
          (funcall splitter)
          (if this-win-2nd (other-window 1))
          (set-window-buffer (selected-window) this-win-buffer)
          (set-window-buffer (next-window) next-win-buffer)
          (select-window first-win)
          (if this-win-2nd (other-window 1))))))

(global-set-key [(control c) (|)] 'toggle-window-split)
(global-set-key [(f5)] 'speedbar)

;;鼠标滚轮,默认的滚动太快,这里改为3行
(defun up-slightly () (interactive) (scroll-up 3))
(defun down-slightly () (interactive) (scroll-down 3))
(global-set-key [mouse-4] 'down-slightly)
(global-set-key [mouse-5] 'up-slightly)

;;启动Emacs自动设置为两个窗口(上下各一个)
;;(split-window-vertically)

效果图:

时间: 2024-08-06 15:07:21

个人的Emacs配置文件的相关文章

linux下emacs配置文件

1:安装.在ubuntu下使用命令 sudo apt-get install emacs,即可,我使用的是ubuntu的10.04的版本,在里面使用了据说是163的2个源. 1.1:如何更新快速的源,在终端下输入:sudo gedit /etc/apt/sources.list 在里面添加这2个地址,我测试过速度相当的快. deb http://ubuntu.cn99.com/ubuntu/ karmic main restricted universe multiverse          

emacs 配置文件

emacs 配置文件 [2016/05/20] ;; 把 .emacs.d 目錄加入到 load-path ;; 這樣的話本來需要放到 /usr/share/emacs/site-lisp/ 的東西  ;; 就只需要放到 .emacs.d 裏面  (add-to-list 'load-path "~/.emacs.d/")  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;

转来的emacs配置文件,自动安装插件

网上转来的emacs配置文件,便于自动安装插件,收藏起来 http://www.gogae.org/post-7/ EMACS是一个伪装成代码编辑器的操作系统. EMACS是一个非常强大的代码编辑器,其扩展能力和插件数量几乎没有任可一个编辑器可以与之相比.她被许多黑客称之为神的编辑器,可想而知这有多受人追捧了.但正因为她的强大而导致了学习曲线陡峭,让大部份想要学习的朋友望而却步.随着Emacs24版本发布,配置成一个顺手好用的编辑器,只需要一个配置文件即可(不像以前要到处去找插件).下面是我写好

emacs配置文件的基础知识 (转载)

转自:http://blog.csdn.net/schumyxp/article/details/2278268 emacs的配置文件,叫作.emacs,是个隐藏文件,存在于当前用户的根目录下面,也就是~/.emacs emacs的配置文件采用了elisp作为配置文件的语言,来源于强大的lisp语言.下面我简单说一点emacs配置文件怎么写.虽然内容不多,也很肤浅,但是知道了这些,至少在编写自己的配置文件的时候,不会那么无序了. 在配置文件里面,引号(;)开头表示注释,比如下面这行; this

Emacs配置文件

;;tab and space;;when true,emacs use mixture of tab and space to archieve(setq-default indent-tabs-mode nil);;control length used to offset.(setq-default c-basic-offset 4);;control how emacs explain TAB(setq-default tab-width 4) ;;setup line number(g

update:我的Emacs配置文件

;;设置字体用的  防止中文变成无法识别的框框 (set-default-font "Consolas-11") (set-fontset-font "fontset-default" 'gb18030' ("微软雅黑" . "unicode-bmp")) ;;设置Home路径 (setq default-directory "d:/code/" ) ;;启动窗口大小 (setq default-frame

我的简单的emacs配置文件

;; Added by Package.el. This must come before configurations of ;; installed packages. Don't delete this line. If you don't want it, ;; just comment it out by adding a semicolon to the start of the line. ;; You may delete these explanatory comments.

我的emacs设置文件.emacs

;;; emacs配置文件 ;;设置行高(setq-default line-spacing 5) (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

搭建emacs的go编程语言环境

关于emacs就不说明了,直接切入主题.关于我的emacs配置,可以直接参考GitHub上的lienhua34/myemacs-conf. go-mode 安装 关于go-mode的安装,可以直接参考GitHub.从github上下载go-mode.el或go-mode-autoloads.el文件到你本地的某个目录下,然后在~/.emacs文件中输入下面内容: (add-to-list 'load-path "/path/to/your/dir") (require 'go-mode