mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-25 02:08:48 +02:00
enc: fix nvim-tree exploler error
This commit is contained in:
parent
2ce30970f6
commit
30ba4f5233
9 changed files with 414 additions and 11 deletions
56
lua/user/utils/cheatsheet.lua
Normal file
56
lua/user/utils/cheatsheet.lua
Normal file
|
@ -0,0 +1,56 @@
|
|||
local M = {}
|
||||
|
||||
M.run = function()
|
||||
local Popup = require("nui.popup")
|
||||
local event = require("nui.utils.autocmd").event
|
||||
|
||||
-- Buat popup untuk menampilkan keymapping
|
||||
local popup = Popup({
|
||||
enter = true,
|
||||
focusable = true,
|
||||
border = {
|
||||
style = "rounded",
|
||||
text = {
|
||||
top = " Key Mappings ",
|
||||
},
|
||||
},
|
||||
position = "50%",
|
||||
size = {
|
||||
width = "80%",
|
||||
height = "80%",
|
||||
},
|
||||
})
|
||||
|
||||
-- Daftar keymapping yang akan ditampilkan dalam dua kolom dengan section header
|
||||
-- stylua: ignore
|
||||
local key_mappings = {
|
||||
{ "<leader>a ", "Toggle Dashboard ", "<leader>e ", "Toggle Explorer "},
|
||||
{ "<leader>c ", "Chat AI ", "<leader>bb", ":Telescope buffers<CR> "},
|
||||
{ " ", " ", "<leader>bd", ":bdelete<CR> "},
|
||||
{ " ", " ", " ", " "},
|
||||
{ "Terminal ", " ", " ", " "},
|
||||
{ "<leader>tt ", ":ToggleTerm<CR> ", "<leader>tn", ":ToggleTerm direction=horizontal<CR>"},
|
||||
}
|
||||
|
||||
-- Fungsi untuk mengubah daftar keymapping menjadi format string
|
||||
local function format_key_mappings(mappings)
|
||||
local formatted = {}
|
||||
for _, mapping in ipairs(mappings) do
|
||||
table.insert(formatted, string.format("%-20s %-20s %-20s %s", mapping[1], mapping[2], mapping[3], mapping[4]))
|
||||
end
|
||||
return formatted
|
||||
end
|
||||
|
||||
-- Set konten popup dengan daftar keymapping yang diformat
|
||||
vim.api.nvim_buf_set_lines(popup.bufnr, 0, -1, false, format_key_mappings(key_mappings))
|
||||
|
||||
-- Mount popup
|
||||
popup:mount()
|
||||
|
||||
-- Unmount popup ketika cursor meninggalkan buffer
|
||||
popup:on(event.BufLeave, function()
|
||||
popup:unmount()
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
|
@ -46,7 +46,7 @@ return {
|
|||
color = function()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
local ts = vim.treesitter.highlighter.active[buf]
|
||||
return { fg = ts and not vim.tbl_isempty(ts) and "#50fa7b" or "#FF5555" }
|
||||
return { fg = ts and not vim.tbl_isempty(ts) and "#98C379" or "#E06C75" }
|
||||
end,
|
||||
cond = hide_in_width,
|
||||
},
|
||||
|
@ -71,7 +71,7 @@ return {
|
|||
color = function()
|
||||
if pcode.codeium then
|
||||
local codeium = all_trim(vim.api.nvim_call_function("codeium#GetStatusString", {}))
|
||||
return { fg = codeium == "OFF" and "#3E4452" or "#50fa7b" }
|
||||
return { fg = codeium == "OFF" and "#3E4452" or "#98C379" }
|
||||
else
|
||||
return {}
|
||||
end
|
||||
|
@ -222,11 +222,11 @@ return {
|
|||
separator = { left = " ", right = "" },
|
||||
fmt = function(str)
|
||||
if pcode.show_mode == 1 then
|
||||
return icons.ui.Neovim .. " " .. (mode_map[str] or str)
|
||||
return icons.ui.Neovim .. " " .. str:sub(1, 1)
|
||||
elseif pcode.show_mode == 2 then
|
||||
return icons.ui.Neovim
|
||||
elseif pcode.show_mode == 3 then
|
||||
return (mode_map[str] or str)
|
||||
return str:sub(1, 1)
|
||||
elseif pcode.show_mode == 4 then
|
||||
return nil
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue