Merge branch 'main' into dropbar

This commit is contained in:
Rubin Bhandari 2024-06-10 22:42:12 +05:45 committed by GitHub
commit 50b8d2e9d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 747 additions and 458 deletions

View file

@ -1 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Ask a question or start a discussion
url: https://github.com/LazyVim/LazyVim/discussions
about: Use Github discussions instead

15
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,15 @@
## What is this PR for?
<!-- Describe the big picture of your changes to communicate to the maintainers
why we should accept this pull request. -->
## Does this PR fix an existing issue?
<!--
If this PR fixes any issues, please link to the issue here.
Fixes #<issue_number>
-->
## Checklist
- [ ] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.

11
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

View file

@ -1,5 +1,64 @@
# Changelog
## [12.11.0](https://github.com/LazyVim/LazyVim/compare/v12.10.0...v12.11.0) (2024-06-09)
### Features
* **octo:** re-open octo windows when restoring session + cleanup ([7793942](https://github.com/LazyVim/LazyVim/commit/7793942ebafd32ef90f79e28979898f8013976ff))
### Bug Fixes
* **extra-lang-angular:** add BufNew event to attach angular treesitter ([#3522](https://github.com/LazyVim/LazyVim/issues/3522)) ([fbb1276](https://github.com/LazyVim/LazyVim/commit/fbb1276ffd45683d4d64a2d99907bdbd3421c16f))
* **extras:** +prefix in which-key panel for visual mode ([#3537](https://github.com/LazyVim/LazyVim/issues/3537)) ([5185404](https://github.com/LazyVim/LazyVim/commit/51854046dbb0bacf690ddc217cc76bf98c8ec1aa))
* **helm:** missing dependency ([#3546](https://github.com/LazyVim/LazyVim/issues/3546)) ([02dd65c](https://github.com/LazyVim/LazyVim/commit/02dd65cdea1ae34cdf4ca00b20760dbb3cfcd72b))
* **lang:** neotest not loading rust tests ([#3544](https://github.com/LazyVim/LazyVim/issues/3544)) ([0567b37](https://github.com/LazyVim/LazyVim/commit/0567b37f61d5ad997793b950c38a6c8f73de3b9b))
* **luasnip:** disable nvim-snippets when luasnip is enabled. Fixes [#3547](https://github.com/LazyVim/LazyVim/issues/3547) ([aa059e0](https://github.com/LazyVim/LazyVim/commit/aa059e0d496e570f898644d3f18bc344ca179d38))
* **rust:** make neotest optional ([547dc76](https://github.com/LazyVim/LazyVim/commit/547dc76a12309d4dafc970ae08832140eae51cba))
* **typescript:** clean up configuration of the vscode dap extension ([#3556](https://github.com/LazyVim/LazyVim/issues/3556)) ([1c46f54](https://github.com/LazyVim/LazyVim/commit/1c46f544328b084753327a81b92e2b57ab568321))
* **typescript:** implemented move to new file. Fixes [#3534](https://github.com/LazyVim/LazyVim/issues/3534) ([d90930b](https://github.com/LazyVim/LazyVim/commit/d90930b13e4515a5f4e4f3892ac9f7c392c4f20c))
## [12.10.0](https://github.com/LazyVim/LazyVim/compare/v12.9.0...v12.10.0) (2024-06-07)
### Features
* **prettier:** prettier is now enabled for all supported filetypes and no longer requires a config file by default ([7d50bf0](https://github.com/LazyVim/LazyVim/commit/7d50bf0626f768b4d036b500ff204835fa405b74))
* **prettier:** with the prettier & astro extra, prettier will be enabled if the prettier-astro-plugin is available ([214f5fc](https://github.com/LazyVim/LazyVim/commit/214f5fccdf468030b05851ebfbef8394485322fb))
* **svelte:** with prettier & svelte extra, prettier will be enabled when prettier-plugin-svelte is available ([945143a](https://github.com/LazyVim/LazyVim/commit/945143a34e298541989a9f050a3fb2ced6646e9e))
* **util:** added LazyVim.has_extra ([b714f28](https://github.com/LazyVim/LazyVim/commit/b714f286623cca6e3da31df43c4cf4354a46c36d))
* **util:** added LazyVim.memoize ([5a11d74](https://github.com/LazyVim/LazyVim/commit/5a11d740e119d392858b97b69470201e66e66212))
### Bug Fixes
* **clojure:** removed rainbow delimiters and fixed some plugin setups. Closes [#3530](https://github.com/LazyVim/LazyVim/issues/3530) ([cfa8c9f](https://github.com/LazyVim/LazyVim/commit/cfa8c9fbd45a36784f76d4842bc385828214ee1c))
* **cmp:** don't enable `snippets` source without `nvim-snippets` ([#3527](https://github.com/LazyVim/LazyVim/issues/3527)) ([af80811](https://github.com/LazyVim/LazyVim/commit/af80811be01f5349544a1b21e9dd03f0e25fefca))
* **extras:** load prettier extra before svelte/astro ([4980574](https://github.com/LazyVim/LazyVim/commit/49805748d4cefc077cc0c81e864f1757198fc3f4))
* **formatting:** remove deprecation check on some options ([c16fb5d](https://github.com/LazyVim/LazyVim/commit/c16fb5d49bfe10041fb36f6ac80a755767b9e6bf))
* **prettier:** fixup ([ac9217b](https://github.com/LazyVim/LazyVim/commit/ac9217b1994ad00b488ba73021d89afac03873ee))
## [12.9.0](https://github.com/LazyVim/LazyVim/compare/v12.8.0...v12.9.0) (2024-06-07)
### Features
* **autocmd:** enable spell for typst and text file ([#3505](https://github.com/LazyVim/LazyVim/issues/3505)) ([8ca7245](https://github.com/LazyVim/LazyVim/commit/8ca72451298f60e6440ac48293052c5e82bd8ec6))
* **docs:** add link to LazyVim For Ambitious Developers to README ([#3504](https://github.com/LazyVim/LazyVim/issues/3504)) ([2a5ab31](https://github.com/LazyVim/LazyVim/commit/2a5ab3109a7e5f3ef98c2a93f24738797c6d9cc6))
* **lang:** add clojure support ([#2179](https://github.com/LazyVim/LazyVim/issues/2179)) ([913902b](https://github.com/LazyVim/LazyVim/commit/913902ba362603a4620f8981fdedac7f53816b3a))
* **neo-tree:** added l:open and h:close_node to neo-tree. Closes [#3293](https://github.com/LazyVim/LazyVim/issues/3293) ([dbec83d](https://github.com/LazyVim/LazyVim/commit/dbec83d57a1d5936ac860c37e0393a89b7cae7e9))
* **options:** when available use treesitter spell regions for spell checking ([276b803](https://github.com/LazyVim/LazyVim/commit/276b8032bedb6e1601ae85ecdfaee63217843b4f))
* **sql:** add SQL extra ([#1740](https://github.com/LazyVim/LazyVim/issues/1740)) ([59495c1](https://github.com/LazyVim/LazyVim/commit/59495c18714d8ae4c0b5f7a41dad96e39f9eb189))
### Bug Fixes
* **editor:** telescope init error when trouble.nvim is disabled ([#3518](https://github.com/LazyVim/LazyVim/issues/3518)) ([c452fd7](https://github.com/LazyVim/LazyVim/commit/c452fd730c94bfcbb5f9f4af1cae3c851f9456a3))
* **lualine:** only show one Lualine component for symbols ([#3514](https://github.com/LazyVim/LazyVim/issues/3514)) ([827aa53](https://github.com/LazyVim/LazyVim/commit/827aa5380a883e6a2a9904c253627489d43d3050)), closes [#3511](https://github.com/LazyVim/LazyVim/issues/3511)
* **mini.files:** fix error about `opts.mappings` ([#3507](https://github.com/LazyVim/LazyVim/issues/3507)) ([9210648](https://github.com/LazyVim/LazyVim/commit/92106484ed89efb364568fa27a689bd8be83d066))
* removed leader-m, since it is leading to too many issues. Still available at leader-wm ([119dcb9](https://github.com/LazyVim/LazyVim/commit/119dcb949a84d9b10a620c9ad8400c220c5e5adb))
## [12.8.0](https://github.com/LazyVim/LazyVim/compare/v12.7.0...v12.8.0) (2024-06-06)

28
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,28 @@
# Contributing to LazyVim
## General Guidelines
- Avoid using Vim plugins whenever possible.
- If an extra requires a Vim plugin, explain why in the PR description.
- Ensure all configurations are overridable by the user, using Lazy's specs.
- Tag specs as `optional` if they should only be enabled when the user has them installed.
- Implement proper lazy-loading for every plugin added in an extra.
- Understand how Lazy's dependencies work. For Lua dependencies, do not specify
them in the `dependencies` field. Instead, add them as a separate spec with `lazy=true`.
## Contributing an Extra Plugin
- The plugin should be well-known and require significant configuration.
- Simple specs containing just the plugin with some options will not be accepted.
## Contributing an Extra Language
- The extra should include the setup most widely used by the community.
- Include Tree-sitter parsers that are not yet the default.
- Include the most widely used LSP server setup.
- Avoid the need for LSP wrapper packages whenever possible.
- Only add a formatter if it is typically used by the community instead of the LSP formatter.
- Only add extra linters if the community typically uses them instead of just the LSP linters.
- Every language extra requires a `recommended` section as part of the extra.
Check lspconfig server configurations for the proper filetypes and root directories.
Refer to other extras for creating the `recommended` section.

27
NEWS.md
View file

@ -1,6 +1,19 @@
# What's new?
## 11.x
## 12.x
- This **news** is now also available on the website at [https://www.lazyvim.org/news](https://www.lazyvim.org/news)
- **prettier** extra now works for all prettier supported filetypes
and will be enabled for astro/svelte extra if you have a proper
config file with the correct prettier plugin
- **New Language Support:** SQL, Clojure, Thrift, Elm, Gleam, Angular,
NuShell, Svelte, Kotlin, Astro, Toml and PHP
- **New Extras:** `copilot-chat`, `git`, `octo`, `inc-rename` and `neogen`
- The **typescript** extra now uses `vtsls` instead of `tsserver`
- **Neovim >= 0.10** now uses the much faster [lazydev.nvim](https://github.com/folke/lazydev.nvim)
instead of `neodev.nvim`
@ -8,6 +21,18 @@
- moved `neoconf.nvim` to extras. Project specific LSP settings
can be done with a `.lazy.lua` file instead.
## 11.x
- **Keymaps:**
- `<leader>gB` to open the current repo in the browser
- `gco` and `gcO` to add a comment below or above the current line
- `<leader>wm` to toggle window maximize
- **lazydev.nvim:** faster alternative to `neodev.nvim`
- **Options:** Added `linebreak=true` to default options.
- `mini.ai` is back as a default plugin! Removing it was a mistake.
It's a great plugin that enhances the native text objects.

View file

@ -115,6 +115,10 @@ There's a great video created by [@elijahmanor](https://github.com/elijahmanor)
[![Watch the video](https://img.youtube.com/vi/N93cTbtLCIM/hqdefault.jpg)](https://www.youtube.com/watch?v=N93cTbtLCIM)
[@dusty-phillips](https://github.com/dusty-phillips) is working on a book called
[LazyVim for Ambitious Developers](https://lazyvim-ambitious-devs.phillips.codes)
available for free online.
## 📂 File Structure
The files under config will be automatically loaded at the appropriate time,

View file

@ -1,4 +1,4 @@
*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 June 06
*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 June 10
==============================================================================
Table of Contents *LazyVim-table-of-contents*
@ -102,6 +102,10 @@ Theres a great video created by @elijahmanor
<https://www.youtube.com/watch?v=N93cTbtLCIM>
@dusty-phillips <https://github.com/dusty-phillips> is working on a book called
LazyVim for Ambitious Developers
<https://lazyvim-ambitious-devs.phillips.codes> available for free online.
FILE STRUCTURE *LazyVim-file-structure*
@ -125,6 +129,7 @@ Refer to the docs <https://lazyvim.github.io>
2. *image*: https://user-images.githubusercontent.com/292349/213447056-92290767-ea16-430c-8727-ce994c93e9cc.png
3. *@elijahmanor*:
4. *Watch the video*: https://img.youtube.com/vi/N93cTbtLCIM/hqdefault.jpg
5. *@dusty-phillips*:
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

View file

@ -66,6 +66,7 @@ vim.api.nvim_create_autocmd("FileType", {
"checkhealth",
"neotest-summary",
"neotest-output-panel",
"dbout",
},
callback = function(event)
vim.bo[event.buf].buflisted = false
@ -85,7 +86,7 @@ vim.api.nvim_create_autocmd("FileType", {
-- wrap and check for spell in text filetypes
vim.api.nvim_create_autocmd("FileType", {
group = augroup("wrap_spell"),
pattern = { "gitcommit", "markdown" },
pattern = { "*.txt", "*.tex", "*.typ", "gitcommit", "markdown" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true

View file

@ -182,7 +182,6 @@ map("n", "<leader>w|", "<C-W>v", { desc = "Split Window Right", remap = true })
map("n", "<leader>-", "<C-W>s", { desc = "Split Window Below", remap = true })
map("n", "<leader>|", "<C-W>v", { desc = "Split Window Right", remap = true })
map("n", "<leader>wm", function() LazyVim.toggle.maximize() end, { desc = "Maximize Toggle" })
map("n", "<leader>m", function() LazyVim.toggle.maximize() end, { desc = "Maximize Toggle" })
-- tabs
map("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" })

View file

@ -82,6 +82,7 @@ opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift t
opt.smartcase = true -- Don't ignore case with capitals
opt.smartindent = true -- Insert indents automatically
opt.spelllang = { "en" }
opt.spelloptions:append("noplainbuffer")
opt.splitbelow = true -- Put new windows below current
opt.splitkeep = "screen"
opt.splitright = true -- Put new windows right of current

View file

@ -19,7 +19,6 @@ return {
-- auto_brackets = { "python" }
-- }
-- ```
opts = function()
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
local cmp = require("cmp")
@ -112,7 +111,9 @@ return {
return LazyVim.cmp.expand(item.body)
end,
}
table.insert(opts.sources, { name = "snippets" })
if LazyVim.has("nvim-snippets") then
table.insert(opts.sources, { name = "snippets" })
end
end,
keys = {
{

View file

@ -72,6 +72,8 @@ return {
},
window = {
mappings = {
["l"] = "open",
["h"] = "close_node",
["<space>"] = "none",
["Y"] = {
function(state)
@ -238,7 +240,9 @@ return {
opts = function()
local actions = require("telescope.actions")
local open_with_trouble = require("trouble.sources.telescope").open
local open_with_trouble = function(...)
return require("trouble.sources.telescope").open(...)
end
local find_files_no_ignore = function()
local action_state = require("telescope.actions.state")
local line = action_state.get_current_line()

View file

@ -66,10 +66,8 @@ return {
-- attach cmp source whenever copilot attaches
-- fixes lazy-loading issues with the copilot cmp source
LazyVim.lsp.on_attach(function(client)
if client.name == "copilot" then
copilot_cmp._on_insert_enter({})
end
end)
copilot_cmp._on_insert_enter({})
end, "copilot")
end,
},
},

View file

@ -46,4 +46,8 @@ return {
{ "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } },
},
},
{
"garymjr/nvim-snippets",
enabled = false,
},
}

View file

@ -53,7 +53,7 @@ return {
-- stylua: ignore
keys = {
{ "<leader>d", "", desc = "+debug" },
{ "<leader>d", "", desc = "+debug", mode = {"n", "v"} },
{ "<leader>dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" },
{ "<leader>db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" },
{ "<leader>dc", function() require("dap").continue() end, desc = "Continue" },
@ -87,16 +87,10 @@ return {
-- setup dap config by VsCode launch.json file
local vscode = require("dap.ext.vscode")
local _filetypes = require("mason-nvim-dap.mappings.filetypes")
local filetypes = vim.tbl_deep_extend("force", _filetypes, {
["node"] = { "javascriptreact", "typescriptreact", "typescript", "javascript" },
["pwa-node"] = { "javascriptreact", "typescriptreact", "typescript", "javascript" },
})
local json = require("plenary.json")
vscode.json_decode = function(str)
return vim.json.decode(json.json_strip_comments(str))
end
vscode.load_launchjs(nil, filetypes)
end,
},

View file

@ -104,27 +104,29 @@ return {
"nvim-lualine/lualine.nvim",
optional = true,
opts = function(_, opts)
table.insert(opts.sections.lualine_c, {
"aerial",
sep = " ", -- separator between symbols
sep_icon = "", -- separator between icon and symbol
if not vim.g.trouble_lualine then
table.insert(opts.sections.lualine_c, {
"aerial",
sep = " ", -- separator between symbols
sep_icon = "", -- separator between icon and symbol
-- 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,
-- 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,
-- 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 = ".",
-- The separator to be used to separate symbols in dense mode.
dense_sep = ".",
-- Color the symbol icons.
colored = true,
})
-- Color the symbol icons.
colored = true,
})
end
end,
},
}

View file

@ -1,6 +1,14 @@
return {
"echasnovski/mini.files",
opts = {
mappings = {
toggle_hidden = "g.",
change_cwd = "gc",
go_in_horizontal = "<C-w>s",
go_in_vertical = "<C-w>v",
go_in_horizontal_plus = "<C-w>S",
go_in_vertical_plus = "<C-w>V",
},
windows = {
preview = true,
width_focus = 30,
@ -82,22 +90,17 @@ return {
vim.keymap.set(
"n",
opts.mappings.toggle_hidden or "g.",
opts.mappings.toggle_hidden,
toggle_dotfiles,
{ buffer = buf_id, desc = "Toggle hidden files" }
)
vim.keymap.set(
"n",
opts.mappings.change_cwd or "gc",
files_set_cwd,
{ buffer = args.data.buf_id, desc = "Set cwd" }
)
vim.keymap.set("n", opts.mappings.change_cwd, files_set_cwd, { buffer = args.data.buf_id, desc = "Set cwd" })
map_split(buf_id, opts.mappings.go_in_horizontal or "<C-w>s", "horizontal", false)
map_split(buf_id, opts.mappings.go_in_vertical or "<C-w>v", "vertical", false)
map_split(buf_id, opts.mappings.go_in_horizontal_plus or "<C-w>S", "horizontal", true)
map_split(buf_id, opts.mappings.go_in_vertical_plus or "<C-w>V", "vertical", true)
map_split(buf_id, opts.mappings.go_in_horizontal, "horizontal", false)
map_split(buf_id, opts.mappings.go_in_vertical, "vertical", false)
map_split(buf_id, opts.mappings.go_in_horizontal_plus, "horizontal", true)
map_split(buf_id, opts.mappings.go_in_vertical_plus, "vertical", true)
end,
})

View file

@ -29,14 +29,16 @@ return {
"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,
})
if not vim.g.trouble_lualine then
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
end,
},
}

View file

@ -7,7 +7,7 @@ return {
"nvim-treesitter/nvim-treesitter",
},
keys = {
{ "<leader>r", "", desc = "+refactor" },
{ "<leader>r", "", desc = "+refactor", mode = { "n", "v" } },
{
"<leader>rs",
function()

View file

@ -1,23 +1,88 @@
---@diagnostic disable: inject-field
if lazyvim_docs then
-- By default, prettier will only be used for formatting
-- if a prettier configuration file is found in the project.
-- Set to `false` to always use prettier for supported filetypes.
vim.g.lazyvim_prettier_needs_config = true
-- Enable the option to require a Prettier config file
-- If no prettier config file is found, the formatter will not be used
vim.g.lazyvim_prettier_needs_config = false
end
local needs_config = vim.g.lazyvim_prettier_needs_config ~= false
---@alias ConformCtx {buf: number, filename: string, dirname: string}
local M = {}
-- local check = vim.g.lazyvim_prettier
local supported = {
"css",
"graphql",
"handlebars",
"html",
"javascript",
"javascriptreact",
"json",
"jsonc",
"less",
"markdown",
"markdown.mdx",
"scss",
"typescript",
"typescriptreact",
"vue",
"yaml",
}
local enabled = {} ---@type table<string, boolean>
--- Checks if a Prettier config file exists for the given context
---@param ctx ConformCtx
function M.has_config(ctx)
vim.fn.system({ "prettier", "--find-config-path", ctx.filename })
return vim.v.shell_error == 0
end
--- Checks if a parser can be inferred for the given context:
--- * If the filetype is in the supported list, return true
--- * Otherwise, check if a parser can be inferred
---@param ctx ConformCtx
function M.has_parser(ctx)
local ft = vim.bo[ctx.buf].filetype --[[@as string]]
-- default filetypes are always supported
if vim.tbl_contains(supported, ft) then
return true
end
-- otherwise, check if a parser can be inferred
local ret = vim.fn.system({ "prettier", "--file-info", ctx.filename })
---@type boolean, string?
local ok, parser = pcall(function()
return vim.fn.json_decode(ret).inferredParser
end)
return ok and parser and parser ~= vim.NIL
end
M.has_config = LazyVim.memoize(M.has_config)
M.has_parser = LazyVim.memoize(M.has_parser)
return {
{
"williamboman/mason.nvim",
opts = { ensure_installed = { "prettier" } },
},
-- conform
{
"stevearc/conform.nvim",
optional = true,
---@param opts ConformOpts
opts = function(_, opts)
table.insert(opts.ensure_installed, "prettier")
opts.formatters_by_ft = opts.formatters_by_ft or {}
for _, ft in ipairs(supported) do
opts.formatters_by_ft[ft] = { "prettier" }
end
opts.formatters = opts.formatters or {}
opts.formatters.prettier = {
condition = function(_, ctx)
return M.has_parser(ctx) and (vim.g.lazyvim_prettier_needs_config ~= true or M.has_config(ctx))
end,
}
end,
},
-- none-ls support
{
"nvimtools/none-ls.nvim",
optional = true,
@ -27,43 +92,4 @@ return {
table.insert(opts.sources, nls.builtins.formatting.prettier)
end,
},
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
["javascript"] = { "prettier" },
["javascriptreact"] = { "prettier" },
["typescript"] = { "prettier" },
["typescriptreact"] = { "prettier" },
["vue"] = { "prettier" },
["css"] = { "prettier" },
["scss"] = { "prettier" },
["less"] = { "prettier" },
["html"] = { "prettier" },
["json"] = { "prettier" },
["jsonc"] = { "prettier" },
["yaml"] = { "prettier" },
["markdown"] = { "prettier" },
["markdown.mdx"] = { "prettier" },
["graphql"] = { "prettier" },
["handlebars"] = { "prettier" },
["svelte"] = { "prettier" },
},
formatters = {
prettier = {
condition = function(_, ctx)
if not needs_config then
return true
end
if enabled[ctx.filename] == nil then
vim.fn.system({ "prettier", "--find-config-path", ctx.filename })
enabled[ctx.filename] = vim.v.shell_error == 0
end
return enabled[ctx.filename]
end,
},
},
},
},
}

View file

@ -14,7 +14,7 @@ return {
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "angular", "scss" })
end
vim.api.nvim_create_autocmd("BufRead", {
vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
pattern = { "*.component.html", "*.container.html" },
callback = function()
vim.treesitter.start(nil, "angular")
@ -36,11 +36,9 @@ return {
setup = {
angularls = function()
LazyVim.lsp.on_attach(function(client)
if client.name == "angularls" then
--HACK: disable angular renaming capability due to duplicate rename popping up
client.server_capabilities.renameProvider = false
end
end)
--HACK: disable angular renaming capability due to duplicate rename popping up
client.server_capabilities.renameProvider = false
end, "angularls")
end,
},
},

View file

@ -7,11 +7,7 @@ return {
end,
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
-- for ansiblels validation
vim.list_extend(opts.ensure_installed, { "ansible-lint" })
end,
opts = { ensure_installed = { "ansible-lint" } },
},
{
"neovim/nvim-lspconfig",

View file

@ -15,11 +15,7 @@ return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "astro" })
end
end,
opts = { ensure_installed = { "astro" } },
},
-- LSP Servers
@ -45,4 +41,14 @@ return {
})
end,
},
{
"conform.nvim",
opts = function(_, opts)
if LazyVim.has_extra("formatting.prettier") then
opts.formatters_by_ft = opts.formatters_by_ft or {}
opts.formatters_by_ft.astro = { "prettier" }
end
end,
},
}

View file

@ -16,11 +16,7 @@ return {
-- Add C/C++ to treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "cpp" })
end
end,
opts = { ensure_installed = { "cpp" } },
},
{
@ -120,11 +116,7 @@ return {
-- Ensure C/C++ debugger is installed
"williamboman/mason.nvim",
optional = true,
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "codelldb" })
end
end,
opts = { ensure_installed = { "codelldb" } },
},
opts = function()
local dap = require("dap")

View file

@ -0,0 +1,99 @@
return {
recommended = function()
return LazyVim.extras.wants({
ft = { "clojure", "edn" },
root = { "project.clj", "deps.edn", "build.boot", "shadow-cljs.edn", "bb.edn" },
})
end,
-- Add Clojure & related to treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = { ensure_installed = { "clojure" } },
},
-- Extend auto completion
{
"hrsh7th/nvim-cmp",
optional = true,
dependencies = {
"PaterJason/cmp-conjure",
},
opts = function(_, opts)
if type(opts.sources) == "table" then
vim.list_extend(opts.sources, { name = "clojure" })
end
end,
},
-- Add s-exp mappings
{ "PaterJason/nvim-treesitter-sexp", opts = {}, event = "LazyFile" },
-- Colorize the output of the log buffer
{
"m00qek/baleia.nvim",
opts = {
line_starts_at = 3,
},
config = function(_, opts)
vim.g.conjure_baleia = require("baleia").setup(opts)
vim.api.nvim_create_user_command("BaleiaColorize", function()
vim.g.conjure_baleia.once(vim.api.nvim_get_current_buf())
end, { bang = true })
vim.api.nvim_create_user_command("BaleiaLogs", vim.g.conjure_baleia.logger.show, { bang = true })
end,
},
-- Use Clojure REPL
{
"Olical/conjure",
event = "LazyFile",
config = function(_, _)
require("conjure.main").main()
require("conjure.mapping")["on-filetype"]()
end,
init = function()
-- print color codes if baleia.nvim is available
local colorize = require("lazyvim.util").has("baleia.nvim")
if colorize then
vim.g["conjure#log#strip_ansi_escape_sequences_line_limit"] = 0
else
vim.g["conjure#log#strip_ansi_escape_sequences_line_limit"] = 1
end
-- disable diagnostics in log buffer and colorize it
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
pattern = "conjure-log-*",
callback = function()
local buffer = vim.api.nvim_get_current_buf()
vim.diagnostic.enable(false, { bufnr = buffer })
if colorize and vim.g.conjure_baleia then
vim.g.conjure_baleia.automatically(buffer)
end
vim.keymap.set(
{ "n", "v" },
"[c",
"<CMD>call search('^; -\\+$', 'bw')<CR>",
{ silent = true, buffer = true, desc = "Jumps to the begining of previous evaluation output." }
)
vim.keymap.set(
{ "n", "v" },
"]c",
"<CMD>call search('^; -\\+$', 'w')<CR>",
{ silent = true, buffer = true, desc = "Jumps to the begining of next evaluation output." }
)
end,
})
-- prefer LSP for jump-to-definition and symbol-doc, and use conjure
-- alternatives with <localleader>K and <localleader>gd
vim.g["conjure#mapping#doc_word"] = "K"
vim.g["conjure#mapping#def_word"] = "gd"
end,
},
}

View file

@ -7,11 +7,7 @@ return {
end,
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "cmake" })
end
end,
opts = { ensure_installed = { "cmake" } },
},
{
"nvimtools/none-ls.nvim",
@ -34,10 +30,7 @@ return {
},
{
"mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "cmakelang", "cmakelint" })
end,
opts = { ensure_installed = { "cmakelang", "cmakelint" } },
},
{
"neovim/nvim-lspconfig",

View file

@ -7,18 +7,11 @@ return {
end,
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "dockerfile" })
end
end,
opts = { ensure_installed = { "dockerfile" } },
},
{
"mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "hadolint" })
end,
opts = { ensure_installed = { "hadolint" } },
},
{
"nvimtools/none-ls.nvim",

View file

@ -7,13 +7,7 @@ return {
end,
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"elixir",
"heex",
"eex",
})
end,
opts = { ensure_installed = { "elixir", "heex", "eex" } },
},
{
"nvim-neotest/neotest",

View file

@ -6,19 +6,12 @@ return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "elm" })
end
end,
opts = { ensure_installed = { "elm" } },
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "elm-format" })
end,
opts = { ensure_installed = { "elm-format" } },
},
{

View file

@ -5,19 +5,13 @@ return {
-- Treesitter git support
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "git_config", "gitcommit", "git_rebase", "gitignore", "gitattributes" })
end,
opts = { ensure_installed = { "git_config", "gitcommit", "git_rebase", "gitignore", "gitattributes" } },
},
{
"nvim-cmp",
dependencies = {
{
"petertriho/cmp-git",
opts = {},
},
{ "petertriho/cmp-git", opts = {} },
},
---@module 'cmp'
---@param opts cmp.ConfigSchema

View file

@ -6,11 +6,7 @@ return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "gleam" })
end
end,
opts = { ensure_installed = { "gleam" } },
},
{

View file

@ -7,14 +7,7 @@ return {
end,
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"go",
"gomod",
"gowork",
"gosum",
})
end,
opts = { ensure_installed = { "go", "gomod", "gowork", "gosum" } },
},
{
"neovim/nvim-lspconfig",
@ -68,20 +61,18 @@ return {
-- workaround for gopls not supporting semanticTokensProvider
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242
LazyVim.lsp.on_attach(function(client, _)
if client.name == "gopls" then
if not client.server_capabilities.semanticTokensProvider then
local semantic = client.config.capabilities.textDocument.semanticTokens
client.server_capabilities.semanticTokensProvider = {
full = true,
legend = {
tokenTypes = semantic.tokenTypes,
tokenModifiers = semantic.tokenModifiers,
},
range = true,
}
end
if not client.server_capabilities.semanticTokensProvider then
local semantic = client.config.capabilities.textDocument.semanticTokens
client.server_capabilities.semanticTokensProvider = {
full = true,
legend = {
tokenTypes = semantic.tokenTypes,
tokenModifiers = semantic.tokenModifiers,
},
range = true,
}
end
end)
end, "gopls")
-- end workaround
end,
},
@ -90,10 +81,7 @@ return {
-- Ensure Go tools are installed
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "goimports", "gofumpt" })
end,
opts = { ensure_installed = { "goimports", "gofumpt" } },
},
{
"nvimtools/none-ls.nvim",
@ -101,10 +89,7 @@ return {
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl" })
end,
opts = { ensure_installed = { "gomodifytags", "impl" } },
},
},
opts = function(_, opts)
@ -132,10 +117,7 @@ return {
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "delve" })
end,
opts = { ensure_installed = { "delve" } },
},
{
"leoluz/nvim-dap-go",

View file

@ -9,11 +9,7 @@ return {
-- Add Haskell to treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "haskell" })
end
end,
opts = { ensure_installed = { "haskell" } },
},
{
@ -33,10 +29,7 @@ return {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "haskell-language-server" })
end,
opts = { ensure_installed = { "haskell-language-server" } },
},
{
@ -45,10 +38,7 @@ return {
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "haskell-debug-adapter" })
end,
opts = { ensure_installed = { "haskell-debug-adapter" } },
},
},
},

View file

@ -1,13 +1,3 @@
LazyVim.lsp.on_attach(function(client, buffer)
if client.name == "yamlls" then
if vim.api.nvim_get_option_value("filetype", { buf = buffer }) == "helm" then
vim.schedule(function()
vim.cmd("LspStop ++force yamlls")
end)
end
end
end)
return {
recommended = function()
return LazyVim.extras.wants({
@ -17,13 +7,28 @@ return {
end,
{ "towolf/vim-helm", ft = "helm" },
{
"nvim-treesitter/nvim-treesitter",
opts = { ensure_installed = { "helm" } },
},
{
"neovim/nvim-lspconfig",
opts = {
servers = {
yamlls = {},
helm_ls = {},
},
setup = {
yamlls = function()
LazyVim.lsp.on_attach(function(client, buffer)
if vim.bo[buffer].filetype == "helm" then
vim.schedule(function()
vim.cmd("LspStop ++force yamlls")
end)
end
end, "yamlls")
end,
},
},
},
}

View file

@ -33,10 +33,7 @@ return {
-- Add java to treesitter.
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "java" })
end,
opts = { ensure_installed = { "java" } },
},
-- Ensure java debugger and test packages are installed.
@ -46,10 +43,7 @@ return {
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "java-test", "java-debug-adapter" })
end,
opts = { ensure_installed = { "java-debug-adapter", "java-test" } },
},
},
},

View file

@ -9,11 +9,7 @@ return {
-- add json to treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "json5" })
end
end,
opts = { ensure_installed = { "json5" } },
},
-- yaml schema support

View file

@ -15,16 +15,12 @@ return {
-- Add packages(linting, debug adapter)
{
"williamboman/mason.nvim",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed or {}, { "ktlint" })
end,
opts = { ensure_installed = { "ktlint" } },
},
-- Add syntax highlighting
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed or {}, { "kotlin" })
end,
opts = { ensure_installed = { "kotlin" } },
},
-- Add language server
{

View file

@ -17,10 +17,7 @@ return {
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "markdownlint", "markdown-toc" })
end,
opts = { ensure_installed = { "markdownlint", "markdown-toc" } },
},
{
"nvimtools/none-ls.nvim",

View file

@ -5,10 +5,7 @@ return {
},
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "nix" })
end,
opts = { ensure_installed = { "nix" } },
},
{
"neovim/nvim-lspconfig",

View file

@ -9,11 +9,7 @@ return {
{ "Hoffs/omnisharp-extended-lsp.nvim", lazy = true },
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "c_sharp" })
end
end,
opts = { ensure_installed = { "c_sharp" } },
},
{
"nvimtools/none-ls.nvim",
@ -41,11 +37,7 @@ return {
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "netcoredbg", "csharpier" })
end
end,
opts = { ensure_installed = { "csharpier", "netcoredbg" } },
},
{
"neovim/nvim-lspconfig",

View file

@ -6,9 +6,7 @@ return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "php" })
end,
opts = { ensure_installed = { "php" } },
},
{
@ -25,11 +23,7 @@ return {
optional = true,
dependencies = {
"williamboman/mason.nvim",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
table.insert(opts.ensure_installed, "php-debug-adapter")
end
end,
opts = { ensure_installed = { "php-debug-adapter" } },
},
opts = function()
local dap = require("dap")

View file

@ -24,11 +24,7 @@ return {
end,
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "ninja", "rst" })
end
end,
opts = { ensure_installed = { "ninja", "rst" } },
},
{
"neovim/nvim-lspconfig",
@ -62,11 +58,9 @@ return {
setup = {
[ruff] = function()
LazyVim.lsp.on_attach(function(client, _)
if client.name == ruff then
-- Disable hover in favor of Pyright
client.server_capabilities.hoverProvider = false
end
end)
-- Disable hover in favor of Pyright
client.server_capabilities.hoverProvider = false
end, ruff)
end,
},
},

View file

@ -59,11 +59,7 @@ return {
},
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "r", "rnoweb" })
end
end,
opts = { ensure_installed = { "r", "rnoweb" } },
},
{
"neovim/nvim-lspconfig",

View file

@ -7,11 +7,7 @@ return {
end,
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"ruby",
})
end,
opts = { ensure_installed = { "ruby" } },
},
{
"neovim/nvim-lspconfig",

View file

@ -30,20 +30,14 @@ return {
-- Add Rust & related to treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "ron", "rust" })
end,
opts = { ensure_installed = { "rust", "ron" } },
},
-- Ensure Rust debugger is installed
{
"williamboman/mason.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "codelldb" })
end,
opts = { ensure_installed = { "codelldb" } },
},
{
@ -126,11 +120,10 @@ return {
{
"nvim-neotest/neotest",
optional = true,
opts = function(_, opts)
opts.adapters = opts.adapters or {}
vim.list_extend(opts.adapters, {
require("rustaceanvim.neotest"),
})
end,
opts = {
adapters = {
["rustaceanvim.neotest"] = {},
},
},
},
}

View file

@ -7,11 +7,7 @@ return {
end,
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "scala" })
end
end,
opts = { ensure_installed = { "scala" } },
},
{
"scalameta/nvim-metals",

View file

@ -0,0 +1,123 @@
local sql_ft = { "sql", "mysql", "plsql" }
return {
recommended = function()
return LazyVim.extras.wants({
ft = sql_ft,
})
end,
{
"tpope/vim-dadbod",
cmd = "DB",
},
{
"kristijanhusak/vim-dadbod-completion",
dependencies = "vim-dadbod",
ft = sql_ft,
init = function()
vim.api.nvim_create_autocmd("FileType", {
pattern = sql_ft,
callback = function()
local cmp = require("cmp")
-- global sources
---@param source cmp.SourceConfig
local sources = vim.tbl_map(function(source)
return { name = source.name }
end, cmp.get_config().sources)
-- add vim-dadbod-completion source
table.insert(sources, { name = "vim-dadbod-completion" })
-- update sources for the current buffer
cmp.setup.buffer({ sources = sources })
end,
})
end,
},
{
"kristijanhusak/vim-dadbod-ui",
cmd = { "DBUI", "DBUIToggle", "DBUIAddConnection", "DBUIFindBuffer" },
dependencies = "vim-dadbod",
keys = {
{ "<leader>D", "<cmd>DBUIToggle<CR>", desc = "Toggle DBUI" },
},
init = function()
local data_path = vim.fn.stdpath("data")
vim.g.db_ui_auto_execute_table_helpers = 1
vim.g.db_ui_save_location = data_path .. "/dadbod_ui"
vim.g.db_ui_show_database_icon = true
vim.g.db_ui_tmp_query_location = data_path .. "/dadbod_ui/tmp"
vim.g.db_ui_use_nerd_fonts = true
vim.g.db_ui_use_nvim_notify = true
-- NOTE: The default behavior of auto-execution of queries on save is disabled
-- this is useful when you have a big query that you don't want to run every time
-- you save the file running those queries can crash neovim to run use the
-- default keymap: <leader>S
vim.g.db_ui_execute_on_save = false
end,
},
-- Treesitter
{
"nvim-treesitter/nvim-treesitter",
optional = true,
opts = { ensure_installed = { "sql" } },
},
-- Edgy integration
{
"folke/edgy.nvim",
optional = true,
opts = function(_, opts)
table.insert(opts.right, {
title = "Database",
ft = "dbui",
pinned = true,
width = 0.3,
open = function()
vim.cmd("DBUI")
end,
})
table.insert(opts.bottom, {
title = "DB Query Result",
ft = "dbout",
})
end,
},
-- Linters & formatters
{
"williamboman/mason.nvim",
opts = { ensure_installed = { "sqlfluff" } },
},
{
"mfussenegger/nvim-lint",
optional = true,
opts = function(_, opts)
for _, ft in ipairs(sql_ft) do
opts.linters_by_ft[ft] = opts.linters_by_ft[ft] or {}
table.insert(opts.linters_by_ft[ft], "sqlfluff")
end
end,
},
{
"stevearc/conform.nvim",
optional = true,
opts = function(_, opts)
opts.formatters.sqlfluff = {
args = { "format", "--dialect=ansi", "-" },
}
for _, ft in ipairs(sql_ft) do
opts.formatters_by_ft[ft] = opts.formatters_by_ft[ft] or {}
table.insert(opts.formatters_by_ft[ft], "sqlfluff")
end
end,
},
}

View file

@ -15,11 +15,7 @@ return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "svelte" })
end
end,
opts = { ensure_installed = { "svelte" } },
},
-- LSP Servers
@ -58,4 +54,14 @@ return {
})
end,
},
{
"conform.nvim",
opts = function(_, opts)
if LazyVim.has_extra("formatting.prettier") then
opts.formatters_by_ft = opts.formatters_by_ft or {}
opts.formatters_by_ft.svelte = { "prettier" }
end
end,
},
}

View file

@ -8,14 +8,7 @@ return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, {
"terraform",
"hcl",
})
end
end,
opts = { ensure_installed = { "terraform", "hcl" } },
},
{
"neovim/nvim-lspconfig",
@ -28,10 +21,7 @@ return {
-- ensure terraform tools are installed
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "tflint" })
end,
opts = { ensure_installed = { "tflint" } },
},
{
"nvimtools/none-ls.nvim",

View file

@ -5,11 +5,7 @@ return {
},
{
"nvim-treesitter",
optional = true,
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "thrift" })
end,
opts = { ensure_installed = { "thrift" } },
},
{
"nvim-lspconfig",

View file

@ -119,6 +119,56 @@ return {
return true
end,
vtsls = function(_, opts)
LazyVim.lsp.on_attach(function(client, buffer)
client.commands["_typescript.moveToFileRefactoring"] = function(command, ctx)
---@type string, string, lsp.Range
local action, uri, range = unpack(command.arguments)
local function move(newf)
client.request("workspace/executeCommand", {
command = command.command,
arguments = { action, uri, range, newf },
})
end
local fname = vim.uri_to_fname(uri)
client.request("workspace/executeCommand", {
command = "typescript.tsserverRequest",
arguments = {
"getMoveToRefactoringFileSuggestions",
{
file = fname,
startLine = range.start.line + 1,
startOffset = range.start.character + 1,
endLine = range["end"].line + 1,
endOffset = range["end"].character + 1,
},
},
}, function(_, result)
---@type string[]
local files = result.body.files
table.insert(files, 1, "Enter new path...")
vim.ui.select(files, {
prompt = "Select move destination:",
format_item = function(f)
return vim.fn.fnamemodify(f, ":~:.")
end,
}, function(f)
if f and f:find("^Enter new path") then
vim.ui.input({
prompt = "Enter move destination:",
default = vim.fn.fnamemodify(fname, ":h") .. "/",
completion = "file",
}, function(newf)
return newf and move(newf)
end)
elseif f then
move(f)
end
end)
end)
end
end, "vtsls")
-- copy typescript settings to javascript
opts.settings.javascript =
vim.tbl_deep_extend("force", {}, opts.settings.typescript, opts.settings.javascript or {})
@ -170,7 +220,13 @@ return {
end
end
for _, language in ipairs({ "typescript", "javascript", "typescriptreact", "javascriptreact" }) do
local js_filetypes = { "typescript", "javascript", "typescriptreact", "javascriptreact" }
local vscode = require("dap.ext.vscode")
vscode.type_to_filetypes["node"] = js_filetypes
vscode.type_to_filetypes["pwa-node"] = js_filetypes
for _, language in ipairs(js_filetypes) do
if not dap.configurations[language] then
dap.configurations[language] = {
{

View file

@ -11,11 +11,7 @@ return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "vue" })
end
end,
opts = { ensure_installed = { "vue" } },
},
-- Add LSP servers

View file

@ -60,10 +60,8 @@ return {
-- Neovim < 0.10 does not have dynamic registration for formatting
if vim.fn.has("nvim-0.10") == 0 then
LazyVim.lsp.on_attach(function(client, _)
if client.name == "yamlls" then
client.server_capabilities.documentFormattingProvider = true
end
end)
client.server_capabilities.documentFormattingProvider = true
end, "yamlls")
end
end,
},

View file

@ -19,10 +19,7 @@ return {
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "shellcheck" })
end,
opts = { ensure_installed = { "shellcheck" } },
},
-- add some stuff to treesitter
{

View file

@ -3,6 +3,7 @@ return {
-- Ensure GitUI tool is installed
{
"williamboman/mason.nvim",
opts = { ensure_installed = { "gitui" } },
keys = {
{
"<leader>gG",
@ -30,9 +31,5 @@ return {
end,
})
end,
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "gitui" })
end,
},
}

View file

@ -18,20 +18,20 @@ return {
picker = "telescope",
},
keys = {
{ "<leader>gi", "<cmd>Octo issue list<CR>", desc = "List Isues (Octo)" },
{ "<leader>gI", "<cmd>Octo issue search<CR>", desc = "Search Isues (Octo)" },
{ "<leader>gi", "<cmd>Octo issue list<CR>", desc = "List Issues (Octo)" },
{ "<leader>gI", "<cmd>Octo issue search<CR>", desc = "Search Issues (Octo)" },
{ "<leader>gp", "<cmd>Octo pr list<CR>", desc = "List PRs (Octo)" },
{ "<leader>gP", "<cmd>Octo pr search<CR>", desc = "Search PRs (Octo)" },
{ "<leader>gr", "<cmd>Octo repo list<CR>", desc = "List Repos (Octo)" },
{ "<leader>gS", "<cmd>Octo search<CR>", desc = "Search (Octo)" },
{ "<leader>a", "", desc = "+assignee (Otco)", ft = "octo" },
{ "<leader>c", "", desc = "+comment/code (Otco)", ft = "octo" },
{ "<leader>l", "", desc = "+label (Otco)", ft = "octo" },
{ "<leader>i", "", desc = "+issue (Otco)", ft = "octo" },
{ "<leader>r", "", desc = "+react (Otco)", ft = "octo" },
{ "<leader>p", "", desc = "+pr (Otco)", ft = "octo" },
{ "<leader>v", "", desc = "+review (Otco)", ft = "octo" },
{ "<leader>a", "", desc = "+assignee (Octo)", ft = "octo" },
{ "<leader>c", "", desc = "+comment/code (Octo)", ft = "octo" },
{ "<leader>l", "", desc = "+label (Octo)", ft = "octo" },
{ "<leader>i", "", desc = "+issue (Octo)", ft = "octo" },
{ "<leader>r", "", desc = "+react (Octo)", ft = "octo" },
{ "<leader>p", "", desc = "+pr (Octo)", ft = "octo" },
{ "<leader>v", "", desc = "+review (Octo)", ft = "octo" },
{ "@", "@<C-x><C-o>", mode = "i", ft = "octo", silent = true },
{ "#", "#<C-x><C-o>", mode = "i", ft = "octo", silent = true },
},
@ -48,53 +48,20 @@ return {
else
LazyVim.error("`octo.nvim` requires `telescope.nvim` or `fzf-lua`")
end
local Signs = require("octo.ui.signs")
---@type {buf: number, from: number, to: number, dirty: boolean}[]
local signs = {}
local unplace = Signs.unplace
function Signs.unplace(bufnr)
signs = vim.tbl_filter(function(s)
return s.buf ~= bufnr
end, signs)
return unplace(bufnr)
end
function Signs.place_signs(bufnr, start_line, end_line, is_dirty)
signs[#signs + 1] = { buf = bufnr, from = start_line, to = end_line, dirty = is_dirty }
end
-- stylua: ignore
local corners = {
top = "┌╴",
middle = "",
last = "└╴",
single = "[ ",
}
--- Fixes octo's comment rendering to take wrapping into account
---@param buf number
---@param lnum number
---@param vnum number
---@param win number
table.insert(LazyVim.ui.virtual, function(buf, lnum, vnum, win)
lnum = lnum - 1
for _, s in ipairs(signs) do
if buf == s.buf and lnum >= s.from and lnum <= s.to then
local height = vim.api.nvim_win_text_height(win, { start_row = s.from, end_row = s.to }).all
local height_end = vim.api.nvim_win_text_height(win, { start_row = s.to, end_row = s.to }).all
local corner = corners.middle
if height == 1 then
corner = corners.single
elseif lnum == s.from and vnum == 0 then
corner = corners.top
elseif lnum == s.to and vnum == height_end - 1 then
corner = corners.last
-- Keep some empty windows in sessions
vim.api.nvim_create_autocmd("ExitPre", {
group = vim.api.nvim_create_augroup("octo_exit_pre", { clear = true }),
callback = function(ev)
local keep = { "octo" }
for _, win in ipairs(vim.api.nvim_list_wins()) do
local buf = vim.api.nvim_win_get_buf(win)
if vim.tbl_contains(keep, vim.bo[buf].filetype) then
vim.bo[buf].buftype = "" -- set buftype to empty to keep the window
end
return { { text = corner, texthl = s.dirty and "OctoDirty" or "IblScope" } }
end
end
end)
end,
})
end,
},
}

View file

@ -2,27 +2,10 @@ local M = {}
---@param opts ConformOpts
function M.setup(_, opts)
for name, formatter in pairs(opts.formatters or {}) do
if type(formatter) == "table" then
---@diagnostic disable-next-line: undefined-field
if formatter.extra_args then
---@diagnostic disable-next-line: undefined-field
formatter.prepend_args = formatter.extra_args
LazyVim.deprecate(
("opts.formatters.%s.extra_args"):format(name),
("opts.formatters.%s.prepend_args"):format(name)
)
end
end
end
for _, key in ipairs({ "format_on_save", "format_after_save" }) do
if opts[key] then
LazyVim.warn(
("Don't set `opts.%s` for `conform.nvim`.\n**LazyVim** will use the conform formatter automatically"):format(
key
)
)
local msg = "Don't set `opts.%s` for `conform.nvim`.\n**LazyVim** will use the conform formatter automatically"
LazyVim.warn(msg:format(key))
---@diagnostic disable-next-line: no-unknown
opts[key] = nil
end

View file

@ -261,11 +261,11 @@ return {
cmd = "Mason",
keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
build = ":MasonUpdate",
opts_extend = { "ensure_installed" },
opts = {
ensure_installed = {
"stylua",
"shfmt",
-- "flake8",
},
},
---@param opts MasonSettings | {ensure_installed: string[]}

View file

@ -22,6 +22,7 @@ return {
{ "<c-space>", desc = "Increment Selection" },
{ "<bs>", desc = "Decrement Selection", mode = "x" },
},
opts_extend = { "ensure_installed" },
---@type TSConfig
---@diagnostic disable-next-line: missing-fields
opts = {

View file

@ -2,13 +2,14 @@ local Config = require("lazyvim.config")
-- Some extras need to be loaded before others
local prios = {
["lazyvim.plugins.extras.editor.aerial"] = 100,
["lazyvim.plugins.extras.editor.outline"] = 100,
["lazyvim.plugins.extras.editor.trouble-v3"] = 100,
["lazyvim.plugins.extras.lang.typescript"] = 5,
["lazyvim.plugins.extras.ui.edgy"] = 2,
["lazyvim.plugins.extras.test.core"] = 1,
["lazyvim.plugins.extras.dap.core"] = 1,
["lazyvim.plugins.extras.ui.edgy"] = 2,
["lazyvim.plugins.extras.lang.typescript"] = 5,
["lazyvim.plugins.extras.formatting.prettier"] = 10,
-- default priority is 50
["lazyvim.plugins.extras.editor.aerial"] = 100,
["lazyvim.plugins.extras.editor.outline"] = 100,
}
---@type string[]
@ -24,8 +25,8 @@ if vim.tbl_contains(compat, v) then
end
table.sort(extras, function(a, b)
local pa = prios[a] or 10
local pb = prios[b] or 10
local pa = prios[a] or 50
local pb = prios[b] or 50
if pa == pb then
return a < b
end

View file

@ -5,3 +5,20 @@ vim.g = {}
_G.lazyvim_docs = true
_G.LazyVim = require("lazyvim.util")
---@class vim.api.create_autocmd.callback.args
---@field id number
---@field event string
---@field group number?
---@field match string
---@field buf number
---@field file string
---@field data any
---@class vim.api.keyset.create_autocmd.opts: vim.api.keyset.create_autocmd
---@field callback? fun(ev:vim.api.create_autocmd.callback.args):boolean?
--- @param event any (string|array) Event(s) that will trigger the handler
--- @param opts vim.api.keyset.create_autocmd.opts
--- @return integer
function vim.api.nvim_create_autocmd(event, opts) end

View file

@ -75,6 +75,12 @@ function M.has(plugin)
return M.get_plugin(plugin) ~= nil
end
---@param extra string
function M.has_extra(extra)
local modname = "lazyvim.plugins.extras." .. extra
return vim.tbl_contains(require("lazy.core.config").spec.modules, modname)
end
---@param fn fun()
function M.on_very_lazy(fn)
vim.api.nvim_create_autocmd("User", {
@ -262,4 +268,17 @@ for _, level in ipairs({ "info", "warn", "error" }) do
end
end
local cache = {} ---@type table<string, any>
---@generic T: fun()
---@param fn T
---@return T
function M.memoize(fn)
return function(...)
local key = vim.inspect({ ... })
if cache[key] == nil then
cache[key] = fn(...)
end
return cache[key]
end
end
return M

View file

@ -22,12 +22,13 @@ function M.get_clients(opts)
end
---@param on_attach fun(client:vim.lsp.Client, buffer)
function M.on_attach(on_attach)
---@param name? string
function M.on_attach(on_attach, name)
return vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local buffer = args.buf ---@type number
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client then
if client and (not name or client.name == name) then
return on_attach(client, buffer)
end
end,
@ -340,6 +341,7 @@ M.action = setmetatable({}, {
---@class LspCommand: lsp.ExecuteCommandParams
---@field open? boolean
---@field handler? lsp.Handler
---@param opts LspCommand
function M.execute(opts)
@ -353,7 +355,7 @@ function M.execute(opts)
params = params,
})
else
return vim.lsp.buf_request(0, "workspace/executeCommand", params)
return vim.lsp.buf_request(0, "workspace/executeCommand", params, opts.handler)
end
end

View file

@ -1,9 +1,6 @@
---@class lazyvim.util.ui
local M = {}
---@type (fun(buf:number, lnum:number, vnum:number, win:number):Sign[]?)[]
M.virtual = {}
---@alias Sign {name:string, text:string, texthl:string, priority:number}
-- Returns a list of regular and extmark signs sorted by priority (low to high)
@ -108,21 +105,9 @@ function M.statuscolumn()
if show_signs then
local signs = M.get_signs(buf, vim.v.lnum)
local has_virtual = false
for _, fn in ipairs(M.virtual) do
local virtual = fn(buf, vim.v.lnum, vim.v.virtnum, win)
if virtual then
has_virtual = true
vim.list_extend(signs, virtual)
end
end
---@type Sign?,Sign?,Sign?
local left, right, fold, githl
for _, s in ipairs(signs) do
if s.name and s.name:lower():find("^octo_clean") then
s.texthl = "IblScope"
end
if s.name and (s.name:find("GitSign") or s.name:find("MiniDiffSign")) then
right = s
if use_githl then
@ -132,9 +117,6 @@ function M.statuscolumn()
left = s
end
end
if vim.v.virtnum ~= 0 and not has_virtual then
left = nil
end
vim.api.nvim_win_call(win, function()
if vim.fn.foldclosed(vim.v.lnum) >= 0 then

View file

@ -83,7 +83,7 @@ describe("Extra", function()
local opts = Plugin.values(ts, "opts", false)
if not vim.tbl_isempty(opts.ensure_installed) then
it("does not install defaut Treesitter langs", function()
it("does not install default Treesitter langs", function()
local invalid = vim.tbl_filter(function(v)
return vim.tbl_contains(tsensure, v)
end, opts.ensure_installed or {})