1995eaton / chromium-vim

Vim bindings for Google Chrome.
https://chrome.google.com/webstore/detail/cvim/ihlenndgcmojhcghmfjfneahoeklbjjh
MIT License
2.25k stars 326 forks source link

Support XDG Base Directory Specification #750

Open erikw opened 2 years ago

erikw commented 2 years ago

First of all, thanks for this really great plugin!

Background

Lately the XDG Base Directory Specification has been gaining quite a steady popularity, even though it's been around for a long time already. The basic idea is to standardize where programs put their files e.g. all config files in a certain directory. The benefits for end users are many, including:

The first point is maybe what most end users enjoy the most though.

How

Specifically for this project, this should mean that the search for the configuration file should be done like:

  1. If $XDG_CONFIG_HOME is set, look for $XDG_CONFIG_HOME/cvim/cvimrc
  2. If $XDG_CONFIG_HOME is unset, use the default value for the envvar which is $HOME/.config. Thus, the config file to look for is at $HOME/.config/cvim/cvimrc
  3. If none of the above, fall-back to current legacy $HOME/.cvimrc

The first two steps to can be codifed in bash like: ${XDG_CONFIG_HOME:-$HOME/.config}/cvim/cvimrc