Auto complete line(s) by grepping the project.
Screenshot:
For example, a web developer need create a new component instanc.
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>
That developer only need input <MyComponent
and run M-x eacl-complete-tag
. Magic happens!*
Place eacl.el
under your Load Path. Then add (require 'eacl)
to your configuration.
Gnu Grep, Emacs 24.3 and ivy are required.
GNU Grep should be pre-installed.
Please use HomeBrew to install GNU Grep
on macOS.
Then insert (setq eacl-grep-program "ggrep")
into ~/.emacs
. The bundled BSD Grep
on macOS is too outdated to use.
You can use Cygwin/MSYS2 to install grep
program. Don’t forget to add the location of grep
into environment variable PATH
.
Multiple commands are provided to grep files in the project to get auto complete candidates.
The keyword to grep is the text from line beginning to current cursor.
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")
Here are the commands you can use.
Complete the line. You could assign key binding C-x C-l
to it.
Complete the statement which ends with “;”.
For example, input text import
and run this command.
Complete the snippet which ends with “}”.
For example, input text if
and run this command.
Complete the HTML tag which ends with “>”.
For example, input text <div
and run this command.