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
|
||||||
end
|
end
|
||||||
until path == ''
|
until path == ''
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function MY_shell_capture(command)
|
function MY_shell_capture(command)
|
||||||
|
|
|
@ -52,7 +52,9 @@ return {
|
||||||
},
|
},
|
||||||
fmt(agpl, {
|
fmt(agpl, {
|
||||||
project = f(function()
|
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),
|
end),
|
||||||
year = f(function()
|
year = f(function()
|
||||||
return os.date('%Y')
|
return os.date('%Y')
|
||||||
|
@ -74,7 +76,9 @@ return {
|
||||||
},
|
},
|
||||||
fmt(bsd0, {
|
fmt(bsd0, {
|
||||||
project = f(function()
|
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),
|
end),
|
||||||
year = f(function()
|
year = f(function()
|
||||||
return os.date('%Y')
|
return os.date('%Y')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user