China Open source community
站内导航:
站内排行前50热点文章

精华文章  GDB调试精粹及使用实例
普通文章  STL中map用法详解
精华文章  负载均衡软件比较(Hapr...
普通文章  头文件的重复引用
普通文章  递归函数的调用过程
普通文章  TCP三次握手/四次挥手详解
普通文章  贪心策略的理论基础——...
普通文章  BMH算法原理与实现(模...
普通文章  排列组合与回溯算法
普通文章  DP动态规划
精华文章  Android线程模型
普通文章  Linux socket编程之套接字
普通文章  Linux内核中的红黑树
精华文章  linux下使用minicom的几...
普通文章  Java开源Html解析类库
精华文章  enum类型的本质
普通文章  memcached server LRU ...
普通文章  linux设置环境变量的方法
普通文章  android核心模块及相关...
普通文章  linux源代码包(.tar.g...
普通文章  L.A.M.P配置过程
普通文章  在ubuntu9.10下安装QT4...
普通文章  C/C++程序员常见面试题...
普通文章  gcc编译过程概述
普通文章  python的memcache和jso...
普通文章  应用程序二进制接口---ABI
普通文章  linux内核编译问题
普通文章  Java多线程实现简单实例
普通文章  Python程序员常用的IDE...
普通文章  brk和sbrk详述
普通文章  优化C语言代码(程序员必...
普通文章  python非贪婪,多行匹配...
普通文章  函数指针传递和全局指针...
普通文章  Unix操作系统的历史演变
普通文章  网络编程之C10K问题
普通文章  发行版发布:CentOS 5.4
普通文章  在windows中构建gtk开发...
普通文章  i++循环与i--循环的执行...
普通文章  关于Qvariant类--万能的...
普通文章  Debian sudo 设置
普通文章  busybox1.15.x 交叉编译
普通文章  关于僵死进程zombie
普通文章  递归思想的妙用
普通文章  判断链表是否存在环并找...
普通文章  Android Porting Exper...
普通文章  关于/etc/bashrc和$HOM...
普通文章  [翻译]Django初窥
普通文章  Python list的排序
普通文章  Django实现大数据量分页...
普通文章  Debug方式取代printf满...

 
 
 
当前位置: 首页 >> 程序设计 >> 用vim搭建python开发环境
 
 

用vim搭建python开发环境

作者:      来源:zz     发表时间:2007-02-05     浏览次数:      字号:    

 
较好的几个插件和配置
  •     ctags+taglist:语法分析,生成和显示tag点。
  •     minibufexpl:Mini Buffer Explorer,在vim上实现多文档tab效果。
  •     supertab:使用tab键实现自动补全功能,很方便,强力推荐。
  •     insenvim:智能语法分析和自动提示。需要perl支持,我安装了ActivePerl。
  •     python_fold:支持python的语句块、类的折叠,在对于单个大文件很实用。
  •     runscript:运行python script。
  •    调试python:使用python自带的pdb,在vim的配置文件_vimrc里配置。请参考这篇文章:《Debugging Python in VIM这篇文章展现了vim配置文件里使用python来实现定制功能的技术,很值得学习和借鉴。
     这篇文章主要是介绍vim下python开发环境的支持插件。
 
配置文件_vimrc


set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

"set ffs=unix
set diffexpr=MyDiff()
function MyDiff()
 let opt = '-a --binary '
 if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
 if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
 let arg1 = v:fname_in
 if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
 let arg2 = v:fname_new
 if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
 let arg3 = v:fname_out
 if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
 silent execute '!D:\Vim\vim70\diff ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
endfunction

hi  HL_HiCurLine ctermfg=blue ctermbg=cyan guifg=blue guibg=cyan
let HL_HiCurLine= "HL_HiCurLine"

set formatoptions=tcrqn2
set guifont=FixedsysTTF:h14   "如果没有这个字体那就不要加
set tabstop=4
set softtabstop=4
set shiftwidth=4
"colorscheme darkblue            "在gvim下可以看到有多少coloscheme
color desert

set lsp=0
set sw=4      " shiftwidth
set et        " expandtab
"set wm=8      " wrapmargin
set lbr       "不在单词中间断行
set fo+=mB    "打开断行模块对亚洲语言支持
set bs=2      " backspace
set ru        " ruler
set ic        " ignorecase      "忽略大小写 但是输入中有大写的话不忽略
set is        " incsearch
set scs       " smartcase: override the 'ic' when searching
"     if search pattern contains uppercase char
set nu        "显示行号

set wmnu
set wildignore=*.bak,*.o,*.e,*~

iab #i #include
iab #d #define
iab #e #endif

set cst
set csto=1
set tags=./tags,../tags,../../tags,../../../tags,D:/Microsoft\ Visual\ Studio/VC98/Include/tags,D:/MinGW/include
set cspc=3  " show file path's last three part

set grepprg=grep\ -nH

map <F2>    :Tlist<cr>
"map <F2>    :WMToggle<cr>
"代码折叠快捷方式
map <F3>    zO
map <F4>    zc
map <F5>    zR
map <F6>    zM
"map <F7>    :cn<CR>

"   
set vb t_vb=  " set visual bell and disable screen flash
set backup    " enable backup and define the backup file
set backupext=.bak
set hlsearch  " hlsearch
" allow backspacing over everything in
" the insert mode
set backspace=indent,eol,start
set dir=D:\vim\temp
" 设置swap文件的目录上面
set backupdir=D:\vim\temp
"设置备份文件的目录上面 我不喜欢看到每个目录下都有备份 因为一般备份用不到


"下面是设置自动folder的 而且是根据写C代码设置的 如果你不喜欢使用folder那么可以省略掉
"au BufReadPost *.h,*.c,*.cpp,*.java,*.pl    syn region myFold start="{" end="}" transparent fold
"au BufReadPost *.h,*.c,*.cpp,*.java,*.pl    syn sync fromstart
"au BufReadPost *.h,*.c,*.cpp,*.java,*.pl    set foldmethod=syntax
"set foldlevel=0
set foldmarker={,}
set foldmethod=marker
set foldlevel=100 " Don't autofold anything (but I can still fold manually)
set foldopen-=search " don't open folds when you search into them
set foldopen-=undo " don't open folds when you undo stuff


"-------------------------------------------------------------------------------
" C-support.vim
"-------------------------------------------------------------------------------
let g:C_AuthorName   = 'J.T Jacky'
let g:C_AuthorRef    = ''
let g:C_Email        = 'brothertian@gmail.com'
let g:C_Company      = 'Baosight'

"-------------------------------------------------------------------------------
" C++
"-------------------------------------------------------------------------------
set sm
set cin
set cino=:0g0t0(sus

"-------------------------------------------------------------------------------
"   copy from web
"-------------------------------------------------------------------------------

set history=1000 " How many lines of history to remember
set cf " enable error files and error jumping
set clipboard+=unnamed " turns out I do like is sharing windows clipboard
set ffs=dos,unix,mac " support all three, in this order
filetype plugin on " load filetype plugins
set viminfo+=! " make sure it can save viminfo
set isk+=_,$,@,%,#,- " none of these should be word dividers, so make them not be

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim UI
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set lsp=0 " space it out a little more (easier to read)
set wildmenu " turn on wild menu
set ruler " Always show current positions along the bottom
set cmdheight=1 " the command bar is 2 high
"set number " turn on line numbers
set lz " do not redraw while running macros (much faster) (LazyRedraw)
"set hid " you can change buffer without saving
set backspace=2 " make backspace work normal
set whichwrap+=<,>,h,l  " backspace and cursor keys wrap to
set mouse=a " use mouse everywhere
set shortmess=atI " shortens messages to avoid 'press a key' prompt
set report=0 " tell us when anything is changed via :...
set noerrorbells " don't make noise
" make the splitters between windows be blank
set fillchars=vert:\ ,stl:\ ,stlnc:\

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Visual Cues
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"set showmatch " show matching brackets
"set mat=5 " how many tenths of a second to blink matching brackets for
"set nohlsearch " do not highlight searched for phrases
set incsearch " BUT do highlight as you type you search phrase
set listchars=tab:\|\ ,trail:.,extends:>,precedes:<,eol:$ " what to show when I hit :set list
set lines=80 " 80 lines tall
set columns=160 " 160 cols wide
set so=0 " Keep 10 lines (top/bottom) for scope
set novisualbell " don't blink
set noerrorbells " no noises
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
set laststatus=2 " always show the status line

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Text Formatting/Layout
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set fo=tcrqn " See Help (complex)
"set ai " autoindent
"set si " smartindent
set cindent " do c-style indenting
filetype indent on
"set tabstop=8 " tab spacing (settings below are just to unify it)
"set softtabstop=8 " unify
"set shiftwidth=8 " unify
"set noexpandtab " real tabs please!
set nowrap " do not wrap lines 
set guioptions+=b "添加水平滚动条
"set smarttab " use tabs at the start of a line, spaces elsewhere

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Folding
"    Enable folding, but by default make it act like folding is off, because folding is annoying in anything but a few rare cases
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"set foldenable " Turn on folding
"set foldmethod=indent " Make folding indent sensitive
"set foldlevel=100 " Don't autofold anything (but I can still fold manually)
"set foldopen-=search " don't open folds when you search into them
"set foldopen-=undo " don't open folds when you undo stuff

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" File Explorer
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:explVertical=1 " should I split verticially
let g:explWinSize=20 " width of 35 pixels

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Win Manager
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:winManagerWidth=20 " How wide should it be( pixels)
"let g:winManagerWindowLayout = 'FileExplorer,TagsExplorer|BufExplorer' " What windows should it

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CTags
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let Tlist_Ctags_Cmd = 'D:\Vim\Intellisense\cppft\ctags.exe' " Location of ctags
let Tlist_Sort_Type = "name" " order by
let Tlist_Use_Right_Window = 1 " split to the right side of the screen
let Tlist_Compart_Format = 1 " show small meny
let Tlist_Exist_OnlyWindow = 1 " if you are the last, kill yourself
let Tlist_File_Fold_Auto_Close = 0 " Do not close tags for other files
let Tlist_Enable_Fold_Column = 0 " Do not show folding tree
let g:ctags_path='D:\Vim\Intellisense\cppft\ctags.exe'
let g:ctags_statusline=1

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Minibuf
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:miniBufExplTabWrap = 1 " make tabs show complete (no broken on two lines)
let g:miniBufExplModSelTarget = 1

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Matchit
""""""""""""""""""""""""""""""""""""""""""""""""""""

编辑 webmaster

 
 
 
评论
 
 
发表
 
姓名: QQ:
性别: MSN:
E-mail: 主页:
评分: 1 2 3 4 5
评论内容:
验证码:
  
  • 请遵守《互联网电子公告服务管理规定》及中华人民共和国其他各项有关法律法规。
  • 严禁发表危害国家安全、损害国家利益、破坏民族团结、破坏国家宗教政策、破坏社会稳定、侮辱、诽谤、教唆、淫秽等内容的评论 。
  • 用户需对自己在使用本站服务过程中的行为承担法律责任(直接或间接导致的)。
  • 本站管理员有权保留或删除评论内容。
  • 评论内容只代表网友个人观点,与本网站立场无关。
  •  
    中国源码网 - www.YuanMa.org - 中国 开放源代码+编程 社区