1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-13 13:19:12 +08:00

Add: more Merlin commands for layers/lang/ocaml (#3223)

This commit is contained in:
JHZheng 2019-11-15 16:59:39 +08:00 committed by Wang Shidong
parent ba7c260e4c
commit 7670689fc3
3 changed files with 40 additions and 6 deletions

View File

@ -29,4 +29,29 @@ endfunction
function! SpaceVim#layers#lang#ocaml#config() abort
let g:syntastic_ocaml_checkers = ['merlin']
" https://github.com/ocaml/merlin/blob/master/vim/merlin/doc/merlin.txt#L333-L341
if g:spacevim_autocomplete_method ==# 'neocomplete'
if !exists('g:neocomplete#sources#omni#input_patterns')
let g:neocomplete#sources#omni#input_patterns = {}
endif
let g:neocomplete#sources#omni#input_patterns.ocaml = '[^. *\t]\.\w*\|\h\w*|#'
endif
call SpaceVim#mapping#gd#add('ocaml', function('s:go_to_def'))
call SpaceVim#mapping#space#regesit_lang_mappings('ocaml', function('s:language_specified_mappings'))
endfunction
function! s:language_specified_mappings() abort
let g:_spacevim_mappings_space.l.m = {'name' : '+Merlin'}
call SpaceVim#mapping#space#langSPC('nmap', ['l','m', 'v'],
\ 'MerlinVersion',
\ 'show Merlin version', 1)
call SpaceVim#mapping#space#langSPC('nmap', ['l','m', 't'],
\ 'MerlinTypeOf',
\ 'extract type informations', 1)
endfunction
function! s:go_to_def() abort
:MerlinLocate
endfunction

View File

@ -24,6 +24,8 @@ lang: zh
- 语法高亮
- 代码补全
- 跳转定义处
- 类型提示
- 检查 `Merlin` 版本
## 启用模块
@ -36,6 +38,9 @@ lang: zh
## 快捷键
| 快捷键 | 功能描述 |
| ---- | ------------------------ |
| `gd` | 跳转到光标下符号的定义处 |
| 快捷键 | 功能描述 |
| ----------- | ------------------------------ |
| `gd` | 跳转到光标下符号的定义处 |
| `SPC l m v` | 显示当前使用的 `Merlin` 版本号 |
| `SPC l m t` | 显示光标下或者选中代码块的类型 |

View File

@ -34,9 +34,13 @@ To use this configuration layer, update custom configuration file with:
- auto-completion
- syntax checking
- goto definition
- type hint
- check `Merlin` version
## Key bindings
| Key Binding | Description |
| ----------- | --------------------------------------------------------- |
| `gd` | jump at the definition of the identifier under the cursor |
| Key Binding | Description |
| ----------- | ------------------------------------------------------------------- |
| `gd` | jump at the definition of the identifier under the cursor |
| `SPC l m v` | display `Merlin` version which currently labored |
| `SPC l m t` | display type informations under the cursor or selected code snippet |