Thread overview
What's the ultimate setup for vim?
Aug 18, 2014
Jay
Aug 18, 2014
simendsjo
Aug 19, 2014
Jay
Oct 06, 2014
Zardoz
August 18, 2014
i've installed dutyl and d.vim (not dsnips though, not interested). i guess now i need to set 'makeprg' (to 'dub build' or 'rdmd --build-only' if dub.json isn't present) and 'errorformat'. this is somewhat uncharted territory for me so i decided to look for existing solutions. didn't get much out of google so here i am. please post your whatever you feel might be useful and i'll try to sum it up and add to the wiki page.
August 18, 2014
On 08/18/2014 09:39 AM, Jay wrote:
> i've installed dutyl and d.vim (not dsnips though, not interested). i guess now i need to set 'makeprg' (to 'dub build' or 'rdmd --build-only' if dub.json isn't present) and 'errorformat'. this is somewhat uncharted territory for me so i decided to look for existing solutions. didn't get much out of google so here i am. please post your whatever you feel might be useful and i'll try to sum it up and add to the wiki page.

I don't have anything fancy. I add a Makefile for each project with some standard Makefile rule-names, and bind these to some function keys. Most of the rules are just `dub run`, `dub build` etc.

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.

" Shortcuts for running makefile rules
map <f1> :wa<cr>:!clear<cr>:Dispatch make doc<cr>
map <f2> :wa<cr>:!clear<cr>:Dispatch make tags<cr>
map <f3> :wa<cr>:!clear<cr>:Dispatch make test<cr>
map <f5> :wa<cr>:!clear<cr>:make run<cr>
map <f6> :wa<cr>:!clear<cr>:Dispatch make build<cr>
map <f7> :wa<cr>:!clear<cr>:make debug<cr>
imap <f1> <esc><f1>
imap <f2> <esc><f2>
imap <f3> <esc><f3>
imap <f5> <esc><f5>
imap <f6> <esc><f6>
imap <f7> <esc><f7>

August 19, 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.
October 06, 2014
On Monday, 18 August 2014 at 07:39:05 UTC, Jay wrote:
> i've installed dutyl and d.vim (not dsnips though, not interested). i guess now i need to set 'makeprg' (to 'dub build' or 'rdmd --build-only' if dub.json isn't present) and 'errorformat'. this is somewhat uncharted territory for me so i decided to look for existing solutions. didn't get much out of google so here i am. please post your whatever you feel might be useful and i'll try to sum it up and add to the wiki page.

I found that neovim show me all errors of two D little projects that I was updating to use DUB. I think that it's launching dub build on background and getting the output to show the errors.