1

Update generated neovim config

This commit is contained in:
2024-09-22 20:41:25 +02:00
parent 1743764e48
commit aa1271c42c
1247 changed files with 26512 additions and 15067 deletions

View File

@ -1,3 +1,7 @@
-- Nixvim's internal module table
-- Can be used to share code throughout init.lua
local _M = {}
-- Set up globals {{{
do
local nixvim_globals = { mallocalleader = " ", mapleader = " " }

View File

@ -1,3 +1,7 @@
-- Nixvim's internal module table
-- Can be used to share code throughout init.lua
local _M = {}
-- Set up globals {{{
do
local nixvim_globals = { mallocalleader = " ", mapleader = " " }
@ -68,7 +72,7 @@ end
vim.loader.enable()
require("lazy").setup({
dev = {
path = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins",
path = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins",
patterns = { "." },
fallback = false,
},
@ -83,7 +87,7 @@ require("lazy").setup({
colorscheme catppuccin
]])
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/catppuccin-nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/catppuccin-nvim",
lazy = false,
name = "catppuccin",
opts = { background = { dark = "mocha", light = "latte" }, flavour = "mocha" },
@ -94,7 +98,7 @@ require("lazy").setup({
config = function(_, opts)
require("nvim-web-devicons").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nvim-web-devicons",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nvim-web-devicons",
lazy = true,
name = "nvim-web-devicons",
},
@ -103,7 +107,7 @@ require("lazy").setup({
config = function(_, opts)
require("nvim-autopairs").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nvim-autopairs",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nvim-autopairs",
event = { "InsertEnter" },
lazy = true,
name = "nvim-autopairs",
@ -112,7 +116,7 @@ require("lazy").setup({
{
"vim-bbye",
cmd = { "Bdelete", "Bwipeout" },
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/vim-bbye",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/vim-bbye",
lazy = true,
name = "vim-bbye",
},
@ -121,7 +125,7 @@ require("lazy").setup({
config = function(_, opts)
require("better_escape").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/better-escape.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/better-escape.nvim",
event = { "InsertEnter" },
lazy = true,
name = "better_escape",
@ -132,7 +136,7 @@ require("lazy").setup({
config = function(_, opts)
require("clangd_extensions").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/clangd_extensions.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/clangd_extensions.nvim",
lazy = true,
name = "clangd_extensions",
opts = { inlay_hints = { inline = false } },
@ -145,50 +149,50 @@ require("lazy").setup({
dependencies = {
{
"cmp-async-path",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/cmp-async-path",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/cmp-async-path",
lazy = true,
name = "cmp-async-path",
},
{
"cmp-buffer",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/cmp-buffer",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/cmp-buffer",
enabled = false,
lazy = true,
name = "cmp-buffer",
},
{
"cmp-cmdline",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/cmp-cmdline",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/cmp-cmdline",
enabled = false,
lazy = true,
name = "cmp-cmdline",
},
{
"cmp-emoji",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/cmp-emoji",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/cmp-emoji",
lazy = true,
name = "cmp-emoji",
},
{
"cmp-nvim-lsp",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/cmp-nvim-lsp",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/cmp-nvim-lsp",
lazy = true,
name = "cmp-nvim-lsp",
},
{
"cmp-nvim-lsp-signature-help",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/cmp-nvim-lsp-signature-help",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/cmp-nvim-lsp-signature-help",
lazy = true,
name = "cmp-nvim-lsp-signature-help",
},
{
"cmp_luasnip",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/cmp_luasnip",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/cmp_luasnip",
lazy = true,
name = "cmp_luasnip",
},
},
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nvim-cmp",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nvim-cmp",
event = { "InsertEnter" },
lazy = true,
name = "cmp",
@ -269,7 +273,7 @@ require("lazy").setup({
config = function(_, opts)
require("ts_context_commentstring").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nvim-ts-context-commentstring",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nvim-ts-context-commentstring",
init = function()
-- Skip compatibility checks
vim.g.skip_ts_context_commentstring_module = true
@ -278,7 +282,7 @@ require("lazy").setup({
name = "ts_context_commentstring",
},
},
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/comment.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/comment.nvim",
lazy = false,
name = "Comment",
opts = {
@ -295,7 +299,7 @@ require("lazy").setup({
config = function(_, opts)
require("conform").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/conform.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/conform.nvim",
event = { "BufReadPost", "BufNewFile" },
lazy = true,
name = "conform",
@ -335,7 +339,7 @@ require("lazy").setup({
config = function(_, opts)
require("nvim-web-devicons").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nvim-web-devicons",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nvim-web-devicons",
lazy = true,
name = "nvim-web-devicons",
},
@ -362,30 +366,30 @@ require("lazy").setup({
dependencies = {
{
"plenary",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/plenary.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/plenary.nvim",
lazy = true,
name = "plenary",
},
{
"telescope-fzf-native",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/telescope-fzf-native.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/telescope-fzf-native.nvim",
lazy = true,
name = "telescope-fzf-native",
},
{
"telescope-undo",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/telescope-undo.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/telescope-undo.nvim",
lazy = true,
name = "telescope-undo",
},
{
"telescope-ui-select",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/telescope-ui-select.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/telescope-ui-select.nvim",
lazy = true,
name = "telescope-ui-select",
},
},
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/telescope.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/telescope.nvim",
lazy = true,
name = "telescope",
opts = {
@ -401,7 +405,7 @@ require("lazy").setup({
},
},
},
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/persisted.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/persisted.nvim",
lazy = true,
name = "persisted",
opts = {
@ -414,7 +418,7 @@ require("lazy").setup({
},
},
},
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/dashboard-nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/dashboard-nvim",
lazy = false,
name = "dashboard",
opts = {
@ -444,13 +448,13 @@ require("lazy").setup({
{
"diffview",
cmd = { "DiffviewOpen" },
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/diffview.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/diffview.nvim",
lazy = true,
name = "diffview",
},
{
"direnv",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/direnv.vim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/direnv.vim",
lazy = false,
name = "direnv",
},
@ -459,7 +463,7 @@ require("lazy").setup({
config = function(_, opts)
require("flash").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/flash.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/flash.nvim",
keys = { "s", "S", "f", "F", "t", "T" },
lazy = true,
name = "flash",
@ -467,7 +471,7 @@ require("lazy").setup({
{
"gitmessenger",
cmd = { "GitMessenger" },
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/git-messenger.vim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/git-messenger.vim",
init = function()
for k, v in pairs({
["git_messenger_floating_win_opts"] = { ["border"] = "rounded" },
@ -484,7 +488,7 @@ require("lazy").setup({
config = function(_, opts)
require("gitsigns").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/gitsigns.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/gitsigns.nvim",
event = { "BufReadPost", "BufNewFile" },
lazy = true,
name = "gitsigns",
@ -492,7 +496,7 @@ require("lazy").setup({
},
{
"haskell-tools",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/haskell-tools.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/haskell-tools.nvim",
lazy = false,
name = "haskell-tools",
},
@ -501,7 +505,7 @@ require("lazy").setup({
config = function(_, opts)
require("illuminate").configure(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/vim-illuminate",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/vim-illuminate",
event = { "BufreadPost", "BufNewFile" },
lazy = true,
name = "illuminate",
@ -521,14 +525,14 @@ require("lazy").setup({
},
{
"intellitab",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/intellitab.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/intellitab.nvim",
event = { "InsertEnter" },
lazy = true,
name = "intellitab",
},
{
"jdtls",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nvim-jdtls",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nvim-jdtls",
lazy = false,
name = "jdtls",
},
@ -537,7 +541,7 @@ require("lazy").setup({
config = function(_, opts)
require("nvim-lastplace").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nvim-lastplace",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nvim-lastplace",
lazy = false,
name = "nvim-lastplace",
},
@ -547,12 +551,12 @@ require("lazy").setup({
dependencies = {
{
"plenary",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/plenary.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/plenary.nvim",
lazy = true,
name = "plenary",
},
},
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/lazygit.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/lazygit.nvim",
lazy = true,
name = "lazygit",
},
@ -565,7 +569,7 @@ require("lazy").setup({
lint[k] = v
end
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nvim-lint",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nvim-lint",
event = { "BufReadPost", "BufNewFile" },
lazy = true,
name = "lint",
@ -679,12 +683,12 @@ require("lazy").setup({
config = function(_, opts)
require("lazydev").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/vimplugin-nvim-lazydev",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/vimplugin-nvim-lazydev",
ft = { "lua" },
name = "lazydev",
},
},
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nvim-lspconfig",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nvim-lspconfig",
event = { "BufReadPost", "BufNewFile" },
lazy = true,
name = "lspconfig",
@ -702,7 +706,7 @@ require("lazy").setup({
unhide = false,
})
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/lualine.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/lualine.nvim",
event = { "BufReadPost", "BufNewFile" },
lazy = true,
name = "lualine",
@ -730,7 +734,7 @@ require("lazy").setup({
config = function(_, opts)
require("luasnip").config.set_config(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/luasnip",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/luasnip",
lazy = false,
name = "luasnip",
},
@ -742,7 +746,7 @@ require("lazy").setup({
vim.keymap.del("x", "<space>nr")
vim.keymap.del("n", "<space>nr")
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/NrrwRgn",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/NrrwRgn",
lazy = true,
name = "narrow-region",
},
@ -779,13 +783,13 @@ require("lazy").setup({
-- }
-- })
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nvim-navic",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nvim-navic",
lazy = true,
name = "navic",
opts = { click = true, depth_limit = 5, highlight = true, lsp = { auto_attach = true } },
},
},
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nvim-navbuddy",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nvim-navbuddy",
lazy = true,
name = "navbuddy",
opts = { lsp = { auto_attach = true }, window = { border = "rounded" } },
@ -799,7 +803,7 @@ require("lazy").setup({
dependencies = {
{
"plenary",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/plenary.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/plenary.nvim",
lazy = true,
name = "plenary",
},
@ -808,18 +812,18 @@ require("lazy").setup({
config = function(_, opts)
require("nvim-web-devicons").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nvim-web-devicons",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nvim-web-devicons",
lazy = true,
name = "nvim-web-devicons",
},
{
"nui",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nui.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nui.nvim",
lazy = true,
name = "nui",
},
},
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/neo-tree.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/neo-tree.nvim",
lazy = true,
name = "neo-tree",
opts = {
@ -874,18 +878,18 @@ require("lazy").setup({
notify.setup(opts)
vim.notify = notify -- Vim uses notify by default
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nvim-notify",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nvim-notify",
lazy = true,
name = "notify",
},
{
"nui",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nui.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nui.nvim",
lazy = true,
name = "nui",
},
},
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/noice.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/noice.nvim",
lazy = false,
name = "noice",
opts = {
@ -921,13 +925,13 @@ require("lazy").setup({
},
{
"rainbow-delimiters",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/rainbow-delimiters.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/rainbow-delimiters.nvim",
lazy = false,
name = "rainbow-delimiters",
},
{
"rustaceanvim",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/rustaceanvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/rustaceanvim",
init = function()
vim.g.rustaceanvim = {
tools = {
@ -973,7 +977,7 @@ require("lazy").setup({
},
{
"sandwich",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/vim-sandwich",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/vim-sandwich",
init = function()
-- Disable default keymaps
vim.g.sandwich_no_default_key_mappings = 1
@ -985,7 +989,7 @@ require("lazy").setup({
},
{
"sleuth",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/vim-sleuth",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/vim-sleuth",
lazy = false,
name = "sleuth",
},
@ -1003,30 +1007,30 @@ require("lazy").setup({
dependencies = {
{
"plenary",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/plenary.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/plenary.nvim",
lazy = true,
name = "plenary",
},
{
"telescope-fzf-native",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/telescope-fzf-native.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/telescope-fzf-native.nvim",
lazy = true,
name = "telescope-fzf-native",
},
{
"telescope-undo",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/telescope-undo.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/telescope-undo.nvim",
lazy = true,
name = "telescope-undo",
},
{
"telescope-ui-select",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/telescope-ui-select.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/telescope-ui-select.nvim",
lazy = true,
name = "telescope-ui-select",
},
},
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/telescope.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/telescope.nvim",
lazy = true,
name = "telescope",
opts = {
@ -1047,12 +1051,12 @@ require("lazy").setup({
dependencies = {
{
"plenary",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/plenary.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/plenary.nvim",
lazy = true,
name = "plenary",
},
},
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/todo-comments.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/todo-comments.nvim",
event = { "BufReadPost", "BufNewFile" },
lazy = true,
name = "todo-comments",
@ -1075,7 +1079,7 @@ require("lazy").setup({
config = function(_, opts)
require("toggleterm").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/toggleterm.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/toggleterm.nvim",
keys = { "<C-/>" },
lazy = true,
name = "toggleterm",
@ -1102,14 +1106,14 @@ require("lazy").setup({
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nvim-treesitter",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nvim-treesitter",
event = { "BufReadPost", "BufNewFile" },
init = function()
-- Fix treesitter grammars/parsers on nix
vim.opt.runtimepath:append(
"/nix/store/0a8da834qdlvvfrah5i2a2rz2mnqc1d2-vimplugin-nvim-treesitter-2024-08-04"
"/nix/store/5idj2gr9mmifgrnzl4zq35i6ac8nh5jm-vimplugin-nvim-treesitter-2024-09-11"
)
vim.opt.runtimepath:append("/nix/store/z5838nllsi3a8z9z73wgv9g0ikx91nlq-treesitter-parsers")
vim.opt.runtimepath:append("/nix/store/wl5irpjigjw2f933kalcjcg1m7h6kwh1-treesitter-parsers")
end,
lazy = true,
name = "treesitter",
@ -1126,7 +1130,7 @@ require("lazy").setup({
},
},
indent = { enable = true },
parser_install_dir = "/nix/store/z5838nllsi3a8z9z73wgv9g0ikx91nlq-treesitter-parsers",
parser_install_dir = "/nix/store/wl5irpjigjw2f933kalcjcg1m7h6kwh1-treesitter-parsers",
},
},
{
@ -1134,7 +1138,7 @@ require("lazy").setup({
config = function(_, opts)
require("trim").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/trim.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/trim.nvim",
lazy = false,
name = "trim",
},
@ -1144,7 +1148,7 @@ require("lazy").setup({
config = function(_, opts)
require("trouble").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/trouble.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/trouble.nvim",
lazy = true,
name = "trouble",
},
@ -1156,18 +1160,18 @@ require("lazy").setup({
dependencies = {
{
"promise",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/promise-async",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/promise-async",
lazy = true,
name = "promise",
},
},
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/nvim-ufo",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/nvim-ufo",
lazy = false,
name = "ufo",
},
{
"vimtex",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/vimtex",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/vimtex",
init = function()
vim.g.vimtex_view_method = "zathura"
end,
@ -1181,12 +1185,12 @@ require("lazy").setup({
dependencies = {
{
"mini",
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/mini.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/mini.nvim",
lazy = true,
name = "mini",
},
},
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/which-key.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/which-key.nvim",
lazy = false,
name = "which-key",
opts = { preset = "helix" },
@ -1198,7 +1202,7 @@ require("lazy").setup({
config = function(_, opts)
require("winshift").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/winshift.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/winshift.nvim",
lazy = true,
name = "winshift",
opts = {
@ -1212,7 +1216,7 @@ require("lazy").setup({
config = function(_, opts)
require("yanky").setup(opts)
end,
dir = "/nix/store/ypd5dagzrwpz35gnf0a67ak6lz7drfpi-lazy-plugins/yanky.nvim",
dir = "/nix/store/2z9dmmiwr51af1gxlljxdp8z6x9iv7ig-lazy-plugins/yanky.nvim",
lazy = true,
name = "yanky",
},

View File

@ -1,4 +1,4 @@
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/sh
#!/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/sh
for i in */; do
cd "$i"

View File

@ -1,4 +1,4 @@
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
#!/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/bash
#set -x
dir="$(realpath ../..)"

View File

@ -1,4 +1,4 @@
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
#!/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/bash
#set -x
Test="Test2"

View File

@ -1,4 +1,4 @@
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
#!/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/bash
#set -x
Test="Test3"

View File

@ -1,4 +1,4 @@
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
#!/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/bash
#set -x
Test="Test4"

View File

@ -1,4 +1,4 @@
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
#!/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/bash
#set -x
Test=`basename $PWD`

View File

@ -1,4 +1,4 @@
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
#!/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/bash
#set -x
Test=`basename $PWD`

View File

@ -1,4 +1,4 @@
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
#!/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/bash
#set -x
Test=`basename $PWD`

View File

@ -110,8 +110,7 @@ require("better_escape").setup {
},
t = {
j = {
k = "<Esc>",
j = "<Esc>",
k = "<C-\\><C-n>",
},
},
v = {

View File

@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: JohnnyMorganz/stylua-action@v2
- uses: JohnnyMorganz/stylua-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest

View File

@ -17,7 +17,7 @@ jobs:
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v5
uses: peter-evans/create-pull-request@v6
with:
commit-message: 'feat: auto-sync upstream palettes'
committer: GitHub <noreply@github.com>

View File

@ -20,7 +20,7 @@ jobs:
toc: true
version: "nvim >= 0.8.0"
treesitter: true
- uses: stefanzweifel/git-auto-commit-action@v4
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "docs: auto generate vimdoc"
branch: ${{ github.head_ref }}

View File

@ -1,5 +1,17 @@
# Changelog
## [1.9.0](https://github.com/catppuccin/nvim/compare/v1.8.0...v1.9.0) (2024-08-09)
### Features
* add fzf-lua integration ([#746](https://github.com/catppuccin/nvim/issues/746)) ([05206bb](https://github.com/catppuccin/nvim/commit/05206bbb6d500a339cd55a9486532c3871a4455e))
* add lir.nvim and lir-git-status.nvim integration ([#705](https://github.com/catppuccin/nvim/issues/705)) ([d3907de](https://github.com/catppuccin/nvim/commit/d3907deedf74d1d5bd3bb990bff2db2ebc916c56))
* add markdown.nvim integration ([ba41328](https://github.com/catppuccin/nvim/commit/ba413282677e1027a42d6ff585115d3e1df12b66))
* add vim-dadbod-ui integration ([#747](https://github.com/catppuccin/nvim/issues/747)) ([4db4c77](https://github.com/catppuccin/nvim/commit/4db4c77cc17d23aa90b393f3e550ce99b9e903d5))
* **render-markdown:** add highlights for callouts ([03a2f35](https://github.com/catppuccin/nvim/commit/03a2f354456373c199eb7829fd14120cc2099108))
* **terminal:** highlight `TermCursor` and `TermCursorNC` ([#749](https://github.com/catppuccin/nvim/issues/749)) ([548b2a2](https://github.com/catppuccin/nvim/commit/548b2a25415bb60e05c536b7658aa8ffbfeb3e45))
## [1.8.0](https://github.com/catppuccin/nvim/compare/v1.7.0...v1.8.0) (2024-07-25)

View File

@ -696,6 +696,20 @@ flash = true
```
<!-- flash.nvim -->
<!-- fzf-lua -->
</tr>
<tr>
<td> <a href="https://github.com/ibhagwan/fzf-lua">fzf-lua</a> </td>
<td>
```lua
fzf = true
```
</td>
</tr>
<!-- fzf-lua -->
<!-- gitsigns.nvim -->
</tr>
<tr>
@ -811,6 +825,20 @@ lightspeed = false
```
<!-- lightspeed.nvim -->
<!-- lir.nvim -->
</tr>
<tr>
<td> <a href="https://github.com/tamago324/lir.nvim">lir.nvim</a> </td>
<td>
```lua
lir = {
enabled = false,
git_status = false
}
```
<!-- lir.nvim -->
<!-- lspsaga.nvim -->
</tr>
<tr>
@ -1326,10 +1354,10 @@ To use another flavour just replace `mocha` with the one you want to use.
</tr>
<!-- reactive.nvim -->
<!-- markdown.nvim -->
<!-- render-markdown.nvim -->
</tr>
<tr>
<td> <a href="https://github.com/MeanderingProgrammer/markdown.nvim">render-markdown (markdown.nvim)</a> </td>
<td> <a href="https://github.com/MeanderingProgrammer/render-markdown.nvim">render-markdown.nvim</a> </td>
<td>
```lua
@ -1338,7 +1366,7 @@ render_markdown = true
</td>
</tr>
<!-- markdown.nvim -->
<!-- render-markdown.nvim -->
<!-- symbols-outline.nvim -->
</tr>
@ -1440,6 +1468,20 @@ let g:clap_theme = 'catppuccin'
</tr>
<!-- vim-clap -->
<!-- vim-dadbod-ui -->
</tr>
<tr>
<td> <a href="https://github.com/kristijanhusak/vim-dadbod-ui">vim-dadbod-ui</a> </td>
<td>
```lua
dadbod_ui = false
```
</td>
</tr>
<!-- vim-dadbod-ui -->
<!-- vim-gitgutter -->
</tr>
<tr>

View File

@ -538,6 +538,10 @@ flash.nvim>lua
flash = true
<
fzf-lua>lua
fzf = true
<
gitsigns.nvim>lua
gitsigns = true
<
@ -587,6 +591,13 @@ lightspeed.nvim>lua
lightspeed = false
<
lir.nvim>lua
lir = {
enabled = false,
git_status = false
}
<
lspsaga.nvim>lua
lsp_saga = false
<
@ -790,7 +801,7 @@ Here is how you can use them.
To use another flavour just replace `mocha` with the one you want to use.
render-markdown (markdown.nvim)>lua
render-markdown.nvim>lua
render_markdown = true
<
@ -830,6 +841,10 @@ Use this to set it up:
let g:clap_theme = 'catppuccin'
<
vim-dadbod-ui>lua
dadbod_ui = false
<
vim-gitgutter>lua
gitgutter = false
<

View File

@ -59,9 +59,11 @@ function M.get()
SpellRare = { sp = C.green, style = { "undercurl" } }, -- Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise.
StatusLine = { fg = C.text, bg = O.transparent_background and C.none or C.mantle }, -- status line of current window
StatusLineNC = { fg = C.surface1, bg = O.transparent_background and C.none or C.mantle }, -- status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window.
TabLine = { bg = C.mantle, fg = C.surface1 }, -- tab pages line, not active tab page label
TabLineFill = {}, -- tab pages line, where there are no labels
TabLine = { bg = C.mantle, fg = C.overlay0 }, -- tab pages line, not active tab page label
TabLineFill = { bg = O.transparent_background and C.none or C.mantle }, -- tab pages line, where there are no labels
TabLineSel = { fg = C.green, bg = C.surface1 }, -- tab pages line, active tab page label
TermCursor = { fg = C.base, bg = C.rosewater }, -- cursor in a focused terminal
TermCursorNC = { fg = C.base, bg = C.overlay2 }, -- cursor in unfocused terminals
Title = { fg = C.blue, style = { "bold" } }, -- titles for output from ":set all", ":autocmd" etc.
Visual = { bg = C.surface1, style = { "bold" } }, -- Visual mode selection
VisualNOS = { bg = C.surface1, style = { "bold" } }, -- Visual mode selection when vim is "Not Owning the Selection".

View File

@ -0,0 +1,11 @@
local M = {}
function M.get()
return {
NotificationInfo = { fg = C.blue, bg = C.mantle },
NotificationWarning = { fg = C.yellow, bg = C.mantle },
NotificationError = { fg = C.red, bg = C.mantle },
}
end
return M

View File

@ -0,0 +1,22 @@
local M = {}
function M.get()
return {
FzfLuaNormal = { link = "NormalFloat" },
FzfLuaBorder = { link = "FloatBorder" },
FzfLuaTitle = { link = "FloatTitle" },
FzfLuaHeaderBind = { fg = C.yellow },
FzfLuaHeaderText = { fg = C.peach },
FzfLuaPathColNr = { fg = C.blue },
FzfLuaPathLineNr = { fg = C.green },
FzfLuaBufName = { fg = C.mauve },
FzfLuaBufNr = { fg = C.yellow },
FzfLuaBufFlagCur = { fg = C.peach },
FzfLuaBufFlagAlt = { fg = C.blue },
FzfLuaTabTitle = { fg = C.sky },
FzfLuaTabMarker = { fg = C.yellow },
FzfLuaLiveSym = { fg = C.peach },
}
end
return M

View File

@ -0,0 +1,26 @@
local M = {}
function M.get()
return vim.tbl_deep_extend("force", {}, {
LirFloatNormal = { fg = C.text, bg = O.transparent_background and C.none or C.mantle },
LirFloatBorder = {
fg = O.transparent_background and C.surface1 or C.base,
bg = O.transparent_background and C.none or C.base,
},
LirFloatCursorLine = { link = "CursorLine" },
LirDir = { fg = C.blue },
LirSymLink = { fg = C.pink },
LirEmptyDirText = { fg = C.blue },
LirFloatCurdirWindowNormal = { fg = C.text },
LirFloatCurdirWindowDirName = { fg = C.lavender, style = { "bold" } },
}, ((O.integrations.lir and O.integrations.lir.git_status) and {
LirGitStatusBracket = { fg = C.overlay0 },
LirGitStatusIndex = { fg = C.blue },
LirGitStatusWorktree = { fg = C.yellow },
LirGitStatusUnmerged = { fg = C.red },
LirGitStatusUntracked = { fg = C.subtext0 },
LirGitStatusIgnored = { fg = C.subtext0 },
}) or {})
end
return M

View File

@ -1,7 +1,7 @@
local M = {}
-- markdown.nvim highlight groups:
-- https://github.com/MeanderingProgrammer/markdown.nvim?tab=readme-ov-file#colors
-- render-markdown.nvim highlight groups:
-- https://github.com/MeanderingProgrammer/render-markdown.nvim?tab=readme-ov-file#colors
function M.get()
local groups = {
@ -10,6 +10,11 @@ function M.get()
RenderMarkdownBullet = { fg = C.sky },
RenderMarkdownTableHead = { fg = C.blue },
RenderMarkdownTableRow = { fg = C.lavender },
RenderMarkdownSuccess = { fg = C.green },
RenderMarkdownInfo = { fg = C.sky },
RenderMarkdownHint = { fg = C.teal },
RenderMarkdownWarn = { fg = C.yellow },
RenderMarkdownError = { fg = C.red },
}
local syntax = require("catppuccin.groups.syntax").get()

View File

@ -132,6 +132,7 @@
-- sign("DapBreakpointCondition", { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = ""})
-- sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = ""})
-- ```
---@field dadbod_ui boolean?
---@field dap boolean?
---@field dap_ui boolean?
---@field dashboard boolean?
@ -149,6 +150,7 @@
-- ```
---@field fidget boolean?
---@field flash boolean?
---@field fzf boolean?
---@field gitgutter boolean?
---@field gitsigns boolean?
---@field grug_far boolean?
@ -159,6 +161,7 @@
---@field indent_blankline CtpIntegrationIndentBlankline | boolean?
---@field leap boolean?
---@field lightspeed boolean?
---@field lir CtpIntegrationLir | boolean?
-- For custom Lsp kind icon and colors, adjust your `lspsaga` config:
--
-- ```lua
@ -238,6 +241,12 @@
-- Follow the instructions on the plugins GitHub repo to set it up.
---@field colored_indent_levels boolean?
---@class CtpIntegrationLir
-- Whether to enable the integration.
---@field enabled boolean
-- Sets lir-git-status.nvim highlight groups
---@field git_status boolean
---@class CtpIntegrationMini
-- Whether to enable the integration.
---@field enabled boolean

View File

@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>catppuccin/renovate-config"
]
}

View File

@ -100,9 +100,11 @@ local function highlight_detail(ast_buf)
conf.highlights.detail,
{ linenum - 1, range.start },
{ linenum - 1, range["end"] },
"v",
false,
110
{
regtype = "v",
inclusive = false,
priority = 110,
}
)
end
end
@ -157,9 +159,11 @@ function M.update_highlight(source_buf, ast_buf)
"Search",
curline_ranges.start,
curline_ranges["end"],
"v",
false,
110
{
regtype = "v",
inclusive = false,
priority = 110,
}
)
end
end

View File

@ -142,7 +142,7 @@ local function handler(err, result, ctx)
local max_len = -1
for key, _ in pairs(ret) do
local line = tonumber(key)
local line = math.floor(tonumber(key))
local current_line =
vim.api.nvim_buf_get_lines(bufnr, line, line + 1, false)[1]
if current_line then
@ -153,7 +153,7 @@ local function handler(err, result, ctx)
for key, value in pairs(ret) do
local virt_text = ""
local line = tonumber(key)
local line = math.floor(tonumber(key))
local current_line =
vim.api.nvim_buf_get_lines(bufnr, line, line + 1, false)[1]

View File

@ -5,8 +5,8 @@ local function display(lines)
for k, line in pairs(lines) do -- Pad lines
if k ~= 1 then lines[k] = " " .. line .. " " end
end
local vim_width = api.nvim_get_option("columns")
local vim_height = api.nvim_get_option("lines")
local vim_width = api.nvim_get_option_value("columns", { scope = "local" })
local vim_height = api.nvim_get_option_value("lines", { scope = "local" })
local height = math.ceil(vim_height * 0.7 - 4)
local width = math.ceil(vim_width * 0.7)
local row = math.ceil((vim_height - height) / 2 - 1)
@ -21,19 +21,21 @@ local function display(lines)
col = col,
border = require("clangd_extensions.config").options.memory_usage.border,
})
vim.bo.shiftwidth = 2
vim.wo.foldmethod = "indent"
api.nvim_buf_set_lines(buf, 0, -1, true, lines)
api.nvim_set_option_value("shiftwidth", 2, { buf = buf })
api.nvim_set_option_value("bufhidden", "wipe", { buf = buf })
api.nvim_set_option_value("modifiable", false, { buf = buf })
api.nvim_set_option_value("buftype", "nofile", { buf = buf })
api.nvim_buf_set_keymap(buf, "n", "q", ":bd<CR>", {
vim.keymap.set("n", "q", ":bd<CR>", {
noremap = true,
silent = true,
buffer = buf,
})
api.nvim_buf_set_keymap(buf, "n", "<ESC>", ":bd<CR>", {
vim.keymap.set("n", "<ESC>", ":bd<CR>", {
noremap = true,
silent = true,
buffer = buf,
})
end

View File

@ -1,6 +1,10 @@
local function handler(_err, uri)
if not uri or uri == "" then
vim.api.nvim_echo({ { "Corresponding file cannot be determined" } }, false, {})
vim.api.nvim_echo(
{ { "Corresponding file cannot be determined" } },
false,
{}
)
return
end
local file_name = vim.uri_to_fname(uri)

View File

@ -1,42 +1,60 @@
local create_command = vim.api.nvim_create_user_command
create_command('ClangdSetInlayHints', function()
require("clangd_extensions.inlay_hints").set_inlay_hints()
end, {})
create_command('ClangdDisableInlayHints', function()
require("clangd_extensions.inlay_hints").disable_inlay_hints()
end, {})
create_command('ClangdToggleInlayHints', function()
require("clangd_extensions.inlay_hints").toggle_inlay_hints()
end, {})
create_command('ClangdAST', function(opts)
require("clangd_extensions.ast").display_ast(opts.line1, opts.line2)
end, { range = true })
create_command('ClangdTypeHierarchy', function()
require("clangd_extensions.type_hierarchy").show_hierarchy()
end, {})
create_command('ClangdSymbolInfo', function()
require("clangd_extensions.symbol_info").show_symbol_info()
end, {})
create_command(
"ClangdSetInlayHints",
function() require("clangd_extensions.inlay_hints").set_inlay_hints() end,
{}
)
create_command(
'ClangdMemoryUsage',
"ClangdDisableInlayHints",
function() require("clangd_extensions.inlay_hints").disable_inlay_hints() end,
{}
)
create_command(
"ClangdToggleInlayHints",
function() require("clangd_extensions.inlay_hints").toggle_inlay_hints() end,
{}
)
create_command(
"ClangdAST",
function(opts)
require("clangd_extensions.memory_usage").show_memory_usage(opts.args == 'expand_preamble')
require("clangd_extensions.ast").display_ast(opts.line1, opts.line2)
end,
{ range = true }
)
create_command(
"ClangdTypeHierarchy",
function() require("clangd_extensions.type_hierarchy").show_hierarchy() end,
{}
)
create_command(
"ClangdSymbolInfo",
function() require("clangd_extensions.symbol_info").show_symbol_info() end,
{}
)
create_command(
"ClangdMemoryUsage",
function(opts)
require("clangd_extensions.memory_usage").show_memory_usage(
opts.args == "expand_preamble"
)
end,
{
nargs = '?',
complete = function(_, _, _)
return { 'expand_preamble' }
end
nargs = "?",
complete = function(_, _, _) return { "expand_preamble" } end,
}
)
create_command('ClangdSwitchSourceHeader', function()
require("clangd_extensions.switch_source_header").switch_source_header()
end, {})
create_command(
"ClangdSwitchSourceHeader",
function()
require("clangd_extensions.switch_source_header").switch_source_header()
end,
{}
)

View File

@ -48,17 +48,89 @@ source.complete = function(self, params, callback)
end)
end
source.resolve = function(self, completion_item, callback)
--- get documentation in separate thread
---@param _ any
---@param completion_item lsp.CompletionItem
---@param callback fun(completion_item: lsp.CompletionItem|nil)
source.resolve = function(_, completion_item, callback)
local data = completion_item.data
if data.stat and data.stat.type == 'file' then
local ok, documentation = pcall(function()
return self:_get_documentation(data.path, constants.max_lines)
end)
if ok then
completion_item.documentation = documentation
end
---@diagnostic disable-next-line: undefined-field
if not data.stat or data.stat.type ~= 'file' then
-- return right away with no changes / no added docs
callback(completion_item)
return
end
callback(completion_item)
local work
work = assert(vim.uv.new_work(
--- Read file in thread
---@param filepath string
---@param count number max line count (-1 if no max)
---@return string|nil, string (error, serialized_table) either some error or the serialized table
function(filepath, count)
local ok, binary = pcall(io.open, filepath, 'rb')
if not ok or binary == nil then
---@diagnostic disable-next-line: redundant-return-value
return nil, vim.json.encode({
kind = "binary",
contents = "« cannot read this file »"
})
end
local first_kb = binary:read(1024)
if first_kb:find('\0') then
---@diagnostic disable-next-line: redundant-return-value
return nil, vim.json.encode({kind = "binary", contents = 'binary file'})
end
local contents = {}
for content in first_kb:gmatch("[^\r\n]+") do
table.insert(contents, content)
if count > -1 and #contents >= count then
break
end
end
---@diagnostic disable-next-line: redundant-return-value
return nil, vim.json.encode({contents = contents})
end,
--- deserialize doc and call callback(…)
---@param serialized_fileinfo string
function(worker_error, serialized_fileinfo)
if worker_error then
error(string.format("Worker error while fetching file doc: %s", worker_error))
end
local read_ok, file_info = pcall(vim.json.decode, serialized_fileinfo, {luanil = {object = true, array = true}})
if not read_ok then
error(string.format("Unexpected problem de-serializing item info: «%s»",
serialized_fileinfo))
end
if file_info.kind == "binary" then
completion_item.documentation = {
kind = cmp.lsp.MarkupKind.PlainText,
value = file_info.contents,
}
else
local contents = file_info.contents
local filetype = vim.filetype.match({contents = contents})
if not filetype then
completion_item.documentation = {
kind = cmp.lsp.MarkupKind.PlainText,
value = table.concat(contents, '\n'),
}
else
table.insert(contents, 1, '```' .. filetype)
table.insert(contents, '```')
completion_item.documentation = {
kind = cmp.lsp.MarkupKind.Markdown,
value = table.concat(contents, '\n'),
}
end
end
callback(completion_item)
end
))
work:queue(data.path, constants.max_lines or -1, cmp.lsp.MarkupKind.Markdown)
end
source._dirname = function(self, params, option)
@ -113,13 +185,22 @@ source._dirname = function(self, params, option)
end
source._candidates = function(_, dirname, include_hidden, option, callback)
local entries, err = vim.loop.fs_scandir(dirname)
local entries, err = vim.uv.fs_scandir(dirname)
if err then
return callback(err, nil)
end
local work
work = assert(vim.loop.new_work(
work = assert(vim.uv.new_work(
--- create path entries
---@param _entries uv_fs_t
---@param _dirname any see vim.fn.resolve()
---@param _include_hidden boolean
---@param label_trailing_slash boolean
---@param trailing_slash boolean
---@param file_kind table<string,number> see cmp.lsp.CompletionItemKind.Filee
---@param folder_kind table<string,number> see cmp.lsp.CompletionItemKind.Folder
---@return string|nil, string (error, serialized_results) "error text", nil or nil, "serialized items"
function(_entries, _dirname, _include_hidden,
label_trailing_slash, trailing_slash,
file_kind, folder_kind)
@ -131,13 +212,13 @@ source._candidates = function(_, dirname, include_hidden, option, callback)
end
local path = _dirname .. '/' .. name
local stat = assert(vim.loop.fs_stat)(path)
local stat = assert(vim.uv.fs_stat)(path)
local lstat = nil
if stat then
fs_type = stat.type
elseif fs_type == 'link' then
-- Broken symlink
lstat = assert(vim.loop.fs_lstat)(_dirname)
lstat = assert(vim.uv.fs_lstat)(_dirname)
if not lstat then
return
end
@ -169,8 +250,9 @@ source._candidates = function(_, dirname, include_hidden, option, callback)
end
while true do
local name, fs_type, e = assert(vim.loop.fs_scandir_next)(_entries)
local name, fs_type, e = assert(vim.uv.fs_scandir_next)(_entries)
if e then
---@diagnostic disable-next-line: redundant-return-value
return fs_type, ""
end
if not name then
@ -179,8 +261,13 @@ source._candidates = function(_, dirname, include_hidden, option, callback)
create_item(name, fs_type)
end
---@diagnostic disable-next-line: redundant-return-value
return nil, vim.json.encode(items)
end, function(worker_error, serialized_items)
end,
---
---@param worker_error string|nil non-nil if some error happened in worker
---@param serialized_items string array-of-items serialized as string
function(worker_error, serialized_items)
if worker_error then
callback(err, nil)
return
@ -218,35 +305,5 @@ source._validate_option = function(_, params)
return option
end
source._get_documentation = function(_, filename, count)
local binary = assert(io.open(filename, 'rb'))
local first_kb = binary:read(1024)
if first_kb:find('\0') then
return {kind = cmp.lsp.MarkupKind.PlainText, value = 'binary file'}
end
local contents = {}
for content in first_kb:gmatch("[^\r\n]+") do
table.insert(contents, content)
if count ~= nil and #contents >= count then
break
end
end
local filetype = vim.filetype.match({filename = filename})
if not filetype then
return {
kind = cmp.lsp.MarkupKind.PlainText,
value = table.concat(contents, '\n'),
}
end
table.insert(contents, 1, '```' .. filetype)
table.insert(contents, '```')
return {
kind = cmp.lsp.MarkupKind.Markdown,
value = table.concat(contents, '\n'),
}
end
return source

View File

@ -10,7 +10,7 @@ body:
- type: input
attributes:
label: "Neovim version (nvim -v)"
placeholder: "0.8.0 commit db1b0ee3b30f"
placeholder: "NVIM v0.10.1"
validations:
required: true
- type: input
@ -19,6 +19,12 @@ body:
placeholder: "MacOS 11.5"
validations:
required: true
- type: checkboxes
attributes:
label: Read debugging tips
options:
- label: I have read through the [debugging tips](https://github.com/stevearc/conform.nvim/blob/master/doc/debugging.md).
required: true
- type: checkboxes
attributes:
label: Add the debug logs

View File

@ -1,3 +1,3 @@
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
#!/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/bash
set -e
make fastlint

View File

@ -1,4 +1,4 @@
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
#!/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/bash
set -e
IFS=' '
while read local_ref _local_sha _remote_ref _remote_sha; do

View File

@ -50,7 +50,6 @@ jobs:
strategy:
matrix:
include:
- nvim_tag: v0.9.4
- nvim_tag: v0.10.0
name: Run tests

View File

@ -0,0 +1,9 @@
{
"runtime": {
"version": "LuaJIT",
"pathStrict": true
},
"type": {
"checkTableShape": true
}
}

View File

@ -1,5 +1,46 @@
# Changelog
## [8.1.0](https://github.com/stevearc/conform.nvim/compare/v8.0.0...v8.1.0) (2024-09-10)
### Features
* **deno:** add support for .mjs files ([#528](https://github.com/stevearc/conform.nvim/issues/528)) ([e82b7b1](https://github.com/stevearc/conform.nvim/commit/e82b7b13b0ed348ce4dbf1495f9b1872d33f9d3f))
* **zine:** add superhtml and ziggy support ([#531](https://github.com/stevearc/conform.nvim/issues/531)) ([392fc98](https://github.com/stevearc/conform.nvim/commit/392fc98c475b4f0552078104624e509b4826d197))
### Bug Fixes
* **log:** prepend date to log lines ([#529](https://github.com/stevearc/conform.nvim/issues/529)) ([c6728c5](https://github.com/stevearc/conform.nvim/commit/c6728c55d1e07da3138beea453d4078668719ee0))
## [8.0.0](https://github.com/stevearc/conform.nvim/compare/v7.1.0...v8.0.0) (2024-08-20)
### ⚠ BREAKING CHANGES
* Require Neovim 0.10+
### Code Refactoring
* Require Neovim 0.10+ ([d31323d](https://github.com/stevearc/conform.nvim/commit/d31323db3fa4a33d203dcb05150d98bd0153c42c))
## [7.1.0](https://github.com/stevearc/conform.nvim/compare/v7.0.0...v7.1.0) (2024-08-16)
### Features
* add support for cljfmt ([#500](https://github.com/stevearc/conform.nvim/issues/500)) ([42e10a3](https://github.com/stevearc/conform.nvim/commit/42e10a38cbb427f418ac17f8a472b3c7315517ba))
* add support for markdownfmt ([#511](https://github.com/stevearc/conform.nvim/issues/511)) ([960f51b](https://github.com/stevearc/conform.nvim/commit/960f51becccadc36825b2c2db266c8cffaeadbde))
* add variable for args to insert the file extension ([#510](https://github.com/stevearc/conform.nvim/issues/510)) ([0f4f299](https://github.com/stevearc/conform.nvim/commit/0f4f299dfea09d2adfd7a1da05149a0844ac8eee))
### Bug Fixes
* **djlint:** remove default indentation arguments ([#517](https://github.com/stevearc/conform.nvim/issues/517)) ([38e5f06](https://github.com/stevearc/conform.nvim/commit/38e5f062f241d89ba44f6d67d16b4bf55d3c477e))
* **docformatter:** update exit_codes, 3 is correct in in-place formatting ([#518](https://github.com/stevearc/conform.nvim/issues/518)) ([667102f](https://github.com/stevearc/conform.nvim/commit/667102f26106709cddd2dff1f699610df5b94d7f))
* **nixfmt:** update repo link and description ([#505](https://github.com/stevearc/conform.nvim/issues/505)) ([2122fe2](https://github.com/stevearc/conform.nvim/commit/2122fe2ff01e9a542fc358ee9398ce2cbddf345d))
* **sqlfluff:** don't assume ansi dialect and require config ([#519](https://github.com/stevearc/conform.nvim/issues/519)) ([bb10949](https://github.com/stevearc/conform.nvim/commit/bb10949d80dd0f60d03572f04953322785f39f7a))
## [7.0.0](https://github.com/stevearc/conform.nvim/compare/v6.1.0...v7.0.0) (2024-07-23)

View File

@ -11,6 +11,7 @@ Lightweight yet powerful formatter plugin for Neovim
- [Formatters](#formatters)
- [Customizing formatters](#customizing-formatters)
- [Recipes](#recipes)
- [Debugging](#debugging)
- [Advanced topics](#advanced-topics)
- [Options](#options)
- [Formatter options](#formatter-options)
@ -27,7 +28,7 @@ Lightweight yet powerful formatter plugin for Neovim
## Requirements
- Neovim 0.9+ (for older versions, use a [nvim-0.x branch](https://github.com/stevearc/conform.nvim/branches))
- Neovim 0.10+ (for older versions, use a [nvim-0.x branch](https://github.com/stevearc/conform.nvim/branches))
## Features
@ -205,6 +206,7 @@ You can view this list in vim with `:help conform-formatters`
- [caramel_fmt](https://caramel.run/manual/reference/cli/fmt.html) - Format Caramel code.
- [cbfmt](https://github.com/lukas-reineke/cbfmt) - A tool to format codeblocks inside markdown and org documents.
- [clang-format](https://www.kernel.org/doc/html/latest/process/clang-format.html) - Tool to format C/C++/… code according to a set of rules and heuristics.
- [cljfmt](https://github.com/weavejester/cljfmt) - cljfmt is a tool for detecting and fixing formatting errors in Clojure code.
- [cljstyle](https://github.com/greglook/cljstyle) - Formatter for Clojure code.
- [cmake_format](https://github.com/cheshirekow/cmake_format) - Parse cmake listfiles and format them nicely.
- [codespell](https://github.com/codespell-project/codespell) - Check code for common misspellings.
@ -273,6 +275,7 @@ You can view this list in vim with `:help conform-formatters`
- [llf](https://repo.or.cz/llf.git) - A LaTeX reformatter / beautifier.
- [lua-format](https://github.com/Koihik/LuaFormatter) - Code formatter for Lua.
- [markdown-toc](https://github.com/jonschlinkert/markdown-toc) - API and CLI for generating a markdown TOC (table of contents) for a README or any markdown files.
- [markdownfmt](https://github.com/shurcooL/markdownfmt) - Like gofmt, but for Markdown.
- [markdownlint](https://github.com/DavidAnson/markdownlint) - A Node.js style checker and lint tool for Markdown/CommonMark files.
- [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) - A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the markdownlint library.
- [mdformat](https://github.com/executablebooks/mdformat) - An opinionated Markdown formatter.
@ -281,7 +284,7 @@ You can view this list in vim with `:help conform-formatters`
- [mix](https://hexdocs.pm/mix/main/Mix.Tasks.Format.html) - Format Elixir files using the mix format command.
- [nickel](https://nickel-lang.org/) - Code formatter for the Nickel programming language.
- [nimpretty](https://github.com/nim-lang/nim) - nimpretty is a Nim source code beautifier that follows the official style guide.
- [nixfmt](https://github.com/serokell/nixfmt) - nixfmt is a formatter for Nix code, intended to apply a uniform style.
- [nixfmt](https://github.com/NixOS/nixfmt) - The official (but not yet stable) formatter for Nix code.
- [nixpkgs_fmt](https://github.com/nix-community/nixpkgs-fmt) - nixpkgs-fmt is a Nix code formatter for nixpkgs.
- [npm-groovy-lint](https://github.com/nvuillam/npm-groovy-lint) - Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle files using command line.
- [ocamlformat](https://github.com/ocaml-ppx/ocamlformat) - Auto-formatter for OCaml code.
@ -332,6 +335,7 @@ You can view this list in vim with `:help conform-formatters`
- [styler](https://github.com/devOpifex/r.nvim) - R formatter and linter.
- [stylish-haskell](https://github.com/haskell/stylish-haskell) - Haskell code prettifier.
- [stylua](https://github.com/JohnnyMorganz/StyLua) - An opinionated code formatter for Lua.
- [superhtml](https://github.com/kristoff-it/superhtml) - HTML Language Server and Templating Language Library.
- [swift_format](https://github.com/apple/swift-format) - Swift formatter from apple. Requires building from source with `swift build`.
- [swiftformat](https://github.com/nicklockwood/SwiftFormat) - SwiftFormat is a code library and command-line tool for reformatting `swift` code on macOS or Linux.
- [swiftlint](https://github.com/realm/SwiftLint) - A tool to enforce Swift style and conventions.
@ -358,6 +362,8 @@ You can view this list in vim with `:help conform-formatters`
- [yew-fmt](https://github.com/schvv31n/yew-fmt) - Code formatter for the Yew framework.
- [yq](https://github.com/mikefarah/yq) - YAML/JSON processor
- [zigfmt](https://github.com/ziglang/zig) - Reformat Zig source into canonical form.
- [ziggy](https://github.com/kristoff-it/ziggy) - A data serialization language for expressing clear API messages, config files, etc.
- [ziggy_schema](https://github.com/kristoff-it/ziggy) - A data serialization language for expressing clear API messages, config files, etc.
- [zprint](https://github.com/kkinnear/zprint) - Formatter for Clojure and EDN.
<!-- /FORMATTERS -->
@ -432,13 +438,22 @@ require("conform").formatters.shfmt = {
- [Format command](doc/recipes.md#format-command)
- [Autoformat with extra features](doc/recipes.md#autoformat-with-extra-features)
- [Command to toggle format-on-save](doc/recipes.md#command-to-toggle-format-on-save)
- [Automatically run slow formatters async](doc/recipes.md#automatically-run-slow-formatters-async)
- [Lazy loading with lazy.nvim](doc/recipes.md#lazy-loading-with-lazynvim)
- [Leave visual mode after range format](doc/recipes.md#leave-visual-mode-after-range-format)
- [Run the first available formatter followed by more formatters](doc/recipes.md#run-the-first-available-formatter-followed-by-more-formatters)
<!-- /RECIPES -->
## Debugging
<!-- DEBUGGING -->
- [Background](doc/debugging.md#background)
- [Tools](doc/debugging.md#tools)
- [Testing the formatter](doc/debugging.md#testing-the-formatter)
<!-- /DEBUGGING -->
## Advanced topics
<!-- ADVANCED -->

View File

@ -22,8 +22,6 @@ The way this "aftermarket" range formatting works is conform will format the ent
## Injected language formatting (code blocks)
Requires: Neovim 0.9+
Sometimes you may have a file that contains small chunks of code in another language. This is most common for markup formats like markdown and neorg, but can theoretically be present in any filetype (for example, embedded SQL queries in a host language). For files like this, it would be nice to be able to format these code chunks using their language-specific formatters.
The way that conform supports this is via the `injected` formatter. If you run this formatter on a file, it will use treesitter to parse out the blocks in the file that have different languages and runs the formatters for that filetype (configured with `formatters_by_ft`). The formatters are run in parallel, one job for each language block.

View File

@ -288,6 +288,8 @@ FORMATTERS *conform-formatter
`cbfmt` - A tool to format codeblocks inside markdown and org documents.
`clang-format` - Tool to format C/C++/… code according to a set of rules and
heuristics.
`cljfmt` - cljfmt is a tool for detecting and fixing formatting errors in
Clojure code.
`cljstyle` - Formatter for Clojure code.
`cmake_format` - Parse cmake listfiles and format them nicely.
`codespell` - Check code for common misspellings.
@ -378,6 +380,7 @@ FORMATTERS *conform-formatter
`lua-format` - Code formatter for Lua.
`markdown-toc` - API and CLI for generating a markdown TOC (table of contents)
for a README or any markdown files.
`markdownfmt` - Like gofmt, but for Markdown.
`markdownlint` - A Node.js style checker and lint tool for Markdown/CommonMark
files.
`markdownlint-cli2` - A fast, flexible, configuration-based command-line
@ -391,8 +394,7 @@ FORMATTERS *conform-formatter
`nickel` - Code formatter for the Nickel programming language.
`nimpretty` - nimpretty is a Nim source code beautifier that follows the
official style guide.
`nixfmt` - nixfmt is a formatter for Nix code, intended to apply a uniform
style.
`nixfmt` - The official (but not yet stable) formatter for Nix code.
`nixpkgs_fmt` - nixpkgs-fmt is a Nix code formatter for nixpkgs.
`npm-groovy-lint` - Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle
files using command line.
@ -459,6 +461,7 @@ FORMATTERS *conform-formatter
`styler` - R formatter and linter.
`stylish-haskell` - Haskell code prettifier.
`stylua` - An opinionated code formatter for Lua.
`superhtml` - HTML Language Server and Templating Language Library.
`swift_format` - Swift formatter from apple. Requires building from source with
`swift build`.
`swiftformat` - SwiftFormat is a code library and command-line tool for
@ -494,6 +497,10 @@ FORMATTERS *conform-formatter
`yew-fmt` - Code formatter for the Yew framework.
`yq` - YAML/JSON processor
`zigfmt` - Reformat Zig source into canonical form.
`ziggy` - A data serialization language for expressing clear API messages,
config files, etc.
`ziggy_schema` - A data serialization language for expressing clear API
messages, config files, etc.
`zprint` - Formatter for Clojure and EDN.
================================================================================

View File

@ -0,0 +1,94 @@
# Debugging
When you are experiencing problems with a formatter, this doc is intended to give you the background
information and tools you need to figure out what is going wrong. It should help you answer
questions like "why isn't my formatter working?" and "why is my formatter using the wrong format?"
<!-- TOC -->
- [Background](#background)
- [Tools](#tools)
- [Testing the formatter](#testing-the-formatter)
<!-- /TOC -->
## Background
How does conform work?
Under the hood, conform is just running a shell command, capturing the output, and replacing the
buffer contents with that output. There are a few fancy things happening with [minimal format
diffs](advanced_topics.md#minimal-format-diffs), but in practice there are almost never problems
with that system so you can mostly ignore it.
Conform runs the formatters using `:help vim.system()`, and does one of two things. Some formatters
support formatting _from_ stdin and _to_ stdout. For these, we pipe the buffer text to the process
via stdin, and read the stdout back as the new buffer contents. For formatters that don't support
stdin/out, we create a temporary file in the same directory, write the buffer to it, run the
formatter, and read back the modified tempfile as the new buffer contents.
## Tools
Conform has two very useful tools for debugging misbehaving formatters: logging and `:ConformInfo`.
Try running `:ConformInfo` now; you should see something like the window below:
<img width="1243" alt="Screenshot 2024-08-07 at 10 03 17PM" src="https://github.com/user-attachments/assets/2dbbc2b7-05c1-4c9f-bb8c-345d039b624c">
This contains a snippet of the log file, the location of the log file in case you need to see more
logs (you can use `gf` to jump to it), available formatters for the current buffer, and a list of
all the configured formatters. Each formatter has a status, an error message if there is something
wrong, a list of filetypes it applies to, and the resolved path to the executable.
This should be enough to fix many issues. Double check to make sure your formatter is `ready` and
that it is configured to run on the filetype(s) you expect. Also double check the path to the
executable. If all of those look good, then it's time to make more use of the logs.
The first thing you will want to do is increase the verbosity of the logs. Do this by setting the
`log_level` option:
```lua
require("conform").setup({
log_level = vim.log.levels.DEBUG,
})
```
It is recommended to start with `DEBUG` level. You can also use `TRACE`, which will log the entire
file input and output to the formatter. This can be helpful in some situations, but takes up a lot
of visual space and so is not recommended until you need that information specifically.
## Testing the formatter
Once you set the log level, try the format operations again, then open the log file (remember, you
can find it from `:ConformInfo`). You're looking for the lines that tell you what command is being
run. It should look like this:
```
21:50:31[DEBUG] Run command: { "black", "--stdin-filename", "/Users/stevearc/dotfiles/vimplugins/conform.nvim/scripts/generate.py", "--quiet", "-" }
21:50:31[DEBUG] Run default CWD: /Users/stevearc/dotfiles/vimplugins/conform.nvim
```
This is logging the lua table that is passed to `vim.system()`. The first thing to do is to take this
command and run it directly in your shell and see what happens. For formatters using stdin/out, it
will look like this:
```
cat path/to/file.py | black --stdin-filename path/to/file.py --quiet -
```
Note that this will print the entire formatted file to stdout. It will be much easier for you if you
can come up with a small test file just a couple lines long that reproduces this issue. MAKE SURE
that you `cd` into the CWD directory from the log lines, as that is the directory that conform will
run the command from. If your formatter doesn't use stdin/out, do the same thing but omit the `cat`.
The command in the log line will contain a path to a temporary file. Just replace that with the path
to the real file:
```
black --quiet path/to/file.py
```
**Q:** What is the point of all of this? \
**A:** We're trying to isolate where the problem is coming from: the formatter, the environment
configuring the formatter, Neovim, or conform. By confirming that the format command works in the
shell, we can eliminate some of those possibilities. If the format command _doesn't_ work in the
shell, you will need to iterate on that until you can find one that works. Please DO NOT file an
issue on this repo until you have a functioning format command in your shell.

View File

@ -5,7 +5,6 @@
- [Format command](#format-command)
- [Autoformat with extra features](#autoformat-with-extra-features)
- [Command to toggle format-on-save](#command-to-toggle-format-on-save)
- [Automatically run slow formatters async](#automatically-run-slow-formatters-async)
- [Lazy loading with lazy.nvim](#lazy-loading-with-lazynvim)
- [Leave visual mode after range format](#leave-visual-mode-after-range-format)
- [Run the first available formatter followed by more formatters](#run-the-first-available-formatter-followed-by-more-formatters)
@ -108,35 +107,6 @@ end, {
})
```
## Automatically run slow formatters async
This snippet will automatically detect which formatters take too long to run synchronously and will run them async on save instead.
```lua
local slow_format_filetypes = {}
require("conform").setup({
format_on_save = function(bufnr)
if slow_format_filetypes[vim.bo[bufnr].filetype] then
return
end
local function on_format(err)
if err and err:match("timeout$") then
slow_format_filetypes[vim.bo[bufnr].filetype] = true
end
end
return { timeout_ms = 200, lsp_format = "fallback" }, on_format
end,
format_after_save = function(bufnr)
if not slow_format_filetypes[vim.bo[bufnr].filetype] then
return
end
return { lsp_format = "fallback" }
end,
})
```
## Lazy loading with lazy.nvim
Here is the recommended config for lazy-loading using lazy.nvim

View File

@ -7,12 +7,8 @@ local M = {}
---@enum conform.ERROR_CODE
M.ERROR_CODE = {
-- Command was passed invalid arguments
INVALID_ARGS = 1,
-- Command was not executable
NOT_EXECUTABLE = 2,
-- Error occurred during when calling jobstart
JOBSTART = 3,
-- Error occurred during when calling vim.system
VIM_SYSTEM = 3,
-- Command timed out during execution
TIMEOUT = 4,
-- Command was pre-empted by another call to format
@ -39,10 +35,7 @@ end
---@param code conform.ERROR_CODE
---@return boolean
M.is_execution_error = function(code)
return code == M.ERROR_CODE.RUNTIME
or code == M.ERROR_CODE.NOT_EXECUTABLE
or code == M.ERROR_CODE.INVALID_ARGS
or code == M.ERROR_CODE.JOBSTART
return code == M.ERROR_CODE.RUNTIME or code == M.ERROR_CODE.VIM_SYSTEM
end
---@param err1? conform.Error

View File

@ -0,0 +1,10 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/weavejester/cljfmt",
description = "cljfmt is a tool for detecting and fixing formatting errors in Clojure code.",
},
command = "cljfmt",
args = { "fix", "-" },
stdin = true,
}

View File

@ -4,6 +4,7 @@ local extensions = {
json = "json",
jsonc = "jsonc",
markdown = "md",
esmodule = "mjs",
typescript = "ts",
typescriptreact = "tsx",
}

View File

@ -6,9 +6,10 @@ return {
description = "✨ HTML Template Linter and Formatter. Django - Jinja - Nunjucks - Handlebars - GoLang.",
},
command = "djlint",
args = function(_, ctx)
return { "--reformat", "--indent", ctx.shiftwidth, "-" }
end,
args = {
"--reformat",
"-",
},
cwd = util.root_file({
".djlintrc",
}),

View File

@ -7,4 +7,5 @@ return {
command = "docformatter",
args = { "--in-place", "$FILENAME" },
stdin = false,
exit_codes = { 0, 3 },
}

View File

@ -112,6 +112,7 @@ return {
url = "doc/advanced_topics.md#injected-language-formatting-code-blocks",
description = "Format treesitter injected languages.",
},
---@type conform.InjectedFormatterOptions
options = {
-- Set to true to ignore errors
ignore_errors = false,
@ -151,8 +152,8 @@ return {
callback("No treesitter parser for buffer")
return
end
---@type conform.InjectedFormatterOptions
local options = self.options
---@cast options conform.InjectedFormatterOptions
---@param lang string
---@return nil|conform.FiletypeFormatter

View File

@ -0,0 +1,8 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/shurcooL/markdownfmt",
description = "Like gofmt, but for Markdown.",
},
command = "markdownfmt",
}

View File

@ -1,8 +1,8 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/serokell/nixfmt",
description = "nixfmt is a formatter for Nix code, intended to apply a uniform style.",
url = "https://github.com/NixOS/nixfmt",
description = "The official (but not yet stable) formatter for Nix code.",
},
command = "nixfmt",
}

View File

@ -7,7 +7,7 @@ return {
description = "A modular SQL linter and auto-formatter with support for multiple dialects and templated code.",
},
command = "sqlfluff",
args = { "fix", "--dialect=ansi", "-" },
args = { "fix", "-" },
stdin = true,
cwd = util.root_file({
".sqlfluff",
@ -16,5 +16,5 @@ return {
"setup.cfg",
"tox.ini",
}),
require_cwd = false,
require_cwd = true,
}

View File

@ -0,0 +1,9 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/kristoff-it/superhtml",
description = "HTML Language Server and Templating Language Library.",
},
command = "superhtml",
args = { "fmt", "--stdin" },
}

View File

@ -0,0 +1,9 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/kristoff-it/ziggy",
description = "A data serialization language for expressing clear API messages, config files, etc.",
},
command = "ziggy",
args = { "fmt", "--stdin" },
}

View File

@ -0,0 +1,9 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/kristoff-it/ziggy",
description = "A data serialization language for expressing clear API messages, config files, etc.",
},
command = "ziggy",
args = { "fmt", "--stdin-schema" },
}

View File

@ -1,12 +1,5 @@
local M = {}
---@diagnostic disable: deprecated
-- The "report_" functions have been deprecated, so use the new ones if defined.
local health_start = vim.health.start or vim.health.report_start
local health_warn = vim.health.warn or vim.health.report_warn
local health_info = vim.health.info or vim.health.report_info
local health_ok = vim.health.ok or vim.health.report_ok
---@param name string
---@return string[]
local function get_formatter_filetypes(name)
@ -36,18 +29,21 @@ end
M.check = function()
local conform = require("conform")
health_start("conform.nvim report")
vim.health.start("conform.nvim report")
local log = require("conform.log")
health_info(string.format("Log file: %s", log.get_logfile()))
if vim.fn.has("nvim-0.10") == 0 then
vim.health.error("Neovim 0.10 or later is required")
end
vim.health.info(string.format("Log file: %s", log.get_logfile()))
local all_formatters = conform.list_all_formatters()
for _, formatter in ipairs(all_formatters) do
if not formatter.available then
health_warn(string.format("%s unavailable: %s", formatter.name, formatter.available_msg))
vim.health.warn(string.format("%s unavailable: %s", formatter.name, formatter.available_msg))
else
local filetypes = get_formatter_filetypes(formatter.name)
health_ok(string.format("%s ready (%s)", formatter.name, table.concat(filetypes, ", ")))
vim.health.ok(string.format("%s ready (%s)", formatter.name, table.concat(filetypes, ", ")))
end
end
end
@ -75,6 +71,12 @@ M.show_window = function()
local lines = {}
local highlights = {}
local logfile = log.get_logfile()
if vim.fn.has("nvim-0.10") == 0 then
table.insert(lines, "Neovim 0.10 or later is required")
table.insert(highlights, { "DiagnosticError", #lines, 0, -1 })
end
table.insert(lines, string.format("Log file: %s", logfile))
table.insert(highlights, { "Title", #lines, 0, 10 })
if vim.fn.filereadable(logfile) == 1 then
@ -113,7 +115,7 @@ M.show_window = function()
table.insert(lines, line)
table.insert(
highlights,
{ "DiagnosticInfo", #lines, formatter.name:len(), formatter.name:len() + 6 }
{ "DiagnosticOk", #lines, formatter.name:len(), formatter.name:len() + 6 }
)
table.insert(highlights, {
"DiagnosticInfo",

View File

@ -52,8 +52,8 @@ end
---@param opts? conform.setupOpts
M.setup = function(opts)
if vim.fn.has("nvim-0.9") == 0 then
notify("conform.nvim requires Neovim 0.9+", vim.log.levels.ERROR)
if vim.fn.has("nvim-0.10") == 0 then
notify("conform.nvim requires Neovim 0.10+", vim.log.levels.ERROR)
return
end
opts = opts or {}
@ -311,7 +311,7 @@ end
---@param bufnr integer
---@param mode "v"|"V"
---@return table {start={row,col}, end={row,col}} using (1, 0) indexing
---@return conform.Range {start={row,col}, end={row,col}} using (1, 0) indexing
local function range_from_selection(bufnr, mode)
-- [bufnum, lnum, col, off]; both row and column 1-indexed
local start = vim.fn.getpos("v")
@ -407,6 +407,13 @@ local has_notified_ft_no_formatters = {}
---@param callback? fun(err: nil|string, did_edit: nil|boolean) Called once formatting has completed
---@return boolean True if any formatters were attempted
M.format = function(opts, callback)
if vim.fn.has("nvim-0.10") == 0 then
notify_once("conform.nvim requires Neovim 0.10+", vim.log.levels.ERROR)
if callback then
callback("conform.nvim requires Neovim 0.10+")
end
return false
end
opts = opts or {}
local has_explicit_formatters = opts.formatters ~= nil
-- If formatters were not passed in directly, fetch any options from formatters_by_ft

View File

@ -36,7 +36,7 @@ local function format(level, msg, ...)
end
end
local ok, text = pcall(string.format, msg, vim.F.unpack_len(args))
local timestr = vim.fn.strftime("%H:%M:%S")
local timestr = vim.fn.strftime("%Y-%m-%d %H:%M:%S")
if ok then
local str_level = levels_reverse[level]
return string.format("%s[%s] %s", timestr, str_level, text)

View File

@ -14,12 +14,16 @@ local M = {}
---@param formatter_name string
---@param ctx conform.Context
---@param config conform.JobFormatterConfig
---@return string|string[]
---@return string[]
M.build_cmd = function(formatter_name, ctx, config)
local command = config.command
if type(command) == "function" then
command = command(config, ctx)
end
local exepath = vim.fn.exepath(command)
if exepath ~= "" then
command = exepath
end
---@type string|string[]
local args = {}
if ctx.range and config.range_args then
@ -29,8 +33,7 @@ M.build_cmd = function(formatter_name, ctx, config)
local computed_args = config.args
if type(computed_args) == "function" then
args = computed_args(config, ctx)
else
---@diagnostic disable-next-line: cast-local-type
elseif computed_args then
args = computed_args
end
end
@ -48,10 +51,10 @@ M.build_cmd = function(formatter_name, ctx, config)
:gsub("$FILENAME", ctx.filename)
:gsub("$DIRNAME", ctx.dirname)
:gsub("$RELATIVE_FILEPATH", compute_relative_filepath)
return command .. " " .. interpolated
:gsub("$EXTENSION", ctx.filename:match(".*(%..*)$") or "")
return util.shell_build_argv(command .. " " .. interpolated)
else
local cmd = { command }
---@diagnostic disable-next-line: param-type-mismatch
for _, v in ipairs(args) do
if v == "$FILENAME" then
v = ctx.filename
@ -59,6 +62,8 @@ M.build_cmd = function(formatter_name, ctx, config)
v = ctx.dirname
elseif v == "$RELATIVE_FILEPATH" then
v = compute_relative_filepath()
elseif v == "$EXTENSION" then
v = ctx.filename:match(".*(%..*)$") or ""
end
table.insert(cmd, v)
end
@ -356,40 +361,29 @@ local function run_formatter(bufnr, formatter, config, ctx, input_lines, opts, c
if env then
log.debug("Run ENV: %s", env)
end
local stdout
local stderr
local exit_codes = config.exit_codes or { 0 }
local jid
local ok, jid_or_err = pcall(vim.fn.jobstart, cmd, {
cwd = cwd,
env = env,
stdout_buffered = true,
stderr_buffered = true,
stdin = config.stdin and "pipe" or "null",
on_stdout = function(_, data)
if config.stdin then
stdout = data
end
end,
on_stderr = function(_, data)
stderr = data
end,
on_exit = function(_, code)
local pid
local ok, job_or_err = pcall(
vim.system,
cmd,
{
cwd = cwd,
env = env,
stdin = config.stdin and buffer_text,
text = true,
},
vim.schedule_wrap(function(result)
local code = result.code
local stdout = result.stdout and vim.split(result.stdout, "\n") or {}
local stderr = result.stderr and vim.split(result.stderr, "\n") or {}
if vim.tbl_contains(exit_codes, code) then
local output
local output = stdout
if not config.stdin then
local fd = assert(uv.fs_open(ctx.filename, "r", 448)) -- 0700
local stat = assert(uv.fs_fstat(fd))
local content = assert(uv.fs_read(fd, stat.size))
uv.fs_close(fd)
output = vim.split(content, "\r?\n", {})
else
output = stdout
-- trim trailing \r in every line
-- so that both branches of this if block behaves the same
for i, line in ipairs(output) do
output[i] = string.gsub(line, "\r$", "")
end
output = vim.split(content, "\r?\n")
end
-- Remove the trailing newline from the output to convert back to vim lines representation
if add_extra_newline and output[#output] == "" then
@ -417,7 +411,7 @@ local function run_formatter(bufnr, formatter, config, ctx, input_lines, opts, c
end
if
vim.api.nvim_buf_is_valid(bufnr)
and jid ~= vim.b[bufnr].conform_jid
and pid ~= vim.b[bufnr].conform_pid
and opts.exclusive
then
callback({
@ -431,35 +425,21 @@ local function run_formatter(bufnr, formatter, config, ctx, input_lines, opts, c
})
end
end
end,
})
end)
)
if not ok then
callback({
code = errors.ERROR_CODE.JOBSTART,
message = string.format("Formatter '%s' error in jobstart: %s", formatter.name, jid_or_err),
code = errors.ERROR_CODE.VIM_SYSTEM,
message = string.format("Formatter '%s' error in vim.system: %s", formatter.name, job_or_err),
})
return
end
jid = jid_or_err
if jid == 0 then
callback({
code = errors.ERROR_CODE.INVALID_ARGS,
message = string.format("Formatter '%s' invalid arguments", formatter.name),
})
elseif jid == -1 then
callback({
code = errors.ERROR_CODE.NOT_EXECUTABLE,
message = string.format("Formatter '%s' command is not executable", formatter.name),
})
elseif config.stdin then
vim.api.nvim_chan_send(jid, buffer_text)
vim.fn.chanclose(jid, "stdin")
end
pid = job_or_err.pid
if opts.exclusive then
vim.b[bufnr].conform_jid = jid
vim.b[bufnr].conform_pid = pid
end
return jid
return pid
end
---@param bufnr integer
@ -524,9 +504,9 @@ M.format_async = function(bufnr, formatters, range, opts, callback)
end
-- kill previous jobs for buffer
local prev_jid = vim.b[bufnr].conform_jid
if prev_jid and opts.exclusive then
if vim.fn.jobstop(prev_jid) == 1 then
local prev_pid = vim.b[bufnr].conform_pid
if prev_pid and opts.exclusive then
if uv.kill(prev_pid) == 0 then
log.info("Canceled previous format job for %s", vim.api.nvim_buf_get_name(bufnr))
end
end
@ -616,9 +596,9 @@ M.format_sync = function(bufnr, formatters, timeout_ms, range, opts)
local original_lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
-- kill previous jobs for buffer
local prev_jid = vim.b[bufnr].conform_jid
if prev_jid and opts.exclusive then
if vim.fn.jobstop(prev_jid) == 1 then
local prev_pid = vim.b[bufnr].conform_pid
if prev_pid and opts.exclusive then
if uv.kill(prev_pid) == 0 then
log.info("Canceled previous format job for %s", vim.api.nvim_buf_get_name(bufnr))
end
end
@ -669,7 +649,7 @@ M.format_lines_sync = function(bufnr, formatters, timeout_ms, range, input_lines
---@type conform.FormatterConfig
local config = assert(require("conform").get_formatter_config(formatter.name, bufnr))
local ctx = M.build_context(bufnr, config, range)
local jid = run_formatter(
local pid = run_formatter(
bufnr,
formatter,
config,
@ -689,8 +669,8 @@ M.format_lines_sync = function(bufnr, formatters, timeout_ms, range, input_lines
end, 5)
if not wait_result then
if jid then
vim.fn.jobstop(jid)
if pid then
uv.kill(pid)
end
if wait_reason == -1 then
return errors.coalesce(final_err, {

View File

@ -49,13 +49,7 @@ end
---@return fun(self: conform.FormatterConfig, ctx: conform.Context): nil|string
M.root_file = function(files)
return function(self, ctx)
if vim.fn.has("nvim-0.10") == 1 then
return vim.fs.root(ctx.dirname, files)
end
local found = vim.fs.find(files, { upward = true, path = ctx.dirname })[1]
if found then
return vim.fs.dirname(found)
end
return vim.fs.root(ctx.dirname, files)
end
end
@ -209,4 +203,47 @@ M.parse_rust_edition = function(dir)
end
end
---@param cmd string
---@return string[]
M.shell_build_argv = function(cmd)
local argv = {}
-- If the shell starts with a quote, it contains spaces (from :help 'shell').
-- The shell may also have additional arguments in it, separated by spaces.
if vim.startswith(vim.o.shell, '"') then
local quoted = vim.o.shell:match('^"([^"]+)"')
table.insert(argv, quoted)
vim.list_extend(argv, vim.split(vim.o.shell:sub(quoted:len() + 3), "%s+", { trimempty = true }))
else
vim.list_extend(argv, vim.split(vim.o.shell, "%s+"))
end
vim.list_extend(argv, vim.split(vim.o.shellcmdflag, "%s+", { trimempty = true }))
if vim.o.shellxquote ~= "" then
-- When shellxquote is "(", we should escape the shellxescape characters with '^'
-- See :help 'shellxescape'
if vim.o.shellxquote == "(" and vim.o.shellxescape ~= "" then
cmd = cmd:gsub(".", function(char)
if string.find(vim.o.shellxescape, char, 1, true) then
return "^" .. char
else
return char
end
end)
end
if vim.o.shellxquote == "(" then
cmd = "(" .. cmd .. ")"
elseif vim.o.shellxquote == '"(' then
cmd = '"(' .. cmd .. ')"'
else
cmd = vim.o.shellxquote .. cmd .. vim.o.shellxquote
end
end
table.insert(argv, cmd)
return argv
end
return M

View File

@ -1,4 +1,4 @@
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
#!/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/bash
set -e
mkdir -p ".testenv/config/nvim"

View File

@ -26,6 +26,7 @@ README = os.path.join(ROOT, "README.md")
DOC = os.path.join(ROOT, "doc")
RECIPES = os.path.join(DOC, "recipes.md")
ADVANCED = os.path.join(DOC, "advanced_topics.md")
DEBUGGING = os.path.join(DOC, "debugging.md")
FORMATTER_OPTIONS = os.path.join(DOC, "formatter_options.md")
VIMDOC = os.path.join(DOC, "conform.txt")
OPTIONS = os.path.join(ROOT, "scripts", "options_doc.lua")
@ -143,21 +144,22 @@ def update_readme_toc():
)
def update_recipes_toc():
def update_tocs():
toc = ["\n"] + generate_md_toc(RECIPES) + ["\n"]
replace_section(RECIPES, r"^<!-- TOC -->$", r"^<!-- /TOC -->$", toc)
subtoc = add_md_link_path("doc/recipes.md", toc)
replace_section(README, r"^<!-- RECIPES -->$", r"^<!-- /RECIPES -->$", subtoc)
def update_advanced_toc():
toc = ["\n"] + generate_md_toc(ADVANCED) + ["\n"]
replace_section(ADVANCED, r"^<!-- TOC -->$", r"^<!-- /TOC -->$", toc)
subtoc = add_md_link_path("doc/advanced_topics.md", toc)
replace_section(README, r"^<!-- ADVANCED -->$", r"^<!-- /ADVANCED -->$", subtoc)
toc = ["\n"] + generate_md_toc(DEBUGGING) + ["\n"]
replace_section(DEBUGGING, r"^<!-- TOC -->$", r"^<!-- /TOC -->$", toc)
subtoc = add_md_link_path("doc/debugging.md", toc)
replace_section(README, r"^<!-- DEBUGGING -->$", r"^<!-- /DEBUGGING -->$", subtoc)
def update_formatter_options_toc():
toc = ["\n"] + generate_md_toc(FORMATTER_OPTIONS) + ["\n"]
replace_section(FORMATTER_OPTIONS, r"^<!-- TOC -->$", r"^<!-- /TOC -->$", toc)
subtoc = add_md_link_path("doc/formatter_options.md", toc)
@ -210,8 +212,6 @@ def main() -> None:
update_autocmd_md()
update_formatter_options_md()
update_md_api()
update_recipes_toc()
update_advanced_toc()
update_formatter_options_toc()
update_tocs()
update_readme_toc()
generate_vimdoc()

View File

@ -1,4 +1,4 @@
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
#!/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/bash
set -e

View File

@ -1,5 +1,6 @@
require("plenary.async").tests.add_to_env()
local conform = require("conform")
local fs = require("conform.fs")
local runner = require("conform.runner")
local test_util = require("tests.test_util")
local util = require("conform.util")
@ -121,7 +122,7 @@ describe("runner", function()
local config = assert(conform.get_formatter_config("test"))
local ctx = runner.build_context(0, config)
local cmd = runner.build_cmd("", ctx, config)
assert.are.same({ "echo", vim.api.nvim_buf_get_name(bufnr) }, cmd)
assert.are.same({ vim.fn.exepath("echo"), vim.api.nvim_buf_get_name(bufnr) }, cmd)
end)
it("replaces $DIRNAME in args", function()
@ -135,7 +136,10 @@ describe("runner", function()
local config = assert(conform.get_formatter_config("test"))
local ctx = runner.build_context(0, config)
local cmd = runner.build_cmd("", ctx, config)
assert.are.same({ "echo", vim.fs.dirname(vim.api.nvim_buf_get_name(bufnr)) }, cmd)
assert.are.same(
{ vim.fn.exepath("echo"), vim.fs.dirname(vim.api.nvim_buf_get_name(bufnr)) },
cmd
)
end)
it("resolves arg function", function()
@ -150,35 +154,7 @@ describe("runner", function()
local config = assert(conform.get_formatter_config("test"))
local ctx = runner.build_context(0, config)
local cmd = runner.build_cmd("", ctx, config)
assert.are.same({ "echo", "--stdin" }, cmd)
end)
it("replaces $FILENAME in string args", function()
vim.cmd.edit({ args = { "README.md" } })
local bufnr = vim.api.nvim_get_current_buf()
conform.formatters.test = {
meta = { url = "", description = "" },
command = "echo",
args = "$FILENAME | patch",
}
local config = assert(conform.get_formatter_config("test"))
local ctx = runner.build_context(0, config)
local cmd = runner.build_cmd("", ctx, config)
assert.equal("echo " .. vim.api.nvim_buf_get_name(bufnr) .. " | patch", cmd)
end)
it("replaces $DIRNAME in string args", function()
vim.cmd.edit({ args = { "README.md" } })
local bufnr = vim.api.nvim_get_current_buf()
conform.formatters.test = {
meta = { url = "", description = "" },
command = "echo",
args = "$DIRNAME | patch",
}
local config = assert(conform.get_formatter_config("test"))
local ctx = runner.build_context(0, config)
local cmd = runner.build_cmd("", ctx, config)
assert.equal("echo " .. vim.fs.dirname(vim.api.nvim_buf_get_name(bufnr)) .. " | patch", cmd)
assert.are.same({ vim.fn.exepath("echo"), "--stdin" }, cmd)
end)
it("resolves arg function with string results", function()
@ -193,7 +169,7 @@ describe("runner", function()
local config = assert(conform.get_formatter_config("test"))
local ctx = runner.build_context(0, config)
local cmd = runner.build_cmd("", ctx, config)
assert.equal("echo | patch", cmd)
assert.are.same(util.shell_build_argv(vim.fn.exepath("echo") .. " | patch"), cmd)
end)
end)
@ -410,5 +386,22 @@ print("a")
assert.are.same({ "a", "d", "c" }, vim.api.nvim_buf_get_lines(0, 0, -1, false))
end)
end)
it("can run the format command in the shell", function()
-- Mac echo doesn't seem to support -e, but the linux ci runner apparently doesn't have seq
if fs.is_mac then
conform.formatters.test = {
command = "seq",
args = "3 1 | sort",
}
run_formatter_test("", "1\n2\n3")
else
conform.formatters.test = {
command = "echo",
args = '-e "World\nHello" | sort',
}
run_formatter_test("", "Hello\nWorld")
end
end)
end)
end)

View File

@ -0,0 +1,72 @@
local test_util = require("tests.test_util")
local util = require("conform.util")
describe("util", function()
local shell = vim.o.shell
local shellcmdflag = vim.o.shellcmdflag
local shellxescape = vim.o.shellxescape
local shellxquote = vim.o.shellxquote
after_each(function()
test_util.reset_editor()
vim.o.shell = shell
vim.o.shellcmdflag = shellcmdflag
vim.o.shellxescape = shellxescape
vim.o.shellxquote = shellxquote
end)
describe("shell_build_argv", function()
it("builds simple command", function()
vim.o.shell = "/bin/bash"
vim.o.shellcmdflag = "-c"
vim.o.shellxescape = ""
vim.o.shellxquote = ""
local argv = util.shell_build_argv("echo hello")
assert.are_same({ "/bin/bash", "-c", "echo hello" }, argv)
end)
it("handles shell arguments", function()
vim.o.shell = "/bin/bash -f"
vim.o.shellcmdflag = "-c"
vim.o.shellxescape = ""
vim.o.shellxquote = ""
local argv = util.shell_build_argv("echo hello")
assert.are_same({ "/bin/bash", "-f", "-c", "echo hello" }, argv)
end)
it("handles shell with spaces", function()
vim.o.shell = '"c:\\program files\\unix\\sh.exe"'
vim.o.shellcmdflag = "-c"
vim.o.shellxescape = ""
vim.o.shellxquote = ""
local argv = util.shell_build_argv("echo hello")
assert.are_same({ "c:\\program files\\unix\\sh.exe", "-c", "echo hello" }, argv)
end)
it("handles shell with spaces and args", function()
vim.o.shell = '"c:\\program files\\unix\\sh.exe" -f'
vim.o.shellcmdflag = "-c"
vim.o.shellxescape = ""
vim.o.shellxquote = ""
local argv = util.shell_build_argv("echo hello")
assert.are_same({ "c:\\program files\\unix\\sh.exe", "-f", "-c", "echo hello" }, argv)
end)
it("applies shellxquote", function()
vim.o.shell = "/bin/bash"
vim.o.shellcmdflag = "-c"
vim.o.shellxescape = ""
vim.o.shellxquote = "'"
local argv = util.shell_build_argv("echo hello")
assert.are_same({ "/bin/bash", "-c", "'echo hello'" }, argv)
end)
it("uses shellxescape", function()
vim.o.shell = "/bin/bash"
vim.o.shellcmdflag = "-c"
vim.o.shellxescape = "el"
vim.o.shellxquote = "("
local argv = util.shell_build_argv("echo hello")
assert.are_same({ "/bin/bash", "-c", "(^echo h^e^l^lo)" }, argv)
end)
end)
end)

View File

@ -4,7 +4,7 @@
scriptencoding utf-8
let s:direnv_cmd = get(g:, 'direnv_cmd', '/nix/store/1mrvvx2ygfyfz8sn3gg5f3qidvd9s8j1-direnv-2.34.0/bin/direnv')
let s:direnv_cmd = get(g:, 'direnv_cmd', '/nix/store/823qi3acdfxnvn0ylygjg6jabx7b4q31-direnv-2.34.0/bin/direnv')
let s:direnv_interval = get(g:, 'direnv_interval', 500)
let s:direnv_max_wait = get(g:, 'direnv_max_wait', 5)
let s:direnv_auto = get(g:, 'direnv_auto', 1)

View File

@ -1,3 +1,3 @@
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
#!/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/bash
nvim -u tests/minit.lua -l lua/flash/docs.lua

View File

@ -1,3 +1,3 @@
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
#!/nix/store/izpf49b74i15pcr9708s3xdwyqs4jxwl-bash-5.2p32/bin/bash
nvim -l tests/minit.lua --minitest

View File

@ -15,7 +15,7 @@ jobs:
version: nightly
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set Git user for running Git commands in unit tests
run: |
git config --global user.email "users@noreply.github.com"
@ -23,7 +23,7 @@ jobs:
- name: Fetch Git history for unit tests
run: git fetch --no-tags --prune --unshallow
- name: Checkout themis.vim
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: thinca/vim-themis
path: vim-themis
@ -37,17 +37,17 @@ jobs:
THEMIS_VIM: ${{ steps.vim.outputs.executable }}
THEMIS_PROFILE: profile.txt
run: ./vim-themis/bin/themis ./test/all.vimspec
- uses: actions/setup-python@v1
- uses: actions/setup-python@v5
with:
python-version: '3'
- name: Report coverage
run: |
# https://github.com/Vimjas/covimerage/issues/95
pip install 'click<8.0.0'
pip install covimerage
covimerage write_coverage profile.txt
coverage report
coverage xml
- name: Upload coverage to codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
@ -58,7 +58,7 @@ jobs:
neovim: [true, false]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set Git user for running Git commands in unit tests
run: |
git config --global user.email "users@noreply.github.com"
@ -66,7 +66,7 @@ jobs:
- name: Fetch Git history for unit tests
run: git fetch --no-tags --prune --unshallow
- name: Checkout themis.vim
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: thinca/vim-themis
path: vim-themis
@ -84,7 +84,9 @@ jobs:
name: Run vint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- run: pip install vim-vint
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3'
- run: pip install setuptools vim-vint
- run: vint --warning --verbose --enable-neovim ./autoload ./plugin

View File

@ -348,8 +348,8 @@ On Vim, please install [vim-healthcheck](https://github.com/rhysd/vim-healthchec
Distributed under [the MIT License](LICENSE)
[repo]: https://github.com/rhysd/git-messenger.vim
[ci-badge]: https://github.com/rhysd/git-messenger.vim/workflows/CI/badge.svg?branch=master&event=push
[ci]: https://github.com/rhysd/git-messenger.vim/actions?query=workflow%3ACI+branch%3Amaster
[ci-badge]: https://github.com/rhysd/git-messenger.vim/actions/workflows/ci.yml/badge.svg
[ci]: https://github.com/rhysd/git-messenger.vim/actions/workflows/ci.yml
[codecov]: https://codecov.io/gh/rhysd/git-messenger.vim
[codecov-badge]: https://codecov.io/gh/rhysd/git-messenger.vim/branch/master/graph/badge.svg
[doc]: ./doc/git-messenger.txt

View File

@ -1,8 +1,34 @@
if has('nvim')
function! s:report_error(msg, ...) abort
if a:0 ==# 0
call v:lua.vim.health.error(a:msg)
else
call v:lua.vim.health.error(a:msg, a:1)
endif
endfunction
function! s:report_warn(msg, note) abort
call v:lua.vim.health.warn(a:msg, a:note)
endfunction
function! s:report_ok(msg) abort
call v:lua.vim.health.ok(a:msg)
endfunction
else
function! s:report_error(msg) abort
call health#report_error(a:msg)
endfunction
function! s:report_warn(msg, note) abort
call health#report_warn(a:msg, a:note)
endfunction
function! s:report_ok(msg) abort
call health#report_ok(a:msg)
endfunction
endif
function! s:check_job() abort
if !has('nvim') && !has('job')
call health#report_error('Not supported since +job feature is not enabled')
call s:report_error('Not supported since +job feature is not enabled')
else
call health#report_ok('+job is available to execute Git command')
call s:report_ok('+job is available to execute Git command')
endif
endfunction
@ -12,7 +38,7 @@ function! s:check_floating_window() abort
endif
if !exists('*nvim_win_set_config')
call health#report_warn(
call s:report_warn(
\ 'Neovim 0.3.0 or earlier does not support floating window feature. Preview window is used instead',
\ 'Please install Neovim 0.4.0 or later')
return
@ -29,7 +55,7 @@ function! s:check_floating_window() abort
\ })
noautocmd call nvim_win_close(win_id, v:true)
catch /^Vim\%((\a\+)\)\=:E118/
call health#report_error(
call s:report_error(
\ 'Your Neovim is too old',
\ [
\ 'Please update Neovim to 0.4.0 or later',
@ -38,23 +64,23 @@ function! s:check_floating_window() abort
return
endtry
call health#report_ok('Floating window is available for popup window')
call s:report_ok('Floating window is available for popup window')
endfunction
function! s:check_git_binary() abort
let cmd = get(g:, 'git_messenger_git_command', 'git')
if !executable(cmd)
call health#report_error('`' . cmd . '` command is not found. Please set proper command to g:git_messenger_git_command')
call s:report_error('`' . cmd . '` command is not found. Please set proper command to g:git_messenger_git_command')
return
endif
let output = substitute(system(cmd . ' -C . --version'), '\r\=\n', '', 'g')
if v:shell_error
call health#report_error('Git command `' . cmd . '` is broken (v1.8.5 or later is required): ' . output)
call s:report_error('Git command `' . cmd . '` is broken (v1.8.5 or later is required): ' . output)
return
endif
call health#report_ok('Git command `' . cmd . '` is available: ' . output)
call s:report_ok('Git command `' . cmd . '` is available: ' . output)
endfunction
function! s:check_vim_version() abort
@ -63,13 +89,13 @@ function! s:check_vim_version() abort
endif
if v:version < 800
call health#report_error(
call s:report_error(
\ 'Your Vim version is too old: ' . v:version,
\ 'Please install Vim 8.0 or later')
return
endif
call health#report_ok('Vim version is fine: ' . v:version)
call s:report_error('Vim version is fine: ' . v:version)
endfunction
function! health#gitmessenger#check() abort

View File

@ -67,6 +67,7 @@ of the default settings:
delay = 1000,
ignore_whitespace = false,
virt_text_priority = 100,
use_focus = true,
},
current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
sign_priority = 6,
@ -821,6 +822,7 @@ current_line_blame_opts *gitsigns-config-current_line_blame_opts*
Default: >
`{
delay = 1000,
use_focus = true,
virt_text = true,
virt_text_pos = "eol",
virt_text_priority = 100
@ -844,6 +846,8 @@ current_line_blame_opts *gitsigns-config-current_line_blame_opts*
Ignore whitespace when running blame.
• virt_text_priority: integer
Priority of virtual text.
• use_focus: boolean
Enable only when buffer is in focus
• extra_opts: string[]
Extra options passed to `git-blame`.

View File

@ -67,6 +67,7 @@ of the default settings:
delay = 1000,
ignore_whitespace = false,
virt_text_priority = 100,
use_focus = true,
},
current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
sign_priority = 6,
@ -821,6 +822,7 @@ current_line_blame_opts *gitsigns-config-current_line_blame_opts*
Default: >
`{
delay = 1000,
use_focus = true,
virt_text = true,
virt_text_pos = "eol",
virt_text_priority = 100
@ -844,6 +846,8 @@ current_line_blame_opts *gitsigns-config-current_line_blame_opts*
Ignore whitespace when running blame.
• virt_text_priority: integer
Priority of virtual text.
• use_focus: boolean
Enable only when buffer is in focus
• extra_opts: string[]
Extra options passed to `git-blame`.

View File

@ -1,21 +1,21 @@
rock_manifest = {
doc = {
["gitsigns.txt"] = "ed2c2a9eac117833753afc9dd55adcf4"
["gitsigns.txt"] = "701ffdce0c14beaede62a3d0e551c7a8"
},
["gitsigns.nvim-scm-1.rockspec"] = "a9b165d604ce401cfeea760a9366418d",
lua = {
gitsigns = {
["actions.lua"] = "ac0661d45e50424f5f59924528b1c031",
["async.lua"] = "ab34c767e5b6c917335d19f2acc6fd36",
["actions.lua"] = "395d48d459147a4505ec15bd9c7f4f49",
["async.lua"] = "9c3d111da582ae7eef17c64ce2519a2a",
["attach.lua"] = "44664690d66389b4487d934ebcad98e6",
["blame.lua"] = "05feea95e221a2409a8d44334c47529f",
["cache.lua"] = "523c72aa06168f06b3ecd34fd04cbe9d",
["cache.lua"] = "b48aea0d367198dc603ab7775513fe87",
cli = {
["argparse.lua"] = "fb6c9ffda01b2090f3c252ecaf00f68a"
},
["cli.lua"] = "00273191aa1ca467c5edbd9531f8fd9d",
["config.lua"] = "8743742b5a5b0a0713f0352ff4e88db0",
["current_line_blame.lua"] = "48e477d836e39ab98e58c2b027dd9db8",
["config.lua"] = "d2e4c0fb951edf984cf534f7d0e90bfd",
["current_line_blame.lua"] = "660345d06ddf374bf8fdde0ee2200634",
["debounce.lua"] = "5a28036b5ac45c1f93f9883b855e564f",
debug = {
["log.lua"] = "f7e994b68e9cbcf91adfeb5bc379d7b1"
@ -27,14 +27,14 @@ rock_manifest = {
["diffthis.lua"] = "aaac58016e9982bb14e942f9e4e24c52",
git = {
["blame.lua"] = "e779f4344bcc41cdb92c1a1be5eb2815",
["cmd.lua"] = "449c03c67b7ae516babc41d6da0dc66e",
["repo.lua"] = "1efe3178f64b77e0fc22cad55d9586a0",
["cmd.lua"] = "87e37bb8fd03083a530970eb4d6943c8",
["repo.lua"] = "8db0a2c7d221ae5ba42db2b8ef24492d",
["version.lua"] = "068a582ed4565978eb1f6eb089a6fa6c"
},
["git.lua"] = "0d3e8859ff8cf7ebd3beb739b64a8c49",
["git.lua"] = "1b97799c57ef1392c67c2d9599da509b",
["highlight.lua"] = "f0bf039b629818fbfae8a6fad161f9a2",
["hunks.lua"] = "ee058ee8b056b055cd8404460ca6921f",
["manager.lua"] = "f6e7e2430f2f28a4dbcfd2479f2c8480",
["manager.lua"] = "394b58f67de90f8138453061eca03d4d",
["message.lua"] = "523ee4df9da4a7fa9b5ab2100eb27ac4",
["popup.lua"] = "2fcf3052f95d81cb5c0bb04ca4e06aae",
["repeat.lua"] = "798544de97c774bc8e10eecfd6479585",

View File

@ -275,6 +275,11 @@ M.stage_hunk = mk_repeatable(async.create(2, function(range, opts)
return
end
if bcache:locked() then
print('Error: busy')
return
end
if not util.path_exists(bcache.file) then
print('Error: Cannot stage lines. Please add the file to the working tree.')
return
@ -294,7 +299,6 @@ M.stage_hunk = mk_repeatable(async.create(2, function(range, opts)
end
bcache.git_obj:stage_hunks({ hunk }, invert)
table.insert(bcache.staged_diffs, hunk)
bcache:invalidate(true)
@ -397,6 +401,11 @@ M.undo_stage_hunk = async.create(function()
return
end
if bcache:locked() then
print('Error: busy')
return
end
local hunk = table.remove(bcache.staged_diffs)
if not hunk then
print('No hunks to undo')
@ -419,6 +428,11 @@ M.stage_buffer = async.create(function()
return
end
if bcache:locked() then
print('Error: busy')
return
end
-- Only process files with existing hunks
local hunks = bcache.hunks
if not hunks or #hunks == 0 then
@ -454,6 +468,11 @@ M.reset_buffer_index = async.create(function()
return
end
if bcache:locked() then
print('Error: busy')
return
end
-- `bcache.staged_diffs` won't contain staged changes outside of current
-- neovim session so signs added from this unstage won't be complete They will
-- however be fixed by gitdir watcher and properly updated We should implement
@ -463,7 +482,6 @@ M.reset_buffer_index = async.create(function()
bcache.staged_diffs = {}
bcache.git_obj:unstage_file()
bcache:invalidate(true)
update(bufnr)
end)
@ -551,6 +569,9 @@ local function get_nav_hunks(bufnr, target, greedy)
if target == 'all' then
hunks = hunks_main
vim.list_extend(hunks, hunks_head)
table.sort(hunks, function(h1, h2)
return h1.added.start < h2.added.start
end)
elseif target == 'staged' then
hunks = hunks_head
end

View File

@ -69,27 +69,37 @@ function Async_T:is_cancelled()
end
--- @param func function
--- @param protected boolean
--- @param callback? fun(...: any)
--- @param ... any
--- @return Gitsigns.Async_T
local function run(func, callback, ...)
local function run(func, protected, callback, ...)
local co = coroutine.create(func)
local handle = Async_T.new(co)
if protected then
assert(type(callback) == 'function')
end
local function step(...)
local ret = { coroutine.resume(co, ...) }
local stat = ret[1]
if not stat then
local err = ret[2] --[[@as string]]
error(
string.format('The coroutine failed with this message: %s\n%s', err, debug.traceback(co))
)
local co_err = ret[2] --- @type string
local err = debug.traceback(co, string.format('The async coroutine failed: %s', co_err))
if protected then
--- @cast callback -nil
callback(false, err)
else
error(err)
end
end
if coroutine.status(co) == 'dead' then
if callback then
callback(unpack(ret, 2, table.maxn(ret)))
-- Include status if protected
callback(unpack(ret, protected and 1 or 2, table.maxn(ret)))
end
return
end
@ -99,13 +109,21 @@ local function run(func, callback, ...)
assert(type(fn) == 'function', 'type error :: expected func')
local args = { select(4, unpack(ret)) }
--- @type any[]
local args = { unpack(ret, 4, table.maxn(ret)) }
args[nargs] = step
local r = fn(unpack(args, 1, nargs))
if is_Async_T(r) then
--- @cast r Gitsigns.Async_T
handle._current = r
if protected then
--- @cast callback -nil
xpcall(fn, function(err)
callback(false, string.format('The wrapped function failed: %s', err))
end, unpack(args, 1, nargs))
else
local r = fn(unpack(args, 1, nargs))
if is_Async_T(r) then
--- @cast r Gitsigns.Async_T
handle._current = r
end
end
end
@ -182,7 +200,7 @@ function M.create(argc_or_func, func)
return function(...)
local callback = argc and select(argc + 1, ...) or nil
assert(not callback or type(callback) == 'function')
return run(func, callback, unpack({ ... }, 1, argc))
return run(func, false, callback, unpack({ ... }, 1, argc))
end
end
@ -191,7 +209,16 @@ end
M.scheduler = M.wrap(1, vim.schedule)
function M.run(func, ...)
return run(func, nil, ...)
return run(func, false, nil, ...)
end
--- @param func fun()
--- @return boolean stat
--- @return string? err
function M.pcall(func)
return M.wait(1, function(cb)
run(func, true, cb)
end)
end
return M

View File

@ -20,6 +20,8 @@ local M = {
--- @field gitdir_watcher? uv.uv_fs_event_t
--- @field git_obj Gitsigns.GitObj
--- @field blame? table<integer,Gitsigns.BlameInfo?>
---
--- @field update_lock? true Update in progress
local CacheEntry = M.CacheEntry
function CacheEntry:get_rev_bufname(rev, nofile)
@ -30,6 +32,10 @@ function CacheEntry:get_rev_bufname(rev, nofile)
return string.format('gitsigns://%s//%s:%s', self.git_obj.repo.gitdir, rev, self.git_obj.relpath)
end
function CacheEntry:locked()
return self.git_obj.lock or self.update_lock or false
end
--- Invalidate any state dependent on the buffer content.
--- If 'all' is passed, then invalidate everything.
--- @param all? boolean

View File

@ -42,6 +42,7 @@
--- @field virt_text_pos? 'eol'|'overlay'|'right_align'
--- @field delay? integer
--- @field virt_text_priority? integer
--- @field use_focus? boolean
--- @class (exact) Gitsigns.BlameOpts
--- @field ignore_whitespace? boolean
@ -680,6 +681,7 @@ M.schema = {
virt_text_pos = 'eol',
virt_text_priority = 100,
delay = 1000,
use_focus = true,
},
description = [[
Options for the current line blame annotation.
@ -700,6 +702,8 @@ M.schema = {
Ignore whitespace when running blame.
• virt_text_priority: integer
Priority of virtual text.
• use_focus: boolean
Enable only when buffer is in focus
• extra_opts: string[]
Extra options passed to `git-blame`.
]],

View File

@ -225,13 +225,18 @@ function M.setup()
-- show current buffer line blame immediately
M.update(api.nvim_get_current_buf())
local events = { 'FocusGained', 'BufEnter', 'CursorMoved', 'CursorMovedI' }
local update_events = { 'BufEnter', 'CursorMoved', 'CursorMovedI' }
local reset_events = { 'InsertEnter', 'BufLeave' }
if vim.fn.exists('#WinResized') == 1 then
-- For nvim 0.9+
events[#events + 1] = 'WinResized'
update_events[#update_events + 1] = 'WinResized'
end
if opts.use_focus then
update_events[#update_events + 1] = 'FocusGained'
reset_events[#reset_events + 1] = 'FocusLost'
end
api.nvim_create_autocmd(events, {
api.nvim_create_autocmd(update_events, {
group = group,
callback = function(args)
reset(args.buf)
@ -239,7 +244,7 @@ function M.setup()
end,
})
api.nvim_create_autocmd({ 'InsertEnter', 'FocusLost', 'BufLeave' }, {
api.nvim_create_autocmd(reset_events, {
group = group,
callback = function(args)
reset(args.buf)

View File

@ -1,4 +1,5 @@
local log = require('gitsigns.debug.log')
local async = require('gitsigns.async')
local util = require('gitsigns.util')
local Repo = require('gitsigns.git.repo')
@ -31,6 +32,8 @@ end
--- @field orig_relpath? string Use for tracking moved files
--- @field repo Gitsigns.Repo
--- @field has_conflicts? boolean
---
--- @field lock? true
local Obj = {}
M.Obj = Obj
@ -61,12 +64,14 @@ function M.diff(file_cmp, file_buf, indent_heuristic, diff_algo)
})
end
--- @async
--- @param revision? string
function Obj:update_revision(revision)
self.revision = util.norm_base(revision)
self:update()
end
--- @async
--- @param update_relpath? boolean
--- @param silent? boolean
--- @return boolean
@ -98,6 +103,7 @@ function Obj:from_tree()
return self.revision and not vim.startswith(self.revision, ':')
end
--- @async
--- @param file? string
--- @param silent? boolean
--- @return Gitsigns.FileInfo
@ -110,6 +116,7 @@ function Obj:file_info(file, silent)
end
--- @private
--- @async
--- Get information about files in the index and the working tree
--- @param file? string
--- @param silent? boolean
@ -177,6 +184,7 @@ function Obj:file_info_index(file, silent)
end
--- @private
--- @async
--- Get information about files in a certain revision
--- @param file? string
--- @param silent? boolean
@ -213,6 +221,7 @@ function Obj:file_info_tree(file, silent)
}
end
--- @async
--- @param revision? string
--- @return string[] stdout, string? stderr
function Obj:get_show_text(revision)
@ -251,11 +260,15 @@ local function autocmd_changed(file)
end)
end
--- @async
function Obj:unstage_file()
self.lock = true
self.repo:command({ 'reset', self.file })
self.lock = nil
autocmd_changed(self.file)
end
--- @async
--- @param lines string[]
--- @param lnum? integer
--- @param revision? string
@ -265,28 +278,33 @@ function Obj:run_blame(lines, lnum, revision, opts)
return require('gitsigns.git.blame').run_blame(self, lines, lnum, revision, opts)
end
--- @param obj Gitsigns.GitObj
local function ensure_file_in_index(obj)
if obj.object_name and not obj.has_conflicts then
--- @async
--- @private
function Obj:ensure_file_in_index()
self.lock = true
if self.object_name and not self.has_conflicts then
return
end
if not obj.object_name then
if not self.object_name then
-- If there is no object_name then it is not yet in the index so add it
obj.repo:command({ 'add', '--intent-to-add', obj.file })
self.repo:command({ 'add', '--intent-to-add', self.file })
else
-- Update the index with the common ancestor (stage 1) which is what bcache
-- stores
local info = string.format('%s,%s,%s', obj.mode_bits, obj.object_name, obj.relpath)
obj.repo:command({ 'update-index', '--add', '--cacheinfo', info })
local info = string.format('%s,%s,%s', self.mode_bits, self.object_name, self.relpath)
self.repo:command({ 'update-index', '--add', '--cacheinfo', info })
end
obj:update()
self:update()
self.lock = nil
end
--- @async
--- Stage 'lines' as the entire contents of the file
--- @param lines string[]
function Obj:stage_lines(lines)
self.lock = true
local new_object = self.repo:command({
'hash-object',
'-w',
@ -301,13 +319,20 @@ function Obj:stage_lines(lines)
string.format('%s,%s,%s', self.mode_bits, new_object, self.relpath),
})
self.lock = nil
autocmd_changed(self.file)
end
local sleep = async.wrap(2, function(duration, cb)
vim.defer_fn(cb, duration)
end)
--- @async
--- @param hunks Gitsigns.Hunk.Hunk[]
--- @param invert? boolean
function Obj:stage_hunks(hunks, invert)
ensure_file_in_index(self)
self.lock = true
self:ensure_file_in_index()
local patch = require('gitsigns.hunks').create_patch(self.relpath, hunks, self.mode_bits, invert)
@ -318,19 +343,32 @@ function Obj:stage_hunks(hunks, invert)
end
end
self.repo:command({
'apply',
'--whitespace=nowarn',
'--cached',
'--unidiff-zero',
'-',
}, {
stdin = patch,
})
local stat, err = async.pcall(function()
self.repo:command({
'apply',
'--whitespace=nowarn',
'--cached',
'--unidiff-zero',
'-',
}, {
stdin = patch,
})
end)
if not stat then
self.lock = nil
error(err)
end
-- Staging operations cause IO of the git directory so wait some time
-- for the changes to settle.
sleep(100)
self.lock = nil
autocmd_changed(self.file)
end
--- @async
--- @return string?
function Obj:has_moved()
local out = self.repo:command({ 'diff', '--name-status', '-C', '--cached' })
@ -349,6 +387,7 @@ function Obj:has_moved()
end
end
--- @async
--- @param file string
--- @param revision string?
--- @param encoding string

View File

@ -12,7 +12,7 @@ local asystem = async.wrap(3, system)
--- @async
--- @param args string[]
--- @param spec? Gitsigns.Git.JobSpec
--- @return string[] stdout, string? stderr
--- @return string[] stdout, string? stderr, integer code
local function git_command(args, spec)
spec = spec or {}
@ -66,7 +66,7 @@ local function git_command(args, spec)
obj.stderr = nil
end
return stdout_lines, obj.stderr
return stdout_lines, obj.stderr, obj.code
end
return git_command

View File

@ -81,6 +81,7 @@ local function iconv_supported(encoding)
return true
end
--- @async
--- Get version of file in the index, return array lines
--- @param object string
--- @param encoding? string
@ -99,9 +100,9 @@ end
--- @async
function M:update_abbrev_head()
local info = M.get_info(self.toplevel)
local info, err = M.get_info(self.toplevel)
if not info then
log.eprintf('Could not get info for repo at %s', self.gitdir)
log.eprintf('Could not get info for repo at %s: %s', self.gitdir, err or '')
return
end
self.abbrev_head = info.abbrev_head
@ -211,7 +212,7 @@ end
--- @param cwd string
--- @param gitdir? string
--- @param toplevel? string
--- @return Gitsigns.RepoInfo?
--- @return Gitsigns.RepoInfo? info, string? err
function M.get_info(cwd, gitdir, toplevel)
-- Does git rev-parse have --absolute-git-dir, added in 2.13:
-- https://public-inbox.org/git/20170203024829.8071-16-szeder.dev@gmail.com/
@ -238,13 +239,13 @@ function M.get_info(cwd, gitdir, toplevel)
'HEAD',
})
local stdout = git_command(args, {
local stdout, stderr, code = git_command(args, {
ignore_error = true,
cwd = toplevel or cwd,
})
if not stdout[1] then
return
if code > 0 then
return nil, string.format('got stderr: %s', stderr or '')
end
local toplevel_r = normalize_path(stdout[1])

View File

@ -448,6 +448,8 @@ M.update = throttle_by_id(function(bufnr)
return
end
local bcache = assert(cache[bufnr])
bcache.update_lock = true
local old_hunks, old_hunks_staged = bcache.hunks, bcache.hunks_staged
bcache.hunks, bcache.hunks_staged = nil, nil
@ -505,6 +507,7 @@ M.update = throttle_by_id(function(bufnr)
summary.head = git_obj.repo.abbrev_head
Status:update(bufnr, summary)
end
bcache.update_lock = nil
end, true)
--- @param bufnr integer

View File

@ -1 +1 @@
/nix/store/rn8bzg423wwkayzbsbmhmvcgjmbzrq5z-lua-5.1.5
/nix/store/k55zni8plmbwkbv9l6ds65p981ndxk7x-lua-5.1.5

View File

@ -1,21 +1,21 @@
rock_manifest = {
doc = {
["gitsigns.txt"] = "ed2c2a9eac117833753afc9dd55adcf4"
["gitsigns.txt"] = "701ffdce0c14beaede62a3d0e551c7a8"
},
["gitsigns.nvim-scm-1.rockspec"] = "a9b165d604ce401cfeea760a9366418d",
lua = {
gitsigns = {
["actions.lua"] = "ac0661d45e50424f5f59924528b1c031",
["async.lua"] = "ab34c767e5b6c917335d19f2acc6fd36",
["actions.lua"] = "395d48d459147a4505ec15bd9c7f4f49",
["async.lua"] = "9c3d111da582ae7eef17c64ce2519a2a",
["attach.lua"] = "44664690d66389b4487d934ebcad98e6",
["blame.lua"] = "05feea95e221a2409a8d44334c47529f",
["cache.lua"] = "523c72aa06168f06b3ecd34fd04cbe9d",
["cache.lua"] = "b48aea0d367198dc603ab7775513fe87",
cli = {
["argparse.lua"] = "fb6c9ffda01b2090f3c252ecaf00f68a"
},
["cli.lua"] = "00273191aa1ca467c5edbd9531f8fd9d",
["config.lua"] = "8743742b5a5b0a0713f0352ff4e88db0",
["current_line_blame.lua"] = "48e477d836e39ab98e58c2b027dd9db8",
["config.lua"] = "d2e4c0fb951edf984cf534f7d0e90bfd",
["current_line_blame.lua"] = "660345d06ddf374bf8fdde0ee2200634",
["debounce.lua"] = "5a28036b5ac45c1f93f9883b855e564f",
debug = {
["log.lua"] = "f7e994b68e9cbcf91adfeb5bc379d7b1"
@ -27,14 +27,14 @@ rock_manifest = {
["diffthis.lua"] = "aaac58016e9982bb14e942f9e4e24c52",
git = {
["blame.lua"] = "e779f4344bcc41cdb92c1a1be5eb2815",
["cmd.lua"] = "449c03c67b7ae516babc41d6da0dc66e",
["repo.lua"] = "1efe3178f64b77e0fc22cad55d9586a0",
["cmd.lua"] = "87e37bb8fd03083a530970eb4d6943c8",
["repo.lua"] = "8db0a2c7d221ae5ba42db2b8ef24492d",
["version.lua"] = "068a582ed4565978eb1f6eb089a6fa6c"
},
["git.lua"] = "0d3e8859ff8cf7ebd3beb739b64a8c49",
["git.lua"] = "1b97799c57ef1392c67c2d9599da509b",
["highlight.lua"] = "f0bf039b629818fbfae8a6fad161f9a2",
["hunks.lua"] = "ee058ee8b056b055cd8404460ca6921f",
["manager.lua"] = "f6e7e2430f2f28a4dbcfd2479f2c8480",
["manager.lua"] = "394b58f67de90f8138453061eca03d4d",
["message.lua"] = "523ee4df9da4a7fa9b5ab2100eb27ac4",
["popup.lua"] = "2fcf3052f95d81cb5c0bb04ca4e06aae",
["repeat.lua"] = "798544de97c774bc8e10eecfd6479585",

View File

@ -1 +1 @@
/nix/store/rn8bzg423wwkayzbsbmhmvcgjmbzrq5z-lua-5.1.5
/nix/store/k55zni8plmbwkbv9l6ds65p981ndxk7x-lua-5.1.5

View File

@ -187,9 +187,6 @@ os:
The Telescope plugin is used to track all git repository visited in one nvim session.
![lazygittelplugin](https://user-images.githubusercontent.com/10464534/156933468-c89abee4-6afb-457c-8b02-55b67913aef2.png)
(background image is not included :smirk:)
**Why a telescope Plugin** ?
Assuming you have one or more submodule(s) in your project and you want to commit changes in both the submodule(s)

View File

@ -54,16 +54,17 @@ function M.require(module)
end
pattern_path = table.concat { 'lua/', module:gsub('%.', '/'), '.lua' }
local paths = vim.api.nvim_get_runtime_file(pattern_path, false)
local paths = vim.api.nvim_get_runtime_file(pattern_path, true)
if #paths <= 0 then
pattern_path = table.concat { 'lua/', module:gsub('%.', '/'), '/init.lua' }
paths = vim.api.nvim_get_runtime_file(pattern_path, false)
paths = vim.api.nvim_get_runtime_file(pattern_path, true)
end
if #paths > 0 then
-- put entries from user config path in front
local user_config_path = vim.fn.stdpath('config')
table.sort(paths, function(a, b)
return vim.startswith(a, user_config_path) or not vim.startswith(b, user_config_path)
local pattern = table.concat { user_config_path, M.sep }
return string.match(a, pattern) or not string.match(b, pattern)
end)
local mod_result = dofile(paths[1])
package.loaded[module] = mod_result

View File

@ -1,4 +1,4 @@
*luasnip.txt* For NVIM v0.8.0 Last change: 2024 August 01
*luasnip.txt* For NVIM v0.8.0 Last change: 2024 August 28
==============================================================================
Table of Contents *luasnip-table-of-contents*
@ -60,10 +60,11 @@ Table of Contents *luasnip-table-of-contents*
26. Cleanup |luasnip-cleanup|
27. Logging |luasnip-logging|
28. Source |luasnip-source|
29. Config-Options |luasnip-config-options|
30. Troubleshooting |luasnip-troubleshooting|
29. Selection |luasnip-selection|
30. Config-Options |luasnip-config-options|
31. Troubleshooting |luasnip-troubleshooting|
- Adding Snippets |luasnip-troubleshooting-adding-snippets|
31. API |luasnip-api|
32. API |luasnip-api|
>
__ ____
/\ \ /\ _`\ __
@ -3259,6 +3260,8 @@ The node and `event_args` can be accessed through `require("luasnip").session`:
`event_args`:
- `expand_pos`: `{<row>, <column>}`, position at which the snippet will be
expanded. `<row>` and `<column>` are both 0-indexed.
- `expand_pos_mark_id`: `number`, the id of the extmark luasnip uses to track
`expand_pos`. This may be moved around freely.
`event_res`:
- `env_override`: `map string->(string[]|string)`, override or extend the
snippets environment (`snip.env`).
@ -3364,7 +3367,33 @@ It is also possible to get/set the source of a snippet via API:
==============================================================================
29. Config-Options *luasnip-config-options*
29. Selection *luasnip-selection*
Many snippets use the `$TM_SELECTED_TEXT` or (for LuaSnip, preferably
`LS_SELECT_RAW` or `LS_SELECT_DEDENT`) variable, which has to be populated by
selecting and then yanking (and usually also cutting) text from the buffer
before expanding.
By default, this is disabled (as to not pollute keybindings which may be used
for something else), so one has to * either set `cut_selection_keys` in `setup`
(see |luasnip-config-options|). * or map `ls.cut_keys` as the rhs of a mapping
* or manually configure the keybinding. For this, create a new keybinding that
1. `<Esc>`es to NORMAL (to populate the `<` and `>`-markers) 2. calls
`luasnip.pre_yank(<namedreg>)` 3. yanks text to some named register
`<namedreg>` 4. calls `luasnip.post_yank(<namedreg>)` Take care that the
yanking actually takes place between the two calls. One way to ensure this is
to call the two functions via `<cmd>lua ...<Cr>`: `lua vim.keymap.set("v",
"<Tab>", [[<Esc><cmd>lua
require("luasnip.util.select").pre_yank("z")<Cr>gv"zs<cmd>lua
require('luasnip.util.select').post_yank("z")<Cr>]])` The reason for this
specific order is to allow us to take a snapshot of registers (in the
pre-callback), and then restore them (in the post-callback) (so that we may get
the visual selection directly from the register, which seems to be the most
foolproof way of doing this).
==============================================================================
30. Config-Options *luasnip-config-options*
These are the settings you can provide to `luasnip.setup()`:
@ -3399,9 +3428,9 @@ These are the settings you can provide to `luasnip.setup()`:
so, remove it from the history. Off by default, `'TextChanged'` (perhaps
`'InsertLeave'`, to react to changes done in Insert mode) should work just fine
(alternatively, this can also be mapped using `<Plug>luasnip-delete-check`).
- `store_selection_keys`: Mapping for populating `TM_SELECTED_TEXT` and related
variables (not set by default). If you want to set this mapping yourself, map
`ls.select_keys` (not a function, actually a string/key-combination) as a rhs.
- `cut_selection_keys`: Mapping for populating `TM_SELECTED_TEXT` and related
variables (not set by default). See |luasnip-selection| for more infos.
- `store_selection_keys` (deprecated): same as `cut_selection_keys`
- `enable_autosnippets`: Autosnippets are disabled by default to minimize
performance penalty if unused. Set to `true` to enable.
- `ext_opts`: Additional options passed to extmarks. Can be used to add
@ -3449,7 +3478,7 @@ These are the settings you can provide to `luasnip.setup()`:
==============================================================================
30. Troubleshooting *luasnip-troubleshooting*
31. Troubleshooting *luasnip-troubleshooting*
ADDING SNIPPETS *luasnip-troubleshooting-adding-snippets*
@ -3518,7 +3547,7 @@ GENERAL ~
==============================================================================
31. API *luasnip-api*
32. API *luasnip-api*
`require("luasnip")`:

View File

@ -48,6 +48,7 @@ luasnip-node luasnip.txt /*luasnip-node*
luasnip-node-api luasnip.txt /*luasnip-node-api*
luasnip-node-reference luasnip.txt /*luasnip-node-reference*
luasnip-restorenode luasnip.txt /*luasnip-restorenode*
luasnip-selection luasnip.txt /*luasnip-selection*
luasnip-snippetnode luasnip.txt /*luasnip-snippetnode*
luasnip-snippetproxy luasnip.txt /*luasnip-snippetproxy*
luasnip-snippets luasnip.txt /*luasnip-snippets*

View File

@ -65,6 +65,12 @@ c = {
conf.history = nil
end
if user_config.store_selection_keys ~= nil then
conf.cut_selection_keys = user_config.store_selection_keys
user_config.store_selection_keys = nil
end
for k, v in pairs(user_config) do
conf[k] = v
end
@ -125,12 +131,12 @@ c = {
end)
end
if session.config.store_selection_keys then
if session.config.cut_selection_keys then
vim.cmd(
string.format(
[[xnoremap <silent> %s %s]],
session.config.store_selection_keys,
require("luasnip.util.select").select_keys
session.config.cut_selection_keys,
require("luasnip.util.select").cut_keys
)
)
end

View File

@ -110,7 +110,10 @@ return {
-- see :h User, event should never be triggered(except if it is `doautocmd`'d)
region_check_events = nil,
delete_check_events = nil,
store_selection_keys = nil, -- Supossed to be the same as the expand shortcut
-- preserve default of store_selection_keys.
cut_selection_keys = nil,
ext_opts = {
[types.textNode] = {
active = { hl_group = "LuasnipTextNodeActive" },

View File

@ -844,7 +844,11 @@ local ls_lazy = {
config = function() return require("luasnip.config") end,
multi_snippet = function() return require("luasnip.nodes.multiSnippet").new_multisnippet end,
snippet_source = function() return require("luasnip.session.snippet_collection.source") end,
select_keys = function() return require("luasnip.util.select").select_keys end
cut_keys = function() return require("luasnip.util.select").cut_keys end,
-- keep select_keys for backwards-compatibility.
select_keys = function() return require("luasnip.util.select").cut_keys end,
pre_yank = function() return require("luasnip.util.select").pre_yank end,
post_yank = function() return require("luasnip.util.select").post_yank end,
}
ls = lazy_table({

View File

@ -632,6 +632,14 @@ end
function Snippet:trigger_expand(current_node, pos_id, env, indent_nodes)
local pos = vim.api.nvim_buf_get_extmark_by_id(0, session.ns_id, pos_id, {})
local pre_expand_res = self:event(
events.pre_expand,
{ expand_pos = pos, expand_pos_mark_id = pos_id }
) or {}
-- update pos, event-callback might have moved the extmark.
pos = vim.api.nvim_buf_get_extmark_by_id(0, session.ns_id, pos_id, {})
-- find tree-node the snippet should be inserted at (could be before another node).
local _, sibling_snippets, own_indx, parent_node =
node_util.snippettree_find_undamaged_node(pos, {
@ -697,11 +705,6 @@ function Snippet:trigger_expand(current_node, pos_id, env, indent_nodes)
end
end
local pre_expand_res = self:event(events.pre_expand, { expand_pos = pos })
or {}
-- update pos, event-callback might have moved the extmark.
pos = vim.api.nvim_buf_get_extmark_by_id(0, session.ns_id, pos_id, {})
Environ:override(env, pre_expand_res.env_override or {})
if indent_nodes then

View File

@ -59,19 +59,30 @@ end
-- subtle: `:lua` exits VISUAL, which means that the '< '>-marks will be set correctly!
-- Afterwards, we can just use <cmd>lua, which does not change the mode.
M.select_keys =
[[:lua require("luasnip.util.select").pre_cut()<Cr>gv"zs<cmd>lua require('luasnip.util.select').post_cut("z")<Cr>]]
M.cut_keys =
[[<Esc><cmd>lua require("luasnip.util.select").pre_yank("z")<Cr>gv"zs<cmd>lua require('luasnip.util.select').post_yank("z")<Cr>]]
local saved_registers
local lines
local start_line, start_col, end_line, end_col
local mode
function M.pre_cut()
function M.pre_yank(yank_register)
-- store registers so we don't change any of them.
-- "" is affected since we perform a cut (s), 1-9 also (although :h
-- quote_number seems to state otherwise for cuts to specific registers..?).
saved_registers =
store_registers("", "1", "2", "3", "4", "5", "6", "7", "8", "9", "z")
saved_registers = store_registers(
"",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
yank_register
)
-- store data needed for de-indenting lines.
start_line = vim.fn.line("'<") - 1
@ -83,9 +94,9 @@ function M.pre_cut()
mode = vim.fn.visualmode()
end
function M.post_cut(register_name)
function M.post_yank(yank_register)
-- remove trailing newline.
local chunks = vim.split(vim.fn.getreg(register_name):gsub("\n$", ""), "\n")
local chunks = vim.split(vim.fn.getreg(yank_register):gsub("\n$", ""), "\n")
-- make sure to restore the registers to the state they were before cutting.
restore_registers(saved_registers)

View File

@ -1,4 +1,4 @@
*luasnip.txt* For NVIM v0.8.0 Last change: 2024 August 01
*luasnip.txt* For NVIM v0.8.0 Last change: 2024 August 28
==============================================================================
Table of Contents *luasnip-table-of-contents*
@ -60,10 +60,11 @@ Table of Contents *luasnip-table-of-contents*
26. Cleanup |luasnip-cleanup|
27. Logging |luasnip-logging|
28. Source |luasnip-source|
29. Config-Options |luasnip-config-options|
30. Troubleshooting |luasnip-troubleshooting|
29. Selection |luasnip-selection|
30. Config-Options |luasnip-config-options|
31. Troubleshooting |luasnip-troubleshooting|
- Adding Snippets |luasnip-troubleshooting-adding-snippets|
31. API |luasnip-api|
32. API |luasnip-api|
>
__ ____
/\ \ /\ _`\ __
@ -3259,6 +3260,8 @@ The node and `event_args` can be accessed through `require("luasnip").session`:
`event_args`:
- `expand_pos`: `{<row>, <column>}`, position at which the snippet will be
expanded. `<row>` and `<column>` are both 0-indexed.
- `expand_pos_mark_id`: `number`, the id of the extmark luasnip uses to track
`expand_pos`. This may be moved around freely.
`event_res`:
- `env_override`: `map string->(string[]|string)`, override or extend the
snippets environment (`snip.env`).
@ -3364,7 +3367,33 @@ It is also possible to get/set the source of a snippet via API:
==============================================================================
29. Config-Options *luasnip-config-options*
29. Selection *luasnip-selection*
Many snippets use the `$TM_SELECTED_TEXT` or (for LuaSnip, preferably
`LS_SELECT_RAW` or `LS_SELECT_DEDENT`) variable, which has to be populated by
selecting and then yanking (and usually also cutting) text from the buffer
before expanding.
By default, this is disabled (as to not pollute keybindings which may be used
for something else), so one has to * either set `cut_selection_keys` in `setup`
(see |luasnip-config-options|). * or map `ls.cut_keys` as the rhs of a mapping
* or manually configure the keybinding. For this, create a new keybinding that
1. `<Esc>`es to NORMAL (to populate the `<` and `>`-markers) 2. calls
`luasnip.pre_yank(<namedreg>)` 3. yanks text to some named register
`<namedreg>` 4. calls `luasnip.post_yank(<namedreg>)` Take care that the
yanking actually takes place between the two calls. One way to ensure this is
to call the two functions via `<cmd>lua ...<Cr>`: `lua vim.keymap.set("v",
"<Tab>", [[<Esc><cmd>lua
require("luasnip.util.select").pre_yank("z")<Cr>gv"zs<cmd>lua
require('luasnip.util.select').post_yank("z")<Cr>]])` The reason for this
specific order is to allow us to take a snapshot of registers (in the
pre-callback), and then restore them (in the post-callback) (so that we may get
the visual selection directly from the register, which seems to be the most
foolproof way of doing this).
==============================================================================
30. Config-Options *luasnip-config-options*
These are the settings you can provide to `luasnip.setup()`:
@ -3399,9 +3428,9 @@ These are the settings you can provide to `luasnip.setup()`:
so, remove it from the history. Off by default, `'TextChanged'` (perhaps
`'InsertLeave'`, to react to changes done in Insert mode) should work just fine
(alternatively, this can also be mapped using `<Plug>luasnip-delete-check`).
- `store_selection_keys`: Mapping for populating `TM_SELECTED_TEXT` and related
variables (not set by default). If you want to set this mapping yourself, map
`ls.select_keys` (not a function, actually a string/key-combination) as a rhs.
- `cut_selection_keys`: Mapping for populating `TM_SELECTED_TEXT` and related
variables (not set by default). See |luasnip-selection| for more infos.
- `store_selection_keys` (deprecated): same as `cut_selection_keys`
- `enable_autosnippets`: Autosnippets are disabled by default to minimize
performance penalty if unused. Set to `true` to enable.
- `ext_opts`: Additional options passed to extmarks. Can be used to add
@ -3449,7 +3478,7 @@ These are the settings you can provide to `luasnip.setup()`:
==============================================================================
30. Troubleshooting *luasnip-troubleshooting*
31. Troubleshooting *luasnip-troubleshooting*
ADDING SNIPPETS *luasnip-troubleshooting-adding-snippets*
@ -3518,7 +3547,7 @@ GENERAL ~
==============================================================================
31. API *luasnip-api*
32. API *luasnip-api*
`require("luasnip")`:

Some files were not shown because too many files have changed in this diff Show More