From de43970de301b9841fd17019c7e52ac2474fd94f Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 7 Oct 2017 23:46:22 +0800 Subject: [PATCH] Update lang#vim layer --- autoload/SpaceVim/layers/lang/vim.vim | 43 ++++++++++++++++++++------- docs/layers/lang/vim.md | 28 +++++++++++++++++ 2 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 docs/layers/lang/vim.md diff --git a/autoload/SpaceVim/layers/lang/vim.vim b/autoload/SpaceVim/layers/lang/vim.vim index 81e6311eb..9dcaf8764 100644 --- a/autoload/SpaceVim/layers/lang/vim.vim +++ b/autoload/SpaceVim/layers/lang/vim.vim @@ -1,16 +1,37 @@ function! SpaceVim#layers#lang#vim#plugins() abort - let plugins = [ - \ ['syngan/vim-vimlint', { 'on_ft' : 'vim'}], - \ ['ynkdir/vim-vimlparser', { 'on_ft' : 'vim'}], - \ ['todesking/vint-syntastic', { 'on_ft' : 'vim'}], - \ ] - call add(plugins,['tweekmonster/exception.vim']) - call add(plugins,['mhinz/vim-lookup']) - call add(plugins,['Shougo/neco-vim', { 'on_event' : 'InsertEnter', 'loadconf_before' : 1}]) - call add(plugins,['tweekmonster/helpful.vim', {'on_cmd': 'HelpfulVersion'}]) - return plugins + let plugins = [ + \ ['syngan/vim-vimlint', { 'on_ft' : 'vim'}], + \ ['ynkdir/vim-vimlparser', { 'on_ft' : 'vim'}], + \ ['todesking/vint-syntastic', { 'on_ft' : 'vim'}], + \ ] + call add(plugins,['tweekmonster/exception.vim']) + call add(plugins,['mhinz/vim-lookup']) + call add(plugins,['Shougo/neco-vim', { 'on_event' : 'InsertEnter', 'loadconf_before' : 1}]) + call add(plugins,['tweekmonster/helpful.vim', {'on_cmd': 'HelpfulVersion'}]) + return plugins endfunction function! SpaceVim#layers#lang#vim#config() abort - call SpaceVim#mapping#gd#add('vim','lookup#lookup') + call SpaceVim#mapping#gd#add('vim','lookup#lookup') + call SpaceVim#mapping#space#regesit_lang_mappings('vim', funcref('s:language_specified_mappings')) +endfunction + +function! s:language_specified_mappings() abort + call SpaceVim#mapping#space#langSPC('nmap', ['l','e'], 'call call(' + \ . string(function('s:eval_cursor')) . ', [])', + \ 'echo eval under cursor', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','v'], 'call call(' + \ . string(function('s:helpversion_cursor')) . ', [])', + \ 'echo helpversion under cursor', 1) +endfunction + +function! s:eval_cursor() abort + let is_keyword = &iskeyword + set iskeyword+=: + echo expand('') 'is' eval(expand('')) + let &iskeyword = is_keyword +endfunction + +function! s:helpversion_cursor() abort + exe 'HelpfulVersion' expand('') endfunction diff --git a/docs/layers/lang/vim.md b/docs/layers/lang/vim.md new file mode 100644 index 000000000..fe5dda783 --- /dev/null +++ b/docs/layers/lang/vim.md @@ -0,0 +1,28 @@ +--- +title: "SpaceVim lang#vim layer" +--- + +# [SpaceVim Layers:](https://spacevim.org/layers) lang#vim + + + +- [Description](#description) +- [Layer Installation](#layer-installation) +- [Key bindings](#key-bindings) + + + +## Description + +This layer is for vim plugin development. + +## Layer Installation + +To use this configuration layer, add `call SpaceVim#layers#load('lang#vim')` to your custom configuration file. + +## Key bindings + +| Key Binding | Description | +| ----------- | ----------------------------------------- | +| `SPC l e` | print the eval under the cursor | +| `SPC l v` | print the helpfulversion under the cursor |