mirror of
https://github.com/NvChad/NvChad
synced 2023-10-04 09:45:13 -05:00
cleaned up code and added descriptive comments
Add configurable 'place_mason_bin' option in custom/chadrc.lua for flexible mason/bin path handling
This commit is contained in:
parent
d85fa05a19
commit
c0640363b0
|
@ -83,12 +83,9 @@ M.ui = {
|
|||
},
|
||||
}
|
||||
|
||||
-- Where NvChad should put mason.nvim bin location in your PATH. Can be one of:
|
||||
-- - "prepend" (default, Mason's bin location is put first in PATH)
|
||||
-- - "append" (Mason's bin location is put at the end of PATH)
|
||||
-- - "skip" (doesn't modify PATH)
|
||||
-- Determines the preferred placement of the mason.nvim bin directory in your PATH.
|
||||
---@type '"prepend"' | '"append"' | '"skip"'
|
||||
M.mason_path = "prepend"
|
||||
M.place_mason_bin = "prepend"
|
||||
|
||||
M.plugins = "" -- path i.e "custom.plugins", so make custom/plugins.lua file
|
||||
|
||||
|
|
|
@ -57,11 +57,15 @@ for _, provider in ipairs { "node", "perl", "python3", "ruby" } do
|
|||
end
|
||||
|
||||
-- add binaries installed by mason.nvim to path
|
||||
-- based on the selected 'place_mason_bin' option
|
||||
local is_windows = vim.loop.os_uname().sysname == "Windows_NT"
|
||||
if config.mason_path == "prepend" then
|
||||
vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH
|
||||
elseif config.mason_path == "append" then
|
||||
vim.env.PATH = vim.env.PATH .. (is_windows and ";" or ":") .. vim.fn.stdpath "data" .. "/mason/bin"
|
||||
local path_separator = is_windows and ";" or ":"
|
||||
local mason_bin_path = vim.fn.stdpath "data" .. "/mason/bin"
|
||||
|
||||
if config.place_mason_bin == "prepend" then
|
||||
vim.env.PATH = mason_bin_path .. path_separator .. vim.env.PATH
|
||||
elseif config.place_mason_bin == "append" then
|
||||
vim.env.PATH = vim.env.PATH .. path_separator .. mason_bin_path
|
||||
end
|
||||
|
||||
-------------------------------------- autocmds ------------------------------------------
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
local options = {
|
||||
ensure_installed = { "lua-language-server" }, -- not an option from mason.nvim
|
||||
|
||||
-- Note: Avoid setting `PATH="prepend"|"append"` here.
|
||||
-- To change the location of the mason/bin directory, update the 'place_mason_bin' option
|
||||
-- in 'custom/chadrc.lua'. If you must set it here, ensure 'place_mason_bin' in 'custom/chadrc.lua'
|
||||
-- is set to 'skip' to prevent duplicate mason/bin paths.
|
||||
PATH = "skip",
|
||||
|
||||
ui = {
|
||||
|
|
Loading…
Reference in a new issue