All Projects → sovetnik → vim-hanami

sovetnik / vim-hanami

Licence: other
Hanami framework vim support

Programming Languages

Vim Script
2826 projects

Labels

Projects that are alternatives of or similar to vim-hanami

bookshelf
Hanami "Getting Started" project
Stars: ✭ 20 (+53.85%)
Mutual labels:  hanami
Hanami
The web, with simplicity.
Stars: ✭ 5,584 (+42853.85%)
Mutual labels:  hanami
hanami-bootstrap
Bootstrap wrapper for hanami framework.
Stars: ✭ 13 (+0%)
Mutual labels:  hanami
timber-ruby
🌲 Great Ruby logging made easy.
Stars: ✭ 155 (+1092.31%)
Mutual labels:  hanami
hanami-serializer
Serializer library for hanami applications
Stars: ✭ 22 (+69.23%)
Mutual labels:  hanami
hanami-pagination
No description or website provided.
Stars: ✭ 14 (+7.69%)
Mutual labels:  hanami
mina-hanami
🌸 Mina plugin for Hanami
Stars: ✭ 13 (+0%)
Mutual labels:  hanami
rodauth hanami
Example app for integrate rodauth server to hanami app
Stars: ✭ 16 (+23.08%)
Mutual labels:  hanami
rspec-hanami
RSpec Matchers for Hanami
Stars: ✭ 47 (+261.54%)
Mutual labels:  hanami
hanami-api-amazon-aws-lambda
Hanami::API on Amazon AWS Lambda
Stars: ✭ 36 (+176.92%)
Mutual labels:  hanami
hanami-shrine
Upload solution for Hanami using Shrine library
Stars: ✭ 28 (+115.38%)
Mutual labels:  hanami

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 <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

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 <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.

SpecToggle

This command mapped to <Leader>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:

let g:hanami_open_strategy = 'vsplit'

Default strategy is split.

You can disable included mappings:

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].