enc: upgrade v2 to v2.5

This commit is contained in:
Pojok Code 2024-11-04 21:29:25 +07:00
parent 68ea712b98
commit 609234c086
443 changed files with 5224 additions and 90746 deletions

117
lua/pcode/user/autocmd.lua Normal file
View file

@ -0,0 +1,117 @@
local api = vim.api
-- General Settings
api.nvim_create_augroup("_general_settings", { clear = true })
api.nvim_create_autocmd("TextYankPost", {
group = "_general_settings",
callback = function()
require("vim.highlight").on_yank({ higroup = "Visual", timeout = 200 })
end,
})
api.nvim_create_autocmd("FileType", {
group = "_general_settings",
pattern = "qf",
command = "set nobuflisted",
})
-- Git Settings
api.nvim_create_augroup("_git", { clear = true })
api.nvim_create_autocmd("FileType", {
group = "_git",
pattern = "gitcommit",
command = "setlocal wrap spell",
})
-- Markdown Settings
api.nvim_create_augroup("_markdown", { clear = true })
api.nvim_create_autocmd("FileType", {
group = "_markdown",
pattern = "markdown",
command = "setlocal wrap spell",
})
-- Auto Resize
api.nvim_create_augroup("_auto_resize", { clear = true })
api.nvim_create_autocmd("VimResized", {
group = "_auto_resize",
command = "tabdo wincmd =",
})
-- Alpha Settings
api.nvim_create_augroup("_alpha", { clear = true })
api.nvim_create_autocmd("User", {
group = "_alpha",
pattern = "AlphaReady",
command = "set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2",
})
-- Terminal Settings
api.nvim_create_augroup("neovim_terminal", { clear = true })
api.nvim_create_autocmd("TermOpen", {
group = "neovim_terminal",
command = "startinsert | set nonumber norelativenumber | nnoremap <buffer> <C-c> i<C-c>",
})
-- Function to Create Non-Existent Directory on BufWrite
local function MkNonExDir(file, buf)
if vim.fn.empty(vim.fn.getbufvar(buf, "&buftype")) == 1 and not string.match(file, "^%w+://") then
local dir = vim.fn.fnamemodify(file, ":h")
if vim.fn.isdirectory(dir) == 0 then
vim.fn.mkdir(dir, "p")
end
end
end
api.nvim_create_augroup("BWCCreateDir", { clear = true })
api.nvim_create_autocmd("BufWritePre", {
group = "BWCCreateDir",
callback = function(_)
MkNonExDir(vim.fn.expand("<afile>"), vim.fn.expand("<abuf>"))
end,
})
-- for fix error last close buffer
vim.api.nvim_create_autocmd({ "QuitPre" }, {
callback = function()
vim.cmd("NvimTreeClose")
end,
})
local autocmd = vim.api.nvim_create_autocmd
autocmd("VimEnter", {
pattern = "*",
callback = function()
vim.opt.statusline = "%#normal# "
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = { "help", "alpha", "dashboard", "NvimTree", "Trouble", "lazy", "mason", "neotest-summary" },
callback = function()
vim.b.miniindentscope_disable = true
end,
})
vim.filetype.add({
pattern = {
[".*%.blade%.php"] = "blade",
},
})
-- config cursor
vim.opt.guicursor = {
"n-v:block", -- Normal, Visual, Command mode: block cursor
"i-ci-ve-c:ver25", -- Insert, Command-line Insert, Visual mode: vertical bar cursor
"r-cr:hor20", -- Replace, Command-line Replace mode: horizontal bar cursor
"o:hor50", -- Operator-pending mode: horizontal bar cursor
"a:blinkwait700-blinkoff400-blinkon250", -- Blinking settings
"sm:block-blinkwait175-blinkoff150-blinkon175", -- Select mode: block cursor with blinking
}
vim.api.nvim_create_autocmd("ExitPre", {
group = vim.api.nvim_create_augroup("Exit", { clear = true }),
command = "set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175,a:ver90",
desc = "Set cursor back to beam when leaving Neovim.",
})

View file

@ -0,0 +1,7 @@
if pcode.themes then
local theme = ""
for _, value in pairs(pcode.themes or {}) do
theme = value
end
pcall(vim.cmd.colorscheme, theme)
end

129
lua/pcode/user/custom.lua Normal file
View file

@ -0,0 +1,129 @@
return {
-- overidse dashboard
{
"goolord/alpha-nvim",
opts = {
dash_model = {
[[ _ __ __ ]],
[[ ___ ___ (____ / /__ _______ ___/ ___ ]],
[[ / _ / _ \ / / _ \/ '_/ / __/ _ / _ / -_) ]],
[[ / .__\_____/ /\___/_/\_\ \__/\___\_,_/\__/ ]],
[[ /_/ |___/ ]],
},
},
},
-- overide lualine
{
"pojokcodeid/auto-lualine.nvim",
opts = {
-- for more options check out https://github.com/pojokcodeid/auto-lualine.nvim
setColor = "auto",
setOption = "roundedall",
setMode = 5,
},
},
-- overide formatting
{
"pojokcodeid/auto-conform.nvim",
opts = {
format_on_save = true,
format_timeout_ms = 5000,
},
},
-- install treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "lua", "c" })
end,
},
-- install mason (lsp, dap, linters, formatters)
{
"williamboman/mason.nvim",
opts = { ensure_installed = { "stylua" } },
},
-- overide lsp config
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
vim.list_extend(opts.skip_config, { "jdtls" })
opts.virtual_text = true
end,
},
-- add whichkey mappings
{
"folke/which-key.nvim",
opts = function(_, opts)
opts.mappings = opts.mappings or {}
vim.list_extend(opts.mappings, {
{ "<leader>h", "<cmd>nohlsearch<CR>", desc = "󱪿 No Highlight", mode = "n" },
})
end,
},
-- overide telescope
{
"nvim-telescope/telescope.nvim",
opts = function(_, opts)
opts.pickers = {
find_files = {
hidden = true,
},
live_grep = {
theme = "dropdown",
only_sort_text = true,
additional_args = function()
return { "--multiline" }
end,
},
}
end,
},
-- add code runner
{
"CRAG666/code_runner.nvim",
opts = function(_, opts)
vim.list_extend(opts.filetype, { go = "go run $fileName" })
end,
},
-- custem nvimtree
{
"nvim-tree/nvim-tree.lua",
opts = function(_, opts)
-- set nvimtree float view (default left side)
-- opts.view = {
-- adaptive_size = false,
-- centralize_selection = true,
-- side = "left",
-- preserve_window_proportions = false,
-- number = false,
-- relativenumber = false,
-- signcolumn = "yes",
-- float = {
-- enable = true,
-- open_win_config = function()
-- local screen_w = vim.opt.columns:get()
-- local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get()
-- local window_w = screen_w * 0.5
-- local window_h = screen_h * 0.9
-- local window_w_int = math.floor(window_w)
-- local window_h_int = math.floor(window_h)
-- local center_x = (screen_w - window_w) / 2
-- local center_y = ((vim.opt.lines:get() - window_h) / 2) - vim.opt.cmdheight:get()
-- return {
-- border = "rounded",
-- relative = "editor",
-- row = center_y,
-- col = center_x,
-- width = window_w_int,
-- height = window_h_int,
-- }
-- end,
-- },
-- width = function()
-- return math.floor(vim.opt.columns:get() * 0.5)
-- end,
-- }
return opts
end,
},
}

83
lua/pcode/user/dapui.lua Normal file
View file

@ -0,0 +1,83 @@
-- local dap, dapui = require("dap"), require("dapui")
local dap_status_ok, dap = pcall(require, "dap")
if not dap_status_ok then
return
end
local dap_ui_status_ok, dapui = pcall(require, "dapui")
if not dap_ui_status_ok then
return
end
-- dapui.setup()
dapui.setup({
icons = { expanded = "", collapsed = "" },
mappings = {
-- Use a table to apply multiple mappings
expand = { "<CR>", "<2-LeftMouse>" },
open = "o",
remove = "d",
edit = "e",
repl = "r",
toggle = "t",
},
-- Expand lines larger than the window
-- Requires >= 0.7
expand_lines = vim.fn.has("nvim-0.7"),
-- Layouts define sections of the screen to place windows.
-- The position can be "left", "right", "top" or "bottom".
-- The size specifies the height/width depending on position. It can be an Int
-- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while
-- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns)
-- Elements are the elements shown in the layout (in order).
-- Layouts are opened in order so that earlier layouts take priority in window sizing.
layouts = {
{
elements = {
-- Elements can be strings or table with id and size keys.
{ id = "scopes", size = 0.25 },
"breakpoints",
-- "stacks",
-- "watches",
},
size = 40, -- 40 columns
position = "right",
},
{
elements = {
"repl",
"console",
},
size = 0.25, -- 25% of total lines
position = "bottom",
},
},
floating = {
max_height = nil, -- These can be integers or a float between 0 and 1.
max_width = nil, -- Floats will be treated as percentage of your screen.
border = "single", -- Border style. Can be "single", "double" or "rounded"
mappings = {
close = { "q", "<Esc>" },
},
},
windows = { indent = 1 },
render = {
max_type_length = nil, -- Can be integer or nil.
},
})
dap.listeners.after.event_initialized["dapui_config"] = function()
-- dapui.setup()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
-- vim.fn.sign_define("DapBreakpoint", { text = "🟥", texthl = "", linehl = "", numhl = "" })
-- vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError", linehl = "", numhl = "" })
vim.fn.sign_define("DapBreakpoint", { text = "󰨰", texthl = "DiagnosticSignError", linehl = "", numhl = "" })
vim.fn.sign_define("DapStopped", { text = "▶️", texthl = "", linehl = "", numhl = "" })

View file

@ -0,0 +1,69 @@
-- activate config spesific languages
pcode.lang = {
-- "angular",
-- "cpp",
-- "sql",
-- "deno",
-- "golang",
-- "java",
-- "javascript",
-- "kotlin",
-- "markdown",
"php",
-- "prisma",
-- "python",
-- "tust",
-- "tailwind",
}
-- activate config extras
pcode.extras = {
-- "autosave",
-- "bigfiles",
-- "codeiumnvim",
-- "liveserver",
-- "minianimate",
-- "neoscroll",
-- "nvimufo",
-- "refactoring",
-- "rest",
-- "treesittercontex",
"codeium",
"colorizer",
"dap",
"deviconcolor",
"illuminate",
"indentscupe",
"navic",
"nvimmenu",
"rainbowdelimiters",
"scrollview",
"smart-split",
"verticalcolumn",
"visualmulti",
"yanky",
"zenmode",
}
-- activate config themes
pcode.themes = {
-- note: open remark only one
-- **:: Eva Theme ::** --
evatheme = "Eva-Dark",
-- evatheme = "Eva-Dark-Italic",
-- evatheme = "Eva-Dark-Bold",
-- evatheme = "Eva-Light",
--
-- **:: Dracula Theme ::** --
-- dracula = "dracula",
-- dracula = "dracula-soft",
--
-- **:: Onedarkpro Theme ::** --
-- onedarkpro = "onedark",
-- onedarkpro = "onedark_vivid",
-- onedarkpro = "onedark_dark",
--
-- **:: Jetbrains Theme ::** --
-- jetbrains = "darcula-dark",
}
-- activate config transparent_bg
pcode.transparent = false
pcode.localcode = true

194
lua/pcode/user/icons.lua Normal file
View file

@ -0,0 +1,194 @@
return {
kind = {
Boolean = "󰨙",
Color = "",
Codeium = "󰘦",
Control = "",
Collapsed = "",
Copilot = "",
CopilotOff = "",
Folder = "󰉋",
Keyword = "",
Reference = "",
Snippet = "",
TabNine = "󰏚",
Text = "",
Unit = "",
Value = "",
File = "",
Module = "",
Namespace = "",
Package = "",
Class = "",
Method = "",
Property = "",
Field = "",
Constructor = "",
Enum = "",
Interface = "",
Function = "",
Variable = "",
Constant = "",
String = "",
Number = "",
Array = "",
Object = "",
Key = "",
Null = "",
EnumMember = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
},
git = {
LineAdded = "",
LineModified = "",
LineRemoved = "",
FileDeleted = "",
FileIgnored = "",
FileRenamed = "",
FileStaged = "S",
FileUnmerged = "",
FileUnstaged = "",
FileUntracked = "U",
Diff = "",
Repo = "",
Octoface = "",
Branch = "",
Branch2 = "",
Branch3 = "󰘬",
NoBranch = "󱓌",
},
ui = {
ArrowCircleDown = "",
ArrowCircleLeft = "",
ArrowCircleRight = "",
ArrowCircleUp = "",
BoldArrowDown = "",
BoldArrowLeft = "",
BoldArrowRight = "",
BoldArrowUp = "",
BoldClose = "",
BoldDividerLeft = "",
BoldDividerRight = "",
BoldLineLeft = "",
BookMark = "",
BoxChecked = "",
Bug = "",
Stacks = "",
Scopes = "",
Watches = "󰂥",
DebugConsole = "",
Calendar = "",
Check = "",
ChevronRight = "",
ChevronShortDown = "",
ChevronShortLeft = "",
ChevronShortRight = "",
ChevronShortUp = "",
ChevronShortDown2 = "",
ChevronShortLeft2 = "",
ChevronShortRight2 = "",
ChevronShortUp2 = "",
Circle = "",
Close = "󰅖",
CloudDownload = "",
Code = "",
Comment = "",
Dashboard = "",
DividerLeft = "",
DividerRight = "",
DoubleChevronRight = "»",
Ellipsis = "",
EmptyFolder = "󰉖",
EmptyFolderOpen = "󰷏",
File = "",
FileSymlink = "",
Files = "",
FindFile = "󰈞",
FindText = "󰊄",
Fire = "",
Folder = "󰉋",
FolderOpen = "󰝰",
FolderSymlink = "",
Forward = "",
Gear = "",
History = "",
Lightbulb = "",
LineLeft = "",
LineMiddle = "",
List = "",
Lock = "",
NewFile = "",
Note = "",
Package = "",
Pencil = "󰏫",
Plus = "",
Project = "",
Search = "",
SignIn = "",
SignOut = "",
Tab = "󰌒",
Table = "",
Target = "󰀘",
Telescope = "",
Text = "",
Tree = "",
Triangle = "󰐊",
TriangleShortArrowDown = "",
TriangleShortArrowLeft = "",
TriangleShortArrowRight = "",
TriangleShortArrowUp = "",
Neovim = "",
Pending = "",
BlankCircle = "",
CheckCircle = "",
DotCircle = "",
Border = { "", "", "", "", "", "", "", "" },
ProjekFolder = "󱧶",
Bell = "󰂠",
ft = "",
not_loaded = "",
Paint = "",
},
folding = {
vert = "", -- alternatives │
fold = " ",
eob = " ", -- suppress ~ at EndOfBuffer
diff = "", -- alternatives = ⣿ ░ ─
msgsep = "",
foldopen = "",
foldsep = "",
foldclose = "",
plusBox = "󰜄",
plusSircle = "󰐙",
plus = "󰐕",
minusBox = "󰛲",
minusSircle = "󰍷",
minus = "󰍴",
},
diagnostics = {
BoldError = "",
Error = "",
BoldWarning = "",
Warning = "",
BoldInformation = "",
Information = "",
BoldQuestion = "",
Question = "",
BoldHint = "",
Hint = "󰌶",
Debug = "",
Trace = "",
},
misc = {
Robot = "󰚩",
Squirrel = "",
Tag = "",
Watch = "",
Smiley = "",
Package = "",
CircuitBoard = "",
},
}

View file

@ -0,0 +1,47 @@
-- definiskanfunction name
local keymap = vim.api.nvim_set_keymap
local opts = { noremap = true, silent = true }
-- Remap space leader keys
keymap("", "<Space>", "<Nop>", opts)
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- MODES
-- mormal mode = "n"
-- insert mode = "i"
-- visual mode = "v"
-- visual block mode = "x"
-- term mode = "t"
-- command mode = "c"
for _, mode in ipairs({ "i", "v", "n", "x" }) do
-- duplicate line
keymap(mode, "<S-Down>", "<cmd>t.<cr>", opts)
keymap(mode, "<S-Up>", "<cmd>t -1<cr>", opts)
-- save file
keymap(mode, "<C-s>", "<cmd>silent! w<cr>", opts)
end
-- duplicate line visual block
keymap("x", "<S-Down>", ":'<,'>t'><cr>", opts)
keymap("x", "<S-Up>", ":'<,'>t-1<cr>", opts)
-- move text up and down
keymap("x", "<A-Down>", ":move '>+1<CR>gv-gv", opts)
keymap("x", "<A-Up>", ":move '<-2<CR>gv-gv", opts)
keymap("n", "<M-Down>", "<cmd>m+<cr>", opts)
keymap("i", "<M-Down>", "<cmd>m+<cr>", opts)
keymap("n", "<M-Up>", "<cmd>m-2<cr>", opts)
keymap("i", "<M-Up>", "<cmd>m-2<cr>", opts)
-- create comment CTRL + / all mode
keymap("v", "<C-_>", "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", opts)
keymap("v", "<C-/>", "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", opts)
keymap("i", "<C-_>", "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", opts)
keymap("i", "<C-/>", "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", opts)
keymap("i", "<C-_>", "<esc><cmd>lua require('Comment.api').toggle.linewise.current()<cr>", opts)
keymap("i", "<C-/>", "<esc><cmd>lua require('Comment.api').toggle.linewise.current()<cr>", opts)
keymap("n", "<C-_>", "<esc><cmd>lua require('Comment.api').toggle.linewise.current()<cr>", opts)
keymap("n", "<C-/>", "<esc><cmd>lua require('Comment.api').toggle.linewise.current()<cr>", opts)
-- close windows
keymap("n", "q", "<cmd>q<cr>", opts)
keymap("n", "f", "<cmd>NvimTreeFindFileToggle<cr><cr><Up>", opts)

View file

@ -0,0 +1,71 @@
local options = {
backspace = vim.opt.backspace + { "nostop" }, -- Jangan hentikan backspace saat insert
clipboard = "unnamedplus", -- Koneksi ke clipboard sistem
cmdheight = 0, -- Sembunyikan command line kecuali dibutuhkan
completeopt = { "menuone", "noselect" }, -- Opsi untuk penyelesaian mode insert
copyindent = true, -- Salin indentasi sebelumnya pada autoindenting
cursorline = true, -- Sorot baris teks dari kursor
expandtab = true, -- Aktifkan penggunaan spasi di tab
fileencoding = "utf-8", -- Pengkodean konten file untuk buffer
fillchars = { eob = " " }, -- Nonaktifkan `~` pada baris yang tidak ada
history = 100, -- Jumlah perintah yang diingat dalam tabel riwayat
ignorecase = true, -- Pencarian tidak peka huruf besar kecil
laststatus = 3, -- globalstatus
guicursor = "n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175",
lazyredraw = false, -- Layar digambar ulang dengan malas
mouse = "a", -- Aktifkan dukungan mouse
number = true, -- Tampilkan garis nomor
preserveindent = true, -- Pertahankan struktur indentasi sebanyak mungkin
pumheight = 10, -- Tinggi menu pop up
relativenumber = true, -- Tampilkan garis nomor relatif
scrolloff = 8, -- Jumlah baris untuk menjaga di atas dan di bawah kursor
shiftwidth = 2, -- Jumlah spasi yang dimasukkan untuk indentasi
showmode = false, -- Nonaktifkan menampilkan mode di command line
showtabline = 2, -- Selalu tampilkan tabline
sidescrolloff = 8, -- Jumlah kolom untuk menjaga di sisi kursor
signcolumn = "yes", -- Selalu tampilkan kolom tanda
smartcase = true, -- Pencarian peka huruf besar kecil
splitbelow = true, -- Membagi jendela baru di bawah jendela saat ini
splitright = true, -- Membagi jendela baru di kanan jendela saat ini
swapfile = false, -- Nonaktifkan penggunaan swapfile untuk buffer
tabstop = 2, -- Jumlah spasi dalam tab
termguicolors = true, -- Aktifkan warna RGB 24-bit di TUI
timeoutlen = 300, -- Panjang waktu tunggu untuk urutan yang dipetakan
undofile = true, -- Aktifkan undo yang persisten
updatetime = 300, -- Panjang waktu tunggu sebelum memicu plugin
wrap = false, -- Nonaktifkan pembungkusan baris lebih panjang dari lebar jendela
writebackup = false, -- Nonaktifkan membuat cadangan sebelum menimpa file
guifont = "Hasklug Nerd Font:h15", -- font yang digunakan dalam aplikasi neovim grafis
whichwrap = "bs<>[]hl", -- Kunci "horizontal" yang diizinkan untuk berpindah ke baris sebelumnya/selanjutnya
}
for k, v in pairs(options) do
vim.opt[k] = v
end
-- vim.opt.shortmess = "ilmnrx" -- flags to shorten vim messages, see :help 'shortmess'
-- vim.o.winbar = "%{%v:lua.require'nvim-navic'.get_location()%}"
vim.opt.shortmess:append("c") -- don't give |ins-completion-menu| messages
vim.opt.iskeyword:append("-") -- hyphenated words recognized by searches
vim.opt.formatoptions:remove({ "t", "c", "q", "j" })
vim.opt.formatoptions = "croql"
-- vim.opt.formatoptions:remove({ "c", "r", "o" }) -- don't insert the current comment leader automatically for auto-wrapping comments using 'textwidth', hitting <Enter> in insert mode, or hitting 'o' or 'O' in normal mode.
vim.opt.runtimepath:remove("/usr/share/vim/vimfiles") -- separate vim plugins from neovim in case vim still in use
-- config for blink cursor in normal, visual and insert mode
-- vim.opt.guicursor = {
-- "n-v-c:block-Cursor/lCursor-blinkwait1000-blinkon100-blinkoff100",
-- "i-ci:ver25-Cursor/lCursor-blinkwait1000-blinkon100-blinkoff100",
-- "r:hor50-Cursor/lCursor-blinkwait100-blinkon100-blinkoff100",
-- }
vim.loader.enable()
-- Disable statusline in dashboard
vim.api.nvim_create_autocmd("FileType", {
pattern = { "dbout", "dbui", "http", "httpResult" },
callback = function()
local opt = vim.opt
opt.number = false -- Print line number
opt.preserveindent = false -- Preserve indent structure as much as possible
opt.relativenumber = false
end,
})

View file

@ -0,0 +1,8 @@
local status_ok = pcall(require, "luasnip")
if not status_ok then
return
end
local lpath = vim.fn.stdpath("config") .. "/snippets"
require("luasnip.loaders.from_vscode").lazy_load({ paths = lpath })
require("luasnip.loaders.from_vscode").load({ paths = lpath })