AutoYADM commit: 2024-12-05 19:30:02

This commit is contained in:
Daniel Fichtinger 2024-12-05 19:30:02 -05:00
parent 3832052955
commit 62228bfda1

View file

@ -51,28 +51,31 @@ map({ "n" }, "<S-l>", "H", { remap = false })
-- Duplicate and comment line
map({ "n" }, "<leader>yc", '"zyygcc"zp', { remap = true, silent = true, desc = "Duplicate and comment line" })
local function is_lsp_attached()
local clients = vim.lsp.get_clients({ bufnr = 0 })
return #clients > 0
end
local cptoggle = Snacks.toggle.new({
name = "Lsp",
-- map = vim.keymap.set,
which_key = true,
get = function()
return not is_lsp_attached()
end,
notify = true,
set = function(state)
if state then
vim.cmd("LspStart")
else
vim.cmd("LspStop")
end
end,
})
Snacks.toggle.map(cptoggle, "<leader>at", { desc = "Toggle Copilot" })
-- local function is_lsp_attached()
-- local clients = vim.lsp.get_clients({ bufnr = 0 })
-- print(#clients .. " clients found")
-- return #clients > 0
-- end
--
-- local lsptoggle = Snacks.toggle.new({
-- name = "Lsp",
-- -- map = vim.keymap.set,
-- which_key = true,
-- get = function()
-- return not is_lsp_attached()
-- end,
-- notify = true,
-- set = function(state)
-- if state then
-- -- vim.cmd("LspStart")
-- print("we start lsp...")
-- else
-- -- vim.cmd("LspStop")
-- print("We stop lsp...")
-- end
-- end,
-- })
-- Snacks.toggle.map(lsptoggle, "<leader>cL", { desc = "Toggle LSP" })
-- better quit
map("n", "<C-q>", "<cmd>qa<cr>", { desc = "Quit All" })