Dutyl - a Vim plugin for running D tools

John Colvin via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Sep 30 01:47:41 PDT 2014


On Tuesday, 30 September 2014 at 08:27:27 UTC, Idan Arye wrote:
> On Monday, 29 September 2014 at 16:09:04 UTC, John Colvin wrote:
>> On Sunday, 28 September 2014 at 11:51:21 UTC, Idan Arye wrote:
>>> On Thursday, 25 September 2014 at 15:40:22 UTC, John Colvin 
>>> wrote:
>>>> On Thursday, 14 August 2014 at 22:20:52 UTC, Idan Arye wrote:
>>>>> GitHub repo: https://github.com/idanarye/vim-dutyl
>>>>> vim.org page: 
>>>>> http://www.vim.org/scripts/script.php?script_id=5003
>>>>>
>>>>> The main problem with my Vim plugin for DCD(placed inside 
>>>>> the DCD repo) is the need to set the import paths manually. 
>>>>> It was a manual task that the user had to do: DCD doesn't 
>>>>> know the import path the current project is using. Vim 
>>>>> doesn't know either.
>>>>>
>>>>> Luckily - DUB knows. So instead of separate Vim plugins for 
>>>>> different tools, each operating it's own tool alone, I 
>>>>> wanted to create one plugin that'll operate both DUB and 
>>>>> DCD - one that can get the list of import modules from DUB 
>>>>> and send it to DCD. That's how Dutyl was born.
>>>>>
>>>>> Currently, Dutyl's only features are using DCD for 
>>>>> autocompletion and for DDocs, but it has a module system 
>>>>> that allows it to add other tools, either to get more 
>>>>> functionality or to get backup for features that some tools 
>>>>> can't support for specific projects. Like dependency 
>>>>> injection but with a real usecase: for projects that don't 
>>>>> use DUB, Dutyl can back up to a manually written list of 
>>>>> import paths saved in a hidden file in the project's dir.
>>>>>
>>>>> I'm open for suggestions for other tools and features to 
>>>>> add to Dutyl(write them here, or preferably open GitHub 
>>>>> issues with them)
>>>>
>>>> How does dutyl know where to look for dub.json? It doesn't 
>>>> seem to find it on my system.
>>>
>>> It looks for a file named "dub.json" in the current folder. 
>>> If it can not find it, it looks for "package.json".
>>
>> Ah, ok. Is it feasible to have it check up the directory tree 
>> as well, like git does? I often find myself in this situation:
>>
>> myProject
>> |- dub.json
>> |- source  <- vim pwd here
>>   |- app.d
>>
>> and so Dutyl misses myProject/dub.json
>
> Seems a little weird to do so, considering that DUB itself does 
> not look up in the directory tree...

True, but it does make auto-complete work properly when you open 
a single source file in a project, without having to manually set 
the current directory. Vim's current directory (either global or 
per-window) isn't part of my workflow*.

It could be an optional feature (a flag in .vimrc would be fine) 
with an override (temporarily manually specify the location of 
dub.json), but I think it makes a significant usability 
improvement.


I'm trying to think of a pathological case where it would be a 
bad idea, but I can't think of anything realistic.


*Am I doing something very wrong here? If using (l)cd in vim is 
part of almost everyone's workflow I should probably just start 
using it more and stop complaining :)


More information about the Digitalmars-d-announce mailing list