nvim: snippets: don't fail if project root not found
This commit is contained in:
parent
64943d0144
commit
2ffd49532d
|
@ -96,6 +96,7 @@ function MY_get_project_root()
|
|||
end
|
||||
end
|
||||
until path == ''
|
||||
return nil
|
||||
end
|
||||
|
||||
function MY_shell_capture(command)
|
||||
|
|
|
@ -52,7 +52,9 @@ return {
|
|||
},
|
||||
fmt(agpl, {
|
||||
project = f(function()
|
||||
return MY_get_project_root():gsub('.*/', '')
|
||||
local root = MY_get_project_root()
|
||||
if root then return root:gsub('.*/', '') end
|
||||
return 'INSERT_PROJECT'
|
||||
end),
|
||||
year = f(function()
|
||||
return os.date('%Y')
|
||||
|
@ -74,7 +76,9 @@ return {
|
|||
},
|
||||
fmt(bsd0, {
|
||||
project = f(function()
|
||||
return MY_get_project_root():gsub('.*/', '')
|
||||
local root = MY_get_project_root()
|
||||
if root then return root:gsub('.*/', '') end
|
||||
return 'INSERT_PROJECT'
|
||||
end),
|
||||
year = f(function()
|
||||
return os.date('%Y')
|
||||
|
|
Loading…
Reference in New Issue
Block a user