基础插件管理

This commit is contained in:
2025-07-14 18:31:16 +08:00
parent b2b778feba
commit 446b801c05
9 changed files with 255 additions and 1 deletions

View File

@ -0,0 +1,22 @@
vim9script
import autoload "tui/util/osinfo.vim"
export def GetFileSeparator(): string
return osinfo.GetFileSeparator()
enddef
export def Normalize(path: string): string
assert_true(!empty(path) && !empty(split(path)))
const path_joined = join(filter(split(path, '[/\\]'), '!empty(split(v:val))'), GetFileSeparator())
return expand(match(path, '^[/\\]') != -1 ? (GetFileSeparator() .. path_joined) : path_joined)
enddef
export def Join(parent: string, ...subs: list<string>): string
assert_true(!empty(parent) && !empty(split(parent)))
const path_joined = join(extend([parent], subs), GetFileSeparator())
return Normalize(path_joined)
enddef