aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-01-06 13:41:35 +1300
committerTom Ryder <tom@sanctum.geek.nz>2020-01-06 13:41:35 +1300
commit16dbdc90b39c1ebf43ca1881a493edc816d2d9fa (patch)
treefe58168dd5ea3da6a2256a0be2cd1f33f8ad54fd
parentMerge branch 'hotfix/v0.1.1' (diff)
parentBump VERSION (diff)
downloadvim-spellfile-local-0.2.0.tar.gz (sig)
vim-spellfile-local-0.2.0.zip
Merge branch 'release/v0.2.0'v0.2.0
* release/v0.2.0: Specify internal wordlist remaps as buffer-local Remove stray word at the end of a comment Adjust aggregate definition layout for readability Add buffer-local maps for internal wordlist
-rw-r--r--VERSION2
-rw-r--r--autoload/spellfile_local.vim37
2 files changed, 29 insertions, 10 deletions
diff --git a/VERSION b/VERSION
index 17e51c3..0ea3a94 100644
--- a/VERSION
+++ b/VERSION
@@ -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