码迷,mamicode.com
首页 > 系统相关 > 详细

vim .vimrc

时间:2017-09-13 01:35:17      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:normal   str   tab   desc   blog   vimrc   bst   etl   utf-8   


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

标签:normal   str   tab   desc   blog   vimrc   bst   etl   utf-8   

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

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!