Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
59 lines (52 sloc) 1.65 KB
" Minimum vimrc, used for ACM practices & real contest
" Settings that should be on by default
syntax on
set bg=dark " Dark background
set bs=2 " backspace should work as we expect
set autoindent
set ruler " show cursor position in bottom line
set nu " show line number
set hlsearch " highlight search result
" y and d put stuff into system clipboard (so that other apps can see it)
set clipboard=unnamed,unnamedplus
set nowrap
set textwidth=0
set cindent
set timeoutlen=100
" Tab related stuffs
set shiftwidth=4 " tab size = 4
set expandtab
set softtabstop=4
set shiftround " when shifting non-aligned set of lines, align them to next tabstop
" Searching
set incsearch " show first match when start typing
set ignorecase " default should ignore case
set smartcase " use case sensitive if I use uppercase
function! MyTabCompletion()
if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
return "\<C-P>"
return "\<Tab>"
inoremap <Tab> <C-R>=MyTabCompletion()<CR>
function! MyComment()
let l = getline('.')
if l =~ '^\s*\/\/'
let l = substitute(l, '\/\/', '', '')
let l = '//' . l
call setline(line('.'), l)
nnoremap <C-c> :call MyComment()<CR>
function! CPPSET()
nnoremap <buffer> <F9> :w<cr>:!g++ % -O2 -o %< -std=c++11 -I ./<cr>:!clear;./%<<cr>
nnoremap <buffer> <F8> :w<cr>:!g++ % -O2 -o %< -std=c++11 -I ./<cr>
function! JAVASET()
nnoremap <buffer> <F8> :!javac %<cr>
nnoremap <buffer> <F9> :!javac %<cr>:!clear;java %< %<cr>
autocmd FileType cpp call CPPSET()
autocmd FileType java call JAVASET()