add: perapihan plugins

This commit is contained in:
asep.komarudin 2024-06-03 09:03:01 +07:00
parent 130f910923
commit 50fffa04d7
6 changed files with 202 additions and 194 deletions

View file

@ -1,20 +1,24 @@
local icons = vim.g.pcode_icons
return {
"echasnovski/mini.indentscope",
version = false, -- wait till new 0.7.0 release to put it back on semver
event = "BufReadPre",
enabled = vim.g.pcode_indentscope and true or false,
opts = {
symbol = icons.ui.LineMiddle,
options = { try_as_border = true },
},
config = function(_, opts)
vim.api.nvim_create_autocmd("FileType", {
pattern = { "help", "alpha", "dashboard", "NvimTree", "Trouble", "lazy", "mason" },
callback = function()
vim.b.miniindentscope_disable = true
end,
})
require("mini.indentscope").setup(opts)
end,
}
if vim.g.pcode_indentscope and true or false then
return {
"echasnovski/mini.indentscope",
version = false, -- wait till new 0.7.0 release to put it back on semver
event = "BufReadPre",
enabled = vim.g.pcode_indentscope and true or false,
opts = {
symbol = icons.ui.LineMiddle,
options = { try_as_border = true },
},
config = function(_, opts)
vim.api.nvim_create_autocmd("FileType", {
pattern = { "help", "alpha", "dashboard", "NvimTree", "Trouble", "lazy", "mason" },
callback = function()
vim.b.miniindentscope_disable = true
end,
})
require("mini.indentscope").setup(opts)
end,
}
else
return {}
end

View file

@ -1,74 +1,77 @@
local function ambilKataDariKiri(kalimat, jumlahKata)
local hasil = ""
local posisiAwal = 1
local kataKe = 0
local hasil = ""
local posisiAwal = 1
local kataKe = 0
while kataKe < jumlahKata do
local posisiSpasi = string.find(kalimat, " ", posisiAwal)
if posisiSpasi then
hasil = hasil .. string.sub(kalimat, posisiAwal, posisiSpasi - 1) .. " "
posisiAwal = posisiSpasi + 1
else
hasil = hasil .. string.sub(kalimat, posisiAwal)
break
end
kataKe = kataKe + 1
end
while kataKe < jumlahKata do
local posisiSpasi = string.find(kalimat, " ", posisiAwal)
if posisiSpasi then
hasil = hasil .. string.sub(kalimat, posisiAwal, posisiSpasi - 1) .. " "
posisiAwal = posisiSpasi + 1
else
hasil = hasil .. string.sub(kalimat, posisiAwal)
break
end
kataKe = kataKe + 1
end
return hasil
return hasil
end
local fidget = true
local lualine = false
if vim.g.pcode_progress == 1 then
fidget = false
lualine = true
fidget = false
lualine = true
elseif vim.g.pcode_progress == 2 then
fidget = true
lualine = false
fidget = true
lualine = false
elseif vim.g.pcode_progress == 0 then
fidget = false
lualine = false
fidget = false
lualine = false
else
fidget = true
lualine = false
fidget = true
lualine = false
end
if fidget then
return {
"j-hui/fidget.nvim",
lazy = true,
enabled = fidget,
tag = "legacy",
event = "BufRead",
config = function()
require("fidget").setup {
window = {
blend = 0,
relative = "editor",
},
}
end,
}
elseif lualine then
return {
"linrongbin16/lsp-progress.nvim",
enabled = lualine,
lazy = true,
branch = "main",
event = { "BufRead" },
config = function()
require("lsp-progress").setup {
client_format = function(client_name, spinner, series_messages)
return #series_messages > 0
and (spinner .. " " .. ambilKataDariKiri(table.concat(series_messages, ", "), 4) .. "...")
or nil
end,
format = function(client_messages)
local sign = ""
return #client_messages > 0
and (sign .. " " .. ambilKataDariKiri(table.concat(client_messages, " "), 4) .. "...")
or sign
end,
}
end,
}
else
return {}
end
return {
{
"j-hui/fidget.nvim",
lazy = true,
enabled = fidget,
tag = "legacy",
event = "BufRead",
config = function()
require("fidget").setup({
window = {
blend = 0,
relative = "editor",
},
})
end,
},
{
"linrongbin16/lsp-progress.nvim",
enabled = lualine,
lazy = true,
branch = "main",
event = { "BufRead" },
config = function()
require("lsp-progress").setup({
client_format = function(client_name, spinner, series_messages)
return #series_messages > 0
and (spinner .. " " .. ambilKataDariKiri(table.concat(series_messages, ", "), 4) .. "...")
or nil
end,
format = function(client_messages)
local sign = ""
return #client_messages > 0
and (sign .. " " .. ambilKataDariKiri(table.concat(client_messages, " "), 4) .. "...")
or sign
end,
})
end,
},
}

View file

@ -1,41 +1,45 @@
return {
-- animations
{
"echasnovski/mini.animate",
event = "BufRead",
enabled = not vim.g.neovide and vim.g.pvode_minianimate and true or false,
opts = function()
-- don't use animate when scrolling with the mouse
local mouse_scrolled = false
for _, scroll in ipairs { "Up", "Down" } do
local key = "<ScrollWheel" .. scroll .. ">"
vim.keymap.set({ "", "i" }, key, function()
mouse_scrolled = true
return key
end, { expr = true })
end
if not vim.g.neovide and vim.g.pvode_minianimate and true or false then
return {
-- animations
{
"echasnovski/mini.animate",
event = "BufRead",
enabled = not vim.g.neovide and vim.g.pvode_minianimate and true or false,
opts = function()
-- don't use animate when scrolling with the mouse
local mouse_scrolled = false
for _, scroll in ipairs { "Up", "Down" } do
local key = "<ScrollWheel" .. scroll .. ">"
vim.keymap.set({ "", "i" }, key, function()
mouse_scrolled = true
return key
end, { expr = true })
end
local animate = require "mini.animate"
return {
resize = {
timing = animate.gen_timing.linear { duration = 100, unit = "total" },
},
scroll = {
timing = animate.gen_timing.linear { duration = 150, unit = "total" },
subscroll = animate.gen_subscroll.equal {
predicate = function(total_scroll)
if mouse_scrolled then
mouse_scrolled = false
return false
end
return total_scroll > 1
end,
local animate = require "mini.animate"
return {
resize = {
timing = animate.gen_timing.linear { duration = 100, unit = "total" },
},
},
}
end,
config = function(_, opts)
require("mini.animate").setup(opts)
end,
},
}
scroll = {
timing = animate.gen_timing.linear { duration = 150, unit = "total" },
subscroll = animate.gen_subscroll.equal {
predicate = function(total_scroll)
if mouse_scrolled then
mouse_scrolled = false
return false
end
return total_scroll > 1
end,
},
},
}
end,
config = function(_, opts)
require("mini.animate").setup(opts)
end,
},
}
else
return {}
end

View file

@ -15,63 +15,67 @@ if clear_line ~= nil then
end
end
return {
-- transparant config
{
"xiyaowong/transparent.nvim",
lazy = true,
enabled = transparent,
event = "BufWinEnter",
cmd = { "TransparentToggle", "TransparentEnable", "TransparentDisable" },
config = function()
require("transparent").setup {
extra_groups = {
"Normal",
"NormalNC",
"NormalFloat",
"FloatBorder",
"Comment",
"Folded",
"GitSignsAdd",
"GitSignsDelete",
"GitSignsChange",
"FoldColumn",
},
exclude_groups = {
-- disable active selection backgroun
"CursorLine",
"CursorLineNR",
"CursorLineSign",
"CursorLineFold",
-- disable nvimtree CursorLine
"NvimTreeCursorLine",
-- disable Neotree CursorLine
"NeoTreeCursorLine",
-- disable Telescope active selection background
"TelescopeSelection",
-- disable lualine background color
"LualineNormal",
},
}
require("transparent").clear_prefix "BufferLine"
-- clear prefix for which-key
require("transparent").clear_prefix "WhichKey"
-- clear prefix for lazy.nvim
require("transparent").clear_prefix "Lazy"
-- clear prefix for NvimTree
require("transparent").clear_prefix "NvimTree"
-- clear prefix for NeoTree
require("transparent").clear_prefix "NeoTree"
-- clear prefix for Telescope
require("transparent").clear_prefix "Telescope"
require("transparent").clear_prefix "mason"
if clear_lualine then
-- clear prefix for Lualine
require("transparent").clear_prefix "Lualine"
-- create auto command to set transparent
vim.cmd "TransparentDisable"
vim.cmd "TransparentEnable"
end
end,
},
}
if transparent then
return {
-- transparant config
{
"xiyaowong/transparent.nvim",
lazy = true,
enabled = transparent,
event = "BufWinEnter",
cmd = { "TransparentToggle", "TransparentEnable", "TransparentDisable" },
config = function()
require("transparent").setup {
extra_groups = {
"Normal",
"NormalNC",
"NormalFloat",
"FloatBorder",
"Comment",
"Folded",
"GitSignsAdd",
"GitSignsDelete",
"GitSignsChange",
"FoldColumn",
},
exclude_groups = {
-- disable active selection backgroun
"CursorLine",
"CursorLineNR",
"CursorLineSign",
"CursorLineFold",
-- disable nvimtree CursorLine
"NvimTreeCursorLine",
-- disable Neotree CursorLine
"NeoTreeCursorLine",
-- disable Telescope active selection background
"TelescopeSelection",
-- disable lualine background color
"LualineNormal",
},
}
require("transparent").clear_prefix "BufferLine"
-- clear prefix for which-key
require("transparent").clear_prefix "WhichKey"
-- clear prefix for lazy.nvim
require("transparent").clear_prefix "Lazy"
-- clear prefix for NvimTree
require("transparent").clear_prefix "NvimTree"
-- clear prefix for NeoTree
require("transparent").clear_prefix "NeoTree"
-- clear prefix for Telescope
require("transparent").clear_prefix "Telescope"
require("transparent").clear_prefix "mason"
if clear_lualine then
-- clear prefix for Lualine
require("transparent").clear_prefix "Lualine"
-- create auto command to set transparent
vim.cmd "TransparentDisable"
vim.cmd "TransparentEnable"
end
end,
},
}
else
return {}
end