vimrc

Linux:

source $VIMRUNTIME/mswin.vim
behave mswin
set mouse=a nu ts=4 sw=4 ai ci si hls is backup undofile
color slate
map <F7> : ! g++ % -o %< -g -Wall -Wextra -Wconversion -Wshadow <CR>
map <F8> : ! time ./%< <CR>
map <F9> : ! gdb %< <CR>

Windows:

set encoding=utf-8 nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set ts=4 sw=4 lines=50 columns=85 au nu
color slate
set backupdir=C:/code/vimtmp/
set undodir=C:/code/vimtmp/
set guifont=Consolas:h14:cANSI
exec 'cd '.fnameescape('C:\code\')
set autochdir
map <F6> : call O2()<CR>
func! O2()
exec "w"
exec "!g++ % -o %< -std=c++17 -O2 -Wl,-stack=1073741824"
endfunc
map <F7> : call CompileGpp()<CR>
func! CompileGpp()
exec "w"
exec "!g++ %  -g -o %< -std=c++17 -Wall -Wconversion -Wextra -Wshadow -Wl,-stack=1073741824"
endfunc
map <F8> :call Run()<CR>
func! Run()
exec "! %<"
endfunc
map <F9> :call Gdb()<CR>
func! Gdb()
exec "w"
exec "! gdb %<"
endfunc

map <F12> :call Headers()<CR>

func! Headers()
exec ":r C:\\code\\std.cpp"
exec ":1"
exec "d"
exec ":8"
endfunc