fix: resolve root dir if not specified

This commit is contained in:
Barrett Ruth 2024-07-21 19:13:57 -05:00
parent fde21e3dc4
commit 5fc8abb727
2 changed files with 1 additions and 13 deletions

View file

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
</html>

View file

@ -55,7 +55,7 @@ M.setup = function(user_config)
local function find_dir(args)
local dir = args ~= '' and args or '%:p:h'
return vim.fn.expand(vim.fn.fnamemodify(dir, ':p'))
return vim.fn.expand(vim.fn.fnamemodify(vim.fn.expand(dir), ':p'))
end
vim.api.nvim_create_user_command('LiveServerStart', function(opts)
@ -65,7 +65,6 @@ M.setup = function(user_config)
M.stop(find_dir(opts.args))
end, { nargs = '?' })
vim.api.nvim_create_user_command('LiveServerToggle', function(opts)
local dir = opts.args ~= '' and opts.args or '%:p:h'
M.toggle(find_dir(opts.args))
end, { nargs = '?' })
end