Skip to content

Modify the "automatic installation" so it uses $XDG_CONFIG_HOME #1335

Description

@pepoluan

I suggest replacing the following snippet in the Automatic Installation section on the Tips page:

let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'

With the following:

if !empty($VIM_CONFIG_DIR)
    let data_dir = $VIM_CONFIG_DIR
elseif has('nvim')
    let data_dir = stdpath('data') . '/site'
elseif !empty($XDG_CONFIG_HOME)
    let data_dir = $XDG_CONFIG_HOME
else
    let data_dir = $HOME . '/.config/vim'
endif

It's not only easier to read, it is now compliant with XDG Base Directory Specification, but allowing override by setting the VIM_CONFIG_DIR env var.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions