]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/ale_linters/markdown/marksman.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Do not set EDITOR/VISUAL for shell
[etc/vim.git] / .vim / bundle / ale / ale_linters / markdown / marksman.vim
1 " Author: Peter Benjamin <petermbenjamin@gmail.com>
2 " Description: Write Markdown with code assist and intelligence in the comfort of your favourite editor.
3
4 call ale#Set('markdown_marksman_executable', 'marksman')
5
6 function! ale_linters#markdown#marksman#GetCommand(buffer) abort
7     return '%e server'
8 endfunction
9
10 function! ale_linters#markdown#marksman#GetProjectRoot(buffer) abort
11     " Find nearest .marksman.toml
12     let l:marksman_toml = ale#path#FindNearestFile(a:buffer, '.marksman.toml')
13
14     if !empty(l:marksman_toml)
15         return fnamemodify(l:marksman_toml, ':h')
16     endif
17
18     " Find nearest .git/ directory
19     let l:project_root = finddir('.git/..', expand('#' . a:buffer . '...').';')
20
21     if !empty(l:project_root)
22         return l:project_root
23     endif
24
25     return ''
26 endfunction
27
28 call ale#linter#Define('markdown', {
29 \   'name': 'marksman',
30 \   'lsp': 'stdio',
31 \   'executable': {b -> ale#Var(b, 'markdown_marksman_executable')},
32 \   'command': function('ale_linters#markdown#marksman#GetCommand'),
33 \   'project_root': function('ale_linters#markdown#marksman#GetProjectRoot'),
34 \   'initialization_options': {},
35 \})