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中文用户可以参考。
39 (global-set-key (kbd "M-/") 'company-complete
)
40 (define-key company-active-map
(kbd "M-i") 'company-complete-selection
)
41 (define-key company-active-map
(kbd "C-n") 'company-select-next
)
42 (define-key company-active-map
(kbd "C-p") 'company-select-previous
)
43 (define-key company-active-map
(kbd "M-n") 'company-select-next
)
44 (define-key company-active-map
(kbd "M-p") 'company-select-previous
)
46 (setq company-idle-delay
0.2)
47 (setq company-minimum-prefix-length
2)
48 (setq company-selection-wrap-around t
)
49 (setq company-show-numbers t
)
50 (setq company-tooltip-limit
10)
51 (setq company-tooltip-minimum-width
40)
52 (setq company-echo-delay
0)
53 (setq company-global-modes
54 '(not message-mode git-commit-mode eshell-mode
))
56 (setq company-dabbrev-char-regexp
"[[:word:]_:@.-]+")
57 (setq company-dabbrev-downcase nil
)
58 (setq company-dabbrev-ignore-case nil
)
59 (setq company-require-match nil
)
60 (setq company-dabbrev-minimum-length
2)
62 (setq company-backends
63 '((company-capf company-files
) ;company-dabbrev 经常让 emacs 卡死
64 (company-dabbrev-code company-gtags company-etags
66 (setq company-transformers
67 '(company-sort-by-occurrence))
69 (setq company-frontends
70 '(company-pseudo-tooltip-frontend
71 company-echo-metadata-frontend
))
73 (if (and (fboundp 'daemonp
) (daemonp))
74 (add-hook 'after-make-frame-functions
76 (global-company-mode)))
77 (global-company-mode))
79 (defun eh-company-dabbrev--prefix (orig-fun)
81 (let ((string (pyim-char-before-to-string 0)))
82 (if (pyim-string-match-p "\\cc" string
)
86 (advice-add 'company-dabbrev--prefix
87 :around
#'eh-company-dabbrev--prefix
)
89 ;; ** company-posframe
90 (require 'company-posframe
)
91 (setq company-posframe-show-indicator nil
)
92 (setq company-posframe-show-metadata nil
)
93 (setq company-posframe-quickhelp-delay
1)
94 (company-posframe-mode 1)
97 (provide 'eh-complete
)
100 ;; coding: utf-8-unix
103 ;;; eh-complete.el ends here