diff options
author | Felipe Morales <hel.sheep@gmail.com> | 2017-07-15 09:14:26 -0400 |
---|---|---|
committer | Felipe Morales <hel.sheep@gmail.com> | 2017-07-16 12:10:49 -0400 |
commit | 3241bce6116cdd17f93651f12b5908e57e1d3136 (patch) | |
tree | 6c49898aa057a102b69234f2e24052df1fa59362 | |
parent | 37af8599307819c66da287ed3cb0babf6295dbfc (diff) | |
download | rneovim-3241bce6116cdd17f93651f12b5908e57e1d3136.tar.gz rneovim-3241bce6116cdd17f93651f12b5908e57e1d3136.tar.bz2 rneovim-3241bce6116cdd17f93651f12b5908e57e1d3136.zip |
tutor: reorganize
-rw-r--r-- | runtime/autoload/tutor.vim | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/runtime/autoload/tutor.vim b/runtime/autoload/tutor.vim index c03326c7fb..56e2283465 100644 --- a/runtime/autoload/tutor.vim +++ b/runtime/autoload/tutor.vim @@ -15,14 +15,25 @@ function! tutor#SetupVim() endif endfunction +" Loads metadata file, if available +function! tutor#LoadMetadata() + let b:tutor_metadata = json_decode(join(readfile(expand('%').'.json'), "\n")) +endfunction + " Mappings: {{{1 +function! tutor#SetNormalMappings() + nnoremap <silent> <buffer> <CR> :call tutor#FollowLink(0)<cr> + nnoremap <silent> <buffer> <2-LeftMouse> :call tutor#MouseDoubleClick()<cr> + nnoremap <buffer> >> :call tutor#InjectCommand()<cr> +endfunction + function! tutor#MouseDoubleClick() if foldclosed(line('.')) > -1 normal! zo else if match(getline('.'), '^#\{1,} ') > -1 - normal! zc + silent normal! zc else call tutor#FollowLink(0) endif @@ -35,14 +46,6 @@ function! tutor#InjectCommand() redraw | echohl WarningMsg | echon "tutor: ran" | echohl None | echon " " | echohl Statement | echon l:cmd endfunction -function! tutor#SetNormalMappings() - nnoremap <silent> <buffer> <CR> :call tutor#FollowLink(0)<cr> - nnoremap <silent> <buffer> <2-LeftMouse> :call tutor#MouseDoubleClick()<cr> - nnoremap <buffer> >> :call tutor#InjectCommand()<cr> -endfunction - -" Hypertext: {{{1 - function! tutor#FollowLink(force) let l:stack_s = join(map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")'), '') if l:stack_s =~# 'tutorLink' @@ -85,12 +88,6 @@ function! tutor#InfoText() return join(l:info_parts, " ") endfunction -function! tutor#LoadMetadata() - try - let b:tutor_metadata = json_decode(join(readfile(expand('%').'.json'), "\n")) - catch - endtry -endfunction " Marks: {{{1 |