Skip to content

Commit 5f4907c

Browse files
committed
Move NNN_SEL to terminal env when it was created.
1 parent 09485c1 commit 5f4907c

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

autoload/nnn.vim

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,18 @@ endfunction
264264

265265
function! s:create_term_buf(opts)
266266
if has("nvim")
267-
call termopen([g:nnn#shell, &shellcmdflag, a:opts.cmd], {'on_exit': a:opts.on_exit })
267+
call termopen([g:nnn#shell, &shellcmdflag, a:opts.cmd], {
268+
\ 'env': { 'NNN_SEL': s:temp_file },
269+
\ 'on_exit': a:opts.on_exit
270+
\ })
268271
startinsert
269272
return bufnr('')
270273
else
271274
let l:curwin = get(a:opts, 'curwin', 1)
272275
let l:hidden = get(a:opts, 'hidden', 0)
273276
let l:Exit_cb = get(a:opts, 'on_exit')
274277
let l:tbuf = term_start([g:nnn#shell, &shellcmdflag, a:opts.cmd], {
278+
\ 'env': { 'NNN_SEL': s:temp_file },
275279
\ 'curwin': l:curwin,
276280
\ 'hidden': l:hidden,
277281
\ 'exit_cb': l:Exit_cb
@@ -366,7 +370,6 @@ function! nnn#pick(...) abort
366370
let l:sess_cfg = ' '
367371
endif
368372

369-
let g:nnn#command = 'NNN_SEL='.shellescape(s:temp_file).' '.g:nnn#command
370373
let l:cmd = g:nnn#command.l:sess_cfg.' -p '.shellescape(s:temp_file).' '.(l:directory != '' ? shellescape(l:directory): '')
371374
let l:layout = exists('l:opts.layout') ? l:opts.layout : g:nnn#layout
372375

0 commit comments

Comments
 (0)