|
|
@ -1,7 +1,28 @@ |
|
|
|
let b:ale_fixers = ['clangtidy', 'clang-format', 'remove_trailing_lines', 'trim_whitespace'] |
|
|
|
let b:ale_linters = ['cc', 'ccls', 'clangcheck', 'clangd', 'clangtidy', 'clazy', 'cppcheck', 'cpplint', 'cquery', 'cspell', 'flawfinder'] |
|
|
|
let b:ale_fixers = { |
|
|
|
\ 'cpp' : [ |
|
|
|
\ 'clangtidy', |
|
|
|
\ 'clang-format', |
|
|
|
\ 'remove_trailing_lines', |
|
|
|
\ 'trim_whitespace' |
|
|
|
\ ] |
|
|
|
\ } |
|
|
|
|
|
|
|
let b:ale_linters = { |
|
|
|
\ 'cpp' : [ |
|
|
|
\ 'cc', |
|
|
|
\ 'ccls', |
|
|
|
\ 'clangcheck', |
|
|
|
\ 'clangd', |
|
|
|
\ 'clangtidy', |
|
|
|
\ 'clazy', |
|
|
|
\ 'cppcheck', |
|
|
|
\ 'cpplint', |
|
|
|
\ 'cquery', |
|
|
|
\ 'cspell', |
|
|
|
\ 'flawfinder' |
|
|
|
\ ] |
|
|
|
\ } |
|
|
|
|
|
|
|
" Function to find the project root |
|
|
|
function! FindProjectRoot() |
|
|
|
let l:current_dir = expand('%:p:h') |
|
|
|
while l:current_dir != "/" |
|
|
@ -13,7 +34,6 @@ function! FindProjectRoot() |
|
|
|
return "" |
|
|
|
endfunction |
|
|
|
|
|
|
|
" Function to compile the project |
|
|
|
function! CompileProject(debug) |
|
|
|
let l:project_root = FindProjectRoot() |
|
|
|
if l:project_root == "" |
|
|
@ -22,7 +42,6 @@ function! CompileProject(debug) |
|
|
|
endif |
|
|
|
let l:main_file = l:project_root . "/main.cpp" |
|
|
|
|
|
|
|
" Extract the project directory name |
|
|
|
let l:project_name = fnamemodify(l:project_root, ':t') |
|
|
|
let l:output_file = l:project_root . "/" . l:project_name |
|
|
|
|
|
|
@ -52,7 +71,6 @@ function! CompileProject(debug) |
|
|
|
endif |
|
|
|
endfunction |
|
|
|
|
|
|
|
" Function to run the compiled project |
|
|
|
function! RunProject() |
|
|
|
let l:project_root = FindProjectRoot() |
|
|
|
if l:project_root == "" |
|
|
@ -60,24 +78,18 @@ function! RunProject() |
|
|
|
return |
|
|
|
endif |
|
|
|
|
|
|
|
" Extract the project directory name |
|
|
|
let l:project_name = fnamemodify(l:project_root, ':t') |
|
|
|
let l:output_file = l:project_root . "/" . l:project_name |
|
|
|
|
|
|
|
" Check if the output file exists |
|
|
|
if !filereadable(l:output_file) |
|
|
|
echo "Output file not found. Please compile the project first." |
|
|
|
return |
|
|
|
endif |
|
|
|
|
|
|
|
" Run the compiled output file |
|
|
|
let l:run_cmd = "!" . l:output_file |
|
|
|
execute l:run_cmd |
|
|
|
endfunction |
|
|
|
|
|
|
|
" Create the Compile command |
|
|
|
command! -nargs=0 Compile call CompileProject(1) |
|
|
|
command! -nargs=0 CompileRelease call CompileProject(0) |
|
|
|
|
|
|
|
" Create the Run command |
|
|
|
command! Run call RunProject() |
|
|
|
command! -nargs=0 Run call RunProject() |
|
|
|