VIM: Adds functions for proselint and languagetool

Jonathan Hodgson 3 years ago
parent 6d0ff5eb98
commit b99abb8c5b
  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
endif
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 :cnext<cr>
" Run proselint and put it in the quickfix list
nnoremap <leader>p :call mine#functions#proselint()<CR>

Loading…
Cancel
Save