• vim 配置文件


    vim的配置文件如下_vimrc:

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

    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 fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
    colorscheme torte

    set nu " 显示行号
    set foldenable " 允许折叠
    set foldmethod=manual " 手动折叠
    set background=dark "背景使用黑色
    set ts=4 "(注:ts是tabstop的缩写,设TAB宽4个空格)
    set expandtab
    set smartindent
    set shiftwidth=4

    set guifont=consolas:h12:cANSI

    "进行版权声明的设置
    "添加或更新头
    map <F4> :call TitleDet()<cr>'s
    function AddTitle()
    call append(0,"/*===============================================")
    call append(1,"# Author: RollerCoaster")
    call append(2,"# Last modified:".strftime("%Y-%m-%d %H:%M"))
    call append(3,"# Filename: ".expand("%:t"))
    call append(4,"# Description: ")
    call append(5,"=================================================*/")
    echohl WarningMsg | echo "Successful in adding the copyright." | echohl None
    endf
    "更新最近修改时间和文件名
    function UpdateTitle()
    normal m'
    execute '/# *Last modified:/s@:.*$@=strftime(":%Y-%m-%d %H:%M")@'
    normal ''
    normal mk
    execute '/# *Filename:/s@:.*$@=":".expand("%:t")@'
    execute "noh"
    normal 'k
    echohl WarningMsg | echo "Successful in updating the copy right." | echohl None
    endfunction
    "判断前10行代码里面,是否有Last modified这个单词,
    "如果没有的话,代表没有添加过作者信息,需要新添加;
    "如果有的话,那么只需要更新即可
    function TitleDet()
    let n=1
    "默认为添加
    while n < 7
    let line = getline(n)
    if line =~ '^#s*S*Lastsmodified:S*.*$'
    call UpdateTitle()
    return
    endif
    let n = n + 1
    endwhile
    call AddTitle()
    endfunction

    "代码补全
    set completeopt=preview,menu
    "从不备份
    set nobackup

    作者:BestNow
    出处:http://www.cnblogs.com/BestNow/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    23. Sum Root to Leaf Numbers
    22. Surrounded Regions
    21. Clone Graph
    19. Palindrome Partitioning && Palindrome Partitioning II (回文分割)
    18. Word Ladder && Word Ladder II
    14. Reverse Linked List II
    20. Candy && Gas Station
    16. Copy List with Random Pointer
    ubuntu 下建立桌面快捷方式
    java基础篇-jar打包
  • 原文地址:https://www.cnblogs.com/tianxue/p/3933559.html
Copyright © 2020-2023  润新知