initial commit

This commit is contained in:
Rudis Muiznieks 2018-09-25 17:14:56 -05:00
commit e2381e4986
No known key found for this signature in database
GPG Key ID: 1C290B51E05090F8
2 changed files with 47 additions and 0 deletions

13
README.md Normal file
View File

@ -0,0 +1,13 @@
# vim-ficdown
A linter definition for [ALE](https://github.com/w0rp/ale) that provides error checking for Ficdown stories as you write them.
## Pre-requisites
You need to have [Mono](https://www.mono-project.com/) installed an on your path, and you need to have [Ficdown](https://github.com/rudism/ficdown) installed somewhere.
## Configuration
```vimscript
let g:ficdown_exe_path='/path/to/ficdown.exe'
```

View File

@ -0,0 +1,34 @@
function! ale_linters#markdown#ficdown#ProcessOutput(buffer, lines) abort
let l:pattern = '^\(\w\)\w\+ L\(\d\+\),\(\d\+\): \("[^"]\+": \)\?\(.\+\)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'type': l:match[1],
\ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0,
\ 'text': l:match[5]
\})
endfor
return l:output
endfunction
function! ale_linters#markdown#ficdown#GetCommand(buffer) abort
let s:exe_path = ''
if !exists('g:ficdown_exe_path')
let s:exe_path = 'ficdown.exe'
else
let s:exe_path = g:ficdown_exe_path
endif
return '%e ' . s:exe_path . ' --format lint'
endfunction
call ale#linter#Define('markdown', {
\ 'name': 'ficdown',
\ 'aliases': ['Ficdown', 'FicDown'],
\ 'executable': 'mono',
\ 'command_callback': 'ale_linters#markdown#ficdown#GetCommand',
\ 'callback': 'ale_linters#markdown#ficdown#ProcessOutput'
\})