vimrc
set nocompatible " Use Vim defaults (much better!)
set bs=indent,eol,start " allow backspacing over everything in insert mode
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers
set history=200 " keep 50 lines of command line history
set ruler " show the cursor position all the time
if has("cscope") && filereadable("/usr/bin/cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
filetype plugin on
if &term=="xterm"
set t_Co=8
set t_Sb=m
set t_Sf=m
endif
" Don't wake up system with blinking cursor:
let &guicursor = &guicursor . ",a:blinkon0"
"" ===================================================
" automatically indent lines (default)
set autoindent
set cindent
set smartindent
set shiftwidth=4
set softtabstop=4
set tabstop=4
set expandtab
set nobackup
set noswapfile
" set smartcase
set ignorecase
set hlsearch
set number
set is
set noincsearch
set nolist
"" set cmdheight=2
"" In console mode, set mouse=v and set nonumber, then right-click it to copy .
"" In gvim, set mouse=a, apply command y to copy.
set mouse=v
" set mouse=a
"" autocmd GUIEnter * simalt ~x
"" set guioptions-=T
set guioptions=
" show the laststatus line always
set laststatus=2
" number of undos
set undolevels=200
" do i have a fast terminal?
set nottyfast
" fuck the beeps
set noerrorbells
" for hidden buffers
set hidden
" continue searching at top when hitting bottom
set wrapscan
"always show the command
set showcmd
" Continue searching at top when hitting bottom
set smarttab
" show all changes
set report=0
" Highlight matching parens
set matchpairs=(:),[:],{:},<:>
" no the terminal is not always fast
" fancy menu
set wildmenu
set uc=75
let mapleader=","
let g:mapleader=","
" Use brighter colors if your xterm has a dark background.
if &term =~ "xterm"
set background=dark
" set background=light
endif
" comment types
set comments=b:#,:%,fb:-,n:),n:> fo=cqrt
" CTRL-X and SHIFT-Del are Cut
vnoremap <S-Del> "+x
" CTRL-C and CTRL-Insert are Copy
vnoremap <C-C> "+y
vnoremap <C-Insert> "+y
" CTRL-V and SHIFT-Insert are Paste
" map <C-V> "+gP
map <S-Insert> "+gP
imap <S-Insert> "+gP
vmap <S-Insert> "+gP
" au GUIEnter * simalt ~x
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set clipboard=unnamed
command ABD 'a,'bd
command ABY 'a,'by
map <C-a> :'a,'by<cr>
map <C-e> :'a,'bd<cr>
set vb t_vb=
set paste
set novisualbell
colorscheme ron
map <C-p> :b#<cr>
" MiniBufExpl Colors
hi MBENormal guifg=#808080 guibg=fg
hi MBEChanged guifg=#CD5907 guibg=fg
hi MBEVisibleNormal guifg=#5DC2D6 guibg=fg
hi MBEVisibleChanged guifg=#F1266F guibg=fg
hi MBEVisibleActiveNormal guifg=#A6DB29 guibg=fg
hi MBEVisibleActiveChanged guifg=#F1266F guibg=fg
set splitbelow
set splitright
" if &diff
" " diff mode
" set diffopt+=iwhite
" endif
function Linesearch()
let line = getline(".")
let repl = substitute(line, "\\", "\\\\\\\\", "g")
let repl = substitute(repl, "[", "\\\\[", "g")
let repl = substitute(repl, "]", "\\\\]", "g")
let repl = substitute(repl, "\\.", "\\\\.", "g")
let repl = substitute(repl, "/", "\\\\/", "g")
let repl = substitute(repl, "*", "\\\\*", "g")
let @/ = repl
endfunction
nnoremap <leader>l :call Linesearch()<cr>
" nnoremap <leader>l :call Linesearch()<cr>n
nnoremap <leader>/ :echo @/<cr>
function Linesearchnoheader()
let line = getline(".")
let repl = substitute(line, "^.\\s*", "", "")
let repl = substitute(repl, "\\", "\\\\\\\\", "g")
let repl = substitute(repl, "[", "\\\\[", "g")
let repl = substitute(repl, "]", "\\\\]", "g")
let repl = substitute(repl, "\\.", "\\\\.", "g")
let repl = substitute(repl, "/", "\\\\/", "g")
let repl = substitute(repl, "*", "\\\\*", "g")
let @/ = repl
endfunction
nnoremap <leader>h :call Linesearchnoheader()<cr>
" nnoremap <leader>h :call Linesearchnoheader()<cr>n
nnoremap <leader>cd :cd %:p:h<CR>:pwd<CR>
nnoremap <leader>ce :cd %:p:h<CR>:e .<CR>
nnoremap <F8> :vertical wincmd f<CR>
function! Appendwordtoregister()
let var_s = getreg('/', 1)
let var_smode = getregtype('/')
let curword = expand('<cword>')
if var_s != ""
if curword != ""
let var_s = substitute(var_s, "^\\\\(", "", "")
let var_s = substitute(var_s, "\\\\)$", "", "")
let var_s = '\(' . var_s . '\|' . curword . '\)'
endif
else
let var_s = curword
endif
call setreg('/', var_s, var_smode)
endfunction
nnoremap <leader>a :call Appendwordtoregister()<cr>
bashrc
# ==========================================================================
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;4;32'
# export PS1="\[\e[1;33m\]$(ppwd \l)\u:\[\e[1;31m\]\w> \[\e[0m\]"
# export PS1="\[\e[1;33m\]\u:\[\e[1;31m\]\w\n> \[\e[0m\]"
export PS1="\[\e[1;36m\]\u:\[\e[1;31m\]\w\n> \[\e[0m\]"
# colorful man page
export PAGER="`which less` -s"
export BROWSER="$PAGER"
export LESS_TERMCAP_mb=$'\E[01;36m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;35m'
# Less Colors for Man Pages
# export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
# export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold
# export LESS_TERMCAP_me=$'\E[0m' # end mode
# export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
# export LESS_TERMCAP_so=$'\E[38;5;246m' # begin standout-mode - info box
# export LESS_TERMCAP_ue=$'\E[0m' # end underline
# export LESS_TERMCAP_us=$'\E[04;38;5;146m' # begin underline
export LANG=en_US.UTF-8
# export LANG=C
sedprint()
{
if [ "$3"x == x ]
then
sed -n "${1}p" $2
else
sed -n "${1}, ${2}p" $3
fi
}
findname()
{
if [ "$1"x == x ]
then
echo "input the name"
else
find . -name "$1"
fi
}
function fordo()
{
if ! [ $# -eq 2 ]
then
echo "Usage: fordo <filename> <command> "
return
fi
filename=$1
halfcmd=$2
for f in $(cat ${filename})
do
command=${halfcmd}" "$f
eval ${command}
done
}
LS_COLORS='rs=0:di=01;36:ln=01;30:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;ls
31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:';
export LS_COLORS