How to configure D autocompletion in Vim?
laurent.treguier.sink at gmail.com
Fri Dec 27 00:59:33 UTC 2019
On Thursday, 26 December 2019 at 18:38:23 UTC, p.shkadzko wrote:
> I'd like to set up autocompletion in Vim akin to VS Code
> "code-d" plugin which uses DCD server for completion. According
> to https://wiki.dlang.org/D_in_Vim, one can use dutyl plugin
> for this purpose. I have installed the plugin as well as
> dcd-server/client, Dscanner and dfmt, everything that was
> mentioned in dutyl README. However, after starting the server
> and working on a D script I am not getting any autocompletion
> Moreover, I simply don't know how to invoke dutyl
> autocompletion. Although looking into the plugin source code, I
> believe autocompletion should just work once you type "." or
> parenthesis. It does not. This is how my .vimrc set for dutyl:
> let g:dutyl_stdImportPaths=['/usr/bin/dmd']
> let g:dutyl_dontUseVimProc=1
> If would be great if some D Vimers shared their setup or gave
> and advice on how to configure D autocompletion in Vim.
I would recommend using a language server  for this. You can
install either Serve-D  or DLS , then use one of the many
Vim/Neovim plugins  to use one of those servers.
The best explanation for what language servers are and how they
work is probably the official one ; but in a nutshell, it
boils down to deferring things such as autocompletion to an
external program, just like DCD, except those programs (the
"language servers") follow a specification (the "Language Server
Protocol") to make them usable with any editor that also conforms
to the spec.
Very often, for editors, the Language Server Protocol is
implemented via plugins, and Vim and Neovim have 5 plugins listed
for this , so you have ample choice on what you'd prefer to
use. Each one of them should have the instructions you need to
get started in their repository's README.
More information about the Digitalmars-d