vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

hare.vim (1443B)


      1 vim9script
      2 
      3 # Vim filetype plugin.
      4 # Language:    Hare
      5 # Maintainer:  Amelia Clarke <selene@perilune.dev>
      6 # Last Change: 2026 Jan 24
      7 #              2026 Jun 27 by Vim Project (normalize recommended style guard)
      8 # Upstream:    https://git.sr.ht/~sircmpwn/hare.vim
      9 
     10 if exists('b:did_ftplugin')
     11   finish
     12 endif
     13 b:did_ftplugin = 1
     14 
     15 # Use the Hare compiler.
     16 compiler hare
     17 b:undo_ftplugin = 'compiler make'
     18 
     19 # Formatting settings.
     20 setlocal comments=://
     21 setlocal commentstring=//\ %s
     22 setlocal formatlistpat=^\\s*-\\s\\+
     23 setlocal formatoptions+=croqnlj/ formatoptions-=t
     24 b:undo_ftplugin ..= ' | setl cms< com< flp< fo<'
     25 
     26 # Locate Hare modules.
     27 &l:include = '\v^\s*use\s+%(\h\w*\s*\=)?'
     28 &l:includeexpr = 'trim(v:fname, ":", 2)->substitute("::", "/", "g")'
     29 setlocal isfname+=:
     30 &l:path = ',,' .. hare#GetPath()
     31 b:undo_ftplugin ..= ' | setl inc< inex< isf< pa<'
     32 
     33 # Follow the official style guide by default.
     34 if get(g:, 'hare_recommended_style', get(g:, 'filetype_recommended_style', 1))
     35   setlocal noexpandtab
     36   setlocal shiftwidth=8
     37   setlocal softtabstop=0
     38   setlocal tabstop=8
     39   setlocal textwidth=80
     40   b:undo_ftplugin ..= ' | setl et< sts< sw< ts< tw<'
     41 endif
     42 
     43 # Highlight incorrect whitespace outside of insert mode.
     44 if get(g:, 'hare_space_error', 1)
     45   augroup HareSpaceError
     46     autocmd!
     47     autocmd InsertEnter * hi link hareSpaceError NONE
     48     autocmd InsertLeave * hi link hareSpaceError Error
     49   augroup END
     50 endif
     51 
     52 # vim: et sts=2 sw=2 ts=8 tw=80