eh-org.el: org-super-agenda add :auto-eh-parent.
[emacs-helper.git] / eh-complete.el
blobbe3c6a7045396b7e315e26bf2dc4c97cac4d31f9
1 ;;; eh-complete.el --- Tumashu's emacs complete configuation -*- lexical-binding: t; -*-
3 ;; * Header
4 ;; Copyright (c) 2011-2019, Feng Shu
6 ;; Author: Feng Shu <tumashu@163.com>
7 ;; URL: https://github.com/tumashu/emacs-helper
8 ;; Version: 0.0.1
10 ;; This file is not part of GNU Emacs.
12 ;;; License:
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.
29 ;;; Commentary:
31 ;; * 简介 :README:
32 ;; 这个文件是tumashu个人专用的emacs配置文件,emacs中文用户可以参考。
34 ;;; Code:
36 ;; * 代码 :code:
37 ;; ** company-mode
38 (require 'company)
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
67 company-keywords)))
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
77 (lambda (_)
78 (global-company-mode)))
79 (global-company-mode))
81 (defun eh-company-dabbrev--prefix (orig-fun)
82 "取消中文补全"
83 (let ((string (pyim-char-before-to-string 0)))
84 (if (pyim-string-match-p "\\cc" string)
85 nil
86 (funcall orig-fun))))
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)
98 ;; * Footer
99 (provide 'eh-complete)
101 ;; Local Variables:
102 ;; coding: utf-8-unix
103 ;; End:
105 ;;; eh-complete.el ends here