Compare commits

..

1 Commits
v13.3.1 ... ai

Author SHA1 Message Date
725469adba refactor: move ai extras to ai instead of coding 2024-11-10 11:25:55 +01:00
21 changed files with 251 additions and 509 deletions

View File

@ -1,3 +1,3 @@
{
".": "13.3.1"
".": "13.1.0"
}

View File

@ -1,57 +1,5 @@
# Changelog
## [13.3.1](https://github.com/LazyVim/LazyVim/compare/v13.3.0...v13.3.1) (2024-11-15)
### Bug Fixes
* **copilot:** don't enable blink when using copilot when blink is not installed. Fixes [#4795](https://github.com/LazyVim/LazyVim/issues/4795) ([07a0468](https://github.com/LazyVim/LazyVim/commit/07a046867dc3407b30801e539ab026fb7c180e7b))
## [13.3.0](https://github.com/LazyVim/LazyVim/compare/v13.2.0...v13.3.0) (2024-11-14)
### Features
* **copilot:** added support for blink.cmp source ([a7eca05](https://github.com/LazyVim/LazyVim/commit/a7eca056096486b20ce37b20979c0d712e49fe76))
* **extras:** add supermaven ([#3491](https://github.com/LazyVim/LazyVim/issues/3491)) ([c1e8e3c](https://github.com/LazyVim/LazyVim/commit/c1e8e3c80d1d9d44e3795022b3f7d2703abccec6))
### Bug Fixes
* **dial.nvim:** added boolean and logical toggles to default group. Fixes [#4515](https://github.com/LazyVim/LazyVim/issues/4515) ([5e485d3](https://github.com/LazyVim/LazyVim/commit/5e485d39b4cc5aca1aedae4d441fb2bfb3bfbf67))
* **fzf:** decouple `defaults` from `opts` to easy switch profiles ([#4190](https://github.com/LazyVim/LazyVim/issues/4190)) ([0819f93](https://github.com/LazyVim/LazyVim/commit/0819f9396e94a4188522b6739ade3d6024d2b8a7))
* **lsp:** wrap signature_help ([#4791](https://github.com/LazyVim/LazyVim/issues/4791)) ([deb9fd8](https://github.com/LazyVim/LazyVim/commit/deb9fd85b150e50053e127f94f3df6273a9f5faf))
* **lualine:** dynamically fetch the color used in lualine ([#4788](https://github.com/LazyVim/LazyVim/issues/4788)) ([e50b435](https://github.com/LazyVim/LazyVim/commit/e50b43544f1261d140bc391a9a1de6e3923b490d))
* **lualine:** normalize paths before calculating pretty path. Fixes [#4763](https://github.com/LazyVim/LazyVim/issues/4763) ([ea266e7](https://github.com/LazyVim/LazyVim/commit/ea266e73265e32183acbec0bd39f8108e213770f))
* **snacks:** explicitely enable snakcs plugins ([c0b623c](https://github.com/LazyVim/LazyVim/commit/c0b623c332b42b3d75e78e06fa1912417bfca71f))
### Performance Improvements
* **treesitter:** better foldtext and foldexpr ([1d7b9a1](https://github.com/LazyVim/LazyVim/commit/1d7b9a1a61596a61019d5d84be9ed679d90c4a38))
## [13.2.0](https://github.com/LazyVim/LazyVim/compare/v13.1.0...v13.2.0) (2024-11-11)
### Features
* **ai:** better completion/suggestions of AI engines ([#4752](https://github.com/LazyVim/LazyVim/issues/4752)) ([fbf881f](https://github.com/LazyVim/LazyVim/commit/fbf881f80b8f0fb2d9e4bc69d04f66323b25c4b9))
* **ai:** move ai related extras from `coding` to `ai` ([#4751](https://github.com/LazyVim/LazyVim/issues/4751)) ([86904d2](https://github.com/LazyVim/LazyVim/commit/86904d2fb1ef406386b2dad43f42756e09b28182))
* **keymaps:** leader-bo to close other buffers ([24665fc](https://github.com/LazyVim/LazyVim/commit/24665fc73651970e5a1e20a63d6031bd99b97637))
* **rest:** add more keymaps to util.rest ([#4467](https://github.com/LazyVim/LazyVim/issues/4467)) ([c22db72](https://github.com/LazyVim/LazyVim/commit/c22db724351bc7a05c56046c48d23a2be8efe71b))
### Bug Fixes
* **extras:** fix alpha-nvim non-string keycodes ([#4735](https://github.com/LazyVim/LazyVim/issues/4735)) ([9c9e650](https://github.com/LazyVim/LazyVim/commit/9c9e650530dcd211afd5a8b7f5e3e33e44abd11b))
* **snacks:** allow overriding `statuscolumn` through `options.lua` ([17a1b84](https://github.com/LazyVim/LazyVim/commit/17a1b846f08db62e3a93c76426db4017ad3cc2eb))
* **vscode:** added snacks.nvim to allowed plugins for vscode. Fixes [#4757](https://github.com/LazyVim/LazyVim/issues/4757) ([06071dd](https://github.com/LazyVim/LazyVim/commit/06071dd452baf1e9b8b5aab140553c4f51fa522e))
### Performance Improvements
* **ui:** only enable treesitter folds if the buffer has treesitter highlighting ([b9dae57](https://github.com/LazyVim/LazyVim/commit/b9dae579612ccf1cd749150ff1603ff6dffc2610))
## [13.1.0](https://github.com/LazyVim/LazyVim/compare/v13.0.0...v13.1.0) (2024-11-09)

View File

@ -1,4 +1,4 @@
*LazyVim.txt* For Neovim Last change: 2024 November 15
*LazyVim.txt* For Neovim Last change: 2024 November 09
==============================================================================
Table of Contents *LazyVim-table-of-contents*

View File

@ -3,7 +3,7 @@ _G.LazyVim = require("lazyvim.util")
---@class LazyVimConfig: LazyVimOptions
local M = {}
M.version = "13.3.1" -- x-release-please-version
M.version = "13.1.0" -- x-release-please-version
LazyVim.config = M
---@class LazyVimOptions
@ -88,7 +88,6 @@ local defaults = {
Snippet = "",
String = "",
Struct = "󰆼 ",
Supermaven = "",
TabNine = "󰏚 ",
Text = "",
TypeParameter = "",

View File

@ -180,13 +180,3 @@ map("n", "<leader><tab><tab>", "<cmd>tabnew<cr>", { desc = "New Tab" })
map("n", "<leader><tab>]", "<cmd>tabnext<cr>", { desc = "Next Tab" })
map("n", "<leader><tab>d", "<cmd>tabclose<cr>", { desc = "Close Tab" })
map("n", "<leader><tab>[", "<cmd>tabprevious<cr>", { desc = "Previous Tab" })
-- native snippets. only needed on < 0.11, as 0.11 creates these by default
if vim.fn.has("nvim-0.11") == 0 then
map("s", "<Tab>", function()
return vim.snippet.active({ direction = 1 }) and "<cmd>lua vim.snippet.jump(1)<cr>" or "<Tab>"
end, { expr = true, desc = "Jump Next" })
map({ "i", "s" }, "<S-Tab>", function()
return vim.snippet.active({ direction = -1 }) and "<cmd>lua vim.snippet.jump(-1)<cr>" or "<S-Tab>"
end, { expr = true, desc = "Jump Previous" })
end

View File

@ -11,10 +11,6 @@ vim.g.autoformat = true
-- enabled with `:LazyExtras`
vim.g.lazyvim_picker = "auto"
-- if the completion engine supports the AI source,
-- use that instead of inline suggestions
vim.g.ai_cmp = true
-- LazyVim root dir detection
-- Each entry can be:
-- * the name of a detector function like `lsp` or `cwd`
@ -89,7 +85,6 @@ opt.spelllang = { "en" }
opt.splitbelow = true -- Put new windows below current
opt.splitkeep = "screen"
opt.splitright = true -- Put new windows right of current
opt.statuscolumn = [[%!v:lua.require'snacks.statuscolumn'.get()]]
opt.tabstop = 2 -- Number of spaces tabs count for
opt.termguicolors = true -- True color support
opt.timeoutlen = vim.g.vscode and 1000 or 300 -- Lower than default (1000) to quickly trigger which-key

View File

@ -43,9 +43,6 @@ return {
cmp.abort()
fallback()
end,
["<tab>"] = function(fallback)
return LazyVim.cmp.map({ "snippet_forward", "ai_accept" }, fallback)()
end,
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
@ -75,10 +72,9 @@ return {
end,
},
experimental = {
-- only show ghost text when we show ai completions
ghost_text = vim.g.ai_cmp and {
ghost_text = {
hl_group = "CmpGhostText",
} or false,
},
},
sorting = defaults.sorting,
}
@ -109,6 +105,17 @@ return {
table.insert(opts.sources, { name = "snippets" })
end
end,
init = function()
-- Neovim enabled snippet navigation mappings by default in v0.11
if vim.fn.has("nvim-0.11") == 0 then
vim.keymap.set({ "i", "s" }, "<Tab>", function()
return vim.snippet.active({ direction = 1 }) and "<cmd>lua vim.snippet.jump(1)<cr>" or "<Tab>"
end, { expr = true, silent = true })
vim.keymap.set({ "i", "s" }, "<S-Tab>", function()
return vim.snippet.active({ direction = -1 }) and "<cmd>lua vim.snippet.jump(-1)<cr>" or "<S-Tab>"
end, { expr = true, silent = true })
end
end,
},
-- auto pairs

View File

@ -1,42 +1,18 @@
return {
-- codeium
{
"Exafunction/codeium.nvim",
cmd = "Codeium",
build = ":Codeium Auth",
opts = {
enable_cmp_source = vim.g.ai_cmp,
virtual_text = {
enabled = not vim.g.ai_cmp,
key_bindings = {
accept = false, -- handled by nvim-cmp / blink.cmp
next = "<M-]>",
prev = "<M-[>",
},
},
},
},
-- add ai_accept action
{
"Exafunction/codeium.nvim",
opts = function()
LazyVim.cmp.actions.ai_accept = function()
if require("codeium.virtual_text").get_current_completion_item() then
LazyVim.create_undo()
vim.api.nvim_input(require("codeium.virtual_text").accept())
return true
end
end
end,
},
-- codeium cmp source
{
"nvim-cmp",
optional = true,
dependencies = { "codeium.nvim" },
dependencies = {
-- codeium
{
"Exafunction/codeium.nvim",
cmd = "Codeium",
build = ":Codeium Auth",
opts = {},
},
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
table.insert(opts.sources, 1, {
name = "codeium",
@ -54,18 +30,4 @@ return {
table.insert(opts.sections.lualine_x, 2, LazyVim.lualine.cmp_source("codeium"))
end,
},
{
"saghen/blink.cmp",
optional = true,
opts = {
sources = {
compat = vim.g.ai_cmp and { "codeium" } or nil,
},
},
dependencies = {
"codeium.nvim",
vim.g.ai_cmp and "saghen/blink.compat" or nil,
},
},
}

View File

@ -5,17 +5,8 @@ return {
"zbirenbaum/copilot.lua",
cmd = "Copilot",
build = ":Copilot auth",
event = "InsertEnter",
opts = {
suggestion = {
enabled = not vim.g.ai_cmp,
auto_trigger = true,
keymap = {
accept = false, -- handled by nvim-cmp / blink.cmp
next = "<M-]>",
prev = "<M-[>",
},
},
suggestion = { enabled = false },
panel = { enabled = false },
filetypes = {
markdown = true,
@ -23,100 +14,110 @@ return {
},
},
},
-- add ai_accept action
{
"zbirenbaum/copilot.lua",
opts = function()
LazyVim.cmp.actions.ai_accept = function()
if require("copilot.suggestion").is_visible() then
LazyVim.create_undo()
require("copilot.suggestion").accept()
return true
end
end
end,
},
-- lualine
{
"nvim-lualine/lualine.nvim",
optional = true,
event = "VeryLazy",
opts = function(_, opts)
table.insert(
opts.sections.lualine_x,
2,
LazyVim.lualine.status(LazyVim.config.icons.kinds.Copilot, function()
local clients = package.loaded["copilot"] and LazyVim.lsp.get_clients({ name = "copilot", bufnr = 0 }) or {}
if #clients > 0 then
local status = require("copilot.api").status.data.status
return (status == "InProgress" and "pending") or (status == "Warning" and "error") or "ok"
local colors = {
[""] = LazyVim.ui.fg("Special"),
["Normal"] = LazyVim.ui.fg("Special"),
["Warning"] = LazyVim.ui.fg("DiagnosticError"),
["InProgress"] = LazyVim.ui.fg("DiagnosticWarn"),
}
table.insert(opts.sections.lualine_x, 2, {
function()
local icon = LazyVim.config.icons.kinds.Copilot
local status = require("copilot.api").status.data
return icon .. (status.message or "")
end,
cond = function()
if not package.loaded["copilot"] then
return
end
end)
)
local ok, clients = pcall(LazyVim.lsp.get_clients, { name = "copilot", bufnr = 0 })
if not ok then
return false
end
return ok and #clients > 0
end,
color = function()
if not package.loaded["copilot"] then
return
end
local status = require("copilot.api").status.data
return colors[status.status] or colors[""]
end,
})
end,
},
-- copilot cmp source
{
"nvim-cmp",
optional = true,
dependencies = { -- this will only be evaluated if nvim-cmp is enabled
dependencies = {
{
"zbirenbaum/copilot-cmp",
enabled = vim.g.ai_cmp, -- only enable if wanted
dependencies = "copilot.lua",
opts = {},
config = function(_, opts)
local copilot_cmp = require("copilot_cmp")
copilot_cmp.setup(opts)
-- attach cmp source whenever copilot attaches
-- fixes lazy-loading issues with the copilot cmp source
LazyVim.lsp.on_attach(function()
LazyVim.lsp.on_attach(function(client)
copilot_cmp._on_insert_enter({})
end, "copilot")
end,
specs = {
{
"nvim-cmp",
optional = true,
---@param opts cmp.ConfigSchema
opts = function(_, opts)
table.insert(opts.sources, 1, {
name = "copilot",
group_index = 1,
priority = 100,
})
end,
},
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
table.insert(opts.sources, 1, {
name = "copilot",
group_index = 1,
priority = 100,
})
end,
},
{
"saghen/blink.cmp",
optional = true,
specs = {
{
"zbirenbaum/copilot.lua",
event = "InsertEnter",
opts = {
suggestion = {
enabled = true,
auto_trigger = true,
keymap = { accept = false },
},
},
},
},
},
-- blink.cmp
{
"saghen/blink.cmp",
optional = true,
dependencies = {
{
"giuxtaposition/blink-cmp-copilot",
enabled = vim.g.ai_cmp, -- only enable if needed
specs = {
{
"blink.cmp",
optional = true,
opts = {
sources = {
providers = {
copilot = { name = "copilot", module = "blink-cmp-copilot" },
},
completion = {
enabled_providers = { "copilot" },
},
},
},
},
opts = {
windows = {
ghost_text = {
enabled = false,
},
},
keymap = {
["<Tab>"] = {
function(cmp)
if cmp.is_in_snippet() then
return cmp.accept()
elseif require("copilot.suggestion").is_visible() then
LazyVim.create_undo()
require("copilot.suggestion").accept()
return true
else
return cmp.select_and_accept()
end
end,
"snippet_forward",
"fallback",
},
},
},

View File

@ -1,107 +0,0 @@
return {
{
"supermaven-inc/supermaven-nvim",
opts = {
keymaps = {
accept_suggestion = nil, -- handled by nvim-cmp / blink.cmp
},
disable_inline_completion = vim.g.ai_cmp,
},
},
-- add ai_accept action
{
"supermaven-inc/supermaven-nvim",
opts = function()
require("supermaven-nvim.completion_preview").suggestion_group = "SupermavenSuggestion"
LazyVim.cmp.actions.ai_accept = function()
local suggestion = require("supermaven-nvim.completion_preview")
if suggestion.has_suggestion() then
LazyVim.create_undo()
vim.schedule(function()
suggestion.on_accept_suggestion()
end)
return true
end
end
end,
},
-- cmp integration
{
"hrsh7th/nvim-cmp",
optional = true,
dependencies = { "supermaven-nvim" },
opts = function(_, opts)
if vim.g.ai_cmp then
table.insert(opts.sources, 1, {
name = "supermaven",
group_index = 1,
priority = 100,
})
end
end,
},
-- blink.cmp integration
--
-- FIXME: this currently doesn't work properly
-- {
-- "saghen/blink.cmp",
-- optional = true,
-- opts = {
-- sources = {
-- compat = vim.g.ai_cmp and { "supermaven" } or nil,
-- },
-- },
-- dependencies = {
-- "supermaven-nvim",
-- vim.g.ai_cmp and "saghen/blink.compat" or nil,
-- },
-- },
--
-- Disabble cmp integration for now
{
"saghen/blink.cmp",
optional = true,
opts = {
windows = { ghost_text = { enabled = false } },
},
dependencies = {
{
"supermaven-nvim",
opts = {
disable_inline_completion = false,
},
},
},
},
{
"nvim-lualine/lualine.nvim",
optional = true,
event = "VeryLazy",
opts = function(_, opts)
table.insert(opts.sections.lualine_x, 2, LazyVim.lualine.cmp_source("supermaven"))
end,
},
{
"folke/noice.nvim",
optional = true,
opts = function(_, opts)
vim.list_extend(opts.routes, {
{
filter = {
event = "msg_show",
any = {
{ find = "Starting Supermaven" },
{ find = "Supermaven Free Tier" },
},
},
skip = true,
},
})
end,
},
}

View File

@ -1,10 +1,3 @@
if lazyvim_docs then
-- set to `true` to follow the main branch
-- you need to have a working rust toolchain to build the plugin
-- in this case.
vim.g.lazyvim_blink_main = false
end
return {
{
"hrsh7th/nvim-cmp",
@ -12,12 +5,8 @@ return {
},
{
"saghen/blink.cmp",
version = not vim.g.lazyvim_blink_main and "*",
build = vim.g.lazyvim_blink_main and "cargo build --release",
opts_extend = {
"sources.completion.enabled_providers",
"sources.compat",
},
version = "*",
opts_extend = { "sources.completion.enabled_providers" },
dependencies = {
"rafamadriz/friendly-snippets",
-- add blink.compat to dependencies
@ -46,7 +35,7 @@ return {
auto_show = true,
},
ghost_text = {
enabled = vim.g.ai_cmp,
enabled = true,
},
},
@ -56,9 +45,6 @@ return {
-- experimental signature help support
-- trigger = { signature_help = { enabled = true } }
sources = {
-- adding any nvim-cmp sources here will enable them
-- with blink.compat
compat = {},
completion = {
-- remember to enable your providers here
enabled_providers = { "lsp", "path", "snippets", "buffer" },
@ -67,28 +53,8 @@ return {
keymap = {
preset = "enter",
["<Tab>"] = {
LazyVim.cmp.map({ "snippet_forward", "ai_accept" }),
"fallback",
},
},
},
---@param opts blink.cmp.Config | { sources: { compat: string[] } }
config = function(_, opts)
-- setup compat sources
local enabled = opts.sources.completion.enabled_providers
for _, source in ipairs(opts.sources.compat or {}) do
opts.sources.providers[source] = vim.tbl_deep_extend(
"force",
{ name = source, module = "blink.compat.source" },
opts.sources.providers[source] or {}
)
if type(enabled) == "table" and not vim.tbl_contains(enabled, source) then
table.insert(enabled, source)
end
end
require("blink.cmp").setup(opts)
end,
},
-- add icons

View File

@ -1,8 +1,4 @@
return {
-- disable builtin snippet support
{ "garymjr/nvim-snippets", enabled = false },
-- add luasnip
{
"L3MON4D3/LuaSnip",
lazy = true,
@ -16,56 +12,43 @@ return {
require("luasnip.loaders.from_vscode").lazy_load()
end,
},
{
"nvim-cmp",
dependencies = {
"saadparwaiz1/cmp_luasnip",
},
opts = function(_, opts)
opts.snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
}
table.insert(opts.sources, { name = "luasnip" })
end,
},
},
opts = {
history = true,
delete_check_events = "TextChanged",
},
},
-- add snippet_forward action
{
"L3MON4D3/LuaSnip",
opts = function()
LazyVim.cmp.actions.snippet_forward = function()
if require("luasnip").jumpable(1) then
require("luasnip").jump(1)
return true
end
end
end,
},
-- nvim-cmp integration
{
"nvim-cmp",
optional = true,
dependencies = { "saadparwaiz1/cmp_luasnip" },
opts = function(_, opts)
opts.snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
}
table.insert(opts.sources, { name = "luasnip" })
end,
-- stylua: ignore
keys = {
{
"<tab>",
function()
return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
end,
expr = true, silent = true, mode = "i",
},
{ "<tab>", function() require("luasnip").jump(1) end, mode = "s" },
{ "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } },
},
},
-- blink.cmp integration
{
"saghen/blink.cmp",
optional = true,
opts = {
accept = {
expand_snippet = function(...)
return require("luasnip").lsp_expand(...)
end,
},
},
"garymjr/nvim-snippets",
enabled = false,
},
}

View File

@ -118,9 +118,6 @@ return {
ordinal_numbers,
weekdays,
months,
capitalized_boolean,
augend.constant.alias.bool, -- boolean value (true <-> false)
logical_alias,
},
typescript = {
augend.integer.alias.decimal_int, -- nonnegative and negative decimal number

View File

@ -74,6 +74,18 @@ return {
config.defaults.actions.files["alt-c"] = config.defaults.actions.files["ctrl-r"]
config.set_action_helpstr(config.defaults.actions.files["ctrl-r"], "toggle-root-dir")
-- use the same prompt for all
local defaults = require("fzf-lua.profiles.default-title")
local function fix(t)
t.prompt = t.prompt ~= nil and "" or nil
for _, v in pairs(t) do
if type(v) == "table" then
fix(v)
end
end
end
fix(defaults)
local img_previewer ---@type string[]?
for _, v in ipairs({
{ cmd = "ueberzug", args = {} },
@ -86,8 +98,7 @@ return {
end
end
return {
"default-title",
return vim.tbl_deep_extend("force", defaults, {
fzf_colors = true,
fzf_opts = {
["--no-scrollbar"] = true,
@ -175,24 +186,9 @@ return {
previewer = vim.fn.executable("delta") == 1 and "codeaction_native" or nil,
},
},
}
})
end,
config = function(_, opts)
if opts[1] == "default-title" then
-- use the same prompt for all pickers for profile `default-title` and
-- profiles that use `default-title` as base profile
local function fix(t)
t.prompt = t.prompt ~= nil and "" or nil
for _, v in pairs(t) do
if type(v) == "table" then
fix(v)
end
end
return t
end
opts = vim.tbl_deep_extend("force", fix(require("fzf-lua.profiles.default-title")), opts)
opts[1] = nil
end
require("fzf-lua").setup(opts)
end,
init = function()

View File

@ -9,23 +9,10 @@ return {
ft = "http",
keys = {
{ "<leader>R", "", desc = "+Rest", ft = "http" },
{ "<leader>Rb", "<cmd>lua require('kulala').scratchpad()<cr>", desc = "Open scratchpad", ft = "http" },
{ "<leader>Rc", "<cmd>lua require('kulala').copy()<cr>", desc = "Copy as cURL", ft = "http" },
{ "<leader>RC", "<cmd>lua require('kulala').from_curl()<cr>", desc = "Paste from curl", ft = "http" },
{
"<leader>Rg",
"<cmd>lua require('kulala').download_graphql_schema()<cr>",
desc = "Download GraphQL schema",
ft = "http",
},
{ "<leader>Ri", "<cmd>lua require('kulala').inspect()<cr>", desc = "Inspect current request", ft = "http" },
{ "<leader>Rn", "<cmd>lua require('kulala').jump_next()<cr>", desc = "Jump to next request", ft = "http" },
{ "<leader>Rp", "<cmd>lua require('kulala').jump_prev()<cr>", desc = "Jump to previous request", ft = "http" },
{ "<leader>Rq", "<cmd>lua require('kulala').close()<cr>", desc = "Close window", ft = "http" },
{ "<leader>Rr", "<cmd>lua require('kulala').replay()<cr>", desc = "Replay the last request", ft = "http" },
{ "<leader>Rs", "<cmd>lua require('kulala').run()<cr>", desc = "Send the request", ft = "http" },
{ "<leader>RS", "<cmd>lua require('kulala').show_stats()<cr>", desc = "Show stats", ft = "http" },
{ "<leader>Rt", "<cmd>lua require('kulala').toggle_view()<cr>", desc = "Toggle headers/body", ft = "http" },
{ "<leader>Rp", "<cmd>lua require('kulala').jump_prev()<cr>", desc = "Jump to previous request", ft = "http" },
{ "<leader>Rn", "<cmd>lua require('kulala').jump_next()<cr>", desc = "Jump to next request", ft = "http" },
},
opts = {},
},

View File

@ -3,7 +3,6 @@ if not vim.g.vscode then
end
local enabled = {
"LazyVim",
"dial.nvim",
"flit.nvim",
"lazy.nvim",
@ -16,10 +15,10 @@ local enabled = {
"nvim-treesitter",
"nvim-treesitter-textobjects",
"nvim-ts-context-commentstring",
"snacks.nvim",
"ts-comments.nvim",
"vim-repeat",
"yanky.nvim",
"LazyVim",
}
local Config = require("lazy.core.config")

View File

@ -30,12 +30,7 @@ return {
opts = function()
---@type snacks.Config
return {
notifier = { enabled = true },
quickfile = { enabled = true },
bigfile = { enabled = true },
words = { enabled = true },
toggle = { map = LazyVim.safe_keymap_set },
statuscolumn = { enabled = false }, -- we set this in options.lua
terminal = {
win = {
keys = {

View File

@ -21,7 +21,7 @@ function M.get()
{ "gD", vim.lsp.buf.declaration, desc = "Goto Declaration" },
{ "K", function() return vim.lsp.buf.hover() end, desc = "Hover" },
{ "gK", function() return vim.lsp.buf.signature_help() end, desc = "Signature Help", has = "signatureHelp" },
{ "<c-k>", function() return vim.lsp.buf.signature_help() end, mode = "i", desc = "Signature Help", has = "signatureHelp" },
{ "<c-k>", vim.lsp.buf.signature_help, mode = "i", desc = "Signature Help", has = "signatureHelp" },
{ "<leader>ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" },
{ "<leader>cc", vim.lsp.codelens.run, desc = "Run Codelens", mode = { "n", "v" }, has = "codeLens" },
{ "<leader>cC", vim.lsp.codelens.refresh, desc = "Refresh & Display Codelens", mode = { "n" }, has = "codeLens" },

View File

@ -1,36 +1,6 @@
---@class lazyvim.util.cmp
local M = {}
---@alias lazyvim.util.cmp.Action fun():boolean?
---@type table<string, lazyvim.util.cmp.Action>
M.actions = {
-- Native Snippets
snippet_forward = function()
if vim.snippet.active({ direction = 1 }) then
vim.schedule(function()
vim.snippet.jump(1)
end)
return true
end
end,
}
---@param actions string[]
---@param fallback? string|fun()
function M.map(actions, fallback)
return function()
for _, name in ipairs(actions) do
if M.actions[name] then
local ret = M.actions[name]()
if ret then
return true
end
end
end
return type(fallback) == "function" and fallback() or fallback
end
end
---@alias Placeholder {n:number, text:string}
---@param snippet string

View File

@ -1,37 +1,13 @@
---@class lazyvim.util.lualine
local M = {}
---@param icon string
---@param status fun(): nil|"ok"|"error"|"pending"
function M.status(icon, status)
local colors = {
ok = "Special",
error = "DiagnosticError",
pending = "DiagnosticWarn",
}
return {
function()
return icon
end,
cond = function()
return status() ~= nil
end,
color = function()
return LazyVim.ui.fg(colors[status()] or colors.ok)
end,
}
end
---@param name string
---@param icon? string
function M.cmp_source(name, icon)
icon = icon or LazyVim.config.icons.kinds[name:sub(1, 1):upper() .. name:sub(2)]
local started = false
return M.status(icon, function()
local function status()
if not package.loaded["cmp"] then
return
end
for _, s in ipairs(require("cmp").core.sources or {}) do
for _, s in ipairs(require("cmp").core.sources) do
if s.name == name then
if s.source:is_available() then
started = true
@ -44,7 +20,25 @@ function M.cmp_source(name, icon)
return "ok"
end
end
end)
end
local colors = {
ok = LazyVim.ui.fg("Special"),
error = LazyVim.ui.fg("DiagnosticError"),
pending = LazyVim.ui.fg("DiagnosticWarn"),
}
return {
function()
return icon or LazyVim.config.icons.kinds[name:sub(1, 1):upper() .. name:sub(2)]
end,
cond = function()
return status() ~= nil
end,
color = function()
return colors[status()] or colors.ok
end,
}
end
---@param component any
@ -97,7 +91,6 @@ function M.pretty_path(opts)
return ""
end
path = LazyVim.norm(path)
local root = LazyVim.root.get({ normalize = true })
local cwd = LazyVim.root.cwd()
@ -145,9 +138,7 @@ function M.root_dir(opts)
parent = true,
other = true,
icon = "󱉭 ",
color = function()
return LazyVim.ui.fg("Special")
end,
color = LazyVim.ui.fg("Special"),
}, opts or {})
local function get()

View File

@ -1,30 +1,93 @@
---@class lazyvim.util.ui
local M = {}
-- foldtext for Neovim < 0.10.0
function M.foldtext()
return vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum, false)[1]
end
-- optimized treesitter foldexpr for Neovim >= 0.10.0
function M.foldexpr()
local buf = vim.api.nvim_get_current_buf()
if vim.b[buf].ts_folds == nil then
-- as long as we don't have a filetype, don't bother
-- checking if treesitter is available (it won't)
if vim.bo[buf].filetype == "" then
return "0"
end
vim.b[buf].ts_folds = pcall(vim.treesitter.get_parser, buf)
local ok = pcall(vim.treesitter.get_parser, vim.api.nvim_get_current_buf())
local ret = ok and vim.treesitter.foldtext and vim.treesitter.foldtext()
if not ret or type(ret) == "string" then
ret = { { vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum, false)[1], {} } }
end
return vim.b[buf].ts_folds and vim.treesitter.foldexpr() or "0"
table.insert(ret, { " " .. LazyVim.config.icons.misc.dots })
if not vim.treesitter.foldtext then
return table.concat(
vim.tbl_map(function(line)
return line[1]
end, ret),
" "
)
end
return ret
end
---@return {fg?:string}?
function M.fg(name)
local hl = vim.api.nvim_get_hl(0, { name = name, link = false })
local fg = hl and hl.fg or hl.foreground
return fg and { fg = string.format("#%06x", fg) } or nil
local color = M.color(name)
return color and { fg = color } or nil
end
---@param name string
---@param bg? boolean
---@return string?
function M.color(name, bg)
---@type {foreground?:number}?
---@diagnostic disable-next-line: deprecated
local hl = vim.api.nvim_get_hl and vim.api.nvim_get_hl(0, { name = name, link = false })
or vim.api.nvim_get_hl_by_name(name, true)
---@diagnostic disable-next-line: undefined-field
---@type string?
local color = nil
if hl then
if bg then
color = hl.bg or hl.background
else
color = hl.fg or hl.foreground
end
end
return color and string.format("#%06x", color) or nil
end
M.skip_foldexpr = {} ---@type table<number,boolean>
local skip_check = assert(vim.uv.new_check())
function M.foldexpr()
local buf = vim.api.nvim_get_current_buf()
-- no highlight, no foldexpr
if not vim.b[buf].ts_highlight then
return "0"
end
-- still in the same tick and no parser
if M.skip_foldexpr[buf] then
return "0"
end
-- don't use treesitter folds for terminal
if vim.bo[buf].buftype == "terminal" then
return "0"
end
-- as long as we don't have a filetype, don't bother
-- checking if treesitter is available (it won't)
if vim.bo[buf].filetype == "" then
return "0"
end
local ok = pcall(vim.treesitter.get_parser, buf)
if ok then
return vim.treesitter.foldexpr()
end
-- no parser available, so mark it as skip
-- in the next tick, all skip marks will be reset
M.skip_foldexpr[buf] = true
skip_check:start(function()
M.skip_foldexpr = {}
skip_check:stop()
end)
return "0"
end
function M.maximize()