fix: resolve root dir if not specified
This commit is contained in:
parent
fde21e3dc4
commit
5fc8abb727
2 changed files with 1 additions and 13 deletions
11
index.html
11
index.html
|
|
@ -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>
|
|
||||||
|
|
@ -55,7 +55,7 @@ M.setup = function(user_config)
|
||||||
|
|
||||||
local function find_dir(args)
|
local function find_dir(args)
|
||||||
local dir = args ~= '' and args or '%:p:h'
|
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
|
end
|
||||||
|
|
||||||
vim.api.nvim_create_user_command('LiveServerStart', function(opts)
|
vim.api.nvim_create_user_command('LiveServerStart', function(opts)
|
||||||
|
|
@ -65,7 +65,6 @@ M.setup = function(user_config)
|
||||||
M.stop(find_dir(opts.args))
|
M.stop(find_dir(opts.args))
|
||||||
end, { nargs = '?' })
|
end, { nargs = '?' })
|
||||||
vim.api.nvim_create_user_command('LiveServerToggle', function(opts)
|
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))
|
M.toggle(find_dir(opts.args))
|
||||||
end, { nargs = '?' })
|
end, { nargs = '?' })
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue