[nvim] Add thesaurus autodownload
Fix location of thesaurus to follow XDG specification for application data (in `.local/share/nvim/thesaurus`). Automatically download thesaurus if it is not found.
This commit is contained in:
parent
a505976485
commit
f8371f0e73
1 changed files with 10 additions and 3 deletions
|
@ -2,10 +2,17 @@
|
||||||
let g:tq_map_keys=0
|
let g:tq_map_keys=0
|
||||||
|
|
||||||
" set custom mthesaur file if we have it
|
" set custom mthesaur file if we have it
|
||||||
if exists("$XDG_CONFIG_HOME")
|
if exists('$XDG_DATA_HOME')
|
||||||
let g:tq_mthesaur_file=getenv("XDG_CONFIG_HOME") . "/nvim/thesaurus/mthesaur.txt"
|
let g:tq_mthesaur_file='$XDG_DATA_HOME' . '/nvim/thesaurus/mthesaur.txt'
|
||||||
else
|
else
|
||||||
let g:tq_mthesaur_file=expand("~/.config/nvim/thesaurus/mthesaur.txt")
|
let g:tq_mthesaur_file=expand('~/.local/share/nvim/thesaurus/mthesaur.txt')
|
||||||
|
endif
|
||||||
|
|
||||||
|
" download if we don't
|
||||||
|
if !filereadable(glob(g:tq_mthesaur_file))
|
||||||
|
echom 'No thesaurus file found, attempting to download in background...'
|
||||||
|
execute '!curl -fLo ' . expand(g:tq_mthesaur_file) . ' --create-dirs
|
||||||
|
\ http://www.gutenberg.org/files/3202/files/mthesaur.txt'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let g:tq_language=['en', 'de']
|
let g:tq_language=['en', 'de']
|
||||||
|
|
Loading…
Reference in a new issue