现在的位置: 首页 > 综合 > 正文

vim for python

2018年01月15日 ⁄ 综合 ⁄ 共 2629字 ⁄ 字号 评论关闭

贴出我的gvim配置文件,,基本给出了注释,感觉还是挺好的哈哈。一些插件,自行百度~

set nocompatible
set nu
syntax enable
syntax on "打开高亮
colorscheme desert
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

filetype plugin on

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
  let eq = ''
  if $VIMRUNTIME =~ ' '
    if &sh =~ '\<cmd'
      let cmd = '""' . $VIMRUNTIME . '\diff"'
      let eq = '"'
    else
      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
    endif
  else
    let cmd = $VIMRUNTIME . '\diff'
  endif
  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction

set ts=4
set ai
set sw=4

set foldenable
set foldmethod=indent    "设置折叠

set background=dark   "设置背景黑色

nmap <F2> :NERDTreeToggle<CR>

let g:pydiction_location = 'F:\Program Files (x86)\Vim\vim74\tools\pydiction\complete-dict'  
let g:pydiction_menu_height = 20  "这是设置tab补全插件

map <C-n> :tabnew<CR>	
"设置c-n新建标签

"c-tab切换标签,alt+数字键切换到相应标签
if has("gui_running") 
     :map <silent> <C-S> :if expand("%") == ""<CR>:browse confirm w<CR>:else<CR>:confirm w<CR>:endif<CR> 
     noremap <M-1> 1gt 
     noremap <M-2> 2gt 
     noremap <M-3> 3gt 
     noremap <M-4> 4gt 
     noremap <M-5> 5gt 
     noremap <M-6> 6gt 
     noremap <M-7> 7gt 
     noremap <M-8> 8gt 
     noremap <M-9> 9gt 
     noremap <M-0> 10gt 
     noremap <C-TAB> gt 
     noremap <C-F4> <ESC>:bd<CR> 
     noremap qt <ESC>:bd<CR> 
     au BufEnter * simalt ~x "maximum the initial window zc
else 
     colorscheme desert"torte 
endif 

"Toggle Menu and Toolbar
"默认不显示菜单,按F10显示菜单
set guioptions-=m
set guioptions-=T
map <silent> <F10> :if &guioptions =~# 'T' <Bar>
        \set guioptions-=T <Bar>
        \set guioptions-=m <bar>
    \else <Bar>
        \set guioptions+=T <Bar>
        \set guioptions+=m <Bar>
    \endif<CR>

"设置搜索
set hlsearch
set incsearch 

autocmd BufRead,BufNewFile *.py set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\"  
autocmd BufRead,BufNewFile *.py set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m  
autocmd BufRead,BufNewFile *.py nmap <F5> :!python %<CR>  
autocmd BufRead,BufNewFile *.py nmap <F6> :make<CR>  
autocmd BufRead,BufNewFile *.py copen "如果是py文件,则同时打开编译信息窗口  


"进行Tlist的设置  
filetype on  
let Tlist_Show_Menu = 1  
"TlistUpdate可以更新tags  
map <F3> :silent! Tlist<CR>  "按下F3就可以呼出Taglist  
let Tlist_Ctags_Cmd='ctags' "因为我们放在环境变量里,所以可以直接执行  
let Tlist_Use_Right_Window=0 "让窗口显示在右边,0的话就是显示在左边  
let Tlist_Show_One_File=1 "让taglist可以同时展示多个文件的函数列表,如果想只有1个,设置为1  
let Tlist_File_Fold_Auto_Close=1 "非当前文件,函数列表折叠隐藏  
let Tlist_Exit_OnlyWindow=1 "当taglist是最后一个分割窗口时,自动退出vim  
let Tlist_Process_File_Always=0 "是否一直处理tags.1:处理;0:不处理  
"let Tlist_Inc_Winwidth=  

"设置帮助语言
set helplang=cn,en
"把gui的工具栏去掉(要去掉,把等号前面的加号变成一个减号即可)
"set guioptions+=T
"把gui的右边的滑动条去掉
"set guioptions+=r
"把gui的左边的滑动条去掉
"set guioptions-=L
"把gui的菜单去掉
"set guioptions+=m
【上篇】
【下篇】

抱歉!评论已关闭.