-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: User runtime path doesn't have priority on Windows #1213
Labels
bug
Something isn't working
Comments
daephx
added a commit
to daephx/lualine.nvim
that referenced
this issue
Mar 19, 2024
daephx
added a commit
to daephx/lualine.nvim
that referenced
this issue
Mar 19, 2024
shadmansaleh
pushed a commit
that referenced
this issue
Mar 21, 2024
daephx
added a commit
to daephx/lualine.nvim
that referenced
this issue
Mar 21, 2024
Fixes the second part of: nvim-lualine#1213 The same logic fixed in (nvim-lualine#1214) is duplicated in the lualine_require module, which appears to be used internally for loading things like extensions. On windows, user defined extensions that overwrite the builtin similarly cannot be loaded due to the same string matching issue. In addition, the number of queried runtime files is always less-than or equal to 1 due to the `all` parameter for `nvim_get_runtime_file` being set to false. Making it impossible to sort the list of files and prioritize ones within the users config path `vim.fn.stdpath("config")`.
daephx
changed the title
Bug: User runtime path doesn't have priority for themes on Windows
Bug: User runtime path doesn't have priority on Windows
Mar 21, 2024
craigmac
pushed a commit
to craigmac/lualine.nvim
that referenced
this issue
May 15, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Self Checks
Describe the issue
I adding a custom module to my user config
lua/lualine/themes/<theme>.lua
to modifying the colors used by lualine and my preferred theme. The changes worked without issue on my Linux host, but these settings where not applied to my Windows host after pulling over the changes.It seems the logic added in this commit afb8bfb for prioritizing the users config directory when loading themes has some side effects with Neovim's default path structure on Windows.
lualine.nvim/lua/lualine/utils/loader.lua
Lines 229 to 233 in af4c3cf
I believe the culprit is the use of
vim.startswith
method to compare the path strings.On Linux, this makes perfect sense as the paths are quite different:
Config:
/home/<user>/.config/nvim
Data:
/home/<user>/.local/share/nvim
But on Windows the default locations are as follows:
Config:
C:\Users\<user>\AppData\Local\nvim
Data:
C:\Users\<user>\AppData\Local\nvim-data
If it's not apparent as to why
vim.startswith
would see these directories as equivalent.The function will only match up to a portion of the data path:
C:\Users\<user>\AppData\Local\nvim
C:\Users\<user>\AppData\Local\nvim
-dataResulting in the match being true for basically any plugin, not allowing the user config directory to take priority!
I replaced this with a simple
string.match
that leveraging the [sep
]erator variable provided by thelualine_require
module to ensure that the path string is matched to the appropriate directory, and I have not exerienced any issues with this change.How to reproduce the problem
Example:
/lua/lualine/themes/tokyonight.lua
Despite the fact that using the
require
function on the new module will return a table with your custom settings.The text was updated successfully, but these errors were encountered: