ubuntu16.04 install IDE that supports python3
1. Install vim:
# apt-get install -y vim-gnome
2. Install ctags, ctags is used to support taglist
# apt-get install ctags
3. Install taglist
# apt-get install vim-scripts vim-addon-manager
# vim-addons install taglist
4. Install pydiction to implement code completion:
# wget https://www.vim.org/scripts/script.php?script_id=850/pydiction-1.2.3.zip
# unzip pydiction-1.2.3.zip
# cd pydiction/after/ftplugin/
# mkdir /usr/share/vim/vim74/pydiction
# cp -rp python_pydiction.vim /usr/share/vim/vim74/ftplugin/
# cp complete-dict pydiction.py /usr/share/vim/vim74/pydiction/
5. Install python_fold automatic folding plugin
Download python_fold.vim:
https://www.vim.org/scripts/script.php?script_id=515
# mv python_fold.vim /usr/share/vim/vim74/plugin/
# vim /root/.vimrc
set foldmethod=indent
6. Generate ctag sequence:
Enter the directory where the python script is located, and execute it in that directory:
# ctags -R *
Generate a ctags file, which records the program/Analysis sequence records of project functions, classes, etc..7.Install taglist plugin:
Download plugin:
https://www.vim.org/scripts/script.php?script_id=273
# unzip taglist_46.zip
# cp plugin/taglist.vim /usr/share/vim/vim74/plugin/
# cp doc/taglist.txt /usr/share/vim/vim74/doc/
#vim
:helptags /usr/share/vim/vim74/doc "Generate taglist help file list.
: help taglist.txt "View taglist help information.
8. Install vim plug:
# mkdir ~/.vim/autoload/
# cd ~/.vim/autoload/
# wget https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Configure vim plug:
#vim /root/.vimrc
call plug#begin('~/.vim/autoload')
Plug 'Valloric/YouCompleteMe'
call plug#end()
# vim /root/.vimrc
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/vundle
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'vim-scripts/indentpython.vim'
Bundle 'Valloric/YouCompleteMe'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
call plug#begin('~/.vim/autoload')
Plug 'Valloric/YouCompleteMe'
call plug#end()set nocompatible "Turn off compatibility mode with vi
set number "Show line number
set nowrap "Do not wrap
set showmatch "Show matching brackets
set scrolloff=3"3 rows from top and bottom"set encoding=utf-8 "coding
set fenc=utf-8 "coding
" set mouse=a "Enable mouse
set hlsearch "Search highlight
syntax on "Syntax highlighting
set helplang=cn
set encoding=utf-8
" au BufNewFile,BufRead *.py
set tabstop=4set softtabstop=4set shiftwidth=4set textwidth=79set expandtab
set autoindent
set fileformat=unix
set foldmethod=indent
set autoindent "Implement automatic indentation
set foldmethod=indent
set shiftwidth=4set expandtab
set number
" Flagging Unnecessary Whitespace
highlight BadWhitespace ctermbg=red guibg=darkred
let Tlist_Auto_Highlight_Tag=1let Tlist_Auto_Open=1let Tlist_Auto_Update=1let Tlist_Display_Tag_Scope=1let Tlist_Exit_OnlyWindow=1let Tlist_Enable_Dold_Column=1let Tlist_File_Fold_Auto_Close=1let Tlist_Show_One_File=1let Tlist_Use_Right_Window=1let Tlist_Use_SingleClick=1
filetype plugin on
let g:pydiction_location ='/usr/share/vim/vim74/pydiction/complete-dict'let g:pydiction_menu_height =20
autocmd FileType python set omnifunc=pythoncomplete#Complete
let Tlist_Show_One_File =1 "Do not display tags of multiple files at the same time, only display the current file
let Tlist_Exit_OnlyWindow =1 "If the taglist window is the last window, exit vim
let Tlist_Use_Right_Window =1 "Show the taglist window in the right window
" let Tlist_Auto_Open=1 "After starting vim, the taglist window is automatically opened
" let Tlist_File_Fold_Auto_Close=1 "Only display the current file tag, the tags of other files are folded
let Tlist_Auto_Highlight_Tag=1let Tlist_Auto_Open=1let Tlist_Auto_Update=1let Tlist_Display_Tag_Scope=1let Tlist_Exit_OnlyWindow=1let Tlist_Enable_Dold_Column=1let Tlist_File_Fold_Auto_Close=1let Tlist_Show_One_File=1let Tlist_Use_Right_Window=1let Tlist_Use_SingleClick=1
nnoremap <silent><F8>:TlistToggle<CR>
filetype plugin on
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascrīpt set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete
autocmd FileType python set omnifunc=pythoncomplete#Complete
Plug-in installation:
Switch to the command line mode and enter
PlugStatus
PlugInstall
You can install the plugin
Use vim plug to easily manage plug-ins
View plug-in type:
:PlugStatus
Install the plugin:
:PlugInstall
Update plugin::PlugUpdate
vim-The plug itself is updated::PlugUpgrade
reference:
ubuntu16.04 makes Vim a powerful Python development environment:
https://www.jianshu.com/p/bc19b91354ef
Recommended Posts