打造vim的python编辑器

最好重新装vim

$sudo apt-get remove vim-tiny
$apt-get update
$apt-get install vim
$ vim --version 

如果不支持,则要装

$ sudo apt install vim-nox-py2

装好后若支持会出现’+python’
在这里插入图片描述

安装Vundle(类似python的pip)

git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim

在根目录下新建文件.vimrc

$ cd
~$ touch .vimrc

三、下列代码写入 .vimrc 文件

set nocompatible              " required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" Add all your plugins here (note older versions of Vundle used Bundle instead of Plugin)
"install flake8 to check errors
Plugin 'scrooloose/syntastic'
Plugin 'nvie/vim-flake8'
"document-tree
Plugin 'scrooloose/nerdtree'
"Powerline
Plugin 'Lokaltog/vim-powerline'
"指示线
Plugin 'Yggdroot/indentLine'
"自动补全括号和引号等
Plugin 'jiangmiao/auto-pairs'
"配色方案(终端模式)
Plugin 'jnurmine/Zenburn'
"配色方案(GUI模式)
Plugin 'altercation/vim-colors-solarized'
"超级搜索
Plugin 'kien/ctrlp.vim'
"markdown插件
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'



" indentpython.vim
"
"
" All of your Plugins must be added before the following line
call vundle#end()            " required

"split navigations
nnoremap  
nnoremap  
nnoremap  
nnoremap  
nnoremap gl :YcmCompleter GoToDeclaration
nnoremap gf :YcmCompleter GoToDefinition
nnoremap gg :YcmCompleter GoToDefinitionElseDeclaration
let g:ycm_autoclose_preview_window_after_completion=1 "Completer's window wont close
let python_highlight_all=1
syntax on

"powerline
set guifont=PowerlineSymbols\ for\ Powerline
set nocompatible
set t_Co=256
let g:Powerline_symbols = 'fancy'

"hide *.pyc files
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree

"enable pep8 indentation
au BufNewfile,BufRead *.py
			\set tabstop=4
			\set softtabstop=4
			\set shiftwidth=4
			\set textwidth=79
			\set expandtab
			\set autoindent
			\set fileformat=unix
			\set encoding=utf-8"
			\set foldmethod=indent
			\set foldlevel=99
" highlight the badwhitespace
"au BufRead,BufNewfile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/


"enable folding 
"set foldmethod=indent "缩进折叠
"set foldlevel=99

set nu "显示行号
"enable folding with spacebar
nnoremap  za

"hotkey of nerdtree
map  :NERDTreeToggle

"按F5键运行python代码
map  :call RunPython()
func! RunPython()
    exec "W"
    if &filetype == 'python'
	exec "!time python %"
    endif
endfunc

"instrall YouCompleteMe 
"cd 
"cd .vim/bundle/YouCompleteMe/
"./install.py --clang-completer
Bundle 'Valloric/YouCompleteMe'


"判断运行模式,选择配色方案
if has('gui_running')
  set background=dark
  colorscheme solarized
else
  colorscheme zenburn
endif
filetype plugin indent on    " required

四、保存退出,重新进入vim

~$ vim
:PluginInstall

出现’Procession xxx’字样
等待它装完
在这里插入图片描述
五、前面步骤装了youcompleteme但是未编译

cd ~/.vim/bundle/YouCompleteMe
git submodule update --init --recursive
./install.py --clang-complete

你可能感兴趣的:(linux,python,vim)