1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Simplify the way to get correct python3_host_prog

This commit is contained in:
jdhao 2019-11-05 01:05:13 +08:00
parent f426ec3c4a
commit d290d79bb9

View File

@ -1,20 +1,20 @@
"{ Global Variable "{ Global Variable
"{{ Builtin variables "{{ Builtin variables
" Path to Python 3 interpreter (must be an absolute path), make startup " Path to Python 3 interpreter (must be an absolute path), make startup
" faster. See https://neovim.io/doc/user/provider.html. Change this variable " faster. See https://neovim.io/doc/user/provider.html.
" in accordance with your system.
if executable('python') if executable('python')
" The output of `system()` function contains a newline character which if has('win32')
" should be removed, see https://vi.stackexchange.com/a/2868/15292 let g:python3_host_prog=substitute(exepath('python'), '.exe$', '', 'g')
if has('win32')
let g:python3_host_prog=substitute(system('where python'), '.exe\n\+$', '', 'g')
elseif has('unix') elseif has('unix')
let g:python3_host_prog=substitute(system('which python'), '\n\+$', '', 'g') let g:python3_host_prog=exepath('python')
endif endif
else else
echoerr 'Python executable not found! You must install Python and set its PATH!' echoerr 'Python executable not found! You must install Python and set its PATH!'
endif endif
" Disable Python2 support
let g:loaded_python_provider=0
" Custom mapping <leader> (see `:h mapleader` for more info) " Custom mapping <leader> (see `:h mapleader` for more info)
let mapleader = ',' let mapleader = ','
"}} "}}
@ -37,4 +37,4 @@ let g:loaded_tarPlugin = 1
let loaded_matchit = 1 let loaded_matchit = 1
let g:loaded_matchparen = 1 let g:loaded_matchparen = 1
"}} "}}
"} "}}