Install python3.7
https://www.python.org/downloads/
https://www.python.org/downloads/release/python-372/
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
Install Python required dependencies
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel python-devel
Unzip tar
tar -xvzf Python-3.7.2.tgz
Configuration
cd Python3.7.2
make clean
. /configure --prefix=/usr/local/python3.7
make
make install
Delete old version python link
rm /usr/bin/python
ln -s /usr/local/python3.7/bin/python3.7 /usr/bin/python
Check if the installation is successful
python -V
Note: centos7 default python 2.7.5
For example: /usr/bin/firewall-cmd, /usr/bin/yum uses python2, please modify it to #!/usr/bin/python2
Source package download:
https://github.com/vim/vim
Download vim8.1:
https://github.com/vim/vim/archive/v8.1.0888.tar.gz
wget https://github.com/vim/vim/archive/v8.1.0888.tar.gz
Uninstall old version
yum remove vim*
Unzip tar
tar -xzvf v8.1.0888.tar.gz
cd vim-8.1.0888
Find the python3 configuration file path
Note: If you are using Python, your config directory may have a computer-specific name (such as config-3.5m-x86_64-linux-gnu) Find the path to the ptyhonn.o file
Because the YouCompleteMe plug-in will be installed later, the YCM plug-in requires vim to support python2, so both python2 and python3 are configured here.
. /configure --with-features=huge \
installation
make
make install
Create link
ln -s /usr/local/vim/bin/vim /usr/bin/vim
vim ~/.bashrc
alias vi='vim'
Configure vim environment to support python3
Vundle is a plugin management tool for Vim
mkdir -p ~/.vim/bundle
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
Add plugin
Note: between call vundle#begin()......call vundle#end(), open vim insert mode: PluginInstall
vim ~/.vimrc
" Vundle
" Remove VI consistency
set nocompatible
filetype off
" Set the running path of Vundle
set rtp+=~/.vim/bundle/Vundle.vim
" Set the installation path of the plug-in, the start flag of the vundle plug-in
call vundle#begin()
" Let vundle manage the plugin version
Plugin 'VundleVim/Vundle.vim'
" Set the installation path of the plugin, vundle plugin end flag
call vundle#end()
" Load the syntax and file type related scripts that come with vim and plug-ins
filetype plugin indent on
set encoding=utf-8 "Set utf-8 encoding
set number "display line number
syntax on "Turn on syntax highlighting
set background=dark "Set the background color
set showmatch "Display matched parentheses
set backspace=2 "You can delete any value
set scrolloff=5 "5 lines from the top and bottom
set laststatus=2 "The command line is two lines
set fenc=utf-8 "file encoding
" Python
set filetype=python
au BufNewFile,BufRead .py,.pyw setf python
set autoindent "Set auto indent
set smartindent "Automatically indent the next line
set textwidth=79 "Maximum line width
set expandtab "tab is replaced with a space bar
set tabstop=4 "Set table length
set softtabstop=4 "The width of softtabstop is 4
set shiftwidth=4 "Set the number of spaces for indentation to 4
set fileformat=unix "Set to save the file in unix format
set foldmethod=indent "Automatic folding
set foldlevel=79 "Up to 79 characters
" F5 direct debugging in vim
map
func! RunPython()
exec "w"
if &filetype =='python' "The first line#!/bin/python Run the python compiler
exec "!time python %"
elseif &filetype =='sh' "The first line #!/bin/bash Run the shell compiler
:! time bash %
endif
endfunc
Recommended Posts