我的vimrc

5 评论34次阅读2008.05.22 12:10; 作者:Felicia 

最近改的vimrc,记录在这里备用

下载: vimrc
" disable VI compatible
set nocompatible

" set tab and indent
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set cindent
set cino=g0
set comments=s1:/*,mb:*,ex:*/

" set GUI
color desert
syntax on
set mouse=a
set hlsearch
set wildmenu
set cursorline
set number
set scrolloff=5
set sidescrolloff=10
set nowrap
set ignorecase
set gfn=Courier\ 10\ Pitch\ 12

" disable menus
set go=

" disable startup message
set shortmess+=I

" set
set magic
set timeoutlen=350

" status line
set laststatus=2
set statusline=\ %F%m%r%h\ %w\ \ %r%{getcwd()}%h\ \ \ Line:\ %l/%L:%c

" set window position and size
winpos 120 100
set lines=35
set columns=100

set backspace=indent,eol,start
set nobackup    " do not keep a backup file, use versions instead
set history=50    " keep 50 lines of command line history
set ruler    " show the cursor position all the time
set showcmd    " display incomplete commands
set incsearch    " do incremental searching
set encoding=utf-8
set fileencodings=utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1
set termencoding=utf-8
set printoptions=syntax:n,number:y,portrait:y

set autoread
set helplang=cn

set ww=<,>,[,]


" key maps

inoremap <C-D> <C-O>dd
inoremap <CR> <CR><left><right>
map o o<left><right>
map O O<left><right>
inoremap <c-]> {<cr>}<c-o>O<left><right>
noremap <F6> =a{

let mapleader=","

" for select, cut, paste
map <leader>a ggVG
map <leader>c "+c
map <leader>y "+y
map <leader>p "+p

" for tabs
map <C-T> :tabnew<CR>
imap <C-T> <Esc><C-T>
map <C-F4> :close<cr>
imap <C-F4> <Esc><C-F4>
map <C-P> :tabp<cr>
imap <C-P> <Esc><C-P>
map <C-N> :tabn<cr>
imap <C-N> <Esc><C-N>


" ,w for save
nmap <leader>w :w!<cr>
" ,q for quit
nmap <leader>q :q<cr>

" F3 to format code
"if &filetype == 'cpp'
map <silent><F3> :w<cr>:!astyle --style=kr %<cr>:n %<cr>
imap <silent><F3> <Esc><F3>
"endif

" F5 to insert template
map <F5> <Esc>ggdG:call Template()<cr>24Go
imap <F5> <Esc><F5>
func Template()
let l=0
let l=l+1 | call setline(l, "\/**")
let l=l+1 | call setline(l, " * File Name: ".expand("%"))
let l=l+1 | call setline(l, " * Created Time:  ".strftime("%c"))
let l=l+1 | call setline(l, " * Author: Felicia")
let l=l+1 | call setline(l, " * Description: ")
let l=l+1 | call setline(l, " */")
let l=l+1 | call setline(l, "#include <cstdio>")
let l=l+1 | call setline(l, "#include <cstring>")
let l=l+1 | call setline(l, "#include <cmath>")
let l=l+1 | call setline(l, "#include <cstdlib>")
let l=l+1 | call setline(l, "#include <algorithm>")
let l=l+1 | call setline(l, "#include <vector>")
let l=l+1 | call setline(l, "#include <set>")
let l=l+1 | call setline(l, "#include <map>")
let l=l+1 | call setline(l, "#include <string>")
let l=l+1 | call setline(l, "#include <climits>")
let l=l+1 | call setline(l, "using namespace std;")
let l=l+1 | call setline(l, "#define NEXT(v, n) (((v) == (n))? 0 : (v))")
let l=l+1 | call setline(l, "#define SZ(x) ((int) x.size())")
let l=l+1 | call setline(l, "typedef long long int64;")
let l=l+1 | call setline(l, "template <class T> void get_max(T& a, const T &b) {b > a? a = b:1;}")
let l=l+1 | call setline(l, "template <class T> void get_min(T& a, const T &b) {b < a? a = b:1;}")
let l=l+1 | call setline(l, "")
let l=l+1 | call setline(l, "int main() {")
let l=l+1 | call setline(l, "    return 0;")
let l=l+1 | call setline(l, "}")
let l=l+1 | call setline(l, "")
endfunc

cd $HOME/workspace
autocmd BufEnter * lcd %:p:h

map <F9> :call CR()<CR><space>
func CR()
    exec "update"
    exec "!gnome-terminal --geometry 100x30+120+120 -e \".run.sh %< %<.in\" "
endfunc

map <F10> :call CRm()<CR><space>
func CRm()
    exec "update"
    exec "!gnome-terminal --geometry 100x30+120+120 -e \".run.sh %<\" "
endfunc

map<F4> :call SetComment()<cr>
func SetComment()
    if getline('.')[0] == '/'
        normal ^xx
    else
        normal 0i//
    endif
endfunc

相关文章

  • 评论 (5)
  • 引用通告 (0)
发表评论 引用通告

  • zhouzili8947 | 回复 1F

    六月 8th, 2008 at 17:05

    FeliciaCrazy ?!
    那个大榕树上的FeliciaCrazy …?
    好熟悉的ID…..
    往事如烟….

  • Felicia | 回复 2F

    六月 9th, 2008 at 10:46

    是啊……多年前的事了

  • name | 回复 3F

    六月 20th, 2008 at 06:17

    I want to make my personal webpage, can you help me?,

  • name | 回复 4F

    六月 20th, 2008 at 06:17

    It`s true?,

  • momodi | 回复 5F

    六月 30th, 2008 at 13:23

    const int maxint64 = 0x7FFFFFFFFFFFFFFFLL;”

    你没觉得别扭吗。。。

暂无引用通告