[vim/vim] Please consider switching to the XDG runtime when no vimrc exists but ~/.config/vim does (Issue #14766)

23 views
Skip to first unread message

Diego Viola

unread,
May 13, 2024, 12:11:53 PM5/13/24
to vim/vim, Subscribed

Please consider doing a runtime switch to the XDG one when a ~/.config/vim directory exists.

Currently the runtime switch happens when ~/.config/vim/vimrc exists, and that's fine.

However, while testing #14757 yesterday, I ran into some issues when I dropped the syntax files in ~/.config/vim/syntax, I didn't have a vimrc anywhere and somehow expected it to work.

A fix for that was simple, just create a minimal ~/.config/vim/vimrc with syntax on and that was it.

I think it would be a lot better if Vim also checked for the presence of ~/.config/vim and enabled the XDG runtime in those cases.

I think this is how ~/.vim currently works anyway, you don't have to have a vimrc in ~/.vim and your syntax files will be sourced regardless.

There may also be a chance that I misunderstood something, if so please let me know and feel free to close this issue.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14766@github.com>

Diego Viola

unread,
May 13, 2024, 12:58:28 PM5/13/24
to vim/vim, Subscribed

I think it would be good to do it for $XDG_CONFIG_HOME/vim too.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14766/2108228846@github.com>

Diego Viola

unread,
May 13, 2024, 1:37:17 PM5/13/24
to vim/vim, Subscribed

Now that I think, you need to have a ~/.config/vim/vimrc with syntax on anyway, given that it is not set by default.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14766/2108375137@github.com>

Diego Viola

unread,
May 13, 2024, 1:41:19 PM5/13/24
to vim/vim, Subscribed

Now that I think, you need to have a ~/.config/vim/vimrc with syntax on anyway, given that it is not set by default.

Wrong, it is.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14766/2108390027@github.com>

Gary Johnson

unread,
May 13, 2024, 2:04:41 PM5/13/24
to reply+ACY5DGHJGUZQNXQMCF...@reply.github.com, vim...@googlegroups.com
On 2024-05-13, Diego Viola wrote:
> Please consider doing a runtime switch to the XDG one when a ~/.config/vim
> directory exists.
>
> Currently the runtime switch happens when ~/.config/vim/vimrc exists, and
> that's fine.
>
> However, while testing #14757 yesterday, I ran into some issues when I dropped
> the syntax files in ~/.config/vim/syntax, I didn't have a vimrc anywhere and
> somehow expected it to work.
>
> A fix for that was simple, just create a minimal ~/.config/vim/vimrc with
> syntax on and that was it.
>
> I think it would be a lot better if Vim also checked for the presence of ~
> /.config/vim and enabled the XDG runtime in those cases.
>
> I think this is how ~/.vim currently works anyway, you don't have to have a
> vimrc in ~/.vim and your syntax files will be sourced regardless.
>
> There may also be a chance that I misunderstood something, if so please let me
> know and feel free to close this issue.

I may be missing something, too, but I think you're right. I didn't
think about that enough during the PR review.

The location of the user's vim directory should be determined by
searching that prioritized list of places and selecting the first
one that is actually a directory or a link to a directory. The
location of the user's vimrc should be determined separately. It
should be $HOME/.vimrc if it exists, else vimrc under the directory
found above.

Regards,
Gary

vim-dev ML

unread,
May 13, 2024, 2:05:11 PM5/13/24
to vim/vim, vim-dev ML, Your activity

On 2024-05-13, Diego Viola wrote:
> Please consider doing a runtime switch to the XDG one when a ~/.config/vim
> directory exists.
>
> Currently the runtime switch happens when ~/.config/vim/vimrc exists, and
> that's fine.
>
> However, while testing #14757 yesterday, I ran into some issues when I dropped
> the syntax files in ~/.config/vim/syntax, I didn't have a vimrc anywhere and
> somehow expected it to work.
>
> A fix for that was simple, just create a minimal ~/.config/vim/vimrc with
> syntax on and that was it.
>
> I think it would be a lot better if Vim also checked for the presence of ~
> /.config/vim and enabled the XDG runtime in those cases.
>
> I think this is how ~/.vim currently works anyway, you don't have to have a
> vimrc in ~/.vim and your syntax files will be sourced regardless.
>
> There may also be a chance that I misunderstood something, if so please let me
> know and feel free to close this issue.

I may be missing something, too, but I think you're right. I didn't
think about that enough during the PR review.

The location of the user's vim directory should be determined by
searching that prioritized list of places and selecting the first
one that is actually a directory or a link to a directory. The
location of the user's vimrc should be determined separately. It
should be $HOME/.vimrc if it exists, else vimrc under the directory
found above.

Regards,
Gary


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14766/2108475930@github.com>

plitter

unread,
Jun 4, 2024, 11:01:13 AM6/4/24
to vim/vim, vim-dev ML, Comment

#2034 I have vim 9.1.429 and having .config/vim/vimrc works now :D


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/issues/14766/2147761068@github.com>

Reply all
Reply to author
Forward
0 new messages