Files
org-vim/runtime/ftplugin/haredoc.vim
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
1.3 KiB
VimL
Raw Normal View History

2025-09-08 15:30:41 -04:00
vim9script
# Vim filetype plugin.
2026-02-06 09:44:16 +00:00
# Language: Haredoc (Hare documentation format)
# Maintainer: Amelia Clarke <selene@perilune.dev>
# Last Change: 2026 Jan 24
# Upstream: https://git.sr.ht/~sircmpwn/hare.vim
2024-05-24 08:05:00 +02:00
if exists('b:did_ftplugin')
finish
endif
2025-09-08 15:30:41 -04:00
b:did_ftplugin = 1
2024-05-24 08:05:00 +02:00
2025-09-08 15:30:41 -04:00
# Use the Hare compiler.
compiler hare
b:undo_ftplugin = 'compiler make'
2024-05-24 08:05:00 +02:00
2025-09-08 15:30:41 -04:00
# Formatting settings.
2024-05-24 08:05:00 +02:00
setlocal comments=:\
2025-09-08 15:30:41 -04:00
setlocal commentstring=\ %s
2026-02-06 09:44:16 +00:00
setlocal formatlistpat=^\\s*-\\s\\+
2024-05-24 08:05:00 +02:00
setlocal formatoptions+=tnlj formatoptions-=c formatoptions-=q
2025-09-08 15:30:41 -04:00
b:undo_ftplugin ..= ' | setl cms< com< flp< fo<'
2024-05-24 08:05:00 +02:00
2025-09-08 15:30:41 -04:00
# Locate Hare modules.
2026-02-06 09:44:16 +00:00
&l:includeexpr = 'trim(v:fname, ":", 2)->substitute("::", "/", "g")'
2024-05-24 08:05:00 +02:00
setlocal isfname+=:
2025-09-08 15:30:41 -04:00
&l:path = ',,' .. hare#GetPath()
2026-02-06 09:44:16 +00:00
b:undo_ftplugin ..= ' | setl inex< isf< pa<'
2024-05-24 08:05:00 +02:00
2025-09-08 15:30:41 -04:00
# Follow the official style guide by default.
2024-05-24 08:05:00 +02:00
if get(g:, 'hare_recommended_style', 1)
setlocal noexpandtab
2026-02-06 09:44:16 +00:00
setlocal shiftwidth=8
2024-05-24 08:05:00 +02:00
setlocal softtabstop=0
setlocal tabstop=8
setlocal textwidth=80
2025-09-08 15:30:41 -04:00
b:undo_ftplugin ..= ' | setl et< sts< sw< ts< tw<'
2024-05-24 08:05:00 +02:00
endif
2025-09-08 15:30:41 -04:00
# Highlight incorrect whitespace outside of insert mode.
if get(g:, 'hare_space_error', 1)
augroup HaredocSpaceError
autocmd!
autocmd InsertEnter * hi link haredocSpaceError NONE
autocmd InsertLeave * hi link haredocSpaceError Error
augroup END
endif
2024-05-24 08:05:00 +02:00
2025-09-08 15:30:41 -04:00
# vim: et sts=2 sw=2 ts=8 tw=80