cespare / vim-toml

Vim syntax for TOML
MIT License
625 stars 40 forks source link

Support user-defined $CARGO_HOME directory #51

Closed brainplot closed 3 years ago

brainplot commented 4 years ago

Cargo allows users to change its data directory by means of the $CARGO_HOME environment variable. I have that variable set to $XDG_DATA_HOME/cargo which doesn't match any of the patterns specified by the plugin. This patch adds support for a custom $CARGO_HOME directory.

I'm a vim newbie so my knowledge of vimscript is fairly limited. If there's a better/clearer way of doing this, I'm not aware of it. I'm sorry, if that's the case :)

Thank you for your work on the plugin!

cespare commented 3 years ago

I don't want this plugin to need to know about Rust in the first place. Cargo should not use toml files without a .toml extension: the extension is specified by the TOML spec and is just good sense.

And in fact, it looks like Cargo has already made this change. From https://doc.rust-lang.org/cargo/reference/config.html:

Note: Cargo also reads config files without the .toml extension, such as .cargo/config. Support for the .toml extension was added in version 1.39 and is the preferred form. If both files exist, Cargo will use the file without the extension.

Cargo 1.39 was released in Nov. 2019. I think the solution here is to upgrade Rust/Cargo and use {credentials,config}.toml instead of the extension-less filenames.

brainplot commented 3 years ago

Makes sense. Thanks for looking at it and letting me know about the change in Cargo!