Advertisement
Guest User

Vim config for D programming

a guest
Aug 18th, 2022
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 1.53 KB | Source Code | 0 0
  1. " ftplugin/d.vim
  2.  
  3. setlocal formatoptions+=ro
  4.  
  5. if filereadable("dub.sdl") || filereadable("dub.json")
  6.     compiler dub
  7. elseif executable("dmd")
  8.     compiler dmd
  9. endif
  10.  
  11. if executable('xdg-open')
  12.     command -buffer -nargs=1 Dpldocs
  13.         \ execute 'silent !xdg-open "http://search.dpldocs.info/locate?q=<args>"' | redraw!
  14.     setlocal keywordprg=:Dpldocs
  15. endif
  16.  
  17. setlocal include=^\\(\\s*static\\)\\?\\s*import\\s\\+\\([[:lower:][:upper:][:digit:]_]\\+\\s*=\\s*\\)\\?\\zs[[:lower:][:upper:][:digit:]_.]\\+\\ze
  18. setlocal includeexpr=substitute(v:fname,'\\.','/','g')
  19. setlocal suffixesadd=.d,.di
  20.  
  21. ----------
  22.  
  23. " compiler/dmd.vim
  24. " Compiler plugin for the Digital Mars D compiler
  25.  
  26. let current_compiler = "dmd"
  27.  
  28. " For compatibility with old versions of Vim
  29. if exists(":CompilerSet") != 2
  30.     command -nargs=* CompilerSet setlocal <args>
  31. endif
  32.  
  33. " errorformat entries:
  34. "  - Errors from -verrors=spec (ignored)
  35. "  - Uncaught exceptions (e.g., from unit tests)
  36. "  - Errors in string mixins
  37. "  - Normal compile errors
  38. CompilerSet errorformat=
  39.     \%-G\(spec:%*[0-9]\)\ %m,
  40.     \%*[^@]@%f\(%l\):\ %m,
  41.     \%f-mixin-%*[0-9]\(%l\\,%c\):\ %m,
  42.     \%f-mixin-%*[0-9]\(%l\):\ %m,
  43.     \%f\(%l\\,%c\):\ %m,
  44.     \%f\(%l\):\ %m
  45.  
  46. ----------
  47.  
  48. " compiler/dub.vim
  49. " Compiler plugin for DUB
  50.  
  51. runtime compiler/dmd.vim
  52.  
  53. let current_compiler = "dub"
  54.  
  55. " For compatibility with old versions of Vim
  56. if exists(":CompilerSet") != 2
  57.     command -nargs=* CompilerSet setlocal <args>
  58. endif
  59.  
  60. " Suppress non-error output to avoid spurious quickfix entries
  61. CompilerSet makeprg=dub\ --verror
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement