mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-14 15:19:12 +08:00
Add: more Merlin commands for layers/lang/ocaml (#3223)
This commit is contained in:
parent
ba7c260e4c
commit
7670689fc3
@ -29,4 +29,29 @@ endfunction
|
|||||||
|
|
||||||
function! SpaceVim#layers#lang#ocaml#config() abort
|
function! SpaceVim#layers#lang#ocaml#config() abort
|
||||||
let g:syntastic_ocaml_checkers = ['merlin']
|
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
|
endfunction
|
||||||
|
@ -24,6 +24,8 @@ lang: zh
|
|||||||
- 语法高亮
|
- 语法高亮
|
||||||
- 代码补全
|
- 代码补全
|
||||||
- 跳转定义处
|
- 跳转定义处
|
||||||
|
- 类型提示
|
||||||
|
- 检查 `Merlin` 版本
|
||||||
|
|
||||||
## 启用模块
|
## 启用模块
|
||||||
|
|
||||||
@ -36,6 +38,9 @@ lang: zh
|
|||||||
|
|
||||||
## 快捷键
|
## 快捷键
|
||||||
|
|
||||||
| 快捷键 | 功能描述 |
|
| 快捷键 | 功能描述 |
|
||||||
| ---- | ------------------------ |
|
| ----------- | ------------------------------ |
|
||||||
| `gd` | 跳转到光标下符号的定义处 |
|
| `gd` | 跳转到光标下符号的定义处 |
|
||||||
|
| `SPC l m v` | 显示当前使用的 `Merlin` 版本号 |
|
||||||
|
| `SPC l m t` | 显示光标下或者选中代码块的类型 |
|
||||||
|
|
||||||
|
@ -34,9 +34,13 @@ To use this configuration layer, update custom configuration file with:
|
|||||||
- auto-completion
|
- auto-completion
|
||||||
- syntax checking
|
- syntax checking
|
||||||
- goto definition
|
- goto definition
|
||||||
|
- type hint
|
||||||
|
- check `Merlin` version
|
||||||
|
|
||||||
## Key bindings
|
## Key bindings
|
||||||
|
|
||||||
| Key Binding | Description |
|
| Key Binding | Description |
|
||||||
| ----------- | --------------------------------------------------------- |
|
| ----------- | ------------------------------------------------------------------- |
|
||||||
| `gd` | jump at the definition of the identifier under the cursor |
|
| `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 |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user