56

GitHub - redguardtoo/eacl: eacl - Emacs auto complete line(s) by grepping projec...

 5 years ago
source link: https://github.com/redguardtoo/eacl
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.org

eacl - Emacs auto complete line(s) v2.0.0

Auto complete line(s) by grepping the project.

Screenshot:

https://raw.githubusercontent.com/redguardtoo/eacl/master/eacl-demo.gif

For example, a web developer need create a new component instance.

Suppose the component has been used in current project before:

<MyComponent
  attr1="v1"
  attr2="v2"
  attr3="v3"
  attr4="v4"
/>
  <Toolbar>
    <Button onClick={ e => console.log(e) }>
      <i className="fa fa-circle" />
    </Button>
  </Toolbar>
</MyComponent>

The developer only need input <MyComponent and run M-x eacl-complete-multiline.

Install

Place eacl.el under your Load Path. Then add (require 'eacl) to your configuration.

Ivy is required.

git grep will be automatically detected for completion if possible. Or else default grep is used.

Usage

M-x eacl-complete-line to complete single line in project.

M-x eacl-complete-multiline to complete multiline code or html tag in project

The keyword to grep is the text from line beginning to current cursor.

Whitespace in keyword could match any characters.

Project is automatically detected if Git/Mercurial/Subversion is used.

You can override the default root directory by setting eacl-project-root,

(setq eacl-project-root "~/projs/PROJECT_DIR")

Tips

Directories and files grep to ignore

Modify grep-find-ignored-directories and grep-find-ignored-files to setup directories and files grep should ignore:

(eval-after-load 'grep
  '(progn
     (dolist (v '("node_modules"
                  "bower_components"
                  ".sass_cache"
                  ".cache"
                  ".npm"))
       (add-to-list 'grep-find-ignored-directories v))
     (dolist (v '("*.min.js"
                  "*.bundle.js"
                  "*.min.css"
                  "*.json"
                  "*.log"))
       (add-to-list 'grep-find-ignored-files v))))

Or you can setup above ignore options in .dir-locals.el.

Sample of .dir-locals.el,

((nil . ((eval . (progn
                   (dolist (v '("node_modules"
                                "bower_components"
                                ".sass_cache"
                                ".cache"
                                ".npm"))
                     (add-to-list 'grep-find-ignored-directories v))
                   (dolist (v '("*.min.js"
                                "*.bundle.js"
                                "*.min.css"
                                "*.json"
                                "*.log"))
                     (add-to-list 'grep-find-ignored-files v)))))))

Bug Report

Check https://github.com/redguardtoo/eacl.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK