给自己留一个备份,要是读者觉得有用,请自便
.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