aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/health.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2023-01-16 04:55:24 -0500
committerGitHub <noreply@github.com>2023-01-16 01:55:24 -0800
commit307efe4906de9f0b7d8611ea36bddb85493c1447 (patch)
tree943a88695f0cbf0a931e10d7e466f3329bac7ebb /runtime/lua/vim/health.lua
parent8a5dad44a7ab777c78312471a8a46600d3412b38 (diff)
downloadrneovim-307efe4906de9f0b7d8611ea36bddb85493c1447.tar.gz
rneovim-307efe4906de9f0b7d8611ea36bddb85493c1447.tar.bz2
rneovim-307efe4906de9f0b7d8611ea36bddb85493c1447.zip
health: migrate to Lua #21661
* refactor: remove all vimscript from nvim/health * fixup: previous method broke if you had a folder named 'x-lua'
Diffstat (limited to 'runtime/lua/vim/health.lua')
-rw-r--r--runtime/lua/vim/health.lua15
1 files changed, 14 insertions, 1 deletions
diff --git a/runtime/lua/vim/health.lua b/runtime/lua/vim/health.lua
index b875da0abc..044880e076 100644
--- a/runtime/lua/vim/health.lua
+++ b/runtime/lua/vim/health.lua
@@ -23,7 +23,20 @@ end
local path2name = function(path)
if path:match('%.lua$') then
-- Lua: transform "../lua/vim/lsp/health.lua" into "vim.lsp"
- return path:gsub('.-lua[%\\%/]', '', 1):gsub('[%\\%/]', '.'):gsub('%.health.-$', '')
+
+ -- Get full path, make sure all slashes are '/'
+ path = vim.fs.normalize(path)
+
+ -- Remove everything up to the last /lua/ folder
+ path = path:gsub('^.*/lua/', '')
+
+ -- Remove the filename (health.lua)
+ path = vim.fn.fnamemodify(path, ':h')
+
+ -- Change slashes to dots
+ path = path:gsub('/', '.')
+
+ return path
else
-- Vim: transform "../autoload/health/provider.vim" into "provider"
return vim.fn.fnamemodify(path, ':t:r')