Skip to content

Instantly share code, notes, and snippets.

@pbackus

pbackus/d.vim Secret

Last active January 14, 2024 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbackus/12e407ae96a54ced6ea9b3f72be25264 to your computer and use it in GitHub Desktop.
Save pbackus/12e407ae96a54ced6ea9b3f72be25264 to your computer and use it in GitHub Desktop.
Vim config for D programming
" ftplugin/d.vim
setlocal formatoptions+=ro
if len(glob("[Mm]akefile")) || len(glob("*.mak"))
compiler dmd
elseif filereadable("dub.sdl") || filereadable("dub.json")
compiler dub
else
compiler dmd
endif
if executable('xdg-open')
command -buffer -nargs=1 Dpldocs
\ execute 'silent !xdg-open "http://search.dpldocs.info/locate?q=<args>"' | redraw!
setlocal keywordprg=:Dpldocs
endif
setlocal include=^\\(\\s*static\\)\\?\\s*import\\s\\+\\([[:lower:][:upper:][:digit:]_]\\+\\s*=\\s*\\)\\?\\zs[[:lower:][:upper:][:digit:]_.]\\+\\ze
setlocal includeexpr=substitute(v:fname,'\\.','/','g')
setlocal suffixesadd=.d,.di
" compiler/dmd.vim
" Compiler plugin for the Digital Mars D compiler
let current_compiler = "dmd"
" For compatibility with old versions of Vim
if exists(":CompilerSet") != 2
command -nargs=* CompilerSet setlocal <args>
endif
" errorformat entries:
" - Errors from -verrors=spec (ignored)
" - Uncaught exceptions (e.g., from unit tests)
" - Errors in string mixins
" - Normal compile errors
CompilerSet errorformat=
\%-G\(spec:%*[0-9]\)\ %m,
\%*[^@]@%f\(%l\):\ %m,
\%f-mixin-%*[0-9]\(%l\\,%c\):\ %m,
\%f-mixin-%*[0-9]\(%l\):\ %m,
\%f\(%l\\,%c\):\ %m,
\%f\(%l\):\ %m
" compiler/dub.vim
" Compiler plugin for DUB
runtime compiler/dmd.vim
let current_compiler = "dub"
" For compatibility with old versions of Vim
if exists(":CompilerSet") != 2
command -nargs=* CompilerSet setlocal <args>
endif
" Suppress non-error output to avoid spurious quickfix entries
CompilerSet makeprg=dub\ --verror
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment