Compare commits

..

40 Commits

Author SHA1 Message Date
6b4c872f2d chore(main): release 9.2.0 (#1600)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-06 15:53:13 +02:00
6e0e01f5b4 fix(config): fixed issues related to LazyFile. Fixes #1601 2023-10-06 15:40:27 +02:00
a1c5886947 feat(conform): ignore formatting errors for injected languages and fix condition example 2023-10-06 09:26:14 +02:00
8a1de2b90a fix(elixir): only enable credo when installed. Fixes #1546 2023-10-06 09:18:07 +02:00
3823f177e9 chore(build): auto-generate vimdoc 2023-10-06 07:03:24 +00:00
f1ea518e29 fix(which-key): change surround group key (#1598) 2023-10-06 09:02:45 +02:00
cce46cd640 chore(main): release 9.1.1 (#1597)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-06 01:02:16 +02:00
337cfdbec4 fix(ui): include extmark signs in signcolumn. Fixes #1596 2023-10-05 23:34:32 +02:00
b2af941290 ci: disable blank issues 2023-10-05 16:33:01 +02:00
f219364656 chore(main): release 9.1.0 (#1592)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-05 16:03:46 +02:00
6f1cdfe4bd feat(dashboard): add projects if enabled (#1595) 2023-10-05 15:59:44 +02:00
1eb019274b fix(options): set default laststatus=3 and set it to 0 before loading dashboard to prevent flickering 2023-10-05 10:43:21 +02:00
d6b56c075e fix(dasboard): disable alpha only once 2023-10-05 09:53:50 +02:00
6f6d587998 chore(build): auto-generate vimdoc 2023-10-05 06:08:38 +00:00
d3e7f7717e fix(tailwind): allow overriding filetypes. Fixes #1590 2023-10-05 08:07:56 +02:00
49b91b6b1f chore(main): release 9.0.2 (#1589)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-04 21:10:17 +02:00
86de423ef0 fix(treesitter): dont enable ]c, [c, ... in diff-mode 2023-10-04 21:00:32 +02:00
0cc80b1b05 fix(autocmds): last_loc autocmd didn't work correctly for first opened file 2023-10-04 20:40:11 +02:00
7272b3e4b5 fix(bufferline): load bufferline on VeryLazy. Fixes #1587 2023-10-04 20:04:56 +02:00
b58446f7b3 chore(main): release 9.0.1 (#1585)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-04 18:09:31 +02:00
d989ecc943 fix(options): only enable treesitter foldexpr on nightly. Fixes #1581 2023-10-04 18:07:21 +02:00
3849e0150b fix(ui): show global marks in the correct buffer only 2023-10-04 17:53:00 +02:00
1abcffbfd9 fix(alpha): use <cmd> instead of : for shortcuts 2023-10-04 16:44:29 +02:00
c490c61d07 chore(main): release 9.0.0 (#1576)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-04 15:03:00 +02:00
79010ae671 fix(nvim-lint): dont try merging function linters 2023-10-04 14:45:45 +02:00
f4750859f2 fix(conform): dont try merging function formatters. Fixes #1582 2023-10-04 14:44:24 +02:00
9f034ab106 fix(conform): dont try to merge formatter functions 2023-10-04 14:41:00 +02:00
2f16a7b2d9 perf(config): add LazyVim to the rtp early for faster spec loading 2023-10-04 13:44:03 +02:00
3833a7d1ce style: removed dead code 2023-10-04 13:19:12 +02:00
bd2ac542a0 feat(ui): show alpha marks in statuscolumn 2023-10-04 12:48:37 +02:00
35053290bf fix(ui): use custom fold when treesitter foldtext returns a string 2023-10-04 12:47:24 +02:00
417de0193d feat(extras): added extra for dashboard.nvim 2023-10-04 12:44:01 +02:00
a12d4bd4e4 chore(build): auto-generate vimdoc 2023-10-04 08:49:22 +00:00
afc8e7f8ca fix(autocmds): retore last location for correct buffer 2023-10-04 10:48:20 +02:00
936d74bb61 perf: added support for LazyFile event that properly loads file based plugins without blocking the ui 2023-10-04 10:45:10 +02:00
f15dd301e5 style: fixed lua annotations 2023-10-04 10:43:44 +02:00
d28c69e49e feat(mini.surround)!: default surround mappings are now gs instead of gz (unless you enabled the leap extra) 2023-10-04 00:25:44 +02:00
0e66ef8393 feat(treesitter): added ]f, [f, ]F, [F, ]c, ]C, [c, [C for treesitter-textobjects 2023-10-04 00:21:47 +02:00
626ae1338a feat(typescript): add typescriptreact/javascriptreact to types (#1574)
* feat(typescript): add typescriptreact/javascriptreact to types

* remove unneeded values

* revert settings change
2023-10-03 23:40:32 +02:00
5f0713d2b6 feat(treesitter): map vim to @namespace.builtin 2023-10-03 20:17:33 +02:00
25 changed files with 407 additions and 85 deletions

1
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1 @@
blank_issues_enabled: false

View File

@ -1,5 +1,89 @@
# Changelog
## [9.2.0](https://github.com/LazyVim/LazyVim/compare/v9.1.1...v9.2.0) (2023-10-06)
### Features
* **conform:** ignore formatting errors for injected languages and fix condition example ([a1c5886](https://github.com/LazyVim/LazyVim/commit/a1c5886947e20059ad7802e71e0a82b413af6657))
### Bug Fixes
* **config:** fixed issues related to LazyFile. Fixes [#1601](https://github.com/LazyVim/LazyVim/issues/1601) ([6e0e01f](https://github.com/LazyVim/LazyVim/commit/6e0e01f5b4dd7e97abbb50241a207d36d0ce9cd5))
* **elixir:** only enable credo when installed. Fixes [#1546](https://github.com/LazyVim/LazyVim/issues/1546) ([8a1de2b](https://github.com/LazyVim/LazyVim/commit/8a1de2b90a699bdfee704f3d4422e2ced18ae0f3))
* **which-key:** change surround group key ([#1598](https://github.com/LazyVim/LazyVim/issues/1598)) ([f1ea518](https://github.com/LazyVim/LazyVim/commit/f1ea518e29a601b773d9c9c94489fc9d273c2dea))
## [9.1.1](https://github.com/LazyVim/LazyVim/compare/v9.1.0...v9.1.1) (2023-10-05)
### Bug Fixes
* **ui:** include extmark signs in signcolumn. Fixes [#1596](https://github.com/LazyVim/LazyVim/issues/1596) ([337cfdb](https://github.com/LazyVim/LazyVim/commit/337cfdbec43003cb2c269e59b27167aa752bf41f))
## [9.1.0](https://github.com/LazyVim/LazyVim/compare/v9.0.2...v9.1.0) (2023-10-05)
### Features
* **dashboard:** add projects if enabled ([#1595](https://github.com/LazyVim/LazyVim/issues/1595)) ([6f1cdfe](https://github.com/LazyVim/LazyVim/commit/6f1cdfe4bd2ec9a85c92a312fa52ba86e02d1a9f))
### Bug Fixes
* **dasboard:** disable alpha only once ([d6b56c0](https://github.com/LazyVim/LazyVim/commit/d6b56c075e88ce12e9e16fb2eeeea38fb7853600))
* **options:** set default laststatus=3 and set it to 0 before loading dashboard to prevent flickering ([1eb0192](https://github.com/LazyVim/LazyVim/commit/1eb019274b5564e66ac6c7e119c140bae262e10c))
* **tailwind:** allow overriding filetypes. Fixes [#1590](https://github.com/LazyVim/LazyVim/issues/1590) ([d3e7f77](https://github.com/LazyVim/LazyVim/commit/d3e7f7717e960bb883b35e9a75badfd5b938cace))
## [9.0.2](https://github.com/LazyVim/LazyVim/compare/v9.0.1...v9.0.2) (2023-10-04)
### Bug Fixes
* **autocmds:** last_loc autocmd didn't work correctly for first opened file ([0cc80b1](https://github.com/LazyVim/LazyVim/commit/0cc80b1b0594516ccc2c1e6c9a60c84012a29abb))
* **bufferline:** load bufferline on VeryLazy. Fixes [#1587](https://github.com/LazyVim/LazyVim/issues/1587) ([7272b3e](https://github.com/LazyVim/LazyVim/commit/7272b3e4b5b626597658dabf774998057892d066))
* **treesitter:** dont enable ]c, [c, ... in diff-mode ([86de423](https://github.com/LazyVim/LazyVim/commit/86de423ef029abd085531e18b197a5f90e201d98))
## [9.0.1](https://github.com/LazyVim/LazyVim/compare/v9.0.0...v9.0.1) (2023-10-04)
### Bug Fixes
* **alpha:** use `&lt;cmd&gt;` instead of `:` for shortcuts ([1abcffb](https://github.com/LazyVim/LazyVim/commit/1abcffbfd940588fa67cc7438ce2115df1c58e92))
* **options:** only enable treesitter `foldexpr` on nightly. Fixes [#1581](https://github.com/LazyVim/LazyVim/issues/1581) ([d989ecc](https://github.com/LazyVim/LazyVim/commit/d989ecc943b3240db0be3aa0369b96089cee4b40))
* **ui:** show global marks in the correct buffer only ([3849e01](https://github.com/LazyVim/LazyVim/commit/3849e0150b0a616dbd6e7e12ec5025aff6c81d39))
## [9.0.0](https://github.com/LazyVim/LazyVim/compare/v8.4.4...v9.0.0) (2023-10-04)
### ⚠ BREAKING CHANGES
* **mini.surround:** default surround mappings are now gs instead of gz (unless you enabled the leap extra)
### Features
* **extras:** added extra for dashboard.nvim ([417de01](https://github.com/LazyVim/LazyVim/commit/417de0193dd0663100a8b1eaedc2bc4976712c61))
* **mini.surround:** default surround mappings are now gs instead of gz (unless you enabled the leap extra) ([d28c69e](https://github.com/LazyVim/LazyVim/commit/d28c69e49eab62b45f7d1562b3bc00afee5fbb65))
* **treesitter:** added ]f, [f, ]F, [F, ]c, ]C, [c, [C for treesitter-textobjects ([0e66ef8](https://github.com/LazyVim/LazyVim/commit/0e66ef83934eb62ee2237e331dcbc0a22b809aae))
* **treesitter:** map `vim` to `[@namespace](https://github.com/namespace).builtin` ([5f0713d](https://github.com/LazyVim/LazyVim/commit/5f0713d2b612a814586bffec39700ab6a30dc0ea))
* **typescript:** add typescriptreact/javascriptreact to types ([#1574](https://github.com/LazyVim/LazyVim/issues/1574)) ([626ae13](https://github.com/LazyVim/LazyVim/commit/626ae1338a88f6cd8962d6c20bd79953a67f0b72))
* **ui:** show alpha marks in statuscolumn ([bd2ac54](https://github.com/LazyVim/LazyVim/commit/bd2ac542a0bb4c58237cd6ca8848063bd20a5282))
### Bug Fixes
* **autocmds:** retore last location for correct buffer ([afc8e7f](https://github.com/LazyVim/LazyVim/commit/afc8e7f8cac06335efd12ec5f71cabb1f38a09b0))
* **conform:** dont try merging function formatters. Fixes [#1582](https://github.com/LazyVim/LazyVim/issues/1582) ([f475085](https://github.com/LazyVim/LazyVim/commit/f4750859f2c2c9a41b3974ac05962ce9648d6c16))
* **conform:** dont try to merge formatter functions ([9f034ab](https://github.com/LazyVim/LazyVim/commit/9f034ab10650e306e178d5189ee9214a52f2e8e5))
* **nvim-lint:** dont try merging function linters ([79010ae](https://github.com/LazyVim/LazyVim/commit/79010ae671035d8ed0040ce51df4fb59ec3962f8))
* **ui:** use custom fold when treesitter foldtext returns a string ([3505329](https://github.com/LazyVim/LazyVim/commit/35053290bf957a230c8758d31ba3997c0699f5f9))
### Performance Improvements
* added support for `LazyFile` event that properly loads file based plugins without blocking the ui ([936d74b](https://github.com/LazyVim/LazyVim/commit/936d74bb6127721eeefa62e5f697d9693ab04fdd))
* **config:** add LazyVim to the rtp early for faster spec loading ([2f16a7b](https://github.com/LazyVim/LazyVim/commit/2f16a7b2d96e912c9ab50ce99d9994413ff3678d))
## [8.4.4](https://github.com/LazyVim/LazyVim/compare/v8.4.3...v8.4.4) (2023-10-03)

View File

@ -1,4 +1,4 @@
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 03
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 06
==============================================================================
Table of Contents *LazyVim-table-of-contents*

View File

@ -31,9 +31,9 @@ vim.api.nvim_create_autocmd({ "VimResized" }, {
-- go to last loc when opening a buffer
vim.api.nvim_create_autocmd("BufReadPost", {
group = augroup("last_loc"),
callback = function()
callback = function(event)
local exclude = { "gitcommit" }
local buf = vim.api.nvim_get_current_buf()
local buf = event.buf
if vim.tbl_contains(exclude, vim.bo[buf].filetype) then
return
end

View File

@ -1,9 +1,10 @@
---@type LazyVimConfig
---@class LazyVimConfig: LazyVimOptions
local M = {}
M.lazy_version = ">=9.1.0"
M.use_lazy_file = true
---@class LazyVimConfig
---@class LazyVimOptions
local defaults = {
-- colorscheme can be a string like `catppuccin` or a function that will load the colorscheme
---@type string|fun()
@ -86,12 +87,12 @@ M.renames = {
["null-ls.nvim"] = "none-ls.nvim",
}
---@type LazyVimConfig
---@type LazyVimOptions
local options
---@param opts? LazyVimConfig
---@param opts? LazyVimOptions
function M.setup(opts)
options = vim.tbl_deep_extend("force", defaults, opts or {})
options = vim.tbl_deep_extend("force", defaults, opts or {}) or {}
if vim.fn.has("nvim-0.9.0") == 0 then
vim.api.nvim_echo({
@ -124,8 +125,9 @@ function M.setup(opts)
M.load("autocmds")
end
local group = vim.api.nvim_create_augroup("LazyVim", { clear = true })
vim.api.nvim_create_autocmd("User", {
group = vim.api.nvim_create_augroup("LazyVim", { clear = true }),
group = group,
pattern = "VeryLazy",
callback = function()
if lazy_autocmds then
@ -135,6 +137,11 @@ function M.setup(opts)
end,
})
M.use_lazy_file = M.use_lazy_file and require("lazy.core.handler.event").trigger_events == nil
if M.use_lazy_file then
M.lazy_file()
end
require("lazy.core.util").try(function()
if type(M.colorscheme) == "function" then
M.colorscheme()
@ -150,6 +157,60 @@ function M.setup(opts)
})
end
-- Properly load file based plugins without blocking the UI
function M.lazy_file()
local events = {} ---@type {event: string, buf: number, data?: any}[]
local function load()
if #events == 0 then
return
end
local Event = require("lazy.core.handler.event")
local Util = require("lazy.core.util")
vim.api.nvim_del_augroup_by_name("lazy_file")
Util.track({ event = "LazyFile" })
---@type table<string,string[]>
local skips = { FileType = Event.get_augroups("FileType") }
for _, event in ipairs(events) do
skips[event.event] = skips[event.event] or Event.get_augroups(event.event)
end
vim.api.nvim_exec_autocmds("User", { pattern = "LazyFile", modeline = false })
for _, event in ipairs(events) do
Event.trigger({
event = event.event,
exclude = skips[event.event],
data = event.data,
buf = event.buf,
})
if vim.bo[event.buf].filetype then
Event.trigger({
event = "FileType",
exclude = skips.FileType,
buf = event.buf,
})
end
end
vim.api.nvim_exec_autocmds("CursorMoved", { modeline = false })
events = {}
Util.track()
end
-- schedule wrap so that nested autocmds are executed
-- and the UI can continue rendering without blocking
load = vim.schedule_wrap(load)
vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
group = vim.api.nvim_create_augroup("lazy_file", { clear = true }),
callback = function(event)
table.insert(events, event)
load()
end,
})
end
---@param range? string
function M.has(range)
local Semver = require("lazy.manage.semver")
@ -190,6 +251,7 @@ M.did_init = false
function M.init()
if not M.did_init then
M.did_init = true
vim.opt.rtp:append(require("lazy.core.config").spec.plugins.LazyVim.dir)
-- delay notifications till vim.notify was replaced or after 500ms
require("lazyvim.util").lazy_notify()
@ -199,6 +261,7 @@ function M.init()
require("lazyvim.config").load("options")
local Plugin = require("lazy.core.plugin")
local add = Plugin.Spec.add
---@diagnostic disable-next-line: duplicate-set-field
Plugin.Spec.add = function(self, plugin, ...)
if type(plugin) == "table" and M.renames[plugin[1]] then
require("lazy.core.util").warn(
@ -211,8 +274,19 @@ function M.init()
)
plugin[1] = M.renames[plugin[1]]
end
if not M.use_lazy_file and type(plugin) == "table" and plugin.event == "LazyFile" then
plugin.event = { "BufReadPost", "BufNewFile" }
end
return add(self, plugin, ...)
end
-- Add support for the LazyFile event
local Event = require("lazy.core.handler.event")
local _event = Event._event
---@diagnostic disable-next-line: duplicate-set-field
Event._event = function(self, value)
return value == "LazyFile" and "User LazyFile" or _event(self, value)
end
end
end

View File

@ -16,7 +16,7 @@ opt.grepformat = "%f:%l:%c:%m"
opt.grepprg = "rg --vimgrep"
opt.ignorecase = true -- Ignore case
opt.inccommand = "nosplit" -- preview incremental substitute
opt.laststatus = 0
opt.laststatus = 3 -- global statusline
opt.list = true -- Show some invisible characters (tabs...
opt.mouse = "a" -- Enable mouse mode
opt.number = true -- Print line number
@ -65,9 +65,13 @@ vim.opt.foldlevel = 99
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()]]
end
-- HACK: causes freezes on <= 0.9, so only enable on >= 0.10 for now
if vim.fn.has("nvim-0.10") == 1 then
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]]
else
vim.opt.foldmethod = "indent"
end

View File

@ -140,13 +140,13 @@ return {
end,
opts = {
mappings = {
add = "gza", -- Add surrounding in Normal and Visual modes
delete = "gzd", -- Delete surrounding
find = "gzf", -- Find surrounding (to the right)
find_left = "gzF", -- Find surrounding (to the left)
highlight = "gzh", -- Highlight surrounding
replace = "gzr", -- Replace surrounding
update_n_lines = "gzn", -- Update `n_lines`
add = "gsa", -- Add surrounding in Normal and Visual modes
delete = "gsd", -- Delete surrounding
find = "gsf", -- Find surrounding (to the right)
find_left = "gsF", -- Find surrounding (to the left)
highlight = "gsh", -- Highlight surrounding
replace = "gsr", -- Replace surrounding
update_n_lines = "gsn", -- Update `n_lines`
},
},
},
@ -179,7 +179,6 @@ return {
-- { "i", mode = { "x", "o" } },
-- },
event = "VeryLazy",
dependencies = { "nvim-treesitter-textobjects" },
opts = function()
local ai = require("mini.ai")
return {

View File

@ -282,7 +282,7 @@ return {
defaults = {
mode = { "n", "v" },
["g"] = { name = "+goto" },
["gz"] = { name = "+surround" },
["gs"] = { name = "+surround" },
["]"] = { name = "+next" },
["["] = { name = "+prev" },
["<leader><tab>"] = { name = "+tabs" },
@ -310,7 +310,7 @@ return {
-- hunks in a commit.
{
"lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" },
event = "LazyFile",
opts = {
signs = {
add = { text = "" },
@ -349,7 +349,7 @@ return {
-- instances.
{
"RRethy/vim-illuminate",
event = { "BufReadPost", "BufNewFile" },
event = "LazyFile",
opts = {
delay = 200,
large_file_cutoff = 2000,
@ -440,7 +440,7 @@ return {
{
"folke/todo-comments.nvim",
cmd = { "TodoTrouble", "TodoTelescope" },
event = { "BufReadPost", "BufNewFile" },
event = "LazyFile",
config = true,
-- stylua: ignore
keys = {

View File

@ -35,6 +35,22 @@ return {
end,
},
-- rename surround mappings from gs to gz to prevent conflict with leap
{
"echasnovski/mini.surround",
opts = {
mappings = {
add = "gza", -- Add surrounding in Normal and Visual modes
delete = "gzd", -- Delete surrounding
find = "gzf", -- Find surrounding (to the right)
find_left = "gzF", -- Find surrounding (to the left)
highlight = "gzh", -- Highlight surrounding
replace = "gzr", -- Replace surrounding
update_n_lines = "gzn", -- Update `n_lines`
},
},
},
-- makes some plugins dot-repeatable like leap
{ "tpope/vim-repeat", event = "VeryLazy" },
}

View File

@ -33,9 +33,10 @@ return {
-- You can also define any custom formatters here.
---@type table<string,table>
formatters = {
injected = { options = { ignore_errors = true } },
-- -- Example of using dprint only when a dprint.json file is present
-- dprint = {
-- condition = function(ctx)
-- condition = function(self, ctx)
-- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1]
-- end,
-- },
@ -43,9 +44,13 @@ return {
},
config = function(_, opts)
opts.formatters = opts.formatters or {}
for f, o in pairs(opts.formatters) do
local ok, formatter = pcall(require, "conform.formatters." .. f)
opts.formatters[f] = vim.tbl_deep_extend("force", {}, ok and formatter or {}, o)
for name, formatter in pairs(opts.formatters) do
if type(formatter) == "table" then
local ok, defaults = pcall(require, "conform.formatters." .. name)
if ok and type(defaults) == "table" then
opts.formatters[name] = vim.tbl_deep_extend("force", {}, defaults, formatter)
end
end
end
require("conform").setup(opts)
end,

View File

@ -45,6 +45,6 @@ return {
{
"Civitasv/cmake-tools.nvim",
opts = {},
event = "BufRead",
event = "LazyFile",
},
}

View File

@ -33,6 +33,9 @@ return {
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
if vim.fn.executable("credo") == 0 then
return
end
local nls = require("null-ls")
opts.sources = opts.sources or {}
vim.list_extend(opts.sources, {
@ -43,10 +46,13 @@ return {
{
"mfussenegger/nvim-lint",
optional = true,
opts = {
linters_by_ft = {
opts = function(_, opts)
if vim.fn.executable("credo") == 0 then
return
end
opts.linters_by_ft = {
elixir = { "credo" },
},
},
}
end,
},
}

View File

@ -4,16 +4,30 @@ return {
opts = {
servers = {
tailwindcss = {
-- exclude a filetype from the default_config
filetypes_exclude = { "markdown" },
-- add additional filetypes to the default_config
filetypes_include = {},
-- to fully override the default_config, change the below
-- filetypes = {}
},
},
setup = {
tailwindcss = function(_, opts)
local tw = require("lspconfig.server_configurations.tailwindcss")
opts.filetypes = opts.filetypes or {}
-- Add default filetypes
vim.list_extend(opts.filetypes, tw.default_config.filetypes)
-- Remove excluded filetypes
--- @param ft string
opts.filetypes = vim.tbl_filter(function(ft)
return not vim.tbl_contains(opts.filetypes_exclude or {}, ft)
end, tw.default_config.filetypes)
end, opts.filetypes)
-- Add additional filetypes
vim.list_extend(opts.filetypes, opts.filetypes_include)
end,
},
},

View File

@ -86,7 +86,7 @@ return {
},
}
end
for _, language in ipairs({ "typescript", "javascript" }) do
for _, language in ipairs({ "typescript", "javascript", "typescriptreact", "javascriptreact" }) do
if not dap.configurations[language] then
dap.configurations[language] = {
{

View File

@ -1,7 +1,7 @@
return {
{
"mfussenegger/nvim-lint",
event = "BufReadPost",
event = "LazyFile",
opts = {
-- Event to trigger linters
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
@ -27,7 +27,9 @@ return {
local lint = require("lint")
for name, linter in pairs(opts.linters) do
lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name] or {}, linter)
if type(linter) == "table" and type(lint.linters) == "table" then
lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name], linter)
end
end
lint.linters_by_ft = opts.linters_by_ft
@ -43,7 +45,6 @@ return {
end
function M.lint()
local lint = require("lint")
local names = lint.linters_by_ft[vim.bo.filetype] or {}
local ctx = { filename = vim.api.nvim_buf_get_name(0) }
ctx.dirname = vim.fn.fnamemodify(ctx.filename, ":h")

View File

@ -0,0 +1,58 @@
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",
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.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,
},
}

View File

@ -2,6 +2,7 @@
return {
-- disable alpha
{ "goolord/alpha-nvim", enabled = false },
{ "glepnir/dashboard-nvim", enabled = false },
-- enable mini.starter
{

View File

@ -5,7 +5,7 @@ M.hl = {}
M.plugin = {
"echasnovski/mini.hipatterns",
event = "BufReadPre",
event = "LazyFile",
opts = function()
local hi = require("mini.hipatterns")
return {

View File

@ -42,4 +42,17 @@ return {
vim.list_extend(opts.items, items)
end,
},
{
"glepnir/dashboard-nvim",
optional = true,
opts = function(_, opts)
local projects = {
action = "Telescope projects",
desc = " Projects",
icon = "",
key = "p",
}
table.insert(opts.config.center, 3, projects)
end,
},
}

View File

@ -18,7 +18,6 @@ local enabled = {
}
local Config = require("lazy.core.config")
local Plugin = require("lazy.core.plugin")
Config.options.checker.enabled = false
Config.options.change_detection.enabled = false
Config.options.defaults.cond = function(plugin)

View File

@ -2,7 +2,7 @@ return {
-- lspconfig
{
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
event = "LazyFile",
dependencies = {
{ "folke/neoconf.nvim", cmd = "Neoconf", config = false, dependencies = { "nvim-lspconfig" } },
{ "folke/neodev.nvim", opts = {} },
@ -203,7 +203,7 @@ return {
-- formatters
{
"nvimtools/none-ls.nvim",
event = { "BufReadPre", "BufNewFile" },
event = "LazyFile",
dependencies = { "mason.nvim" },
opts = function()
local nls = require("null-ls")

View File

@ -1,4 +1,3 @@
local load_textobjects = false
return {
-- Treesitter is a new parser generator tool that we can
-- use in Neovim to power faster and more accurate
@ -7,16 +6,21 @@ return {
"nvim-treesitter/nvim-treesitter",
version = false, -- last release is way too old and doesn't work on Windows
build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" },
event = { "LazyFile", "VeryLazy" },
dependencies = {
{
"nvim-treesitter/nvim-treesitter-textobjects",
init = function()
-- disable rtp plugin, as we only need its queries for mini.ai
-- In case other textobject modules are enabled, we will load them
-- once nvim-treesitter is loaded
require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects")
load_textobjects = true
config = function()
-- Disable class keymaps in diff mode
vim.api.nvim_create_autocmd("BufReadPost", {
callback = function(event)
if vim.wo.diff then
for _, key in ipairs({ "[c", "]c", "[C", "]C" }) do
pcall(vim.keymap.del, "n", key, { buffer = event.buf })
end
end
end,
})
end,
},
},
@ -59,6 +63,15 @@ return {
node_decremental = "<bs>",
},
},
textobjects = {
move = {
enable = true,
goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer" },
goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer" },
goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer" },
goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer" },
},
},
},
---@param opts TSConfig
config = function(_, opts)
@ -74,21 +87,6 @@ return {
end, opts.ensure_installed)
end
require("nvim-treesitter.configs").setup(opts)
if load_textobjects then
-- PERF: no need to load the plugin, if we only need its queries for mini.ai
if opts.textobjects then
for _, mod in ipairs({ "move", "select", "swap", "lsp_interop" }) do
if opts.textobjects[mod] and opts.textobjects[mod].enable then
local Loader = require("lazy.core.loader")
Loader.disabled_rtp_plugins["nvim-treesitter-textobjects"] = nil
local plugin = require("lazy.core.config").plugins["nvim-treesitter-textobjects"]
require("lazy.core.loader").source_runtime(plugin.dir, "plugin")
break
end
end
end
end
end,
},
}

View File

@ -166,7 +166,7 @@ return {
-- indent guides for Neovim
{
"lukas-reineke/indent-blankline.nvim",
event = { "BufReadPost", "BufNewFile" },
event = "LazyFile",
opts = {
indent = {
char = "",
@ -197,7 +197,7 @@ return {
{
"echasnovski/mini.indentscope",
version = false, -- wait till new 0.7.0 release to put it back on semver
event = { "BufReadPre", "BufNewFile" },
event = "LazyFile",
opts = {
-- symbol = "▏",
symbol = "",
@ -296,14 +296,14 @@ return {
dashboard.section.header.val = vim.split(logo, "\n")
dashboard.section.buttons.val = {
dashboard.button("f", "" .. " Find file", ":Telescope find_files <CR>"),
dashboard.button("n", "" .. " New file", ":ene <BAR> startinsert <CR>"),
dashboard.button("r", "" .. " Recent files", ":Telescope oldfiles <CR>"),
dashboard.button("g", "" .. " Find text", ":Telescope live_grep <CR>"),
dashboard.button("c", "" .. " Config", ":e $MYVIMRC <CR>"),
dashboard.button("s", "" .. " Restore Session", [[:lua require("persistence").load() <cr>]]),
dashboard.button("l", "󰒲 " .. " Lazy", ":Lazy<CR>"),
dashboard.button("q", "" .. " Quit", ":qa<CR>"),
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("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"
@ -316,6 +316,7 @@ return {
return dashboard
end,
config = function(_, dashboard)
vim.o.laststatus = 0
-- close Lazy and re-open when the dashboard is ready
if vim.o.filetype == "lazy" then
vim.cmd.close()

View File

@ -1,14 +1,57 @@
local M = {}
---@alias Sign {name:string, text:string, texthl:string}
---@alias Sign {name:string, text:string, texthl:string, priority:number}
-- Returns a list of regular and extmark signs sorted by priority (low to high)
---@return Sign[]
function M.get_signs(win)
local buf = vim.api.nvim_win_get_buf(win)
---@diagnostic disable-next-line: no-unknown
return vim.tbl_map(function(sign)
return vim.fn.sign_getdefined(sign.name)[1]
end, vim.fn.sign_getplaced(buf, { group = "*", lnum = vim.v.lnum })[1].signs)
---@param buf number
---@param lnum number
function M.get_signs(buf, lnum)
-- Get regular signs
---@type Sign[]
local signs = vim.tbl_map(function(sign)
---@type Sign
local ret = vim.fn.sign_getdefined(sign.name)[1]
ret.priority = sign.priority
return ret
end, vim.fn.sign_getplaced(buf, { group = "*", lnum = lnum })[1].signs)
-- Get extmark signs
local extmarks = vim.api.nvim_buf_get_extmarks(
buf,
-1,
{ lnum - 1, 0 },
{ lnum - 1, -1 },
{ details = true, type = "sign" }
)
for _, extmark in pairs(extmarks) do
signs[#signs + 1] = {
name = extmark[4].sign_hl_group,
text = extmark[4].sign_text,
texthl = extmark[4].sign_hl_group,
priority = extmark[4].priority,
}
end
-- Sort by priority
table.sort(signs, function(a, b)
return (a.priority or 0) < (b.priority or 0)
end)
return signs
end
---@return Sign?
---@param buf number
---@param lnum number
function M.get_mark(buf, lnum)
local marks = vim.fn.getmarklist(buf)
vim.list_extend(marks, vim.fn.getmarklist())
for _, mark in ipairs(marks) do
if mark.pos[1] == buf and mark.pos[2] == lnum and mark.mark:match("[a-zA-Z]") then
return { text = mark.mark:sub(2), texthl = "DiagnosticHint" }
end
end
end
---@param sign? Sign
@ -24,7 +67,7 @@ end
function M.foldtext()
local ok = pcall(vim.treesitter.get_parser, vim.api.nvim_get_current_buf())
local ret = ok and vim.treesitter.foldtext and vim.treesitter.foldtext()
if not ret then
if not ret or type(ret) == "string" then
ret = { { vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum, false)[1], {} } }
end
table.insert(ret, { " " .. require("lazyvim.config").icons.misc.dots })
@ -45,13 +88,14 @@ function M.statuscolumn()
if vim.wo[win].signcolumn == "no" then
return ""
end
local buf = vim.api.nvim_win_get_buf(win)
---@type Sign?,Sign?,Sign?
local left, right, fold
for _, s in ipairs(M.get_signs(win)) do
for _, s in ipairs(M.get_signs(buf, vim.v.lnum)) do
if s.name:find("GitSign") then
right = s
elseif not left then
else
left = s
end
end
@ -68,7 +112,7 @@ function M.statuscolumn()
end
return table.concat({
M.icon(left),
M.icon(M.get_mark(buf, vim.v.lnum) or left),
[[%=]],
nu .. " ",
M.icon(fold or right),

View File

@ -0,0 +1,4 @@
;; extends
((identifier) @namespace.builtin
(#eq? @namespace.builtin "vim"))