Compare commits
71 Commits
Author | SHA1 | Date | |
---|---|---|---|
6428fc167c | |||
762017dc35 | |||
afbe2043a7 | |||
f1ce07510d | |||
364bcf325d | |||
3f868aa825 | |||
fecc5faca2 | |||
19926d2848 | |||
450e0c6beb | |||
4e277fcb8f | |||
86d3694672 | |||
7c5a458761 | |||
ecac59c982 | |||
4ff51cd678 | |||
fe341e6b97 | |||
0ca732e0ef | |||
766d5e5bf7 | |||
9b16770573 | |||
e36f7d811c | |||
0b04e3908c | |||
e8ab2ff5b6 | |||
3acdac917b | |||
2ffd629cc7 | |||
dd95de5dbe | |||
9d17c43087 | |||
2aea5c7210 | |||
9935dc3944 | |||
b8ffa5261a | |||
bfe04222fe | |||
f7655a83c5 | |||
9bb4e8755f | |||
4a2c89cd1d | |||
964dd6c4b2 | |||
0136bfa4b5 | |||
5eca3dc3bb | |||
7821c0e851 | |||
bd48536335 | |||
1c878b9d06 | |||
6f9adbd4fb | |||
ff5f5886db | |||
300350686f | |||
718c5c6036 | |||
31d913697b | |||
6bb0d1b66f | |||
0e5ff5c0ab | |||
886d49eb89 | |||
0f7a009d1c | |||
05f45bb720 | |||
9762e7e431 | |||
aab365a9f8 | |||
f61a243d1a | |||
6b05ed7dcd | |||
a7f68e5e37 | |||
3c448a1be1 | |||
7cac6f064c | |||
274649e923 | |||
a3011daf40 | |||
fa6cbfc602 | |||
d012a1acb8 | |||
d03f708cd3 | |||
017582c05a | |||
13bf7977a4 | |||
74786c21d7 | |||
7f5051ef72 | |||
b220e54159 | |||
b25559d397 | |||
ee068d8399 | |||
db86635e32 | |||
a1ab7c6e32 | |||
b30ff44af5 | |||
36d6a7fe4f |
151
CHANGELOG.md
151
CHANGELOG.md
@ -1,5 +1,156 @@
|
||||
# Changelog
|
||||
|
||||
## [8.4.0](https://github.com/LazyVim/LazyVim/compare/v8.3.0...v8.4.0) (2023-10-03)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **keymaps:** added toggle for relative line numbers ([3f868aa](https://github.com/LazyVim/LazyVim/commit/3f868aa8254efbd494f6bf100c86a59c5a002c1c))
|
||||
* **options:** enable smoothscroll on nightly ([450e0c6](https://github.com/LazyVim/LazyVim/commit/450e0c6bebc5bb9a0c513cdffaf9c46d5f62d5fa))
|
||||
* **options:** enabled treesitter folding and foldtext when available ([19926d2](https://github.com/LazyVim/LazyVim/commit/19926d284862b5e58f29e73b71ec532ac29c54ba))
|
||||
* **ui:** fancy fold text ([f1ce075](https://github.com/LazyVim/LazyVim/commit/f1ce07510d2048e33fec2b609814d68a7175d591))
|
||||
* **ui:** fancy status column ([364bcf3](https://github.com/LazyVim/LazyVim/commit/364bcf325d91a06e6bd6516bdfed84399566cdb6))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **ui:** better fallback for foldtext when buffer does not have TreeSitter ([762017d](https://github.com/LazyVim/LazyVim/commit/762017dc35fc961bdcc7879a5527dbccced27792))
|
||||
* **ui:** Neovim < 0.10 ([afbe204](https://github.com/LazyVim/LazyVim/commit/afbe2043a73b6c90476812f9cc0ca4759814e5ac))
|
||||
|
||||
## [8.3.0](https://github.com/LazyVim/LazyVim/compare/v8.2.0...v8.3.0) (2023-10-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **conform:** added new keymap (leader-cF) to format injected languages ([86d3694](https://github.com/LazyVim/LazyVim/commit/86d36946727bade57918c6a358c6b6bae52d441b))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **indent-blankline:** set `config.indent.tab_char` ([#1552](https://github.com/LazyVim/LazyVim/issues/1552)) ([7c5a458](https://github.com/LazyVim/LazyVim/commit/7c5a458761fe7002c6603d602e8d130b9a62dd68))
|
||||
|
||||
## [8.2.0](https://github.com/LazyVim/LazyVim/compare/v8.1.0...v8.2.0) (2023-10-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **mini.files:** added lsp rename support to mini.files ([4ff51cd](https://github.com/LazyVim/LazyVim/commit/4ff51cd678343ea32668eaf0c1103caacb4334a2))
|
||||
|
||||
## [8.1.0](https://github.com/LazyVim/LazyVim/compare/v8.0.0...v8.1.0) (2023-10-01)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **conform:** set vim.opt.formatexpr ([766d5e5](https://github.com/LazyVim/LazyVim/commit/766d5e5bf7a8e40910a00aef4dc30f36376e5652))
|
||||
* **elixir:** Add credo if none-ls is used ([#1546](https://github.com/LazyVim/LazyVim/issues/1546)) ([2ffd629](https://github.com/LazyVim/LazyVim/commit/2ffd629cc7a68e6e4a721ac8babe6b7cf612868e))
|
||||
* **format:** show warning when no formatter ran when using the format keymap ([e36f7d8](https://github.com/LazyVim/LazyVim/commit/e36f7d811c396b60bcbf65f962b3f52d2f75b0b3))
|
||||
* **go:** add goimports ([#1549](https://github.com/LazyVim/LazyVim/issues/1549)) ([e8ab2ff](https://github.com/LazyVim/LazyVim/commit/e8ab2ff5b6a75952943d3ba44586c7de5588be33))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **format:** moved formatting keymap to lua/lazyvim/config/keymaps.lua ([9b16770](https://github.com/LazyVim/LazyVim/commit/9b1677057377400ab292c51bbc085c82637a39d4))
|
||||
|
||||
## [8.0.0](https://github.com/LazyVim/LazyVim/compare/v7.0.3...v8.0.0) (2023-10-01)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* LazyVim now requires Neovim >= 0.9.0
|
||||
|
||||
### Features
|
||||
|
||||
* replace Copilot icon with logo ([#1539](https://github.com/LazyVim/LazyVim/issues/1539)) ([9bb4e87](https://github.com/LazyVim/LazyVim/commit/9bb4e8755f5a822659ca1d8cb3689732435d90d0))
|
||||
* show error and exit Neovim when version is too old ([2aea5c7](https://github.com/LazyVim/LazyVim/commit/2aea5c7210882a2f98526ee29115fe2e1a41d7b4))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* cleanup all Neovim < 0.9.0 code ([9935dc3](https://github.com/LazyVim/LazyVim/commit/9935dc3944c4724d7ee7f70b6bc450f8c3b34a08))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* dont't load schemastore as an lspconfig dep ([9d17c43](https://github.com/LazyVim/LazyVim/commit/9d17c4308713e8db7ec03871ba62ff80a3bfb79c))
|
||||
|
||||
|
||||
### Documentation
|
||||
|
||||
* LazyVim now requires Neovim >= 0.9.0 ([bfe0422](https://github.com/LazyVim/LazyVim/commit/bfe04222fe5585179f03197b01a6f6ed711d4421))
|
||||
|
||||
## [7.0.3](https://github.com/LazyVim/LazyVim/compare/v7.0.2...v7.0.3) (2023-09-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **extras.go:** remove unneeded formatters since gopls handles them ([#1535](https://github.com/LazyVim/LazyVim/issues/1535)) ([964dd6c](https://github.com/LazyVim/LazyVim/commit/964dd6c4b2135399758c87afed7e1f3c8e30b487))
|
||||
|
||||
## [7.0.2](https://github.com/LazyVim/LazyVim/compare/v7.0.1...v7.0.2) (2023-09-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **format:** allow `custom_format` to return early ([#1531](https://github.com/LazyVim/LazyVim/issues/1531)) ([1c878b9](https://github.com/LazyVim/LazyVim/commit/1c878b9d06fb116135419d098fe5dfde5304b709))
|
||||
* **python:** make venv-selector `dap_enabled` conditional on `nvim-dap-python` ([#1529](https://github.com/LazyVim/LazyVim/issues/1529)) ([7821c0e](https://github.com/LazyVim/LazyVim/commit/7821c0e85199205af98ceedfb2c4990c96900e46))
|
||||
|
||||
## [7.0.1](https://github.com/LazyVim/LazyVim/compare/v7.0.0...v7.0.1) (2023-09-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **nvim-lint:** dont use default configured linters from nvim-lint ([ff5f588](https://github.com/LazyVim/LazyVim/commit/ff5f5886db321679e3fdc5dbb82b12daf6075510))
|
||||
|
||||
## [7.0.0](https://github.com/LazyVim/LazyVim/compare/v6.4.3...v7.0.0) (2023-09-29)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* **typescript:** removed `typescript.nvim` since it's deprecated
|
||||
* **null-ls:** use none-ls instead of null-ls ([#1517](https://github.com/LazyVim/LazyVim/issues/1517))
|
||||
|
||||
### Features
|
||||
|
||||
* **extras:** added `conform.nvim` extra you can use instead of null-ls/none-ls ([f61a243](https://github.com/LazyVim/LazyVim/commit/f61a243d1aca582963aca3f2c2c7c2ae0be16b06))
|
||||
* **extras:** added extra for nvim-lint ([05f45bb](https://github.com/LazyVim/LazyVim/commit/05f45bb7200a6fd33ab7366553b957fa222e2cdf))
|
||||
* **neo-tree:** added support for LSP renaming to NeoTree ([9762e7e](https://github.com/LazyVim/LazyVim/commit/9762e7e43110013a0931b8470be2929b54b4b641))
|
||||
* **null-ls:** use none-ls instead of null-ls ([#1517](https://github.com/LazyVim/LazyVim/issues/1517)) ([7cac6f0](https://github.com/LazyVim/LazyVim/commit/7cac6f064c5b30f6b0ae4dffab62100aa6fe2568))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **conform:** use `formatters` for both custom and overriding formatters ([6bb0d1b](https://github.com/LazyVim/LazyVim/commit/6bb0d1b66ffe6d0a77ad96d0f945113ddcb9fdb3))
|
||||
* **docker:** put hadolint in its own spec ([718c5c6](https://github.com/LazyVim/LazyVim/commit/718c5c6036f2aff6534501e151dd3e5ff13a42fa))
|
||||
* **format:** wrap custom formatter with error handler ([0e5ff5c](https://github.com/LazyVim/LazyVim/commit/0e5ff5c0ab6930190122df086db5e3f91d8b38b8))
|
||||
* **nvim-lint:** use `linters` for both custom and overriding linters ([31d9136](https://github.com/LazyVim/LazyVim/commit/31d913697bc9b731bc941362021ce06617f627d3))
|
||||
* remove deprecated leap/flit code checks ([6b05ed7](https://github.com/LazyVim/LazyVim/commit/6b05ed7dcd729322e2e5b6752655a9491cd17f86))
|
||||
* **typescript:** removed `typescript.nvim` since it's deprecated ([aab365a](https://github.com/LazyVim/LazyVim/commit/aab365a9f8b6405c6c5a938cb4745e9b770f2261))
|
||||
|
||||
## [6.4.3](https://github.com/LazyVim/LazyVim/compare/v6.4.2...v6.4.3) (2023-09-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **ibl:** use default hl groups ([74786c2](https://github.com/LazyVim/LazyVim/commit/74786c21d743db0fabed61b90bf7ecaab16bbf14))
|
||||
* **lsp:** don't install jsonls by default. It's part of the json extra ([fa6cbfc](https://github.com/LazyVim/LazyVim/commit/fa6cbfc6020efcd2168ffe09a209037599b91442))
|
||||
* **telescope:** add enums and consts to search symbols ([#1512](https://github.com/LazyVim/LazyVim/issues/1512)) ([b220e54](https://github.com/LazyVim/LazyVim/commit/b220e541594a0ef556d1515649cd99d45fe94058))
|
||||
* **telescope:** replace anonymous functions in mappings by named functions ([#1294](https://github.com/LazyVim/LazyVim/issues/1294)) ([13bf797](https://github.com/LazyVim/LazyVim/commit/13bf7977a4bae39a38ef6a3fad6303366c8b4bea))
|
||||
* **telescope:** typo ([017582c](https://github.com/LazyVim/LazyVim/commit/017582c05a2d87c73cfe794dd2e296cc0caf86cd))
|
||||
* **yamlls:** work-around for yaml formatting on Neovim < 0.10. Fixes [#1435](https://github.com/LazyVim/LazyVim/issues/1435) ([7f5051e](https://github.com/LazyVim/LazyVim/commit/7f5051ef72cfe66eb50ddb7c973714aa8aea04ec))
|
||||
|
||||
## [6.4.2](https://github.com/LazyVim/LazyVim/compare/v6.4.1...v6.4.2) (2023-09-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **indent-blankline:** upgrade ibl config to v3 ([db86635](https://github.com/LazyVim/LazyVim/commit/db86635e3276451f795da4f8af64eff94391fe48))
|
||||
|
||||
## [6.4.1](https://github.com/LazyVim/LazyVim/compare/v6.4.0...v6.4.1) (2023-09-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **dap:** revert loading vscode launch files. Add it to your own config when needed. Fixes [#1503](https://github.com/LazyVim/LazyVim/issues/1503) ([36d6a7f](https://github.com/LazyVim/LazyVim/commit/36d6a7fe4f4e7d5c9ffceca0496655a889df2ebc))
|
||||
|
||||
## [6.4.0](https://github.com/LazyVim/LazyVim/compare/v6.3.0...v6.4.0) (2023-09-26)
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ LazyVim 提供了两全其美的方式 - 根据需要调整配置的灵活性,
|
||||
|
||||
## ⚡️ 要求
|
||||
|
||||
- Neovim >= **0.8.0** (需要用 **LuaJIT** 构建)
|
||||
- Neovim >= **0.9.0** (需要用 **LuaJIT** 构建)
|
||||
- Git >= **2.19.0** (用于部分克隆支持)
|
||||
- 一个 [Nerd Font](https://www.nerdfonts.com/) 字体 **_(可选)_**
|
||||
- 一个用于 `nvim-treesitter` 的 **C** 编译器。看 [这里](https://github.com/nvim-treesitter/nvim-treesitter#requirements)
|
||||
|
@ -56,7 +56,7 @@ to tweak your config as needed, along with the convenience of a pre-configured s
|
||||
|
||||
## ⚡️ Requirements
|
||||
|
||||
- Neovim >= **0.8.0** (needs to be built with **LuaJIT**)
|
||||
- Neovim >= **0.9.0** (needs to be built with **LuaJIT**)
|
||||
- Git >= **2.19.0** (for partial clones support)
|
||||
- a [Nerd Font](https://www.nerdfonts.com/) **_(optional)_**
|
||||
- a **C** compiler for `nvim-treesitter`. See [here](https://github.com/nvim-treesitter/nvim-treesitter#requirements)
|
||||
|
@ -1,4 +1,4 @@
|
||||
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 September 26
|
||||
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 October 03
|
||||
|
||||
==============================================================================
|
||||
Table of Contents *LazyVim-table-of-contents*
|
||||
@ -52,7 +52,7 @@ FEATURES *LazyVim-features*
|
||||
|
||||
REQUIREMENTS *LazyVim-requirements*
|
||||
|
||||
- Neovim >= **0.8.0** (needs to be built with **LuaJIT**)
|
||||
- Neovim >= **0.9.0** (needs to be built with **LuaJIT**)
|
||||
- Git >= **2.19.0** (for partial clones support)
|
||||
- a Nerd Font <https://www.nerdfonts.com/> **(optional)**
|
||||
- a **C** compiler for `nvim-treesitter`. See here <https://github.com/nvim-treesitter/nvim-treesitter#requirements>
|
||||
|
@ -19,6 +19,9 @@ local defaults = {
|
||||
},
|
||||
-- icons used by other plugins
|
||||
icons = {
|
||||
misc = {
|
||||
dots = "",
|
||||
},
|
||||
dap = {
|
||||
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
||||
Breakpoint = " ",
|
||||
@ -44,7 +47,7 @@ local defaults = {
|
||||
Color = " ",
|
||||
Constant = " ",
|
||||
Constructor = " ",
|
||||
Copilot = " ",
|
||||
Copilot = " ",
|
||||
Enum = " ",
|
||||
EnumMember = " ",
|
||||
Event = " ",
|
||||
@ -79,6 +82,8 @@ local defaults = {
|
||||
|
||||
M.renames = {
|
||||
["windwp/nvim-spectre"] = "nvim-pack/nvim-spectre",
|
||||
["jose-elias-alvarez/null-ls.nvim"] = "nvimtools/none-ls.nvim",
|
||||
["null-ls.nvim"] = "none-ls.nvim",
|
||||
}
|
||||
|
||||
---@type LazyVimConfig
|
||||
@ -87,6 +92,21 @@ local options
|
||||
---@param opts? LazyVimConfig
|
||||
function M.setup(opts)
|
||||
options = vim.tbl_deep_extend("force", defaults, opts or {})
|
||||
|
||||
if vim.fn.has("nvim-0.9.0") == 0 then
|
||||
vim.api.nvim_echo({
|
||||
{
|
||||
"LazyVim requires Neovim >= 0.9.0\n",
|
||||
"ErrorMsg",
|
||||
},
|
||||
{ "Press any key to exit", "MoreMsg" },
|
||||
}, true, {})
|
||||
|
||||
vim.fn.getchar()
|
||||
vim.cmd([[quit]])
|
||||
return
|
||||
end
|
||||
|
||||
if not M.has() then
|
||||
require("lazy.core.util").error(
|
||||
"**LazyVim** needs **lazy.nvim** version "
|
||||
@ -181,6 +201,14 @@ function M.init()
|
||||
local add = Plugin.Spec.add
|
||||
Plugin.Spec.add = function(self, plugin, ...)
|
||||
if type(plugin) == "table" and M.renames[plugin[1]] then
|
||||
require("lazy.core.util").warn(
|
||||
("Plugin `%s` was renamed to `%s`.\nPlease update your config for `%s`"):format(
|
||||
plugin[1],
|
||||
M.renames[plugin[1]],
|
||||
self.importing or "LazyVim"
|
||||
),
|
||||
{ title = "LazyVim" }
|
||||
)
|
||||
plugin[1] = M.renames[plugin[1]]
|
||||
end
|
||||
return add(self, plugin, ...)
|
||||
|
@ -103,12 +103,18 @@ if not Util.has("trouble.nvim") then
|
||||
map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" })
|
||||
end
|
||||
|
||||
-- formatting
|
||||
map({ "n", "v" }, "<leader>cf", function()
|
||||
require("lazyvim.plugins.lsp.format").format({ force = true })
|
||||
end, { desc = "Format" })
|
||||
|
||||
-- stylua: ignore start
|
||||
|
||||
-- toggle options
|
||||
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", Util.toggle_diagnostics, { desc = "Toggle Diagnostics" })
|
||||
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
|
||||
@ -125,9 +131,7 @@ map("n", "<leader>gG", function() Util.float_term({ "lazygit" }, {esc_esc = fals
|
||||
map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit all" })
|
||||
|
||||
-- highlights under cursor
|
||||
if vim.fn.has("nvim-0.9.0") == 1 then
|
||||
map("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" })
|
||||
end
|
||||
map("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" })
|
||||
|
||||
-- LazyVim Changelog
|
||||
map("n", "<leader>L", Util.changelog, {desc = "LazyVim Changelog"})
|
||||
|
@ -27,7 +27,7 @@ opt.scrolloff = 4 -- Lines of context
|
||||
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
|
||||
opt.shiftround = true -- Round indent
|
||||
opt.shiftwidth = 2 -- Size of an indent
|
||||
opt.shortmess:append({ W = true, I = true, c = true })
|
||||
opt.shortmess:append({ W = true, I = true, c = true, C = true })
|
||||
opt.showmode = false -- Dont show mode since we have a statusline
|
||||
opt.sidescrolloff = 8 -- Columns of context
|
||||
opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
|
||||
@ -35,6 +35,7 @@ opt.smartcase = true -- Don't ignore case with capitals
|
||||
opt.smartindent = true -- Insert indents automatically
|
||||
opt.spelllang = { "en" }
|
||||
opt.splitbelow = true -- Put new windows below current
|
||||
opt.splitkeep = "screen"
|
||||
opt.splitright = true -- Put new windows right of current
|
||||
opt.tabstop = 2 -- Number of spaces tabs count for
|
||||
opt.termguicolors = true -- True color support
|
||||
@ -45,10 +46,34 @@ opt.updatetime = 200 -- Save swap file and trigger CursorHold
|
||||
opt.wildmode = "longest:full,full" -- Command-line completion mode
|
||||
opt.winminwidth = 5 -- Minimum window width
|
||||
opt.wrap = false -- Disable line wrap
|
||||
opt.fillchars = {
|
||||
foldopen = "",
|
||||
foldclose = "",
|
||||
-- fold = "⸱",
|
||||
fold = " ",
|
||||
foldsep = " ",
|
||||
diff = "╱",
|
||||
eob = " ",
|
||||
}
|
||||
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
opt.smoothscroll = true
|
||||
end
|
||||
|
||||
-- Folding
|
||||
vim.opt.foldlevel = 99
|
||||
if vim.treesitter.foldexpr then
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
else
|
||||
vim.opt.foldmethod = "indent"
|
||||
end
|
||||
if vim.treesitter.foldtext then
|
||||
vim.opt.foldtext = "v:lua.require'lazyvim.util.ui'.foldtext()"
|
||||
end
|
||||
|
||||
if vim.fn.has("nvim-0.9.0") == 1 then
|
||||
opt.splitkeep = "screen"
|
||||
opt.shortmess:append({ C = true })
|
||||
vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util.ui'.statuscolumn()]]
|
||||
end
|
||||
|
||||
-- Fix markdown indentation settings
|
||||
|
@ -8,10 +8,10 @@ local error = vim.health.error or vim.health.report_error
|
||||
function M.check()
|
||||
start("LazyVim")
|
||||
|
||||
if vim.fn.has("nvim-0.8.0") == 1 then
|
||||
ok("Using Neovim >= 0.8.0")
|
||||
if vim.fn.has("nvim-0.9.0") == 1 then
|
||||
ok("Using Neovim >= 0.9.0")
|
||||
else
|
||||
error("Neovim >= 0.8.0 is required")
|
||||
error("Neovim >= 0.9.0 is required")
|
||||
end
|
||||
|
||||
for _, cmd in ipairs({ "git", "rg", { "fd", "fdfind" }, "lazygit" }) do
|
||||
|
@ -59,6 +59,16 @@ return {
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local function on_move(data)
|
||||
Util.on_rename(data.source, data.destination)
|
||||
end
|
||||
|
||||
local events = require("neo-tree.events")
|
||||
opts.event_handlers = opts.event_handlers or {}
|
||||
vim.list_extend(opts.event_handlers, {
|
||||
{ event = events.FILE_MOVED, handler = on_move },
|
||||
{ event = events.FILE_RENAMED, handler = on_move },
|
||||
})
|
||||
require("neo-tree").setup(opts)
|
||||
vim.api.nvim_create_autocmd("TermClose", {
|
||||
pattern = "*lazygit",
|
||||
@ -82,10 +92,12 @@ return {
|
||||
},
|
||||
},
|
||||
|
||||
-- fuzzy finder
|
||||
-- Fuzzy finder.
|
||||
-- The default key bindings to find files will use Telescope's
|
||||
-- `find_files` or `git_files` depending on whether the
|
||||
-- directory is a git repo.
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
commit = vim.fn.has("nvim-0.9.0") == 0 and "057ee0f8783" or nil,
|
||||
cmd = "Telescope",
|
||||
version = false, -- telescope did only one release, so use HEAD for now
|
||||
keys = {
|
||||
@ -138,6 +150,8 @@ return {
|
||||
"Trait",
|
||||
"Field",
|
||||
"Property",
|
||||
"Enum",
|
||||
"Constant",
|
||||
},
|
||||
}),
|
||||
desc = "Goto Symbol",
|
||||
@ -156,79 +170,56 @@ return {
|
||||
"Trait",
|
||||
"Field",
|
||||
"Property",
|
||||
"Enum",
|
||||
"Constant",
|
||||
},
|
||||
}),
|
||||
desc = "Goto Symbol (Workspace)",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
defaults = {
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
mappings = {
|
||||
i = {
|
||||
["<c-t>"] = function(...)
|
||||
return require("trouble.providers.telescope").open_with_trouble(...)
|
||||
end,
|
||||
["<a-t>"] = function(...)
|
||||
return require("trouble.providers.telescope").open_selected_with_trouble(...)
|
||||
end,
|
||||
["<a-i>"] = function()
|
||||
local action_state = require("telescope.actions.state")
|
||||
local line = action_state.get_current_line()
|
||||
Util.telescope("find_files", { no_ignore = true, default_text = line })()
|
||||
end,
|
||||
["<a-h>"] = function()
|
||||
local action_state = require("telescope.actions.state")
|
||||
local line = action_state.get_current_line()
|
||||
Util.telescope("find_files", { hidden = true, default_text = line })()
|
||||
end,
|
||||
["<C-Down>"] = function(...)
|
||||
return require("telescope.actions").cycle_history_next(...)
|
||||
end,
|
||||
["<C-Up>"] = function(...)
|
||||
return require("telescope.actions").cycle_history_prev(...)
|
||||
end,
|
||||
["<C-f>"] = function(...)
|
||||
return require("telescope.actions").preview_scrolling_down(...)
|
||||
end,
|
||||
["<C-b>"] = function(...)
|
||||
return require("telescope.actions").preview_scrolling_up(...)
|
||||
end,
|
||||
},
|
||||
n = {
|
||||
["q"] = function(...)
|
||||
return require("telescope.actions").close(...)
|
||||
end,
|
||||
opts = function()
|
||||
local actions = require("telescope.actions")
|
||||
|
||||
local open_with_trouble = function(...)
|
||||
return require("trouble.providers.telescope").open_with_trouble(...)
|
||||
end
|
||||
local open_selected_with_trouble = function(...)
|
||||
return require("trouble.providers.telescope").open_selected_with_trouble(...)
|
||||
end
|
||||
local find_files_no_ignore = function()
|
||||
local action_state = require("telescope.actions.state")
|
||||
local line = action_state.get_current_line()
|
||||
Util.telescope("find_files", { no_ignore = true, default_text = line })()
|
||||
end
|
||||
local find_files_with_hidden = function()
|
||||
local action_state = require("telescope.actions.state")
|
||||
local line = action_state.get_current_line()
|
||||
Util.telescope("find_files", { hidden = true, default_text = line })()
|
||||
end
|
||||
|
||||
return {
|
||||
defaults = {
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
mappings = {
|
||||
i = {
|
||||
["<c-t>"] = open_with_trouble,
|
||||
["<a-t>"] = open_selected_with_trouble,
|
||||
["<a-i>"] = find_files_no_ignore,
|
||||
["<a-h>"] = find_files_with_hidden,
|
||||
["<C-Down>"] = actions.cycle_history_next,
|
||||
["<C-Up>"] = actions.cycle_history_prev,
|
||||
["<C-f>"] = actions.preview_scrolling_down,
|
||||
["<C-b>"] = actions.preview_scrolling_up,
|
||||
},
|
||||
n = {
|
||||
["q"] = actions.close,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- disable old installations of leap and flit. Optional so it doesn't appear under disabled plugins
|
||||
{
|
||||
"ggandor/leap.nvim",
|
||||
enabled = function()
|
||||
vim.schedule(function()
|
||||
local Config = require("lazy.core.config")
|
||||
if Config.spec.disabled["leap.nvim"] or Config.spec.disabled["flit.nvim"] then
|
||||
require("lazy.core.util").warn(
|
||||
[[`flash.nvim` is now the default **LazyVim** jump plugin.
|
||||
**leap.nvim** and **flit.nvim** have been disabled.
|
||||
Please remove the plugins from your config.
|
||||
If you rather use leap/flit instead, you can add the leap extra:
|
||||
`lazyvim.plugins.extras.editor.leap`
|
||||
]],
|
||||
{ title = "LazyVim" }
|
||||
)
|
||||
end
|
||||
end)
|
||||
return false
|
||||
}
|
||||
end,
|
||||
optional = true,
|
||||
},
|
||||
{ "ggandor/flit.nvim", enabled = false, optional = true },
|
||||
|
||||
-- Flash enhances the built-in search functionality by showing labels
|
||||
-- at the end of each match, letting you quickly jump to a specific
|
||||
|
@ -14,7 +14,7 @@ return {
|
||||
opts = {},
|
||||
config = function(_, opts)
|
||||
-- setup dap config by VsCode launch.json file
|
||||
require("dap.ext.vscode").load_launchjs()
|
||||
-- require("dap.ext.vscode").load_launchjs()
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
dapui.setup(opts)
|
||||
|
@ -1,6 +0,0 @@
|
||||
require("lazy.core.util").warn(
|
||||
"`flash.nvim` is now the default jump plugin for **LazyVim**.\nPlease remove the `lazyvim.plugins.extras.editor.flash` import from your **lazy** config.",
|
||||
{ title = "LazyVim" }
|
||||
)
|
||||
|
||||
return {}
|
@ -53,5 +53,12 @@ return {
|
||||
vim.keymap.set("n", "g.", toggle_dotfiles, { buffer = buf_id })
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "MiniFilesActionRename",
|
||||
callback = function(event)
|
||||
require("lazyvim.util").on_rename(event.data.from, event.data.to)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
53
lua/lazyvim/plugins/extras/formatting/conform.lua
Normal file
53
lua/lazyvim/plugins/extras/formatting/conform.lua
Normal file
@ -0,0 +1,53 @@
|
||||
return {
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
dependencies = { "mason.nvim" },
|
||||
lazy = true,
|
||||
cmd = "ConformInfo",
|
||||
keys = {
|
||||
{
|
||||
"<leader>cF",
|
||||
function()
|
||||
require("conform").format({ formatters = { "injected" } })
|
||||
end,
|
||||
mode = { "n", "v" },
|
||||
desc = "Format Injected Langs",
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
|
||||
-- Install the conform formatter on VeryLazy
|
||||
require("lazyvim.util").on_very_lazy(function()
|
||||
require("lazyvim.plugins.lsp.format").custom_format = function(buf)
|
||||
return require("conform").format({ bufnr = buf })
|
||||
end
|
||||
end)
|
||||
end,
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
fish = { "fish_indent" },
|
||||
sh = { "shfmt" },
|
||||
},
|
||||
-- LazyVim will merge the options you set here with builtin formatters.
|
||||
-- You can also define any custom formatters here.
|
||||
---@type table<string,table>
|
||||
formatters = {
|
||||
-- -- Example of using dprint only when a dprint.json file is present
|
||||
-- dprint = {
|
||||
-- condition = function(ctx)
|
||||
-- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1]
|
||||
-- end,
|
||||
-- },
|
||||
},
|
||||
},
|
||||
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)
|
||||
end
|
||||
require("conform").setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
@ -6,10 +6,35 @@ return {
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
"nvimtools/none-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
table.insert(opts.sources, nls.builtins.formatting.prettierd)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
["javascript"] = { { "prettierd", "prettier" } },
|
||||
["javascriptreact"] = { { "prettierd", "prettier" } },
|
||||
["typescript"] = { { "prettierd", "prettier" } },
|
||||
["typescriptreact"] = { { "prettierd", "prettier" } },
|
||||
["vue"] = { { "prettierd", "prettier" } },
|
||||
["css"] = { { "prettierd", "prettier" } },
|
||||
["scss"] = { { "prettierd", "prettier" } },
|
||||
["less"] = { { "prettierd", "prettier" } },
|
||||
["html"] = { { "prettierd", "prettier" } },
|
||||
["json"] = { { "prettierd", "prettier" } },
|
||||
["jsonc"] = { { "prettierd", "prettier" } },
|
||||
["yaml"] = { { "prettierd", "prettier" } },
|
||||
["markdown"] = { { "prettierd", "prettier" } },
|
||||
["markdown.mdx"] = { { "prettierd", "prettier" } },
|
||||
["graphql"] = { { "prettierd", "prettier" } },
|
||||
["handlebars"] = { { "prettierd", "prettier" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -8,7 +8,8 @@ return {
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
"nvimtools/none-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
opts.sources = opts.sources or {}
|
||||
@ -17,6 +18,15 @@ return {
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
optional = true,
|
||||
opts = {
|
||||
linters_by_ft = {
|
||||
cmake = { "cmakelint" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"mason.nvim",
|
||||
opts = function(_, opts)
|
||||
|
@ -8,7 +8,15 @@ return {
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
"mason.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, { "hadolint" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
opts.sources = opts.sources or {}
|
||||
@ -16,12 +24,14 @@ return {
|
||||
nls.builtins.diagnostics.hadolint,
|
||||
})
|
||||
end,
|
||||
dependencies = {
|
||||
"mason.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, { "hadolint" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
optional = true,
|
||||
opts = {
|
||||
linters_by_ft = {
|
||||
dockerfile = { "hadolint" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -29,4 +29,24 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
opts.sources = opts.sources or {}
|
||||
vim.list_extend(opts.sources, {
|
||||
nls.builtins.diagnostics.credo,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
optional = true,
|
||||
opts = {
|
||||
linters_by_ft = {
|
||||
elixir = { "credo" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -83,19 +83,28 @@ return {
|
||||
},
|
||||
-- Ensure Go tools are installed
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
"nvimtools/none-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
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.gofumpt,
|
||||
nls.builtins.formatting.goimports_reviser,
|
||||
nls.builtins.formatting.goimports,
|
||||
})
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
go = { "goimports" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
optional = true,
|
||||
@ -104,7 +113,7 @@ return {
|
||||
"mason.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl", "gofumpt", "goimports-reviser", "delve" })
|
||||
vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl", "goimports", "delve" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
|
@ -10,13 +10,16 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
-- yaml schema support
|
||||
{
|
||||
"b0o/SchemaStore.nvim",
|
||||
lazy = true,
|
||||
version = false, -- last release is way too old
|
||||
},
|
||||
|
||||
-- correctly setup lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"b0o/SchemaStore.nvim",
|
||||
version = false, -- last release is way too old
|
||||
},
|
||||
opts = {
|
||||
-- make sure mason installs the server
|
||||
servers = {
|
||||
|
@ -9,12 +9,28 @@ return {
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
"nvimtools/none-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
table.insert(opts.sources, nls.builtins.formatting.csharpier)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
cs = { "csharpier" },
|
||||
},
|
||||
formatters = {
|
||||
csharpier = {
|
||||
command = "dotnet-csharpier",
|
||||
args = { "--write-stdout" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = function(_, opts)
|
||||
|
@ -61,15 +61,19 @@ return {
|
||||
{
|
||||
"linux-cultist/venv-selector.nvim",
|
||||
cmd = "VenvSelect",
|
||||
opts = {
|
||||
name = {
|
||||
"venv",
|
||||
".venv",
|
||||
"env",
|
||||
".env",
|
||||
},
|
||||
dap_enabled = true, -- Ensure that the venv selector affect PythonPath in nvim-dap as well!
|
||||
},
|
||||
opts = function(_, opts)
|
||||
if require("lazyvim.util").has("nvim-dap-python") then
|
||||
opts.dap_enabled = true
|
||||
end
|
||||
return vim.tbl_deep_extend("force", opts, {
|
||||
name = {
|
||||
"venv",
|
||||
".venv",
|
||||
"env",
|
||||
".env",
|
||||
},
|
||||
})
|
||||
end,
|
||||
keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv" } },
|
||||
},
|
||||
}
|
||||
|
@ -25,7 +25,8 @@ return {
|
||||
},
|
||||
},
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
"nvimtools/none-ls.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
if type(opts.sources) == "table" then
|
||||
local null_ls = require("null-ls")
|
||||
@ -36,4 +37,25 @@ return {
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
optional = true,
|
||||
opts = {
|
||||
linters_by_ft = {
|
||||
terraform = { "terraform_validate" },
|
||||
tf = { "terraform_validate" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
terraform = { "terraform_fmt" },
|
||||
tf = { "terraform_fmt" },
|
||||
["terraform-vars"] = { "terraform_fmt" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -13,15 +13,25 @@ return {
|
||||
-- correctly setup lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = { "jose-elias-alvarez/typescript.nvim" },
|
||||
opts = {
|
||||
-- make sure mason installs the server
|
||||
servers = {
|
||||
---@type lspconfig.options.tsserver
|
||||
tsserver = {
|
||||
keys = {
|
||||
{ "<leader>co", "<cmd>TypescriptOrganizeImports<CR>", desc = "Organize Imports" },
|
||||
{ "<leader>cR", "<cmd>TypescriptRenameFile<CR>", desc = "Rename File" },
|
||||
{
|
||||
"<leader>co",
|
||||
function()
|
||||
vim.lsp.buf.code_action({
|
||||
apply = true,
|
||||
context = {
|
||||
only = { "source.organizeImports.ts" },
|
||||
diagnostics = {},
|
||||
},
|
||||
})
|
||||
end,
|
||||
desc = "Organize Imports",
|
||||
},
|
||||
},
|
||||
settings = {
|
||||
typescript = {
|
||||
@ -44,20 +54,8 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
tsserver = function(_, opts)
|
||||
require("typescript").setup({ server = opts })
|
||||
return true
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sources, require("typescript.extensions.null-ls.code-actions"))
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
optional = true,
|
||||
|
@ -10,13 +10,16 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
-- yaml schema support
|
||||
{
|
||||
"b0o/SchemaStore.nvim",
|
||||
lazy = true,
|
||||
version = false, -- last release is way too old
|
||||
},
|
||||
|
||||
-- correctly setup lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"b0o/SchemaStore.nvim",
|
||||
version = false, -- last release is way too old
|
||||
},
|
||||
opts = {
|
||||
-- make sure mason installs the server
|
||||
servers = {
|
||||
@ -54,6 +57,18 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
yamlls = function()
|
||||
-- Neovim < 0.10 does not have dynamic registration for formatting
|
||||
if vim.fn.has("nvim-0.10") == 0 then
|
||||
require("lazyvim.util").on_attach(function(client, _)
|
||||
if client.name == "yamlls" then
|
||||
client.server_capabilities.documentFormattingProvider = true
|
||||
end
|
||||
end)
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
66
lua/lazyvim/plugins/extras/linting/nvim-lint.lua
Normal file
66
lua/lazyvim/plugins/extras/linting/nvim-lint.lua
Normal file
@ -0,0 +1,66 @@
|
||||
return {
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
event = "BufReadPost",
|
||||
opts = {
|
||||
-- Event to trigger linters
|
||||
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
|
||||
linters_by_ft = {
|
||||
fish = { "fish" },
|
||||
},
|
||||
-- LazyVim extension to easily override linter options
|
||||
-- or add custom linters.
|
||||
---@type table<string,table>
|
||||
linters = {
|
||||
-- -- Example of using selene only when a selene.toml file is present
|
||||
-- selene = {
|
||||
-- -- `condition` is another LazyVim extension that allows you to
|
||||
-- -- dynamically enable/disable linters based on the context.
|
||||
-- condition = function(ctx)
|
||||
-- return vim.fs.find({ "selene.toml" }, { path = ctx.filename, upward = true })[1]
|
||||
-- end,
|
||||
-- },
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local M = {}
|
||||
|
||||
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)
|
||||
end
|
||||
lint.linters_by_ft = opts.linters_by_ft
|
||||
|
||||
function M.debounce(ms, fn)
|
||||
local timer = vim.loop.new_timer()
|
||||
return function(...)
|
||||
local argv = { ... }
|
||||
timer:start(ms, 0, function()
|
||||
timer:stop()
|
||||
vim.schedule_wrap(fn)(unpack(argv))
|
||||
end)
|
||||
end
|
||||
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")
|
||||
names = vim.tbl_filter(function(name)
|
||||
local linter = lint.linters[name]
|
||||
return linter and not (linter.condition and not linter.condition(ctx))
|
||||
end, names)
|
||||
|
||||
if #names > 0 then
|
||||
lint.try_lint(names)
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd(opts.events, {
|
||||
group = vim.api.nvim_create_augroup("nvim-lint", { clear = true }),
|
||||
callback = M.debounce(100, M.lint),
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
@ -5,6 +5,11 @@ local M = {}
|
||||
---@type PluginLspOpts
|
||||
M.opts = nil
|
||||
|
||||
-- Allow plugins to set a custom formatter for a buffer.
|
||||
-- See the conform extra for an example.
|
||||
---@type fun(bufnr:number):boolean
|
||||
M.custom_format = nil
|
||||
|
||||
function M.enabled()
|
||||
return M.opts.autoformat
|
||||
end
|
||||
@ -30,19 +35,27 @@ function M.format(opts)
|
||||
return
|
||||
end
|
||||
|
||||
if
|
||||
M.custom_format
|
||||
and Util.try(function()
|
||||
return M.custom_format(buf)
|
||||
end, { msg = "Custom formatter failed" })
|
||||
then
|
||||
return
|
||||
end
|
||||
|
||||
local formatters = M.get_formatters(buf)
|
||||
local client_ids = vim.tbl_map(function(client)
|
||||
return client.id
|
||||
end, formatters.active)
|
||||
|
||||
if #client_ids == 0 then
|
||||
if opts and opts.force then
|
||||
Util.warn("No formatter available", { title = "LazyVim" })
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if M.opts.format_notify then
|
||||
M.notify(formatters)
|
||||
end
|
||||
|
||||
vim.lsp.buf.format(vim.tbl_deep_extend("force", {
|
||||
bufnr = buf,
|
||||
filter = function(client)
|
||||
@ -51,45 +64,6 @@ function M.format(opts)
|
||||
}, require("lazyvim.util").opts("nvim-lspconfig").format or {}))
|
||||
end
|
||||
|
||||
---@param formatters LazyVimFormatters
|
||||
function M.notify(formatters)
|
||||
local lines = { "# Active:" }
|
||||
|
||||
for _, client in ipairs(formatters.active) do
|
||||
local line = "- **" .. client.name .. "**"
|
||||
if client.name == "null-ls" then
|
||||
line = line
|
||||
.. " ("
|
||||
.. table.concat(
|
||||
vim.tbl_map(function(f)
|
||||
return "`" .. f.name .. "`"
|
||||
end, formatters.null_ls),
|
||||
", "
|
||||
)
|
||||
.. ")"
|
||||
end
|
||||
table.insert(lines, line)
|
||||
end
|
||||
|
||||
if #formatters.available > 0 then
|
||||
table.insert(lines, "")
|
||||
table.insert(lines, "# Disabled:")
|
||||
for _, client in ipairs(formatters.available) do
|
||||
table.insert(lines, "- **" .. client.name .. "**")
|
||||
end
|
||||
end
|
||||
|
||||
vim.notify(table.concat(lines, "\n"), vim.log.levels.INFO, {
|
||||
title = "Formatting",
|
||||
on_open = function(win)
|
||||
vim.api.nvim_win_set_option(win, "conceallevel", 3)
|
||||
vim.api.nvim_win_set_option(win, "spell", false)
|
||||
local buf = vim.api.nvim_win_get_buf(win)
|
||||
vim.treesitter.start(buf, "markdown")
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- Gets all lsp clients that support formatting.
|
||||
-- When a null-ls formatter is available for the current filetype,
|
||||
-- only null-ls formatters are returned.
|
||||
|
@ -41,9 +41,6 @@ return {
|
||||
capabilities = {},
|
||||
-- Automatically format on save
|
||||
autoformat = true,
|
||||
-- Enable this to show formatters used in a notification
|
||||
-- Useful for debugging formatter issues
|
||||
format_notify = false,
|
||||
-- options for vim.lsp.buf.format
|
||||
-- `bufnr` and `filter` is handled by the LazyVim formatter,
|
||||
-- but can be also overridden when specified
|
||||
@ -54,7 +51,6 @@ return {
|
||||
-- LSP Server Settings
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
jsonls = {},
|
||||
lua_ls = {
|
||||
-- mason = false, -- set to false if you don't want this server to be installed with mason
|
||||
-- Use this to add any additional keymaps
|
||||
@ -123,7 +119,7 @@ return {
|
||||
|
||||
if opts.inlay_hints.enabled and inlay_hint then
|
||||
Util.on_attach(function(client, buffer)
|
||||
if client.supports_method('textDocument/inlayHint') then
|
||||
if client.supports_method("textDocument/inlayHint") then
|
||||
inlay_hint(buffer, true)
|
||||
end
|
||||
end)
|
||||
@ -206,7 +202,7 @@ return {
|
||||
|
||||
-- formatters
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
"nvimtools/none-ls.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = { "mason.nvim" },
|
||||
opts = function()
|
||||
|
@ -5,9 +5,6 @@ M._keys = nil
|
||||
|
||||
---@return (LazyKeys|{has?:string})[]
|
||||
function M.get()
|
||||
local format = function()
|
||||
require("lazyvim.plugins.lsp.format").format({ force = true })
|
||||
end
|
||||
if not M._keys then
|
||||
---@class PluginLspKeys
|
||||
-- stylua: ignore
|
||||
@ -28,8 +25,6 @@ function M.get()
|
||||
{ "[e", M.diagnostic_goto(false, "ERROR"), desc = "Prev Error" },
|
||||
{ "]w", M.diagnostic_goto(true, "WARN"), desc = "Next Warning" },
|
||||
{ "[w", M.diagnostic_goto(false, "WARN"), desc = "Prev Warning" },
|
||||
{ "<leader>cf", format, desc = "Format Document", has = "formatting" },
|
||||
{ "<leader>cf", format, desc = "Format Range", mode = "v", has = "rangeFormatting" },
|
||||
{ "<leader>ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" },
|
||||
{
|
||||
"<leader>cA",
|
||||
|
@ -168,23 +168,27 @@ return {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
opts = {
|
||||
-- char = "▏",
|
||||
char = "│",
|
||||
filetype_exclude = {
|
||||
"help",
|
||||
"alpha",
|
||||
"dashboard",
|
||||
"neo-tree",
|
||||
"Trouble",
|
||||
"lazy",
|
||||
"mason",
|
||||
"notify",
|
||||
"toggleterm",
|
||||
"lazyterm",
|
||||
indent = {
|
||||
char = "│",
|
||||
tab_char = "│",
|
||||
},
|
||||
scope = { enabled = false },
|
||||
exclude = {
|
||||
filetypes = {
|
||||
"help",
|
||||
"alpha",
|
||||
"dashboard",
|
||||
"neo-tree",
|
||||
"Trouble",
|
||||
"lazy",
|
||||
"mason",
|
||||
"notify",
|
||||
"toggleterm",
|
||||
"lazyterm",
|
||||
},
|
||||
},
|
||||
show_trailing_blankline_indent = false,
|
||||
show_current_context = false,
|
||||
},
|
||||
main = "ibl",
|
||||
},
|
||||
|
||||
-- Active indent guide and indent text objects. When you're browsing
|
||||
@ -220,7 +224,7 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
-- noicer ui
|
||||
-- Displays a popup with possible key bindings of the command you started typing
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
opts = function(_, opts)
|
||||
@ -229,6 +233,8 @@ return {
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
-- Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu.
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
|
@ -299,4 +299,25 @@ function M.changelog()
|
||||
vim.diagnostic.disable(float.buf)
|
||||
end
|
||||
|
||||
---@param from string
|
||||
---@param to string
|
||||
function M.on_rename(from, to)
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
for _, client in ipairs(clients) do
|
||||
if client:supports_method("workspace/willRenameFiles") then
|
||||
local resp = client.request_sync("workspace/willRenameFiles", {
|
||||
files = {
|
||||
{
|
||||
oldUri = vim.uri_from_fname(from),
|
||||
newUri = vim.uri_from_fname(to),
|
||||
},
|
||||
},
|
||||
}, 1000)
|
||||
if resp and resp.result ~= nil then
|
||||
vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user