vim配置python代码提示,VIM配置成Python IDE

一、~/.vimrc 文件内容:

set nocompatible              " required

filetype off                  " required

set rtp+=~/.vim/bundle/Vundle.vim

call vundle#begin()

Plugin 'gmarik/Vundle.vim'

Plugin 'tmhedberg/SimpylFold'

Plugin 'jistr/vim-nerdtree-tabs'

Plugin 'kien/ctrlp.vim'

Plugin 'Valloric/YouCompleteMe'

Plugin 'scrooloose/nerdtree'

Plugin 'Xuyuanp/nerdtree-git-plugin'

Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}

Plugin 'kien/ctrlp.vim'

Plugin 'scrooloose/nerdcommenter'  " commenter: \cc \cu

Plugin 'vim-scripts/indentpython.vim'

Plugin 'tpope/vim-fugitive'

Plugin 'nvie/vim-flake8'

Plugin 'jnurmine/Zenburn'

Plugin 'altercation/vim-colors-solarized'

call vundle#end()            " required

filetype plugin indent on    " required

set nuset foldmethod=indentau BufWinLeave * silent mkview  " 保存文件的折叠状态au BufRead * silent loadview    " 恢复文件的折叠状态nnoremapza            " 用空格来切换折叠状态nnoremap" Ctrl+N 打开/关闭map:NERDTreeToggle" 当不带参数打开Vim时自动加载项目树

autocmd StdinReadPre * let s:std_in=1

autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif

" 当所有文件关闭时关闭项目树窗格

autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif" 不显示这些文件let NERDTreeIgnore=['\.pyc

, '\~

, 'node_modules'] "ignore files in NERDTree" 不显示项目树上额外的信息,例如帮助、提示什么的let NERDTreeMinimalUI=1let g:ctrlp_working_path_mode = 'ra'set wildignore+=*/tmp/*,*/node_modules/*,*.so,*.swp,*.zip    let g:ctrlp_custom_ignore = {'dir':  '\v[\/]\.(git|hg|svn)

, 'file': '\v\.(exe|so|dll)

}set pastetoggle=set guifont=Inconsolata\ for\ Powerline:h15let g:Powerline_symbols = 'fancy'set encoding=utf-8set t_Co=256set fillchars+=stl:\ ,stlnc:\set term=xterm-256colorset termencoding=utf-8let mapleader=';'let g:SimpylFold_docstring_preview=1let g:ycm_autoclose_preview_window_after_completion=1mapg  :YcmCompleter GoToDefinitionElseDeclarationau BufNewFile,BufRead *.py "pthon编码风格

\ set tabstop=4

\ set softtabstop=4

\ set shiftwidth=4

\ set textwidth=79

\ set expandtab

\ set autoindent

\ set fileformat=unix

"au BufNewFile,BufRead *.js, *.html, *.css

"\ set tabstop=2

"\ set softtabstop=2

"\ set shiftwidth=2

au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/

set encoding=utf-8

"python with virtualenv support

"py << EOF

"import os

"import sys

"if 'VIRTUAL_ENV' in os.environ:

"  project_base_dir = os.environ['VIRTUAL_ENV']

"    activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')

"      execfile(activate_this, dict(__file__=activate_this))

"      EOF

let python_highlight_all=1

syntax on

if has('gui_running')

set background=dark

colorscheme solarized

else

colorscheme Zenburn

endif

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

set clipboard=unnamed

"bash setting

autocmd BufNewFile *.py,*.sh, exec ":call SetTitle()"

let $author_name = "Aaron.Ren"

let $author_email = "kyednal@foxmail.com"

func SetTitle()

if &filetype == 'sh'

call setline(1,"\###################################################################")

call append(line("."), "\# File Name: ".expand("%"))

call append(line(".")+1, "\# Author: ".$author_name)

call append(line(".")+2, "\# mail: ".$author_email)

call append(line(".")+3, "\# Created Time: ".strftime("%c"))

call append(line(".")+4, "\##################################################################")

call append(line(".")+5, "\#!/bin/bash")

call append(line(".")+6, "")

else

call setline(1,"\###################################################################")

call append(line("."), "\# File Name: ".expand("%"))

call append(line(".")+1, "\# Author: ".$author_name)

call append(line(".")+2, "\# mail: ".$author_email)

call append(line(".")+3, "\# Created Time: ".strftime("%c"))

call append(line(".")+4, "\###################################################################")

call append(line(".")+5, "\#!/bin/python")

call append(line(".")+6, "\# -*- coding:utf-8 -*-")

call append(line(".")+7, "")

endif

endfunc

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值