Skip to content

Instantly share code, notes, and snippets.

View AkashRRao's full-sized avatar

Akash Rao AkashRRao

View GitHub Profile
@AkashRRao
AkashRRao / .vimrc
Created May 5, 2020 18:55
Compiling, Running and Testing C++ files
autocmd FileType cpp nnoremap <leader>rm :!g++ -g --std=c++11 % -o %:r<CR>
" autocmd FileType cpp nnoremap <leader>rm :set makeprg=g++<CR>:make % -o %:r<CR>
autocmd FileType cpp nnoremap <leader>rr :!./%:r<CR>
autocmd FileType cpp nnoremap <leader>rt :!for f in %:r.*.test; do echo "TEST: $f"; ./%:r < $f; done<CR>
@AkashRRao
AkashRRao / generate_template.sh
Created May 5, 2020 18:38
A simple bash script to create a template file based on the extension
#!/bin/sh
# filename
filename=$1
# file extension
extension="${filename##*.}"
if [ "$extension" == "cpp" ]; then
cp -n ~/.vim/templates/cpp_template.cpp ./$filename;
elif [ "$extension" == "tex" ]; then