Skip to content
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

Fix: Vim scripts loaded on Unix systems, when git config --global core.autocrlf, fail to load #1055

Closed
wants to merge 3 commits into from

Conversation

JL102
Copy link

@JL102 JL102 commented Sep 28, 2023

Fixes #1025 (See note: #1025 (comment))

Added the config option git.override_autocrlf, with a default of true, which forces config.autocrlf=false when cloning repos. Tested on Windows and Ubuntu.

To verify:

  1. Set git config --global core.autocrlf true
  2. nvim -u repro.lua repro.lua
  3. Since override_autocrlf was not overridden and the default is true, neo_tree loads without error on both Windows and Linux. Note that .repro/plugins/neo_tree.nvim/plugin/neo-tree.vim has LF line endings.
  4. rm -rf .repro
  5. Modify repro.lua and remove the comment around override_autocrlf = false
  6. nvim -u repro.lua repro.lua
  7. On Linux, neo-tree will fail to load. On Windows, neo-tree will load fine. Note that .repro/plugins/neo_tree.nvim/plugin/neo-tree.vim has CRLF line endings.

Thanks!

-- repro.lua
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
	vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"--single-branch",
		"https://github.com/JL102/lazy.nvim.git",
		lazypath,
	})
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
	-- do not remove the colorscheme!
	"folke/tokyonight.nvim",
	-- add any other pugins here
	{
		"nvim-neo-tree/neo-tree.nvim",
		branch = "v3.x",
		dependencies = {
			"nvim-lua/plenary.nvim",
			"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
			"MunifTanjim/nui.nvim",
		},
	},
}
require("lazy").setup(plugins, {
	root = root .. "/plugins",
	git = {
--		override_autocrlf = false,
	},
})

-- add anything else here
vim.opt.termguicolors = true
-- do not remove the colorscheme!
vim.cmd([[colorscheme tokyonight]])

@folke
Copy link
Owner

folke commented May 13, 2024

I just pushed a change to always set that option. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: Lazy on linux fails to load plugins when git config --global core.autocrlf is true
2 participants