VIM: Adds functions for proselint and languagetool

master
Jonathan Hodgson 3 years ago
parent 5b22913c67
commit 9816fbb258
  1. 37
      nvim/.config/nvim/autoload/mine/functions.vim
  2. 3
      nvim/.config/nvim/plugin/mappings.vim

@ -18,3 +18,40 @@ function! mine#functions#colorcols() abort
setlocal colorcolumn=80,100 setlocal colorcolumn=80,100
endif endif
endfunction endfunction
function! mine#functions#proselint() abort
let oldmakeprg = &l:makeprg
" set new value of makeprg and call the function
set makeprg=proselint\ %
make
copen
" set makeprg back to old value
let &l:makeprg = oldmakeprg
endfunction
function! mine#functions#languagetool() abort
let oldmakeprg = &l:makeprg
let olderrformat = &l:errorformat
" set new value of makeprg and call the function
set makeprg=languagetool\ -l\ en-GB\ %
let &l:errorformat =
\ '%-GPicked up _JAVA_OPTIONS: %.%#,' .
\ '%-GExpected text language: %.%#,' .
\ '%-PWorking on %f...,' .
\ '%-I%.%# [main] DEBUG %.%#,' .
\ '%+IUsing %.%# for file %.%#,' .
\ '%I%\d%\+.) Line %l\, column %c\, Rule ID: %m,' .
\ '%-CMessage%m,' .
\ '%-CSuggestion%m,' .
\ '%-CMore info%m,' .
\ '%-C%\s%#^%\+%\s%#,' .
\ '%-C%.%#,' .
\ '%-Z%\s%#,' .
\ '%-Q,' .
\ '%-GTime: %.%#'
make
copen
" set makeprg back to old value
let &l:makeprg = oldmakeprg
let &l:makeprg = olderrformat
endfunction

@ -78,3 +78,6 @@ vnoremap > >gv
nnoremap [c :cprevious<cr> nnoremap [c :cprevious<cr>
nnoremap ]c :cnext<cr> nnoremap ]c :cnext<cr>
" Run proselint and put it in the quickfix list
nnoremap <leader>p :call mine#functions#proselint()<CR>

Loading…
Cancel
Save