Emacs company-mode

  • Company 是 ‘complete anything’ 的意思
  • 是一種 auto-complete 自動完成
  • 支援各種後端 (back-ends): Elisp, clang, yasnippet …
  • 可以更改前端樣式

Youtube 影片

安裝

(use-package company
:ensure t
:config
(global-company-mode t)
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 3)
(setq company-backends
‘((company-files
company-yasnippet
company-keywords
company-capf
)
(company-abbrev company-dabbrev))))

在 emacs-lisp mode 使用 company

(add-hook ’emacs-lisp-mode-hook
(lambda ()
(add-to-list (make-local-variable ‘company-backends)
‘(company-elisp))))

avoid “C-n”, “C-p” issues

(with-eval-after-load ‘company
(define-key company-active-map (kbd “M-n”) nil)
(define-key company-active-map (kbd “M-p”) nil)
(define-key company-active-map (kbd “C-n”) #’company-select-next)
(define-key company-active-map (kbd “C-p”) #’company-select-previous))

company integrate with yasnippet

(advice-add ‘company-complete-common :before (lambda ()
(setq my-company-point (point))))
(advice-add ‘company-complete-common :after (lambda ()
(when (equal my-company-point (point))
(yas-expand))))

Notice: compact(): Undefined variable: limits in /var/www/html/wp-includes/class-wp-comment-query.php on line 853 Notice: compact(): Undefined variable: groupby in /var/www/html/wp-includes/class-wp-comment-query.php on line 853

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *