Skip to content

Commit

Permalink
fix: error opening recent projects (#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkhg authored Feb 7, 2024
1 parent c045eb2 commit 96a45f3
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions lua/dashboard/theme/hyper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,25 @@ end
local function map_key(config, key, content)
keymap.set('n', key, function()
local text = content or api.nvim_get_current_line()
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')
end

if config.mru.cwd_only then
local scol = text:find(' %w')
text = text:sub(scol)
else
local scol = utils.is_win and text:find('%w') or text:find('%p')
text = text:sub(scol)

path = text:sub(1, text:find('%w(%s+)$'))
path = vim.fs.normalize(path)
end

local path = text:sub(1, text:find('%w(%s+)$'))
path = vim.fs.normalize(path)
if vim.fn.isdirectory(path) == 1 then
if path == nil then
vim.cmd('enew')
elseif vim.fn.isdirectory(path) == 1 then
vim.cmd('lcd ' .. path)
if type(config.project.action) == 'function' then
config.project.action(path)
Expand Down

0 comments on commit 96a45f3

Please sign in to comment.