Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jadercorrea/elixir_generator.vim
Vim plugin to generate elixir method and a test
https://github.com/jadercorrea/elixir_generator.vim
Last synced: 8 days ago
JSON representation
Vim plugin to generate elixir method and a test
- Host: GitHub
- URL: https://github.com/jadercorrea/elixir_generator.vim
- Owner: jadercorrea
- License: mit
- Created: 2015-08-18T23:17:14.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-04-07T00:08:51.000Z (7 months ago)
- Last Synced: 2024-08-02T02:14:43.662Z (3 months ago)
- Language: Vim Script
- Size: 4.88 KB
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - elixir_generator - Vim plugin to generate Elixir module and test files with one command. (Editors)
README
## Elixir Generator
This plugin adds a command to easily add more modules to your `Mix` project.
Just like Mix, it creates a lib and a test file for you to start coding.#### Self-generate modules and unit tests
Hit `:EX` and vim will prompt you to include the path of your new module:
```Type the path (e.g store/cart/item):```
if you type `shopping/cart`, it will generate two files:
* `lib/shopping/cart.ex`
```elixir
defmodule Store.Cart do
def some_method(opts \\ [])def some_method(opts) when opts == [] do
{:ok}
enddef some_method(opts) do
{:ok, [opts]}
enddefp private_method do
{:ok}
end
end
```* `test/shopping/cart_test.exs`
```elixir
defmodule Shopping.CartTest do
use ExUnit.Case, async: true
require Shopping.Cart, as: Carttest "some_method/0" do
assert Cart.some_method == {:ok}
endtest "some_method/1" do
assert Cart.some_method(1) == {:ok, [1]}
end
end
```You may wanna use [vim.test](https://github.com/vim-test/vim-test)
to run your test with a key mapping. If offers a large amount supported languages.#### Contributing
Please consider contributing back.