参考视频:http://v.youku.com/v_show/id_XNDY4NTM4NzY0.html

好的,在我们默认的centos6的操作系统中使用的python2,我们一般会再去安装一个python3。我的环境就是python 和python3都有,python -V就是python2.6的版本。

我们需要下载vim进行重新编译安装,我们可以从官网下载源码包。这里就是我下载的vim包:

在编译安装之前,我们还需要安装python-devel的包,这个yum install python-devel就行了。 还有安装git。

执行rpm -ql python-devel会看到devel生成了一个配置文件目录:

准备完成之后了,我们如果原来有装vim的话,可以将其卸载,  好的,我们开始编译安装vim:

1、cd /vim74b/src

2、./configure --enable-pythoninterp --enable-python3interp  --with-python-config-dir=/usr/lib64/python2.6/config/ --with-features=huge --prefix=$HOME/opt/vim

执行过程中,我们可以看到这么一段:

另一台机器:

3、make $$ make install

然后就是将vim加入PATH。这个大家应该都会。

然后执行 vim --version ,可以看到vim 的一些信息:

现在开始配置 .vimrc文件,vim ~/.vimrc , 这里我们也可以一步一步的参考视频里的操作做,但是要非常认真的去看,这个文件可以参考下面模板,:

set guifont=courier_new:h18
set cursorline cul
set encoding=utf-8
colorscheme darkblue
nmap gO O<ESC>j
nmap g<C-O> o<ESC>k
" source $MYVIMRC reloads the saved $MYVIMRC
nmap <Leader>s :source $MYVIMRC
" opens $MYVIMRC for editing, or use :tabedit $MYVIMRC
nmap <Leader>v :e $MYVIMRC
" <Leader> is \ by default, so those commands can be invoked by doing \v and \s " Sample .vimrc file by Martin Brochhaus
" Presented at PyCon APAC 2012 " Installed Plug-Ins:
" Pathogen
" vim powerline
" nerdtree
" jedi-vim
" ctrlp " Automatic reloading of .vimrc
autocmd! bufwritepost .vimrc source % " Better copy & paste
" When you want to paste large blocks of code into vim, press F2 before you
" paste. At the bottom you should see ``-- INSERT (paste) --``. set pastetoggle=<F2>
set clipboard=unnamed " Mouse and backspace
set mouse=a " on OSX press ALT and click
set bs=2 " make backspace behave like normal again " 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 command
""noremap <C-Z> :update<CR>
""vnoremap <C-Z> <C-C>:update<CR>
""inoremap <C-Z> <C-O>:update<CR> " Quick quit command
noremap <Leader>e :quit<CR> " Quit current window
noremap <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>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-h> <c-w>h " easier moving between tabs
map <Leader>n <esc>:tabprevious<CR>
map <Leader>m <esc>:tabnext<CR> " map sort function to a key
vnoremap <Leader>s :sort<CR> " easier moving of code blocks
" Try to go into visual mode (v), thenselect several lines of code here and
" then press ``>`` several times.
vnoremap < <gv " better indentation
vnoremap > >gv " better indentation " Show whitespace
" MUST be inserted BEFORE the colorscheme command
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
au InsertLeave * match ExtraWhitespace /\s\+$/ " Color scheme
" mkdir -p ~/.vim/colors && cd ~/.vim/colors
" wget -O wombat256mod.vim http://www.vim.org/scripts/download_script.php?src_id=13400
set t_Co=256
color wombat256mod " Enable syntax highlighting
" You need to reload this file for the change to apply
filetype off
filetype plugin indent on
syntax on " Showing line numbers and length
set number " show line numbers
set tw=79 " width of document (used by gd)
set nowrap " don't automatically wrap on load
set fo-=t " don't automatically wrap text when typing
set colorcolumn=80
highlight ColorColumn ctermbg=233 " easier formatting of paragraphs
vmap Q gq
nmap Q gqap " Useful settings
set history=700
set undolevels=700 " Real programmers don't use TABs but spaces
set tabstop=4
set softtabstop=4
set shiftwidth=4
set shiftround
set expandtab " Make search case insensitive
set hlsearch
set incsearch
set ignorecase
set smartcase " Disable stupid backup and swap files - they trigger too many events
" for file system watchers
set nobackup
set nowritebackup
set noswapfile " Setup Pathogen to manage your plugins
" mkdir -p ~/.vim/autoload ~/.vim/bundle
" curl -so ~/.vim/autoload/pathogen.vim https://raw.github.com/tpope/vim-pathogen/HEAD/autoload/pathogen.vim
"Now you can install any plugin into a .vim/bundle/plugin-name/ folder
call pathogen#infect() " ============================================================================
" Python IDE Setup
" ============================================================================ " Settings for vim-powerline
" cd ~/.vim/bundle
" git clone git://github.com/Lokaltog/vim-powerline.git
set laststatus=2 " Settings for ctrlp
" cd ~/.vim/bundle
" git clone https://github.com/kien/ctrlp.vim.git
let g:ctrlp_max_height = 30
set wildignore+=*.pyc
set wildignore+=*_build/*
set wildignore+=*/coverage/* " Settings for python-mode
" Note: I'm no longer using this. Leave this commented out
" and uncomment the part about jedi-vim instead
" cd ~/.vim/bundle
" git clone https://github.com/klen/python-mode
""map <Leader>g :call RopeGotoDefinition()<CR>
""let ropevim_enable_shortcuts = 1
""let ropevim_enable_shortcutsg:pymode_rope_goto_def_newwin = "vnew"
""let g:pymode_rope_extended_complete = 1
""let g:pymode_breakpoint = 0
""let g:pymode_syntax = 1
""let g:pymode_syntax_builtin_objs = 0
""let g:pymode_syntax_builtin_funcs = 0
""map <Leader>b Oimport ipdb; ipdb.set_trace() # BREAKPOINT<C-c> " Settings for jedi-vim
" " cd ~/vimfiles/bundle
" " git clone git://github.com/davidhalter/jedi-vim.git
let g:jedi#usages_command = "<leader>z"
let g:jedi#popup_on_dot = 1
let g:jedi#popup_select_first = 0
let g:jedi#show_call_signatures = 1
let g:jedi#force_py_version = 2
call jedi#configure_call_signatures()
map <Leader>b Oimport ipdb; ipdb.set_trace() # BREAKPOINT<C-c> " Better navigating through omnicomplete option list
" See http://stackoverflow.com/questions/2170023/how-to-map-keys-for-popup-menu-in-vim
set completeopt=longest,menuone
function! OmniPopup(action)
if pumvisible()
if a:action == 'j'
return "\<C-N>"
elseif a:action == 'k'
return "\<C-P>"
endif
endif
return a:action
endfunction "" inoremap <silent><C-j> <C-R>=OmniPopup('j')<CR>
"" inoremap <silent><C-k> <C-R>=OmniPopup('k')<CR> " Python folding
" mkdir -p ~/.vim/ftplugin
" wget -O ~/.vim/ftplugin/python_editing.vim http://www.vim.org/scripts/download_script.php?src_id=5492
set nofoldenable "" nerdtree
" " cd ~/vimfiles/bundle
""git clone https://github.com/scrooloose/nerdtree.git
map <C-n> :NERDTreeToggle<CR>
let g:NERDTreeDirArrows=1
let NERDTreeWinPos ="left"
let NERDTreeIgnore = ['\.pyc$']
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
""let NERDTreeShowBookmarks=1
" NERDTress File highlighting
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#'
endfunction call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515')
call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515')
call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515')
call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515')

  

使用了模板前,还需要下载颜色包文件。

mkdir -p ~/.vim/colors

cd ~/.vim/colors/

wget -O wombat256mod.vim http://www.vim.org/scripts/download_script.php?src_id=13400

再下载:

mkdir -p ~/.vim/autoload ~/.vim/bundle

curl -so ~/.vim/autoload/pathogen.vim https://raw.github.com/tpope/vim-pathogen/HEAD/autoload/pathogen.vim

再下载:

" cd ~/.vim/bundle
" git clone git://github.com/Lokaltog/vim-powerline.git

再下载:

" cd ~/.vim/bundle
" git clone https://github.com/kien/ctrlp.vim.git

再下载:

" cd ~/.vim/bundle
" git clone git://github.com/davidhalter/jedi-vim.git

再下载:

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

参考:https://github.com/davidhalter/jedi-vim/

可能还需要pip2 install jedi 和pip3 install jedi

Vim as a Python IDE的更多相关文章

  1. Use Vim as a Python IDE

    Use Vim as a Python IDE I love vim and often use it to write Python code. Here are some useful plugi ...

  2. Ubuntu下将vim配置为Python IDE(转)

    工欲善其事,必先利其器. 配置好了Django的环境,该把vim好好配置一下当做python的IDE来用. 在Windows下用惯了各种现成的工具,转到Linux下,一下没了头绪……好歹google出 ...

  3. 两个命令把 Vim 打造成 Python IDE

    运行下面两个命令,即可把 Vim(含插件)配置成 Python IDE.目前支持 MAC 和 Ubuntu. Shell   curl -O https://raw.githubusercontent ...

  4. centos6.5下Python IDE开发环境搭建

    自由不是想做什么就做什么,而是想不做什么就不做什么.        ---摘抄于2016/11/30晚 之前学习了一段时间的Python,但所有部署都在windows上.正赶上最近在学习liux,以后 ...

  5. vim as python IDE

    参照Martin Brochhaus大神的视频,今天我也尝试了一下配置vim python IDE以后使用过程中只需要https://github.com/wyj1239630590/vim-as-a ...

  6. 10 款最好的 Python IDE

    Python 非常易学,强大的编程语言.Python 包括高效高级的数据结构,提供简单且高效的面向对象编程. Python 的学习过程少不了 IDE 或者代码编辑器,或者集成的开发编辑器(IDE).这 ...

  7. 【转】手把手教你把Vim改装成一个IDE编程环境(图文)

    手把手教你把Vim改装成一个IDE编程环境(图文) By: 吴垠 Date: 2007-09-07 Version: 0.5 Email: lazy.fox.wu#gmail.com Homepage ...

  8. python IDE

    提供给开发者 10 款最好的 Python IDE http://www.oschina.net/news/57468/best-python-ide-for-developers vim windo ...

  9. Vim配置及说明——IDE编程环境

    Vim配置及说明——IDE编程环境 Vim配置及说明——IDE编程环境 1.基本及字体 2.插件管理 3.主题风格 4.窗口设置 5.目录树导航 6.标签导航 7.taglist 8.多文档编辑 9. ...

随机推荐

  1. Python2.X和Python3.X文件对话框、下拉列表的不同

    Python2.X和Python3.X文件对话框.下拉列表的不同 今天初次使用Python Tkinter来做了个简单的记事本程序.发现Python2.x和Python3.x的Tkinter模块的好多 ...

  2. 平方十位数——第八届蓝桥杯JavaB组(国赛)第一题

    原创 标题:平方十位数 由0~9这10个数字不重复.不遗漏,可以组成很多10位数字.这其中也有很多恰好是平方数(是某个数的平方). 比如:1026753849,就是其中最小的一个平方数. 请你找出其中 ...

  3. ecliplse集成SVN

    按照下图操作 : SVN不同版本下载链接在文章底部有提供 上图点击add之后稍等一会就会弹出下图: 上图点击next之后: 最后等待完成之后重启ecliplse即可 重启ecliplse之后显示SVN ...

  4. C# 抽象

    好多人将抽象类也作为多态的一种,其实我觉得并不是特别的好. 抽象在C#中是类的一种表现. 如果将类作为多态,那么前面所有的东西不就白费了吗? C#的 抽象很简单. 那就是抽象. 基本就是高度抽象. 那 ...

  5. 【bzoj4720】[Noip2016]换教室 期望dp+最短路

    Description 对于刚上大学的牛牛来说,他面临的第一个问题是如何根据实际情况申请合适的课程.在可以选择的课程中,有2n节 课程安排在n个时间段上.在第i(1≤i≤n)个时间段上,两节内容相同的 ...

  6. loj #6014. 「网络流 24 题」最长 k 可重区间集

    #6014. 「网络流 24 题」最长 k 可重区间集 题目描述 给定实直线 L LL 上 n nn 个开区间组成的集合 I II,和一个正整数 k kk,试设计一个算法,从开区间集合 I II 中选 ...

  7. Kafka,Mq,Redis作为消息队列有何差异?

    Kafka作为新一代的消息系统,mq是比较成熟消息系统,而redis也可以发布订阅,那么这三者有何异同? RabbitMQ 是使用Erlang编写的一个开源的消息队列,本身支持很多的协议:AMQP,X ...

  8. win10在CMD操作MySQL时中文显示乱码

    根据网上说明直接修改数据库各种的字符集没有效果,后来经过测试发现需要先更换至旧版CMD才行. 具体总流程如下: 1.在边框栏上右键,打开属性栏. 2.选择“使用旧版控制台” 3.重启CMD,并设置字符 ...

  9. 设置placeholder的样式

    :-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: #f00; } ::-moz-placeholder { /* Mozilla Fir ...

  10. java基础(多态)_03

    一.多态 1.概念:一个对象的多种形态 2.前提: a:必须有继承 b:必须有重写(只有重写才会有意义,没重写语法没错) 3.体现形式: 父类类型 变量名 = new 子类类型(): 4.注意事项: ...