File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -281,18 +281,25 @@ end
281281local function map_key (config , key , content )
282282 keymap .set (' n' , key , function ()
283283 local text = content or api .nvim_get_current_line ()
284+ local scol = utils .is_win and text :find (' %w' ) or text :find (' %p' )
285+ local path = nil
286+
287+ if scol ~= nil then
288+ local is_tilde = text :sub (scol , scol ) == ' ~'
289+
290+ if not is_tilde then
291+ scol = text :find (' %w' )
292+ end
284293
285- if config .mru .cwd_only then
286- local scol = text :find (' %w' )
287- text = text :sub (scol )
288- else
289- local scol = utils .is_win and text :find (' %w' ) or text :find (' %p' )
290294 text = text :sub (scol )
295+
296+ path = text :sub (1 , text :find (' %w(%s+)$' ))
297+ path = vim .fs .normalize (path )
291298 end
292299
293- local path = text : sub ( 1 , text : find ( ' %w(%s+)$ ' ))
294- path = vim .fs . normalize ( path )
295- if vim .fn .isdirectory (path ) == 1 then
300+ if path == nil then
301+ vim .cmd ( ' enew ' )
302+ elseif vim .fn .isdirectory (path ) == 1 then
296303 vim .cmd (' lcd ' .. path )
297304 if type (config .project .action ) == ' function' then
298305 config .project .action (path )
You can’t perform that action at this time.
0 commit comments