首页 > 系统服务 > 详细

vim .vimrc

时间:2017-09-13 01:04:11      阅读:271      评论:0      收藏:0      [点我收藏+]

set tabstop=4
set number
set cul 
set cuc 
hi CursorColumn ctermfg=3 ctermbg=2
function InsertPythonComment()
    exe ‘normal‘.1.‘G‘
    let line = getline(‘.‘)
    if line =~ ‘^#!.*$‘ || line =~ ‘^#.*coding:.*$‘
        return
    endif
    normal O
    call setline(‘.‘, ‘#!/usr/bin/env python‘)
    normal o
    call setline(‘.‘, ‘# -*- coding:utf-8 -*-‘)
    normal o
    call setline(‘.‘, ‘ ‘)
    normal o
    call setline(‘.‘, ‘# Author : ‘.g:python_author)
    normal o
    call setline(‘.‘, ‘# E-mail : ‘.g:python_email)                                                                                                                                                     
    normal o
    call setline(‘.‘, ‘# Date   : ‘.strftime("%y/%m/%d %H:%M:%S"))
    normal o
    call setline(‘.‘, ‘# Desc   : ‘)
    normal o
    call setline(‘.‘, ‘ ‘)
    normal o
    call cursor(7, 17) 
endfunction
function InsertCommentWhenOpen()
    if a:lastline == 1 && !getline(‘.‘)
        call InsertPythonComment()
    end 
endfunc
au FileType python :%call InsertCommentWhenOpen()
au FileType python map <F4> :call InsertPythonComment()<cr>
        
let g:python_author = ‘zhibo.wang‘
let g:python_email  = ‘gm.zhibo.wang@gmail.com‘

 

vim .vimrc

原文:http://www.cnblogs.com/dockers/p/7513036.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!