您的位置:首页 > 其它

emacs使用 -- 默认配置,不断更新中

2012-04-24 00:00 441 查看
设置默认c文件缩进风格
;;define my c mode hook

(defun mychook()
(c-set-style "linux"))
(add-hook 'c-mode-hook 'mychook)

M-x hs-minor-mode
For Emacs 21:

•C-c @ C-M-s show all
•C-c @ C-M-h hide all
•C-c @ C-s show block
•C-c @ C-h hide block
•C-c @ C-c toggle hide/show

(add-hook 'c-mode-hook 'hs-minor-mode)

indent and de-indent

C-c >

C-c <

================My Configuration File========================

(global-set-key [(meta g)] 'goto-line)
(global-set-key [(meta p)] 'backward-kill-word)
(global-set-key [(ctrl f)] 'hs-toggle-hiding)

(global-set-key (kbd "C-c #") 'comment-region)

;;define my c mode hook
(defun mychook()
(c-set-style "linux"))
(add-hook 'c-mode-hook 'mychook)
(add-hook 'c-mode-hook 'hs-minor-mode)

;;open .bbclass or .bb files with python mode
(add-to-list 'auto-mode-alist '("\\.bbclass$" . python-mode))
(add-to-list 'auto-mode-alist '("\\.bb$" . python-mode))

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

2012-12-31

global-set-key [(meta g)] 'goto-line)
(global-set-key [(meta p)] 'backward-kill-word)
(global-set-key (kbd "C-c #") 'comment-region)

;;define my c mode hook
(defun mychook()
(c-set-style "linux"))
(add-hook 'c-mode-hook 'mychook)
(add-hook 'c-mode-hook 'hs-minor-mode)

;;open .bbclass or .bb files with python mode
(add-to-list 'auto-mode-alist '("\\.bbclass$" . python-mode))
(add-to-list 'auto-mode-alist '("\\.bb$" . python-mode))
(add-to-list 'auto-mode-alist '("\\.inc$" . python-mode))

;;make system c/p work with emacs's c/p
(setq x-select-enable-clipboard t)
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)

(require 'whitespace)
(setq whitespace-style '(face empty tabs lines-tail trailing))
(global-whitespace-mode t)

============= 2013-06-23 === 增加默认highlight===============

(global-set-key [(meta g)] 'goto-line)
(global-set-key [(meta p)] 'backward-kill-word)
(global-set-key (kbd "C-c #") 'comment-region)

;;define my c mode hook
(defun mychook()
(c-set-style "linux"))
(add-hook 'c-mode-hook 'mychook)
(add-hook 'c-mode-hook 'hs-minor-mode)

;;define hightlight hook
(defun highlight()
(highlight-regexp ".*\\[100%\\]" "hi-green")
(highlight-regexp ".*\\[critical\\]" "hi-red-b")
(highlight-regexp ".*\\[important\\]" "hi-red-b")
(highlight-regexp ".*\\[to do\\]" "hi-blue")
(highlight-regexp ".*\\[work\\]" "hi-yellow"))
(add-hook 'text-mode-hook 'highlight)

;;open .bbclass or .bb files with python mode
(add-to-list 'auto-mode-alist '("\\.bbclass$" . python-mode))
(add-to-list 'auto-mode-alist '("\\.bb$" . python-mode))
(add-to-list 'auto-mode-alist '("\\.inc$" . python-mode))

;;make system c/p work with emacs's c/p
(setq x-select-enable-clipboard t)
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)

(require 'whitespace)
(setq whitespace-style '(face empty tabs lines-tail trailing))
(global-whitespace-mode t)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  emacs editting-mode hook