1. 程式人生 > >打造vim的python3編輯器

打造vim的python3編輯器

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'

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

"split navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
nnoremap gl :YcmCompleter GoToDeclaration<CR>
nnoremap gf :YcmCompleter GoToDefinition<CR>
nnoremap gg :YcmCompleter GoToDefinitionElseDeclaration<CR>
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"
" 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 <space> za

"hotkey of nerdtree
map <C-n> :NERDTreeToggle<CR>

"按F5鍵執行python程式碼
map <F5> :call RunPython()<CR>
func! RunPython()
    exec "W"
    if &filetype == 'python'
	exec "!time python3 %"
    endif
endfunc

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


filetype plugin indent on    " required