@@ -63,14 +63,19 @@ if has('python3')
6363 setlocal omnifunc = python3complete#Complete
6464endif
6565
66+ function ! s: pcall_require (name) abort
67+ if ! has (' nvim' ) | return 0 | endif
68+ call luaeval (' pcall(require, _A[0])' , a: name )
69+ return v: true
70+ endfunction
6671
6772" shortcuts
6873" =========
6974
7075" CTRL-B: insert breakpoint above?
7176imap <buffer> <C-B> <ESC><leader> ba<Down>
7277
73- if has_key ( g: , ' plugs ' ) && has_key ( g: plugs , ' vim-surround' )
78+ if 1 " TODO: HasPlug( 'vim-surround')
7479 " Apply str(...) repr(...) to the current word or selection
7580 " :help surround-replacements
7681 nmap <buffer> <leader> str ysiwfstr<CR>
@@ -137,14 +142,14 @@ endfunction
137142" <F5> to run &makeprg on a floaterm window (experimental)
138143" pytest or execute the script itself, as per &makeprg
139144let s: is_test_file = (expand (' %:t:r' ) = ~# " _test$" || expand (' %:t:r' ) = ~# ' ^test_' )
140- if has_key ( g: plugs , ' neotest-python' ) && s: is_test_file
145+ if s: is_test_file && s: pcall_require ( ' neotest-python' )
141146 " see ~/.config/nvim/config/tesing.lua commands
142147 command ! - buffer -nargs =0 Build echom ' :Test' | Test
143148 command ! - buffer -nargs =0 Output NeotestOutput
144149
145150 nnoremap <buffer> <leader> T <cmd> NeotestSummary<CR>
146151
147- elseif has_key ( g: plugs , ' vim-floaterm ' )
152+ elseif exists ( ' g:loaded_floaterm ' )
148153 let s: ftname = ' makepython'
149154 function ! MakeInTerminal () abort
150155 let l: bufnr = floaterm#terminal#get_bufnr (s: ftname )
0 commit comments