SpaceVim
A modular Vim/Neovim configuration
Home | About | Quick start guide | Documentation | Development | Community | Sponsors | 中文
This is a general guide for using SpaceVim as a Ruby IDE, including layer configuration and usage. Each of the following sections will be covered:
To add Ruby language support in SpaceVim, you need to enable the lang#ruby
layer. Press SPC f v d
to open
SpaceVim configuration file, and add the following snippet:
[[layers]]
name = "lang#ruby"
For more info, you can read the lang#ruby layer documentation.
lang#ruby
layer will load the Ruby plugin automatically, unless it’s overriden in your init.toml
.
The completion menu will be opened as you type.
If you want to use solargraph for a more advance code completion, you can do it through coc. For use coc
like your autocompletion engine, you must set the next variable:
[options]
autocomplete_method = "coc"
Be sure to have solargraph installed:
gem install solargraph
Then install coc-solargraph extension for coc
to support solargraph with the next command:
:CocInstall coc-solargraph
The checkers layer is enabled by default. This layer provides asynchronous syntax linting via neomake. It will run rubocop asynchronously.
Install rubocop via gem:
gem install rubocop
SpaceVim use built-in plugin to manager the files in a project, you can add a .project_alt.json
to the root of your project with the following content:
{
"src/*.rb": {"alternate": "test/{}.rb"},
"test/*.rb": {"alternate": "src/{}.rb"}
}
For a Rails project with Minitest use this:
{
"app/*.rb": {"alternate": "test/{}_test.rb"},
"test/*_test.rb": {"alternate": "app/{}.rb"}
}
With this configuration, you can jump between the source code and test file via command :A
To run current script, you can press SPC l r
, and a split window
will be openen, the output of the script will be shown in this window.
It is running asynchronously, and will not block your Vim.
The format layer is also enabled by default. With this layer you can use key binding SPC b f
to format current buffer.
Before using this feature, please install rufo:
gem install rufo
Start a irb
inferior REPL process with SPC l s i
. After the REPL process being started, you can
send code to inferior process. All key bindings prefix with SPC l s
, including sending line, sending selection or even
send whole buffer.
Powered by Jekyll