Skip to content

Commit

Permalink
chore(nvim): cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Nov 13, 2024
1 parent ed37990 commit 34ee630
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 108 deletions.
75 changes: 2 additions & 73 deletions nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,86 +17,15 @@ _G.p = function(...)
end
vim.print = _G.dd

vim.api.nvim_create_autocmd("VimResized", {
callback = function(ev)
dd(ev)
end,
})

vim.api.nvim_create_autocmd("TermOpen", {
callback = function(ev)
Snacks.notify("Terminal opened!")
end,
})

if vim.fn.has("nvim-0.10") == 1 then
---@type table<number, {token:lsp.ProgressToken, msg:string, done:boolean}[]>
local progress = vim.defaulttable()
vim.api.nvim_create_autocmd("LspProgress", {
---@param ev {data: {client_id: integer, params: lsp.ProgressParams}}
callback = function(ev)
local client = vim.lsp.get_client_by_id(ev.data.client_id)
local value = ev.data.params.value --[[@as {percentage?: number, title?: string, message?: string, kind: "begin" | "report" | "end"}]]
if not client or type(value) ~= "table" then
return
end
local p = progress[client.id]

for i = 1, #p + 1 do
if i == #p + 1 or p[i].token == ev.data.params.token then
p[i] = {
token = ev.data.params.token,
msg = ("[%3d%%] %s%s"):format(
value.kind == "end" and 100 or value.percentage or 100,
value.title or "",
value.message and (" **%s**"):format(value.message) or ""
),
done = value.kind == "end",
}
break
end
end

local msg = {} ---@type string[]
progress[client.id] = vim.tbl_filter(function(v)
return table.insert(msg, v.msg) or not v.done
end, p)

local spinner = { "", "", "", "", "", "", "", "", "", "" }
vim.notify(table.concat(msg, "\n"), "info", {
id = "lsp_progress2",
title = client.name,
opts = function(notif)
notif.icon = #progress[client.id] == 0 and ""
or spinner[math.floor(vim.uv.hrtime() / (1e6 * 80)) % #spinner + 1]
end,
})
end,
})
vim.api.nvim_create_autocmd("LspProgress", {
---@param ev {data: {client_id: integer, params: lsp.ProgressParams}}
callback = function(ev)
local spinner = { "", "", "", "", "", "", "", "", "", "" }
vim.notify(vim.lsp.status(), "info", {
id = "lsp_progress",
title = "LSP Progress",
opts = function(notif)
notif.icon = ev.data.params.value.kind == "end" and ""
or spinner[math.floor(vim.uv.hrtime() / (1e6 * 80)) % #spinner + 1]
end,
})
end,
})
end
-- require("util.profiler").startup()
-- require("util.profiler").startup("perfanno")

pcall(require, "config.env")

require("config.lazy")({
-- debug = false,
profiling = {
loader = false,
require = true,
require = false,
},
})

Expand Down
32 changes: 16 additions & 16 deletions nvim/lazy-lock.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
{
"SchemaStore.nvim": { "branch": "main", "commit": "a5f6e784d2000f9570791d5f43040ab29e13f9e3" },
"blink.cmp": { "branch": "main", "commit": "3a096f348b274810a297ecd236b17b582cc61943" },
"SchemaStore.nvim": { "branch": "main", "commit": "dbf93f5074efe788a3c0a80c6680d9b9b64953b2" },
"blink.cmp": { "branch": "main", "commit": "1309ec5babfc897da7927ffabe7d4bea5bb9b0cc" },
"bufferline.nvim": { "branch": "main", "commit": "5cc447cb2b463cb499c82eaeabbed4f5fa6a0a44" },
"busted-types": { "branch": "main", "commit": "5ed85d0e016a5eb5eca097aa52905eedf1b180f1" },
"catppuccin": { "branch": "main", "commit": "65bf0b16f57a3db70d6a93ac68882dd9a31d0565" },
"conform.nvim": { "branch": "master", "commit": "d28ccf945374edd9f1c34a82f6c22261dbd8ab98" },
"catppuccin": { "branch": "main", "commit": "637d99e638bc6f1efedac582f6ccab08badac0c6" },
"conform.nvim": { "branch": "master", "commit": "023f795dbcf32d4351b6a9ed2e613d471b5bb812" },
"copilot.lua": { "branch": "master", "commit": "f8d8d872bb319f640d5177dad5fbf01f7a16d7d0" },
"dashboard-nvim": { "branch": "master", "commit": "ae309606940d26d8c9df8b048a6e136b6bbec478" },
"dial.nvim": { "branch": "master", "commit": "ed4d6a5bbd5e479b4c4a3019d148561a2e6c1490" },
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
"fzf-lua": { "branch": "main", "commit": "ce1e24f2a48089b65deefcb0a71a9856839002b5" },
"fzf-lua": { "branch": "main", "commit": "8af7f00a11fbeb33a88cf95c951460eb8b1fb531" },
"gitsigns.nvim": { "branch": "main", "commit": "f4928ba14eb6c667786ac7d69927f6aee6719f1e" },
"grug-far.nvim": { "branch": "main", "commit": "190c03d54e8976491e6e49acb97087bf4182b079" },
"grug-far.nvim": { "branch": "main", "commit": "26415d3cc2fef99ccefa019cbc3969f404a83e70" },
"inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" },
"indent-blankline.nvim": { "branch": "master", "commit": "04e44b09ee3ff189c69ab082edac1ef7ae2e256c" },
"indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" },
"log-highlight.nvim": { "branch": "main", "commit": "cd948cad8150475ac1ace5515d0ae206a9aad3f2" },
"lualine.nvim": { "branch": "master", "commit": "640260d7c2d98779cab89b1e7088ab14ea354a02" },
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
"luassert-types": { "branch": "main", "commit": "d3528bb679302cbfdedefabb37064515ab95f7b9" },
"luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"mini.ai": { "branch": "main", "commit": "9b9b7cfa38b4871c3e44cfe89cf6d53fd40684d9" },
"mini.ai": { "branch": "main", "commit": "31c149067d38b97720d2a179619f7745a0006ecc" },
"mini.align": { "branch": "main", "commit": "26111a737494bc39576ad67b52bbc2638ca23553" },
"mini.animate": { "branch": "main", "commit": "d33ddf0eefee6338bbd95805c4595c1b34e6bfe2" },
"mini.diff": { "branch": "main", "commit": "65c59f9967fec965d8759a88c1baa43147699035" },
"mini.hipatterns": { "branch": "main", "commit": "797cbdc893cdcc2f0fbc05a23b4dae238a1fb0ae" },
"mini.icons": { "branch": "main", "commit": "a2742459f0ee32806c2438ca06b4d8b331f3f4d4" },
"mini.icons": { "branch": "main", "commit": "54686be7d58807906cb2c8c2216e0bf9c044f19a" },
"mini.pairs": { "branch": "main", "commit": "7e834c5937d95364cc1740e20d673afe2d034cdb" },
"mini.surround": { "branch": "main", "commit": "48a9795c9d352c771e1ab5dedab6063c0a2df037" },
"mini.test": { "branch": "main", "commit": "86a64d5a4bf9d73ebf5875edaae0d878f64f5e48" },
"neo-tree.nvim": { "branch": "main", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" },
"neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" },
"neotest-python": { "branch": "master", "commit": "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e" },
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
"nvim-cmp": { "branch": "main", "commit": "29fb4854573355792df9e156cb779f0d31308796" },
"nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" },
"nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" },
"nvim-lspconfig": { "branch": "master", "commit": "54617a18f4cf46f0c2f6d024fa6feb7515fe036d" },
"nvim-lspconfig": { "branch": "master", "commit": "d2d153a179ed59aa7134d7ebdf4d7dcb156efa22" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" },
"nvim-treesitter": { "branch": "master", "commit": "9565149634ec5e0fc9e740f4edb6cab26bf7fb6f" },
"nvim-treesitter": { "branch": "master", "commit": "e1e3108cd23d7f967842261bd66126b6734d8907" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "3e450cd85243da99dc23ebbf14f9c70e9a0c26a4" },
"nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" },
"perfanno.nvim": { "branch": "master", "commit": "b138718bf4289b429dc81cadaf80ace8221c647b" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"render-markdown.nvim": { "branch": "main", "commit": "fc05fb7c56795f191b6800799a2ec6ea325ba715" },
"render-markdown.nvim": { "branch": "main", "commit": "82184c4a3c3580a7a859b2cb7e58f16c10fd29ef" },
"telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" },
"tree-sitter-caddy": { "branch": "master", "commit": "65b60437983933d00809c8927e7d8a29ca26dfa3" },
"treesj": { "branch": "main", "commit": "0d81326b5afd36babe7dd480aabbb0b05f33e688" },
"venv-selector.nvim": { "branch": "regexp", "commit": "e82594274bf7b54387f9a2abe65f74909ac66e97" },
"yanky.nvim": { "branch": "main", "commit": "73215b77d22ebb179cef98e7e1235825431d10e4" }
"yanky.nvim": { "branch": "main", "commit": "f9b905994cccf3c55f41af3a0a1f4c76c844e411" }
}
12 changes: 6 additions & 6 deletions nvim/lazyvim.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extras": [
"lazyvim.plugins.extras.ai.copilot",
"lazyvim.plugins.extras.coding.blink",
"lazyvim.plugins.extras.coding.copilot",
"lazyvim.plugins.extras.coding.mini-surround",
"lazyvim.plugins.extras.coding.yanky",
"lazyvim.plugins.extras.editor.dial",
Expand All @@ -17,14 +17,14 @@
"lazyvim.plugins.extras.lang.yaml",
"lazyvim.plugins.extras.linting.eslint",
"lazyvim.plugins.extras.test.core",
"lazyvim.plugins.extras.ui.edgy",
"lazyvim.plugins.extras.ui.mini-animate",
"lazyvim.plugins.extras.util.dot",
"lazyvim.plugins.extras.util.mini-hipatterns"
"lazyvim.plugins.extras.util.mini-hipatterns",
"lazyvim.plugins.extras.vscode"
],
"news": {
"NEWS.md": "6520",
"doc/news.txt": "13405"
"NEWS.md": "7107",
"doc/news.txt": "13806"
},
"version": 6
"version": 7
}
1 change: 1 addition & 0 deletions nvim/lua/plugins/editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ return {
},
{
"t-troebst/perfanno.nvim",
dependencies = { "nvim-telescope/telescope.nvim" },
opts = function()
local util = require("perfanno.util")
local hl = vim.api.nvim_get_hl(0, { name = "Normal" })
Expand Down
13 changes: 0 additions & 13 deletions nvim/lua/util/init.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
-- selene: allow(global_usage)
_G.profile = function(cmd, times, flush)
times = times or 100
local start = vim.uv.hrtime()
for _ = 1, times, 1 do
if flush then
jit.flush(cmd, true)
end
cmd()
end
print(((vim.uv.hrtime() - start) / 1e6 / times) .. "ms")
end

local M = {}

function M.test(is_file)
Expand Down
1 change: 1 addition & 0 deletions pacman.txt
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ nbtscan
ncdu
needrestart
neofetch
neohtop-bin
neovim
nerdfix
netctl
Expand Down

0 comments on commit 34ee630

Please sign in to comment.