Skip to content

Commit 32d106a

Browse files
authored
Merge pull request #148 from mcchrish/open-file-relative-cwd
Open file relative cwd
2 parents 98b00d0 + c18b8af commit 32d106a

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

autoload/nnn.vim

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,18 @@ function! s:eval_temp_file(opts)
9090
if (type(l:Cmd) == v:t_func)
9191
call l:Cmd(l:names)
9292
else
93-
" Remove directories and missing files
93+
" Remove directories and unreadable files
9494
call filter(l:names, {_, val -> !isdirectory(val) && filereadable(val) })
95-
" Consider trimming out current working directory from filename
96-
let l:cwd = getcwd()
97-
call map(l:names, { _, val -> strcharpart(val, 0, strlen(l:cwd)) ==# l:cwd ? strcharpart(val, strlen(l:cwd) + 1) : val }) " + 1 is to also remove the trailing slash
9895
call reverse(l:names)
9996
" Edit the first item.
100-
execute 'silent' l:Cmd fnameescape(l:names[0])
97+
execute(join([l:Cmd,fnameescape(fnamemodify(l:names[0], ':.'))], ' '))
10198
" Add any remaining items to the arg list/buffer list.
10299
for l:name in l:names[1:]
103-
execute 'silent argadd' fnameescape(l:name)
100+
execute(join(['argadd', fnameescape(fnamemodify(l:name, ':.'))], ' '))
104101
endfor
105102
endif
106103

107104
let s:action = '' " reset action
108-
redraw!
109105
endfunction
110106

111107
function! s:popup(opts, term_opts)

0 commit comments

Comments
 (0)