[NVIM] YCM autoinstall, fix python path
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
set nocompatible
|
set nocompatible
|
||||||
filetype off
|
filetype off
|
||||||
|
|
||||||
|
|
||||||
" Plugins
|
" Plugins
|
||||||
" Note: on most systems, this will make the plugins reside in \
|
" Note: on most systems, this will make the plugins reside in \
|
||||||
" ~/.local/share/nvim/plugged/
|
" ~/.local/share/nvim/plugged/
|
||||||
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
|
let data_dir = has('nvim') ? stdpath('data') . '/site' : expand('~/.vim')
|
||||||
if empty(glob(data_dir . '/autoload/plug.vim'))
|
if empty(glob(data_dir . '/autoload/plug.vim'))
|
||||||
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||||
let &runtimepath = &runtimepath
|
let &runtimepath = &runtimepath
|
||||||
@@ -14,6 +15,19 @@ endif
|
|||||||
" Disable Perl
|
" Disable Perl
|
||||||
let g:loaded_perl_provider = 0
|
let g:loaded_perl_provider = 0
|
||||||
|
|
||||||
|
" Find python
|
||||||
|
if has("macunix")
|
||||||
|
" Required for virtualenvs
|
||||||
|
let arch=substitute(system('uname -m'), '\n', '', '')
|
||||||
|
if arch == 'arm64'
|
||||||
|
let g:python_interpreter=expand("~/python-envs/neovim/bin/python3")
|
||||||
|
else
|
||||||
|
let g:python_interpreter="/usr/local/bin/python3"
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
let g:python_interpreter = 'python3'
|
||||||
|
endif
|
||||||
|
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
|
|
||||||
" Warn about plugin updates
|
" Warn about plugin updates
|
||||||
@@ -44,7 +58,17 @@ Plug 'ConradIrwin/vim-bracketed-paste'
|
|||||||
Plug 'christoomey/vim-tmux-navigator'
|
Plug 'christoomey/vim-tmux-navigator'
|
||||||
|
|
||||||
" YouCompleteMe
|
" YouCompleteMe
|
||||||
Plug 'Valloric/YouCompleteMe'
|
function! BuildYCM(info)
|
||||||
|
" info is a dictionary with 3 fields
|
||||||
|
" - name: name of the plugin
|
||||||
|
" - status: 'installed', 'updated', or 'unchanged'
|
||||||
|
" - force: set on PlugInstall! or PlugUpdate!
|
||||||
|
if a:info.status == 'installed' || a:info.force
|
||||||
|
execute '!' . g:python_interpreter . ' ./install.py --all'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
Plug 'ycm-core/YouCompleteMe', { 'do': function('BuildYCM') }
|
||||||
Plug 'rdnetto/YCM-Generator'
|
Plug 'rdnetto/YCM-Generator'
|
||||||
|
|
||||||
" Git
|
" Git
|
||||||
@@ -218,9 +242,11 @@ nmap <C-]> <C-w><C-]><C-w>T
|
|||||||
|
|
||||||
" YouCompleteMe
|
" YouCompleteMe
|
||||||
let g:ycm_collect_identifiers_from_tags_files = 1 " Read from tag files
|
let g:ycm_collect_identifiers_from_tags_files = 1 " Read from tag files
|
||||||
let g:ycm_global_ycm_extra_conf = '~/.config/nvim/.ycm_extra_conf.py' " Standard conf
|
let g:ycm_global_ycm_extra_conf = expand('~/.config/nvim/.ycm_extra_conf.py') " Standard conf
|
||||||
let g:ycm_enable_diagnostic_signs = 0 " Do not show semantic error bar
|
let g:ycm_enable_diagnostic_signs = 0 " Do not show semantic error bar
|
||||||
let g:ycm_server_python_interpreter = 'python3'
|
let g:ycm_server_python_interpreter=g:python_interpreter
|
||||||
|
" Enable virtualenv autocompletion
|
||||||
|
let g:ycm_python_binary_path = 'python'
|
||||||
let g:ycm_key_list_select_completion = ['<C-j>', '<C-n>', '<Down>']
|
let g:ycm_key_list_select_completion = ['<C-j>', '<C-n>', '<Down>']
|
||||||
let g:ycm_key_list_previous_completion = ['<C-k>', '<C-p>', '<Up>']
|
let g:ycm_key_list_previous_completion = ['<C-k>', '<C-p>', '<Up>']
|
||||||
|
|
||||||
@@ -284,13 +310,4 @@ catch
|
|||||||
endtry
|
endtry
|
||||||
let g:tex_flavor = "latex"
|
let g:tex_flavor = "latex"
|
||||||
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
|
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
|
||||||
|
let g:python3_host_prog=g:python_interpreter
|
||||||
if has("macunix")
|
|
||||||
" Required for virtualenvs
|
|
||||||
let arch=substitute(system('uname -m'), '\n', '', '')
|
|
||||||
if arch == 'arm64'
|
|
||||||
let g:python3_host_prog="~/python-envs/neovim/bin/python3"
|
|
||||||
else
|
|
||||||
let g:python3_host_prog="/usr/local/bin/python3"
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|||||||
Reference in New Issue
Block a user