1 ;;; eh-complete.el --- Tumashu's emacs complete configuation -*- lexical-binding: t; -*-
4 ;; Copyright (c) 2011-2019, Feng Shu
6 ;; Author: Feng Shu <tumashu@163.com>
7 ;; URL: https://github.com/tumashu/emacs-helper
10 ;; This file is not part of GNU Emacs.
14 ;; This program is free software; you can redistribute it and/or
15 ;; modify it under the terms of the GNU General Public License
16 ;; as published by the Free Software Foundation; either version 3
17 ;; of the License, or (at your option) any later version.
19 ;; This program is distributed in the hope that it will be useful,
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;; GNU General Public License for more details.
24 ;; You should have received a copy of the GNU General Public License
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the
26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
27 ;; Boston, MA 02110-1301, USA.
32 ;; 这个文件是tumashu个人专用的emacs配置文件,emacs中文用户可以参考。
40 (global-set-key (kbd "M-/") 'company-complete
)
41 (define-key company-active-map
(kbd "M-i") 'company-complete-selection
)
42 (define-key company-active-map
(kbd "C-n") 'company-select-next
)
43 (define-key company-active-map
(kbd "C-p") 'company-select-previous
)
44 (define-key company-active-map
(kbd "M-n") 'company-select-next
)
45 (define-key company-active-map
(kbd "M-p") 'company-select-previous
)
47 (setq company-idle-delay
0.2)
48 (setq company-minimum-prefix-length
2)
49 (setq company-selection-wrap-around t
)
50 (setq company-show-numbers t
)
51 (setq company-tooltip-limit
10)
52 (setq company-tooltip-minimum-width
40)
53 (setq company-echo-delay
0)
54 (setq company-global-modes
55 '(not message-mode git-commit-mode eshell-mode
))
57 (require 'company-dabbrev
)
58 (setq company-dabbrev-char-regexp
"[[:word:]_:@.-]+")
59 (setq company-dabbrev-downcase nil
)
60 (setq company-dabbrev-ignore-case nil
)
61 (setq company-require-match nil
)
62 (setq company-dabbrev-minimum-length
2)
64 (setq company-backends
65 '((company-capf company-files
) ;company-dabbrev 经常让 emacs 卡死
66 (company-dabbrev-code company-gtags company-etags
68 (setq company-transformers
69 '(company-sort-by-occurrence))
71 (setq company-frontends
72 '(company-pseudo-tooltip-frontend
73 company-echo-metadata-frontend
))
75 (if (and (fboundp 'daemonp
) (daemonp))
76 (add-hook 'after-make-frame-functions
78 (global-company-mode)))
79 (global-company-mode))
81 (defun eh-company-dabbrev--prefix (orig-fun)
83 (let ((string (pyim-char-before-to-string 0)))
84 (if (pyim-string-match-p "\\cc" string
)
88 (advice-add 'company-dabbrev--prefix
89 :around
#'eh-company-dabbrev--prefix
)
91 ;; ** company-posframe
92 (require 'company-posframe
)
93 (setq company-posframe-show-indicator nil
)
94 (setq company-posframe-show-metadata nil
)
95 (setq company-posframe-quickhelp-delay
1)
96 (company-posframe-mode 1)
99 (provide 'eh-complete
)
102 ;; coding: utf-8-unix
105 ;;; eh-complete.el ends here