save
This commit is contained in:
@@ -37,3 +37,78 @@ vim.api.nvim_create_user_command("DeployRobotCode", function()
|
||||
end,
|
||||
})
|
||||
end, {})
|
||||
|
||||
---@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_progress",
|
||||
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({ 'FileType' }, {
|
||||
pattern = { 'netrw' },
|
||||
group = vim.api.nvim_create_augroup('NetrwOnRename', { clear = true }),
|
||||
callback = function()
|
||||
vim.keymap.set("n", "R", function()
|
||||
local original_file_path = vim.b.netrw_curdir .. '/' .. vim.fn["netrw#Call"]("NetrwGetWord")
|
||||
|
||||
vim.ui.input({ prompt = 'Move/rename to:', default = original_file_path },
|
||||
function(target_file_path)
|
||||
if target_file_path and target_file_path ~= "" then
|
||||
local file_exists = vim.uv.fs_access(target_file_path, "W")
|
||||
|
||||
if not file_exists then
|
||||
vim.uv.fs_rename(original_file_path, target_file_path)
|
||||
|
||||
Snacks.rename.on_rename_file(original_file_path, target_file_path)
|
||||
else
|
||||
vim.notify(
|
||||
"File '" .. target_file_path .. "' already exists! Skipping...",
|
||||
vim.log.levels.ERROR)
|
||||
end
|
||||
|
||||
-- Refresh netrw
|
||||
vim.cmd(':Ex ' .. vim.b.netrw_curdir)
|
||||
end
|
||||
end)
|
||||
end, { remap = true, buffer = true })
|
||||
end
|
||||
})
|
||||
|
||||
@@ -9,6 +9,11 @@ opt.splitbelow = true
|
||||
|
||||
vim.cmd("colorscheme vim")
|
||||
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
|
||||
-- mini.pick colors
|
||||
vim.api.nvim_set_hl(0, "MiniPickNormal", { bg = "#000000" })
|
||||
vim.api.nvim_set_hl(0, "MiniPickBorder", { bg = "#000000", fg = "#000000" })
|
||||
@@ -16,4 +21,13 @@ vim.api.nvim_set_hl(0, "MiniPickMatchCurrent", { bg = "#1e1e2e" })
|
||||
|
||||
if vim.g.neovide then
|
||||
vim.g.neovide_opacity = 0.8
|
||||
vim.o.guifont = "ComicShannsMono Nerd Font"
|
||||
|
||||
local function save() vim.cmd.write() end
|
||||
local function copy() vim.cmd([[normal! "+y]]) end
|
||||
local function paste() vim.api.nvim_paste(vim.fn.getreg("+"), true, -1) end
|
||||
|
||||
vim.keymap.set({ "n", "i", "v" }, "<S-C-s>", save)
|
||||
vim.keymap.set("v", "<S-C-c>", copy, { silent = true })
|
||||
vim.keymap.set({ "n", "i", "v", "c", "t" }, "<S-C-v>", paste)
|
||||
end
|
||||
|
||||
@@ -16,3 +16,7 @@ keymap("n", "<leader>f", ":Pick files<CR>")
|
||||
keymap("n", "<leader>g", ":Pick grep_live<CR>")
|
||||
|
||||
keymap("n", "<leader>lf", vim.lsp.buf.format)
|
||||
|
||||
keymap({ "n", "t" }, "<C-/>", function()
|
||||
require("snacks").terminal()
|
||||
end)
|
||||
|
||||
@@ -13,12 +13,24 @@ vim.pack.add {
|
||||
{ src = "https://github.com/m00qek/baleia.nvim" },
|
||||
{ src = "https://github.com/esmuellert/codediff.nvim" },
|
||||
{ src = "https://github.com/NeogitOrg/neogit" },
|
||||
|
||||
{ src = "https://github.com/folke/snacks.nvim" },
|
||||
|
||||
{ src = "https://github.com/saghen/blink.lib" },
|
||||
}
|
||||
|
||||
require("mini.pick").setup {}
|
||||
require("lualine").setup {}
|
||||
require("smear_cursor").setup {}
|
||||
require("neogit").setup {}
|
||||
|
||||
require("snacks").setup {
|
||||
notifier = { enabled = true },
|
||||
image = { enabled = true },
|
||||
quickfile = { enabed = true },
|
||||
}
|
||||
|
||||
require("blink.cmp").build():pwait(60000)
|
||||
require('blink.cmp').setup {
|
||||
fuzzy = { implementation = 'prefer_rust_with_warning' },
|
||||
signature = { enabled = true },
|
||||
@@ -29,7 +41,7 @@ require('blink.cmp').setup {
|
||||
["<C-n>"] = { "select_next", "fallback" },
|
||||
["<C-b>"] = { "scroll_documentation_down", "fallback" },
|
||||
["<C-f>"] = { "scroll_documentation_up", "fallback" },
|
||||
-- ["<C-e>"] = { "hide" },
|
||||
["<C-e>"] = { "hide" },
|
||||
},
|
||||
|
||||
appearance = {
|
||||
@@ -58,5 +70,3 @@ require('blink.cmp').setup {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require("neogit").setup {}
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
"src": "https://github.com/saghen/blink.cmp",
|
||||
"version": "'1.*'"
|
||||
},
|
||||
"blink.lib": {
|
||||
"rev": "b127d48bf8e9ac9cf41f6e0fbead317503f76558",
|
||||
"src": "https://github.com/saghen/blink.lib"
|
||||
},
|
||||
"codediff.nvim": {
|
||||
"rev": "29b06f37251f2e010f53a0892573b2ec03d165e2",
|
||||
"src": "https://github.com/esmuellert/codediff.nvim"
|
||||
@@ -21,6 +25,10 @@
|
||||
"rev": "47f91c416daef12db467145e16bed5bbfe00add8",
|
||||
"src": "https://github.com/nvim-lualine/lualine.nvim"
|
||||
},
|
||||
"mini.nvim": {
|
||||
"rev": "cbae4fa396bbf9c802b3d2dc2e9c5362e8fb9468",
|
||||
"src": "https://github.com/nvim-mini/mini.nvim"
|
||||
},
|
||||
"mini.pick": {
|
||||
"rev": "8521fe21df86e08d9e4b3c3f3a7d50e47954e1af",
|
||||
"src": "https://github.com/nvim-mini/mini.pick"
|
||||
@@ -41,6 +49,10 @@
|
||||
"rev": "9e9378d6ee34bb3782e0e8c63d9ec8ca618b479b",
|
||||
"src": "https://github.com/sphamba/smear-cursor.nvim"
|
||||
},
|
||||
"snacks.nvim": {
|
||||
"rev": "882c996cf28183f4d63640de0b4c02ec886d01f2",
|
||||
"src": "https://github.com/folke/snacks.nvim"
|
||||
},
|
||||
"todo-comments.nvim": {
|
||||
"rev": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668",
|
||||
"src": "https://github.com/folke/todo-comments.nvim"
|
||||
|
||||
Reference in New Issue
Block a user