emacs 自动添加括号
来源:互联网 发布:女生喜欢穿热裤 知乎 编辑:程序博客网 时间:2024/05/18 02:14
;; C mode(add-hook 'c-mode-hook 'hs-minor-mode)(add-hook 'c++-mode-hook 'hs-minor-mode)(defun my-c-mode-auto-pair () (interactive) (make-local-variable 'skeleton-pair-alist) (setq skeleton-pair-alist '( (?` ?` _ "''") (?\( ? _ ")") (?\[ ? _ "]") (?{ \n > _ \n ?} >))) (setq skeleton-pair t) (local-set-key (kbd "(") 'skeleton-pair-insert-maybe) (local-set-key (kbd "{") 'skeleton-pair-insert-maybe) (local-set-key (kbd "`") 'skeleton-pair-insert-maybe) (local-set-key (kbd "[") 'skeleton-pair-insert-maybe))(add-hook 'c-mode-hook 'my-c-mode-auto-pair)(add-hook 'c++-mode-hook 'my-c-mode-auto-pair)