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

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

53 lines
1.3 KiB
VimL
Raw Normal View History

2025-09-08 15:30:41 -04:00
vim9script
# Vim filetype plugin.
# Language: Hare
# Maintainer: Amelia Clarke <selene@perilune.dev>
# Last Updated: 2025 Sep 06
# Upstream: https://git.sr.ht/~sircmpwn/hare.vim
2022-09-27 17:30:34 +01:00
if exists('b:did_ftplugin')
finish
endif
2025-09-08 15:30:41 -04:00
b:did_ftplugin = 1
2022-09-27 17:30:34 +01: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.
setlocal comments=://
2022-09-27 17:30:34 +01:00
setlocal commentstring=//\ %s
2025-09-08 15:30:41 -04:00
setlocal formatlistpat=^\\s*-\
2024-05-24 08:05:00 +02:00
setlocal formatoptions+=croqnlj/ formatoptions-=t
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.
&l:include = '\v^\s*use\s+%(\h\w*\s*\=)?'
setlocal includeexpr=hare#IncludeExpr()
2024-05-24 08:05:00 +02:00
setlocal isfname+=:
2025-09-08 15:30:41 -04:00
&l:path = ',,' .. hare#GetPath()
setlocal suffixesadd=.ha
2025-09-08 15:30:41 -04:00
b:undo_ftplugin ..= ' | setl inc< inex< isf< pa< sua<'
2022-09-27 17:30:34 +01: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
2024-05-24 08:05:00 +02:00
setlocal shiftwidth=0
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<'
endif
2022-09-27 17:30:34 +01:00
2025-09-08 15:30:41 -04:00
# Highlight incorrect whitespace outside of insert mode.
if get(g:, 'hare_space_error', 1)
augroup HareSpaceError
autocmd!
2024-05-24 08:05:00 +02:00
autocmd InsertEnter * hi link hareSpaceError NONE
autocmd InsertLeave * hi link hareSpaceError Error
2025-09-08 15:30:41 -04:00
augroup END
endif
2025-09-08 15:30:41 -04:00
# vim: et sts=2 sw=2 ts=8 tw=80