Skip to content

Commit 74e2f39

Browse files
committed
evaluate shell config lazily
since &shell can change anytime within the vim session
1 parent ab87283 commit 74e2f39

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

autoload/nnn.vim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,16 @@ function! s:switch_back(opts, Cmd)
182182
endfunction
183183

184184
function! s:create_term_buf(opts)
185+
let l:shell = get(g:, 'nnn#shell', &shell)
185186
if has('nvim')
186-
call termopen([g:nnn#shell, &shellcmdflag, a:opts.cmd], {
187+
call termopen([l:shell, &shellcmdflag, a:opts.cmd], {
187188
\ 'env': { 'NNN_SEL': s:temp_file },
188189
\ 'on_exit': a:opts.on_exit
189190
\ })
190191
startinsert
191192
return bufnr('')
192193
else
193-
return term_start([g:nnn#shell, &shellcmdflag, a:opts.cmd], {
194+
return term_start([l:shell, &shellcmdflag, a:opts.cmd], {
194195
\ 'curwin': get(a:opts, 'curwin', 1),
195196
\ 'hidden': get(a:opts, 'hidden', 0),
196197
\ 'env': { 'NNN_SEL': s:temp_file },

plugin/nnn.vim

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ if !exists('g:nnn#statusline')
2525
let g:nnn#statusline = 1
2626
endif
2727

28-
if !exists('g:nnn#shell')
29-
let g:nnn#shell = &shell
30-
endif
31-
3228
if !exists('g:nnn#session')
3329
let g:nnn#session = "none"
3430
endif

0 commit comments

Comments
 (0)