diff options
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | autoload/spellfile_local.vim | 37 |
2 files changed, 29 insertions, 10 deletions
@@ -1 +1 @@ -0.1.1 +0.2.0 diff --git a/autoload/spellfile_local.vim b/autoload/spellfile_local.vim index 7d1877e..92ace4c 100644 --- a/autoload/spellfile_local.vim +++ b/autoload/spellfile_local.vim @@ -27,8 +27,8 @@ function! spellfile_local#() abort " for runtimepath in s:OptionSplit(&runtimepath) let path = s:Path(join(add( - \ split(runtimepath, '/', 1) - \,'spell' + \ split(runtimepath, '/', 1), + \ 'spell', \), '/'), lang, encoding) if path !=# '' call add(spellfiles, path) @@ -46,11 +46,17 @@ function! spellfile_local#() abort " Specify the name and type of spelling files we'll add, with a list of " two-key dictionaries. For each of these, the `name` is used as the - " subdirectory, and the `value` as the first component of the filename. We + " subdirectory, and the `value` as the first component of the filename. " let types = [ - \ { 'name': 'path', 'value': expand('%:p') } - \,{ 'name': 'filetype', 'value': &filetype } + \ { + \ 'name': 'path', + \ 'value': expand('%:p'), + \ }, + \ { + \ 'name': 'filetype', + \ 'value': &filetype, + \ }, \] " Iterate through the specified types to add them to the spelling files list @@ -67,6 +73,19 @@ function! spellfile_local#() abort " Set the spellfile path list to the concatenated list let &spellfile = s:OptionJoin(spellfiles) + " Remap the internal word list mappings to use the second entry in + " the new local 'spellfile' + if get(g:, 'spellfile_local_remap_internal', 1) + nnoremap <buffer> zG 2zg + xnoremap <buffer> zG 2zg + nnoremap <buffer> zW 2zw + xnoremap <buffer> zW 2zw + nnoremap <buffer> zuG 2zug + xnoremap <buffer> zuG 2zug + nnoremap <buffer> zuW 2zuw + xnoremap <buffer> zuW 2zuw + endif + endfunction " Escape a path for use as a valid spelling file name; replace any characters @@ -92,16 +111,16 @@ endfunction " Join a list of strings into a comma-separated option function! s:OptionJoin(list) abort return join(map( - \ a:list - \,'substitute(v:val, ''\\\@<!,'', ''\\,'', ''g'')' + \ a:list, + \ 'substitute(v:val, ''\\\@<!,'', ''\\,'', ''g'')', \), ',') endfunction " Split a comma-separated option into a list of strings function! s:OptionSplit(string) abort return map( - \ split(a:string, '\\\@<!,[, ]*') - \,'substitute(v:val, ''\\,'', '''', ''g'')' + \ split(a:string, '\\\@<!,[, ]*'), + \ 'substitute(v:val, ''\\,'', '''', ''g'')', \) endfunction |