using distinct filetype

This commit is contained in:
Rudis Muiznieks 2019-05-12 10:53:45 -05:00
parent 615e82ce0a
commit ad569a1941
5 changed files with 13 additions and 10 deletions

View File

@ -1,13 +1,13 @@
# vim-ficdown # vim-ficdown
A linter definition for [ALE](https://github.com/w0rp/ale) that provides error checking for Ficdown stories as you write them. A linter definition for [ALE](https://github.com/w0rp/ale) that provides markdown syntax highlighting and error checking for Ficdown stories as you write them. Expects you to use a `.ficdown` extension on your files.
## Pre-requisites ## 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. You need to have [Ficdown](https://github.com/rudism/ficdown) >= v1.1.0 installed somewhere.
## Configuration ## Configuration
```vim ```vim
let g:ficdown_exe_path='/path/to/ficdown.exe' let g:ficdown_exe_path='/path/to/ficdown'
``` ```

View File

@ -1,4 +1,4 @@
function! ale_linters#markdown#ficdown#ProcessOutput(buffer, lines) abort function! ale_linters#ficdown#ficdown#ProcessOutput(buffer, lines) abort
let l:pattern = '^\(\w\)\w\+ L\(\d\+\),\(\d\+\): \("[^"]\+": \)\?\(.\+\)$' let l:pattern = '^\(\w\)\w\+ L\(\d\+\),\(\d\+\): \("[^"]\+": \)\?\(.\+\)$'
let l:output = [] let l:output = []
@ -14,7 +14,7 @@ function! ale_linters#markdown#ficdown#ProcessOutput(buffer, lines) abort
return l:output return l:output
endfunction endfunction
function! ale_linters#markdown#ficdown#GetCommand(buffer) abort function! ale_linters#ficdown#ficdown#GetExecutable(buffer) abort
let s:exe_path = '' let s:exe_path = ''
if !exists('g:ficdown_exe_path') if !exists('g:ficdown_exe_path')
let s:exe_path = 'ficdown.exe' let s:exe_path = 'ficdown.exe'
@ -22,13 +22,13 @@ function! ale_linters#markdown#ficdown#GetCommand(buffer) abort
let s:exe_path = g:ficdown_exe_path let s:exe_path = g:ficdown_exe_path
endif endif
return '%e ' . s:exe_path . ' --format lint' return s:exe_path
endfunction endfunction
call ale#linter#Define('markdown', { call ale#linter#Define('ficdown', {
\ 'name': 'ficdown', \ 'name': 'ficdown',
\ 'aliases': ['Ficdown', 'FicDown'], \ 'aliases': ['Ficdown', 'FicDown'],
\ 'executable': 'mono', \ 'executable_callback': 'ale_linters#ficdown#ficdown#GetExecutable',
\ 'command_callback': 'ale_linters#markdown#ficdown#GetCommand', \ 'command': '%e --format lint',
\ 'callback': 'ale_linters#markdown#ficdown#ProcessOutput' \ 'callback': 'ale_linters#ficdown#ficdown#ProcessOutput'
\}) \})

1
ftdetect/ficdown.vim Normal file
View File

@ -0,0 +1 @@
au BufRead,BufNewFile *.ficdown set filetype=ficdown

1
ftplugin/ficdown.vim Normal file
View File

@ -0,0 +1 @@
runtime! ftplugin/markdown.vim

1
syntax/ficdown.vim Normal file
View File

@ -0,0 +1 @@
runtime! syntax/markdown.vim