About My Blog



Whenever I get stuck doing something - the time comes to venture in the world of internet to find solution. In most cases I do find the solution, solve my problem and go on with my life. Then one day I am faced with the same problem. But now - I can't remember how the hell I solved it the first time. So the cycle begins again. Then I thought, what if I can remember all the those things? So here it is, my Auxiliary Memory. I decided to save all the problems and their solution in this blog so that I can get back to them when I need them. And the plus point is - so can everybody else.

Saturday, October 5, 2019

VIM dotnet core cli compiler script

I wanted to use dotnet cli build command to build dotnet core project. I found that vim already has a compiler script for msbuild. Though dotnet build command internally calls msbuild, I did not want to use the msbuild compiler script. So I made some modification to the msbuild.vim script and made dotnet.vim compiler script -

" Vim compiler file
" Compiler: Microsoft Visual Studio C#
" Maintainer: Chiel ten Brinke (ctje92@gmail.com)
" Last Change: 2013 May 13

if exists("current_compiler")
  finish
endif
let current_compiler = "dotnet"
let s:keepcpo= &cpo
set cpo&vim

if exists(":CompilerSet") != 2  " older Vim always used :setlocal
  command -nargs=* CompilerSet setlocal 
endif

CompilerSet errorformat=\ %#%f(%l\\\,%c):\ %m,%-G%.%#
CompilerSet makeprg=dotnet\ build\ --nologo\ --no-restore\ /clp:NoSummary
let &cpo = s:keepcpo
unlet s:keepcpo
I copied it in ~\vimfiles\compiler folder. And now to use is I just call :compiler dotnet followed by :make.