From dab3a1bca93f6b13de59bc9b439b7351a223d54c Mon Sep 17 00:00:00 2001 From: yannickreiss Date: Sat, 26 Aug 2023 17:15:48 +0200 Subject: [PATCH] Implement build function at --- viml/legacyconf.vim | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/viml/legacyconf.vim b/viml/legacyconf.vim index f9aab82..37395cd 100644 --- a/viml/legacyconf.vim +++ b/viml/legacyconf.vim @@ -75,4 +75,23 @@ endfunction nnoremap :call Update_Sys() -nnoremap :!lualatex % < /dev/null +" Call build function +function! Build() + let l:filetype = &filetype + + if l:filetype == 'c' || l:filetype == 'cpp' || l:filetype == 'h' || l:filetype == 'hpp' + execute 'make' + elseif l:filetype == 'py' || l:filetype == 'python' + execute '!python3 %' + elseif l:filetype == 'tex' + execute '!lualatex % < /dev/null' + elseif l:filetype == 'rs' + execute 'cargo run' + elseif l:filetype == 'S' + execute 'make' + else + echo "Unsupported file type: " . l:filetype + endif +endfunction + +nnoremap :call Build()