From fe209d14183d18adcc31ce53b0f8a06fb713d1c4 Mon Sep 17 00:00:00 2001 From: Wryn Wagner Date: Fri, 9 Apr 2021 15:25:32 -0600 Subject: [PATCH] vim library; added formatting options for dockerfile, added dotnet core testing function --- vim/formatting.vim | 1 + vim/testing.vim | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/vim/formatting.vim b/vim/formatting.vim index f7470c5..590f5b0 100644 --- a/vim/formatting.vim +++ b/vim/formatting.vim @@ -31,6 +31,7 @@ augroup filetype_specific_formatting autocmd FileType haskell call FormatFileType(2, v:true, 'indent', 99, v:false) autocmd FileType perl call FormatFileType(4, v:true, 'indent', 99, v:false) autocmd FileType kotlin call FormatFileType(2, v:true, 'indent', 99, v:false) + autocmd FileType dockerfile call FormatFileType(4, v:true, 'indent', 99, v:false) augroup end augroup forced_filetype_recognition diff --git a/vim/testing.vim b/vim/testing.vim index 3ad973e..3010277 100644 --- a/vim/testing.vim +++ b/vim/testing.vim @@ -61,6 +61,32 @@ function GetDjangoManagePy() endfunction +" =================================================================== +" === dotnet core =================================================== +" =================================================================== + +function DotnetTest(filter = '') + let l:command = + \ 'cd ' . GetDotnetProjectLocation() + \ . ';' . 'dotnet build -clp:ErrorsOnly' + \ . ';' . 'cd ' . GetDotnetProjectLocation(1) + \ . ';' . 'dotnet test -clp:ErrorsOnly' + if a:filter != '' + let l:command = l:command . ' --filter ' . a:filter + endif + call TmuxTest(l:command) +endfunction + +function GetDotnetProjectLocation(test = 0) + let l:projectRoot = substitute(expand(getcwd()), '/code.*', '/code', '') + if a:test + let l:testPath = system('ls ' . l:projectRoot . '/**/*.csproj | grep Test | head -1') + else + let l:testPath = system('ls ' . l:projectRoot . '/**/*.csproj | grep -v Test | head -1') + endif + return substitute(l:testPath, '\(.*\)/.*.csproj.*', '\1', '') +endfunction + " =================================================================== " === npm =========================================================== " ===================================================================