Skip to content

Commit

Permalink
fix: handle filename start with dot (#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkhg authored Feb 8, 2024
1 parent 7514748 commit 320ae0c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lua/dashboard/theme/hyper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,11 @@ local function map_key(config, key, content)
local scol = utils.is_win and text:find('%w') or text:find('%p')
local path = nil

if scol ~= nil then
local is_tilde = text:sub(scol, scol) == '~'

if not is_tilde then
scol = text:find('%w')
if scol ~= nil then -- scol == nil if pressing enter in empty space
if text:sub(scol, scol + 1) ~= '~/' then -- is relative path
scol = math.min(text:find('%w'), text:find('%p'))
end

text = text:sub(scol)

path = text:sub(1, text:find('%w(%s+)$'))
path = vim.fs.normalize(path)
end
Expand All @@ -312,7 +308,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
Expand Down

0 comments on commit 320ae0c

Please sign in to comment.