User:Feixie/Vim

Vimrc
syntax on set number set ruler

let mapleader = "," let g:mapleader = ","

"""""""""""""""""""""""""""""" " Command of feixie """""""""""""""""""""""""""""" " 1) Switch between head and body of C++ source. " map   map   map  :tabp map  :tabn map  :tabnew vmap  :w! ~/.vbuf nmap  :.w! ~/.vbuf imap  :r ~/.vbuf<CR>

function HeadBody unlet! s:filename let s:fileext = expand("%:e") let s:filename = bufname("%") let s:filename = strpart(s:filename, 0, strlen(s:filename)-2) if s:fileext == "H" let s:filename = s:filename. ".C" endif if s:fileext == "C" let s:filename = s:filename. ".H" endif if exists("s:filename") edit `=s:filename` endif endfunction map <C-b> :call HeadBody<CR>

map <C-p> :call AutoCtags("-a")<CR> function AutoCtags(opts) let s:fileext = expand("%:e") if s:fileext == "H" || s:fileext == "C" || s:fileext == "hpp" || s:fileext == "cpp" || s:fileext == "pl" || s:fileext == "pm" || s:fileext == "cgi" || s:fileext == "ttc" let s:filename = expand("%:p") let w:scmd = "ctags ". a:opts. " " . s:filename echo w:scmd let s:tagfile = system(w:scmd) if s:tagfile != "" let w:cmd = "set tags =". s:tagfile execute w:cmd endif else echo "Error in AutoCtags" endif endfunction map <C-y> :call AutoCtags("")<CR> map <C-l> :call AutoCtags("-f")<CR>

function Codes sp ~feixie/codebase/C++/codes.C endfunction
 * command Code :call Codes

function PfEdit(op) let s:filename = bufname("%") let s:filename = substitute(s:filename, '\/\/\+', "/", "g") echo s:filename let s:cwd = getcwd. "/" let s:filename = substitute(s:filename, s:cwd, "", "") echo s:filename if (a:op == "e") let w:pcmd = "P4 edit ". s:filename endif if (a:op == "r") let w:pcmd = "P4 revert ". s:filename endif if (a:op == "a") let w:pcmd = "P4 add ". s:filename endif let s:ret = system(w:pcmd) :e echo s:ret endfunction
 * command Pfe :call PfEdit("e")
 * command Pfa :call PfEdit("a")
 * command Pfr :call PfEdit("r")

" Set by feixie set fdm=syntax let g:xml_syntax_folding = 1

map zz :qall<CR>

"""""""""""""""""""""""""""""" " Statusline """""""""""""""""""""""""""""" "Always hide the statusline set laststatus=2

"Format the statusline set statusline=\ %t%(%m%r%h%)\ %w\ \ CWD:\ %r%{getcwd}%h\ \ \ Line:\ %l/%L:%c

set ignorecase set hlsearch " turn off the annoying highling by pressing F2 set incsearch " set mouse=a set backspace=2 filetype plugin on filetype indent on set autoindent

set showmatch set autowriteall

" wildmode settings set wildmenu set wildmode=list:full

" Disable auto-comment when editing C/Cpp files au FileType C,c,cpp setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,f://

" set colorscheme hi MatchParen term=reverse cterm=bold ctermbg=4 hi LineNr term=underline cterm=bold ctermfg=0 hi Pmenu ctermbg=0 hi PmenuSel cterm=bold hi TabLine term=underline ctermfg=7 ctermbg=0 hi TabLineSel term=bold cterm=bold,underline ctermfg=7 ctermbg=0 hi Folded term=underline cterm=bold ctermfg=0 ctermbg=0

"m make textwidth work also for chinese M don't insert blankspace between set formatoptions+=mM

" to disable tab, and replace tab with two spaces set expandtab set tabstop=2 set shiftwidth=2 retab set nocompatible filetype on set history=1000 set background=dark set tabstop=2 set cindent set shiftwidth=2 set showmatch set incsearch