自用的bash和vimrc配置

给自己留一个备份,要是读者觉得有用,请自便

.bashrc

alias grep='grep --color'
#export LC_ALL=zh_CN.GBK
export LC_ALL=zh_CN.UTF-8
alias col="awk -F '\t' '{print NF}' "
export TERM=linux
#export TERM=xterm-color
CLICOLOR=1LSCOLORS=gxfxcxdxbxegedabagacadexport
PS1='\[\033[01;32m\]\u@\H\[\033[00m\]:\[\033[01;36m\]`pwd`\[\033[00m\] \$ 'alias ls='ls --color=auto'

.vimrc

set tag=$PWD/tags
set mouse=
set foldmethod=manual
set nocompatible
set expandtab
syntax on
set number
set cursorcolumn
set cursorline
set undodir=~/.undodir
set ruler
set autoindent
set shiftwidth=4
set softtabstop=4
set tabstop=4
set nobackup
set autochdir
set noic
filetype plugin indent on
set backupcopy=yes
set ignorecase smartcase
set nowrapscan
set incsearch
set hlsearch
set noerrorbells
set novisualbell
set t_vb=
set foldenable
let mapleader=
au BufNewFile,BufRead *.aql set filetype=adtable
au BufNewFile,BufRead *.ats.main set filetype=adtable
au BufNewFile,BufRead *.ats set filetype=adtable
au BufNewFile,BufRead *.tag set filetype=adtable
highlight CursorLine guibg=NONE guifg=NONE ctermbg=NONE ctermfg=NONE cterm=bold
highlight CursorColumn guibg=lightblue ctermbg=NONE guifg=black ctermfg=NONE cterm=bold
map <F4> :call TitleDet()<cr>'s
function AddTitle()
    call append(0,
    call append(1,
    call append(2,
    call append(3,
    call append(4,
    call append(5,
    call append(6,
    call InsertHeadDefN()
    echohl WarningMsg | echo
endf

function UpdateTitle()
    normal ma
    1
    execute '/# Last modified:/s@:.*$@\=strftime(
    1
    execute '/# Filename:/s@:.*$@\=
    execute
    normal 'a
    echohl WarningMsg | echo
endfunction

function TitleDet()
    let n=1

    while n < 10
        let line = getline(n)
        if line =~ '^\#\s*\S*Last\smodified:\S*.*$'
            call UpdateTitle()
            return
        endif
        let n = n + 1
    endwhile
    call AddTitle()
endfunction

function InsertHeadDef(firstLine, lastLine)
    if a:firstLine <1 || a:lastLine> line('$')
        echoerr 'InsertHeadDef : Range overflow !(FirstLine:'.a:firstLine.';LastLine:'.a:lastLine.';ValidRange:1~'.line('$').’)'
    return ''
    endif
    let sourcefilename=expand(
    let definename=substitute(sourcefilename,' ','','g')
    let definename=substitute(definename,'\.','_','g')
    let definename = toupper(definename)
    exe 'normal '.a:firstLine.'GO'
    call setline('.', '#ifndef _'.definename.
    normal ==o
    call setline('.', '#define _'.definename.
    exe 'normal =='.(a:lastLine-a:firstLine+1).'jo'
    call setline('.', '#endif')
    let goLn = a:firstLine+2
    exe 'normal =='.goLn.'G'
endfunction
function InsertHeadDefN()
    let firstLine = 1
    let lastLine = line('$')
    let n=1
    while n < 20
        let line = getline(n)
        if n==1
            if line =~ '^\/\*.*$'
                let n = n + 1
                continue
            else
                break
            endif
        endif
        if line =~ '^.*\*\/$'
            let firstLine = n+1
            break
        endif
        let n = n + 1
    endwhile
    call InsertHeadDef(firstLine, lastLine)
endfunction

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值