diff options
| author | czjstmax <jstmaxlol@disroot.org> | 2025-12-18 22:12:16 +0100 |
|---|---|---|
| committer | czjstmax <jstmaxlol@disroot.org> | 2025-12-18 22:12:16 +0100 |
| commit | e94e1c73fc7726927e4410efcffc16286084696b (patch) | |
| tree | cc795b5029e98b0b286e5c38b6224fc42c3b1acd /.exrc | |
| parent | 7c9fc77ed9fa910c74e0bb6947aaf873f21a4211 (diff) | |
Added skeletons and styling guidelines for the project.
- Added initial rbc.c (skeleton), contains styling guidelines and
a brief project explanation.
- Added .exrc for Vim/Neovim users to auto-apply the project's styling
guidelines.
Diffstat (limited to '.exrc')
| -rw-r--r-- | .exrc | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -0,0 +1,44 @@ +if exists('g:crbc_compile_loaded') + finish +endif +let g:crbc_compile_loaded = 1 + +let s:cc = 'gcc' +let s:cflags = '-std=c23 -Wall -Wextra -pedantic' +let s:dbgflags = '-g -O0 -fsanitize=address,undefined' +let s:optflags = '-O2' + +function! s:Compile(debug) + if &filetype !=# 'c' && &filetype !=# 'cpp' + echoerr ">>> not a C/++ file!" + return + endif + + let l:src = expand('%') + "let l:out = expand('%:r') + let l:out = 'crbc' + + if a:debug + let l:cmd = printf( + \ '%s %s %s "%s" -o "%sDbg"', + \ s:cc, s:cflags, s:dbgflags, l:src, l:out + \ ) + echo ">>> compiling debug build .." + else + let l:cmd = printf( + \ '%s %s %s "%s" -o "%s"', + \ s:cc, s:cflags, s:optflags, l:src, l:out + \ ) + echo ">>> compiling release build .." + endif + + execute '!' . l:cmd +endfunction + +" user commands +command! Compn call s:Compile(0) +command! Cn call s:Compile(0) + +command! Compd call s:Compile(1) +command! Cd call s:Compile(1) + |