Skip to content
Fastest Emacs auto-completion using Company and Ctags
Emacs Lisp Makefile
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test company-ctags support multiple tags files Feb 4, 2020
.gitignore fixed diff bug, add tdd Nov 8, 2019
Makefile fixed diff bug, add tdd Nov 8, 2019
README.org doc on rust programming language Feb 9, 2020
company-ctags.el doc on rust programming language Feb 9, 2020
screenshot.png first import Sep 26, 2019

README.org

Fastest auto-completion using Company and Ctags

This library enables the completion using Company mode and Ctags for Emacs. It’s simply fast because a new optimized algorithm is designed for Ctags.

It shows the candidate immediately for project as big as Linux kernel.

screenshot.png

Install and Setup

Place company-ctags.el under Load Path, then add (require 'company-ctags) to your configuration.

It’s also possible to use http://melpa.org/.

Setup is simple,

(eval-after-load 'company
  '(progn
     (company-ctags-auto-setup)))

Usage

Step 1, create tags file in project root,

find . -name "*.[ch]" | ctags -e -L -

Step 2, enjoy!

Tips

Load extra tags files

You can set company-ctags-extra-tags-files to load extra tags files,

(setq company-ctags-extra-tags-files '("$HOME/TAGS" "/usr/include/TAGS"))

Use CLI program diff to improve performance

Make sure CLI program diff is executable on Windows.

It’s optional but highly recommended. It can speed up tags file updating.

This package uses diff through variable diff-command.

Linux/macOS needs no setup.

Fuzzy match

Set company-ctags-fuzzy-match-p to fuzzy match the candidates.

The input could match any part of the candidate instead of the beginning of the candidate.

Here is example how to combine counsel with company-ctags,

(require 'counsel)
(defun my-counsel-company ()
  "Input code from company backend using fuzzy matching."
  (interactive)
  (company-abort)
  (let* ((company-backends '(company-ctags))
         (company-ctags-fuzzy-match-p t))
    (counsel-company)))

You can use general.el so you could press rr in insert mode to trigger my-counsel-company,

;; In insert mode, press "rr" in 0.2 second to trigger my-counsel-company
(require 'general)
(general-imap "r"
  (general-key-dispatch 'self-insert-command
    :timeout 0.2
    "r" 'my-counsel-company))

Rust programming language

Use rusty-tags to generate tags file for Rust programming language.

Add below code into ~/.emacs,

(setq company-ctags-tags-file-name "rusty-tags.emacs")

Contact me

Report bugs at https://github.com/redguardtoo/company-ctags.

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You can’t perform that action at this time.