Saturday, February 1, 2014

emacs配置

;;emacs的配置文件是~/.emacs
;;.emacs config file
;;
;;
;;add additional path where load-file find files
(add-to-list ‘load-path (expand-file-name "~/.emacs.d"))
(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.
 )
(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.
  ;;’(variable-pitch ((t (:background "skyblue" :foreground "skyblue" :family "Sans Serif")))))
  ’(default ((t (:stipple nil :background "skyblue" :foreground "#000000" :inverse-video nil
                 :box nil :overline nil :underline nil :slant normal
                 :weight normal :family "Sans Serif")))))
;;shell
(defun shell()
  (interactive)
  (ansi-term "/bin/bash"))
;;add tab support
(require ‘tabbar)
(tabbar-mode)
(global-set-key (kbd "<C-down>") ‘tabbar-backward-group)
(global-set-key (kbd "<C-up>") ‘tabbar-forward-group)
(global-set-key (kbd "<C-left>") ‘tabbar-backward)
(global-set-key (kbd "<C-right>") ‘tabbar-forward)
;;add verilog & systemverilog support
(autoload ‘verilog-mode "verilog-mode" "Verilog mode" t)
(setq auto-mode-alist (cons ‘("\\.v\\’\\|\\.sv[ih]?\\’" . verilog-mode) auto-mode-alist))
(add-hook ‘verilog-mode-hook ‘(lambda() (font-lock-mode 1)))
;;kill newline symbol when kill line
(setq kill-whole-line t)
;; set yes-or-no answer to y-or-n answer
(fset ‘yes-or-no-p ‘y-or-n-p)
(setq split-window-keep-point nil)
(setq default-tab-width 4)
(setq tab-width 4)
(global-font-lock-mode t)
(setq-default transient-mark-mode t)
(transient-mark-mode t)
;;display line number
(require ‘linum)
(add-hook ‘find-file-hooks (lambda() (linum-mode 1)))
;;set goto-line bind key
(global-set-key "\C-cg" ‘goto-line)
(put ‘narrow-to-region ‘disabled nil)
(setq-default indent-tabs-mode nil)
(setq default-major-mode ‘text-mode)
(setq inhibit-startup-screen t)
;;bind F5 to reload the modified file
(global-set-key [f5]
    ’(lambda() "Refresh the buffer from the disk (prompt of modified)."
        (interactive)
        (revert-buffer t (not (buffer-modified-p)) t)))

No comments:

Post a Comment