vim 作为python2.7 IDE的配置

来源:互联网 发布:珠光宝气人物分析知乎 编辑:程序博客网 时间:2024/06/09 04:43

1.首先下载vundle,wombat256mod风格插件和folding插件

” mkdir -p ~/.vim/bundle/vundle
” git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

” Color scheme
” mkdir -p ~/.vim/colors && cd ~/.vim/colors
” wget -O wombat256mod.vim http://www.vim.org/scripts/download_script.php?src_id=13400

” Python folding
” mkdir -p ~/.vim/ftplugin
” wget -O ~/.vim/ftplugin/python_editing.vim http://www.vim.org/scripts/download_script.php?src_id=5492

2.~/.vimrc文件如下内容

set nocompatiblefiletype off" mkdir -p  ~/.vim/bundle/vundle" git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundleset rtp+=~/.vim/bundle/vundle/call vundle#rc()" let Vundle manage Vundle" required!Bundle 'gmarik/vundle'" The bundles you install will be listed herefiletype plugin indent on" The rest of your config follows hereaugroup vimrc_autocmds    autocmd!    " highlight characters past column 120    autocmd FileType python highlight Excess ctermbg=DarkGrey guibg=Black    autocmd FileType python match Excess /\%120v.*/    autocmd FileType python set nowrap    augroup ENDlet g:islinux = 1if has("gui_running")    let g:isGUI = 1else    let g:isGUI = 0endifif g:islinux    set hlsearch          set incsearch        " Uncomment the following to have Vim jump to the last position when    " reopening a file    if has("autocmd")        au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif    endif    if g:isGUI        " Source a global configuration file if available        if filereadable("/etc/vim/gvimrc.local")            source /etc/vim/gvimrc.local        endif    else        " This line should not be removed as it ensures that various options are        " properly set to work with the Vim-related packages available in Debian.        runtime! debian.vim        " Vim5 and later versions support syntax highlighting. Uncommenting the next        " line enables syntax highlighting by default.        if has("syntax")            syntax on        endif        set mouse=a         set t_Co=256         set backspace=2           " Source a global configuration file if available        if filereadable("/etc/vim/vimrc.local")            source /etc/vim/vimrc.local        endif    endifendifif g:isGUI    set guioptions-=m    set guioptions-=T    set guioptions-=r    set guioptions-=L    map <silent> <c-F11> :if &guioptions =~# 'm' <Bar>        \set guioptions-=m <Bar>        \set guioptions-=T <Bar>        \set guioptions-=r <Bar>        \set guioptions-=L <Bar>    \else <Bar>        \set guioptions+=m <Bar>        \set guioptions+=T <Bar>        \set guioptions+=r <Bar>        \set guioptions+=L <Bar>    \endif<CR>endifset autoreadnmap cS :%s/\s\+$//g<CR>:noh<CR>nmap cM :%s/\r$//g<CR>:noh<CR>set shortmess=atI  filetype plugin indent onPlugin 'vim-airline/vim-airline'Plugin 'vim-airline/vim-airline-themes'let g:airline_theme='wombat'Bundle 'jiangmiao/auto-pairs'  Bundle 'tpope/vim-fugitive'Bundle 'scrooloose/nerdtree'map <F2> :NERDTreeToggle<CR>Bundle 'klen/python-mode'let g:pymode_rope = 0" Documentationlet g:pymode_doc = 1let g:pymode_doc_key = 'K'"Lintinglet g:pymode_lint = 0let g:pymode_lint_checker = "pep8"" Auto check on savelet g:pymode_lint_write = 1" Support virtualenvlet g:pymode_virtualenv = 0" Enable breakpoints pluginlet g:pymode_breakpoint = 1let g:pymode_breakpoint_bind = '<leader>b'" syntax highlightinglet g:pymode_syntax = 1let g:pymode_syntax_all = 1let g:pymode_syntax_indent_errors = g:pymode_syntax_alllet g:pymode_syntax_space_errors = g:pymode_syntax_all" Don't autofold codelet g:pymode_folding = 0Bundle 'Shougo/neocomplcache.vim'let g:neocomplcache_enable_at_startup = 1  Bundle 'davidhalter/jedi-vim'" Settings for jedi-vim" git clone git://github.com/davidhalter/jedi-vim.gitlet g:jedi#usages_command = "<leader>z"" let g:jedi#popup_select_first = 0map <Leader>b Oimport ipdb; ipdb.set_trace() # BREAKPOINT<C-c>let g:jedi#completions_command = "<C-Space>"Bundle 'kien/ctrlp.vim'let g:ctrlp_max_height = 30set wildignore+=*.pycset wildignore+=*_build/*set wildignore+=*/coverage/*" Use <leader>l to toggle display of whitespacenmap <leader>l :set list!<CR>" automatically change window's cwd to file's dirset autochdirBundle 'andviro/flake8-vim'let g:PyFlakeOnWrite = 1let g:PyFlakeCheckers = 'pep8,mccabe'let g:PyFlakeDefaultComplexity=10" more subtle popup colorsif has ('gui_running')    highlight Pmenu guibg=#cccccc gui=boldendif" Real programmers don't use TABs but spacesset tabstop=4set softtabstop=4set shiftwidth=4set shiftroundset expandtab" Make search case insensitiveset hlsearchset incsearchset ignorecaseset smartcase" Disable stupid backup and swap files - they trigger too many events" for file system watchersset nobackupset nowritebackupset noswapfile" Rebind <Leader> key" I like to have it here becuase it is easier to reach than the default and" it is next to ``m`` and ``n`` which I use for navigating between tabs."" let mapleader = ","" Bind nohl" Removes highlight of your last search" ``<C>`` stands for ``CTRL`` and therefore ``<C-n>`` stands for ``CTRL+n``noremap <C-n> :nohl<CR>vnoremap <C-n> :nohl<CR>inoremap <C-n> :nohl<CR>" Quicksave commandnoremap <C-Z> :update<CR>vnoremap <C-Z> <C-C>:update<CR>inoremap <C-Z> <C-O>:update<CR>" Quick quit commandnoremap <Leader>e :quit<CR>  " Quit current windownoremap <Leader>E :qa!<CR>   " Quit all windows" bind Ctrl+<movement> keys to move around the windows, instead of using Ctrl+w + <movement>" Every unnecessary keystroke that can be saved is good for your health :)map <c-j> <c-w>jmap <c-k> <c-w>kmap <c-l> <c-w>lmap <c-h> <c-w>h" easier moving between tabs"" map <Leader>n <esc>:tabprevious<CR>"" map <Leader>m <esc>:tabnext<CR>" Color scheme" mkdir -p ~/.vim/colors && cd ~/.vim/colors" wget -O wombat256mod.vim http://www.vim.org/scripts/download_script.php?src_id=13400set t_Co=256color wombat256mod" Showing line numbers and lengthset number  " show line numbersset tw=79   " width of document (used by gd)" Useful settingsset history=700set undolevels=700" Python folding" mkdir -p ~/.vim/ftplugin" wget -O ~/.vim/ftplugin/python_editing.vim http://www.vim.org/scripts/download_script.php?src_id=5492set nofoldenableimap <F9> <ESC>:w<CR>:!python %<CR>nmap <F9> :w<CR>:!python %<CR>

3.打开vim,运行:BundleInstall,安装好所有插件,然后重启vim。

0 0
原创粉丝点击