Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sovetnik/vim-hanami
Hanami framework vim support
https://github.com/sovetnik/vim-hanami
hanami vim
Last synced: 1 day ago
JSON representation
Hanami framework vim support
- Host: GitHub
- URL: https://github.com/sovetnik/vim-hanami
- Owner: sovetnik
- Created: 2017-04-22T23:57:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-22T16:29:16.000Z (almost 6 years ago)
- Last Synced: 2024-08-03T18:12:55.670Z (4 months ago)
- Topics: hanami, vim
- Language: Vim script
- Size: 81.1 KB
- Stars: 13
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-hanami - Vim Hanami - plugin that gives you faster navigation between semantically associated files, like Action <-> View, Entity <-> Repository or Spec <-> Entity. (Hanami Gem List / Editors and IDE)
README
# vim-hanami
Hanami support plugin for vim that gives you faster navigation between semantically
associated files, like Action <-> View, Entity -> Repository or Spec -> Entity.Spec <-> Entity association works if code lives in `lib` and specs in 'spec' directoties.
## Installation
Add this to your `.vimrc` or `nvim/init.vim`:
```
Plug 'sovetnik/vim-hanami'
```## Usage
The plugin registers `s`(SpecToggle) and `x`(RepoToggle) in normal mode for toggle files.
Some public commands:
`:HanamiAlterToggle` toggles between entity and repo.
`:HanamiSpecToggle` toggles between lib and spec.
`:HanamiProject` returnes project name from `.hanamirc`
`:HanamiTemplate` returnes template engine from `.hanamirc`## Toggles
Assume we have generated a hanami entity or action.
Suppose you run `hanami g model fnord` and get files:
- `lib/bookshelf/entities/fnord.rb`
- `lib/bookshelf/repositories/fnord_repository.rb`
- `spec/bookshelf/entities/fnord_spec.rb`
- `spec/bookshelf/repositories/fnord_repository_spec.rb`Or we run `hanami generate action web foobar#show` and get:
- `spec/web/controllers/foobar/show_spec.rb`
- `apps/web/controllers/foobar/show.rb`
- `apps/web/views/foobar/show.rb`
- `apps/web/templates/foobar/show.html.erb`
- `spec/web/views/foobar/show_spec.rb`Toggle command simply splits window with alter or spec file.
### AlterToggle
This command mapped to `x`
From buffer with Action, View or its specs toggles between them, Action <-> View.
From buffer with Entity, Repository or its specs toggles between them, Entity <-> Repo.
### SpecToggle
This command mapped to `s`
From Action, Entity, Repository and View toggles between them and their specs.
## Settings
In your `~/.vimrc` or `~/.config/nvim/init.vim` add this statement to change open strategy:
```vim
let g:hanami_open_strategy = 'vsplit'
```
Default strategy is `split`.You can disable included mappings:
```vim
let g:hanami_map_keys = 0
```
By default mappings enabled.## Next features(planned)
- navigation in app folder
- something else## License
The Vim Hanami plugin is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).