Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
* upstream/master:
  fix(lir): nil check, simpler logic (LunarVim#3725)
  fix(icons): make devicons optional (LunarVim#3616)
  feat(dap-ui): update setup table (LunarVim#3724)
  refactor(quit)!: use native quit confirm (LunarVim#3721)
  fix(config): copy the correct example config (LunarVim#3722)
  feat: cmdline config option enables cmp-cmdline plugin (LunarVim#3719)
  refactor: move to upstream lir (LunarVim#3711)
  fix(treesitter): prepend to rtp (LunarVim#3708)
  refactor: migrate to lazy.nvim (LunarVim#3647)
  fix: bash installer errors (LunarVim#3686)
  refactor(treesitter)!: use auto-install by default (LunarVim#3677)
  fix(telescope): backwards compability (LunarVim#3596)
  feat: enable auto preview colorscheme by default (LunarVim#3701)
  fix(ts): disable indent for c and cpp (LunarVim#3687)
  chore: update funding
  feat: update setup tables (LunarVim#3693)
  refactor: use lir fork in the org (LunarVim#3694)
  chore: bump plugins version (LunarVim#3652)
  • Loading branch information
hexsailor committed Jan 13, 2023
2 parents 22cd45e + 2922a42 commit 9aab7fd
Show file tree
Hide file tree
Showing 35 changed files with 689 additions and 1,305 deletions.
5 changes: 1 addition & 4 deletions .github/FUNDING.yml
@@ -1,6 +1,3 @@
# These are supported funding model platforms

github: christianchiarulli
patreon: chrisatmachine
ko_fi: chrisatmachine
custom: ["https://www.buymeacoffee.com/chrisatmachine", "https://www.paypal.com/paypalme/chrisatmachine", "https://strike.me/chrisatmachine"]
custom: ["https://www.lunarvim.org/donate"]
27 changes: 11 additions & 16 deletions lua/lvim/bootstrap.lua
Expand Up @@ -3,6 +3,7 @@ local M = {}
if vim.fn.has "nvim-0.8" ~= 1 then
vim.notify("Please upgrade your Neovim base installation. Lunarvim requires v0.8+", vim.log.levels.WARN)
vim.wait(5000, function()
---@diagnostic disable-next-line: redundant-return-value
return false
end)
vim.cmd "cquit"
Expand All @@ -23,7 +24,7 @@ _G.require_safe = require("lvim.utils.modules").require_safe
_G.reload = require("lvim.utils.modules").reload

---Get the full path to `$LUNARVIM_RUNTIME_DIR`
---@return string
---@return string|nil
function _G.get_runtime_dir()
local lvim_runtime_dir = os.getenv "LUNARVIM_RUNTIME_DIR"
if not lvim_runtime_dir then
Expand All @@ -34,7 +35,7 @@ function _G.get_runtime_dir()
end

---Get the full path to `$LUNARVIM_CONFIG_DIR`
---@return string
---@return string|nil
function _G.get_config_dir()
local lvim_config_dir = os.getenv "LUNARVIM_CONFIG_DIR"
if not lvim_config_dir then
Expand All @@ -44,7 +45,7 @@ function _G.get_config_dir()
end

---Get the full path to `$LUNARVIM_CACHE_DIR`
---@return string
---@return string|nil
function _G.get_cache_dir()
local lvim_cache_dir = os.getenv "LUNARVIM_CACHE_DIR"
if not lvim_cache_dir then
Expand All @@ -60,11 +61,11 @@ function M:init(base_dir)
self.config_dir = get_config_dir()
self.cache_dir = get_cache_dir()
self.pack_dir = join_paths(self.runtime_dir, "site", "pack")
self.packer_install_dir = join_paths(self.runtime_dir, "site", "pack", "packer", "start", "packer.nvim")
self.packer_cache_path = join_paths(self.config_dir, "plugin", "packer_compiled.lua")
self.lazy_install_dir = join_paths(self.pack_dir, "lazy", "opt", "lazy.nvim")

---@meta overridden to use LUNARVIM_CACHE_DIR instead, since a lot of plugins call this function internally
---NOTE: changes to "data" are currently unstable, see #2507
---@diagnostic disable-next-line: duplicate-set-field
vim.fn.stdpath = function(what)
if what == "cache" then
return _G.get_cache_dir()
Expand All @@ -79,33 +80,27 @@ function M:init(base_dir)
end

if os.getenv "LUNARVIM_RUNTIME_DIR" then
-- vim.opt.rtp:append(os.getenv "LUNARVIM_RUNTIME_DIR" .. path_sep .. "lvim")
vim.opt.rtp:remove(join_paths(vim.call("stdpath", "data"), "site"))
vim.opt.rtp:remove(join_paths(vim.call("stdpath", "data"), "site", "after"))
vim.opt.rtp:prepend(join_paths(self.runtime_dir, "site"))
-- vim.opt.rtp:prepend(join_paths(self.runtime_dir, "site"))
vim.opt.rtp:append(join_paths(self.runtime_dir, "lvim", "after"))
vim.opt.rtp:append(join_paths(self.runtime_dir, "site", "after"))

vim.opt.rtp:remove(vim.call("stdpath", "config"))
vim.opt.rtp:remove(join_paths(vim.call("stdpath", "config"), "after"))
vim.opt.rtp:prepend(self.config_dir)
vim.opt.rtp:append(join_paths(self.config_dir, "after"))
-- TODO: we need something like this: vim.opt.packpath = vim.opt.rtp

vim.cmd [[let &packpath = &runtimepath]]
end

if not vim.env.LVIM_TEST_ENV then
require "lvim.impatient"
vim.opt.packpath = vim.opt.rtp:get()
end

require("lvim.config"):init()

require("lvim.plugin-loader").init {
package_root = self.pack_dir,
install_path = self.packer_install_dir,
install_path = self.lazy_install_dir,
}

require("lvim.config"):init()

require("lvim.core.mason").bootstrap()

return self
Expand Down
101 changes: 88 additions & 13 deletions lua/lvim/config/_deprecated.lua
Expand Up @@ -41,6 +41,24 @@ function M.handle()
end,
})

---@deprecated
lvim.builtin.dashboard = {}
setmetatable(lvim.builtin.dashboard, {
__newindex = function(_, k, _)
deprecate("lvim.builtin.dashboard." .. k, "Use `lvim.builtin.alpha` instead. See LunarVim#1906")
end,
})

---@deprecated
lvim.lsp.popup_border = {}
setmetatable(lvim.lsp.popup_border, mt)

---@deprecated
lvim.lang = {}
setmetatable(lvim.lang, mt)
end

function M.post_load()
if lvim.lsp.override and not vim.tbl_isempty(lvim.lsp.override) then
deprecate("lvim.lsp.override", "Use `lvim.lsp.automatic_configuration.skipped_servers` instead")
vim.tbl_map(function(c)
Expand All @@ -64,21 +82,78 @@ function M.handle()
)
end

---@deprecated
lvim.builtin.dashboard = {}
setmetatable(lvim.builtin.dashboard, {
__newindex = function(_, k, _)
deprecate("lvim.builtin.dashboard." .. k, "Use `lvim.builtin.alpha` instead. See LunarVim#1906")
end,
})
local function convert_spec_to_lazy(spec)
local alternatives = {
setup = "init",
as = "name",
opt = "lazy",
run = "build",
lock = "pin",
tag = "version",
}

---@deprecated
lvim.lsp.popup_border = {}
setmetatable(lvim.lsp.popup_border, mt)
alternatives.requires = function()
if type(spec.requires) == "string" then
spec.dependencies = { spec.requires }
else
spec.dependencies = spec.requires
end

---@deprecated
lvim.lang = {}
setmetatable(lvim.lang, mt)
return "Use `dependencies` instead"
end

alternatives.disable = function()
if type(spec.disabled) == "function" then
spec.enabled = function()
return not spec.disabled()
end
else
spec.enabled = not spec.disabled
end
return "Use `enabled` instead"
end

alternatives.wants = function()
return "It's not needed in most cases, otherwise use `dependencies`."
end
alternatives.needs = alternatives.wants

alternatives.module = function()
spec.lazy = true
return "Use `lazy = true` instead."
end

for old_key, alternative in pairs(alternatives) do
if spec[old_key] ~= nil then
local message

if type(alternative) == "function" then
message = alternative()
else
spec[alternative] = spec[old_key]
end
spec[old_key] = nil

message = message or string.format("Use `%s` instead.", alternative)
deprecate(
string.format("%s` in `lvim.plugins", old_key),
message .. " See https://github.com/folke/lazy.nvim#-migration-guide"
)
end
end

if spec[1] and spec[1]:match "^http" then
spec.url = spec[1]
spec[1] = nil
deprecate("{ 'http...' }` in `lvim.plugins", "Use { url = 'http...' } instead.")
end
end

for _, plugin in ipairs(lvim.plugins) do
if type(plugin) == "table" then
convert_spec_to_lazy(plugin)
end
end
end

return M
6 changes: 5 additions & 1 deletion lua/lvim/config/init.lua
Expand Up @@ -56,13 +56,17 @@ function M:load(config_path)
vim.notify_once(
string.format("User-configuration not found. Creating an example configuration in %s", config_path)
)
local example_config = join_paths(get_lvim_base_dir(), "utils", "installer", "config.example.lua")
local config_name = vim.loop.os_uname().version:match "Windows" and "config_win" or "config"
local example_config = join_paths(get_lvim_base_dir(), "utils", "installer", config_name .. ".example.lua")
vim.fn.mkdir(user_config_dir, "p")
vim.loop.fs_copyfile(example_config, config_path)
end
end

Log:set_level(lvim.log.level)

require("lvim.config._deprecated").post_load()

autocmds.define_autocmds(lvim.autocommands)

vim.g.mapleader = (lvim.leader == "space" and " ") or lvim.leader
Expand Down
17 changes: 12 additions & 5 deletions lua/lvim/core/breadcrumbs.lua
Expand Up @@ -12,7 +12,7 @@ M.config = function()
"help",
"startify",
"dashboard",
"packer",
"lazy",
"neo-tree",
"neogitstatus",
"NvimTree",
Expand Down Expand Up @@ -99,10 +99,17 @@ M.get_filename = function()
local f = require "lvim.utils.functions"

if not f.isempty(filename) then
local file_icon, hl_group = require("nvim-web-devicons").get_icon(filename, extension, { default = true })

if f.isempty(file_icon) then
file_icon = lvim.icons.kind.File
local file_icon, hl_group
local devicons_ok, devicons = pcall(require, "nvim-web-devicons")
if lvim.use_icons and devicons_ok then
file_icon, hl_group = devicons.get_icon(filename, extension, { default = true })

if f.isempty(file_icon) then
file_icon = lvim.icons.kind.File
end
else
file_icon = ""
hl_group = "Normal"
end

local buf_ft = vim.bo.filetype
Expand Down
4 changes: 2 additions & 2 deletions lua/lvim/core/bufferline.lua
Expand Up @@ -117,8 +117,8 @@ M.config = function()
highlight = "PanelHeading",
},
{
filetype = "packer",
text = "Packer",
filetype = "lazy",
text = "Lazy",
highlight = "PanelHeading",
padding = 1,
},
Expand Down
24 changes: 23 additions & 1 deletion lua/lvim/core/dap.lua
Expand Up @@ -31,7 +31,6 @@ M.config = function()
threshold = vim.log.levels.INFO,
},
config = {
expand_lines = true,
icons = { expanded = "", collapsed = "", circular = "" },
mappings = {
-- Use a table to apply multiple mappings
Expand All @@ -42,6 +41,9 @@ M.config = function()
repl = "r",
toggle = "t",
},
-- Use this to override mappings for specific elements
element_mappings = {},
expand_lines = true,
layouts = {
{
elements = {
Expand All @@ -62,6 +64,21 @@ M.config = function()
position = "bottom",
},
},
controls = {
enabled = true,
-- Display controls in this element
element = "repl",
icons = {
pause = "",
play = "",
step_into = "",
step_over = "",
step_out = "",
step_back = "",
run_last = "",
terminate = "",
},
},
floating = {
max_height = 0.9,
max_width = 0.5, -- Floats will be treated as percentage of your screen.
Expand All @@ -70,6 +87,11 @@ M.config = function()
close = { "q", "<Esc>" },
},
},
windows = { indent = 1 },
render = {
max_type_length = nil, -- Can be integer or nil.
max_value_lines = 100, -- Can be integer or nil.
},
},
},
}
Expand Down
25 changes: 9 additions & 16 deletions lua/lvim/core/gitsigns.lua
Expand Up @@ -37,15 +37,14 @@ M.config = function()
linehl = "GitSignsChangeLn",
},
},
signcolumn = true,
numhl = false,
linehl = false,
keymaps = {
-- Default keymap options
noremap = true,
buffer = true,
},
signcolumn = true,
word_diff = false,
watch_gitdir = {
interval = 1000,
follow_files = true,
},
attach_to_untracked = true,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
Expand All @@ -54,9 +53,10 @@ M.config = function()
delay = 1000,
ignore_whitespace = false,
},
current_line_blame_formatter_opts = {
relative_time = false,
},
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
sign_priority = 6,
status_formatter = nil, -- Use default
update_debounce = 200,
max_file_length = 40000,
preview_config = {
-- Options passed to nvim_open_win
Expand All @@ -66,13 +66,6 @@ M.config = function()
row = 0,
col = 1,
},
watch_gitdir = {
interval = 1000,
follow_files = true,
},
sign_priority = 6,
update_debounce = 200,
status_formatter = nil, -- Use default
yadm = { enable = false },
},
}
Expand Down
6 changes: 5 additions & 1 deletion lua/lvim/core/illuminate.lua
Expand Up @@ -13,13 +13,17 @@ M.config = function()
},
-- delay: delay in milliseconds
delay = 120,
-- filetype_overrides: filetype specific overrides.
-- The keys are strings to represent the filetype while the values are tables that
-- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist
filetype_overrides = {},
-- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist
filetypes_denylist = {
"dirvish",
"fugitive",
"alpha",
"NvimTree",
"packer",
"lazy",
"neogitstatus",
"Trouble",
"lir",
Expand Down

0 comments on commit 9aab7fd

Please sign in to comment.