Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
61f1c308bf |
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -59,8 +59,6 @@ jobs:
|
||||
with:
|
||||
release-type: simple
|
||||
package-name: LazyVim
|
||||
extra-files: |
|
||||
lua/lazyvim/config/init.lua
|
||||
- uses: actions/checkout@v3
|
||||
- name: tag stable versions
|
||||
if: ${{ steps.release.outputs.release_created }}
|
||||
|
@ -1,5 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## [9.9.1](https://github.com/LazyVim/LazyVim/compare/v9.9.0...v9.9.1) (2023-10-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **config:** disable LazyFile till v10.0 ([ee7a401](https://github.com/LazyVim/LazyVim/commit/ee7a401388f2933729afcd7090fb8e69631b912f))
|
||||
|
||||
## [9.9.0](https://github.com/LazyVim/LazyVim/compare/v9.8.0...v9.9.0) (2023-10-10)
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -95,19 +95,18 @@ end
|
||||
|
||||
-- formatting
|
||||
map({ "n", "v" }, "<leader>cf", function()
|
||||
Util.format({ force = true })
|
||||
require("lazyvim.plugins.lsp.format").format({ force = true })
|
||||
end, { desc = "Format" })
|
||||
|
||||
-- stylua: ignore start
|
||||
|
||||
-- toggle options
|
||||
map("n", "<leader>uf", function() Util.format.toggle() end, { desc = "Toggle auto format (global)" })
|
||||
map("n", "<leader>uF", function() Util.format.toggle(true) end, { desc = "Toggle auto format (buffer)" })
|
||||
map("n", "<leader>uf", require("lazyvim.plugins.lsp.format").toggle, { desc = "Toggle format on Save" })
|
||||
map("n", "<leader>us", function() Util.toggle("spell") end, { desc = "Toggle Spelling" })
|
||||
map("n", "<leader>uw", function() Util.toggle("wrap") end, { desc = "Toggle Word Wrap" })
|
||||
map("n", "<leader>uL", function() Util.toggle("relativenumber") end, { desc = "Toggle Relative Line Numbers" })
|
||||
map("n", "<leader>ul", function() Util.toggle.number() end, { desc = "Toggle Line Numbers" })
|
||||
map("n", "<leader>ud", function() Util.toggle.diagnostics() end, { desc = "Toggle Diagnostics" })
|
||||
map("n", "<leader>ul", function() Util.toggle_number() end, { desc = "Toggle Line Numbers" })
|
||||
map("n", "<leader>ud", Util.toggle_diagnostics, { desc = "Toggle Diagnostics" })
|
||||
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
|
||||
map("n", "<leader>uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" })
|
||||
if vim.lsp.inlay_hint then
|
||||
@ -115,8 +114,8 @@ if vim.lsp.inlay_hint then
|
||||
end
|
||||
|
||||
-- lazygit
|
||||
map("n", "<leader>gg", function() Util.terminal({ "lazygit" }, { cwd = Util.root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" })
|
||||
map("n", "<leader>gG", function() Util.terminal({ "lazygit" }, {esc_esc = false, ctrl_hjkl = false}) end, { desc = "Lazygit (cwd)" })
|
||||
map("n", "<leader>gg", function() Util.float_term({ "lazygit" }, { cwd = Util.get_root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" })
|
||||
map("n", "<leader>gG", function() Util.float_term({ "lazygit" }, {esc_esc = false, ctrl_hjkl = false}) end, { desc = "Lazygit (cwd)" })
|
||||
|
||||
-- quit
|
||||
map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit all" })
|
||||
@ -128,9 +127,9 @@ map("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" })
|
||||
map("n", "<leader>L", Util.changelog, {desc = "LazyVim Changelog"})
|
||||
|
||||
-- floating terminal
|
||||
local lazyterm = function() Util.terminal(nil, { cwd = Util.root() }) end
|
||||
local lazyterm = function() Util.float_term(nil, { cwd = Util.get_root() }) end
|
||||
map("n", "<leader>ft", lazyterm, { desc = "Terminal (root dir)" })
|
||||
map("n", "<leader>fT", function() Util.terminal() end, { desc = "Terminal (cwd)" })
|
||||
map("n", "<leader>fT", function() Util.float_term() end, { desc = "Terminal (cwd)" })
|
||||
map("n", "<c-/>", lazyterm, { desc = "Terminal (root dir)" })
|
||||
map("n", "<c-_>", lazyterm, { desc = "which_key_ignore" })
|
||||
|
||||
|
@ -2,16 +2,6 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
|
||||
-- Enable LazyVim auto format
|
||||
vim.g.autoformat = true
|
||||
|
||||
-- LazyVim root dir detection
|
||||
-- Each entry can be:
|
||||
-- * the name of a detector function like `lsp` or `cwd`
|
||||
-- * a pattern or array of patterns like `.git` or `lua`.
|
||||
-- * a function with signature `function(buf) -> string|string[]`
|
||||
vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" }
|
||||
|
||||
local opt = vim.opt
|
||||
|
||||
opt.autowrite = true -- Enable auto write
|
||||
@ -73,10 +63,10 @@ end
|
||||
|
||||
-- Folding
|
||||
vim.opt.foldlevel = 99
|
||||
vim.opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()"
|
||||
vim.opt.foldtext = "v:lua.require'lazyvim.util.ui'.foldtext()"
|
||||
|
||||
if vim.fn.has("nvim-0.9.0") == 1 then
|
||||
vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util'.ui.statuscolumn()]]
|
||||
vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]]
|
||||
end
|
||||
|
||||
-- HACK: causes freezes on <= 0.9, so only enable on >= 0.10 for now
|
||||
|
@ -11,7 +11,7 @@ return {
|
||||
{
|
||||
"<leader>fe",
|
||||
function()
|
||||
require("neo-tree.command").execute({ toggle = true, dir = Util.root() })
|
||||
require("neo-tree.command").execute({ toggle = true, dir = require("lazyvim.util").get_root() })
|
||||
end,
|
||||
desc = "Explorer NeoTree (root dir)",
|
||||
},
|
||||
@ -29,7 +29,7 @@ return {
|
||||
vim.cmd([[Neotree close]])
|
||||
end,
|
||||
init = function()
|
||||
if vim.fn.argc(-1) == 1 then
|
||||
if vim.fn.argc() == 1 then
|
||||
local stat = vim.loop.fs_stat(vim.fn.argv(0))
|
||||
if stat and stat.type == "directory" then
|
||||
require("neo-tree")
|
||||
@ -60,7 +60,7 @@ return {
|
||||
},
|
||||
config = function(_, opts)
|
||||
local function on_move(data)
|
||||
Util.lsp.on_rename(data.source, data.destination)
|
||||
Util.on_rename(data.source, data.destination)
|
||||
end
|
||||
|
||||
local events = require("neo-tree.events")
|
||||
@ -150,20 +150,42 @@ return {
|
||||
{ "<leader>uC", Util.telescope("colorscheme", { enable_preview = true }), desc = "Colorscheme with preview" },
|
||||
{
|
||||
"<leader>ss",
|
||||
function()
|
||||
require("telescope.builtin").lsp_document_symbols({
|
||||
symbols = require("lazyvim.config").get_kind_filter(),
|
||||
})
|
||||
end,
|
||||
Util.telescope("lsp_document_symbols", {
|
||||
symbols = {
|
||||
"Class",
|
||||
"Function",
|
||||
"Method",
|
||||
"Constructor",
|
||||
"Interface",
|
||||
"Module",
|
||||
"Struct",
|
||||
"Trait",
|
||||
"Field",
|
||||
"Property",
|
||||
"Enum",
|
||||
"Constant",
|
||||
},
|
||||
}),
|
||||
desc = "Goto Symbol",
|
||||
},
|
||||
{
|
||||
"<leader>sS",
|
||||
function()
|
||||
require("telescope.builtin").lsp_dynamic_workspace_symbols({
|
||||
symbols = require("lazyvim.config").get_kind_filter(),
|
||||
})
|
||||
end,
|
||||
Util.telescope("lsp_dynamic_workspace_symbols", {
|
||||
symbols = {
|
||||
"Class",
|
||||
"Function",
|
||||
"Method",
|
||||
"Constructor",
|
||||
"Interface",
|
||||
"Module",
|
||||
"Struct",
|
||||
"Trait",
|
||||
"Field",
|
||||
"Property",
|
||||
"Enum",
|
||||
"Constant",
|
||||
},
|
||||
}),
|
||||
desc = "Goto Symbol (Workspace)",
|
||||
},
|
||||
},
|
||||
@ -248,7 +270,7 @@ return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
if not Util.has("flash.nvim") then
|
||||
if not require("lazyvim.util").has("flash.nvim") then
|
||||
return
|
||||
end
|
||||
local function flash(prompt_bufnr)
|
||||
|
@ -49,9 +49,9 @@ return {
|
||||
|
||||
local Util = require("lazyvim.util")
|
||||
local colors = {
|
||||
ok = Util.ui.fg("Special"),
|
||||
error = Util.ui.fg("DiagnosticError"),
|
||||
pending = Util.ui.fg("DiagnosticWarn"),
|
||||
ok = Util.fg("Special"),
|
||||
error = Util.fg("DiagnosticError"),
|
||||
pending = Util.fg("DiagnosticWarn"),
|
||||
}
|
||||
table.insert(opts.sections.lualine_x, 2, {
|
||||
function()
|
||||
|
@ -21,10 +21,10 @@ return {
|
||||
opts = function(_, opts)
|
||||
local Util = require("lazyvim.util")
|
||||
local colors = {
|
||||
[""] = Util.ui.fg("Special"),
|
||||
["Normal"] = Util.ui.fg("Special"),
|
||||
["Warning"] = Util.ui.fg("DiagnosticError"),
|
||||
["InProgress"] = Util.ui.fg("DiagnosticWarn"),
|
||||
[""] = Util.fg("Special"),
|
||||
["Normal"] = Util.fg("Special"),
|
||||
["Warning"] = Util.fg("DiagnosticError"),
|
||||
["InProgress"] = Util.fg("DiagnosticWarn"),
|
||||
}
|
||||
table.insert(opts.sections.lualine_x, 2, {
|
||||
function()
|
||||
@ -36,7 +36,7 @@ return {
|
||||
if not package.loaded["copilot"] then
|
||||
return
|
||||
end
|
||||
local ok, clients = pcall(require("lazyvim.util").lsp.get_clients, { name = "copilot", bufnr = 0 })
|
||||
local ok, clients = pcall(require("lazyvim.util").get_clients, { name = "copilot", bufnr = 0 })
|
||||
if not ok then
|
||||
return false
|
||||
end
|
||||
@ -66,7 +66,7 @@ return {
|
||||
copilot_cmp.setup(opts)
|
||||
-- attach cmp source whenever copilot attaches
|
||||
-- fixes lazy-loading issues with the copilot cmp source
|
||||
require("lazyvim.util").lsp.on_attach(function(client)
|
||||
require("lazyvim.util").on_attach(function(client)
|
||||
if client.name == "copilot" then
|
||||
copilot_cmp._on_insert_enter({})
|
||||
end
|
||||
|
@ -1,7 +1,6 @@
|
||||
---@param config {args?:string[]|fun():string[]?}
|
||||
local function get_args(config)
|
||||
local args = type(config.args) == "function" and (config.args() or {}) or config.args or {}
|
||||
config = vim.deepcopy(config)
|
||||
---@cast args string[]
|
||||
config.args = function()
|
||||
local new_args = vim.fn.input("Run with args: ", table.concat(args, " ")) --[[@as string]]
|
||||
@ -55,6 +54,7 @@ return {
|
||||
opts = {
|
||||
defaults = {
|
||||
["<leader>d"] = { name = "+debug" },
|
||||
["<leader>da"] = { name = "+adapters" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1,40 +1,24 @@
|
||||
return {
|
||||
"mfussenegger/nvim-dap",
|
||||
|
||||
dependencies = {
|
||||
{
|
||||
"jbyuki/one-small-step-for-vimkind",
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "<leader>daL", function() require("osv").launch({ port = 8086 }) end, desc = "Adapter Lua Server", ft = "lua" },
|
||||
{ "<leader>dal", function() require("osv").run_this() end, desc = "Adapter Lua", ft = "lua" },
|
||||
},
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
dap.adapters.nlua = function(callback, conf)
|
||||
local adapter = {
|
||||
type = "server",
|
||||
host = conf.host or "127.0.0.1",
|
||||
port = conf.port or 8086,
|
||||
}
|
||||
if conf.start_neovim then
|
||||
local dap_run = dap.run
|
||||
dap.run = function(c)
|
||||
adapter.port = c.port
|
||||
adapter.host = c.host
|
||||
end
|
||||
require("osv").run_this()
|
||||
dap.run = dap_run
|
||||
end
|
||||
callback(adapter)
|
||||
dap.adapters.nlua = function(callback, config)
|
||||
callback({ type = "server", host = config.host or "127.0.0.1", port = config.port or 8086 })
|
||||
end
|
||||
dap.configurations.lua = {
|
||||
{
|
||||
type = "nlua",
|
||||
request = "attach",
|
||||
name = "Run this file",
|
||||
start_neovim = {},
|
||||
},
|
||||
{
|
||||
type = "nlua",
|
||||
request = "attach",
|
||||
name = "Attach to running Neovim instance (port = 8086)",
|
||||
port = 8086,
|
||||
name = "Attach to running Neovim instance",
|
||||
},
|
||||
}
|
||||
end,
|
||||
|
@ -1,134 +0,0 @@
|
||||
local Config = require("lazyvim.config")
|
||||
local Util = require("lazyvim.util")
|
||||
|
||||
return {
|
||||
{
|
||||
"stevearc/aerial.nvim",
|
||||
event = "LazyFile",
|
||||
opts = function()
|
||||
---@diagnostic disable-next-line: no-unknown
|
||||
local lualine = require("lualine.components.aerial")
|
||||
|
||||
-- Strip trailing spaces from symbols in statusline
|
||||
---@param _ any
|
||||
---@param symbols {icon?:string}[]
|
||||
lualine.format_status = Util.inject.args(lualine.format_status, function(_, symbols)
|
||||
for _, s in ipairs(symbols) do
|
||||
s.icon = s.icon and s.icon:gsub("%s*$", "") or nil
|
||||
end
|
||||
end)
|
||||
|
||||
local icons = vim.deepcopy(Config.icons.kinds)
|
||||
|
||||
-- HACK: fix lua's weird choice for `Package` for control
|
||||
-- structures like if/else/for/etc.
|
||||
icons.lua = { Package = icons.Control }
|
||||
|
||||
---@type table<string, string[]>|false
|
||||
local filter_kind = false
|
||||
if Config.kind_filter then
|
||||
filter_kind = assert(vim.deepcopy(Config.kind_filter))
|
||||
filter_kind._ = filter_kind.default
|
||||
filter_kind.default = nil
|
||||
end
|
||||
|
||||
local opts = {
|
||||
attach_mode = "global",
|
||||
backends = { "lsp", "treesitter", "markdown", "man" },
|
||||
show_guides = true,
|
||||
layout = {
|
||||
resize_to_content = false,
|
||||
win_opts = {
|
||||
winhl = "Normal:NormalFloat,FloatBorder:NormalFloat,SignColumn:SignColumnSB",
|
||||
signcolumn = "yes",
|
||||
statuscolumn = " ",
|
||||
},
|
||||
},
|
||||
icons = icons,
|
||||
filter_kind = filter_kind,
|
||||
-- stylua: ignore
|
||||
guides = {
|
||||
mid_item = "├╴",
|
||||
last_item = "└╴",
|
||||
nested_top = "│ ",
|
||||
whitespace = " ",
|
||||
},
|
||||
}
|
||||
return opts
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>cs", "<cmd>AerialToggle<cr>", desc = "Aerial (Symbols)" },
|
||||
},
|
||||
},
|
||||
|
||||
-- Telescope integration
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
optional = true,
|
||||
opts = function()
|
||||
Util.on_load("telescope.nvim", function()
|
||||
require("telescope").load_extension("aerial")
|
||||
end)
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<leader>ss",
|
||||
"<cmd>Telescope aerial<cr>",
|
||||
desc = "Goto Symbol (Aerial)",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- edgy integration
|
||||
{
|
||||
"folke/edgy.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local edgy_idx = Util.plugin.extra_idx("ui.edgy")
|
||||
local aerial_idx = Util.plugin.extra_idx("editor.aerial")
|
||||
|
||||
if edgy_idx and edgy_idx > aerial_idx then
|
||||
Util.warn("The `edgy.nvim` extra must be **imported** before the `aerial.nvim` extra to work properly.", {
|
||||
title = "LazyVim",
|
||||
})
|
||||
end
|
||||
|
||||
opts.right = opts.right or {}
|
||||
table.insert(opts.right, {
|
||||
title = "Aerial",
|
||||
ft = "aerial",
|
||||
pinned = true,
|
||||
open = "AerialOpen",
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- lualine integration
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sections.lualine_c, {
|
||||
"aerial",
|
||||
-- The separator to be used to separate symbols in status line.
|
||||
sep = " ",
|
||||
|
||||
-- The number of symbols to render top-down. In order to render only 'N' last
|
||||
-- symbols, negative numbers may be supplied. For instance, 'depth = -1' can
|
||||
-- be used in order to render only current symbol.
|
||||
depth = 5,
|
||||
|
||||
-- When 'dense' mode is on, icons are not rendered near their symbols. Only
|
||||
-- a single icon that represents the kind of current symbol is rendered at
|
||||
-- the beginning of status line.
|
||||
dense = false,
|
||||
|
||||
-- The separator to be used to separate symbols in dense mode.
|
||||
dense_sep = ".",
|
||||
|
||||
-- Color the symbol icons.
|
||||
colored = true,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
@ -57,7 +57,7 @@ return {
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "MiniFilesActionRename",
|
||||
callback = function(event)
|
||||
require("lazyvim.util").lsp.on_rename(event.data.from, event.data.to)
|
||||
require("lazyvim.util").on_rename(event.data.from, event.data.to)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
|
@ -1,42 +0,0 @@
|
||||
return {
|
||||
-- lsp symbol navigation for lualine. This shows where
|
||||
-- in the code structure you are - within functions, classes,
|
||||
-- etc - in the statusline.
|
||||
{
|
||||
"SmiteshP/nvim-navic",
|
||||
lazy = true,
|
||||
init = function()
|
||||
vim.g.navic_silence = true
|
||||
require("lazyvim.util").lsp.on_attach(function(client, buffer)
|
||||
if client.supports_method("textDocument/documentSymbol") then
|
||||
require("nvim-navic").attach(client, buffer)
|
||||
end
|
||||
end)
|
||||
end,
|
||||
opts = function()
|
||||
return {
|
||||
separator = " ",
|
||||
highlight = true,
|
||||
depth_limit = 5,
|
||||
icons = require("lazyvim.config").icons.kinds,
|
||||
lazy_update_context = true,
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- lualine integration
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sections.lualine_c, {
|
||||
function()
|
||||
return require("nvim-navic").get_location()
|
||||
end,
|
||||
cond = function()
|
||||
return package.loaded["nvim-navic"] and require("nvim-navic").is_available()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
local Util = require("lazyvim.util")
|
||||
|
||||
return {
|
||||
{
|
||||
"simrat39/symbols-outline.nvim",
|
||||
keys = { { "<leader>cs", "<cmd>SymbolsOutline<cr>", desc = "Symbols Outline" } },
|
||||
cmd = "SymbolsOutline",
|
||||
opts = function()
|
||||
local Config = require("lazyvim.config")
|
||||
local defaults = require("symbols-outline.config").defaults
|
||||
local opts = {
|
||||
symbols = {},
|
||||
symbol_blacklist = {},
|
||||
}
|
||||
|
||||
for kind, symbol in pairs(defaults.symbols) do
|
||||
opts.symbols[kind] = {
|
||||
icon = Config.icons.kinds[kind] or symbol.icon,
|
||||
hl = symbol.hl,
|
||||
}
|
||||
if not vim.tbl_contains(Config.kind_filter.default, kind) then
|
||||
table.insert(opts.symbol_blacklist, kind)
|
||||
end
|
||||
end
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
|
||||
-- edgy integration
|
||||
{
|
||||
"folke/edgy.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local edgy_idx = Util.plugin.extra_idx("ui.edgy")
|
||||
local symbols_idx = Util.plugin.extra_idx("editor.symbols-outline")
|
||||
|
||||
if edgy_idx and edgy_idx > symbols_idx then
|
||||
Util.warn(
|
||||
"The `edgy.nvim` extra must be **imported** before the `symbols-outline.nvim` extra to work properly.",
|
||||
{
|
||||
title = "LazyVim",
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
opts.right = opts.right or {}
|
||||
table.insert(opts.right, {
|
||||
title = "Symbols Outline",
|
||||
ft = "Outline",
|
||||
pinned = true,
|
||||
open = "SymbolsOutline",
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
@ -10,7 +10,6 @@ return {
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
opts.sources = opts.sources or {}
|
||||
table.insert(opts.sources, nls.builtins.formatting.black)
|
||||
end,
|
||||
},
|
||||
|
@ -18,20 +18,9 @@ return {
|
||||
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
|
||||
-- Install the conform formatter on VeryLazy
|
||||
require("lazyvim.util").on_very_lazy(function()
|
||||
require("lazyvim.util").format.register({
|
||||
name = "conform.nvim",
|
||||
priority = 100,
|
||||
primary = true,
|
||||
format = function(buf)
|
||||
require("conform").format({ bufnr = buf })
|
||||
end,
|
||||
sources = function(buf)
|
||||
local ret = require("conform").list_formatters(buf)
|
||||
return vim.tbl_map(function(v)
|
||||
return v.name
|
||||
end, ret)
|
||||
end,
|
||||
})
|
||||
require("lazyvim.plugins.lsp.format").custom_format = function(buf)
|
||||
return require("conform").format({ bufnr = buf })
|
||||
end
|
||||
end)
|
||||
end,
|
||||
opts = {
|
@ -10,7 +10,6 @@ return {
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
opts.sources = opts.sources or {}
|
||||
table.insert(opts.sources, nls.builtins.formatting.prettierd)
|
||||
end,
|
||||
},
|
||||
|
@ -12,7 +12,8 @@ return {
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
opts.sources = vim.list_extend(opts.sources or {}, {
|
||||
opts.sources = opts.sources or {}
|
||||
vim.list_extend(opts.sources, {
|
||||
nls.builtins.diagnostics.cmake_lint,
|
||||
})
|
||||
end,
|
||||
|
@ -19,7 +19,8 @@ return {
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
opts.sources = vim.list_extend(opts.sources or {}, {
|
||||
opts.sources = opts.sources or {}
|
||||
vim.list_extend(opts.sources, {
|
||||
nls.builtins.diagnostics.hadolint,
|
||||
})
|
||||
end,
|
||||
|
@ -37,7 +37,8 @@ return {
|
||||
return
|
||||
end
|
||||
local nls = require("null-ls")
|
||||
opts.sources = vim.list_extend(opts.sources or {}, {
|
||||
opts.sources = opts.sources or {}
|
||||
vim.list_extend(opts.sources, {
|
||||
nls.builtins.diagnostics.credo,
|
||||
})
|
||||
end,
|
||||
|
@ -61,7 +61,7 @@ return {
|
||||
gopls = function(_, opts)
|
||||
-- workaround for gopls not supporting semanticTokensProvider
|
||||
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242
|
||||
require("lazyvim.util").lsp.on_attach(function(client, _)
|
||||
require("lazyvim.util").on_attach(function(client, _)
|
||||
if client.name == "gopls" then
|
||||
if not client.server_capabilities.semanticTokensProvider then
|
||||
local semantic = client.config.capabilities.textDocument.semanticTokens
|
||||
@ -86,12 +86,14 @@ return {
|
||||
"nvimtools/none-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
opts.sources = vim.list_extend(opts.sources or {}, {
|
||||
nls.builtins.code_actions.gomodifytags,
|
||||
nls.builtins.code_actions.impl,
|
||||
nls.builtins.formatting.goimports,
|
||||
})
|
||||
if type(opts.sources) == "table" then
|
||||
local nls = require("null-ls")
|
||||
vim.list_extend(opts.sources, {
|
||||
nls.builtins.code_actions.gomodifytags,
|
||||
nls.builtins.code_actions.impl,
|
||||
nls.builtins.formatting.goimports,
|
||||
})
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
|
@ -13,7 +13,6 @@ return {
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
opts.sources = opts.sources or {}
|
||||
table.insert(opts.sources, nls.builtins.formatting.csharpier)
|
||||
end,
|
||||
},
|
||||
|
@ -16,7 +16,7 @@ return {
|
||||
},
|
||||
setup = {
|
||||
ruff_lsp = function()
|
||||
require("lazyvim.util").lsp.on_attach(function(client, _)
|
||||
require("lazyvim.util").on_attach(function(client, _)
|
||||
if client.name == "ruff_lsp" then
|
||||
-- Disable hover in favor of Pyright
|
||||
client.server_capabilities.hoverProvider = false
|
||||
|
@ -28,11 +28,13 @@ return {
|
||||
"nvimtools/none-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local null_ls = require("null-ls")
|
||||
opts.sources = vim.list_extend(opts.sources or {}, {
|
||||
null_ls.builtins.formatting.terraform_fmt,
|
||||
null_ls.builtins.diagnostics.terraform_validate,
|
||||
})
|
||||
if type(opts.sources) == "table" then
|
||||
local null_ls = require("null-ls")
|
||||
vim.list_extend(opts.sources, {
|
||||
null_ls.builtins.formatting.terraform_fmt,
|
||||
null_ls.builtins.diagnostics.terraform_validate,
|
||||
})
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ return {
|
||||
yamlls = function()
|
||||
-- Neovim < 0.10 does not have dynamic registration for formatting
|
||||
if vim.fn.has("nvim-0.10") == 0 then
|
||||
require("lazyvim.util").lsp.on_attach(function(client, _)
|
||||
require("lazyvim.util").on_attach(function(client, _)
|
||||
if client.name == "yamlls" then
|
||||
client.server_capabilities.documentFormattingProvider = true
|
||||
end
|
||||
|
@ -14,37 +14,22 @@ return {
|
||||
},
|
||||
setup = {
|
||||
eslint = function()
|
||||
local function get_client(buf)
|
||||
return require("lazyvim.util").lsp.get_clients({ name = "eslint", bufnr = buf })[1]
|
||||
end
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
callback = function(event)
|
||||
if not require("lazyvim.plugins.lsp.format").enabled() then
|
||||
-- exit early if autoformat is not enabled
|
||||
return
|
||||
end
|
||||
|
||||
local formatter = require("lazyvim.util").lsp.formatter({
|
||||
name = "eslint: lsp",
|
||||
primary = false,
|
||||
priority = 200,
|
||||
filter = "eslint",
|
||||
})
|
||||
|
||||
-- Use EslintFixAll on Neovim < 0.10.0
|
||||
if not pcall(require, "vim.lsp._dynamic") then
|
||||
formatter.name = "eslint: EslintFixAll"
|
||||
formatter.sources = function(buf)
|
||||
local client = get_client(buf)
|
||||
return client and { "eslint" } or {}
|
||||
end
|
||||
formatter.format = function(buf)
|
||||
local client = get_client(buf)
|
||||
local client = require("lazyvim.util").get_clients({ bufnr = event.buf, name = "eslint" })[1]
|
||||
if client then
|
||||
local diag = vim.diagnostic.get(buf, { namespace = vim.lsp.diagnostic.get_namespace(client.id) })
|
||||
local diag = vim.diagnostic.get(event.buf, { namespace = vim.lsp.diagnostic.get_namespace(client.id) })
|
||||
if #diag > 0 then
|
||||
vim.cmd("EslintFixAll")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- register the formatter with LazyVim
|
||||
require("lazyvim.util").format.register(formatter)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
@ -1,45 +0,0 @@
|
||||
local Util = require("lazyvim.util")
|
||||
|
||||
return {
|
||||
-- none-ls
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
event = "LazyFile",
|
||||
dependencies = { "mason.nvim" },
|
||||
init = function()
|
||||
Util.on_very_lazy(function()
|
||||
-- register the formatter with LazyVim
|
||||
require("lazyvim.util").format.register({
|
||||
name = "none-ls.nvim",
|
||||
priority = 200, -- set higher than conform, the builtin formatter
|
||||
primary = true,
|
||||
format = function(buf)
|
||||
return Util.lsp.format({
|
||||
bufnr = buf,
|
||||
filter = function(client)
|
||||
return client.name == "null-ls"
|
||||
end,
|
||||
})
|
||||
end,
|
||||
sources = function(buf)
|
||||
local ret = require("null-ls.sources").get_available(vim.bo[buf].filetype, "NULL_LS_FORMATTING") or {}
|
||||
return vim.tbl_map(function(source)
|
||||
return source.name
|
||||
end, ret)
|
||||
end,
|
||||
})
|
||||
end)
|
||||
end,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
opts.root_dir = opts.root_dir
|
||||
or require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git")
|
||||
opts.sources = vim.list_extend(opts.sources or {}, {
|
||||
nls.builtins.formatting.fish_indent,
|
||||
nls.builtins.diagnostics.fish,
|
||||
nls.builtins.formatting.stylua,
|
||||
nls.builtins.formatting.shfmt,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
return {
|
||||
|
||||
{ "glepnir/dashboard-nvim", enabled = false },
|
||||
{ "echasnovski/mini.starter", enabled = false },
|
||||
-- Dashboard. This runs when neovim starts, and is what displays
|
||||
-- the "LAZYVIM" banner.
|
||||
{
|
||||
"goolord/alpha-nvim",
|
||||
event = "VimEnter",
|
||||
enabled = true,
|
||||
init = false,
|
||||
opts = function()
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
local logo = [[
|
||||
██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
|
||||
██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
|
||||
██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z
|
||||
██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z
|
||||
███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
]]
|
||||
|
||||
dashboard.section.header.val = vim.split(logo, "\n")
|
||||
-- stylua: ignore
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("f", " " .. " Find file", "<cmd> Telescope find_files <cr>"),
|
||||
dashboard.button("n", " " .. " New file", "<cmd> ene <BAR> startinsert <cr>"),
|
||||
dashboard.button("r", " " .. " Recent files", "<cmd> Telescope oldfiles <cr>"),
|
||||
dashboard.button("g", " " .. " Find text", "<cmd> Telescope live_grep <cr>"),
|
||||
dashboard.button("c", " " .. " Config", "<cmd> e $MYVIMRC <cr>"),
|
||||
dashboard.button("s", " " .. " Restore Session", [[<cmd> lua require("persistence").load() <cr>]]),
|
||||
dashboard.button("e", " " .. " Lazy Extras", "<cmd> LazyExtras <cr>"),
|
||||
dashboard.button("l", " " .. " Lazy", "<cmd> Lazy <cr>"),
|
||||
dashboard.button("q", " " .. " Quit", "<cmd> qa <cr>"),
|
||||
}
|
||||
for _, button in ipairs(dashboard.section.buttons.val) do
|
||||
button.opts.hl = "AlphaButtons"
|
||||
button.opts.hl_shortcut = "AlphaShortcut"
|
||||
end
|
||||
dashboard.section.header.opts.hl = "AlphaHeader"
|
||||
dashboard.section.buttons.opts.hl = "AlphaButtons"
|
||||
dashboard.section.footer.opts.hl = "AlphaFooter"
|
||||
dashboard.opts.layout[1].val = 8
|
||||
return dashboard
|
||||
end,
|
||||
config = function(_, dashboard)
|
||||
-- close Lazy and re-open when the dashboard is ready
|
||||
if vim.o.filetype == "lazy" then
|
||||
vim.cmd.close()
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
once = true,
|
||||
pattern = "AlphaReady",
|
||||
callback = function()
|
||||
require("lazy").show()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
require("alpha").setup(dashboard.opts)
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
once = true,
|
||||
pattern = "LazyVimStarted",
|
||||
callback = function()
|
||||
local stats = require("lazy").stats()
|
||||
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
|
||||
dashboard.section.footer.val = "⚡ Neovim loaded "
|
||||
.. stats.loaded
|
||||
.. "/"
|
||||
.. stats.count
|
||||
.. " plugins in "
|
||||
.. ms
|
||||
.. "ms"
|
||||
pcall(vim.cmd.AlphaRedraw)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
64
lua/lazyvim/plugins/extras/ui/dashboard.lua
Normal file
64
lua/lazyvim/plugins/extras/ui/dashboard.lua
Normal file
@ -0,0 +1,64 @@
|
||||
return {
|
||||
{ "goolord/alpha-nvim", enabled = false },
|
||||
{ "echasnovski/mini.starter", enabled = false },
|
||||
{
|
||||
"glepnir/dashboard-nvim",
|
||||
event = "VimEnter",
|
||||
opts = function()
|
||||
local logo = [[
|
||||
██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
|
||||
██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
|
||||
██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z
|
||||
██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z
|
||||
███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
]]
|
||||
|
||||
logo = string.rep("\n", 8) .. logo .. "\n\n"
|
||||
|
||||
local opts = {
|
||||
theme = "doom",
|
||||
hide = {
|
||||
-- this is taken care of by lualine
|
||||
-- enabling this messes up the actual laststatus setting after loading a file
|
||||
statusline = false,
|
||||
},
|
||||
config = {
|
||||
header = vim.split(logo, "\n"),
|
||||
center = {
|
||||
{ action = "Telescope find_files", desc = " Find file", icon = " ", key = "f" },
|
||||
{ action = "ene | startinsert", desc = " New file", icon = " ", key = "n" },
|
||||
{ action = "Telescope oldfiles", desc = " Recent files", icon = " ", key = "r" },
|
||||
{ action = "Telescope live_grep", desc = " Find text", icon = " ", key = "g" },
|
||||
{ action = "e $MYVIMRC", desc = " Config", icon = " ", key = "c" },
|
||||
{ action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" },
|
||||
{ action = "Lazy", desc = " Lazy", icon = " ", key = "l" },
|
||||
{ action = "qa", desc = " Quit", icon = " ", key = "q" },
|
||||
},
|
||||
footer = function()
|
||||
local stats = require("lazy").stats()
|
||||
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
|
||||
return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" }
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
for _, button in ipairs(opts.config.center) do
|
||||
button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
|
||||
end
|
||||
|
||||
-- close Lazy and re-open when the dashboard is ready
|
||||
if vim.o.filetype == "lazy" then
|
||||
vim.cmd.close()
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "DashboardLoaded",
|
||||
callback = function()
|
||||
require("lazy").show()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user