Skip to content

Commit

Permalink
Merge pull request dpelle#13 from Eluminae/master
Browse files Browse the repository at this point in the history
Allow a specific configured program call to start languagetool:
  • Loading branch information
dpelle authored Apr 4, 2020
2 parents ff6da56 + fbcd1f2 commit 217720d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
12 changes: 12 additions & 0 deletions doc/LanguageTool.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,18 @@ g:languagetool_jar *g:languagetool_jar*
:let g:languagetool_jar='$HOME/languagetool/languagetool-standalone/target/LanguageTool-4.3-SNAPSHOT/LanguageTool-4.3-SNAPSHOT/languagetool-commandline.jar'
g:languagetool_cmd *g:languagetool_cmd*

Conversely, you could use this variable to specify by yourself the
command call. This variable take priority over g:languagetool_jar.
This is usefull for system package management installs like for
archlinux.

Example: >
:let g:languagetool_cmd='/usr/bin/languagetool'
:let g:languagetool_cmd='java -jar $HOME/languagetool/languagetool-standalone/target/LanguageTool-4.3-SNAPSHOT/LanguageTool-4.3-SNAPSHOT/languagetool-commandline.jar'
g:languagetool_lang *g:languagetool_lang*

The language code to use for the language tool checker. If undefined,
Expand Down
9 changes: 6 additions & 3 deletions plugin/LanguageTool.vim
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function s:LanguageToolSetUp() "{{{1
\ ? g:languagetool_jar
\ : $HOME . '/languagetool/languagetool-commandline.jar'

if !filereadable(s:languagetool_jar)
if !exists("g:languagetool_cmd") && !filereadable(s:languagetool_jar)
" Hmmm, can't find the jar file. Try again with expand() in case user
" set it up as: let g:languagetool_jar = '$HOME/languagetool-commandline.jar'
let l:languagetool_jar = expand(s:languagetool_jar)
Expand Down Expand Up @@ -253,8 +253,11 @@ function s:LanguageToolCheck(line1, line2) "{{{1
let l:range = a:line1 . ',' . a:line2
silent exe l:range . 'w!' . l:tmpfilename

let l:languagetool_cmd = 'java'
\ . ' -jar ' . s:languagetool_jar
let l:languagetool_cmd = exists("g:languagetool_cmd")
\ ? g:languagetool_cmd
\ : 'java -jar ' . s:languagetool_jar

let l:languagetool_cmd = l:languagetool_cmd
\ . ' -c ' . s:languagetool_encoding
\ . (empty(s:languagetool_disable_rules) ? '' : ' -d '.s:languagetool_disable_rules)
\ . (empty(s:languagetool_enable_rules) ? '' : ' -e '.s:languagetool_enable_rules)
Expand Down

0 comments on commit 217720d

Please sign in to comment.