patch 9.1.0442: hare runtime files outdated
Problem: hare runtime files outdated
Solution: runtime(hare): update hare.vim to match upstream
(Amelia Clarke)
closes: #14836
Signed-off-by: Amelia Clarke <selene@perilune.dev>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
2b09de9104
commit
35dfe58a54
28
runtime/autoload/dist/ft.vim
vendored
28
runtime/autoload/dist/ft.vim
vendored
@ -3,7 +3,7 @@ vim9script
|
||||
# Vim functions for file type detection
|
||||
#
|
||||
# Maintainer: The Vim Project <https://github.com/vim/vim>
|
||||
# Last Change: 2024 Feb 18
|
||||
# Last Change: 2024 May 23
|
||||
# Former Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
|
||||
# These functions are moved here from runtime/filetype.vim to make startup
|
||||
@ -376,6 +376,32 @@ export def FTfs()
|
||||
endif
|
||||
enddef
|
||||
|
||||
# Recursively search for Hare source files in a directory and any
|
||||
# subdirectories, up to a given depth.
|
||||
def IsHareModule(dir: string, depth: number): bool
|
||||
if depth <= 0
|
||||
return !empty(glob(dir .. '/*.ha'))
|
||||
endif
|
||||
|
||||
return reduce(sort(glob(dir .. '/*', true, true),
|
||||
(a, b) => isdirectory(a) - isdirectory(b)),
|
||||
(acc, n) => acc
|
||||
|| n =~ '\.ha$'
|
||||
|| isdirectory(n)
|
||||
&& IsHareModule(n, depth - 1),
|
||||
false)
|
||||
enddef
|
||||
|
||||
# Determine if a README file exists within a Hare module and should be given the
|
||||
# Haredoc filetype.
|
||||
export def FTharedoc()
|
||||
if exists('g:filetype_haredoc')
|
||||
if IsHareModule('<afile>:h', get(g:, 'haredoc_search_depth', 1))
|
||||
setf haredoc
|
||||
endif
|
||||
endif
|
||||
enddef
|
||||
|
||||
# Distinguish between HTML, XHTML and Django
|
||||
export def FThtml()
|
||||
var n = 1
|
||||
|
||||
26
runtime/autoload/hare.vim
Normal file
26
runtime/autoload/hare.vim
Normal file
@ -0,0 +1,26 @@
|
||||
" Vim autoload file.
|
||||
" Language: Hare
|
||||
" Maintainer: Amelia Clarke <selene@perilune.dev>
|
||||
" Last Updated: 2024-05-10
|
||||
" Upstream: https://git.sr.ht/~sircmpwn/hare.vim
|
||||
|
||||
" Attempt to find the directory for a given Hare module.
|
||||
function hare#FindModule(str)
|
||||
let path = substitute(trim(a:str, ':', 2), '::', '/', 'g')
|
||||
let dir = finddir(path)
|
||||
while !empty(path) && empty(dir)
|
||||
let path = substitute(path, '/\?\h\w*$', '', '')
|
||||
let dir = finddir(path)
|
||||
endwhile
|
||||
return dir
|
||||
endfunction
|
||||
|
||||
" Return the value of HAREPATH if it exists. Otherwise use a reasonable default.
|
||||
function hare#GetPath()
|
||||
if empty($HAREPATH)
|
||||
return '/usr/src/hare/stdlib,/usr/src/hare/third-party'
|
||||
endif
|
||||
return substitute($HAREPATH, ':', ',', 'g')
|
||||
endfunction
|
||||
|
||||
" vim: et sts=2 sw=2 ts=8
|
||||
Reference in New Issue
Block a user