"this is my VIMRC file
syntax on
set shiftwidth=2 softtabstop=2 expandtab
"I don't like auto indent
set noautoindent
command! Wq :wq
command! W :w
set path+=**
set wildmenu
nnoremap <C-n> :bnext<CR>
nnoremap <C-p> :bprevious<CR>
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
"insert templates
nnoremap ,html :-1read $HOME/.vim/skeleton/bootlist.html<CR>3j9li
nnoremap ,getlist :-1read $HOME/.vim/skeleton/getlist.js<CR>i
nnoremap ,fun :call Jfun()<CR>$kkbi
function Jfun()
execute "normal i function (){\<enter>\<enter>}\<esc>v="
endfunction
nnoremap ,post :call Jpost()<CR>i
function Jpost()
execute "normal i function (){\<enter>\<esc>"
execute "normal i var url = 'submit.php';\<enter>\<esc>"
execute "normal i $.post( url, {data:'test'}, function( data ) {\<enter>\<esc>"
execute "normal i console.log( data );\<enter>\<esc>"
execute "normal i });\<enter>\<esc>"
execute "normal i }\<esc>vkkkk=v>jv>jjv<"
execute "normal kkkkf("
endfunction
"CSS autocomplete Ctrl + x followed by Ctrl + o
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
"JavaScript Autocomplete Ctrl + x followed by Ctrl + o
autocmd FileType js set omnifunc=javascriptcomplete#CompleteJS
"html Autocomplete Ctrl + x followed by Ctrl + o
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
"auto close tags on space
inoremap </ </<C-X><C-O>
"line numbering
set relativenumber
set number
"remove all trailing whitespace by pressing F5
nnoremap <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar><CR>