Requirements: $brew install g++ gdb coreutils;
map <C-s> = :w<cr> " save file
map <S-Left> = :!gdb ./%:r <CR> " Debug
map <S-Down> = :!g++-12 -std=c++14 -g % -o %:r<CR> " build only
map <S-Up> = :!./%:r <CR> " run only.
map <S-Right> = :!g++-12 -std=c++14 -g % -o %:r && gtimeout 4s ./%:r <CR> " build and run.
" map <S-Right> = :!g++-12 -std=c++14 -g % -o %:r && gtimeout 4s ./%:r < input.txt > output.txt <CR> " build and run.
$gdb ./a.out;
break 10 <CR> : puts breakpoint at line 10.
Usage:
break [filename]:line_number
break [filename]:function_name
run [args]
c : continue
n : next / step over
s : step in
p : print, Usage: p <variable name> , …..
l : list (print the source code) Usage: l <linenumber> , l <function name>
ENTER : execute previous command again.
bt : backtrace ie print backtrace of all stack frames
help <topicname>
quit <CR>
Load template in vim: autocmd BufNewFile *.cpp execute "0r ~/.vim/template/".input("Template name: ").".cpp"