File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ Features of this plugin:
77* Specify the languages to be used in spell-check
88* Specify a list of thesauruses for synonym completion
99* Specify a list of dictionaries for word completion
10+ * Specify a list of spellfiles for custom word-check additions
1011* Opt-in key mappings for _ Normal_ mode thesaurus and dictionary completion
1112* Buffer-scoped configuration (leaves your global settings alone)
1213
@@ -101,6 +102,17 @@ let g:lexical#dictionary = ['/usr/share/dict/words',]
101102
102103You can specify multiple paths to dictionaries in the list.
103104
105+
106+ ### Spellfile configuration
107+ On Unix-based systems (including OS X) the spellfile will default to:
108+
109+ ``` vim
110+ let g:lexical#dictionary = ['~/.vim/spell/en.utf-8.add',]
111+ ```
112+
113+ You can specify a single path for spellfile in the list.
114+
115+
104116## Commands
105117
106118Vim offers many standard key mappings for spell-checking and completion.
@@ -189,6 +201,7 @@ command -nargs=0 LexMed call lexical#init({
189201 \ 'thesaurus': ['~/.vim/dictionary/medical_synonyms.txt',
190202 \ '~/.vim/thesaurus/mthesaur.txt',
191203 \ ],
204+ \ 'spellfile': ['~/.vim/spell/en.add'],
192205 \ })
193206```
194207
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ function! lexical#init(...) abort
2323 let l: spelllang_list = get (l: args , ' spelllang' , g: lexical #spelllang )
2424 execute ' setlocal spelllang=' . join (l: spelllang_list , ' ,' )
2525
26+ let l: spellfile_list = get (l: args , ' spellfile' , g: lexical #spellfile )
27+ execute ' setlocal spellfile=' . join (l: spellfile_list , ' ,' )
28+
2629 let l: thesaurus_list = get (l: args , ' thesaurus' , g: lexical #thesaurus )
2730 execute ' setlocal thesaurus=' . join (l: thesaurus_list , ' ,' )
2831 if len (&thesaurus ) > 0
Original file line number Diff line number Diff line change @@ -61,6 +61,25 @@ if !exists('g:lexical#dictionary')
6161 unlet dict_list
6262endif
6363
64+ if ! exists (' g:lexical#spellfile' )
65+ " build on globally-defined spellfile, if any
66+ let spellfile_list = split (&spellfile , ' ,' )
67+ if len (spellfile_list) > 0
68+ " use the globally-defined spellfile
69+ let g: lexical #spellfile = spellfile_list
70+ else
71+ " attempt to discover a dictionary
72+ let spellfile_path = ' ~/.vim/spell/en.utf-8.add'
73+ let g: lexical #spellfile = [
74+ \ has (' unix' ) && filereadable (spellfile_path)
75+ \ ? spellfile_path
76+ \ : ' '
77+ \ ]
78+ unlet spellfile_path
79+ endif
80+ unlet spellfile_list
81+ endif
82+
6483if ! exists (' g:lexical#spell_key' )
6584 let g: lexical #spell_key = ' '
6685endif
7089if ! exists (' g:lexical#dictionary_key' )
7190 let g: lexical #dictionary_key = ' '
7291endif
92+ if ! exists (' g:lexical#spellfile_key' )
93+ let g: lexical #spellfile_key = ' '
94+ endif
7395
7496let &cpo = s: save_cpo
7597unlet s: save_cpo
You can’t perform that action at this time.
0 commit comments