ListCode, fix unique buffer opening an existing file on disk
This commit is contained in:
@@ -251,13 +251,16 @@ function MatchExec(s, meta)
|
||||
return {kind = "skip"}
|
||||
end
|
||||
|
||||
OnOpenMatchers = {
|
||||
BuiltinOnOpenMatchers = {
|
||||
MatchWindowsPath,
|
||||
MatchGitCommit,
|
||||
MatchURL,
|
||||
|
||||
MatchGotoBuild,
|
||||
|
||||
MatchExec,
|
||||
}
|
||||
OnOpenMatchers = BuiltinOnOpenMatchers
|
||||
|
||||
function OnOpen(path, meta)
|
||||
for i = #OnOpenMatchers,1,-1 do
|
||||
@@ -319,4 +322,38 @@ function OnSave(buffer_id)
|
||||
if Style.ClangFormatOnSave and (name:match(".c$") or name:match(".h$") or name:match(".cpp$") or name:match(".hpp$")) then
|
||||
ApplyClangFormat(buffer_id)
|
||||
end
|
||||
end
|
||||
|
||||
function IsCodeExclude(s, meta)
|
||||
if s:match("/.git$") or s:match("\\.git$") or
|
||||
s:match(".exe$") or
|
||||
s:match(".bin$") or
|
||||
s:match(".obj$") or
|
||||
s:match(".o$") or
|
||||
s:match(".lib$") or
|
||||
s:match(".ilk$") or
|
||||
s:match(".cache$") or
|
||||
s:match(".exp$") or
|
||||
s:match(".pdb$") or
|
||||
s:match("/external/") or s:match("\\external\\")
|
||||
then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
BuiltinIsCodeMatchers = {
|
||||
IsCodeExclude,
|
||||
}
|
||||
IsCodeMatchers = BuiltinIsCodeMatchers
|
||||
|
||||
function IsCode(path, meta)
|
||||
for i = #IsCodeMatchers,1,-1 do
|
||||
rule = IsCodeMatchers[i]
|
||||
result = rule(path, meta)
|
||||
if result then
|
||||
return result
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
Reference in New Issue
Block a user