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.
Add this to your .vimrc or nvim/init.vim:
Plug 'sovetnik/vim-hanami'
The plugin registers <Leader>s(SpecToggle) and <Leader>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
Assume we have generated a hanami entity or action.
Suppose you run hanami g model fnord and get files:
lib/bookshelf/entities/fnord.rblib/bookshelf/repositories/fnord_repository.rbspec/bookshelf/entities/fnord_spec.rbspec/bookshelf/repositories/fnord_repository_spec.rb
Or we run hanami generate action web foobar#show and get:
spec/web/controllers/foobar/show_spec.rbapps/web/controllers/foobar/show.rbapps/web/views/foobar/show.rbapps/web/templates/foobar/show.html.erbspec/web/views/foobar/show_spec.rb
Toggle command simply splits window with alter or spec file.
This command mapped to <Leader>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.

This command mapped to <Leader>s
From Action, Entity, Repository and View toggles between them and their specs.

In your ~/.vimrc or ~/.config/nvim/init.vim add this statement to change open strategy:
let g:hanami_open_strategy = 'vsplit'Default strategy is split.
You can disable included mappings:
let g:hanami_map_keys = 0By default mappings enabled.
- navigation in app folder
- something else
The Vim Hanami plugin is open-sourced software licensed under the MIT license.

