What's the ultimate setup for vim?

Jay via Digitalmars-d-ide digitalmars-d-ide at puremagic.com
Mon Aug 18 22:57:00 PDT 2014


On Monday, 18 August 2014 at 07:45:57 UTC, simendsjo wrote:
> I like doing it this way as I can easily have as complex build 
> rules as
> I want, and I can also build from the cli.

interesting. i'm still a noob so for my projects a trivial
invocation of dub or (r)dmd is enough. i hacked together this:


function! DBuildToolSelect(file)
      let &l:errorformat = '%f(%l):%m,%-G%.%#'

      let dir = fnamemodify(a:file, ':p:h')

      while 1
          if filereadable(dir . "/dub.json")
              let &l:makeprg = "dub build --root='" . dir . "'"
              return
          endif

          if dir == '/'
              let &l:makeprg = "rdmd --build-only '" . a:file . "'"
              return
          endif

          let dir = fnamemodify(dir, ':h')
      endwhile
endfunction

autocmd FileType d call DBuildToolSelect("%")


errorformat could be improved and i didn't test it much but so
far it seems to work.


More information about the Digitalmars-d-ide mailing list