From d11d10db26778afa5e3b33f47bb26d4739c36bae Mon Sep 17 00:00:00 2001 From: Kyal Lanum Date: Tue, 12 Nov 2024 15:18:25 -0700 Subject: [PATCH 1/2] Supports spaces in path for projects. Adds error checking for brackets in name. --- lua/dashboard/theme/hyper.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/dashboard/theme/hyper.lua b/lua/dashboard/theme/hyper.lua index d555ae6..e0ff598 100644 --- a/lua/dashboard/theme/hyper.lua +++ b/lua/dashboard/theme/hyper.lua @@ -303,12 +303,17 @@ local function map_key(config, key, content) end text = text:sub(scol) path = text:sub(1, text:find('%w(%s+)$')) + if string.find(path, '[%]%[]') ~= nil then + vim.notify('Brackets in path names are not currently supported', vim.log.levels.ERROR) + return + end path = vim.fs.normalize(path) end if path == nil then vim.cmd('enew') elseif vim.fn.isdirectory(path) == 1 then + path = vim.fn.fnameescape(path) vim.cmd('lcd ' .. path) if type(config.project.action) == 'function' then config.project.action(path) @@ -321,7 +326,7 @@ local function map_key(config, key, content) end end else - vim.cmd('edit ' .. vim.fn.fnameescape(path)) + vim.cmd('edit ' .. path) local root = utils.get_vcs_root() if not config.change_to_vcs_root then return From 8384179a019e907bf7153d706add826919cd6a94 Mon Sep 17 00:00:00 2001 From: Kyal Lanum Date: Tue, 12 Nov 2024 15:24:15 -0700 Subject: [PATCH 2/2] fixed one last thing --- lua/dashboard/theme/hyper.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/dashboard/theme/hyper.lua b/lua/dashboard/theme/hyper.lua index e0ff598..b8ab1a6 100644 --- a/lua/dashboard/theme/hyper.lua +++ b/lua/dashboard/theme/hyper.lua @@ -326,7 +326,7 @@ local function map_key(config, key, content) end end else - vim.cmd('edit ' .. path) + vim.cmd('edit ' .. vim.fn.fnameescape(path)) local root = utils.get_vcs_root() if not config.change_to_vcs_root then return