vim-ruby-block-helpers


Ⅰ. 插件描述

Vim plugin for more easily navigating blocks in ruby and/or rspec

Ⅱ. 基本信息

创建日期:  2018-01-17
使用用户:  4
Github星:  11
插件作者:  John DeWyze

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'dewyze/vim-ruby-block-helpers'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'dewyze/vim-ruby-block-helpers'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'dewyze/vim-ruby-block-helpers'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/dewyze/vim-ruby-block-helpers

Ⅳ. 文档说明

# Vim Ruby Block Helpers

This adds mappings/keystrokes to vim to allow you to more easily maneuver and
traverse ruby blocks. Additionally it adds some very helpful features for
showing context/describe hierarchy in rspec.

Mappings

]b                Goes to next sibling block, or next sibling of parent block
[b        Goes to previous sibling block, or previous sibling of parent block
]p                            Goes to the beginning of the first parent block
]c     Go to the beginning of the first spec context block (describe/context)
]s                                             Goes to start of current block
]e                                               Goes to end of current block
]h                               Print the block hierachy to the current line
]v                  Prints the various 'lets', 'subjects', and '@=' variables

Functions

RubyBlockNext

This will go to the beginning of the line of the next block at the sibling

  1. If run on the last block inside another block, it will go to the
  2. sibling of the parent block.

RubyBlockPrevious

This will go to the beginning of the line of the previous block at the sibling

  1. If run on the first block inside another block, it will go to the first
  2. sibling of the parent block.

RubyBlockParent

This will go to the beginning of the line of the immediate block surrounding
the block you are currently in.

RubyBlockSpecParentContext

This will go to the beginning of the line of the immediate rspec block
surrounding the block you are currently in. Limited to
describe/context/shared_example.

RubyBlockStart

This will go to the start of the current block.

RubyBlockEnd

This will go to the end of the current block.

RubyBlockHierarchy

This will print the hierarchy of surrounding parent blocks of the current

  1. This can be useful in large spec files to learn where you are. For
    example, it will print:
describe "foo" do
  context "bar" do
    it "baz" do

RubyBlockSpecEnv

EXPERIMENTAL This should really only be used in RSpec style files, and it
is tailored to those. It will print out the first line all let/subject
blocks, as well as anytime an @= varable is defined in a setup section for
a test. So it will show you your "environment" for a given spec.
For example, it will print:

describe "foo" do
  let(:thing1) { "thing 1" }
  context "bar" do
    @thing2 = Thing2.new
    it "baz" do

Contributing

See the CONTRIBUTING doc.

Code of Conduct

See the Code of Conduct doc.

添加新评论