1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-13 02:05:40 +08:00

Update ruby layer

This commit is contained in:
wsdjeg 2017-12-12 15:05:41 +08:00
parent 7556c5caa9
commit b19851d3d6
2 changed files with 44 additions and 2 deletions

View File

@ -33,4 +33,8 @@ function! s:language_specified_mappings() abort
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 's'],
\ 'call SpaceVim#plugins#repl#send("selection")',
\ 'send selection and keep code buffer focused', 1)
let g:_spacevim_mappings_space.l.c = {'name' : '+RuboCop'}
call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 'f'],
\ 'Noeformat rubocop',
\ 'Runs RuboCop on the currently visited file', 1)
endfunction

View File

@ -8,8 +8,13 @@ description: "This layer is for ruby development, provide autocompletion, syntax
<!-- vim-markdown-toc GFM -->
- [Description](#description)
- [Layer Installation](#layer-installation)
- [Installation](#installation)
- [Layer](#layer)
- [Syntax checking && Code formatting](#syntax-checking--code-formatting)
- [Key bindings](#key-bindings)
- [Inferior REPL process](#inferior-repl-process)
- [RuboCop](#rubocop)
- [Running current script](#running-current-script)
<!-- vim-markdown-toc -->
@ -17,8 +22,41 @@ description: "This layer is for ruby development, provide autocompletion, syntax
This layer is for ruby development.
## Layer Installation
## Installation
### Layer
To use this configuration layer, add `SPLayer 'lang#ruby'` to your custom configuration file.
### Syntax checking && Code formatting
To enable syntax checking and code formatting in spacevim, you need to install [cobocop](https://github.com/bbatsov/rubocop).
```sh
gem install rubocop
```
## Key bindings
### Inferior REPL process
Start a `irb` inferior REPL process with `SPC l s i`.
Send code to inferior process commands:
| Key Binding | Description |
| ----------- | ------------------------------------------------ |
| `SPC l s b` | send buffer and keep code buffer focused |
| `SPC l s l` | send line and keep code buffer focused |
| `SPC l s s` | send selection text and keep code buffer focused |
### RuboCop
| Key Binding | Description |
| ----------- | ------------------------------------------ |
| `SPC l c f` | Runs RuboCop on the currently visited file |
### Running current script
To running a python script, you can press `SPC l r` to run current file without loss focus, and the result will be shown in a runner buffer.