mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-08-04 18:04:34 +02:00
Compare commits
384 commits
Author | SHA1 | Date | |
---|---|---|---|
|
76277745b3 | ||
|
20e96da865 | ||
|
3f9b73de6a | ||
|
08d228aa17 | ||
|
3b30870f04 | ||
|
b341ee7246 | ||
|
3f3e84aa49 | ||
|
c29942d4a7 | ||
|
aa2f3a49ef | ||
|
1bdac09f77 | ||
|
4b9382146f | ||
|
6d87fbb90a | ||
|
be2518be72 | ||
|
4baa37dec7 | ||
|
5ae8f516b8 | ||
|
8bc18a0f0c | ||
|
38bf58ad63 | ||
|
64e62e59ba | ||
|
bb6238e749 | ||
|
37aa6dd7a7 | ||
|
5206ccb56e | ||
|
a4e2d9ec21 | ||
|
2ab92b6e94 | ||
|
6d3f3dedad | ||
|
6087de87b0 | ||
|
282733e5ea | ||
|
fa09a7248e | ||
|
1167f053e4 | ||
|
bf0a8b2f9b | ||
|
82392943e2 | ||
|
68cf1f8bc4 | ||
|
339f818e4a | ||
|
7450625ba8 | ||
|
23a8cf07bf | ||
|
c1e9e57f17 | ||
|
dc19ff45d8 | ||
|
5df3f7b2ab | ||
|
82d6ba2889 | ||
|
bf60de3aa1 | ||
|
d31ffccdca | ||
|
d41d9b4cf5 | ||
|
f3761c699a | ||
|
04f3bfc8a3 | ||
|
56982c3434 | ||
|
65b1300677 | ||
|
5b2d06cf97 | ||
|
af0923e403 | ||
|
b727898cf3 | ||
|
69d6dd962d | ||
|
8e0228505a | ||
|
c2fbd57469 | ||
|
5dc5c723b2 | ||
|
2bae787a7d | ||
|
d084330d2f | ||
|
3fb9efd7c9 | ||
|
5e9e520a23 | ||
|
fde1324bf2 | ||
|
9166b0e686 | ||
|
b3f841d25c | ||
|
b4e2e4d000 | ||
|
11a88eb681 | ||
|
c66913e4c2 | ||
|
16264d0b0d | ||
|
3c9cf18933 | ||
|
4af6a3dec6 | ||
|
26cb34e301 | ||
|
353e5a66c7 | ||
|
e0a4367eb0 | ||
|
d186be6aec | ||
|
835b1706b2 | ||
|
0c56a139ec | ||
|
273f3ebcb7 | ||
|
422efe87ce | ||
|
e9e0ca3e88 | ||
|
b3f5ec5619 | ||
|
db41fc7e00 | ||
|
5ab63cdf43 | ||
|
292e79137f | ||
|
17aee6c301 | ||
|
5146726772 | ||
|
35348c069a | ||
|
826cbfe9f8 | ||
|
177cf190df | ||
|
b3d4f8b8a1 | ||
|
5a64a2e380 | ||
|
fe846f291e | ||
|
c21ebc23ef | ||
|
c8d51254d4 | ||
|
b4356bd49a | ||
|
8a5c2dd398 | ||
|
b5f544bc27 | ||
|
541a0dac95 | ||
|
ea602aba6e | ||
|
5200fa75aa | ||
|
3f5a3a6439 | ||
|
8b37a27d59 | ||
|
11875c382d | ||
|
80f8ade2a5 | ||
|
299c94137d | ||
|
16c9fa5a36 | ||
|
0ef35939de | ||
|
e6e7acc2a0 | ||
|
d5da617c07 | ||
|
1a59409085 | ||
|
ef38e66bf9 | ||
|
a3bda6f3a5 | ||
|
c52fc5f1d2 | ||
|
fc0a994282 | ||
|
8467b64cd9 | ||
|
ea15a8e8b8 | ||
|
ba77691fb3 | ||
|
50184acdb4 | ||
|
335c0d0cb6 | ||
|
edd352519e | ||
|
9a5c3d6a5b | ||
|
5f97594d62 | ||
|
9aebda6491 | ||
|
8767818e34 | ||
|
609234c086 | ||
|
68ea712b98 | ||
|
f5e3f130e4 | ||
|
70e40989c9 | ||
|
b75362b066 | ||
|
4bd49ca963 | ||
|
dfe7507f5a | ||
|
54ccd837a9 | ||
|
c8bc3339ea | ||
|
be3648f80d | ||
|
ce4b507ca3 | ||
|
5559c097d9 | ||
|
f9e08dd537 | ||
|
9b20297edc | ||
|
f7dc5afb5b | ||
|
ba028451b6 | ||
|
b8d786072a | ||
|
05d51faadf | ||
|
c09e320633 | ||
|
5f766a5717 | ||
|
e2afd37cae | ||
|
cde110e7bd | ||
|
51f6b3bcd4 | ||
|
27f602e210 | ||
|
ad9f646417 | ||
|
0ee6631931 | ||
|
30ba4f5233 | ||
|
2ce30970f6 | ||
|
cfbb38f75e | ||
|
ceb786c9cc | ||
|
3c34a7ba22 | ||
|
d0194ea92e | ||
|
ec403e8b54 | ||
|
09c5fdd259 | ||
|
aeae04bacf | ||
|
3ddbd80e6a | ||
|
870e0fe28a | ||
|
f488cd1495 | ||
|
ee0092886d | ||
|
4d03c39f7a | ||
|
70185c6de3 | ||
|
2b1a97a9f2 | ||
|
891086f606 | ||
|
82b68e6d01 | ||
|
4894f180e6 | ||
|
245f1b7abb | ||
|
be42c75ded | ||
|
60fa8e90c6 | ||
|
1629caa700 | ||
|
3ac997cc10 | ||
|
72b8b4b531 | ||
|
12ec8d33ef | ||
|
cfea979e6b | ||
|
e76eea2ebb | ||
|
87a44d46db | ||
|
41bc2bce8f | ||
|
f6ec28fbba | ||
|
9762d71c6e | ||
|
ab014bb8b5 | ||
|
0f9e5836be | ||
|
5cf2456f6c | ||
|
9b806d2ed1 | ||
|
224d29c616 | ||
|
52b270121f | ||
|
6143c6a95d | ||
|
bde07f949a | ||
|
38a9984694 | ||
|
a2240b582c | ||
|
f69bcdf155 | ||
|
18f8a746e4 | ||
|
c0eb97fa96 | ||
|
7962b741bd | ||
|
1aa86bfa2d | ||
|
624d3aceb6 | ||
|
d46370f0b3 | ||
|
b6711611ec | ||
|
aa8f68d8aa | ||
|
32b5eba8bb | ||
|
ff62c20795 | ||
|
eace6b6674 | ||
|
03a3d5f32b | ||
|
e7c7785cc5 | ||
|
19abed8ac0 | ||
|
dd872b6ea5 | ||
|
a636b2988d | ||
|
a72df67e8f | ||
|
4f3feb5c38 | ||
|
49478d3a89 | ||
|
fecc32cc9e | ||
|
4ead9b7dd3 | ||
|
e7caa67641 | ||
|
ca6f6ca957 | ||
|
02f4aab215 | ||
|
ef97b8b1bc | ||
|
14284a94ca | ||
|
1d622094b9 | ||
|
ef6ac90acf | ||
|
4ba72487b4 | ||
|
c3d0591394 | ||
|
d4bef2b2d1 | ||
|
aed25e545a | ||
|
4333ed78b4 | ||
|
9662230b4a | ||
|
fbd69d94ec | ||
|
22202bc11b | ||
|
b2404fbb67 | ||
|
d9702eb157 | ||
|
2f2909cfe4 | ||
|
32cf770bbd | ||
|
0d0de22c7b | ||
|
a7ae61e8af | ||
|
b2e2b94344 | ||
|
d2749f48eb | ||
|
f5f74f80e0 | ||
|
2e64635d7e | ||
|
9b41753fd4 | ||
|
14207d8f21 | ||
|
204561a51e | ||
|
530d54d5a6 | ||
|
0adcd0f0aa | ||
|
fa940d994e | ||
|
91ecdb0406 | ||
|
94ff8e53a9 | ||
|
54657657a3 | ||
|
3388bdd1d7 | ||
|
e3ebfb7a5b | ||
|
d3b57e0fa6 | ||
|
1a91af074f | ||
|
e009cbb877 | ||
|
524bfc707b | ||
|
ec8d701b71 | ||
|
d44240f988 | ||
|
21929ee44d | ||
|
6da9ec51d8 | ||
|
fc32c1b69c | ||
|
024214153a | ||
|
522c9db37c | ||
|
73d0838347 | ||
|
a988f497e1 | ||
|
34d23ba464 | ||
|
fe8e5296f9 | ||
|
cf21e5a91a | ||
|
d93425cec0 | ||
|
77b40e7caf | ||
|
55c555afe1 | ||
|
a6f0a973cf | ||
|
70cc034eea | ||
|
c762b2584d | ||
|
5fe2180144 | ||
|
77ec605527 | ||
|
2486c9e49e | ||
|
98a141b4b5 | ||
|
ece7dd2b9f | ||
|
f5adb4bb7d | ||
|
ee86e49f17 | ||
|
9f267f2109 | ||
|
4776d7f0bf | ||
|
d6b019bfb8 | ||
|
83df5f4359 | ||
|
0ce16ab2a3 | ||
|
2d1579c969 | ||
|
4bd718cab7 | ||
|
fbc8a53840 | ||
|
b9949062dc | ||
|
7162f65a13 | ||
|
a3143f9ae0 | ||
|
618b816d52 | ||
|
29a0e20f56 | ||
|
10dfd41f44 | ||
|
ef95246d88 | ||
|
24b3020b5c | ||
|
f7c84d58f8 | ||
|
22fef75144 | ||
|
33fe8d43df | ||
|
39b6c22356 | ||
|
13e2e75069 | ||
|
b28f354786 | ||
|
4392eb6d59 | ||
|
aeeb5ccd1f | ||
|
e9d75bd429 | ||
|
ab36e30b69 | ||
|
66c83b9abb | ||
|
17204ad330 | ||
|
94ef091902 | ||
|
ddfa140e41 | ||
|
cecf29d7db | ||
|
f0f7958de7 | ||
|
e3dcee7c35 | ||
|
174eed8daa | ||
|
d352202bcf | ||
|
a7933afc34 | ||
|
9a3c7cd78b | ||
|
bdd33afd27 | ||
|
ea7e0730c2 | ||
|
826445d655 | ||
|
16723f902e | ||
|
5817798c72 | ||
|
fa07b44ecf | ||
|
af1dd1aa00 | ||
|
35c170c09a | ||
|
178c969312 | ||
|
abb9a69a87 | ||
|
2165fb1c63 | ||
|
66d401335e | ||
|
ebe7697c5e | ||
|
01af4a3a1d | ||
|
b643b04031 | ||
|
f2cd687048 | ||
|
bb58e61e35 | ||
|
68cf0d9468 | ||
|
d8ded80fd4 | ||
|
8374eb0483 | ||
|
7117a875fb | ||
|
63c3f9d088 | ||
|
d9a3cc4dad | ||
|
e072b40f3d | ||
|
db9ed03df2 | ||
|
e2fd81f115 | ||
|
19f44f754d | ||
|
368838347c | ||
|
5bd883a99c | ||
|
489b9491ab | ||
|
66c6917a73 | ||
|
2839d4106b | ||
|
8c91594e60 | ||
|
61b4120e30 | ||
|
e16678fc29 | ||
|
ec3ec5ea1e | ||
|
384c0b5768 | ||
|
65857a4226 | ||
|
ecc54b9f87 | ||
|
cbd0b55458 | ||
|
7482132068 | ||
|
be59c58be4 | ||
|
d44e2d92ae | ||
|
faebd74eff | ||
|
9dbcd4b755 | ||
|
17f2ffe48b | ||
|
75a484306b | ||
|
b5cc229ee8 | ||
|
51bea4df6d | ||
|
ba64a3073c | ||
|
27f4a6016d | ||
|
d1481038d6 | ||
|
8ae7bbb8d2 | ||
|
be18e2df41 | ||
|
3f55a10738 | ||
|
13c5df174c | ||
|
33335939d0 | ||
|
e7cf581b2a | ||
|
27405a0f8a | ||
|
090f4c3d24 | ||
|
c5280b8d08 | ||
|
56e8da9c8e | ||
|
babcd3c9dd | ||
|
a51db2cbc7 | ||
|
73f85d9584 | ||
|
c8798367cc | ||
|
520ae101c6 | ||
|
55432b7b13 | ||
|
bbc23eae04 | ||
|
836ac75161 | ||
|
da416417d8 | ||
|
a0c81f7286 | ||
|
8677303d6d | ||
|
a80dab94b9 |
470 changed files with 9454 additions and 88870 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -0,0 +1 @@
|
|||
db_ui
|
|
@ -3,4 +3,4 @@ line_endings = "Unix"
|
|||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
quote_style = "AutoPreferDouble"
|
||||
no_call_parentheses = true
|
||||
# no_call_parentheses = true
|
||||
|
|
30
README.md
30
README.md
|
@ -67,40 +67,46 @@
|
|||
## Basic Requirement
|
||||
|
||||
2. Install Neovim 0.95+ https://github.com/neovim/neovim/releases/tag/stable
|
||||
3. C++ https://www.msys2.org/
|
||||
4. GIT https://git-scm.com/download/win
|
||||
5. NodeJs https://nodejs.org/en/
|
||||
6. Ripgrep https://github.com/BurntSushi/ripgrep
|
||||
7. Lazygit https://github.com/jesseduffield/lazygit
|
||||
8. Nerd Font https://www.nerdfonts.com/ or https://github.com/ryanoasis/nerd-fonts
|
||||
9. Windows Terminal (Windows) https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701?hl=en-id&gl=id
|
||||
10. Powershell (windows) https://apps.microsoft.com/store/detail/powershell/9MZ1SNWT0N5D?hl=en-id&gl=id
|
||||
1. C++ https://www.msys2.org/
|
||||
1. GIT https://git-scm.com/download/win
|
||||
1. NodeJs https://nodejs.org/en/
|
||||
1. Ripgrep https://github.com/BurntSushi/ripgrep
|
||||
1. Lazygit https://github.com/jesseduffield/lazygit
|
||||
1. Nerd Font https://www.nerdfonts.com/ or https://github.com/ryanoasis/nerd-fonts
|
||||
1. Windows Terminal (Windows) https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701?hl=en-id&gl=id
|
||||
1. Powershell (windows) https://apps.microsoft.com/store/detail/powershell/9MZ1SNWT0N5D?hl=en-id&gl=id
|
||||
|
||||
# Windows
|
||||
|
||||
```
|
||||
git clone https://github.com/pojokcodeid/nvim-lazy-basic.git "$env:LOCALAPPDATA\nvim"
|
||||
git clone https://github.com/pojokcodeid/neovim-starter.git "$env:LOCALAPPDATA\nvim"
|
||||
nvim
|
||||
```
|
||||
|
||||
# Linux
|
||||
|
||||
```bash
|
||||
git clone https://github.com/pojokcodeid/nvim-lazy-basic.git ~/.config/nvim
|
||||
git clone https://github.com/pojokcodeid/neovim-starter.git ~/.config/nvim
|
||||
```
|
||||
|
||||
# Uninstall
|
||||
|
||||
```bash
|
||||
# Linux / Macos (unix)
|
||||
# Linux / MacOS (unix)
|
||||
rm -rf ~/.config/nvim
|
||||
rm -rf ~/.local/state/nvim
|
||||
rm -rf ~/.local/share/nvim
|
||||
|
||||
# Flatpak (linux)
|
||||
rm -rf ~/.var/app/io.neovim.nvim/config/nvim
|
||||
rm -rf ~/.var/app/io.neovim.nvim/data/nvim
|
||||
rm -rf ~/.var/app/io.neovim.nvim/.local/state/nvim
|
||||
|
||||
# Windows CMD
|
||||
rd -r ~\AppData\Local\nvim
|
||||
rd -r ~\AppData\Local\nvim-data
|
||||
|
||||
# Window PowerShell
|
||||
# Windows PowerShell
|
||||
rm -Force ~\AppData\Local\nvim
|
||||
rm -Force ~\AppData\Local\nvim-data
|
||||
```
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
-- local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
|
||||
-- if not lspconfig_status_ok then
|
||||
-- return
|
||||
-- end
|
||||
--
|
||||
-- local status_ok, configs = pcall(require, "nvim-treesitter.configs")
|
||||
-- if not status_ok then
|
||||
-- return
|
||||
-- end
|
||||
--
|
||||
-- local mason_ok, mason_lsp = pcall(require, "mason-lspconfig")
|
||||
-- if not mason_ok then
|
||||
-- return
|
||||
-- end
|
||||
--
|
||||
-- mason_lsp.setup({
|
||||
-- ensure_installed = { "clangd" },
|
||||
-- automatic_installation = true,
|
||||
-- })
|
||||
--
|
||||
-- lspconfig.clangd.setup({
|
||||
-- on_attach = require("user.lsp.handlers").on_attach,
|
||||
-- capabilities = require("user.lsp.handlers").capabilities,
|
||||
-- root_dir = require("lspconfig.util").root_pattern(
|
||||
-- "build",
|
||||
-- "compile_commands.json",
|
||||
-- ".git",
|
||||
-- "mvnw",
|
||||
-- "gradlew",
|
||||
-- "pom.xml",
|
||||
-- "build.gradle"
|
||||
-- ) or vim.loop.cwd() or vim.fn.getcwd(),
|
||||
-- })
|
||||
--
|
||||
-- configs.setup({
|
||||
-- ensure_installed = { "cpp" }, -- pastikan parser TypeScript terinstal
|
||||
-- highlight = {
|
||||
-- enable = true, -- aktifkan highlight berbasis treesitter
|
||||
-- additional_vim_regex_highlighting = false,
|
||||
-- },
|
||||
-- rainbow = {
|
||||
-- enable = false,
|
||||
-- },
|
||||
-- incremental_selection = { enable = true },
|
||||
-- indent = { enable = true, disable = { "python", "css" } },
|
||||
-- autopairs = {
|
||||
-- enable = true,
|
||||
-- },
|
||||
-- })
|
||||
--
|
||||
-- require("nvim-ts-autotag").setup()
|
|
@ -1,7 +0,0 @@
|
|||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
local opt = vim.opt
|
||||
|
||||
opt.shiftwidth = 2 -- Size of an indent
|
||||
opt.tabstop = 2 -- Size of an indent
|
|
@ -1,141 +0,0 @@
|
|||
-- more space in the neovim command line for displaying messages
|
||||
-- use this function notation to build some variables
|
||||
vim.opt_local.shiftwidth = 4
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.softtabstop = 4
|
||||
vim.opt_local.ts = 4
|
||||
vim.opt_local.expandtab = true
|
||||
|
||||
local status, jdtls = pcall(require, "jdtls")
|
||||
if not status then
|
||||
return
|
||||
end
|
||||
|
||||
local function capabilities()
|
||||
local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
if status_ok then
|
||||
return cmp_nvim_lsp.default_capabilities()
|
||||
end
|
||||
|
||||
local CAPABILITIES = vim.lsp.protocol.make_client_capabilities()
|
||||
CAPABILITIES.textDocument.completion.completionItem.snippetSupport = true
|
||||
CAPABILITIES.textDocument.completion.completionItem.resolveSupport = {
|
||||
properties = {
|
||||
"documentation",
|
||||
"detail",
|
||||
"additionalTextEdits",
|
||||
},
|
||||
}
|
||||
|
||||
return CAPABILITIES
|
||||
end
|
||||
|
||||
local function directory_exists(path)
|
||||
local f = io.popen("cd " .. path)
|
||||
local ff = f:read("*all")
|
||||
|
||||
if ff:find("ItemNotFoundException") then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local root_markers = { ".git", "mvnw", "gradlew", "pom.xml", "build.gradle" }
|
||||
local root_dir = require("jdtls.setup").find_root(root_markers)
|
||||
|
||||
-- calculate workspace dir
|
||||
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t")
|
||||
local workspace_dir = vim.fn.stdpath("data") .. "/site/java/workspace-root/" .. project_name
|
||||
if directory_exists(workspace_dir) then
|
||||
else
|
||||
os.execute("mkdir " .. workspace_dir)
|
||||
end
|
||||
-- get the mason install path
|
||||
local install_path = require("mason-registry").get_package("jdtls"):get_install_path()
|
||||
|
||||
-- get the current OS
|
||||
local os
|
||||
if vim.fn.has("macunix") then
|
||||
os = "mac"
|
||||
elseif vim.fn.has("win32") then
|
||||
os = "win"
|
||||
else
|
||||
os = "linux"
|
||||
end
|
||||
|
||||
local bundles = {}
|
||||
local mason_path = vim.fn.glob(vim.fn.stdpath("data") .. "/mason/")
|
||||
vim.list_extend(bundles, vim.split(vim.fn.glob(mason_path .. "packages/java-test/extension/server/*.jar"), "\n"))
|
||||
vim.list_extend(
|
||||
bundles,
|
||||
vim.split(
|
||||
vim.fn.glob(mason_path .. "packages/java-debug-adapter/extension/server/com.microsoft.java.debug.plugin-*.jar"),
|
||||
"\n"
|
||||
)
|
||||
)
|
||||
|
||||
local config = {
|
||||
cmd = {
|
||||
"java",
|
||||
"-Declipse.application=org.eclipse.jdt.ls.core.id1",
|
||||
"-Dosgi.bundles.defaultStartLevel=4",
|
||||
"-Declipse.product=org.eclipse.jdt.ls.core.product",
|
||||
"-Dlog.protocol=true",
|
||||
"-Dlog.level=ALL",
|
||||
"-javaagent:" .. install_path .. "/lombok.jar",
|
||||
"-Xms1g",
|
||||
"--add-modules=ALL-SYSTEM",
|
||||
"--add-opens",
|
||||
"java.base/java.util=ALL-UNNAMED",
|
||||
"--add-opens",
|
||||
"java.base/java.lang=ALL-UNNAMED",
|
||||
"-jar",
|
||||
vim.fn.glob(install_path .. "/plugins/org.eclipse.equinox.launcher_*.jar"),
|
||||
"-configuration",
|
||||
install_path .. "/config_" .. os,
|
||||
"-data",
|
||||
workspace_dir,
|
||||
},
|
||||
capabilities = capabilities(),
|
||||
root_dir = root_dir,
|
||||
settings = {
|
||||
java = {},
|
||||
},
|
||||
|
||||
init_options = {
|
||||
bundles = {
|
||||
vim.fn.glob(
|
||||
mason_path .. "packages/java-debug-adapter/extension/server/com.microsoft.java.debug.plugin-*.jar",
|
||||
"\n"
|
||||
),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
config["on_attach"] = function(client, bufnr)
|
||||
local _, _ = pcall(vim.lsp.codelens.refresh)
|
||||
|
||||
-- valdation if DAP not installed
|
||||
local dap_status, _ = pcall(require, "nvim-dap")
|
||||
if not dap_status then
|
||||
return
|
||||
end
|
||||
|
||||
require("jdtls.dap").setup_dap_main_class_configs()
|
||||
jdtls.setup_dap({ hotcodereplace = "auto" })
|
||||
require("user.lsp.handlers").on_attach(client, bufnr)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
pattern = { "*.java" },
|
||||
callback = function()
|
||||
local _, _ = pcall(vim.lsp.codelens.refresh)
|
||||
end,
|
||||
})
|
||||
|
||||
jdtls.start_or_attach(config)
|
||||
|
||||
vim.cmd(
|
||||
[[command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime(<f-args>)]]
|
||||
)
|
|
@ -1,4 +0,0 @@
|
|||
vim.opt_local.expandtab = true
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.softtabstop = 2
|
|
@ -1,59 +0,0 @@
|
|||
vim.opt_local.expandtab = true
|
||||
vim.opt_local.shiftwidth = 4
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.softtabstop = 4
|
||||
|
||||
-- local status_ok, configs = pcall(require, "nvim-treesitter.configs")
|
||||
-- if not status_ok then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
-- local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
|
||||
-- if not lspconfig_status_ok then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
-- local mason_ok, mason_lsp = pcall(require, "mason-lspconfig")
|
||||
-- if not mason_ok then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
-- mason_lsp.setup({
|
||||
-- ensure_installed = { "kotlin_language_server" },
|
||||
-- automatic_installation = true,
|
||||
-- })
|
||||
|
||||
-- lspconfig.kotlin_language_server.setup({
|
||||
-- on_attach = require("user.lsp.handlers").on_attach,
|
||||
-- capabilities = require("user.lsp.handlers").capabilities,
|
||||
-- cmd = { "kotlin-language-server" },
|
||||
-- filetypes = { "kotlin" },
|
||||
-- root_dir = require("lspconfig.util").root_pattern(
|
||||
-- "build.gradle.kts",
|
||||
-- "build.gradle",
|
||||
-- "settings.gradle",
|
||||
-- "gradlew",
|
||||
-- "pom.xml",
|
||||
-- "build.gradle.kts",
|
||||
-- "build.kts",
|
||||
-- ".git"
|
||||
-- ),
|
||||
-- })
|
||||
|
||||
-- configs.setup({
|
||||
-- ensure_installed = { "kotlin" }, -- pastikan parser TypeScript terinstal
|
||||
-- highlight = {
|
||||
-- enable = true, -- aktifkan highlight berbasis treesitter
|
||||
-- additional_vim_regex_highlighting = false,
|
||||
-- },
|
||||
-- rainbow = {
|
||||
-- enable = false,
|
||||
-- },
|
||||
-- incremental_selection = { enable = true },
|
||||
-- indent = { enable = true, disable = { "python", "css" } },
|
||||
-- autopairs = {
|
||||
-- enable = true,
|
||||
-- },
|
||||
-- })
|
||||
--
|
||||
-- require("nvim-ts-autotag").setup()
|
|
@ -1,4 +0,0 @@
|
|||
vim.opt_local.expandtab = true
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.softtabstop = 2
|
|
@ -1,4 +0,0 @@
|
|||
vim.opt_local.expandtab = true
|
||||
vim.opt_local.shiftwidth = 4
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.softtabstop = 4
|
|
@ -1,109 +0,0 @@
|
|||
local status_ok, configs = pcall(require, "nvim-treesitter.configs")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
configs.setup({
|
||||
ensure_installed = { "typescript", "tsx" }, -- pastikan parser TypeScript terinstal
|
||||
highlight = {
|
||||
enable = true, -- aktifkan highlight berbasis treesitter
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
rainbow = {
|
||||
enable = false,
|
||||
},
|
||||
incremental_selection = { enable = true },
|
||||
indent = { enable = true, disable = { "python", "css" } },
|
||||
autopairs = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
||||
|
||||
require("nvim-ts-autotag").setup()
|
||||
|
||||
-- local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
|
||||
-- if not lspconfig_status_ok then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
-- local function idxOf(array, value)
|
||||
-- for i, v in ipairs(array) do
|
||||
-- if v == value then
|
||||
-- return i
|
||||
-- end
|
||||
-- end
|
||||
-- return nil
|
||||
-- end
|
||||
|
||||
-- local unregis_lsp = {}
|
||||
-- local data_ok, unregis = pcall(require, "core.config")
|
||||
-- if data_ok then
|
||||
-- if unregis.unregister_lsp ~= nil then
|
||||
-- unregis_lsp = unregis.unregister_lsp
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- local idxts = idxOf(unregis_lsp, "tsserver")
|
||||
-- if idxts ~= nil then
|
||||
-- lspconfig.tsserver.setup({
|
||||
-- on_attach = require("user.lsp.handlers").on_attach,
|
||||
-- capabilities = require("user.lsp.handlers").capabilities,
|
||||
-- -- add cmd
|
||||
-- cmd = { "typescript-language-server", "--stdio" },
|
||||
-- -- add file type support
|
||||
-- filetypes = {
|
||||
-- "javascript",
|
||||
-- "javascriptreact",
|
||||
-- "javascript.jsx",
|
||||
-- "typescript",
|
||||
-- "typescriptreact",
|
||||
-- "typescript.tsx",
|
||||
-- },
|
||||
-- -- add dynamic root dir support
|
||||
-- root_dir = require("lspconfig.util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
|
||||
-- init_options = {
|
||||
-- hostInfo = "neovim",
|
||||
-- },
|
||||
-- })
|
||||
-- end
|
||||
|
||||
-- local idxemmet = idxOf(unregis_lsp, "emmet_ls")
|
||||
-- if idxemmet ~= nil then
|
||||
-- lspconfig.emmet_ls.setup({
|
||||
-- on_attach = require("user.lsp.handlers").on_attach,
|
||||
-- capabilities = require("user.lsp.handlers").capabilities,
|
||||
-- -- add cmd
|
||||
-- cmd = { "emmet-ls", "-c", "--stdio" },
|
||||
-- -- add file type support
|
||||
-- filetypes = {
|
||||
-- "javascript",
|
||||
-- "javascriptreact",
|
||||
-- "javascript.jsx",
|
||||
-- "typescript",
|
||||
-- "typescriptreact",
|
||||
-- "typescript.tsx",
|
||||
-- },
|
||||
-- -- add dynamic root dir support
|
||||
-- root_dir = require("lspconfig.util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
|
||||
-- })
|
||||
-- end
|
||||
|
||||
-- local idxeslint = idxOf(unregis_lsp, "eslint")
|
||||
-- if idxeslint ~= nil then
|
||||
-- lspconfig.eslint.setup({
|
||||
-- on_attach = require("user.lsp.handlers").on_attach,
|
||||
-- capabilities = require("user.lsp.handlers").capabilities,
|
||||
-- -- add cmd
|
||||
-- cmd = { "vscode-eslint-language-server", "--stdio" }, -- add file type support
|
||||
-- filetypes = {
|
||||
-- "javascript",
|
||||
-- "javascriptreact",
|
||||
-- "javascript.jsx",
|
||||
-- "typescript",
|
||||
-- "typescriptreact",
|
||||
-- "typescript.tsx",
|
||||
-- },
|
||||
-- -- add dynamic root dir support
|
||||
-- root_dir = require("lspconfig.util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
|
||||
-- })
|
||||
-- end
|
6
init.lua
6
init.lua
|
@ -6,9 +6,9 @@ if vim.g.vscode then
|
|||
VSCodeNotify = vim.fn.VSCodeNotify
|
||||
VSCodeCall = vim.fn.VSCodeCall
|
||||
|
||||
require "vscode.functions"
|
||||
require "vscode.mappings"
|
||||
require("_vscode.functions")
|
||||
require("_vscode.mappings")
|
||||
else
|
||||
-- config neovim
|
||||
require "core"
|
||||
require("pcode.core")
|
||||
end
|
||||
|
|
106
lazy-lock.json
106
lazy-lock.json
|
@ -1,54 +1,58 @@
|
|||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" },
|
||||
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "99337f63f0a3c3ab9519f3d1da7618ca4f91cffe" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "2b3cbcdd980cae1e022409289245053f62fb50f6" },
|
||||
"auto-bufferline.nvim": { "branch": "main", "commit": "6a69520dcb0dc615df3cf972f69027aae3f75c3e" },
|
||||
"auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" },
|
||||
"auto-lint.nvim": { "branch": "main", "commit": "aff13cb8eaa055e66e940d43b7d83166397e5413" },
|
||||
"auto-lsp.nvim": { "branch": "main", "commit": "f32c94fff2862c313f4e150eb39dd0dc9bf18755" },
|
||||
"auto-lualine.nvim": { "branch": "main", "commit": "201da916411a56d0b27905528a7cb49a320ee054" },
|
||||
"breadcrumbs.nvim": { "branch": "master", "commit": "9f764278784ce2f10dbe2f555ba14be2451d36a0" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
||||
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"code_runner.nvim": { "branch": "main", "commit": "6c5bfe44a6c7523350cd706e6b3b8101166eed99" },
|
||||
"darcula-dark.nvim": { "branch": "main", "commit": "cce636860dc5151b6980a35dd378f54a238e0f0e" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "572314728cb1ce012e825fd66331f52c94acac12" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "d0610077b6129cf9f7f78afbe3a1425d60f6e2f1" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "76927d14d3fbd4ba06ccb5246e79d93b5442c188" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "b0ba3f9399bf48c86abaa4db1a40bd0b681d5018" },
|
||||
"lsp-progress.nvim": { "branch": "main", "commit": "55a04895ea20c365b670051a3128265d43bdfa3d" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" },
|
||||
"mason-null-ls.nvim": { "branch": "main", "commit": "2b8433f76598397fcc97318d410e0c4f7a4bea6a" },
|
||||
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
|
||||
"neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" },
|
||||
"noice.nvim": { "branch": "main", "commit": "69c6ad5c1f1c0777125d0275f9871d8609cb0521" },
|
||||
"none-ls-extras.nvim": { "branch": "main", "commit": "336e84b9e43c0effb735b08798ffac382920053b" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "f5b960a73418249aebcdae3455de320360509253" },
|
||||
"nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "0b8165cf95806bc4bb8f745bb0c92021b2ed4b98" },
|
||||
"nvim-material-icon": { "branch": "main", "commit": "7a8893417c6947925d00946d16b81b56574796a9" },
|
||||
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
|
||||
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
|
||||
"nvim-scrollview": { "branch": "main", "commit": "c29c5f69d37040a1fac88cbea7f5e6f06f0aff4d" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "2bc725a3ebc23f0172fb0ab4d1134b81bcc13812" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "a80fe081b4c5890980561e0de2458f64aaffbfc7" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "fd41b7ccc5490a3a99c734d1ee418b68d06c48a9" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "6eb4120a1aadef07ac312f1c4bc6456712220007" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" },
|
||||
"playground": { "branch": "master", "commit": "bcfab84f98a33f2ad34dda6c842046dca70aabf6" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
|
||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "12b1a1e095d968887a17ef791c2edb78d7595d46" },
|
||||
"smart-splits.nvim": { "branch": "master", "commit": "2179ec0d26aacd4f40c766c79f6ebc83b7001e48" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "dfa230be84a044e7f546a6c2b0a403c739732b86" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "fee58a0473fd92b28c34f8f724e4918b15ba30a3" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
|
||||
"vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" },
|
||||
"vim-visual-multi": { "branch": "master", "commit": "b84a6d42c1c10678928b0bf8327f378c8bc8af5a" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "4b7167f8fb2dba3d01980735e3509e172c024c29" },
|
||||
"yanky.nvim": { "branch": "main", "commit": "9268018e92d02650a94e39dd5f5903c542f7ea11" }
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"cmp-rg": { "branch": "master", "commit": "70a43543f61b6083ba9c3b7deb9ccee671410ac6" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"code_runner.nvim": { "branch": "main", "commit": "65c8d11f507073b915f10faa88ea05bd4fbf69ce" },
|
||||
"colorful-menu.nvim": { "branch": "master", "commit": "bc3e82609f2fcf7dad7ca87c20e65e51d5d9d87c" },
|
||||
"conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" },
|
||||
"dracula.nvim": { "branch": "main", "commit": "96c9d19ce81b26053055ad6f688277d655b3f7d2" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "8270378ab83540b03d09c0194ba3e208f9d0cb72" },
|
||||
"hlchunk.nvim": { "branch": "main", "commit": "474ec5d0f220158afa83aaefab32402e710d3032" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lsp_signature.nvim": { "branch": "master", "commit": "62cadce83aaceed677ffe7a2d6a57141af7131ea" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "844d247d998c2f9a6a3baad8bb9748edc55ce69f" },
|
||||
"mason.nvim": { "branch": "main", "commit": "9e25c98d4826998460926f8c5c2284848d80ae89" },
|
||||
"multiple-cursors.nvim": { "branch": "main", "commit": "1ac15d047a4b265cc2389957bcc56ee561b29e02" },
|
||||
"neocodeium": { "branch": "main", "commit": "272aed226827d8dadb85b4d9e2c9bb6bd30b4033" },
|
||||
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||
"nvim-lint": { "branch": "master", "commit": "7ef127aaede2a4d5ad8df8321e2eb4e567f29594" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "d0dbf489a8810672fa9a61f4a86e5cf89214b772" },
|
||||
"nvim-material-icon": { "branch": "main", "commit": "c25a4e56be2f846dfdf8f30b980adc17f219d019" },
|
||||
"nvim-navic": { "branch": "master", "commit": "f887d794a0f4594882814d7780980a949200a238" },
|
||||
"nvim-notify": { "branch": "master", "commit": "397c7c1184745fca649e5104de659e6392ef5a4d" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "65bae449224b8a3bc149471b96587b23b13a9946" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "3362099de3368aa620a8105b19ed04c2053e38c0" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "97bf4b8ef9298644a29fcd9dd41a0210cf08cac7" },
|
||||
"showkeys": { "branch": "main", "commit": "cb0a50296f11f1e585acffba8c253b9e8afc1f84" },
|
||||
"smart-splits.nvim": { "branch": "master", "commit": "f46b79cf9e83b0a13a4e3f83e3bd5b0d2f172bf2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" },
|
||||
"virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" },
|
||||
"yanky.nvim": { "branch": "main", "commit": "04775cc6e10ef038c397c407bc17f00a2f52b378" }
|
||||
}
|
265
lua/_vscode/functions.lua
Normal file
265
lua/_vscode/functions.lua
Normal file
|
@ -0,0 +1,265 @@
|
|||
function Active_whichkey()
|
||||
VSCodeNotify("whichkey.show")
|
||||
end
|
||||
|
||||
function Top_screen()
|
||||
Cmd("call <SNR>3_reveal('top', 0)")
|
||||
end
|
||||
|
||||
function Bottom_screen()
|
||||
Cmd("call <SNR>3_reveal('bottom', 0)")
|
||||
end
|
||||
|
||||
function Move_to_top_screen()
|
||||
Cmd("call <SNR>3_moveCursor('top')")
|
||||
end
|
||||
|
||||
function Move_to_bottom_screen()
|
||||
Cmd("call <SNR>3_moveCursor('bottom')")
|
||||
end
|
||||
|
||||
function Scroll_line_down()
|
||||
VSCodeCall("scrollLineDown")
|
||||
end
|
||||
|
||||
function Scroll_line_up()
|
||||
VSCodeCall("scrollLineUp")
|
||||
end
|
||||
|
||||
function Vscode_ctrl_d()
|
||||
VSCodeNotify("vscode-neovim.ctrl-d")
|
||||
end
|
||||
|
||||
function Vscode_ctrl_u()
|
||||
VSCodeNotify("vscode-neovim.ctrl-u")
|
||||
end
|
||||
|
||||
function Move_to_bottom_screen__center_screen()
|
||||
Move_to_bottom_screen()
|
||||
Center_screen()
|
||||
end
|
||||
|
||||
function Move_to_top_screen__center_screen()
|
||||
Move_to_top_screen()
|
||||
Center_screen()
|
||||
end
|
||||
|
||||
function Trim_trailing_whitespace()
|
||||
VSCodeCall("editor.action.trimTrailingWhitespace")
|
||||
end
|
||||
|
||||
function Save()
|
||||
VSCodeCall("workbench.action.files.save")
|
||||
end
|
||||
|
||||
function Save_no_format()
|
||||
VSCodeCall("workbench.action.files.saveWithoutFormatting")
|
||||
end
|
||||
|
||||
function Trim__save__no_format()
|
||||
Trim_trailing_whitespace()
|
||||
Save_no_format()
|
||||
end
|
||||
|
||||
function Trim__save__no_highlight()
|
||||
Trim_trailing_whitespace()
|
||||
Save()
|
||||
Remove_highlighting()
|
||||
end
|
||||
|
||||
function Format()
|
||||
VSCodeCall("editor.action.formatDocument")
|
||||
print("formatted!")
|
||||
end
|
||||
|
||||
function Trim__save__format()
|
||||
Trim_trailing_whitespace()
|
||||
Format()
|
||||
Save()
|
||||
end
|
||||
|
||||
function Reveal_definition_aside()
|
||||
VSCodeNotify("editor.action.revealDefinitionAside")
|
||||
end
|
||||
|
||||
function Go_to_implementation()
|
||||
VSCodeNotify("editor.action.goToImplementation")
|
||||
end
|
||||
|
||||
function Go_to_reference()
|
||||
VSCodeNotify("editor.action.goToReferences")
|
||||
end
|
||||
|
||||
function Rename_symbol()
|
||||
VSCodeNotify("editor.action.rename")
|
||||
end
|
||||
|
||||
function Outdent()
|
||||
---@diagnostic disable-next-line: unused-local
|
||||
for i = 1, vim.v.count1 do
|
||||
VSCodeNotify("editor.action.outdentLines")
|
||||
end
|
||||
end
|
||||
|
||||
function Indent()
|
||||
---@diagnostic disable-next-line: unused-local
|
||||
for i = 1, vim.v.count1 do
|
||||
VSCodeNotify("editor.action.indentLines")
|
||||
end
|
||||
end
|
||||
|
||||
function Outdent_vis()
|
||||
VSCodeNotify("editor.action.outdentLines", false)
|
||||
end
|
||||
|
||||
function Indent_vis()
|
||||
VSCodeNotify("editor.action.indentLines", false)
|
||||
end
|
||||
|
||||
function Comment()
|
||||
VSCodeNotify("editor.action.commentLine")
|
||||
end
|
||||
|
||||
function Convert_to_spaces()
|
||||
VSCodeNotify("editor.action.indentationToSpaces")
|
||||
end
|
||||
|
||||
function Convert_to_tabs()
|
||||
VSCodeNotify("editor.action.indentationToTabs")
|
||||
end
|
||||
|
||||
function Indent_with_spaces()
|
||||
VSCodeNotify("editor.action.indentUsingSpaces")
|
||||
end
|
||||
|
||||
function Indent_with_tabs()
|
||||
VSCodeNotify("editor.action.indentUsingTabs")
|
||||
end
|
||||
|
||||
function CloseEditor()
|
||||
VSCodeNotify("workbench.action.closeActiveEditor")
|
||||
end
|
||||
|
||||
function UndoCloseEditor()
|
||||
VSCodeNotify("workbench.action.reopenClosedEditor")
|
||||
end
|
||||
|
||||
function Git_stage_file()
|
||||
Trim_trailing_whitespace()
|
||||
Save()
|
||||
VSCodeNotify("git.stage")
|
||||
end
|
||||
|
||||
function Git_unstage_file()
|
||||
Save()
|
||||
VSCodeNotify("git.unstage")
|
||||
end
|
||||
|
||||
function Git_revert_change()
|
||||
VSCodeNotify("git.revertSelectedRanges")
|
||||
end
|
||||
|
||||
function Git_stage_change()
|
||||
VSCodeNotify("git.stageSelectedRanges")
|
||||
end
|
||||
|
||||
function Git_unstage_change()
|
||||
VSCodeNotify("git.unstageSelectedRanges")
|
||||
end
|
||||
|
||||
function Git_open_changes()
|
||||
VSCodeNotify("git.openChange")
|
||||
end
|
||||
|
||||
function Git_open_all_changes()
|
||||
VSCodeNotify("git.openAllChanges")
|
||||
end
|
||||
|
||||
function Accept_merge_both()
|
||||
VSCodeNotify("merge-conflict.accept.both")
|
||||
end
|
||||
|
||||
function Accept_merge_all_both()
|
||||
VSCodeNotify("merge-conflict.accept.all-both")
|
||||
end
|
||||
|
||||
function Accept_merge_current()
|
||||
VSCodeNotify("merge-conflict.accept.current")
|
||||
end
|
||||
|
||||
function Accept_merge_all_current()
|
||||
VSCodeNotify("merge-conflict.accept.all-current")
|
||||
end
|
||||
|
||||
function Accept_merge_incoming()
|
||||
VSCodeNotify("merge-conflict.accept.incoming")
|
||||
end
|
||||
|
||||
function Accept_merge_all_incoming()
|
||||
VSCodeNotify("merge-conflict.accept.all-incoming")
|
||||
end
|
||||
|
||||
function Accept_merge_selection()
|
||||
VSCodeNotify("merge-conflict.accept.selection")
|
||||
end
|
||||
|
||||
function Codesnap()
|
||||
VSCodeNotify("codesnap.start", true)
|
||||
end
|
||||
|
||||
function Comment_vis()
|
||||
VSCodeNotify("editor.action.commentLine", false)
|
||||
end
|
||||
|
||||
function Toggle_breakpoint()
|
||||
VSCodeNotify("editor.debug.action.toggleBreakpoint")
|
||||
end
|
||||
|
||||
function Copy_path()
|
||||
VSCodeNotify("copyFilePath")
|
||||
end
|
||||
|
||||
function Copy_relative_path()
|
||||
VSCodeNotify("copyRelativeFilePath")
|
||||
end
|
||||
|
||||
function Active_whichkey()
|
||||
VSCodeNotify("whichkey.show")
|
||||
end
|
||||
|
||||
function Navigation_down()
|
||||
VSCodeNotify("workbench.action.navigateDown")
|
||||
end
|
||||
|
||||
function Navigation_up()
|
||||
VSCodeNotify("workbench.action.navigateUp")
|
||||
end
|
||||
|
||||
function Navigation_left()
|
||||
VSCodeNotify("workbench.action.navigateLeft")
|
||||
end
|
||||
|
||||
function Navigation_right()
|
||||
VSCodeNotify("workbench.action.navigateRight")
|
||||
end
|
||||
|
||||
function Select_all()
|
||||
VSCodeNotify("editor.action.selectAll")
|
||||
end
|
||||
|
||||
function Copy_clipboard()
|
||||
VSCodeNotify("editor.action.clipboardCopyAction")
|
||||
end
|
||||
|
||||
function Paste_clipboard()
|
||||
VSCodeNotify("editor.action.clipboardPasteAction")
|
||||
end
|
||||
|
||||
function Save()
|
||||
VSCodeNotify("workbench.action.files.save")
|
||||
VSCodeNotify("workbench.action.files.saveAll")
|
||||
end
|
||||
|
||||
function Close()
|
||||
VSCodeNotify("workbench.action.closeActiveEditor")
|
||||
end
|
|
@ -31,9 +31,11 @@ Map("n", "zy", Toggle_breakpoint)
|
|||
Map("n", "yr", Copy_relative_path)
|
||||
Map("n", "yR", Copy_path)
|
||||
Map({ "n", "i", "v", "x" }, "<C-a>", Select_all)
|
||||
Map({ "n", "v", "x" }, "y", Copy_clipboard)
|
||||
Map({ "n", "v", "x" }, "p", Paste_clipboard)
|
||||
Map({ "n", "v", "x" }, "<C-s>", Save)
|
||||
Map({ "n", "v", "x", "i" }, "y", Copy_clipboard)
|
||||
Map({ "n", "v", "x", "i" }, "<C-c>", Copy_clipboard)
|
||||
Map({ "n", "v", "x", "i" }, "p", Paste_clipboard)
|
||||
Map({ "n", "v", "x", "i" }, "<C-v>", Paste_clipboard)
|
||||
Map({ "n", "v", "x", "i" }, "<C-s>", Save)
|
||||
Map({ "n" }, "q", Close)
|
||||
|
||||
Map("v", "gs", Codesnap)
|
76
lua/auto-jdtls2/create_gradle_project.lua
Normal file
76
lua/auto-jdtls2/create_gradle_project.lua
Normal file
|
@ -0,0 +1,76 @@
|
|||
local function gradle_new_project()
|
||||
local function create_notif(message, level)
|
||||
local notif_ok, notify = pcall(require, "notify")
|
||||
if notif_ok then
|
||||
notify(message, level)
|
||||
else
|
||||
print(message)
|
||||
end
|
||||
end
|
||||
|
||||
-- Fungsi untuk meminta input dari pengguna dengan opsi untuk membatalkan
|
||||
local function get_user_input(prompt, default_value)
|
||||
vim.fn.inputsave()
|
||||
local result = vim.fn.input(prompt, default_value)
|
||||
vim.fn.inputrestore()
|
||||
|
||||
-- Cek apakah pengguna menekan Esc untuk membatalkan input
|
||||
if result == "" then
|
||||
create_notif("Input canceled.", "info")
|
||||
return nil, true
|
||||
end
|
||||
|
||||
return result, false
|
||||
end
|
||||
-- Ambil input Testing
|
||||
local test, canceled_test = get_user_input("Testing (junit,junit-jupiter,testng,spock): ", "junit-jupiter")
|
||||
if canceled_test then
|
||||
return
|
||||
end
|
||||
-- Ambil input DSL
|
||||
local script_dsl, canceled_dsl = get_user_input("Script DSL (kotlin, groovy): ", "groovy")
|
||||
if canceled_dsl then
|
||||
return
|
||||
end
|
||||
-- Ambil input package name
|
||||
local package_name, canceled_package = get_user_input("Enter package name: ", "com.example")
|
||||
if canceled_package then
|
||||
return
|
||||
end
|
||||
|
||||
-- Format perintah Gradle berdasarkan input pengguna
|
||||
local command = string.format(
|
||||
"echo no | gradle init --type java-application --test-framework %s --dsl %s --package %s --no-daemon",
|
||||
test,
|
||||
script_dsl,
|
||||
package_name
|
||||
)
|
||||
|
||||
-- Fungsi untuk menjalankan perintah Gradle dan menampilkan outputnya
|
||||
local function run_gradle_command(cmd, path, pkg)
|
||||
local output = vim.fn.system(cmd)
|
||||
if vim.v.shell_error ~= 0 then
|
||||
create_notif("Error executing: " .. output, "error")
|
||||
else
|
||||
create_notif("Project created successfully!", "info")
|
||||
create_notif("Please Reopen Dir : " .. path, "info")
|
||||
vim.cmd(":NvimTreeFindFileToggle<CR>")
|
||||
local main_class_path = string.format("%s/app/src/main/java/%s/App.java", path, pkg:gsub("%.", "/"))
|
||||
if vim.fn.filereadable(main_class_path) == 1 then
|
||||
vim.cmd(":edit " .. main_class_path)
|
||||
end
|
||||
local function delayed_quit()
|
||||
vim.defer_fn(function()
|
||||
vim.cmd("qa!")
|
||||
end, 4000) -- Delay is set in milliseconds (3,000ms = 3 seconds)
|
||||
end
|
||||
-- Run the delayed quit function
|
||||
delayed_quit()
|
||||
end
|
||||
end
|
||||
|
||||
-- Jalankan perintah Gradle dan buka proyek
|
||||
run_gradle_command(command, vim.fn.getcwd(), package_name)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("GradleNewProject", gradle_new_project, {})
|
123
lua/auto-jdtls2/create_maven_project.lua
Normal file
123
lua/auto-jdtls2/create_maven_project.lua
Normal file
|
@ -0,0 +1,123 @@
|
|||
local function mvn_new_project()
|
||||
local function create_notif(message, level)
|
||||
local notif_ok, notify = pcall(require, "notify")
|
||||
if notif_ok then
|
||||
notify(message, level)
|
||||
else
|
||||
print(message)
|
||||
end
|
||||
end
|
||||
-- Fungsi untuk meminta input dari pengguna dengan opsi untuk membatalkan
|
||||
local function get_user_input(prompt, default_value)
|
||||
vim.fn.inputsave()
|
||||
local result = vim.fn.input(prompt, default_value)
|
||||
vim.fn.inputrestore()
|
||||
|
||||
-- Cek apakah pengguna menekan Esc untuk membatalkan input
|
||||
if result == "" then
|
||||
create_notif("Input canceled.", "info")
|
||||
return nil, true
|
||||
end
|
||||
|
||||
return result, false
|
||||
end
|
||||
-- Ambil input dari pengguna untuk menentukan direktori proyek
|
||||
local project_dir, canceled = get_user_input("Enter project directory: ", vim.fn.getcwd())
|
||||
if canceled then
|
||||
return
|
||||
end
|
||||
-- Buat direktori jika belum ada
|
||||
if vim.fn.isdirectory(project_dir) == 0 then
|
||||
if vim.fn.mkdir(project_dir, "p") == 0 then
|
||||
create_notif("Failed to create project directory: " .. project_dir, "error")
|
||||
return
|
||||
end
|
||||
end
|
||||
-- Pindah ke direktori proyek
|
||||
-- Hapus satu level dari path
|
||||
local parent_dir = vim.fn.fnamemodify(project_dir, ":h")
|
||||
local success, err = pcall(vim.fn.chdir, parent_dir)
|
||||
if not success then
|
||||
create_notif("Error changing directory: " .. err, "error")
|
||||
return
|
||||
end
|
||||
|
||||
create_notif("Changed directory to: " .. project_dir, "info")
|
||||
-- Fungsi untuk mendapatkan nama direktori terakhir dari path
|
||||
local function getLastDirName(path)
|
||||
local uname = vim.loop.os_uname().sysname
|
||||
local name
|
||||
if uname == "Windows_NT" then
|
||||
name = path:match("([^\\]+)$")
|
||||
else
|
||||
name = path:match("([^/]+)$")
|
||||
end
|
||||
return name
|
||||
end
|
||||
-- Ambil input dari pengguna untuk Maven
|
||||
local group_id, canceled_group = get_user_input("Enter groupId: ", "com.example")
|
||||
if canceled_group then
|
||||
return
|
||||
end
|
||||
local artifact_id = getLastDirName(project_dir)
|
||||
local archetype_artifact_id, canceled_archetype =
|
||||
get_user_input("Enter archetypeArtifactId: ", "maven-archetype-quickstart")
|
||||
if canceled_archetype then
|
||||
return
|
||||
end
|
||||
local archetype_version, canceled_version = get_user_input("Enter archetypeVersion: ", "1.5")
|
||||
if canceled_version then
|
||||
return
|
||||
end
|
||||
local interactive_mode, canceled_interactive = get_user_input("Enter interactiveMode (true/false): ", "false")
|
||||
if canceled_interactive then
|
||||
return
|
||||
end
|
||||
-- Format perintah Maven berdasarkan input pengguna
|
||||
local command = string.format(
|
||||
[[mvn archetype:generate "-DgroupId=%s" "-DartifactId=%s" "-DarchetypeArtifactId=%s" "-DarchetypeVersion=%s" "-DinteractiveMode=%s"]],
|
||||
group_id,
|
||||
artifact_id,
|
||||
archetype_artifact_id,
|
||||
archetype_version,
|
||||
interactive_mode
|
||||
)
|
||||
|
||||
-- Fungsi untuk menjalankan perintah Maven dan menampilkan outputnya
|
||||
local function run_maven_command(cmd, project_name)
|
||||
local output = vim.fn.system(cmd)
|
||||
if vim.v.shell_error ~= 0 then
|
||||
print("Erro ao executar: " .. output)
|
||||
else
|
||||
local ch_dir = string.format("cd %s", project_name)
|
||||
vim.fn.system(ch_dir)
|
||||
vim.fn.chdir(project_name)
|
||||
-- Cari dan buka file main class
|
||||
local uname = vim.loop.os_uname().sysname
|
||||
if uname == "Windows_NT" then
|
||||
if group_id then
|
||||
group_id = group_id:gsub("%.", "\\")
|
||||
local main_class_path = string.format("src\\main\\java\\%s\\App.java", group_id)
|
||||
if vim.fn.filereadable(main_class_path) == 1 then
|
||||
vim.cmd(":edit " .. main_class_path)
|
||||
end
|
||||
end
|
||||
else
|
||||
if group_id then
|
||||
group_id = group_id:gsub("%.", "/")
|
||||
local main_class_path = string.format("src/main/java/%s/App.java", group_id)
|
||||
if vim.fn.filereadable(main_class_path) == 1 then
|
||||
vim.cmd(":edit " .. main_class_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.cmd(":NvimTreeFindFileToggl<CR>")
|
||||
end
|
||||
end
|
||||
|
||||
-- Jalankan perintah Maven dan buka proyek
|
||||
run_maven_command(command, artifact_id)
|
||||
create_notif("Project created successfully !", "info")
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("MavenNewProject", mvn_new_project, {})
|
289
lua/auto-jdtls2/create_springboot_project.lua
Normal file
289
lua/auto-jdtls2/create_springboot_project.lua
Normal file
|
@ -0,0 +1,289 @@
|
|||
local function create_notif(message, level)
|
||||
local notif_ok, notify = pcall(require, "notify")
|
||||
if notif_ok then
|
||||
notify(message, level)
|
||||
else
|
||||
print(message)
|
||||
end
|
||||
end
|
||||
|
||||
local function safe_request(url)
|
||||
local status, request = pcall(function()
|
||||
return vim.system({ "curl", "-s", url }, { text = true }):wait()
|
||||
end)
|
||||
|
||||
if not status then
|
||||
vim.api.nvim_err_writeln("Error making request to " .. url .. ": " .. request)
|
||||
return nil
|
||||
end
|
||||
|
||||
return request
|
||||
end
|
||||
|
||||
local function safe_json_decode(data)
|
||||
local status, decoded = pcall(vim.fn.json_decode, data)
|
||||
|
||||
if not status then
|
||||
vim.api.nvim_err_writeln("Error decoding JSON: " .. decoded)
|
||||
return nil
|
||||
end
|
||||
|
||||
return decoded
|
||||
end
|
||||
|
||||
local function contains(list, element)
|
||||
for _, value in pairs(list) do
|
||||
if value == element then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function list_to_string(list, is_err)
|
||||
local result = ""
|
||||
|
||||
for i, value in ipairs(list) do
|
||||
if is_err then
|
||||
result = result .. "'" .. tostring(value) .. "'"
|
||||
else
|
||||
result = result .. tostring(value)
|
||||
end
|
||||
if i < #list then
|
||||
if is_err then
|
||||
result = result .. " or "
|
||||
else
|
||||
result = result .. "/"
|
||||
end
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
local function handle_start_springboot_data(data)
|
||||
local spring_data = {}
|
||||
for _, value in pairs(data.values) do
|
||||
table.insert(spring_data, value.id)
|
||||
end
|
||||
return spring_data
|
||||
end
|
||||
|
||||
local function change_directory()
|
||||
-- Fungsi untuk meminta input dari pengguna dengan opsi untuk membatalkan
|
||||
local function get_user_input(prompt, default_value)
|
||||
vim.fn.inputsave()
|
||||
local result = vim.fn.input(prompt, default_value)
|
||||
vim.fn.inputrestore()
|
||||
|
||||
-- Cek apakah pengguna menekan Esc untuk membatalkan input
|
||||
if result == "" then
|
||||
create_notif("Input canceled.", "info")
|
||||
return nil, true
|
||||
end
|
||||
|
||||
return result, false
|
||||
end
|
||||
|
||||
-- Ambil input dari pengguna untuk menentukan direktori proyek
|
||||
local project_dir, canceled = get_user_input("Enter project directory: ", vim.fn.getcwd())
|
||||
if canceled then
|
||||
return
|
||||
end
|
||||
-- Buat direktori jika belum ada
|
||||
if vim.fn.isdirectory(project_dir) == 0 then
|
||||
if vim.fn.mkdir(project_dir, "p") == 0 then
|
||||
create_notif("Failed to create project directory: " .. project_dir, "error")
|
||||
return
|
||||
end
|
||||
end
|
||||
-- Pindah ke direktori proyek
|
||||
local success, err = pcall(vim.fn.chdir, project_dir)
|
||||
if not success then
|
||||
create_notif("Error changing directory: " .. err, "error")
|
||||
return
|
||||
end
|
||||
|
||||
create_notif("Changed directory to: " .. project_dir, "info")
|
||||
return project_dir
|
||||
end
|
||||
|
||||
local function get_build_type(data_available)
|
||||
local build_type_available = list_to_string(data_available, false)
|
||||
local options_err = list_to_string(data_available, true)
|
||||
local build_type = vim.fn.input("Enter build type (" .. build_type_available .. "): ", "maven")
|
||||
if not contains(data_available, build_type) then
|
||||
create_notif("Invalid build type. Please enter " .. options_err .. ".", "info")
|
||||
return ""
|
||||
end
|
||||
|
||||
return build_type
|
||||
end
|
||||
|
||||
local function get_language(data_available)
|
||||
local language_available = list_to_string(data_available, false)
|
||||
local options_err = list_to_string(data_available, true)
|
||||
|
||||
local language = vim.fn.input("Enter Language (" .. language_available .. "): ", "java")
|
||||
if not contains(data_available, language) then
|
||||
create_notif("Invalid language. Please enter " .. options_err .. ".", "info")
|
||||
return ""
|
||||
end
|
||||
|
||||
return language
|
||||
end
|
||||
|
||||
local function get_java_version(data_available)
|
||||
local version_available = list_to_string(data_available, false)
|
||||
local options_err = list_to_string(data_available, true)
|
||||
|
||||
local java_version = vim.fn.input("Enter Java Version (" .. version_available .. "): ", "21")
|
||||
if not contains(data_available, java_version) then
|
||||
create_notif("Invalid Java version. Please enter a valid version " .. options_err .. ".", "info")
|
||||
return ""
|
||||
end
|
||||
|
||||
return java_version
|
||||
end
|
||||
|
||||
local function get_boot_version(data_available)
|
||||
local version_available = list_to_string(data_available, false)
|
||||
local options_err = list_to_string(data_available, true)
|
||||
|
||||
local versions_table = {}
|
||||
for v in string.gmatch(version_available, "([^/]+)") do
|
||||
table.insert(versions_table, "-> " .. v)
|
||||
end
|
||||
local annotated_versions = table.concat(versions_table, "\n")
|
||||
local boot_version = vim.fn.input(annotated_versions .. "\n: ", "3.3.5.RELEASE")
|
||||
if not contains(data_available, boot_version) then
|
||||
create_notif("Invalid Spring Boot version. Please enter a valid version " .. options_err .. ".", "info")
|
||||
return ""
|
||||
end
|
||||
|
||||
return boot_version
|
||||
end
|
||||
|
||||
local function get_packaging(data_available)
|
||||
local packaging_available = list_to_string(data_available, false)
|
||||
local options_err = list_to_string(data_available, true)
|
||||
|
||||
local packaging = vim.fn.input("Enter Packaging(" .. packaging_available .. "): ", "jar")
|
||||
if packaging ~= "jar" and packaging ~= "war" then
|
||||
create_notif("Invalid packaging. Please enter " .. options_err .. ".", "info")
|
||||
return ""
|
||||
end
|
||||
return packaging
|
||||
end
|
||||
|
||||
local function springboot_new_project()
|
||||
local request = safe_request("https://start.spring.io/metadata/client")
|
||||
|
||||
if not request then
|
||||
vim.api.nvim_err_writeln("Failed to make a request to the URL.")
|
||||
return false
|
||||
end
|
||||
|
||||
local springboot_data = safe_json_decode(request.stdout)
|
||||
|
||||
if not springboot_data then
|
||||
vim.api.nvim_err_writeln("Failed to decode JSON from the request.")
|
||||
return false
|
||||
end
|
||||
local project_dir = change_directory()
|
||||
local build_types = { "maven", "gradle" }
|
||||
local languages = handle_start_springboot_data(springboot_data.language)
|
||||
local java_versions = handle_start_springboot_data(springboot_data.javaVersion)
|
||||
local boot_versions = handle_start_springboot_data(springboot_data.bootVersion)
|
||||
local packagings = handle_start_springboot_data(springboot_data.packaging)
|
||||
local build_type = get_build_type(build_types)
|
||||
|
||||
if build_type:len() == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local language = get_language(languages)
|
||||
if language:len() == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local java_version = get_java_version(java_versions)
|
||||
if java_version:len() == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local boot_version = get_boot_version(boot_versions)
|
||||
if boot_version:len() == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local packaging = get_packaging(packagings)
|
||||
if packaging:len() == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local dependencies = vim.fn.input("Enter dependencies (comma separated): ", "devtools,web,data-jpa,h2,thymeleaf")
|
||||
local group_id = vim.fn.input("Enter Group ID: ", "com.example")
|
||||
local artifact_id = vim.fn.input("Enter Artifact ID: ", "myproject")
|
||||
local name = vim.fn.input("Enter project name: ", artifact_id)
|
||||
local package_name = vim.fn.input("Enter package name: ", group_id .. "." .. artifact_id)
|
||||
local description = vim.fn.input("Enter project description: ", "")
|
||||
|
||||
local command = string.format(
|
||||
"spring init --boot-version=%s --java-version=%s --dependencies=%s --groupId=%s --artifactId=%s --name=%s --package-name=%s --description=%s --language=%s --build=%s %s",
|
||||
boot_version,
|
||||
java_version,
|
||||
dependencies,
|
||||
group_id,
|
||||
artifact_id,
|
||||
name,
|
||||
package_name,
|
||||
description, -- Menambahkan deskripsi proyek
|
||||
language, -- Menambahkan bahasa pemrograman (Java, Kotlin, atau Groovy)
|
||||
build_type,
|
||||
name
|
||||
)
|
||||
|
||||
-- Fungsi untuk mengubah teks
|
||||
local function capitalize_first_letter(str)
|
||||
return str:sub(1, 1):upper() .. str:sub(2):lower()
|
||||
end
|
||||
|
||||
local output = vim.fn.system(command)
|
||||
if vim.v.shell_error ~= 0 then
|
||||
create_notif("Erro ao executar: " .. output, "error")
|
||||
else
|
||||
local ch_dir = string.format("cd %s", project_dir .. "/" .. name)
|
||||
vim.fn.system(ch_dir)
|
||||
vim.fn.chdir(project_dir .. "/" .. name)
|
||||
create_notif(name, "info")
|
||||
-- Cari dan buka file main class
|
||||
local uname = vim.loop.os_uname().sysname
|
||||
local pth = package_name
|
||||
if uname == "Windows_NT" then
|
||||
if pth then
|
||||
pth = pth:gsub("%.", "\\")
|
||||
create_notif(pth, "info")
|
||||
local main_class_path =
|
||||
string.format("src\\main\\java\\%s\\" .. capitalize_first_letter(name) .. "Application.java", pth)
|
||||
create_notif(main_class_path, "info")
|
||||
if vim.fn.filereadable(main_class_path) == 1 then
|
||||
vim.cmd(":edit " .. main_class_path)
|
||||
end
|
||||
end
|
||||
else
|
||||
if pth then
|
||||
pth = pth:gsub("%.", "/")
|
||||
local main_class_path =
|
||||
string.format("src/main/java/%s/" .. capitalize_first_letter(name) .. "Application.java", pth)
|
||||
if vim.fn.filereadable(main_class_path) == 1 then
|
||||
vim.cmd(":edit " .. main_class_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.cmd(":NvimTreeFindFileToggl<CR>")
|
||||
end
|
||||
|
||||
create_notif("Project created successfully!", "info")
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("SpringBootNewProject", springboot_new_project, {})
|
106
lua/auto-jdtls2/generate_java_class.lua
Normal file
106
lua/auto-jdtls2/generate_java_class.lua
Normal file
|
@ -0,0 +1,106 @@
|
|||
local function create_java_class()
|
||||
local is_maven_project = function()
|
||||
if vim.fn.findfile("pom.xml", vim.fn.getcwd()) == "pom.xml" then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
local function create_notif(message, level)
|
||||
local notif_ok, notify = pcall(require, "notify")
|
||||
if notif_ok then
|
||||
notify(message, level)
|
||||
else
|
||||
print(message)
|
||||
end
|
||||
end
|
||||
|
||||
-- Fungsi untuk meminta input dari pengguna dengan opsi untuk membatalkan
|
||||
local function get_user_input(prompt, default_value)
|
||||
vim.fn.inputsave()
|
||||
local result = vim.fn.input(prompt, default_value)
|
||||
vim.fn.inputrestore()
|
||||
|
||||
-- Cek apakah pengguna menekan Esc untuk membatalkan input
|
||||
if result == "" then
|
||||
create_notif("Input canceled.", "info")
|
||||
return nil, true
|
||||
end
|
||||
|
||||
return result, false
|
||||
end
|
||||
|
||||
-- Fungsi untuk mendapatkan nama package default berdasarkan buffer aktif
|
||||
local function get_default_package()
|
||||
local path = vim.fn.expand("%:p:h")
|
||||
local project_root = vim.fn.getcwd()
|
||||
local relative_path = path:sub(#project_root + 1)
|
||||
relative_path = relative_path:gsub("app\\src\\main\\java\\", "")
|
||||
relative_path = relative_path:gsub("src\\main\\java\\", "")
|
||||
relative_path = relative_path:gsub("app/src/main/java/", "")
|
||||
relative_path = relative_path:gsub("src/main/java/", "")
|
||||
relative_path = relative_path:gsub("\\", ".")
|
||||
relative_path = relative_path:gsub("/", ".")
|
||||
return relative_path:sub(2)
|
||||
end
|
||||
|
||||
-- Ambil input dari pengguna untuk nama package dan nama kelas
|
||||
local package_name, canceled_package = get_user_input("Enter package name: ", get_default_package())
|
||||
if canceled_package then
|
||||
return
|
||||
end
|
||||
|
||||
local class_name, canceled_class = get_user_input("Enter class name: ", "MyClass")
|
||||
if canceled_class then
|
||||
return
|
||||
end
|
||||
|
||||
-- Format direktori dan path file berdasarkan input pengguna
|
||||
local package_dir = nil
|
||||
if package_name then
|
||||
if is_maven_project() then
|
||||
package_dir = string.format("src/main/java/%s", package_name:gsub("%.", "/"))
|
||||
else
|
||||
package_dir = string.format("app/src/main/java/%s", package_name:gsub("%.", "/"))
|
||||
end
|
||||
if vim.fn.isdirectory(package_dir) == 0 then
|
||||
vim.fn.mkdir(package_dir, "p")
|
||||
end
|
||||
else
|
||||
create_notif("Invalid package name: " .. package_name, "error")
|
||||
return
|
||||
end
|
||||
|
||||
local file_path = string.format("%s/%s.java", package_dir, class_name)
|
||||
if vim.fn.filereadable(file_path) == 1 then
|
||||
create_notif("Class already exists: " .. file_path, "error")
|
||||
return
|
||||
end
|
||||
|
||||
-- Tulis konten kelas Java ke dalam file
|
||||
local class_content = string.format(
|
||||
[[
|
||||
package %s;
|
||||
|
||||
public class %s {
|
||||
|
||||
}
|
||||
]],
|
||||
package_name,
|
||||
class_name,
|
||||
class_name
|
||||
)
|
||||
|
||||
local file = io.open(file_path, "w")
|
||||
if file then
|
||||
file:write(class_content)
|
||||
file:close()
|
||||
end
|
||||
|
||||
-- Buka file Java yang baru dibuat di Neovim
|
||||
vim.cmd(":edit " .. file_path)
|
||||
create_notif("Java class created: " .. file_path, "info")
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("CreateJavaClass", create_java_class, {})
|
109
lua/auto-jdtls2/generate_java_interface.lua
Normal file
109
lua/auto-jdtls2/generate_java_interface.lua
Normal file
|
@ -0,0 +1,109 @@
|
|||
local function create_java_class()
|
||||
local function create_notif(message, level)
|
||||
local notif_ok, notify = pcall(require, "notify")
|
||||
if notif_ok then
|
||||
notify(message, level)
|
||||
else
|
||||
print(message)
|
||||
end
|
||||
end
|
||||
|
||||
local is_maven_project = function()
|
||||
if vim.fn.findfile("pom.xml", vim.fn.getcwd()) == "pom.xml" then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- Fungsi untuk meminta input dari pengguna dengan opsi untuk membatalkan
|
||||
local function get_user_input(prompt, default_value)
|
||||
vim.fn.inputsave()
|
||||
local result = vim.fn.input(prompt, default_value)
|
||||
vim.fn.inputrestore()
|
||||
|
||||
-- Cek apakah pengguna menekan Esc untuk membatalkan input
|
||||
if result == "" then
|
||||
create_notif("Input canceled.", "info")
|
||||
return nil, true
|
||||
end
|
||||
|
||||
return result, false
|
||||
end
|
||||
|
||||
-- Fungsi untuk mendapatkan nama package default berdasarkan buffer aktif
|
||||
local function get_default_package()
|
||||
local path = vim.fn.expand("%:p:h")
|
||||
local project_root = vim.fn.getcwd()
|
||||
local relative_path = path:sub(#project_root + 1)
|
||||
relative_path = relative_path:gsub("app\\src\\main\\java\\", "")
|
||||
relative_path = relative_path:gsub("src\\main\\java\\", "")
|
||||
relative_path = relative_path:gsub("app/src/main/java/", "")
|
||||
relative_path = relative_path:gsub("src/main/java/", "")
|
||||
relative_path = relative_path:gsub("\\", ".")
|
||||
relative_path = relative_path:gsub("/", ".")
|
||||
return relative_path:sub(2)
|
||||
end
|
||||
|
||||
-- Ambil input dari pengguna untuk nama package dan nama kelas
|
||||
local package_name, canceled_package = get_user_input("Enter package name: ", get_default_package())
|
||||
if canceled_package then
|
||||
return
|
||||
end
|
||||
|
||||
local class_name, canceled_class = get_user_input("Enter interface name: ", "MyInterface")
|
||||
if canceled_class then
|
||||
return
|
||||
end
|
||||
|
||||
-- Format direktori dan path file berdasarkan input pengguna
|
||||
local package_dir = nil
|
||||
if package_name then
|
||||
if is_maven_project() then
|
||||
package_dir = string.format("src/main/java/%s", package_name:gsub("%.", "/"))
|
||||
else
|
||||
package_dir = string.format("app/src/main/java/%s", package_name:gsub("%.", "/"))
|
||||
end
|
||||
if vim.fn.isdirectory(package_dir) == 0 then
|
||||
vim.fn.mkdir(package_dir, "p")
|
||||
end
|
||||
else
|
||||
create_notif("Invalid package name: " .. package_name, "error")
|
||||
return
|
||||
end
|
||||
|
||||
local file_path = string.format("%s/%s.java", package_dir, class_name)
|
||||
if vim.fn.filereadable(file_path) == 1 then
|
||||
create_notif("Class already exists: " .. file_path, "error")
|
||||
return
|
||||
end
|
||||
|
||||
-- Tulis konten kelas Java ke dalam file
|
||||
local class_content = string.format(
|
||||
[[
|
||||
/*
|
||||
* This Java source file.
|
||||
*/
|
||||
package %s;
|
||||
|
||||
public interface %s {
|
||||
// Other methods and fields
|
||||
}
|
||||
]],
|
||||
package_name,
|
||||
class_name,
|
||||
class_name
|
||||
)
|
||||
|
||||
local file = io.open(file_path, "w")
|
||||
if file then
|
||||
file:write(class_content)
|
||||
file:close()
|
||||
end
|
||||
|
||||
-- Buka file Java yang baru dibuat di Neovim
|
||||
vim.cmd(":edit " .. file_path)
|
||||
create_notif("Java interface created: " .. file_path, "info")
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("CreateJavaInterface", create_java_class, {})
|
115
lua/auto-jdtls2/generate_java_main_class.lua
Normal file
115
lua/auto-jdtls2/generate_java_main_class.lua
Normal file
|
@ -0,0 +1,115 @@
|
|||
local function create_java_main_class()
|
||||
local function create_notif(message, level)
|
||||
local notif_ok, notify = pcall(require, "notify")
|
||||
if notif_ok then
|
||||
notify(message, level)
|
||||
else
|
||||
print(message)
|
||||
end
|
||||
end
|
||||
|
||||
local is_maven_project = function()
|
||||
if vim.fn.findfile("pom.xml", vim.fn.getcwd()) == "pom.xml" then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- Fungsi untuk meminta input dari pengguna dengan opsi untuk membatalkan
|
||||
local function get_user_input(prompt, default_value)
|
||||
vim.fn.inputsave()
|
||||
local result = vim.fn.input(prompt, default_value)
|
||||
vim.fn.inputrestore()
|
||||
|
||||
-- Cek apakah pengguna menekan Esc untuk membatalkan input
|
||||
if result == "" then
|
||||
create_notif("Input canceled.", "info")
|
||||
return nil, true
|
||||
end
|
||||
|
||||
return result, false
|
||||
end
|
||||
|
||||
-- Fungsi untuk mendapatkan nama package default berdasarkan buffer aktif
|
||||
local function get_default_package()
|
||||
local path = vim.fn.expand("%:p:h")
|
||||
local project_root = vim.fn.getcwd()
|
||||
local relative_path = path:sub(#project_root + 1)
|
||||
relative_path = relative_path:gsub("app\\src\\main\\java\\", "")
|
||||
relative_path = relative_path:gsub("src\\main\\java\\", "")
|
||||
relative_path = relative_path:gsub("app/src/main/java/", "")
|
||||
relative_path = relative_path:gsub("src/main/java/", "")
|
||||
relative_path = relative_path:gsub("\\", ".")
|
||||
relative_path = relative_path:gsub("/", ".")
|
||||
return relative_path:sub(2)
|
||||
end
|
||||
|
||||
-- Ambil input dari pengguna untuk nama package dan nama kelas
|
||||
local package_name, canceled_package = get_user_input("Enter package name: ", get_default_package())
|
||||
if canceled_package then
|
||||
return
|
||||
end
|
||||
|
||||
local class_name, canceled_class = get_user_input("Enter class name: ", "MyMainClass")
|
||||
if canceled_class then
|
||||
return
|
||||
end
|
||||
|
||||
-- Format direktori dan path file berdasarkan input pengguna
|
||||
local package_dir = nil
|
||||
if package_name then
|
||||
if is_maven_project() then
|
||||
package_dir = string.format("src/main/java/%s", package_name:gsub("%.", "/"))
|
||||
else
|
||||
package_dir = string.format("app/src/main/java/%s", package_name:gsub("%.", "/"))
|
||||
end
|
||||
if vim.fn.isdirectory(package_dir) == 0 then
|
||||
vim.fn.mkdir(package_dir, "p")
|
||||
end
|
||||
else
|
||||
create_notif("Invalid package name: " .. package_name, "error")
|
||||
return
|
||||
end
|
||||
|
||||
local file_path = string.format("%s/%s.java", package_dir, class_name)
|
||||
if vim.fn.filereadable(file_path) == 1 then
|
||||
create_notif("Class already exists: " .. file_path, "error")
|
||||
return
|
||||
end
|
||||
|
||||
-- Tulis konten kelas Java ke dalam file
|
||||
local class_content = string.format(
|
||||
[[
|
||||
/*
|
||||
* This Java source file.
|
||||
*/
|
||||
package %s;
|
||||
|
||||
public class %s {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello World");
|
||||
}
|
||||
|
||||
}
|
||||
]],
|
||||
package_name,
|
||||
class_name,
|
||||
class_name
|
||||
)
|
||||
|
||||
local file = io.open(file_path, "w")
|
||||
if file then
|
||||
file:write(class_content)
|
||||
file:close()
|
||||
end
|
||||
|
||||
-- Buka file Java yang baru dibuat di Neovim
|
||||
vim.cmd(":edit " .. file_path)
|
||||
create_notif("Java class created: " .. file_path, "info")
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("CreateJavaMainClass", create_java_main_class, {})
|
15
lua/auto-jdtls2/init.lua
Normal file
15
lua/auto-jdtls2/init.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
local M = {}
|
||||
|
||||
M.setup = function(opt)
|
||||
opt = opt or {}
|
||||
require("auto-jdtls2.create_gradle_project")
|
||||
require("auto-jdtls2.create_maven_project")
|
||||
require("auto-jdtls2.create_springboot_project")
|
||||
require("auto-jdtls2.generate_java_class")
|
||||
require("auto-jdtls2.generate_java_interface")
|
||||
require("auto-jdtls2.generate_java_main_class")
|
||||
-- require("auto-jdtls2.utils").install()
|
||||
-- require("auto-jdtls2.utils").attach_jdtls(opt)
|
||||
end
|
||||
|
||||
return M
|
449
lua/auto-jdtls2/utils.lua
Normal file
449
lua/auto-jdtls2/utils.lua
Normal file
|
@ -0,0 +1,449 @@
|
|||
local M = {}
|
||||
M.java_filetypes = { "java" }
|
||||
M.root_markers = { ".git", "mvnw", "gradlew", "pom.xml", "build.gradle" }
|
||||
|
||||
-- Utility function to extend or override a config table, similar to the way
|
||||
-- that Plugin.opts works.
|
||||
---@param config table
|
||||
---@param custom function | table | nil
|
||||
M.extend_or_override = function(config, custom, ...)
|
||||
if type(custom) == "function" then
|
||||
config = custom(config, ...) or config
|
||||
elseif custom then
|
||||
config = vim.tbl_deep_extend("force", config, custom) --[[@as table]]
|
||||
end
|
||||
return config
|
||||
end
|
||||
|
||||
function M.capabilities()
|
||||
local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
if status_ok then
|
||||
return cmp_nvim_lsp.default_capabilities()
|
||||
end
|
||||
|
||||
local CAPABILITIES = vim.lsp.protocol.make_client_capabilities()
|
||||
CAPABILITIES.textDocument.completion.completionItem.snippetSupport = true
|
||||
CAPABILITIES.textDocument.completion.completionItem.resolveSupport = {
|
||||
properties = {
|
||||
"documentation",
|
||||
"detail",
|
||||
"additionalTextEdits",
|
||||
},
|
||||
}
|
||||
|
||||
return CAPABILITIES
|
||||
end
|
||||
-- stylua: ignore
|
||||
M.lsp_keymaps=function ()
|
||||
vim.keymap.set({ "n", "v" }, "<leader>l", "", { desc = "LSP" })
|
||||
-- Set vim motion for <Space> + l + h to show code documentation about the code the cursor is currently over if available
|
||||
vim.keymap.set("n", "<leader>lh", vim.lsp.buf.hover, { desc = "Code Hover Documentation" })
|
||||
-- Set vim motion for <Space> + l + d to go where the code/variable under the cursor was defined
|
||||
vim.keymap.set("n", "<leader>ld", vim.lsp.buf.definition, { desc = "Code Goto Definition" })
|
||||
-- Set vim motion for <Space> + l + a for display code action suggestions for code diagnostics in both normal and visual mode
|
||||
vim.keymap.set({ "n", "v" }, "<leader>la", vim.lsp.buf.code_action, { desc = "Code Actions" })
|
||||
-- Set vim motion for <Space> + l + r to display references to the code under the cursor
|
||||
vim.keymap.set("n", "<leader>lr", require("telescope.builtin").lsp_references, { desc = "Code Goto References" })
|
||||
-- Set vim motion for <Space> + l + i to display implementations to the code under the cursor
|
||||
vim.keymap.set("n", "<leader>li", require("telescope.builtin").lsp_implementations, { desc = "Code Goto Implementations" })
|
||||
-- Set a vim motion for <Space> + l + <Shift>R to smartly rename the code under the cursor
|
||||
vim.keymap.set("n", "<leader>lR", vim.lsp.buf.rename, { desc = "Code Rename" })
|
||||
-- Set a vim motion for <Space> + l + <Shift>D to go to where the code/object was declared in the project (class file)
|
||||
vim.keymap.set("n", "<leader>lD", vim.lsp.buf.declaration, { desc = "Code Goto Declaration" })
|
||||
end
|
||||
|
||||
M.is_maven_project = function()
|
||||
if vim.fn.findfile("pom.xml", vim.fn.getcwd()) == "pom.xml" then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
M.is_gradle_project = function()
|
||||
if
|
||||
vim.fn.findfile("build.gradle", vim.fn.getcwd()) == "build.gradle"
|
||||
or vim.fn.findfile("settings.gradle", vim.fn.getcwd()) == "settings.gradle"
|
||||
or vim.fn.findfile("gradlew", vim.fn.getcwd()) == "gradlew"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
M.is_main_class = function()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local content = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
||||
for i, line in ipairs(content) do
|
||||
if line:match("public static void main%s*%(") then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
M.run_aven_pring_boot = function()
|
||||
if M.is_maven_project() then
|
||||
vim.cmd("terminal mvn spring-boot:run")
|
||||
else
|
||||
local notif_ok, notify = pcall(require, "notify")
|
||||
if notif_ok then
|
||||
notify("Project pom.xml not found !", "info")
|
||||
else
|
||||
print("Project pom.xml not found !")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
M.cmd_maven_spring_boot = function()
|
||||
vim.api.nvim_create_user_command("RunMvnSpringBoot", function()
|
||||
M.run_aven_pring_boot()
|
||||
end, { nargs = 0 })
|
||||
end
|
||||
|
||||
M.run_gradle_spring_boot = function()
|
||||
if M.is_gradle_project() then
|
||||
local uname = vim.loop.os_uname().sysname
|
||||
if uname == "Windows_NT" then
|
||||
vim.cmd("terminal .\\gradlew build --continuous")
|
||||
vim.cmd("terminal .\\gradlew bootRun")
|
||||
else
|
||||
vim.cmd("terminal ./gradlew build --continuous")
|
||||
vim.cmd("terminal ./gradlew bootRun")
|
||||
end
|
||||
else
|
||||
local notif_ok, notify = pcall(require, "notify")
|
||||
if notif_ok then
|
||||
notify("Project build.gradle not found !", "info")
|
||||
else
|
||||
print("Project build.gradle not found !")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
M.cmd_gradle_spring_boot = function()
|
||||
vim.api.nvim_create_user_command("RunGradleSpringBoot", function()
|
||||
M.run_gradle_spring_boot()
|
||||
end, { nargs = 0 })
|
||||
end
|
||||
|
||||
M.run_mvn_and_java = function()
|
||||
if M.is_maven_project() then
|
||||
local result = M.is_main_class()
|
||||
if not result then
|
||||
local notif_ok, notify = pcall(require, "notify")
|
||||
if notif_ok then
|
||||
notify("Please open java main class !", "info")
|
||||
else
|
||||
print("Please open java main class !")
|
||||
end
|
||||
return
|
||||
else
|
||||
-- Fungsi untuk mencari file .jar dalam folder target
|
||||
local function find_jar_file()
|
||||
local target_dir = "target"
|
||||
local jar_file = nil
|
||||
|
||||
local handle = vim.loop.fs_scandir(target_dir)
|
||||
if handle then
|
||||
while true do
|
||||
local name, t = vim.loop.fs_scandir_next(handle)
|
||||
if not name then
|
||||
break
|
||||
end
|
||||
if t == "file" and name:match("%.jar$") then
|
||||
jar_file = name
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
return jar_file
|
||||
end
|
||||
local jar_file = find_jar_file()
|
||||
-- Buat fungsi untuk menjalankan perintah secara berurutan dalam mode diam
|
||||
function RunMvnAndJava()
|
||||
-- daptkan path
|
||||
local root = vim.uv.cwd()
|
||||
local fname = vim.api.nvim_buf_get_name(0)
|
||||
fname = fname:gsub(root, "")
|
||||
fname = fname:gsub("/src/main/java/", "")
|
||||
fname = fname:gsub("\\src\\main\\java\\", "")
|
||||
fname = fname:gsub(".java", ""):gsub("/", ".")
|
||||
fname = fname:gsub("\\", ".")
|
||||
-- Jalankan perintah mvn package secara diam-diam
|
||||
local notif_ok, notify = pcall(require, "notify")
|
||||
if notif_ok then
|
||||
notify("Compile Start !", "info")
|
||||
end
|
||||
vim.fn.jobstart("mvn package", {
|
||||
on_exit = function()
|
||||
vim.cmd("terminal java -cp target/" .. jar_file .. " " .. fname)
|
||||
end,
|
||||
})
|
||||
end
|
||||
RunMvnAndJava()
|
||||
end
|
||||
else
|
||||
local notif_ok, notify = pcall(require, "notify")
|
||||
if notif_ok then
|
||||
notify("Project pom.xml not found !", "info")
|
||||
else
|
||||
print("Project pom.xml not found !")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
M.cmd_mvn_and_java = function()
|
||||
vim.api.nvim_create_user_command("RunMaven", function()
|
||||
M.run_mvn_and_java()
|
||||
end, { nargs = 0 })
|
||||
end
|
||||
|
||||
M.cmd_gradle = function()
|
||||
vim.api.nvim_create_user_command("RunGradle", function()
|
||||
vim.cmd("terminal gradle run")
|
||||
end, { nargs = 0 })
|
||||
end
|
||||
|
||||
-- stylua: ignore
|
||||
M.jdtls_keymaps=function ()
|
||||
-- add keymaps
|
||||
vim.keymap.set('n', '<leader>J', "", { desc = "Java" })
|
||||
-- Set a Vim motion to <Space> + <Shift>J + o to organize imports in normal mode
|
||||
vim.keymap.set('n', '<leader>Jo', "<Cmd> lua require('jdtls').organize_imports()<CR>", { desc = "Java Organize Imports" })
|
||||
-- Set a Vim motion to <Space> + <Shift>J + v to extract the code under the cursor to a variable
|
||||
vim.keymap.set('n', '<leader>Jv', "<Cmd> lua require('jdtls').extract_variable()<CR>", { desc = "Java Extract Variable" })
|
||||
-- Set a Vim motion to <Space> + <Shift>J + v to extract the code selected in visual mode to a variable
|
||||
vim.keymap.set('v', '<leader>Jv', "<Esc><Cmd> lua require('jdtls').extract_variable(true)<CR>", { desc = "Java Extract Variable" })
|
||||
-- Set a Vim motion to <Space> + <Shift>J + <Shift>C to extract the code under the cursor to a static variable
|
||||
vim.keymap.set('n', '<leader>JC', "<Cmd> lua require('jdtls').extract_constant()<CR>", { desc = "Java Extract Constant" })
|
||||
-- Set a Vim motion to <Space> + <Shift>J + <Shift>C to extract the code selected in visual mode to a static variable
|
||||
vim.keymap.set('v', '<leader>JC', "<Esc><Cmd> lua require('jdtls').extract_constant(true)<CR>", { desc = "Java Extract Constant" })
|
||||
-- Set a Vim motion to <Space> + <Shift>J + t to run the test method currently under the cursor
|
||||
vim.keymap.set('n', '<leader>Jt', "<Cmd> lua require('jdtls').test_nearest_method()<CR>", { desc = "Java Test Method" })
|
||||
-- Set a Vim motion to <Space> + <Shift>J + t to run the test method that is currently selected in visual mode
|
||||
vim.keymap.set('v', '<leader>Jt', "<Esc><Cmd> lua require('jdtls').test_nearest_method(true)<CR>", { desc = "Java Test Method" })
|
||||
-- Set a Vim motion to <Space> + <Shift>J + <Shift>T to run an entire test suite (class)
|
||||
vim.keymap.set('n', '<leader>JT', "<Cmd> lua require('jdtls').test_class()<CR>", { desc = "Java Test Class" })
|
||||
-- Set a Vim motion to <Space> + <Shift>J + u to update the project configuration
|
||||
vim.keymap.set('n', '<leader>Ju', "<Cmd> JdtUpdateConfig<CR>", { desc = "Java Update Config" })
|
||||
end
|
||||
|
||||
M.opts = {
|
||||
root_dir = require("jdtls.setup").find_root(M.root_markers),
|
||||
project_name = function()
|
||||
return vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t")
|
||||
end,
|
||||
|
||||
get_jdtls = function()
|
||||
local function check_os()
|
||||
local uname = vim.loop.os_uname().sysname
|
||||
if uname == "Darwin" then
|
||||
return "mac"
|
||||
elseif uname == "Windows_NT" then
|
||||
return "win"
|
||||
elseif uname == "Linux" then
|
||||
return "linux"
|
||||
else
|
||||
return "unknown"
|
||||
end
|
||||
end
|
||||
local mason_registry = require("mason-registry")
|
||||
local jdtls = mason_registry.get_package("jdtls")
|
||||
local jdtls_path = jdtls:get_install_path()
|
||||
local launcher = vim.fn.glob(jdtls_path .. "/plugins/org.eclipse.equinox.launcher_*.jar")
|
||||
local SYSTEM = check_os()
|
||||
local config = jdtls_path .. "/config_" .. SYSTEM
|
||||
local lombok = jdtls_path .. "/lombok.jar"
|
||||
return launcher, config, lombok
|
||||
end,
|
||||
|
||||
jdtls_workspace_dir = function(project_name)
|
||||
local function get_workspace()
|
||||
local home = os.getenv("HOME")
|
||||
local workspace_path = home .. "/code/workspace/"
|
||||
local workspace_dir = workspace_path .. project_name
|
||||
return workspace_dir
|
||||
end
|
||||
return get_workspace()
|
||||
end,
|
||||
full_cmd = function(opts)
|
||||
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t")
|
||||
local launcher, os_config, lombok = opts.get_jdtls()
|
||||
local cmd = {
|
||||
"java",
|
||||
"-Declipse.application=org.eclipse.jdt.ls.core.id1",
|
||||
"-Dosgi.bundles.defaultStartLevel=4",
|
||||
"-Declipse.product=org.eclipse.jdt.ls.core.product",
|
||||
"-Dlog.protocol=true",
|
||||
"-Dlog.level=ALL",
|
||||
"-Xmx1g",
|
||||
"--add-modules=ALL-SYSTEM",
|
||||
"--add-opens",
|
||||
"java.base/java.util=ALL-UNNAMED",
|
||||
"--add-opens",
|
||||
"java.base/java.lang=ALL-UNNAMED",
|
||||
"-javaagent:" .. lombok,
|
||||
"-jar",
|
||||
launcher,
|
||||
"-configuration",
|
||||
os_config,
|
||||
"-data",
|
||||
opts.jdtls_workspace_dir(project_name),
|
||||
}
|
||||
return cmd
|
||||
end,
|
||||
|
||||
-- These depend on nvim-dap, but can additionally be disabled by setting false here.
|
||||
dap = { hotcodereplace = "auto", config_overrides = {} },
|
||||
dap_main = {},
|
||||
test = true,
|
||||
settings = {
|
||||
java = {
|
||||
inlayHints = {
|
||||
parameterNames = {
|
||||
enabled = "all",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.attach_jdtls = function(op)
|
||||
M.opts = M.extend_or_override(M.opts, op or {})
|
||||
local opt = vim.opt
|
||||
opt.shiftwidth = 4
|
||||
opt.tabstop = 4
|
||||
opt.softtabstop = 4
|
||||
opt.ts = 4
|
||||
opt.expandtab = true
|
||||
|
||||
-- Check Ttriisittrer
|
||||
|
||||
local function ensure_ts_install(lang)
|
||||
local parsers = require("nvim-treesitter.parsers")
|
||||
local installed = parsers.has_parser(lang)
|
||||
|
||||
if not installed then
|
||||
vim.cmd("TSInstall " .. lang)
|
||||
require("notify")("Treesitter parser for " .. lang .. " installed successfully.")
|
||||
end
|
||||
end
|
||||
|
||||
-- Memeriksa dan menginstal atau mengonfirmasi Treesitter untuk Java
|
||||
ensure_ts_install("java")
|
||||
|
||||
local mason_registry = require("mason-registry")
|
||||
if
|
||||
not mason_registry.is_installed("jdtls")
|
||||
or not mason_registry.is_installed("java-debug-adapter")
|
||||
or not mason_registry.is_installed("java-test")
|
||||
then
|
||||
vim.cmd("Mason")
|
||||
require("notify")("Mason Installed Dependency, please restart nvim after installation is completed")
|
||||
return
|
||||
end
|
||||
local bundles = {} ---@type string[]
|
||||
if M.opts.dap and mason_registry.is_installed("java-debug-adapter") then
|
||||
local java_dbg_pkg = mason_registry.get_package("java-debug-adapter")
|
||||
local java_dbg_path = java_dbg_pkg:get_install_path()
|
||||
local jar_patterns = {
|
||||
java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar",
|
||||
}
|
||||
-- java-test also depends on java-debug-adapter.
|
||||
if M.opts.test and mason_registry.is_installed("java-test") then
|
||||
local java_test_pkg = mason_registry.get_package("java-test")
|
||||
local java_test_path = java_test_pkg:get_install_path()
|
||||
vim.list_extend(jar_patterns, {
|
||||
java_test_path .. "/extension/server/*.jar",
|
||||
})
|
||||
end
|
||||
for _, jar_pattern in ipairs(jar_patterns) do
|
||||
for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), "\n")) do
|
||||
table.insert(bundles, bundle)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- initialisasi config
|
||||
local function attach_jdtls()
|
||||
-- load user cmd
|
||||
M.cmd_maven_spring_boot()
|
||||
M.cmd_gradle_spring_boot()
|
||||
M.cmd_mvn_and_java()
|
||||
M.cmd_gradle()
|
||||
-- Configuration can be augmented and overridden by opts.jdtls
|
||||
local config = M.extend_or_override({
|
||||
cmd = M.opts.full_cmd(M.opts),
|
||||
root_dir = require("jdtls.setup").find_root(M.root_markers),
|
||||
init_options = {
|
||||
bundles = bundles,
|
||||
},
|
||||
settings = M.opts.settings,
|
||||
-- enable CMP capabilities
|
||||
-- capabilities = require("user.lsp.handlers").capabilities or nil,
|
||||
-- capabilities = require("auto-lsp.lsp.handlers").capabilities or nil,
|
||||
capabilities = M.capabilities() or nil,
|
||||
}, M.opts.jdtls)
|
||||
|
||||
-- Existing server will be reused if the root_dir matches.
|
||||
require("jdtls").start_or_attach(config)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = M.java_filetypes,
|
||||
callback = attach_jdtls,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
-- stylua: ignore
|
||||
if client and client.name == "jdtls" then
|
||||
-- M.jdtls_keymaps()
|
||||
-- M.lsp_keymaps()
|
||||
if M.opts.dap and mason_registry.is_installed("java-debug-adapter") then
|
||||
-- custom init for Java debugger
|
||||
require("jdtls").setup_dap(M.opts.dap)
|
||||
require("jdtls.dap").setup_dap_main_class_configs(M.opts.dap_main)
|
||||
end
|
||||
|
||||
-- User can set additional keymaps in opts.on_attach
|
||||
if M.opts.on_attach then
|
||||
M.opts.on_attach(args)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
attach_jdtls()
|
||||
end
|
||||
|
||||
M.install = function()
|
||||
local ensure_installed = {
|
||||
"java-debug-adapter",
|
||||
"java-test",
|
||||
"jdtls",
|
||||
}
|
||||
local mr = require("mason-registry")
|
||||
mr:on("package:install:success", function()
|
||||
vim.defer_fn(function()
|
||||
-- trigger FileType event to possibly load this newly installed LSP server
|
||||
require("lazy.core.handler.event").trigger({
|
||||
event = "FileType",
|
||||
buf = vim.api.nvim_get_current_buf(),
|
||||
})
|
||||
end, 100)
|
||||
end)
|
||||
|
||||
mr.refresh(function()
|
||||
for _, tool in ipairs(ensure_installed) do
|
||||
local p = mr.get_package(tool)
|
||||
if not p:is_installed() then
|
||||
p:install()
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
return M
|
|
@ -1,60 +0,0 @@
|
|||
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
-- bootstrap lazy.nvim
|
||||
-- stylua: ignore
|
||||
vim.fn.system({
|
||||
"git", "clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable",
|
||||
lazypath
|
||||
})
|
||||
end
|
||||
|
||||
local icons = require("user.icons").ui
|
||||
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
vim.diagnostic.config { virtual_lines = false }
|
||||
require("lazy").setup {
|
||||
spec = {
|
||||
{ import = "plugins.themes" },
|
||||
{ import = "plugins" },
|
||||
{ import = "custom.plugins" },
|
||||
},
|
||||
defaults = {
|
||||
lazy = true, -- every plugin is lazy-loaded by default
|
||||
version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
},
|
||||
ui = {
|
||||
backdrop = 100,
|
||||
border = "rounded",
|
||||
browser = "chrome",
|
||||
throttle = 40,
|
||||
custom_keys = { ["<localleader>l"] = false },
|
||||
icons = {
|
||||
ft = icons.ft,
|
||||
lazy = icons.Bell .. " ",
|
||||
loaded = icons.CheckCircle,
|
||||
not_loaded = icons.not_loaded,
|
||||
},
|
||||
},
|
||||
change_detection = { enabled = false, notify = false },
|
||||
checker = { enabled = true }, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"matchit",
|
||||
"matchparen",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
"lazyredraw",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
require "custom.default"
|
||||
require "custom.dashboard"
|
||||
require "config.lazy_lib"
|
||||
require "user.colorscheme"
|
||||
require "user.keymaps"
|
||||
-- require("user.snip")
|
||||
require "core.neovide"
|
||||
require "custom.autocmd"
|
||||
require "custom.keymaps"
|
||||
-- require("user.nvim-tree")
|
||||
-- require("user.options")
|
||||
-- require("user.keymaps")
|
||||
-- require("user.autocommands")
|
||||
-- require("user.format_onsave")
|
||||
-- require("user.snip")
|
||||
-- require("user.bufferline")
|
||||
-- require("user.chat_gpt")
|
||||
-- vim.cmd("colorscheme one_monokai")
|
||||
-- vim.cmd("colorscheme onedark")
|
||||
-- vim.cmd("colorscheme github_dark_dimmed")
|
||||
-- vim.cmd("colorscheme github_dark_high_contrast")
|
|
@ -1,56 +0,0 @@
|
|||
local transparent_mode = vim.g.pcode_transparent_mode or 0
|
||||
if transparent_mode ~= nil then
|
||||
if transparent_mode == 1 then
|
||||
vim.cmd "TransparentDisable"
|
||||
vim.cmd "TransparentEnable"
|
||||
end
|
||||
end
|
||||
|
||||
-- get folder name from current directory
|
||||
local _get_folder_name = function()
|
||||
local str = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
|
||||
return " " .. str:lower():gsub("^%l", string.upper) .. " "
|
||||
end
|
||||
|
||||
local term_program = vim.fn.getenv "TERM_PROGRAM"
|
||||
if term_program == "WezTerm" then
|
||||
-- vim.cmd('silent !wezterm cli set-tab-title "' .. _get_folder_name() .. '"')
|
||||
-- create autocmd on insertEnter
|
||||
vim.api.nvim_create_autocmd("BufRead", {
|
||||
group = vim.api.nvim_create_augroup("BufRead", { clear = true }),
|
||||
command = 'silent !wezterm cli set-tab-title "' .. _get_folder_name() .. '"',
|
||||
desc = "Set Folder Name",
|
||||
})
|
||||
end
|
||||
|
||||
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.",
|
||||
})
|
||||
|
||||
|
||||
-- config for vim-visual-multi color selection
|
||||
vim.g.VM_Mono_hl = "DiffText"
|
||||
vim.g.VM_Extend_hl = "DiffAdd"
|
||||
-- vim.g.VM_Cursor_hl = "Visual"
|
||||
vim.g.VM_Cursor_hl = "DiffText"
|
||||
vim.g.VM_Insert_hl = "DiffChange"
|
||||
|
||||
-- NvimTree automatically resize the floating window when neovim's window size changes
|
||||
-- local tree_api = require("nvim-tree")
|
||||
-- local tree_view = require("nvim-tree.view")
|
||||
--
|
||||
-- vim.api.nvim_create_augroup("NvimTreeResize", {
|
||||
-- clear = true,
|
||||
-- })
|
||||
--
|
||||
-- vim.api.nvim_create_autocmd({ "VimResized" }, {
|
||||
-- group = "NvimTreeResize",
|
||||
-- callback = function()
|
||||
-- if tree_view.is_visible() then
|
||||
-- tree_view.close()
|
||||
-- tree_api.open()
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
|
@ -1,37 +0,0 @@
|
|||
-- Untuk Ubah Dashboard
|
||||
-- 1. Buka remark dash board dibawah
|
||||
-- 2. Ubah dashboard sesuai keinginan dan kebutuhan
|
||||
|
||||
vim.g.pcode_header1 = {
|
||||
[[ _ __ __ ]],
|
||||
[[ ___ ___ (____ / /__ _______ ___/ ___ ]],
|
||||
[[ / _ / _ \ / / _ \/ '_/ / __/ _ / _ / -_) ]],
|
||||
[[ / .__\_____/ /\___/_/\_\ \__/\___\_,_/\__/ ]],
|
||||
[[ /_/ |___/ ]],
|
||||
}
|
||||
|
||||
-- vim.g.pcode_header2 = {
|
||||
-- [[ __ ]],
|
||||
-- [[ ___ ___ ___ __ __ /\_\ ___ ___ ]],
|
||||
-- [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]],
|
||||
-- [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
|
||||
-- [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]],
|
||||
-- [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]],
|
||||
-- }
|
||||
-- vim.g.pcode_header1 = {
|
||||
-- " ▄ ▄ ",
|
||||
-- " ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ ",
|
||||
-- " █ ▄ █▄█ ▄▄▄ █ █▄█ █ █ ",
|
||||
-- " ▄▄ █▄█▄▄▄█ █▄█▄█▄▄█▄▄█ █ ",
|
||||
-- " ▄ █▄▄█ ▄ ▄▄ ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ",
|
||||
-- " █▄▄▄▄ ▄▄▄ █ ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ █ ▄",
|
||||
-- "▄ █ █▄█ █▄█ █ █ █▄█ █ █▄█ ▄▄▄ █ █",
|
||||
-- "█▄█ ▄ █▄▄█▄▄█ █ ▄▄█ █ ▄ █ █▄█▄█ █",
|
||||
-- " █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ █▄█▄▄▄█ ",
|
||||
-- }
|
||||
|
||||
vim.g.pcode_footer = "PCode"
|
||||
|
||||
-- 1 startify model
|
||||
-- 2 dashboard model
|
||||
vim.g.pcode_model = 1 -- isi dengan 1 atau 2 untuk model dashboard
|
|
@ -1,117 +0,0 @@
|
|||
-- custom colorscheme
|
||||
-- colorscheme ready :
|
||||
-- tokyonight, tokyonight-night, tokyonight-storm, tokyonight-day, tokyonight-moon
|
||||
-- gruvbox-baby (default)
|
||||
-- sonokai, sonokai_atlantis,
|
||||
-- sonokai_andromeda,sonokai_shusia,sonokai_maia,sonokai_espresso
|
||||
-- material, material_deepocean, material_palenight, material_lighter, material_darker
|
||||
-- onedark, onedark_vivid, onedark_dark
|
||||
-- lunar
|
||||
-- nord
|
||||
-- catppuccin, catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha
|
||||
-- dracula
|
||||
-- nightfox, dayfox, dawnfox, duskfox, nordfox, terafox, carbonfox
|
||||
-- github_dark, github_dark_default, github_dark_colorblind, github_dark_dimmed
|
||||
-- solarized-osaka
|
||||
-- darcula-dark
|
||||
-- juliana
|
||||
vim.g.pcode_colorscheme = "darcula-dark"
|
||||
|
||||
-- 0 =off 1= on
|
||||
vim.g.pcode_transparent_mode = 0
|
||||
-- rounded
|
||||
-- roundedall
|
||||
-- square
|
||||
-- triangle
|
||||
-- parallelogram
|
||||
-- transparent
|
||||
-- default
|
||||
vim.g.pcode_lualinetheme = "roundedall"
|
||||
-- 0 disable progress
|
||||
-- 1 lualine lsp progress
|
||||
-- 2 fidget progress
|
||||
vim.g.pcode_progress = 1
|
||||
|
||||
-- 0 = on full text mode info,
|
||||
-- 1 = on initial mode + logo
|
||||
-- 2 = logo only
|
||||
-- 3 = initial only
|
||||
-- 4 = off
|
||||
vim.g.pcode_show_mode = 3
|
||||
|
||||
-- 1 ( format jalan) 0 (fromat off)
|
||||
vim.g.pcode_format_on_save = 1
|
||||
|
||||
-- ini hanya untuk lsp yg tidak support masson
|
||||
-- untuk referesi support language kunjungi link dibawah
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||
vim.g.pcode_lsp_installer = {
|
||||
-- "yamlls",
|
||||
-- tambahkan di bawah sini setelah melakukan :masoninstall
|
||||
}
|
||||
|
||||
-- use for lsp diagnostics virtual text
|
||||
vim.g.pcode_lsp_virtualtext = true
|
||||
|
||||
-- use for lsp ghost text config
|
||||
vim.g.pcode_lspghost_text = false
|
||||
|
||||
-- untuk referesi support language kunjungi link dibawah
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||
vim.g.pcode_mason_ensure_installed = { -- sebelumnya register_lsp
|
||||
-- "yamlls",
|
||||
-- "intelephense",
|
||||
-- "marksman",
|
||||
-- "csharp_ls",
|
||||
-- "clangd",
|
||||
-- "dartls",
|
||||
-- "kotlin_language_server",
|
||||
-- tambahkan di bawah sini setelah melakukan :masoninstall
|
||||
}
|
||||
vim.g.pcode_unregister_lsp = {
|
||||
"jdtls", -- tambahkan di bawah ini
|
||||
}
|
||||
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md
|
||||
vim.g.pcode_null_ls_ensure_installed = {
|
||||
"stylua",
|
||||
}
|
||||
|
||||
-- dap instal hanya support linux dan mac
|
||||
-- https://github.com/jay-babu/mason-nvim-dap.nvim/blob/main/lua/mason-nvim-dap/mappings/source.lua
|
||||
-- atau gunakan :MasonInstall
|
||||
vim.g.pcode_dap_ensure_installed = {
|
||||
-- "python",
|
||||
}
|
||||
|
||||
-- https://github.com/folke/which-key.nvim
|
||||
vim.g.pcode_whichkey = {
|
||||
-- contoh penambahan
|
||||
["k"] = {
|
||||
name = "Example",
|
||||
k = { '<cmd>lua print("Testing")<cr>', "Example" },
|
||||
},
|
||||
["r"] = {
|
||||
name = "Run",
|
||||
j = { "<cmd>Jaq float<CR>", "Run With Jaq" },
|
||||
},
|
||||
}
|
||||
|
||||
-- https://github.com/CRAG666/code_runner.nvim
|
||||
-- ready default java, python, typescript, javascript, rust, cpp, scss
|
||||
vim.g.pcode_coderunner = {
|
||||
go = "go run $fileName",
|
||||
html = "live-server $dir/$fileName",
|
||||
}
|
||||
|
||||
-- 0 = normal
|
||||
-- 1 = float
|
||||
vim.g.pcode_nvimtree_isfloat = 0
|
||||
|
||||
vim.g.pcode_tailwindcolorizer = false
|
||||
vim.g.pcode_codeium = false
|
||||
vim.g.pcode_nvimufo = false
|
||||
vim.g.pcode_indentscope = false
|
||||
vim.g.pvode_minianimate = false
|
||||
|
||||
vim.g.pcode_disable_cmpdoc = false
|
|
@ -1,11 +0,0 @@
|
|||
local opts = { noremap = true, silent = true }
|
||||
local keymap = vim.api.nvim_set_keymap
|
||||
|
||||
keymap("n", "]h", '<cmd>lua print("Testing")<cr>', opts)
|
||||
keymap("n", "f", "<cmd>NvimTreeFindFileToggle<cr><cr><Up>", opts)
|
||||
|
||||
-- Allow clipboard copy paste in neovim
|
||||
vim.api.nvim_set_keymap("", "<C-v>", "+p<CR>", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("!", "<C-v>", "<C-R>+", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("t", "<C-v>", "<C-R>+", { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap("v", "<C-v>", "<C-R>+", { noremap = true, silent = true })
|
|
@ -1,11 +0,0 @@
|
|||
local null_ls = require("null-ls")
|
||||
local formatting = null_ls.builtins.formatting
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
local m = {
|
||||
sources = {
|
||||
formatting.stylua, -- tambahkan di bawah sini
|
||||
--diagnostics.flake8, -- tambahkan di bawah sini
|
||||
--formatting.blade_formatter.with({ filetypes = { "blade", "php" } }),
|
||||
},
|
||||
}
|
||||
return m
|
|
@ -1,161 +0,0 @@
|
|||
-- initial gui app
|
||||
local is_neovide = false
|
||||
local use_noice = true
|
||||
-- if vim.g.neovide then
|
||||
-- is_neovide = true
|
||||
-- use_noice = false
|
||||
-- end
|
||||
-- vim.opt.lazyredraw = is_neovide
|
||||
return {
|
||||
-- { "gelguy/wilder.nvim", enabled = not use_noice },
|
||||
-- {
|
||||
-- "folke/noice.nvim",
|
||||
-- lazy = true,
|
||||
-- enabled = use_noice,
|
||||
-- dependencies = {
|
||||
-- { "MunifTanjim/nui.nvim", enabled = use_noice },
|
||||
-- },
|
||||
-- -- event = "BufWinEnter",
|
||||
-- event = "VeryLazy",
|
||||
-- opts = {
|
||||
-- messages = {
|
||||
-- enabled = false,
|
||||
-- },
|
||||
-- notify = {
|
||||
-- enabled = false,
|
||||
-- },
|
||||
-- lsp = {
|
||||
-- progress = {
|
||||
-- enabled = false,
|
||||
-- },
|
||||
-- hover = {
|
||||
-- enabled = false,
|
||||
-- },
|
||||
-- signature = {
|
||||
-- enabled = false,
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- init = function()
|
||||
-- -- load if mode command mode
|
||||
-- -- vim.api.nvim_create_autocmd("CmdlineEnter", {
|
||||
-- -- callback = function()
|
||||
-- -- require("lazy").load({ plugins = { "noice.nvim" } })
|
||||
-- -- end,
|
||||
-- -- })
|
||||
-- -- require("lazy").load({ plugins = { "noice.nvim" } })
|
||||
-- end,
|
||||
-- keys = {
|
||||
-- {
|
||||
-- "<S-Enter>",
|
||||
-- function()
|
||||
-- require("noice").redirect(vim.fn.getcmdline())
|
||||
-- end,
|
||||
-- mode = "c",
|
||||
-- desc = "Redirect Cmdline",
|
||||
-- },
|
||||
-- {
|
||||
-- "<leader>snl",
|
||||
-- function()
|
||||
-- require("noice").cmd("last")
|
||||
-- end,
|
||||
-- desc = "Noice Last Message",
|
||||
-- },
|
||||
-- {
|
||||
-- "<leader>snh",
|
||||
-- function()
|
||||
-- require("noice").cmd("history")
|
||||
-- end,
|
||||
-- desc = "Noice History",
|
||||
-- },
|
||||
-- {
|
||||
-- "<leader>sna",
|
||||
-- function()
|
||||
-- require("noice").cmd("all")
|
||||
-- end,
|
||||
-- desc = "Noice All",
|
||||
-- },
|
||||
-- {
|
||||
-- "<c-f>",
|
||||
-- function()
|
||||
-- if not require("noice.lsp").scroll(4) then
|
||||
-- return "<c-f>"
|
||||
-- end
|
||||
-- end,
|
||||
-- silent = true,
|
||||
-- expr = true,
|
||||
-- desc = "Scroll forward",
|
||||
-- mode = { "i", "n", "s" },
|
||||
-- },
|
||||
-- {
|
||||
-- "<c-b>",
|
||||
-- function()
|
||||
-- if not require("noice.lsp").scroll(-4) then
|
||||
-- return "<c-b>"
|
||||
-- end
|
||||
-- end,
|
||||
-- silent = true,
|
||||
-- expr = true,
|
||||
-- desc = "Scroll backward",
|
||||
-- mode = { "i", "n", "s" },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- {
|
||||
-- "hrsh7th/cmp-cmdline",
|
||||
-- event = "VeryLazy",
|
||||
-- enabled = use_noice,
|
||||
-- init = function()
|
||||
-- -- load if mode command mode
|
||||
-- -- vim.api.nvim_create_autocmd("CmdlineEnter", {
|
||||
-- -- callback = function()
|
||||
-- -- require("lazy").load({ plugins = { "cmp-cmdline" } })
|
||||
-- -- end,
|
||||
-- -- })
|
||||
-- end,
|
||||
-- config = function()
|
||||
-- local cmp = require("cmp")
|
||||
-- local mapping = {
|
||||
-- ["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
-- ["<Up>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
|
||||
-- ["<S-Tab>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
|
||||
-- ["<Down>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
|
||||
-- ["<Tab>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
|
||||
-- }
|
||||
--
|
||||
-- -- Use buffer source for `/`.
|
||||
-- cmp.setup.cmdline("/", {
|
||||
-- preselect = "none",
|
||||
-- completion = {
|
||||
-- completeopt = "menu,preview,menuone,noselect",
|
||||
-- },
|
||||
-- mapping = mapping,
|
||||
-- sources = {
|
||||
-- { name = "buffer" },
|
||||
-- },
|
||||
-- experimental = {
|
||||
-- ghost_text = true,
|
||||
-- native_menu = false,
|
||||
-- },
|
||||
-- })
|
||||
--
|
||||
-- -- Use cmdline & path source for ':'.
|
||||
-- cmp.setup.cmdline(":", {
|
||||
-- preselect = "none",
|
||||
-- completion = {
|
||||
-- completeopt = "menu,preview,menuone,noselect",
|
||||
-- },
|
||||
-- mapping = mapping,
|
||||
-- sources = cmp.config.sources({
|
||||
-- { name = "path" },
|
||||
-- }, {
|
||||
-- { name = "cmdline" },
|
||||
-- }),
|
||||
-- experimental = {
|
||||
-- ghost_text = true,
|
||||
-- native_menu = false,
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
-- },
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
return {
|
||||
-- {
|
||||
-- "navarasu/onedark.nvim",
|
||||
-- enabled = false,
|
||||
-- },
|
||||
-- {
|
||||
-- "projekt0n/github-nvim-theme",
|
||||
-- lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
||||
-- priority = 1000, -- make sure to load this before all the other start plugins
|
||||
-- config = function()
|
||||
-- local is_transparent = false
|
||||
-- local palette = require("github-theme.palette").load("github_dark_dimmed")
|
||||
-- require("github-theme").setup({
|
||||
-- options = {
|
||||
-- -- Compiled file's destination location
|
||||
-- compile_path = vim.fn.stdpath("cache") .. "/github-theme",
|
||||
-- compile_file_suffix = "_compiled", -- Compiled file suffix
|
||||
-- hide_end_of_buffer = true, -- Hide the '~' character at the end of the buffer for a cleaner look
|
||||
-- hide_nc_statusline = true, -- Override the underline style for non-active statuslines
|
||||
-- transparent = is_transparent, -- Disable setting background
|
||||
-- terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal`
|
||||
-- dim_inactive = false, -- Non focused panes set to alternative background
|
||||
-- module_default = true, -- Default enable value for modules
|
||||
-- styles = { -- Style to be applied to different syntax groups
|
||||
-- comments = "italic", -- Value is any valid attr-list value `:help attr-list`
|
||||
-- functions = "italic",
|
||||
-- keywords = "NONE",
|
||||
-- variables = "NONE",
|
||||
-- conditionals = "NONE",
|
||||
-- constants = "NONE",
|
||||
-- numbers = "NONE",
|
||||
-- operators = "NONE",
|
||||
-- strings = "NONE",
|
||||
-- types = "NONE",
|
||||
-- },
|
||||
-- inverse = { -- Inverse highlight for different types
|
||||
-- match_paren = false,
|
||||
-- visual = false,
|
||||
-- search = false,
|
||||
-- },
|
||||
-- darken = { -- Darken floating windows and sidebar-like windows
|
||||
-- floats = false,
|
||||
-- sidebars = {
|
||||
-- enabled = true,
|
||||
-- list = {}, -- Apply dark background to specific windows
|
||||
-- },
|
||||
-- },
|
||||
-- modules = { -- List of various plugins and additional options
|
||||
-- -- ...
|
||||
-- },
|
||||
-- },
|
||||
-- palettes = {
|
||||
-- github_dark_dimmed = {
|
||||
-- bg0 = is_transparent and "NONE" or "bg1",
|
||||
-- bg1 = is_transparent and "NONE" or "bg",
|
||||
-- },
|
||||
-- },
|
||||
-- specs = {},
|
||||
-- groups = {
|
||||
-- all = {
|
||||
-- illuminatedWord = { bg = "#3b4261" },
|
||||
-- illuminatedCurWord = { bg = "#3b4261" },
|
||||
-- IlluminatedWordText = { bg = "#3b4261" },
|
||||
-- IlluminatedWordRead = { bg = "#3b4261" },
|
||||
-- IlluminatedWordWrite = { bg = "#3b4261" },
|
||||
-- ["@tag.attribute"] = { fg = "#77bdfb", style = "italic" },
|
||||
-- ["@text.uri"] = { fg = palette.const, style = "italic" },
|
||||
-- ["@keyword.return"] = { fg = "#fa7970", style = "italic" },
|
||||
-- -- ["@tag.attribute.html"] = { fg = "#faa356", style = "italic" },
|
||||
-- -- ["@operator.html"] = { fg = "#faa356" },
|
||||
-- -- ["@tag.html"] = { fg = "#fa7970" },
|
||||
-- -- ["@tag.delimiter.html"] = { fg = "#faa356" },
|
||||
-- -- ["@tag.javascript"] = { fg = "#faa356" },
|
||||
-- -- ["@tag.javascript"] = { fg = "#8ddb8c" },
|
||||
-- -- ["@tag.tsx"] = { fg = "#8ddb8c" },
|
||||
-- ["@string.special.url"] = { fg = palette.const, style = "italic" },
|
||||
-- ["@tag.delimiter.javascript"] = { fg = "fg1" },
|
||||
-- ["@tag.tsx"] = { fg = "#faa356" },
|
||||
-- ["@lsp.type.parameter"] = { fg = "#faa356" },
|
||||
-- ["@property.lua"] = { fg = "#91cbff", bg = is_transparent and "NONE" or "bg1" },
|
||||
-- ["@lsp.type.property.lua"] = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" },
|
||||
-- ["@lsp.type.variable.lua"] = { fg = "#91cbff", bg = is_transparent and "NONE" or "bg1" },
|
||||
-- },
|
||||
-- github_dark_high_contrast = {
|
||||
-- NvimTreeSpecialFile = { fg = "#faa356", style = "italic" },
|
||||
-- },
|
||||
-- github_dark_dimmed = {
|
||||
-- -- As with specs and palettes, a specific style's value will be used over the `all`'s value.
|
||||
-- NvimTreeNormal = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" },
|
||||
-- NvimTreeSpecialFile = { fg = "#faa356", style = "italic" },
|
||||
-- NvimTreeIndentMarker = { fg = "#3E4450" },
|
||||
-- BufferLineFill = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- BufferLineUnfocusedFill = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- LualineNormal = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- StatusLine = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- StatusLineTerm = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- Pmenu = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- PmenuSel = { link = "CursorLine" },
|
||||
-- WhichKeyFloat = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- LazyNormal = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- LazyBackground = { bg = is_transparent and "NONE" or "bg1" },
|
||||
-- NormalSB = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" }, -- normal text
|
||||
-- NormalFloat = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" },
|
||||
-- IblIndent = { fg = "#3E4450" },
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
-- },
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
return {
|
||||
-- {
|
||||
-- "https://github.com/adelarsq/image_preview.nvim",
|
||||
-- event = "VeryLazy",
|
||||
-- config = function()
|
||||
-- require("image_preview").setup()
|
||||
-- end,
|
||||
-- },
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
local icons = vim.g.pcode_icons
|
||||
return {
|
||||
--- masukan plugin tambahan disini
|
||||
-- {
|
||||
-- "folke/trouble.nvim",
|
||||
-- event = "BufRead",
|
||||
-- cmd = { "TroubleToggle", "Trouble" },
|
||||
-- opts = { use_diagnostic_signs = true },
|
||||
-- keys = {
|
||||
-- {
|
||||
-- "<leader>xx",
|
||||
-- "<cmd>TroubleToggle document_diagnostics<cr>",
|
||||
-- desc = "Document Diagnostics (Trouble)",
|
||||
-- },
|
||||
-- {
|
||||
-- "<leader>xX",
|
||||
-- "<cmd>TroubleToggle workspace_diagnostics<cr>",
|
||||
-- desc = "Workspace Diagnostics (Trouble)",
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- {
|
||||
-- "echasnovski/mini.indentscope",
|
||||
-- version = false, -- wait till new 0.7.0 release to put it back on semver
|
||||
-- event = "BufReadPre",
|
||||
-- opts = {
|
||||
-- -- symbol = "▏",
|
||||
-- -- symbol = "│",
|
||||
-- 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,
|
||||
-- },
|
||||
-- {
|
||||
-- "hrsh7th/cmp-nvim-lua",
|
||||
-- enabled = false,
|
||||
-- },
|
||||
-- {
|
||||
-- "gbprod/yanky.nvim",
|
||||
-- event = "BufReadPre",
|
||||
-- config = function()
|
||||
-- require("user.yanky")
|
||||
-- end,
|
||||
-- },
|
||||
-- {
|
||||
-- "is0n/jaq-nvim",
|
||||
-- event = "BufRead",
|
||||
-- config = function()
|
||||
-- require("user.jaq")
|
||||
-- end,
|
||||
-- },
|
||||
-- better todo coloring and icon
|
||||
-- {
|
||||
-- "folke/todo-comments.nvim",
|
||||
-- event = { "BufReadPost", "BufNewFile" },
|
||||
-- config = function()
|
||||
-- require("todo-comments").setup()
|
||||
-- end,
|
||||
-- },
|
||||
-- mini scrollview
|
||||
-- {
|
||||
-- "karb94/neoscroll.nvim",
|
||||
-- event = "BufRead",
|
||||
-- config = function()
|
||||
-- require("user.neoscroll")
|
||||
-- end,
|
||||
-- },
|
||||
|
||||
-- { "ahmedkhalf/project.nvim", commit = "628de7e433dd503e782831fe150bb750e56e55d6", event = "VeryLazy" }, --
|
||||
-- additional plugins
|
||||
-- makes some plugins dot-repeatable like leap
|
||||
-- { "tpope/vim-repeat", event = "VeryLazy" },
|
||||
-- better diagnostics list and others
|
||||
-- for markdown preview
|
||||
-- make sure already install npm and yarn
|
||||
-- {
|
||||
-- "iamcco/markdown-preview.nvim",
|
||||
-- event = "VeryLazy",
|
||||
-- build = "cd app && npm install",
|
||||
-- init = function()
|
||||
-- vim.g.mkdp_filetypes = { "markdown" }
|
||||
-- end,
|
||||
-- ft = { "markdown" },
|
||||
-- cmd = { "MarkdownPreview", "MarkdownPreviewStop", "MarkdownPreviewToggle" },
|
||||
-- },
|
||||
-- for codeGPT
|
||||
-- {
|
||||
-- "jackMort/ChatGPT.nvim",
|
||||
-- dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim" },
|
||||
-- lazy = true,
|
||||
-- event = "VeryLazy",
|
||||
-- -- opts = function()
|
||||
-- -- require("user.chat_gpt")
|
||||
-- -- end,
|
||||
-- },
|
||||
-- indent detection
|
||||
-- {
|
||||
-- "Darazaki/indent-o-matic",
|
||||
-- event = "VeryLazy",
|
||||
-- opt = true,
|
||||
-- cmd = { "IndentOMatic" },
|
||||
-- config = function()
|
||||
-- require("user.indent-o-matic")
|
||||
-- end,
|
||||
-- },
|
||||
-- Khusus Projek laravel baru di buka
|
||||
-- {
|
||||
-- "adalessa/laravel.nvim",
|
||||
-- dependencies = {
|
||||
-- "nvim-telescope/telescope.nvim",
|
||||
-- },
|
||||
-- cmd = { "Sail", "Artisan", "Composer" },
|
||||
-- keys = {
|
||||
-- { "<leader>pa", ":Artisan<cr>" },
|
||||
-- },
|
||||
-- config = function()
|
||||
-- require("laravel").setup()
|
||||
-- require("telescope").load_extension("laravel")
|
||||
-- end,
|
||||
-- },
|
||||
-- --
|
||||
-- {
|
||||
-- "barrett-ruth/live-server.nvim",
|
||||
-- build = "yarn global add live-server",
|
||||
-- config = true,
|
||||
-- init = function()
|
||||
-- require("live-server").setup({
|
||||
-- -- Arguments passed to live-server via `vim.fn.jobstart()`
|
||||
-- -- Run `live-server --help` to see list of available options
|
||||
-- -- For example, to use port 7000 and browser firefox:
|
||||
-- args = { "--port=7000", "--browser=firefox" },
|
||||
-- --args = {},
|
||||
-- })
|
||||
-- end,
|
||||
-- },
|
||||
-- for install lsp tidak support mason
|
||||
-- {
|
||||
-- "williamboman/nvim-lsp-installer",
|
||||
-- event = "BufRead",
|
||||
-- lazy = true,
|
||||
-- config = function()
|
||||
-- require("user.lsp.config")
|
||||
-- end,
|
||||
-- },
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
return {
|
||||
-- { "mfussenegger/nvim-jdtls", event = "BufRead" },
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
return {
|
||||
-- "ErichDonGubler/lsp_lines.nvim",
|
||||
-- event = "BufRead",
|
||||
-- config = function()
|
||||
-- require("lsp_lines").setup()
|
||||
-- vim.api.nvim_create_autocmd("FileType", {
|
||||
-- pattern = { "*" }, --ini untuk file yang tidak ingin dibaca
|
||||
-- callback = function()
|
||||
-- local exclude_ft = {
|
||||
-- "lazy",
|
||||
-- }
|
||||
-- if vim.tbl_contains(exclude_ft, vim.o.filetype) then
|
||||
-- vim.diagnostic.config({ virtual_lines = false })
|
||||
-- else
|
||||
-- vim.diagnostic.config({ virtual_lines = true })
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
||||
-- end,
|
||||
}
|
|
@ -1,243 +0,0 @@
|
|||
return {
|
||||
-- {
|
||||
-- "nvim-lualine/lualine.nvim",
|
||||
-- event = "InsertEnter",
|
||||
-- config = function()
|
||||
-- local hide_in_width = function()
|
||||
-- return vim.fn.winwidth(0) > 80
|
||||
-- end
|
||||
-- local icons = require("user.icons")
|
||||
--
|
||||
-- local getLeftSubstring = function(word, length)
|
||||
-- if #word > length then
|
||||
-- return string.sub(word, 1, length) .. "..."
|
||||
-- else
|
||||
-- return word
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- -- start for lsp
|
||||
-- local list_registered_providers_names = function(filetype)
|
||||
-- local s = require("null-ls.sources")
|
||||
-- local available_sources = s.get_available(filetype)
|
||||
-- local registered = {}
|
||||
-- for _, source in ipairs(available_sources) do
|
||||
-- for method in pairs(source.methods) do
|
||||
-- registered[method] = registered[method] or {}
|
||||
-- table.insert(registered[method], source.name)
|
||||
-- end
|
||||
-- end
|
||||
-- return registered
|
||||
-- end
|
||||
--
|
||||
-- local null_ls = require("null-ls")
|
||||
-- -- for formatter
|
||||
-- local list_registered = function(filetype)
|
||||
-- local method = null_ls.methods.FORMATTING
|
||||
-- local registered_providers = list_registered_providers_names(filetype)
|
||||
-- return registered_providers[method] or {}
|
||||
-- end
|
||||
--
|
||||
-- --- for linter
|
||||
-- local alternative_methods = {
|
||||
-- null_ls.methods.DIAGNOSTICS,
|
||||
-- null_ls.methods.DIAGNOSTICS_ON_OPEN,
|
||||
-- null_ls.methods.DIAGNOSTICS_ON_SAVE,
|
||||
-- }
|
||||
--
|
||||
-- local linter_list_registered = function(filetype)
|
||||
-- local registered_providers = list_registered_providers_names(filetype)
|
||||
-- -- local providers_for_methods = vim.tbl_flatten(vim.tbl_map(function(m)
|
||||
-- -- return registered_providers[m] or {}
|
||||
-- -- end, alternative_methods))
|
||||
-- local providers_for_methods = vim.iter(vim.tbl_map(function(m)
|
||||
-- return registered_providers[m] or {}
|
||||
-- end, alternative_methods))
|
||||
--
|
||||
-- return providers_for_methods
|
||||
-- end
|
||||
-- -- end for lsp
|
||||
--
|
||||
-- local lsp_info = {
|
||||
-- function()
|
||||
-- local msg = "LS Inactive"
|
||||
-- local buf_ft = vim.bo.filetype
|
||||
-- -- start register
|
||||
-- local buf_clients = vim.lsp.get_clients()
|
||||
-- local buf_client_names = {}
|
||||
-- if next(buf_clients) == nil then
|
||||
-- -- TODO: clean up this if statement
|
||||
-- if type(msg) == "boolean" or #msg == 0 then
|
||||
-- return "LS Inactive"
|
||||
-- end
|
||||
-- return msg
|
||||
-- end
|
||||
-- -- add client
|
||||
-- for _, client in pairs(buf_clients) do
|
||||
-- if client.name ~= "null-ls" and client.name ~= "copilot" then
|
||||
-- table.insert(buf_client_names, client.name)
|
||||
-- end
|
||||
-- end
|
||||
-- -- add formatter
|
||||
-- local supported_formatters = list_registered(buf_ft)
|
||||
-- vim.list_extend(buf_client_names, supported_formatters)
|
||||
-- -- add linter
|
||||
-- local supported_linters = linter_list_registered(buf_ft)
|
||||
-- vim.list_extend(buf_client_names, supported_linters)
|
||||
-- -- decomple
|
||||
-- local unique_client_names = vim.fn.uniq(buf_client_names)
|
||||
-- local msg = table.concat(unique_client_names, ", ")
|
||||
-- return msg
|
||||
-- end,
|
||||
-- --icon = " ",
|
||||
-- icon = icons.ui.Gear .. "",
|
||||
-- padding = 1,
|
||||
-- }
|
||||
--
|
||||
-- local diagnostics = {
|
||||
-- "diagnostics",
|
||||
-- sources = { "nvim_diagnostic" },
|
||||
-- sections = { "error", "warn" },
|
||||
-- -- symbols = { error = " ", warn = " " },
|
||||
-- symbols = {
|
||||
-- error = icons.diagnostics.BoldError .. " ",
|
||||
-- warn = icons.diagnostics.BoldWarning .. " ",
|
||||
-- },
|
||||
-- colored = true,
|
||||
-- update_in_insert = false,
|
||||
-- always_visible = false,
|
||||
-- }
|
||||
--
|
||||
-- local diff = {
|
||||
-- "diff",
|
||||
-- colored = true,
|
||||
-- -- symbols = { added = " ", modified = " ", removed = " " }, -- changes diff symbols
|
||||
-- symbols = {
|
||||
-- added = icons.git.LineAdded .. " ",
|
||||
-- modified = icons.git.LineModified .. " ",
|
||||
-- removed = icons.git.LineRemoved .. " ",
|
||||
-- }, -- changes diff symbols
|
||||
-- cond = hide_in_width,
|
||||
-- }
|
||||
--
|
||||
-- local spaces = function()
|
||||
-- -- return " " .. vim.api.nvim_buf_get_option(0, "shiftwidth")
|
||||
-- return icons.ui.Tab .. " " .. vim.api.nvim_get_option_value(0, "shiftwidth")
|
||||
-- end
|
||||
--
|
||||
-- local mode = {
|
||||
-- "mode",
|
||||
-- padding = 1,
|
||||
-- separator = { left = " " },
|
||||
-- -- right_padding = 3,
|
||||
-- fmt = function(str)
|
||||
-- return icons.ui.Neovim .. " " .. str
|
||||
-- end,
|
||||
-- }
|
||||
-- local branch = {
|
||||
-- "branch",
|
||||
-- padding = 1,
|
||||
-- }
|
||||
--
|
||||
-- local get_branch = function()
|
||||
-- if vim.b.gitsigns_head ~= nil then
|
||||
-- return icons.git.Branch2 .. " " .. getLeftSubstring(vim.b.gitsigns_head, 6)
|
||||
-- else
|
||||
-- return icons.git.Branch2 .. vim.fn.fnamemodify("", ":t")
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- local lsp_progress = {}
|
||||
-- local data_ok, lspprogress = pcall(require, "lsp-progress")
|
||||
-- if data_ok then
|
||||
-- lsp_progress = lspprogress.progress
|
||||
-- end
|
||||
-- -- stylua: ignore
|
||||
-- -- local github=vim.fn.fnamemodify("auto", ":t")
|
||||
-- local github={}
|
||||
-- local status_ok, _ = pcall(require, "github-theme")
|
||||
-- if status_ok then
|
||||
-- local C = require("github-theme.lib.color")
|
||||
-- local config = require("github-theme.config").options
|
||||
-- local s = require("github-theme.spec").load("github_dark_dimmed")
|
||||
-- local p = s.palette
|
||||
-- local tbg = config.transparent and "NONE" or s.bg0
|
||||
--
|
||||
-- local function blend(color, a)
|
||||
-- return C(s.bg1):blend(C(color), a):to_css()
|
||||
-- end
|
||||
--
|
||||
-- --- Create lualine group colors for github-theme
|
||||
-- ---@param color string
|
||||
-- local tint = function(color)
|
||||
-- return {
|
||||
-- a = { bg = color, fg = s.bg1 },
|
||||
-- b = { bg = blend(color, 0.2), fg = blend(color, 0.8) },
|
||||
-- c = { bg = "NONE", fg = blend(color, 0.60) },
|
||||
-- }
|
||||
-- end
|
||||
--
|
||||
-- local inactive_hi = { bg = tbg, fg = blend(s.fg1, 0.3) }
|
||||
-- github = {
|
||||
-- normal = tint(p.blue.base),
|
||||
-- insert = tint(p.green.base),
|
||||
-- command = tint(p.magenta.bright),
|
||||
-- visual = tint(p.yellow.base),
|
||||
-- replace = tint(p.red.base),
|
||||
-- terminal = tint(p.orange),
|
||||
-- inactive = {
|
||||
-- a = inactive_hi,
|
||||
-- b = inactive_hi,
|
||||
-- c = inactive_hi,
|
||||
-- },
|
||||
-- }
|
||||
-- end
|
||||
--
|
||||
-- require("lualine").setup({
|
||||
-- options = {
|
||||
-- theme = github or "auto",
|
||||
-- -- theme = "auto",
|
||||
-- component_separators = { left = "", right = "" },
|
||||
-- section_separators = { left = "", right = "" },
|
||||
-- disabled_filetypes = {
|
||||
-- "TelescopePrompt",
|
||||
-- "packer",
|
||||
-- "alpha",
|
||||
-- "dashboard",
|
||||
-- "NvimTree",
|
||||
-- "Outline",
|
||||
-- "DressingInput",
|
||||
-- "toggleterm",
|
||||
-- "lazy",
|
||||
-- "mason",
|
||||
-- "neo-tree",
|
||||
-- "startuptime",
|
||||
-- },
|
||||
-- always_divide_middle = true,
|
||||
-- },
|
||||
-- sections = {
|
||||
-- lualine_a = {
|
||||
-- mode,
|
||||
-- },
|
||||
-- lualine_b = { get_branch },
|
||||
-- lualine_c = { lsp_info, diagnostics, lsp_progress },
|
||||
-- lualine_x = { diff, spaces, "filetype" },
|
||||
-- lualine_y = { "progress" },
|
||||
-- lualine_z = {
|
||||
-- { "location", separator = { right = " " }, padding = 1 },
|
||||
-- },
|
||||
-- },
|
||||
-- inactive_sections = {
|
||||
-- lualine_a = { "filename" },
|
||||
-- lualine_b = {},
|
||||
-- lualine_c = {},
|
||||
-- lualine_x = {},
|
||||
-- lualine_y = {},
|
||||
-- lualine_z = { "location" },
|
||||
-- },
|
||||
-- tabline = {},
|
||||
-- extensions = {},
|
||||
-- })
|
||||
-- end,
|
||||
-- },
|
||||
}
|
|
@ -1,249 +0,0 @@
|
|||
return {
|
||||
-- {
|
||||
-- "nvim-lualine/lualine.nvim",
|
||||
-- event = "InsertEnter",
|
||||
-- config = function()
|
||||
-- local hide_in_width = function()
|
||||
-- return vim.fn.winwidth(0) > 80
|
||||
-- end
|
||||
-- local icons = require("user.icons")
|
||||
--
|
||||
-- local getLeftSubstring = function(word, length)
|
||||
-- if #word > length then
|
||||
-- return string.sub(word, 1, length) .. "..."
|
||||
-- else
|
||||
-- return word
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- -- start for lsp
|
||||
-- local list_registered_providers_names = function(filetype)
|
||||
-- local s = require("null-ls.sources")
|
||||
-- local available_sources = s.get_available(filetype)
|
||||
-- local registered = {}
|
||||
-- for _, source in ipairs(available_sources) do
|
||||
-- for method in pairs(source.methods) do
|
||||
-- registered[method] = registered[method] or {}
|
||||
-- table.insert(registered[method], source.name)
|
||||
-- end
|
||||
-- end
|
||||
-- return registered
|
||||
-- end
|
||||
--
|
||||
-- local null_ls = require("null-ls")
|
||||
-- -- for formatter
|
||||
-- local list_registered = function(filetype)
|
||||
-- local method = null_ls.methods.FORMATTING
|
||||
-- local registered_providers = list_registered_providers_names(filetype)
|
||||
-- return registered_providers[method] or {}
|
||||
-- end
|
||||
--
|
||||
-- --- for linter
|
||||
-- local alternative_methods = {
|
||||
-- null_ls.methods.DIAGNOSTICS,
|
||||
-- null_ls.methods.DIAGNOSTICS_ON_OPEN,
|
||||
-- null_ls.methods.DIAGNOSTICS_ON_SAVE,
|
||||
-- }
|
||||
--
|
||||
-- local linter_list_registered = function(filetype)
|
||||
-- local registered_providers = list_registered_providers_names(filetype)
|
||||
-- local providers_for_methods = vim.iter(vim.tbl_map(function(m)
|
||||
-- return registered_providers[m] or {}
|
||||
-- end, alternative_methods))
|
||||
--
|
||||
-- return providers_for_methods
|
||||
-- end
|
||||
-- -- end for lsp
|
||||
--
|
||||
-- local lsp_info = {
|
||||
-- function()
|
||||
-- local msg = "LS Inactive"
|
||||
-- local buf_ft = vim.bo.filetype
|
||||
-- -- start register
|
||||
-- local buf_clients = {}
|
||||
-- buf_clients = vim.lsp.get_clients({ bufnr = 0 })
|
||||
-- local buf_client_names = {}
|
||||
-- if next(buf_clients) == nil then
|
||||
-- -- TODO: clean up this if statement
|
||||
-- if type(msg) == "boolean" or #msg == 0 then
|
||||
-- return "LS Inactive"
|
||||
-- end
|
||||
-- return msg
|
||||
-- end
|
||||
-- -- add client
|
||||
-- for _, client in pairs(buf_clients) do
|
||||
-- if client.name ~= "null-ls" and client.name ~= "copilot" then
|
||||
-- table.insert(buf_client_names, client.name)
|
||||
-- end
|
||||
-- end
|
||||
-- -- add formatter
|
||||
-- local supported_formatters = list_registered(buf_ft)
|
||||
-- vim.list_extend(buf_client_names, supported_formatters)
|
||||
-- -- add linter
|
||||
-- local supported_linters = linter_list_registered(buf_ft)
|
||||
-- vim.list_extend(buf_client_names, supported_linters)
|
||||
-- -- decomple
|
||||
-- local unique_client_names = vim.fn.uniq(buf_client_names)
|
||||
-- local msg = table.concat(unique_client_names, ", ")
|
||||
-- return msg
|
||||
-- end,
|
||||
-- --icon = " ",
|
||||
-- icon = icons.ui.Gear .. "",
|
||||
-- padding = 1,
|
||||
-- }
|
||||
--
|
||||
-- local diagnostics = {
|
||||
-- "diagnostics",
|
||||
-- sources = { "nvim_diagnostic" },
|
||||
-- sections = { "error", "warn" },
|
||||
-- -- symbols = { error = " ", warn = " " },
|
||||
-- symbols = {
|
||||
-- error = icons.diagnostics.BoldError .. " ",
|
||||
-- warn = icons.diagnostics.BoldWarning .. " ",
|
||||
-- },
|
||||
-- colored = true,
|
||||
-- update_in_insert = false,
|
||||
-- always_visible = false,
|
||||
-- }
|
||||
--
|
||||
-- local diff = {
|
||||
-- "diff",
|
||||
-- colored = true,
|
||||
-- -- symbols = { added = " ", modified = " ", removed = " " }, -- changes diff symbols
|
||||
-- symbols = {
|
||||
-- added = icons.git.LineAdded .. " ",
|
||||
-- modified = icons.git.LineModified .. " ",
|
||||
-- removed = icons.git.LineRemoved .. " ",
|
||||
-- }, -- changes diff symbols
|
||||
-- cond = hide_in_width,
|
||||
-- }
|
||||
--
|
||||
-- local spaces = function()
|
||||
-- -- return " " .. vim.api.nvim_buf_get_option(0, "shiftwidth")
|
||||
-- return icons.ui.Tab .. " " .. vim.api.nvim_get_option_value(0, "shiftwidth")
|
||||
-- end
|
||||
--
|
||||
-- local mode = {
|
||||
-- "mode",
|
||||
-- padding = 1,
|
||||
-- separator = { left = " " },
|
||||
-- -- right_padding = 3,
|
||||
-- fmt = function(str)
|
||||
-- return icons.ui.Neovim .. " " .. str
|
||||
-- end,
|
||||
-- }
|
||||
-- local branch = {
|
||||
-- "branch",
|
||||
-- padding = 1,
|
||||
-- }
|
||||
--
|
||||
-- local get_branch = function()
|
||||
-- if vim.b.gitsigns_head ~= nil then
|
||||
-- return icons.git.Branch2 .. " " .. getLeftSubstring(vim.b.gitsigns_head, 6)
|
||||
-- else
|
||||
-- return icons.git.Branch2 .. vim.fn.fnamemodify("", ":t")
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- local lsp_progress = {}
|
||||
-- local data_ok, lspprogress = pcall(require, "lsp-progress")
|
||||
-- if data_ok then
|
||||
-- lsp_progress = lspprogress.progress
|
||||
-- end
|
||||
-- -- stylua: ignore
|
||||
-- -- local onedark=vim.fn.fnamemodify("auto", ":t")
|
||||
-- local onedark={}
|
||||
-- local is_transparat = true
|
||||
-- local status_ok, onedarkpro = pcall(require, "onedarkpro.helpers")
|
||||
-- if status_ok then
|
||||
-- local colors = onedarkpro.get_colors("onedark")
|
||||
--
|
||||
-- onedark = {
|
||||
-- normal = {
|
||||
-- a = { bg = colors.green, fg = colors.bg },
|
||||
-- b = { bg = colors.fg_gutter, fg = colors.green },
|
||||
-- c = {
|
||||
-- bg = is_transparat and colors.none or colors.bg_statusline,
|
||||
-- fg = colors.fg,
|
||||
-- },
|
||||
-- },
|
||||
--
|
||||
-- insert = {
|
||||
-- a = { bg = colors.blue, fg = colors.bg },
|
||||
-- b = { bg = colors.fg_gutter, fg = colors.blue },
|
||||
-- },
|
||||
-- visual = {
|
||||
-- a = { bg = colors.yellow, fg = colors.bg },
|
||||
-- b = { bg = colors.fg_gutter, fg = colors.yellow },
|
||||
-- },
|
||||
-- replace = {
|
||||
-- a = { bg = colors.red, fg = colors.bg },
|
||||
-- b = { bg = colors.fg_gutter, fg = colors.red },
|
||||
-- },
|
||||
-- command = {
|
||||
-- a = { bg = colors.purple, fg = colors.bg },
|
||||
-- b = { bg = colors.fg_gutter, fg = colors.purple },
|
||||
-- },
|
||||
-- terminal = {
|
||||
-- a = { bg = colors.cyan, fg = colors.bg },
|
||||
-- b = { bg = colors.fg_gutter, fg = colors.cyan },
|
||||
-- },
|
||||
-- inactive = {
|
||||
-- a = { bg = colors.bg, fg = colors.blue },
|
||||
-- b = { bg = colors.bg, fg = colors.fg_gutter_inactive, gui = "bold" },
|
||||
-- c = {
|
||||
-- bg = is_transparat and colors.none or colors.bg,
|
||||
-- fg = colors.fg_gutter_inactive,
|
||||
-- },
|
||||
-- },
|
||||
-- }
|
||||
-- end
|
||||
--
|
||||
-- require("lualine").setup({
|
||||
-- options = {
|
||||
-- theme = onedark,
|
||||
-- -- theme = "auto",
|
||||
-- component_separators = { left = "", right = "" },
|
||||
-- section_separators = { left = "", right = "" },
|
||||
-- disabled_filetypes = {
|
||||
-- "TelescopePrompt",
|
||||
-- "packer",
|
||||
-- "alpha",
|
||||
-- "dashboard",
|
||||
-- "NvimTree",
|
||||
-- "Outline",
|
||||
-- "DressingInput",
|
||||
-- "toggleterm",
|
||||
-- "lazy",
|
||||
-- "mason",
|
||||
-- "neo-tree",
|
||||
-- "startuptime",
|
||||
-- },
|
||||
-- always_divide_middle = true,
|
||||
-- },
|
||||
-- sections = {
|
||||
-- lualine_a = {
|
||||
-- mode,
|
||||
-- },
|
||||
-- lualine_b = { get_branch },
|
||||
-- lualine_c = { lsp_info, diagnostics, lsp_progress },
|
||||
-- lualine_x = { diff, spaces, "filetype" },
|
||||
-- lualine_y = { "progress" },
|
||||
-- lualine_z = {
|
||||
-- { "location", separator = { right = " " }, padding = 1 },
|
||||
-- },
|
||||
-- },
|
||||
-- inactive_sections = {
|
||||
-- lualine_a = { "filename" },
|
||||
-- lualine_b = {},
|
||||
-- lualine_c = {},
|
||||
-- lualine_x = {},
|
||||
-- lualine_y = {},
|
||||
-- lualine_z = { "location" },
|
||||
-- },
|
||||
-- tabline = {},
|
||||
-- extensions = {},
|
||||
-- })
|
||||
-- end,
|
||||
-- },
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
local is_neovide = false
|
||||
if vim.g.neovide then
|
||||
is_neovide = true
|
||||
end
|
||||
|
||||
return {
|
||||
-- animations
|
||||
-- {
|
||||
-- "echasnovski/mini.animate",
|
||||
-- event = "BufRead",
|
||||
-- enabled = not is_neovide,
|
||||
-- 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,
|
||||
-- }),
|
||||
-- },
|
||||
-- }
|
||||
-- end,
|
||||
-- config = function(_, opts)
|
||||
-- require("mini.animate").setup(opts)
|
||||
-- end,
|
||||
-- },
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
return {
|
||||
-- "echasnovski/mini.map",
|
||||
-- branch = "stable",
|
||||
-- event = "BufRead",
|
||||
-- config = function()
|
||||
-- require("mini.map").setup()
|
||||
-- local map = require("mini.map")
|
||||
-- map.setup({
|
||||
-- integrations = {
|
||||
-- map.gen_integration.builtin_search(),
|
||||
-- map.gen_integration.diagnostic({
|
||||
-- error = "DiagnosticFloatingError",
|
||||
-- warn = "DiagnosticFloatingWarn",
|
||||
-- info = "DiagnosticFloatingInfo",
|
||||
-- hint = "DiagnosticFloatingHint",
|
||||
-- }),
|
||||
-- },
|
||||
-- symbols = {
|
||||
-- encode = map.gen_encode_symbols.dot("4x2"),
|
||||
-- },
|
||||
-- window = {
|
||||
-- side = "right",
|
||||
-- width = 10, -- set to 1 for a pure scrollbar :)
|
||||
-- winblend = 15,
|
||||
-- show_integration_count = false,
|
||||
-- },
|
||||
-- })
|
||||
--
|
||||
-- vim.api.nvim_create_autocmd("FileType", {
|
||||
-- pattern = "*",
|
||||
-- callback = function()
|
||||
-- local exclude_ft = {
|
||||
-- "qf",
|
||||
-- "NvimTree",
|
||||
-- "toggleterm",
|
||||
-- "TelescopePrompt",
|
||||
-- "alpha",
|
||||
-- "netrw",
|
||||
-- }
|
||||
--
|
||||
-- local map = require("mini.map")
|
||||
-- if vim.tbl_contains(exclude_ft, vim.o.filetype) then
|
||||
-- vim.b.minimap_disable = true
|
||||
-- map.close()
|
||||
-- elseif vim.o.buftype == "" then
|
||||
-- map.open()
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
||||
-- end,
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
return {
|
||||
-- { "kyazdani42/nvim-tree.lua", enabled = false },
|
||||
-- {
|
||||
-- "nvim-neo-tree/neo-tree.nvim",
|
||||
-- dependencies = { "MunifTanjim/nui.nvim" },
|
||||
-- event = "BufWinEnter",
|
||||
-- cmd = "Neotree",
|
||||
-- keys = {
|
||||
-- {
|
||||
-- "<leader>fE",
|
||||
-- function()
|
||||
-- require("neo-tree.command").execute({ toggle = true, dir = vim.loop.cwd() })
|
||||
-- end,
|
||||
-- desc = "Explorer NeoTree (cwd)",
|
||||
-- },
|
||||
-- { "<leader>n", "<cmd>Neotree toggle<cr>", desc = "Explorer NeoTree (root dir)", remap = true },
|
||||
-- { "<leader>E", "<leader>fE", desc = "Explorer NeoTree (cwd)", remap = true },
|
||||
-- },
|
||||
-- deactivate = function()
|
||||
-- vim.cmd([[Neotree close]])
|
||||
-- end,
|
||||
-- init = function()
|
||||
-- vim.g.neo_tree_remove_legacy_commands = 1
|
||||
-- if vim.fn.argc() == 1 then
|
||||
-- local stat = vim.loop.fs_stat(vim.fn.argv(0))
|
||||
-- if stat and stat.type == "directory" then
|
||||
-- require("neo-tree")
|
||||
-- end
|
||||
-- end
|
||||
-- end,
|
||||
-- opts = {
|
||||
-- filesystem = {
|
||||
-- bind_to_cwd = false,
|
||||
-- follow_current_file = true,
|
||||
-- },
|
||||
-- window = {
|
||||
-- position = "left",
|
||||
-- width = 30,
|
||||
-- mappings = {
|
||||
-- ["<space>"] = "none",
|
||||
-- },
|
||||
-- },
|
||||
-- default_component_configs = {
|
||||
-- icon = {
|
||||
-- folder_closed = "",
|
||||
-- folder_open = "",
|
||||
-- folder_empty = "ﰊ",
|
||||
-- -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
|
||||
-- -- then these will never be used.
|
||||
-- default = "*",
|
||||
-- highlight = "NeoTreeFileIcon",
|
||||
-- },
|
||||
-- modified = {
|
||||
-- symbol = "[+]",
|
||||
-- highlight = "NeoTreeModified",
|
||||
-- },
|
||||
-- git_status = {
|
||||
-- symbols = {
|
||||
-- -- Change type
|
||||
-- added = "✚", -- or "✚", but this is redundant info if you use git_status_colors on the name
|
||||
-- modified = "", -- or "", but this is redundant info if you use git_status_colors on the name
|
||||
-- deleted = "✖", -- this can only be used in the git_status source
|
||||
-- renamed = "", -- this can only be used in the git_status source
|
||||
-- -- Status type
|
||||
-- untracked = "",
|
||||
-- ignored = "",
|
||||
-- -- unstaged = "",
|
||||
-- unstaged = "",
|
||||
-- staged = "",
|
||||
-- conflict = "",
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
}
|
|
@ -1,255 +0,0 @@
|
|||
-- local icons = vim.g.pcode_icons
|
||||
-- local HEIGHT_RATIO = 0.9 -- You can change this
|
||||
-- local WIDTH_RATIO = 0.5 -- You can change this too
|
||||
return {
|
||||
-- "kyazdani42/nvim-tree.lua",
|
||||
-- lazy = true,
|
||||
-- cmd = { "NvimTreeFindFileToggle", "NvimTree", "NvimTreeOpen", "NvimTreeToggle", "NvimTreeFocus", "NvimTreeClose" },
|
||||
-- opts = {
|
||||
-- auto_reload_on_write = false,
|
||||
-- disable_netrw = false,
|
||||
-- hijack_cursor = false,
|
||||
-- hijack_netrw = true,
|
||||
-- hijack_unnamed_buffer_when_opening = false,
|
||||
-- sort_by = "name",
|
||||
-- root_dirs = {},
|
||||
-- prefer_startup_root = false,
|
||||
-- sync_root_with_cwd = true,
|
||||
-- reload_on_bufenter = false,
|
||||
-- respect_buf_cwd = false,
|
||||
-- on_attach = "default",
|
||||
-- select_prompts = false,
|
||||
-- view = {
|
||||
-- adaptive_size = false,
|
||||
-- centralize_selection = true,
|
||||
-- -- width = 30,
|
||||
-- side = "left",
|
||||
-- preserve_window_proportions = false,
|
||||
-- number = false,
|
||||
-- relativenumber = false,
|
||||
-- signcolumn = "yes",
|
||||
-- -- float = {
|
||||
-- -- enable = false,
|
||||
-- -- quit_on_focus_loss = true,
|
||||
-- -- open_win_config = {
|
||||
-- -- relative = "editor",
|
||||
-- -- border = "rounded",
|
||||
-- -- width = 30,
|
||||
-- -- height = 30,
|
||||
-- -- row = 1,
|
||||
-- -- col = 1,
|
||||
-- -- },
|
||||
-- -- },
|
||||
-- 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 * WIDTH_RATIO
|
||||
-- local window_h = screen_h * HEIGHT_RATIO
|
||||
-- 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() * WIDTH_RATIO)
|
||||
-- end,
|
||||
-- },
|
||||
-- renderer = {
|
||||
-- add_trailing = false,
|
||||
-- group_empty = false,
|
||||
-- highlight_git = true,
|
||||
-- full_name = false,
|
||||
-- highlight_opened_files = "none",
|
||||
-- -- root_folder_label = ":t",
|
||||
-- root_folder_label = false,
|
||||
-- indent_width = 2,
|
||||
-- indent_markers = {
|
||||
-- enable = true,
|
||||
-- inline_arrows = true,
|
||||
-- icons = {
|
||||
-- corner = "└",
|
||||
-- edge = "│",
|
||||
-- item = "│",
|
||||
-- none = " ",
|
||||
-- },
|
||||
-- },
|
||||
-- icons = {
|
||||
-- webdev_colors = true,
|
||||
-- git_placement = "before",
|
||||
-- padding = " ",
|
||||
-- symlink_arrow = " ➛ ",
|
||||
-- show = {
|
||||
-- file = true,
|
||||
-- folder = true,
|
||||
-- folder_arrow = true,
|
||||
-- git = true,
|
||||
-- },
|
||||
-- glyphs = {
|
||||
-- default = icons.ui.Text,
|
||||
-- symlink = icons.ui.FileSymlink,
|
||||
-- bookmark = icons.ui.BookMark,
|
||||
-- folder = {
|
||||
-- -- arrow_closed = icons.ui.TriangleShortArrowRight,
|
||||
-- arrow_closed = icons.ui.ChevronShortRight,
|
||||
-- -- arrow_open = icons.ui.TriangleShortArrowDown,
|
||||
-- arrow_open = icons.ui.ChevronShortDown,
|
||||
-- default = icons.ui.Folder,
|
||||
-- open = icons.ui.FolderOpen,
|
||||
-- empty = icons.ui.EmptyFolder,
|
||||
-- empty_open = icons.ui.EmptyFolderOpen,
|
||||
-- symlink = icons.ui.FolderSymlink,
|
||||
-- symlink_open = icons.ui.FolderOpen,
|
||||
-- },
|
||||
-- git = {
|
||||
-- unstaged = icons.git.FileUnstaged,
|
||||
-- staged = icons.git.FileStaged,
|
||||
-- unmerged = icons.git.FileUnmerged,
|
||||
-- renamed = icons.git.FileRenamed,
|
||||
-- untracked = icons.git.FileUntracked,
|
||||
-- deleted = icons.git.FileDeleted,
|
||||
-- ignored = icons.git.FileIgnored,
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" },
|
||||
-- symlink_destination = true,
|
||||
-- },
|
||||
-- hijack_directories = {
|
||||
-- enable = false,
|
||||
-- auto_open = true,
|
||||
-- },
|
||||
-- update_focused_file = {
|
||||
-- enable = true,
|
||||
-- debounce_delay = 15,
|
||||
-- update_root = true,
|
||||
-- ignore_list = {},
|
||||
-- },
|
||||
-- diagnostics = {
|
||||
-- enable = true,
|
||||
-- show_on_dirs = false,
|
||||
-- show_on_open_dirs = true,
|
||||
-- debounce_delay = 50,
|
||||
-- severity = {
|
||||
-- min = vim.diagnostic.severity.HINT,
|
||||
-- max = vim.diagnostic.severity.ERROR,
|
||||
-- },
|
||||
-- icons = {
|
||||
-- hint = icons.diagnostics.BoldHint,
|
||||
-- info = icons.diagnostics.BoldInformation,
|
||||
-- warning = icons.diagnostics.BoldWarning,
|
||||
-- error = icons.diagnostics.BoldError,
|
||||
-- },
|
||||
-- },
|
||||
-- filters = {
|
||||
-- dotfiles = false,
|
||||
-- git_clean = false,
|
||||
-- no_buffer = false,
|
||||
-- custom = { "node_modules", "\\.cache", "\\.git" },
|
||||
-- exclude = {
|
||||
-- ".gitignore",
|
||||
-- ".prettierignore",
|
||||
-- },
|
||||
-- },
|
||||
-- filesystem_watchers = {
|
||||
-- enable = true,
|
||||
-- debounce_delay = 50,
|
||||
-- ignore_dirs = {},
|
||||
-- },
|
||||
-- git = {
|
||||
-- enable = true,
|
||||
-- ignore = false,
|
||||
-- show_on_dirs = true,
|
||||
-- show_on_open_dirs = true,
|
||||
-- disable_for_dirs = {},
|
||||
-- timeout = 400,
|
||||
-- },
|
||||
-- actions = {
|
||||
-- use_system_clipboard = true,
|
||||
-- change_dir = {
|
||||
-- enable = true,
|
||||
-- global = false,
|
||||
-- restrict_above_cwd = false,
|
||||
-- },
|
||||
-- expand_all = {
|
||||
-- max_folder_discovery = 300,
|
||||
-- exclude = {},
|
||||
-- },
|
||||
-- file_popup = {
|
||||
-- open_win_config = {
|
||||
-- col = 1,
|
||||
-- row = 1,
|
||||
-- relative = "cursor",
|
||||
-- border = "shadow",
|
||||
-- style = "minimal",
|
||||
-- },
|
||||
-- },
|
||||
-- open_file = {
|
||||
-- quit_on_open = false,
|
||||
-- resize_window = false,
|
||||
-- window_picker = {
|
||||
-- enable = true,
|
||||
-- picker = "default",
|
||||
-- chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
|
||||
-- exclude = {
|
||||
-- filetype = { "notify", "lazy", "qf", "diff", "fugitive", "fugitiveblame" },
|
||||
-- buftype = { "nofile", "terminal", "help" },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- remove_file = {
|
||||
-- close_window = true,
|
||||
-- },
|
||||
-- },
|
||||
-- trash = {
|
||||
-- cmd = "trash",
|
||||
-- require_confirm = true,
|
||||
-- },
|
||||
-- live_filter = {
|
||||
-- prefix = "[FILTER]: ",
|
||||
-- always_show_folders = true,
|
||||
-- },
|
||||
-- tab = {
|
||||
-- sync = {
|
||||
-- open = false,
|
||||
-- close = false,
|
||||
-- ignore = {},
|
||||
-- },
|
||||
-- },
|
||||
-- notify = {
|
||||
-- threshold = vim.log.levels.INFO,
|
||||
-- -- threshold = vim.log.levels.ERROR,
|
||||
-- },
|
||||
-- log = {
|
||||
-- enable = false,
|
||||
-- truncate = false,
|
||||
-- types = {
|
||||
-- all = false,
|
||||
-- config = false,
|
||||
-- copy_paste = false,
|
||||
-- dev = false,
|
||||
-- diagnostics = false,
|
||||
-- git = false,
|
||||
-- profile = false,
|
||||
-- watcher = false,
|
||||
-- },
|
||||
-- },
|
||||
-- system_open = {
|
||||
-- cmd = nil,
|
||||
-- args = {},
|
||||
-- },
|
||||
-- },
|
||||
-- config = function(_, opts)
|
||||
-- require("nvim-tree").setup(opts)
|
||||
-- end,
|
||||
}
|
|
@ -1,335 +0,0 @@
|
|||
function TABLE_CONTAINS(tbl, x)
|
||||
local found = false
|
||||
for _, v in pairs(tbl) do
|
||||
if v == x then
|
||||
found = true
|
||||
end
|
||||
end
|
||||
return found
|
||||
end
|
||||
|
||||
local icons = vim.g.pcode_icons.folding
|
||||
|
||||
return {
|
||||
-- "kevinhwang91/nvim-ufo",
|
||||
-- dependencies = {
|
||||
-- "kevinhwang91/promise-async",
|
||||
-- {
|
||||
-- "luukvbaal/statuscol.nvim",
|
||||
-- config = function()
|
||||
-- local builtin = require "statuscol.builtin"
|
||||
-- require("statuscol").setup {
|
||||
-- -- relculright = true,
|
||||
-- -- segments = {
|
||||
-- -- { text = { builtin.foldfunc }, click = "v:lua.ScFa" },
|
||||
-- -- { text = { "%s" }, click = "v:lua.ScSa" },
|
||||
-- -- { text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
|
||||
-- -- },
|
||||
-- setopt = true,
|
||||
-- relculright = true,
|
||||
-- segments = {
|
||||
-- { text = { "%s" }, click = "v:lua.ScSa" },
|
||||
-- {
|
||||
-- -- text = { builtin.foldfunc, " " },
|
||||
-- text = { builtin.foldfunc },
|
||||
-- condition = { builtin.not_empty, true, builtin.not_empty },
|
||||
-- click = "v:lua.ScFa",
|
||||
-- },
|
||||
-- { text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
|
||||
-- -- { text = { builtin.lnumfunc }, click = "v:lua.ScLa" },
|
||||
-- },
|
||||
-- }
|
||||
-- end,
|
||||
-- },
|
||||
-- },
|
||||
-- enabled = true,
|
||||
-- lazy = true,
|
||||
-- -- event = "BufReadPost",
|
||||
-- -- event = { "BufReadPost", "BufRead", "InsertEnter", "BufNewFile" },
|
||||
-- event = "VeryLazy",
|
||||
-- config = function()
|
||||
-- vim.o.foldcolumn = "1" -- '0' is not bad
|
||||
-- vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
|
||||
-- vim.o.foldlevelstart = 99
|
||||
-- vim.o.foldenable = true
|
||||
-- -- vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
|
||||
-- -- vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
|
||||
-- -- vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep:│,foldclose:]]
|
||||
-- -- vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep:│,foldclose:]]
|
||||
-- -- vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep:│,foldclose:]]
|
||||
-- -- vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep:│,foldclose:]]
|
||||
-- -- vim.o.fillchars = [[eob: ,fold: ,foldopen:▾,foldsep:│,foldclose:▸]]
|
||||
-- vim.opt.fillchars = {
|
||||
-- vert = icons.vert,
|
||||
-- fold = icons.fold,
|
||||
-- eob = icons.eob,
|
||||
-- diff = icons.diff,
|
||||
-- msgsep = icons.msgsep,
|
||||
-- foldopen = icons.foldopen,
|
||||
-- foldsep = icons.foldsep,
|
||||
-- foldclose = icons.foldclose,
|
||||
-- }
|
||||
-- -- these are "extra", change them as you like
|
||||
-- vim.keymap.set("n", "zR", require("ufo").openAllFolds)
|
||||
-- vim.keymap.set("n", "zM", require("ufo").closeAllFolds)
|
||||
-- vim.cmd("highlight FoldColumn guifg=" .. vim.fn.synIDattr(vim.fn.synIDtrans(vim.fn.hlID "Comment"), "fg"))
|
||||
-- -- vim.cmd("highlight FoldColumn guifg=" .. vim.fn.synIDattr(vim.fn.synIDtrans(vim.fn.hlID("IblIndent")), "fg"))
|
||||
-- -- Option 3: treesitter as a main provider instead
|
||||
-- -- Only depend on `nvim-treesitter/queries/filetype/folds.scm`,
|
||||
-- -- performance and stability are better than `foldmethod=nvim_treesitter#foldexpr()`
|
||||
--
|
||||
-- --[[require("ufo").setup({
|
||||
-- -- provider_selector = function(bufnr, filetype, buftype)
|
||||
-- -- return { "treesitter", "indent" }
|
||||
-- -- end,
|
||||
-- open_fold_hl_timeout = 150,
|
||||
-- close_fold_kinds_for_ft = {
|
||||
-- default = { "imports", "comment" },
|
||||
-- json = { "array" },
|
||||
-- c = { "comment", "region" },
|
||||
-- },
|
||||
-- preview = {
|
||||
-- win_config = {
|
||||
-- border = { "", "─", "", "", "", "─", "", "" },
|
||||
-- -- winhighlight = 'Normal:Normal',
|
||||
-- -- winhighlight = 'IncSearch:Folded',
|
||||
-- winhighlight = "Normal:UfoPreviewNormal,FloatBorder:UfoPreviewBorder,CursorLine:UfoPreviewCursorLine",
|
||||
-- winblend = 0,
|
||||
-- },
|
||||
-- mappings = {
|
||||
-- scrollU = "<C-u>",
|
||||
-- scrollD = "<C-d>",
|
||||
-- jumpTop = "[",
|
||||
-- jumpBot = "]",
|
||||
-- },
|
||||
-- },
|
||||
-- provider_selector = function(_, filetype)
|
||||
-- return { "treesitter", "indent" }
|
||||
-- end,
|
||||
-- fold_virt_text_handler = function(virt_text, lnum, end_lnum, width, truncate)
|
||||
-- local result = {}
|
||||
-- local _end = end_lnum - 1
|
||||
-- local final_text = vim.trim(vim.api.nvim_buf_get_text(0, _end, 0, _end, -1, {})[1])
|
||||
-- local suffix = final_text:format(end_lnum - lnum)
|
||||
-- local suffix_width = vim.fn.strdisplaywidth(suffix)
|
||||
-- local target_width = width - suffix_width
|
||||
-- local cur_width = 0
|
||||
-- for _, chunk in ipairs(virt_text) do
|
||||
-- local chunk_text = chunk[1]
|
||||
-- local chunk_width = vim.fn.strdisplaywidth(chunk_text)
|
||||
-- if target_width > cur_width + chunk_width then
|
||||
-- table.insert(result, chunk)
|
||||
-- else
|
||||
-- chunk_text = truncate(chunk_text, target_width - cur_width)
|
||||
-- local hl_group = chunk[2]
|
||||
-- table.insert(result, { chunk_text, hl_group })
|
||||
-- chunk_width = vim.fn.strdisplaywidth(chunk_text)
|
||||
-- -- str width returned from truncate() may less than 2nd argument, need padding
|
||||
-- if cur_width + chunk_width < target_width then
|
||||
-- suffix = suffix .. (" "):rep(target_width - cur_width - chunk_width)
|
||||
-- end
|
||||
-- break
|
||||
-- end
|
||||
-- cur_width = cur_width + chunk_width
|
||||
-- end
|
||||
-- table.insert(result, { " ⋯ ", "NonText" })
|
||||
-- if vim.bo.filetype ~= "json" then
|
||||
-- table.insert(result, { suffix, "TSPunctBracket" })
|
||||
-- end
|
||||
-- return result
|
||||
-- end,
|
||||
-- })]]
|
||||
-- --
|
||||
--
|
||||
-- -- start ini bagian code support comment dan import
|
||||
-- local ftMap = {
|
||||
-- vim = "indent",
|
||||
-- python = { "indent" },
|
||||
-- git = "",
|
||||
-- -- javascriptreact = { "treesitter", "indent" },
|
||||
-- -- typescriptreact = { "treesitter", "indent" },
|
||||
-- }
|
||||
--
|
||||
-- local function customizeSelector(bufnr)
|
||||
-- local function handleFallbackException(err, providerName)
|
||||
-- if type(err) == "string" and err:match "UfoFallbackException" then
|
||||
-- return require("ufo").getFolds(bufnr, providerName)
|
||||
-- else
|
||||
-- return require("promise").reject(err)
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- return require("ufo")
|
||||
-- .getFolds(bufnr, "lsp")
|
||||
-- :catch(function(err)
|
||||
-- return handleFallbackException(err, "treesitter")
|
||||
-- end)
|
||||
-- :catch(function(err)
|
||||
-- return handleFallbackException(err, "indent")
|
||||
-- end)
|
||||
-- end
|
||||
--
|
||||
-- require("ufo").setup {
|
||||
-- open_fold_hl_timeout = 150,
|
||||
-- close_fold_kinds_for_ft = {
|
||||
-- -- default = { "imports", "comment" },
|
||||
-- -- json = { "array" },
|
||||
-- -- c = { "comment", "region" },
|
||||
-- },
|
||||
-- preview = {
|
||||
-- win_config = {
|
||||
-- border = { "", "─", "", "", "", "─", "", "" },
|
||||
-- winhighlight = "Normal:Folded",
|
||||
-- winblend = 0,
|
||||
-- },
|
||||
-- mappings = {
|
||||
-- scrollU = "<C-u>",
|
||||
-- scrollD = "<C-d>",
|
||||
-- jumpTop = "[",
|
||||
-- jumpBot = "]",
|
||||
-- },
|
||||
-- },
|
||||
-- provider_selector = function(bufnr, filetype, buftype)
|
||||
-- -- if you prefer treesitter provider rather than lsp,
|
||||
-- -- return ftMap[filetype]
|
||||
-- -- return ftMap[filetype] or {'treesitter', 'indent'}
|
||||
-- return ftMap[filetype] or customizeSelector
|
||||
--
|
||||
-- -- refer to ./doc/example.lua for detail
|
||||
-- end,
|
||||
--
|
||||
-- fold_virt_text_handler = function(virt_text, lnum, end_lnum, width, truncate)
|
||||
-- local result = {}
|
||||
-- local closed_fold_text = "comments ..." -- Teks yang ingin ditampilkan
|
||||
-- local import_fold_text = "import ..." -- Teks yang ingin ditampilkan
|
||||
-- local is_comment = false -- Variabel untuk mengecek apakah ini komentar
|
||||
-- local is_import = false
|
||||
-- local is_bracket = false
|
||||
--
|
||||
-- -- Memeriksa apakah baris awal dari fold adalah komentar
|
||||
-- local start_line = vim.api.nvim_buf_get_lines(0, lnum - 1, lnum, false)[1]
|
||||
-- -- cari comentar dengan awalan /* untuk generaal comment
|
||||
-- if start_line:find "^%s*%/%*" then
|
||||
-- is_comment = true
|
||||
-- -- cara commentar dengan awalan <!-- untuk html
|
||||
-- elseif start_line:find "^%s*<!--" then
|
||||
-- is_comment = true
|
||||
-- -- cari comentar dengan awalan -- untuk lua
|
||||
-- elseif start_line:find "^%s*%-%-" then
|
||||
-- is_comment = true
|
||||
-- end
|
||||
-- -- cek fold yang berawalan import
|
||||
-- if start_line:find "^%s*import" then
|
||||
-- is_import = true
|
||||
-- end
|
||||
-- -- cek fold dengan akhiran {
|
||||
-- if start_line:find "%s*{%s*$" then
|
||||
-- is_bracket = true
|
||||
-- end
|
||||
-- if is_comment then
|
||||
-- local suffix = string.format(" %s ", closed_fold_text)
|
||||
-- local target_width = width - vim.fn.strdisplaywidth(suffix)
|
||||
-- local cur_width = 0
|
||||
-- for _, chunk in ipairs(virt_text) do
|
||||
-- local chunk_text = chunk[1]
|
||||
-- local chunk_width = vim.fn.strdisplaywidth(chunk_text)
|
||||
-- if target_width > cur_width + chunk_width then
|
||||
-- table.insert(result, chunk)
|
||||
-- else
|
||||
-- chunk_text = truncate(chunk_text, target_width - cur_width)
|
||||
-- local hl_group = chunk[2]
|
||||
-- table.insert(result, { chunk_text, hl_group })
|
||||
-- break
|
||||
-- end
|
||||
-- cur_width = cur_width + chunk_width
|
||||
-- end
|
||||
-- -- Menambahkan teks 'Comments ...' ke akhir baris yang dilipat
|
||||
-- table.insert(result, { suffix, "NonText" })
|
||||
-- elseif is_import then
|
||||
-- --[[
|
||||
-- local suffix = string.format(" %s ", import_fold_text)
|
||||
-- local target_width = width - vim.fn.strdisplaywidth(suffix)
|
||||
-- local cur_width = 0
|
||||
-- for _, chunk in ipairs(virt_text) do
|
||||
-- local chunk_text = chunk[1]
|
||||
-- local chunk_width = vim.fn.strdisplaywidth(chunk_text)
|
||||
-- if target_width > cur_width + chunk_width then
|
||||
-- table.insert(result, chunk)
|
||||
-- else
|
||||
-- chunk_text = truncate(chunk_text, target_width - cur_width)
|
||||
-- local hl_group = chunk[2]
|
||||
-- table.insert(result, { chunk_text, hl_group })
|
||||
-- break
|
||||
-- end
|
||||
-- cur_width = cur_width + chunk_width
|
||||
-- end
|
||||
-- -- Menambahkan teks 'Comments ...' ke akhir baris yang dilipat
|
||||
-- table.insert(result, { suffix, "NonText" })
|
||||
-- ]]
|
||||
-- --
|
||||
--
|
||||
-- local suffix = (" %d "):format(end_lnum - lnum)
|
||||
-- local sufWidth = vim.fn.strdisplaywidth(suffix)
|
||||
-- local targetWidth = width - sufWidth
|
||||
-- local curWidth = 0
|
||||
-- for _, chunk in ipairs(virt_text) do
|
||||
-- local chunkText = chunk[1]
|
||||
-- local chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
-- if targetWidth > curWidth + chunkWidth then
|
||||
-- table.insert(result, chunk)
|
||||
-- else
|
||||
-- chunkText = truncate(chunkText, targetWidth - curWidth)
|
||||
-- local hlGroup = chunk[2]
|
||||
-- table.insert(result, { chunkText, hlGroup })
|
||||
-- chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
-- -- str width returned from truncate() may less than 2nd argument, need padding
|
||||
-- if curWidth + chunkWidth < targetWidth then
|
||||
-- suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth)
|
||||
-- end
|
||||
-- break
|
||||
-- end
|
||||
-- curWidth = curWidth + chunkWidth
|
||||
-- end
|
||||
-- table.insert(result, { " import⋯ ", "NonText" })
|
||||
-- table.insert(result, { suffix, "MoreMsg" })
|
||||
-- else
|
||||
-- -- Jika bukan komentar, tampilkan teks asli
|
||||
-- -- for _, chunk in ipairs(virt_text) do
|
||||
-- -- table.insert(result, chunk)
|
||||
-- -- end
|
||||
-- local _end = end_lnum - 1
|
||||
-- local final_text = vim.trim(vim.api.nvim_buf_get_text(0, _end, 0, _end, -1, {})[1])
|
||||
-- local suffix = final_text:format(end_lnum - lnum)
|
||||
-- local suffix_width = vim.fn.strdisplaywidth(suffix)
|
||||
-- local target_width = width - suffix_width
|
||||
-- local cur_width = 0
|
||||
-- for _, chunk in ipairs(virt_text) do
|
||||
-- local chunk_text = chunk[1]
|
||||
-- local chunk_width = vim.fn.strdisplaywidth(chunk_text)
|
||||
-- if target_width > cur_width + chunk_width then
|
||||
-- table.insert(result, chunk)
|
||||
-- else
|
||||
-- chunk_text = truncate(chunk_text, target_width - cur_width)
|
||||
-- local hl_group = chunk[2]
|
||||
-- table.insert(result, { chunk_text, hl_group })
|
||||
-- chunk_width = vim.fn.strdisplaywidth(chunk_text)
|
||||
-- -- str width returned from truncate() may less than 2nd argument, need padding
|
||||
-- if cur_width + chunk_width < target_width then
|
||||
-- suffix = suffix .. (" "):rep(target_width - cur_width - chunk_width)
|
||||
-- end
|
||||
-- break
|
||||
-- end
|
||||
-- cur_width = cur_width + chunk_width
|
||||
-- end
|
||||
-- table.insert(result, { " ⋯ ", "NonText" })
|
||||
-- local l = { "javascriptreact", "typescriptreact" }
|
||||
-- if TABLE_CONTAINS(l, vim.bo.filetype) and not is_bracket then
|
||||
-- table.insert(result, { suffix, "TSPunctBracket" })
|
||||
-- end
|
||||
-- end
|
||||
-- return result
|
||||
-- end,
|
||||
-- }
|
||||
-- -- end bagian code support comment dan import
|
||||
-- end,
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
return {
|
||||
-- { "navarasu/onedark.nvim", enabled = false },
|
||||
-- {
|
||||
-- "olimorris/onedarkpro.nvim",
|
||||
-- priority = 1000, -- Ensure it loads first
|
||||
-- config = function()
|
||||
-- local is_transparent = false
|
||||
-- require("onedarkpro").setup({
|
||||
-- styles = {
|
||||
-- types = "NONE",
|
||||
-- methods = "NONE",
|
||||
-- numbers = "NONE",
|
||||
-- strings = "NONE",
|
||||
-- comments = "italic",
|
||||
-- keywords = "bold,italic",
|
||||
-- constants = "NONE",
|
||||
-- functions = "italic",
|
||||
-- operators = "NONE",
|
||||
-- variables = "NONE",
|
||||
-- parameters = "NONE",
|
||||
-- conditionals = "italic",
|
||||
-- virtual_text = "NONE",
|
||||
-- tags = "italic",
|
||||
-- },
|
||||
-- colors = {
|
||||
-- onedark = {
|
||||
-- green = "#99c379",
|
||||
-- gray = "#8094b4",
|
||||
-- red = "#e06c75",
|
||||
-- purple = "#c678dd",
|
||||
-- yellow = "#e5c07a",
|
||||
-- blue = "#61afef",
|
||||
-- cyan = "#56b6c2",
|
||||
-- bg_statusline = "#282c34",
|
||||
-- indentline = "#3b4261",
|
||||
-- float_bg = "#282c34",
|
||||
-- },
|
||||
-- },
|
||||
-- options = {
|
||||
-- cursorline = true,
|
||||
-- transparency = is_transparent,
|
||||
-- terminal_colors = true,
|
||||
-- },
|
||||
-- highlights = {
|
||||
-- -- overide cursor line fill colors
|
||||
-- LineNr = { fg = "#49505E" }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set.
|
||||
-- CursorLineNr = { fg = "${blue}" }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line.
|
||||
-- CursorLine = { bg = "#333842" },
|
||||
-- Cursor = { fg = "${bg}", bg = "${fg}" }, -- character under the cursor
|
||||
-- lCursor = { fg = "${bg}", bg = "${fg}" }, -- the character under the cursor when |language-mapping| is used (see 'guicursor')
|
||||
-- CursorIM = { fg = "${bg}", bg = "${fg}" }, -- like Cursor, but used when in IME mode |CursorIM|
|
||||
-- CursorColumn = { bg = "#333842" }, -- Screen-column at the cursor, when 'cursorcolumn' is set.
|
||||
-- -- overide nvimtree folder icon fill color
|
||||
-- NvimTreeFolderIcon = { fg = "${gray}" },
|
||||
-- -- overide nvimtree text fill color folder opened
|
||||
-- NvimTreeOpenedFolderName = { fg = "${blue}" },
|
||||
-- -- overide nvimtree text fill color root folder
|
||||
-- NvimTreeRootFolder = { fg = "${yellow}" },
|
||||
-- NvimTreeSpecialFile = { fg = "${orange}" },
|
||||
-- NvimTreeWinSeparator = { fg = "#202329" },
|
||||
-- NvimTreeIndentMarker = { fg = "#3E4450" },
|
||||
-- -- overide indenline fill color
|
||||
-- IblIndent = { fg = "#3E4450" },
|
||||
-- -- overide cmp cursorline fill color with #333842
|
||||
-- PmenuSel = { bg = "#333842" },
|
||||
-- illuminatedWord = { bg = "#3b4261" },
|
||||
-- illuminatedCurWord = { bg = "#3b4261" },
|
||||
-- IlluminatedWordText = { bg = "#3b4261" },
|
||||
-- IlluminatedWordRead = { bg = "#3b4261" },
|
||||
-- IlluminatedWordWrite = { bg = "#3b4261" },
|
||||
-- StatusLine = { fg = "#f8f8f2", bg = is_transparent and "NONE" or "${bg}" },
|
||||
-- StatusLineTerm = { fg = "#f8f8f2", bg = "${bg}" },
|
||||
-- BufferLineFill = { bg = is_transparent and "NONE" or "${bg}" },
|
||||
-- ["@string.special.url.html"] = { fg = "${green}" },
|
||||
-- ["@lsp.type.parameter"] = { fg = "${gray}" },
|
||||
-- -- ["@text.uri.html"] = { fg = "${green}" },
|
||||
-- -- ["@tag.javascript"] = { fg = "${red}" },
|
||||
-- -- ["@tag.attribute"] = { fg = "${orange}", style = "italic" },
|
||||
-- -- ["@constructor.javascript"] = { fg = "${red}" },
|
||||
-- -- ["@variable"] = { fg = "${fg}", style = "NONE" }, -- various variable names
|
||||
-- -- ["@variable.builtin"] = { fg = "${red}", style = "NONE" },
|
||||
-- -- ["@variable.member"] = "${cyan}",
|
||||
-- -- ["@variable.parameter"] = "${red}",
|
||||
-- -- ["@property"] = { fg = "${cyan}" }, -- similar to `@field`
|
||||
-- ["@property.lua"] = { fg = "${red}", bg = "NONE" },
|
||||
-- ["@lsp.type.property.lua"] = { fg = "${cyan}", bg = "NONE" },
|
||||
-- ["@lsp.type.variable.lua"] = { fg = "${red}", bg = "NONE" },
|
||||
-- NvimTreeGitDirty = { fg = "${yellow}" },
|
||||
-- Pmenu = { fg = "${fg}", bg = "${bg}" },
|
||||
-- PmenuThumb = { bg = "${gray}" }, -- Popup menu: Thumb of the scrollbar.
|
||||
-- -- overide lualine fill color with bg color
|
||||
-- LualineNormal = { bg = "${bg}" },
|
||||
-- -- overide lualine_c fill color with bg color
|
||||
-- LualineC = { bg = "${bg}" },
|
||||
-- -- overide lualine_x fill color with bg color
|
||||
-- LualineX = { bg = "${bg}" },
|
||||
-- -- overide which-key fill color with bg color
|
||||
-- -- WhichKey = { bg = "${bg}" },
|
||||
-- -- -- overide which-key fill color with bg color
|
||||
-- -- WhichKeySeperator = { bg = "${bg}" },
|
||||
-- -- -- overide which-key fill color with bg color
|
||||
-- -- WhichKeyDesc = { fg = "${red}" },
|
||||
-- -- -- overide which-key fill color with bg color
|
||||
-- -- WhichKeyFloat = { bg = "${bg}" },
|
||||
-- WhichKeyFloat = { bg = is_transparent and "NONE" or "${bg}" },
|
||||
-- -- -- overide which-key fill color with bg color
|
||||
-- -- WhichKeyValue = { bg = "${bg}" },
|
||||
-- -- -- overide which-key fill color with bg color
|
||||
-- -- WhichKeyBorder = { bg = "${bg}" },
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
-- },
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
return {
|
||||
"folke/playground",
|
||||
lazy = true,
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup {
|
||||
playground = {
|
||||
enable = true,
|
||||
disable = {},
|
||||
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
|
||||
persist_queries = false, -- Whether the query persists across vim sessions
|
||||
keybindings = {
|
||||
toggle_query_editor = "o",
|
||||
toggle_hl_groups = "i",
|
||||
toggle_injected_languages = "t",
|
||||
toggle_anonymous_nodes = "a",
|
||||
toggle_language_display = "I",
|
||||
focus_language = "f",
|
||||
unfocus_language = "F",
|
||||
update = "R",
|
||||
goto_node = "<cr>",
|
||||
show_help = "?",
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
return {
|
||||
-- {
|
||||
-- "folke/tokyonight.nvim",
|
||||
-- lazy = false,
|
||||
-- priority = 1000,
|
||||
-- opts = {},
|
||||
-- config = function()
|
||||
-- local status_ok, tokyonight = pcall(require, "tokyonight")
|
||||
-- if not status_ok then
|
||||
-- return
|
||||
-- end
|
||||
-- local transp = false
|
||||
-- local sidebar = "normal" --"dark , transparent, normal"
|
||||
-- local hilight = "#292e42"
|
||||
-- local data_exists, config = pcall(require, "core.config")
|
||||
-- if data_exists then
|
||||
-- local tras = config.transparent_mode
|
||||
-- if tras == 1 then
|
||||
-- transp = true
|
||||
-- sidebar = "transparent"
|
||||
-- -- hilight = "#3E4254"
|
||||
-- -- hilight = "#353a56"
|
||||
-- hilight = "#292e42"
|
||||
-- end
|
||||
-- end
|
||||
-- tokyonight.setup({
|
||||
-- -- your configuration comes here
|
||||
-- -- or leave it empty to use the default settings
|
||||
-- style = "night", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
|
||||
-- light_style = "day", -- The theme is used when the background is set to light
|
||||
-- transparent = transp, -- Enable this to disable setting the background color
|
||||
-- terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
|
||||
-- styles = {
|
||||
-- -- Style to be applied to different syntax groups
|
||||
-- -- Value is any valid attr-list value for `:help nvim_set_hl`
|
||||
-- -- comments = { italic = true },
|
||||
-- comments = { italic = true },
|
||||
-- keywords = { italic = true },
|
||||
-- functions = {},
|
||||
-- variables = {},
|
||||
-- -- Background styles. Can be "dark", "transparent" or "normal"
|
||||
-- sidebars = sidebar, -- style for sidebars, see below
|
||||
-- floats = sidebar, -- style for floating windows
|
||||
-- },
|
||||
-- sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]`
|
||||
-- day_brightness = 0.2, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors
|
||||
-- hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**.
|
||||
-- dim_inactive = false, -- dims inactive windows
|
||||
-- lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold
|
||||
--
|
||||
-- --- You can override specific color groups to use other groups or a hex color
|
||||
-- --- function will be called with a ColorScheme table
|
||||
-- -- @param colors ColorScheme
|
||||
-- on_colors = function(colors)
|
||||
-- colors.bg_highlight = hilight
|
||||
-- colors.bg_statusline = colors.none
|
||||
-- end,
|
||||
--
|
||||
-- --- You can override specific highlights to use other groups or a hex color
|
||||
-- --- function will be called with a Highlights and ColorScheme table
|
||||
-- --@param highlights Highlights
|
||||
-- -- @param colors ColorScheme
|
||||
-- on_highlights = function(highlights, colors)
|
||||
-- highlights.NvimTreeFolderIcon = {
|
||||
-- bg = colors.none,
|
||||
-- fg = "#e0af68",
|
||||
-- }
|
||||
-- highlights.Underlined = {
|
||||
-- underline = false,
|
||||
-- }
|
||||
-- highlights.NvimTreeWinSeparator = {
|
||||
-- fg = colors.border,
|
||||
-- }
|
||||
-- highlights.BufferLineFill = { bg = colors.bg }
|
||||
-- highlights.NvimTreeSpecialFile = { fg = colors.purple, underline = false }
|
||||
-- end,
|
||||
-- })
|
||||
-- end,
|
||||
-- },
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
return {
|
||||
-- {
|
||||
-- "folke/tokyonight.nvim",
|
||||
-- lazy = false,
|
||||
-- priority = 1000,
|
||||
-- opts = {},
|
||||
-- config = function()
|
||||
-- local status_ok, tokyonight = pcall(require, "tokyonight")
|
||||
-- if not status_ok then
|
||||
-- return
|
||||
-- end
|
||||
-- local transp = false
|
||||
-- local sidebar = "normal" --"dark , transparent, normal"
|
||||
-- tokyonight.setup({
|
||||
-- -- your configuration comes here
|
||||
-- -- or leave it empty to use the default settings
|
||||
-- style = "night", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
|
||||
-- light_style = "day", -- The theme is used when the background is set to light
|
||||
-- transparent = transp, -- Enable this to disable setting the background color
|
||||
-- terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
|
||||
-- styles = {
|
||||
-- -- Style to be applied to different syntax groups
|
||||
-- -- Value is any valid attr-list value for `:help nvim_set_hl`
|
||||
-- -- comments = { italic = true },
|
||||
-- comments = { italic = true },
|
||||
-- keywords = { italic = true },
|
||||
-- functions = {},
|
||||
-- variables = {},
|
||||
-- -- Background styles. Can be "dark", "transparent" or "normal"
|
||||
-- sidebars = sidebar, -- style for sidebars, see below
|
||||
-- floats = sidebar, -- style for floating windows
|
||||
-- },
|
||||
-- sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]`
|
||||
-- day_brightness = 0.2, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors
|
||||
-- hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**.
|
||||
-- dim_inactive = false, -- dims inactive windows
|
||||
-- lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold
|
||||
--
|
||||
-- --- You can override specific color groups to use other groups or a hex color
|
||||
-- --- function will be called with a ColorScheme table
|
||||
-- -- @param colors ColorScheme
|
||||
-- on_colors = function(colors)
|
||||
-- colors.bg_statusline = colors.bg
|
||||
-- colors.bg_sidebar = colors.bg
|
||||
-- colors.bg = colors.bg
|
||||
-- colors.bg_dark = colors.bg
|
||||
-- colors.terminal_black = colors.bg
|
||||
-- end,
|
||||
--
|
||||
-- --- You can override specific highlights to use other groups or a hex color
|
||||
-- --- function will be called with a Highlights and ColorScheme table
|
||||
-- --@param highlights Highlights
|
||||
-- -- @param colors ColorScheme
|
||||
-- on_highlights = function(highlights, colors)
|
||||
-- highlights.NvimTreeFolderIcon = {
|
||||
-- bg = colors.none,
|
||||
-- fg = "#e0af68",
|
||||
-- }
|
||||
-- highlights.Underlined = {
|
||||
-- underline = false,
|
||||
-- }
|
||||
-- highlights.BufferLineFill = { bg = colors.none }
|
||||
-- highlights.NvimTreeWinSeparator = {
|
||||
-- fg = colors.border,
|
||||
-- bg = colors.bg_sidebar,
|
||||
-- }
|
||||
-- highlights.Pmenu = { fg = colors.fg, bg = colors.bg }
|
||||
-- end,
|
||||
-- })
|
||||
-- end,
|
||||
-- },
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
return {
|
||||
-- "pmizio/typescript-tools.nvim",
|
||||
-- event = "BufRead",
|
||||
-- dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
|
||||
-- config = function()
|
||||
-- require("typescript-tools").setup({
|
||||
-- on_attach = require("user.lsp.handlers").on_attach,
|
||||
-- })
|
||||
-- end,
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
return {
|
||||
-- { "RRethy/nvim-base16" },
|
||||
-- -- simbol outline
|
||||
-- {
|
||||
-- "simrat39/symbols-outline.nvim",
|
||||
-- lazy = true,
|
||||
-- event = "BufRead",
|
||||
-- config = function()
|
||||
-- require("symbols-outline").setup()
|
||||
-- end,
|
||||
-- },
|
||||
-- {
|
||||
-- "nvim-lualine/lualine.nvim",
|
||||
-- lazy = true,
|
||||
-- event = "BufWinEnter",
|
||||
-- config = function()
|
||||
-- require("user.lualine")
|
||||
-- end,
|
||||
-- },
|
||||
-- { "RRethy/vim-illuminate", event = "InsertEnter", enabled = true },
|
||||
-- { "cpea2506/one_monokai.nvim" },
|
||||
-- { "luisiacc/gruvbox-baby", lazy = true, enabled = false },
|
||||
-- { "projekt0n/github-nvim-theme", version = "v0.0.7" },
|
||||
-- { "stevearc/dressing.nvim", enabled = false },
|
||||
-- { "karb94/neoscroll.nvim", enabled = false },
|
||||
}
|
53
lua/gemini/init.lua
Normal file
53
lua/gemini/init.lua
Normal file
|
@ -0,0 +1,53 @@
|
|||
local M = {}
|
||||
M.last_popup_win = nil
|
||||
M.last_popup_buf = nil
|
||||
|
||||
function M.ask_gemini()
|
||||
-- Ambil path file buffer aktif
|
||||
--[[ local buf_path = vim.api.nvim_buf_get_name(0)
|
||||
if buf_path ~= "" then
|
||||
local dir = vim.fn.fnamemodify(buf_path, ":h")
|
||||
vim.api.nvim_set_current_dir(dir)
|
||||
end ]]
|
||||
|
||||
vim.ui.input({ prompt = "Prompt ke Gemini: " }, function(prompt)
|
||||
if not prompt or prompt == "" then
|
||||
vim.notify("Prompt kosong", vim.log.levels.WARN)
|
||||
return
|
||||
end
|
||||
|
||||
M.show_popup("Loading...")
|
||||
|
||||
vim.schedule(function()
|
||||
local output = vim.fn.system('gemini --prompt "' .. prompt .. '"')
|
||||
M.show_popup(output)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function M.show_popup(output)
|
||||
if M.last_popup_win and vim.api.nvim_win_is_valid(M.last_popup_win) then
|
||||
vim.api.nvim_win_close(M.last_popup_win, true)
|
||||
end
|
||||
if M.last_popup_buf and vim.api.nvim_buf_is_valid(M.last_popup_buf) then
|
||||
vim.api.nvim_buf_delete(M.last_popup_buf, { force = true })
|
||||
end
|
||||
|
||||
local buf = vim.api.nvim_create_buf(false, true)
|
||||
vim.api.nvim_buf_set_lines(buf, 0, -1, false, vim.split(output or "", "\n"))
|
||||
local width = math.floor(vim.o.columns * 0.6)
|
||||
local height = math.floor(vim.o.lines * 0.8)
|
||||
local win = vim.api.nvim_open_win(buf, true, {
|
||||
relative = "editor",
|
||||
width = width,
|
||||
height = height,
|
||||
row = math.floor((vim.o.lines - height) / 2),
|
||||
col = math.floor((vim.o.columns - width) / 2),
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
})
|
||||
M.last_popup_win = win
|
||||
M.last_popup_buf = buf
|
||||
end
|
||||
|
||||
return M
|
91
lua/pcode/config/lazy_lib.lua
Normal file
91
lua/pcode/config/lazy_lib.lua
Normal file
|
@ -0,0 +1,91 @@
|
|||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
|
||||
vim.opt.number = false
|
||||
|
||||
local icons = require("pcode.user.icons").ui
|
||||
-- Make sure to setup `mapleader` and `maplocalleader` before
|
||||
-- loading lazy.nvim so that mappings are correct.
|
||||
-- This is also a good place to setup other settings (vim.opt)
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
-- initialisasi plugins
|
||||
local importdata = {
|
||||
{ import = "pcode.plugins" },
|
||||
}
|
||||
-- load theme
|
||||
local theme = pcode.themes or {}
|
||||
for key, _ in pairs(theme) do
|
||||
table.insert(importdata, { import = "pcode.plugins.theme." .. key })
|
||||
end
|
||||
-- load extras plugins
|
||||
local extras = pcode.extras or {}
|
||||
for key, value in pairs(extras) do
|
||||
if value then
|
||||
table.insert(importdata, { import = "pcode.plugins.extras." .. key })
|
||||
end
|
||||
end
|
||||
-- load language config
|
||||
local lang = pcode.lang or {}
|
||||
for key, value in pairs(lang) do
|
||||
if value then
|
||||
table.insert(importdata, { import = "pcode.plugins.lang." .. key })
|
||||
end
|
||||
end
|
||||
-- load transparant config
|
||||
local transparant = pcode.transparent or false
|
||||
if transparant then
|
||||
table.insert(importdata, { import = "pcode.plugins.extras.transparent" })
|
||||
end
|
||||
-- add overide path
|
||||
table.insert(importdata, { import = "pcode.user.custom" })
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = importdata,
|
||||
ui = {
|
||||
backdrop = 100, -- Menyeting backdrop UI
|
||||
border = "rounded", -- Mengatur border UI ke rounded
|
||||
browser = "chrome", -- Menggunakan Chrome sebagai browser default
|
||||
throttle = 40, -- Menyeting throttle
|
||||
custom_keys = {
|
||||
["<localleader>l"] = false, -- Menonaktifkan kunci lokal leader l
|
||||
},
|
||||
icons = {
|
||||
ft = icons.ft,
|
||||
lazy = icons.Bell .. " ",
|
||||
loaded = icons.CheckCircle,
|
||||
not_loaded = icons.not_loaded,
|
||||
},
|
||||
},
|
||||
change_detection = { enabled = false, notify = false }, -- Nonaktifkan deteksi perubahan
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true },
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"matchit",
|
||||
"matchparen",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
9
lua/pcode/core/init.lua
Normal file
9
lua/pcode/core/init.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
_G.pcode = _G.pcode or {}
|
||||
require("pcode.user.default")
|
||||
require("pcode.config.lazy_lib")
|
||||
require("pcode.user.colorscheme")
|
||||
require("pcode.core.neovide")
|
||||
|
||||
vim.keymap.set({ "n", "v", "x" }, "<C-i>", function()
|
||||
require("gemini").ask_gemini()
|
||||
end, { noremap = true, silent = true, desc = "Prompt Gemini CLI" })
|
55
lua/pcode/plugins/_default.lua
Normal file
55
lua/pcode/plugins/_default.lua
Normal file
|
@ -0,0 +1,55 @@
|
|||
_G.idxOf = function(array, value)
|
||||
for i, v in ipairs(array) do
|
||||
if v == value then
|
||||
return i
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
_G.LAZYGIT_TOGGLE = function()
|
||||
local ok = pcall(require, "toggleterm")
|
||||
if not ok then
|
||||
require("notify")("toggleterm not found!", "error")
|
||||
return
|
||||
end
|
||||
local Terminal = require("toggleterm.terminal").Terminal
|
||||
local lazygit = Terminal:new({ cmd = "lazygit", hidden = true })
|
||||
lazygit:toggle()
|
||||
end
|
||||
|
||||
_G.substring = function(text, key)
|
||||
local index, _ = string.find(text, key)
|
||||
if index then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
_G.all_trim = function(s)
|
||||
return s:match("^%s*(.-)%s*$")
|
||||
end
|
||||
|
||||
_G.current_theme = function()
|
||||
if pcode.themes then
|
||||
local theme = ""
|
||||
for _, value in pairs(pcode.themes or {}) do
|
||||
theme = value
|
||||
end
|
||||
return all_trim(theme)
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
local function safeRequire(module)
|
||||
local ok, result = pcall(require, module)
|
||||
if ok then
|
||||
return result
|
||||
end
|
||||
end
|
||||
|
||||
safeRequire("pcode.user.options")
|
||||
safeRequire("pcode.user.autocmd")
|
||||
safeRequire("pcode.user.keymaps")
|
||||
return {}
|
95
lua/pcode/plugins/_lsp.lua
Normal file
95
lua/pcode/plugins/_lsp.lua
Normal file
|
@ -0,0 +1,95 @@
|
|||
return {
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
event = { "CmdlineEnter", "BufReadPre", "BufNewFile", "BufRead" },
|
||||
dependencies = {
|
||||
{ "pojokcodeid/auto-lsp.nvim", lazy = true },
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"LspInfo",
|
||||
"LspInstall",
|
||||
"LspUninstall",
|
||||
},
|
||||
config = function()
|
||||
require("lspconfig.ui.windows").default_options.border = "rounded"
|
||||
end,
|
||||
},
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
lazy = true,
|
||||
build = ":MasonUpdate",
|
||||
opts_extend = { "ensure_installed" },
|
||||
cmd = {
|
||||
"Mason",
|
||||
"MasonInstall",
|
||||
"MasonUninstall",
|
||||
"MasonUninstallAll",
|
||||
"MasonLog",
|
||||
},
|
||||
opts = function(_, opts)
|
||||
local icons = require("pcode.user.icons").ui
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, { "stylua" })
|
||||
opts.ui = {
|
||||
-- border = "none",
|
||||
border = icons.Border,
|
||||
icons = {
|
||||
package_pending = icons.Pending,
|
||||
package_installed = icons.CheckCircle,
|
||||
package_uninstalled = icons.BlankCircle,
|
||||
},
|
||||
keymaps = {
|
||||
toggle_server_expand = "<CR>",
|
||||
install_server = "i",
|
||||
update_server = "u",
|
||||
check_server_version = "c",
|
||||
update_all_servers = "U",
|
||||
check_outdated_servers = "C",
|
||||
uninstall_server = "X",
|
||||
},
|
||||
}
|
||||
opts.log_level = vim.log.levels.INFO
|
||||
opts.max_concurrent_installers = 4
|
||||
return opts
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("mason").setup(opts)
|
||||
local mr = require("mason-registry")
|
||||
mr:on("package:install:success", function()
|
||||
vim.defer_fn(function()
|
||||
-- trigger FileType event to possibly load this newly installed LSP server
|
||||
require("lazy.core.handler.event").trigger({
|
||||
event = "FileType",
|
||||
buf = vim.api.nvim_get_current_buf(),
|
||||
})
|
||||
end, 100)
|
||||
end)
|
||||
|
||||
mr.refresh(function()
|
||||
for _, tool in ipairs(opts.ensure_installed) do
|
||||
local p = mr.get_package(tool)
|
||||
if not p:is_installed() then
|
||||
p:install()
|
||||
end
|
||||
end
|
||||
end)
|
||||
end,
|
||||
},
|
||||
},
|
||||
opts = function(_, opts)
|
||||
opts.skip_config = opts.skip_config or {}
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
opts.automatic_installation = true
|
||||
vim.list_extend(opts.ensure_installed, { "lua_ls" })
|
||||
opts.format_on_save = true -- if use none-ls set true
|
||||
opts.virtual_text = true
|
||||
opts.timeout_ms = 5000
|
||||
return opts
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("auto-lsp").setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
50
lua/pcode/plugins/_treesitter.lua
Normal file
50
lua/pcode/plugins/_treesitter.lua
Normal file
|
@ -0,0 +1,50 @@
|
|||
return {
|
||||
{ "nvim-lua/plenary.nvim", event = "VeryLazy" },
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufRead", "VeryLazy" },
|
||||
version = false,
|
||||
build = ":TSUpdate",
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"TSInstall",
|
||||
-- "TSInstallInfo",
|
||||
"TSInstallSync",
|
||||
"TSUpdate",
|
||||
"TSUpdateSync",
|
||||
"TSUninstall",
|
||||
"TSUninstallInfo",
|
||||
"TSInstallFromGrammar",
|
||||
},
|
||||
opts = function()
|
||||
return {
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
ensure_installed = { "lua", "luadoc", "printf", "vim", "vimdoc" },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
},
|
||||
autopairs = {
|
||||
enable = true,
|
||||
},
|
||||
}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
if type(opts.ensure_installed) == "table" then
|
||||
---@type table<string, boolean>
|
||||
local added = {}
|
||||
opts.ensure_installed = vim.tbl_filter(function(lang)
|
||||
if added[lang] then
|
||||
return false
|
||||
end
|
||||
added[lang] = true
|
||||
return true
|
||||
end, opts.ensure_installed)
|
||||
end
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
vim.api.nvim_create_user_command("TSInstallInfo", function()
|
||||
vim.cmd("Telescope treesitter_info")
|
||||
end, {})
|
||||
end,
|
||||
},
|
||||
}
|
35
lua/pcode/plugins/_treesitterautopairs.lua
Normal file
35
lua/pcode/plugins/_treesitterautopairs.lua
Normal file
|
@ -0,0 +1,35 @@
|
|||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
lazy = true,
|
||||
dependencies = "hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
opts = {
|
||||
check_ts = true,
|
||||
ts_config = {
|
||||
lua = { "string", "source" },
|
||||
javascript = { "string", "template_string" },
|
||||
java = false,
|
||||
},
|
||||
disable_filetype = { "TelescopePrompt", "spectre_panel" },
|
||||
fast_wrap = {
|
||||
map = "<M-e>",
|
||||
chars = { "{", "[", "(", '"', "'", "`" },
|
||||
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
|
||||
offset = 0, -- Offset from pattern match
|
||||
end_key = "$",
|
||||
keys = "qwertyuiopzxcvbnmasdfghjkl",
|
||||
check_comma = true,
|
||||
highlight = "PmenuSel",
|
||||
highlight_grey = "LineNr",
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("nvim-autopairs").setup(opts)
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
|
||||
end,
|
||||
}
|
6
lua/pcode/plugins/_treesitterautotag.lua
Normal file
6
lua/pcode/plugins/_treesitterautotag.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
"windwp/nvim-ts-autotag",
|
||||
lazy = true,
|
||||
event = { "BufRead", "InsertEnter" },
|
||||
opts = {},
|
||||
}
|
82
lua/pcode/plugins/alpha.lua
Normal file
82
lua/pcode/plugins/alpha.lua
Normal file
|
@ -0,0 +1,82 @@
|
|||
local M = {
|
||||
"goolord/alpha-nvim",
|
||||
event = "VimEnter",
|
||||
}
|
||||
|
||||
M.opts = {
|
||||
dash_model = {
|
||||
[[ _ __ __ ]],
|
||||
[[ ___ ___ (____ / /__ _______ ___/ ___ ]],
|
||||
[[ / _ / _ \ / / _ \/ '_/ / __/ _ / _ / -_) ]],
|
||||
[[ / .__\_____/ /\___/_/\_\ \__/\___\_,_/\__/ ]],
|
||||
[[ /_/ |___/ ]],
|
||||
},
|
||||
}
|
||||
|
||||
function M.config(_, opts)
|
||||
local alpha = require("alpha")
|
||||
local startify = require("alpha.themes.startify")
|
||||
startify.section.header.val = pcode.dashboard or opts.dash_model
|
||||
startify.section.top_buttons.val = {
|
||||
startify.button("F", " Find file", ":Telescope find_files <CR>"),
|
||||
startify.button("e", " New file", ":ene <BAR> startinsert <CR>"),
|
||||
startify.button("p", " Find project", ":Telescope projects <CR>"),
|
||||
startify.button("r", " Recently used files", ":Telescope oldfiles <CR>"),
|
||||
startify.button("t", " Find text", ":Telescope live_grep <CR>"),
|
||||
startify.button("c", " Configuration", ":e $MYVIMRC <CR>"),
|
||||
startify.button("l", " Lazy", ":Lazy<CR>"),
|
||||
startify.button("q", " Quit", ":qa<CR>"),
|
||||
}
|
||||
-- disable MRU
|
||||
startify.section.mru.val = { { type = "padding", val = 4 } }
|
||||
-- disable MRU cwd
|
||||
startify.section.mru_cwd.val = { { type = "padding", val = 0 } }
|
||||
-- disable nvim_web_devicons
|
||||
startify.nvim_web_devicons.enabled = false
|
||||
startify.section.bottom_buttons.val = {}
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "LazyVimStarted",
|
||||
desc = "Add Alpha dashboard footer",
|
||||
once = true,
|
||||
callback = function()
|
||||
local stats = require("lazy").stats()
|
||||
local ms = math.floor(stats.startuptime * 100 + 0.5) / 100
|
||||
-- stylua: ignore
|
||||
startify.section.footer.val = {
|
||||
-- {
|
||||
-- type = "text",
|
||||
-- val = {"───────────────────────────────────────────"},
|
||||
-- },
|
||||
{
|
||||
type = "text",
|
||||
val = {
|
||||
"⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms",
|
||||
},
|
||||
},
|
||||
-- {
|
||||
-- type = "text",
|
||||
-- val = {"───────────────────────────────────────────"},
|
||||
-- },
|
||||
}
|
||||
pcall(vim.cmd.AlphaRedraw)
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "User" }, {
|
||||
pattern = { "AlphaReady" },
|
||||
callback = function()
|
||||
vim.cmd([[
|
||||
set laststatus=0 | autocmd BufUnload <buffer> set laststatus=3
|
||||
]])
|
||||
end,
|
||||
})
|
||||
-- ignore filetypes in MRU
|
||||
local default_mru_ignore = {}
|
||||
startify.mru_opts.ignore = function(path, ext)
|
||||
return (string.find(path, "COMMIT_EDITMSG")) or (vim.tbl_contains(default_mru_ignore, ext))
|
||||
end
|
||||
alpha.setup(startify.config)
|
||||
end
|
||||
|
||||
return M
|
34
lua/pcode/plugins/bufferline.lua
Normal file
34
lua/pcode/plugins/bufferline.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
return {
|
||||
"akinsho/bufferline.nvim",
|
||||
branch = "main",
|
||||
event = { "BufRead", "InsertEnter", "BufNewFile" },
|
||||
dependencies = "pojokcodeid/auto-bufferline.nvim",
|
||||
config = function()
|
||||
vim.opt.termguicolors = true
|
||||
local config = require("auto-bufferline").config()
|
||||
require("bufferline").setup(config)
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>b", "", desc = " Buffers", mode = "n" },
|
||||
{
|
||||
"<leader>bb",
|
||||
function()
|
||||
require("telescope.builtin").buffers(require("telescope.themes").get_dropdown({ previewer = false }))
|
||||
end,
|
||||
desc = "All Buffer",
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"<leader>bc",
|
||||
function()
|
||||
require("auto-bufferline.configs.utils").bufremove()
|
||||
end,
|
||||
desc = "Close current buffer",
|
||||
mode = "n",
|
||||
},
|
||||
{ "<leader>bd", "<cmd>BufferLineCloseLeft<cr>", desc = "Close Buffer Left", mode = "n" },
|
||||
{ "<leader>bD", "<cmd>BufferLineCloseRight<cr>", desc = "Close Buffer Right", mode = "n" },
|
||||
{ "<leader>ba", "<cmd>BufferLineCloseOthers<cr>", desc = "Close Buffer Other", mode = "n" },
|
||||
{ "<leader>bA", "<cmd>BufferLineCloseOthers<cr><cmd>bd!<cr>", desc = "Close Buffer All", mode = "n" },
|
||||
},
|
||||
}
|
151
lua/pcode/plugins/cmp.lua
Normal file
151
lua/pcode/plugins/cmp.lua
Normal file
|
@ -0,0 +1,151 @@
|
|||
return {
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
event = "InsertEnter",
|
||||
version = "v2.*",
|
||||
-- build = "make install_jsregexp",
|
||||
opts = {
|
||||
history = true,
|
||||
delete_check_events = "TextChanged",
|
||||
},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "<tab>", function() require("luasnip").jump(1) end, mode = "s" },
|
||||
{ "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } },
|
||||
},
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
version = false, -- last release is way too old
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"xzbdmw/colorful-menu.nvim",
|
||||
"lukas-reineke/cmp-rg",
|
||||
},
|
||||
opts = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
local check_backspace = function()
|
||||
local col = vim.fn.col(".") - 1
|
||||
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
|
||||
end
|
||||
|
||||
return {
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif check_backspace() then
|
||||
fallback()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "rg" },
|
||||
}),
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = function(entry, vim_item)
|
||||
vim_item.menu = vim.api.nvim_get_mode().mode == "c" and "" or all_trim(vim_item.kind)
|
||||
vim_item.kind = string.format("%s", all_trim(require("pcode.user.icons")["kind2"][vim_item.kind]))
|
||||
|
||||
local original_notify = vim.notify
|
||||
vim.notify = function(msg, level, opts)
|
||||
if type(msg) == "string" and msg:match("has new line character, please open an issue") then
|
||||
return
|
||||
end
|
||||
original_notify(msg, level, opts)
|
||||
end
|
||||
|
||||
local ok, highlights_info = pcall(require("colorful-menu").cmp_highlights, entry)
|
||||
if ok and highlights_info ~= nil then
|
||||
vim_item.abbr_hl_group = highlights_info.highlights
|
||||
|
||||
-- ambil nama group hilightnya saja
|
||||
-- eg. "@parameter"
|
||||
local var_hilight = highlights_info.highlights[1][1]
|
||||
local id = vim.fn.hlID(var_hilight)
|
||||
|
||||
local var_out = "@tag"
|
||||
-- cek apakah hilight terdefinisi
|
||||
if id ~= 0 then
|
||||
var_out = var_hilight
|
||||
else
|
||||
var_out = var_hilight:match("([^%.]+)")
|
||||
end
|
||||
|
||||
vim_item.menu_hl_group = var_out
|
||||
-- vim.notify(var_out)
|
||||
else
|
||||
vim_item.abbr_hl_group = "CmpItemAbbr"
|
||||
vim_item.menu_hl_group = "CmpItemAbbr"
|
||||
end
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = false,
|
||||
native_menu = false,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
"rafamadriz/friendly-snippets",
|
||||
event = "InsertEnter",
|
||||
lazy = true,
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("pcode.user.snippets")
|
||||
end,
|
||||
},
|
||||
}
|
141
lua/pcode/plugins/cmpcmdline.lua
Normal file
141
lua/pcode/plugins/cmpcmdline.lua
Normal file
|
@ -0,0 +1,141 @@
|
|||
return {
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
lazy = true,
|
||||
enabled = true,
|
||||
dependencies = {
|
||||
{ "MunifTanjim/nui.nvim" },
|
||||
},
|
||||
event = "CmdlineEnter",
|
||||
opts = {
|
||||
messages = {
|
||||
enabled = false,
|
||||
},
|
||||
notify = {
|
||||
enabled = false,
|
||||
},
|
||||
lsp = {
|
||||
progress = {
|
||||
enabled = false,
|
||||
},
|
||||
hover = {
|
||||
enabled = false,
|
||||
},
|
||||
signature = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
-- Preset ini menyesuaikan bentuk cursor pada mode commond
|
||||
command_bar_cursor = {
|
||||
enabled = true,
|
||||
cursor_shape = "ver30", -- "ver" menandakan bar vertikal, 30 adalah tinggi dalam persen
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<S-Enter>",
|
||||
function()
|
||||
require("noice").redirect(vim.fn.getcmdline())
|
||||
end,
|
||||
mode = "c",
|
||||
desc = "Redirect Cmdline",
|
||||
},
|
||||
{
|
||||
"<leader>snl",
|
||||
function()
|
||||
require("noice").cmd("last")
|
||||
end,
|
||||
desc = "Noice Last Message",
|
||||
},
|
||||
{
|
||||
"<leader>snh",
|
||||
function()
|
||||
require("noice").cmd("history")
|
||||
end,
|
||||
desc = "Noice History",
|
||||
},
|
||||
{
|
||||
"<leader>sna",
|
||||
function()
|
||||
require("noice").cmd("all")
|
||||
end,
|
||||
desc = "Noice All",
|
||||
},
|
||||
{
|
||||
"<c-f>",
|
||||
function()
|
||||
if not require("noice.lsp").scroll(4) then
|
||||
return "<c-f>"
|
||||
end
|
||||
end,
|
||||
silent = true,
|
||||
expr = true,
|
||||
desc = "Scroll forward",
|
||||
mode = { "i", "n", "s" },
|
||||
},
|
||||
{
|
||||
"<c-b>",
|
||||
function()
|
||||
if not require("noice.lsp").scroll(-4) then
|
||||
return "<c-b>"
|
||||
end
|
||||
end,
|
||||
silent = true,
|
||||
expr = true,
|
||||
desc = "Scroll backward",
|
||||
mode = { "i", "n", "s" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"hrsh7th/cmp-cmdline",
|
||||
-- event = "VeryLazy",
|
||||
event = "CmdlineEnter",
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local mapping = {
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Up>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
|
||||
["<S-Tab>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
|
||||
["<Down>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
|
||||
["<Tab>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
|
||||
}
|
||||
|
||||
-- Use buffer source for `/`.
|
||||
cmp.setup.cmdline("/", {
|
||||
preselect = "none",
|
||||
completion = {
|
||||
completeopt = "menu,preview,menuone,noselect",
|
||||
},
|
||||
mapping = mapping,
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
native_menu = false,
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':'.
|
||||
cmp.setup.cmdline(":", {
|
||||
preselect = "none",
|
||||
completion = {
|
||||
completeopt = "menu,preview,menuone,noselect",
|
||||
},
|
||||
mapping = mapping,
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
native_menu = false,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
64
lua/pcode/plugins/coderunner.lua
Normal file
64
lua/pcode/plugins/coderunner.lua
Normal file
|
@ -0,0 +1,64 @@
|
|||
--typescript = "deno run",
|
||||
-- cpp="gcc $fileName -lstdc++ -o $fileNameWithoutExt && $fileNameWithoutExt"
|
||||
local pyrun = "python -u"
|
||||
if vim.fn.has("win32") == 0 then
|
||||
pyrun = "python3 -u"
|
||||
end
|
||||
local rfile = {
|
||||
java = "cd $dir && javac $fileName && java $fileNameWithoutExt",
|
||||
python = pyrun,
|
||||
typescript = "ts-node $dir/$fileName",
|
||||
rust = "cd $dir && rustc $fileName && $dir/$fileNameWithoutExt",
|
||||
cpp = "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt",
|
||||
scss = "sass $dir/$fileName $dir/$fileNameWithoutExt.css",
|
||||
javascript = 'node "$dir/$fileName"',
|
||||
-- go = "go run .",
|
||||
go = "go run $fileName",
|
||||
}
|
||||
|
||||
local runProject = {}
|
||||
local cwd = vim.fn.getcwd()
|
||||
local go_mod_path = cwd .. "/go.mod"
|
||||
if vim.fn.filereadable(go_mod_path) ~= 0 then
|
||||
runProject[cwd] = {
|
||||
name = "Go Project (cwd)",
|
||||
command = "go run .",
|
||||
}
|
||||
end
|
||||
|
||||
return {
|
||||
"CRAG666/code_runner.nvim",
|
||||
lazy = true,
|
||||
cmd = { "RunCode", "RunFile", "RunProject", "RunClose" },
|
||||
opts = {
|
||||
filetype = rfile,
|
||||
project = runProject,
|
||||
mode = "float",
|
||||
focus = true,
|
||||
startinsert = true,
|
||||
term = {
|
||||
position = "bot",
|
||||
size = 50,
|
||||
},
|
||||
float = {
|
||||
close_key = "<ESC>",
|
||||
border = "rounded",
|
||||
height = 0.8,
|
||||
width = 0.8,
|
||||
x = 0.5,
|
||||
y = 0.5,
|
||||
border_hl = "FloatBorder",
|
||||
float_hl = "Normal",
|
||||
blend = 0,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("code_runner").setup(opts)
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>r", "", desc = " Run", mode = "n" },
|
||||
{ "<leader>rr", "<cmd>RunCode<CR>", desc = "Run Code", mode = "n" },
|
||||
{ "<leader>rf", "<cmd>RunFile<CR>", desc = "Run File", mode = "n" },
|
||||
{ "<leader>rp", "<cmd>RunProject<CR>", desc = "Run Project", mode = "n" },
|
||||
},
|
||||
}
|
29
lua/pcode/plugins/comment.lua
Normal file
29
lua/pcode/plugins/comment.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
return {
|
||||
"numToStr/Comment.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||
},
|
||||
opts = function()
|
||||
return {
|
||||
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
|
||||
}
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<leader>/",
|
||||
"<Plug>(comment_toggle_linewise_current)",
|
||||
desc = " Coment line",
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"<leader>/",
|
||||
"<Plug>(comment_toggle_linewise_visual)",
|
||||
desc = " Coment line",
|
||||
mode = "v",
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("Comment").setup(opts)
|
||||
end,
|
||||
}
|
43
lua/pcode/plugins/conform.lua
Normal file
43
lua/pcode/plugins/conform.lua
Normal file
|
@ -0,0 +1,43 @@
|
|||
return {
|
||||
"pojokcodeid/auto-conform.nvim",
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
"stevearc/conform.nvim",
|
||||
},
|
||||
event = "BufRead",
|
||||
opts = function(_, opts)
|
||||
opts.formatters = opts.formatters or {}
|
||||
opts.formatters_by_ft = opts.formatters_by_ft or {}
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
-- vim.list_extend(opts.ensure_installed, { "stylua" })
|
||||
opts.lang_maps = opts.lang_maps or {}
|
||||
opts.name_maps = opts.name_maps or {}
|
||||
opts.add_new = opts.add_new or {}
|
||||
opts.ignore = opts.ignore or {}
|
||||
opts.format_on_save = opts.format_on_save or true
|
||||
opts.format_timeout_ms = opts.format_timeout_ms or 5000
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("auto-conform").setup(opts)
|
||||
-- other conform config
|
||||
local conform = require("conform")
|
||||
if opts.format_on_save then
|
||||
conform.setup({
|
||||
format_on_save = {
|
||||
lsp_fallback = true,
|
||||
timeout_ms = opts.format_timeout_ms or 5000,
|
||||
},
|
||||
})
|
||||
end
|
||||
vim.keymap.set({ "n", "v" }, "<leader>lF", function()
|
||||
conform.format({
|
||||
lsp_fallback = true,
|
||||
async = false,
|
||||
timeout_ms = opts.format_timeout_ms or 5000,
|
||||
})
|
||||
end, { desc = "Format file or range (in visual mode)" })
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>l", "", desc = " Lsp" },
|
||||
},
|
||||
}
|
34
lua/pcode/plugins/dressing.lua
Normal file
34
lua/pcode/plugins/dressing.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
return {
|
||||
"stevearc/dressing.nvim",
|
||||
lazy = true,
|
||||
init = function()
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
vim.ui.select = function(...)
|
||||
require("lazy").load({ plugins = { "dressing.nvim" } })
|
||||
return vim.ui.select(...)
|
||||
end
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
--[[ vim.ui.input = function(...)
|
||||
require("lazy").load({ plugins = { "dressing.nvim" } })
|
||||
return vim.ui.input(...)
|
||||
end ]]
|
||||
end,
|
||||
opts = {
|
||||
input = {
|
||||
title_pos = "center",
|
||||
relative = "editor",
|
||||
default_prompt = "➤ ",
|
||||
win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" },
|
||||
prefer_width = 30,
|
||||
max_width = { 140, 0.9 },
|
||||
min_width = { 50, 0.2 },
|
||||
},
|
||||
select = {
|
||||
backend = { "telescope", "builtin" },
|
||||
builtin = { win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" } },
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("dressing").setup(opts)
|
||||
end,
|
||||
}
|
49
lua/pcode/plugins/extras/autosave.lua
Normal file
49
lua/pcode/plugins/extras/autosave.lua
Normal file
|
@ -0,0 +1,49 @@
|
|||
return {
|
||||
"okuuva/auto-save.nvim",
|
||||
version = "^1.0.0", -- see https://devhints.io/semver, alternatively use '*' to use the latest tagged release
|
||||
cmd = "ASToggle", -- optional for lazy loading on command
|
||||
event = { "InsertLeave", "TextChanged" }, -- optional for lazy loading on trigger events
|
||||
opts = {
|
||||
enabled = true, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it)
|
||||
trigger_events = { -- See :h events
|
||||
immediate_save = { "BufLeave", "FocusLost" }, -- vim events that trigger an immediate save
|
||||
defer_save = { "InsertLeave", "TextChanged" }, -- vim events that trigger a deferred save (saves after `debounce_delay`)
|
||||
cancel_deferred_save = { "InsertEnter" }, -- vim events that cancel a pending deferred save
|
||||
},
|
||||
-- function that takes the buffer handle and determines whether to save the current buffer or not
|
||||
-- return true: if buffer is ok to be saved
|
||||
-- return false: if it's not ok to be saved
|
||||
-- if set to `nil` then no specific condition is applied
|
||||
condition = nil,
|
||||
write_all_buffers = false, -- write all buffers when the current one meets `condition`
|
||||
noautocmd = false, -- do not execute autocmds when saving
|
||||
lockmarks = false, -- lock marks when saving, see `:h lockmarks` for more details
|
||||
debounce_delay = 1500, -- delay after which a pending save is executed
|
||||
-- log debug messages to 'auto-save.log' file in neovim cache directory, set to `true` to enable
|
||||
debug = false,
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("auto-save").setup(opts)
|
||||
local group = vim.api.nvim_create_augroup("autosave", {})
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "AutoSaveWritePost",
|
||||
group = group,
|
||||
callback = function(opts)
|
||||
local ftype = vim.bo.filetype
|
||||
if opts.data.saved_buffer ~= nil and ftype ~= "TelescopePrompt" and not substring(tostring(ftype), "dap") then
|
||||
local filename = vim.api.nvim_buf_get_name(opts.data.saved_buffer)
|
||||
local is_ok = pcall(require, "notify")
|
||||
if is_ok then
|
||||
require("notify")("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"))
|
||||
else
|
||||
print("AutoSave: saved " .. filename .. " at " .. vim.fn.strftime("%H:%M:%S"))
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>n", ":ASToggle<CR>", desc = " Toggle auto-save" },
|
||||
},
|
||||
}
|
8
lua/pcode/plugins/extras/bigfiles.lua
Normal file
8
lua/pcode/plugins/extras/bigfiles.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
"LunarVim/bigfile.nvim",
|
||||
lazy = true,
|
||||
event = "BufReadPre",
|
||||
opts = {
|
||||
file_size = 2,
|
||||
},
|
||||
}
|
73
lua/pcode/plugins/extras/cheatsheet.lua
Normal file
73
lua/pcode/plugins/extras/cheatsheet.lua
Normal file
|
@ -0,0 +1,73 @@
|
|||
return {
|
||||
"pojokcodeid/cheatsheet-nvim",
|
||||
event = "VeryLazy",
|
||||
keys = {
|
||||
{ "<F1>", "<cmd>KeymapsPopup<cr>", desc = "Keymaps Popup" },
|
||||
},
|
||||
cmd = { "KeymapsPopup" },
|
||||
opts = {
|
||||
["LSP"] = {
|
||||
{ "LSP Code Action", "n", "<leader>la" },
|
||||
{ "LSP Code Format", "n", "<leader>lf" },
|
||||
{ "LSP Information", "n", "<leader>li" },
|
||||
{ "Mason Information", "n", "<leader>lI" },
|
||||
{ "LSP Next Diagnostic", "n", "<leader>lj" },
|
||||
{ "LSP Previous Diagnostic", "n", "<leader>lk" },
|
||||
{ "LSP Quickfix", "n", "<leader<lq" },
|
||||
{ "LSP Rename", "n", "<leader>lr" },
|
||||
{ "LSP Signature Help", "n", "<leader>ls" },
|
||||
{ "LSP Format On Range", "v", "<leader>lF" },
|
||||
},
|
||||
["Cmp"] = {
|
||||
{ "Scroll Next Documentation", "i", "CTRL + f" },
|
||||
{ "Scroll Previous Documentation", "i", "CTRL + b" },
|
||||
{ "Mapping Complete", "i", "CTRL + space" },
|
||||
{ "Abort Completion", "i", "CTRL + e" },
|
||||
{ "Accept Completion", "i", "↵" },
|
||||
{ "Next Autocompletion", "i", "TAB" },
|
||||
{ "Previous Autocompletion", "i", "SHIFT + TAB" },
|
||||
},
|
||||
["Terminal"] = {
|
||||
{ "Terminal Float", "n", "<leader>tf" },
|
||||
{ "Terminal Horizontal", "n", "<leader>th" },
|
||||
{ "Terminal new tab", "n", "<leader>ts" },
|
||||
{ "Terminal Vertical", "n", "<leader>tv" },
|
||||
{ "Terminal Close", "n", "<leader>tx" },
|
||||
},
|
||||
["Comment"] = {
|
||||
{ "Comment line toggle", "n/v", "gcc or CTRL + /" },
|
||||
{ "Comment block toggle", "n/v", "gbc or CTRL + /" },
|
||||
{ "Comment visual selection", "v", "gc" },
|
||||
{ "Comment visual selection using block delimiters", "v", "gb" },
|
||||
{ "Comment out text object line wise", "v", "gc<motion>" },
|
||||
{ "Comment out text object block wise", "v", "gb<motion>" },
|
||||
{ "Add comment on the line above", "n", "gcO" },
|
||||
{ "Add comment on the line below", "n", "gco" },
|
||||
{ "Add comment at the end of line", "n", "gcA" },
|
||||
},
|
||||
["Bufferline"] = {
|
||||
{ "Move Active Buffer Left", "n", "SHIFT + h/SHIFT + Left" },
|
||||
{ "Move Active Buffer Right", "n", "SHIFT + l/SHIFT + Right" },
|
||||
{ "Reorder Bufferline", "n", "SHIFT + PageUp/PageDown" },
|
||||
{ "Close Current Buffer", "n", "SHIFT + t" },
|
||||
},
|
||||
["Window"] = {
|
||||
{ "Resize Window", "n", "CTRL + Left/Right/Up/Down" },
|
||||
{ "Navigate Window", "n", "CTRL + h/l" },
|
||||
},
|
||||
["Text-Manipulation"] = {
|
||||
{ "Select Multiple Cursor Vertical", "n/i", "SHIFT + ALT + Up/Down" },
|
||||
{ "Select text", "n", "CTRL + d" },
|
||||
{ "Select Multiple Cursor", "i/n", "ALT + Left Click Mouse" },
|
||||
{ "Duplicate Row", "i/n/v", "SHIFT + ALT + Up/Down" },
|
||||
{ "Move Row", "i/n/v", "ALT + Up/Down" },
|
||||
},
|
||||
["Ai"] = {
|
||||
{ "Approve AI Sugention", "i", "CTRL + g" },
|
||||
{ "Change AI Option", "i", "CTRL + Up/Down" },
|
||||
{ "Clear AI Sugention", "i", "CTRL + x" },
|
||||
},
|
||||
},
|
||||
|
||||
config = true,
|
||||
}
|
33
lua/pcode/plugins/extras/codeium.lua
Normal file
33
lua/pcode/plugins/extras/codeium.lua
Normal file
|
@ -0,0 +1,33 @@
|
|||
return {
|
||||
"exafunction/codeium.vim",
|
||||
enabled = true,
|
||||
-- for fix notwork new version
|
||||
-- https://github.com/exafunction/codeium.vim/issues/376#issuecomment-2159643405
|
||||
-- version = "1.8.37",
|
||||
-- event = "bufwinenter",
|
||||
-- event = "bufenter",
|
||||
-- event = "insertenter",
|
||||
event = { "VeryLazy", "bufreadpre", "bufnewfile", "bufread" },
|
||||
build = ":Codeium Auth",
|
||||
cmd = { "CodeiumChat" },
|
||||
config = function()
|
||||
vim.g.codeium_disable_bindings = 1
|
||||
|
||||
-- Change '<C-g>' here to any keycode you like.
|
||||
vim.keymap.set("i", "<C-g>", function()
|
||||
return vim.fn["codeium#Accept"]()
|
||||
end, { expr = true, silent = true })
|
||||
vim.keymap.set("i", "<c-Up>", function()
|
||||
return vim.fn["codeium#CycleCompletions"](1)
|
||||
end, { expr = true, silent = true })
|
||||
vim.keymap.set("i", "<c-Down>", function()
|
||||
return vim.fn["codeium#CycleCompletions"](-1)
|
||||
end, { expr = true, silent = true })
|
||||
vim.keymap.set("i", "<c-x>", function()
|
||||
return vim.fn["codeium#Clear"]()
|
||||
end, { expr = true, silent = true })
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>c", ":CodeiumChat<cr>", desc = " codeium chat", mode = "n" },
|
||||
},
|
||||
}
|
38
lua/pcode/plugins/extras/codeiumnvim.lua
Normal file
38
lua/pcode/plugins/extras/codeiumnvim.lua
Normal file
|
@ -0,0 +1,38 @@
|
|||
return {
|
||||
-- codeium cmp source
|
||||
{
|
||||
"nvim-cmp",
|
||||
event = "BufReadPre",
|
||||
dependencies = {
|
||||
-- codeium
|
||||
{
|
||||
"Exafunction/windsurf.nvim",
|
||||
cmd = "Codeium",
|
||||
enabled = true,
|
||||
opts = {
|
||||
enable_chat = true,
|
||||
enable_cmp_source = true,
|
||||
virtual_text = {
|
||||
enabled = true,
|
||||
key_bindings = {
|
||||
accept = "<c-g>",
|
||||
next = "<c-Down>",
|
||||
prev = "<c-Up>",
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("codeium").setup(opts)
|
||||
end,
|
||||
},
|
||||
},
|
||||
--@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sources, 1, {
|
||||
name = "codeium",
|
||||
group_index = 1,
|
||||
priority = 100,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
25
lua/pcode/plugins/extras/colorizer.lua
Normal file
25
lua/pcode/plugins/extras/colorizer.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
return {
|
||||
"NvChad/nvim-colorizer.lua",
|
||||
lazy = true,
|
||||
event = { "BufRead", "InsertEnter", "BufNewFile" },
|
||||
opts = {
|
||||
user_default_options = {
|
||||
RGB = true, -- #RGB hex codes
|
||||
RRGGBB = true, -- #RRGGBB hex codes
|
||||
names = true, -- "Name" codes like Blue
|
||||
RRGGBBAA = true, -- #RRGGBBAA hex codes
|
||||
rgb_fn = true, -- CSS rgb() and rgba() functions
|
||||
hsl_fn = true, -- CSS hsl() and hsla() functions
|
||||
css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||
css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||
-- Available modes: foreground, background
|
||||
mode = "background", -- Set the display mode.
|
||||
tailwind = true,
|
||||
},
|
||||
filetypes = {
|
||||
"*", -- Highlight all files, but customize some others.
|
||||
css = { rgb_fn = true }, -- Enable parsing rgb(...) functions in css.
|
||||
html = { names = false }, -- Disable parsing "names" like Blue or Gray
|
||||
},
|
||||
},
|
||||
}
|
62
lua/pcode/plugins/extras/dap.lua
Normal file
62
lua/pcode/plugins/extras/dap.lua
Normal file
|
@ -0,0 +1,62 @@
|
|||
return {
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
lazy = true,
|
||||
event = "BufRead",
|
||||
dependencies = {
|
||||
{ "mfussenegger/nvim-dap", lazy = true },
|
||||
{ "nvim-neotest/nvim-nio", lazy = true },
|
||||
{
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
opts = {
|
||||
virt_text_win_col = 80,
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require("pcode.user.dapui")
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>d", "", desc = " Debug" },
|
||||
{ "<leader>dt", "<cmd>lua require'dap'.toggle_breakpoint()<cr>", desc = "Toggle Breakpoint" },
|
||||
{ "<leader>db", "<cmd>lua require'dap'.step_back()<cr>", desc = "Step Back" },
|
||||
{ "<leader>dc", "<cmd>lua require'dap'.continue()<cr>", desc = "Continue" },
|
||||
{ "<leader>dC", "<cmd>lua require'dap'.run_to_cursor()<cr>", desc = "Run To Cursor" },
|
||||
{ "<leader>dd", "<cmd>lua require'dap'.disconnect()<cr>", desc = "Disconnect" },
|
||||
{ "<leader>dg", "<cmd>lua require'dap'.session()<cr>", desc = "Get Session" },
|
||||
{ "<leader>di", "<cmd>lua require'dap'.step_into()<cr>", desc = "Step Into" },
|
||||
{ "<leader>do", "<cmd>lua require'dap'.step_over()<cr>", desc = "Step Over" },
|
||||
{ "<leader>du", "<cmd>lua require'dap'.step_out()<cr>", desc = "Step Out" },
|
||||
{ "<leader>dp", "<cmd>lua require'dap'.pause()<cr>", desc = "Pause" },
|
||||
{ "<leader>dr", "<cmd>lua require'dap'.repl.toggle()<cr>", desc = "Toggle Repl" },
|
||||
{ "<leader>ds", "<cmd>lua require'dap'.continue()<cr>", desc = "Start" },
|
||||
{ "<leader>dq", "<cmd>lua require'dap'.close()<cr>", desc = "Quit" },
|
||||
{ "<leader>dU", "<cmd>lua require'dapui'.toggle({reset = true})<cr>", desc = "Toggle UI" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
lazy = true,
|
||||
event = "BufRead",
|
||||
dependencies = { "williamboman/mason.nvim", "mfussenegger/nvim-dap" },
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, {})
|
||||
opts.automatic_setup = true
|
||||
opts.handlers = {
|
||||
function(config)
|
||||
-- all sources with no handler get passed here
|
||||
|
||||
-- Keep original functionality
|
||||
require("mason-nvim-dap").default_setup(config)
|
||||
end,
|
||||
}
|
||||
return opts
|
||||
end,
|
||||
-- enabled = vim.fn.has("win32") == 0,
|
||||
config = function(_, opts)
|
||||
require("mason").setup()
|
||||
require("mason-nvim-dap").setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
7
lua/pcode/plugins/extras/deviconcolor.lua
Normal file
7
lua/pcode/plugins/extras/deviconcolor.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
"rachartier/tiny-devicons-auto-colors.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("tiny-devicons-auto-colors").setup()
|
||||
end,
|
||||
}
|
35
lua/pcode/plugins/extras/dressing.lua
Normal file
35
lua/pcode/plugins/extras/dressing.lua
Normal file
|
@ -0,0 +1,35 @@
|
|||
return {
|
||||
"pojokcodeid/dressing.nvim",
|
||||
lazy = true,
|
||||
init = function()
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
vim.ui.select = function(...)
|
||||
require("lazy").load({ plugins = { "dressing.nvim" } })
|
||||
return vim.ui.select(...)
|
||||
end
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
-- vim.ui.input = function(...)
|
||||
-- require("lazy").load({ plugins = { "dressing.nvim" } })
|
||||
-- return vim.ui.input(...)
|
||||
-- end
|
||||
end,
|
||||
opts = {
|
||||
input = {
|
||||
enabled = false,
|
||||
title_pos = "center",
|
||||
relative = "editor",
|
||||
default_prompt = "➤ ",
|
||||
win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" },
|
||||
prefer_width = 30,
|
||||
max_width = { 140, 0.9 },
|
||||
min_width = { 50, 0.2 },
|
||||
},
|
||||
select = {
|
||||
backend = { "telescope", "builtin" },
|
||||
builtin = { win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" } },
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("dressing").setup(opts)
|
||||
end,
|
||||
}
|
14
lua/pcode/plugins/extras/fidget.lua
Normal file
14
lua/pcode/plugins/extras/fidget.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
return {
|
||||
"j-hui/fidget.nvim",
|
||||
lazy = true,
|
||||
tag = "legacy",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("fidget").setup({
|
||||
window = {
|
||||
blend = 0,
|
||||
relative = "editor",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
65
lua/pcode/plugins/extras/illuminate.lua
Normal file
65
lua/pcode/plugins/extras/illuminate.lua
Normal file
|
@ -0,0 +1,65 @@
|
|||
local M = {
|
||||
"RRethy/vim-illuminate",
|
||||
event = "BufRead",
|
||||
}
|
||||
|
||||
M.opts = {
|
||||
delay = 200,
|
||||
large_file_cutoff = 2000,
|
||||
large_file_overrides = {
|
||||
providers = { "lsp" },
|
||||
},
|
||||
filetypes_denylist = {
|
||||
"mason",
|
||||
"harpoon",
|
||||
"DressingInput",
|
||||
"NeogitCommitMessage",
|
||||
"qf",
|
||||
"dirvish",
|
||||
"oil",
|
||||
"minifiles",
|
||||
"fugitive",
|
||||
"alpha",
|
||||
"NvimTree",
|
||||
"lazy",
|
||||
"NeogitStatus",
|
||||
"Trouble",
|
||||
"netrw",
|
||||
"lir",
|
||||
"DiffviewFiles",
|
||||
"Outline",
|
||||
"Jaq",
|
||||
"spectre_panel",
|
||||
"toggleterm",
|
||||
"DressingSelect",
|
||||
"TelescopePrompt",
|
||||
},
|
||||
}
|
||||
|
||||
function M.config(_, opts)
|
||||
require("illuminate").configure(opts)
|
||||
local function map(key, dir, buffer)
|
||||
vim.keymap.set("n", key, function()
|
||||
require("illuminate")["goto_" .. dir .. "_reference"](false)
|
||||
end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", buffer = buffer })
|
||||
end
|
||||
|
||||
map("]]", "next")
|
||||
map("[[", "prev")
|
||||
|
||||
-- also set it after loading ftplugins, since a lot overwrite [[ and ]]
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
callback = function()
|
||||
local buffer = vim.api.nvim_get_current_buf()
|
||||
map("]]", "next", buffer)
|
||||
map("[[", "prev", buffer)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
M.keys = {
|
||||
{ "]]", desc = "Next Reference" },
|
||||
{ "[[", desc = "Prev Reference" },
|
||||
}
|
||||
|
||||
return M
|
36
lua/pcode/plugins/extras/indentscupe.lua
Normal file
36
lua/pcode/plugins/extras/indentscupe.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
local icons = require("pcode.user.icons")
|
||||
return {
|
||||
"echasnovski/mini.indentscope",
|
||||
version = false, -- wait till new 0.7.0 release to put it back on semver
|
||||
event = "BufReadPre",
|
||||
opts = {
|
||||
symbol = icons.ui.LineMiddle,
|
||||
options = { try_as_border = true },
|
||||
},
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = {
|
||||
"alpha",
|
||||
"dashboard",
|
||||
"fzf",
|
||||
"help",
|
||||
"lazy",
|
||||
"lazyterm",
|
||||
"mason",
|
||||
"neo-tree",
|
||||
"NvimTree",
|
||||
"notify",
|
||||
"toggleterm",
|
||||
"Trouble",
|
||||
"trouble",
|
||||
"term",
|
||||
"terminal",
|
||||
"zsh",
|
||||
"keymaps_table",
|
||||
},
|
||||
callback = function()
|
||||
vim.b.miniindentscope_disable = true
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
10
lua/pcode/plugins/extras/liveserver.lua
Normal file
10
lua/pcode/plugins/extras/liveserver.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
"barrett-ruth/live-server.nvim",
|
||||
build = "npm i -g live-server",
|
||||
cmd = { "LiveServerStart", "LiveServerStop", "LiveServerToggle" },
|
||||
config = true,
|
||||
keys = {
|
||||
-- open http://localhost:5555/ jika menggunakan wsl
|
||||
{ "<leader>rl", "<cmd>LiveServerToggle<cr>", desc = "LiveServer" },
|
||||
},
|
||||
}
|
23
lua/pcode/plugins/extras/lspsignatur.lua
Normal file
23
lua/pcode/plugins/extras/lspsignatur.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
return {
|
||||
"ray-x/lsp_signature.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
local is_enabled = true
|
||||
return {
|
||||
-- Window mode
|
||||
floating_window = is_enabled, -- Display it as floating window.
|
||||
hi_parameter = "IncSearch", -- Color to highlight floating window.
|
||||
handler_opts = { border = "rounded" }, -- Window style
|
||||
|
||||
-- Hint mode
|
||||
hint_enable = false, -- Display it as hint.
|
||||
hint_prefix = "👈 ",
|
||||
|
||||
-- Additionally, you can use <space>uH to toggle inlay hints.
|
||||
toggle_key_flip_floatwin_setting = is_enabled,
|
||||
}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("lsp_signature").setup(opts)
|
||||
end,
|
||||
}
|
40
lua/pcode/plugins/extras/minianimate.lua
Normal file
40
lua/pcode/plugins/extras/minianimate.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
return {
|
||||
-- animations
|
||||
{
|
||||
"echasnovski/mini.animate",
|
||||
event = "BufRead",
|
||||
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,
|
||||
}),
|
||||
},
|
||||
}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("mini.animate").setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
35
lua/pcode/plugins/extras/navic.lua
Normal file
35
lua/pcode/plugins/extras/navic.lua
Normal file
|
@ -0,0 +1,35 @@
|
|||
local M = {
|
||||
"SmiteshP/nvim-navic",
|
||||
event = "BufRead",
|
||||
dependencies = {
|
||||
"LunarVim/breadcrumbs.nvim",
|
||||
opts = {},
|
||||
config = true,
|
||||
},
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local icons = require("pcode.user.icons").kind
|
||||
for key, value in pairs(icons) do
|
||||
icons[key] = value .. " "
|
||||
end
|
||||
require("nvim-navic").setup({
|
||||
icons = icons,
|
||||
lsp = {
|
||||
auto_attach = true,
|
||||
preference = nil,
|
||||
},
|
||||
highlight = false,
|
||||
separator = " > ",
|
||||
depth_limit = 0,
|
||||
depth_limit_indicator = "..",
|
||||
safe_output = true,
|
||||
lazy_update_context = false,
|
||||
click = false,
|
||||
format_text = function(text)
|
||||
return text
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
72
lua/pcode/plugins/extras/neocodeium.lua
Normal file
72
lua/pcode/plugins/extras/neocodeium.lua
Normal file
|
@ -0,0 +1,72 @@
|
|||
return {
|
||||
"monkoose/neocodeium",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
local uv = vim.uv
|
||||
local fn = vim.fn
|
||||
local pummenu_timer = assert(uv.new_timer())
|
||||
local cmp = require("cmp")
|
||||
local neocodeium = require("neocodeium")
|
||||
local renderer = require("neocodeium.renderer")
|
||||
local completer = require("neocodeium.completer")
|
||||
local function is_noselect()
|
||||
local completeopt = vim.o.completeopt
|
||||
return completeopt:find("noselect") and -1 or 0
|
||||
end
|
||||
|
||||
local default_selected_compl = is_noselect()
|
||||
local selected_compl = default_selected_compl
|
||||
|
||||
-- if cmp menu_opened then neocodeium clear
|
||||
cmp.event:on("menu_opened", function()
|
||||
neocodeium.clear()
|
||||
end)
|
||||
neocodeium.setup({
|
||||
filter = function()
|
||||
return not cmp.visible()
|
||||
end,
|
||||
})
|
||||
|
||||
-- if cmp menu_is_closed then neocodeium activate
|
||||
cmp.event:on("menu_closed", function()
|
||||
local cur_selected = fn.complete_info({ "selected" }).selected
|
||||
if selected_compl == cur_selected then
|
||||
completer:initiate()
|
||||
else
|
||||
selected_compl = cur_selected
|
||||
completer:clear(true)
|
||||
renderer:display_label()
|
||||
pummenu_timer:stop()
|
||||
pummenu_timer:start(
|
||||
400,
|
||||
0,
|
||||
vim.schedule_wrap(function()
|
||||
if fn.pumvisible() == 1 then
|
||||
completer:initiate()
|
||||
end
|
||||
end)
|
||||
)
|
||||
end
|
||||
end)
|
||||
vim.keymap.set("i", "<C-g>", function()
|
||||
neocodeium.accept()
|
||||
end)
|
||||
vim.keymap.set("i", "<c-Down>", function()
|
||||
neocodeium.cycle()
|
||||
end)
|
||||
vim.keymap.set("i", "<c-Up>", function()
|
||||
require("neocodeium").cycle(-1)
|
||||
end)
|
||||
vim.keymap.set("i", "<c-x>", function()
|
||||
require("neocodeium").clear()
|
||||
end)
|
||||
-- create user command CodeiumDiasable
|
||||
vim.api.nvim_create_user_command("CodeiumDisable", function()
|
||||
require("neocodeium.commands").disable(true)
|
||||
end, {})
|
||||
-- create user command CodeiumEnable
|
||||
vim.api.nvim_create_user_command("CodeiumEnable", function()
|
||||
require("neocodeium.commands").enable()
|
||||
end, {})
|
||||
end,
|
||||
}
|
|
@ -3,6 +3,6 @@ return {
|
|||
event = "VeryLazy",
|
||||
lazy = true,
|
||||
config = function()
|
||||
require("neoscroll").setup {}
|
||||
require("neoscroll").setup({})
|
||||
end,
|
||||
}
|
36
lua/pcode/plugins/extras/nvimmenu.lua
Normal file
36
lua/pcode/plugins/extras/nvimmenu.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
return {
|
||||
{
|
||||
"nvzone/menu",
|
||||
lazy = true,
|
||||
event = { "VeryLazy" },
|
||||
dependencies = {
|
||||
{ "nvzone/volt", lazy = true },
|
||||
{ "nvzone/showkeys", cmd = "ShowkeysToggle", lazy = true },
|
||||
{
|
||||
"nvzone/minty",
|
||||
cmd = { "Shades", "Huefy" },
|
||||
lazy = true,
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
mouse = true,
|
||||
border = true,
|
||||
},
|
||||
config = function(_, opts)
|
||||
-- Keyboard users
|
||||
vim.keymap.set("n", "<C-t>", function()
|
||||
require("menu").open("default")
|
||||
end, {})
|
||||
|
||||
-- mouse users + nvimtree users!
|
||||
vim.keymap.set({ "n", "v" }, "<RightMouse>", function()
|
||||
require("menu.utils").delete_old_menus()
|
||||
vim.cmd.exec('"normal! \\<RightMouse>"')
|
||||
|
||||
local buf = vim.api.nvim_win_get_buf(vim.fn.getmousepos().winid)
|
||||
local options = vim.bo[buf].ft == "NvimTree" and "nvimtree" or "default"
|
||||
require("menu").open(options, opts)
|
||||
end, {})
|
||||
end,
|
||||
},
|
||||
}
|
107
lua/pcode/plugins/extras/nvimufo.lua
Normal file
107
lua/pcode/plugins/extras/nvimufo.lua
Normal file
|
@ -0,0 +1,107 @@
|
|||
local M = { "kevinhwang91/nvim-ufo" }
|
||||
M.event = "VeryLazy"
|
||||
M.dependencies = {
|
||||
"kevinhwang91/promise-async",
|
||||
"luukvbaal/statuscol.nvim",
|
||||
}
|
||||
M.config = function()
|
||||
local builtin = require("statuscol.builtin")
|
||||
local cfg = {
|
||||
setopt = true,
|
||||
relculright = true,
|
||||
segments = {
|
||||
|
||||
{ text = { builtin.foldfunc, " " }, click = "v:lua.ScFa", hl = "Comment" },
|
||||
|
||||
{ text = { "%s" }, click = "v:lua.ScSa" },
|
||||
{ text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
|
||||
},
|
||||
}
|
||||
|
||||
require("statuscol").setup(cfg)
|
||||
|
||||
vim.o.foldcolumn = "1" -- '0' is not bad
|
||||
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
|
||||
vim.o.foldlevelstart = 99
|
||||
vim.o.foldenable = true
|
||||
vim.o.fillchars = [[eob: ,fold: ,foldopen:▾,foldsep: ,foldclose:▸]]
|
||||
|
||||
-- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself
|
||||
vim.keymap.set("n", "zR", require("ufo").openAllFolds)
|
||||
vim.keymap.set("n", "zM", require("ufo").closeAllFolds)
|
||||
|
||||
local handler = function(virtText, lnum, endLnum, width, truncate)
|
||||
local newVirtText = {}
|
||||
local suffix = (" %d "):format(endLnum - lnum)
|
||||
local sufWidth = vim.fn.strdisplaywidth(suffix)
|
||||
local targetWidth = width - sufWidth
|
||||
local curWidth = 0
|
||||
for _, chunk in ipairs(virtText) do
|
||||
local chunkText = chunk[1]
|
||||
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
if targetWidth > curWidth + chunkWidth then
|
||||
table.insert(newVirtText, chunk)
|
||||
else
|
||||
chunkText = truncate(chunkText, targetWidth - curWidth)
|
||||
local hlGroup = chunk[2]
|
||||
table.insert(newVirtText, { chunkText, hlGroup })
|
||||
chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
-- str width returned from truncate() may less than 2nd argument, need padding
|
||||
if curWidth + chunkWidth < targetWidth then
|
||||
suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth)
|
||||
end
|
||||
break
|
||||
end
|
||||
curWidth = curWidth + chunkWidth
|
||||
end
|
||||
table.insert(newVirtText, { suffix, "MoreMsg" })
|
||||
return newVirtText
|
||||
end
|
||||
|
||||
local ftMap = {
|
||||
-- typescriptreact = { "lsp", "treesitter" },
|
||||
-- python = { "indent" },
|
||||
-- git = "",
|
||||
}
|
||||
|
||||
require("ufo").setup({
|
||||
fold_virt_text_handler = handler,
|
||||
close_fold_kinds = {},
|
||||
-- close_fold_kinds = { "imports", "comment" },
|
||||
provider_selector = function(bufnr, filetype, buftype)
|
||||
-- if you prefer treesitter provider rather than lsp,
|
||||
-- return ftMap[filetype] or {'treesitter', 'indent'}
|
||||
return ftMap[filetype]
|
||||
-- return { "treesitter", "indent" }
|
||||
|
||||
-- refer to ./doc/example.lua for detail
|
||||
end,
|
||||
|
||||
preview = {
|
||||
win_config = {
|
||||
border = { "", "─", "", "", "", "─", "", "" },
|
||||
winhighlight = "Normal:Folded",
|
||||
winblend = 0,
|
||||
},
|
||||
mappings = {
|
||||
scrollU = "<C-k>",
|
||||
scrollD = "<C-j>",
|
||||
jumpTop = "[",
|
||||
jumpBot = "]",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "zR", require("ufo").openAllFolds)
|
||||
vim.keymap.set("n", "zM", require("ufo").closeAllFolds)
|
||||
vim.keymap.set("n", "zr", require("ufo").openFoldsExceptKinds)
|
||||
vim.keymap.set("n", "zm", require("ufo").closeFoldsWith) -- closeAllFolds == closeFoldsWith(0)
|
||||
vim.keymap.set("n", "K", function()
|
||||
local winid = require("ufo").peekFoldedLinesUnderCursor()
|
||||
if not winid then
|
||||
vim.lsp.buf.hover()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
|
@ -2,9 +2,10 @@ return {
|
|||
"hiphish/rainbow-delimiters.nvim",
|
||||
lazy = true,
|
||||
event = "BufRead",
|
||||
branch = "master",
|
||||
config = function()
|
||||
-- Modul ini berisi beberapa definisi default
|
||||
local rainbow_delimiters = require "rainbow-delimiters"
|
||||
local rainbow_delimiters = require("rainbow-delimiters")
|
||||
vim.g.rainbow_delimiters = {
|
||||
strategy = {
|
||||
[""] = rainbow_delimiters.strategy["global"],
|
49
lua/pcode/plugins/extras/refactoring.lua
Normal file
49
lua/pcode/plugins/extras/refactoring.lua
Normal file
|
@ -0,0 +1,49 @@
|
|||
return {
|
||||
-- Incremental rename
|
||||
{
|
||||
"smjonas/inc-rename.nvim",
|
||||
cmd = "IncRename",
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{"<leader>u","",desc=" Edit"},
|
||||
{
|
||||
"<leader>un",
|
||||
function()
|
||||
return ":IncRename " .. vim.fn.expand("<cword>")
|
||||
end,
|
||||
desc = "Incremental rename",
|
||||
mode = "n",
|
||||
noremap = true,
|
||||
expr = true,
|
||||
},
|
||||
},
|
||||
config = true,
|
||||
},
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
presets = { inc_rename = true },
|
||||
},
|
||||
},
|
||||
-- Refactoring tool
|
||||
{
|
||||
"ThePrimeagen/refactoring.nvim",
|
||||
keys = {
|
||||
{
|
||||
"<leader>r",
|
||||
function()
|
||||
require("refactoring").select_refactor({
|
||||
show_success_message = true,
|
||||
})
|
||||
end,
|
||||
mode = "v",
|
||||
noremap = true,
|
||||
silent = true,
|
||||
expr = false,
|
||||
desc = " Refactoring",
|
||||
},
|
||||
},
|
||||
opts = {},
|
||||
},
|
||||
}
|
27
lua/pcode/plugins/extras/rest.lua
Normal file
27
lua/pcode/plugins/extras/rest.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
vim.filetype.add({
|
||||
extension = {
|
||||
["http"] = "http",
|
||||
},
|
||||
})
|
||||
return {
|
||||
{
|
||||
"mistweaverco/kulala.nvim",
|
||||
ft = "http",
|
||||
keys = {
|
||||
{ "<leader>R", "", desc = " Rest" },
|
||||
{ "<leader>Rs", "<cmd>lua require('kulala').run()<cr>", desc = "Send the request" },
|
||||
{ "<leader>Rt", "<cmd>lua require('kulala').toggle_view()<cr>", desc = "Toggle headers/body" },
|
||||
{ "<leader>Rp", "<cmd>lua require('kulala').jump_prev()<cr>", desc = "Jump to previous request" },
|
||||
{ "<leader>Rn", "<cmd>lua require('kulala').jump_next()<cr>", desc = "Jump to next request" },
|
||||
},
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, { "http", "graphql" })
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
}
|
46
lua/pcode/plugins/extras/restnvim.lua
Normal file
46
lua/pcode/plugins/extras/restnvim.lua
Normal file
|
@ -0,0 +1,46 @@
|
|||
-- install luarock
|
||||
-- sudo apt-get install luarocks lua5.4 (untuk linux)
|
||||
-- https://github.com/luarocks/luarocks/wiki/Installation-instructions-for-Windows
|
||||
|
||||
-- manual penggunaan
|
||||
-- https://www.jetbrains.com/help/idea/exploring-http-syntax.html
|
||||
return {
|
||||
"rest-nvim/rest.nvim",
|
||||
-- NOTE: Follow https://github.com/rest-nvim/rest.nvim/issues/306
|
||||
-- commit = "91badd46c60df6bd9800c809056af2d80d33da4c",
|
||||
event = "VeryLazy",
|
||||
enabled = vim.fn.executable("luarocks") == 1,
|
||||
dependencies = {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
vim.list_extend(opts.ensure_installed, { "http" })
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require("rest-nvim").setup()
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "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,
|
||||
})
|
||||
end,
|
||||
ft = "http",
|
||||
keys = {
|
||||
{
|
||||
"<Leader>rh",
|
||||
"<cmd>Rest run<cr>",
|
||||
desc = "Run http request under cursor",
|
||||
},
|
||||
{
|
||||
"<Leader>rH",
|
||||
"<cmd>Rest last<cr>",
|
||||
desc = "Run last http request",
|
||||
},
|
||||
},
|
||||
}
|
13
lua/pcode/plugins/extras/scrollview.lua
Normal file
13
lua/pcode/plugins/extras/scrollview.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
return {
|
||||
"dstein64/nvim-scrollview",
|
||||
lazy = true,
|
||||
event = { "BufRead", "InsertEnter", "BufNewFile" },
|
||||
opts = {
|
||||
bg = "LightCyan",
|
||||
ctermbg = 160,
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("scrollview").setup(opts)
|
||||
vim.g.scrollview_excluded_filetypes = { "NvimTree", "vista_kind", "Outline", "neo-tree" }
|
||||
end,
|
||||
}
|
1
lua/pcode/plugins/extras/showkeys.lua
Normal file
1
lua/pcode/plugins/extras/showkeys.lua
Normal file
|
@ -0,0 +1 @@
|
|||
return { "nvzone/showkeys", cmd = "ShowkeysToggle" }
|
21
lua/pcode/plugins/extras/smartsplit.lua
Normal file
21
lua/pcode/plugins/extras/smartsplit.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
return {
|
||||
"mrjones2014/smart-splits.nvim",
|
||||
lazy = true,
|
||||
event = { "BufRead", "InsertEnter", "BufNewFile" },
|
||||
opts = {
|
||||
ignored_filetypes = {
|
||||
"nofile",
|
||||
"quickfix",
|
||||
"qf",
|
||||
"prompt",
|
||||
},
|
||||
ignored_buftypes = { "nofile" },
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("smart-splits").setup(opts)
|
||||
vim.keymap.set("n", "<C-Left>", require("smart-splits").resize_left)
|
||||
vim.keymap.set("n", "<C-Down>", require("smart-splits").resize_down)
|
||||
vim.keymap.set("n", "<C-Up", require("smart-splits").resize_up)
|
||||
vim.keymap.set("n", "<C-Right>", require("smart-splits").resize_right)
|
||||
end,
|
||||
}
|
26
lua/pcode/plugins/extras/telescopediff.lua
Normal file
26
lua/pcode/plugins/extras/telescopediff.lua
Normal file
|
@ -0,0 +1,26 @@
|
|||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"jemag/telescope-diff.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("telescope").load_extension("diff")
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<leader>sd",
|
||||
function()
|
||||
require("telescope").extensions.diff.diff_files({ hidden = true })
|
||||
end,
|
||||
desc = "Diff 2 Files",
|
||||
},
|
||||
{
|
||||
"<leader>sD",
|
||||
function()
|
||||
require("telescope").extensions.diff.diff_current({ hidden = true })
|
||||
end,
|
||||
desc = "Diff Current File",
|
||||
},
|
||||
},
|
||||
}
|
13
lua/pcode/plugins/extras/telescopetreesiterinfo.lua
Normal file
13
lua/pcode/plugins/extras/telescopetreesiterinfo.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"roycrippen4/telescope-treesitter-info.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("telescope").load_extension("treesitter_info")
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>p", "<cmd>Telescope treesitter_info<cr>", desc = "Treesitter Info" },
|
||||
},
|
||||
}
|
22
lua/pcode/plugins/extras/tinydignostic.lua
Normal file
22
lua/pcode/plugins/extras/tinydignostic.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
return {
|
||||
"rachartier/tiny-inline-diagnostic.nvim",
|
||||
event = "VeryLazy", -- Or `LspAttach`
|
||||
priority = 1000, -- needs to be loaded in first
|
||||
config = function()
|
||||
require("tiny-inline-diagnostic").setup({
|
||||
preset = "powerline",
|
||||
-- signs = {
|
||||
-- left = "",
|
||||
-- right = "",
|
||||
-- diag = "●",
|
||||
-- arrow = " ",
|
||||
-- up_arrow = " ",
|
||||
-- vertical = " │",
|
||||
-- vertical_end = " └",
|
||||
-- },
|
||||
blend = {
|
||||
factor = 0.22,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
70
lua/pcode/plugins/extras/transparent.lua
Normal file
70
lua/pcode/plugins/extras/transparent.lua
Normal file
|
@ -0,0 +1,70 @@
|
|||
return {
|
||||
-- transparant config
|
||||
{
|
||||
"xiyaowong/transparent.nvim",
|
||||
lazy = true,
|
||||
event = "BufWinEnter",
|
||||
cmd = { "TransparentToggle", "TransparentEnable", "TransparentDisable" },
|
||||
config = function()
|
||||
require("transparent").setup({
|
||||
extra_groups = {
|
||||
"Normal",
|
||||
"NormalNC",
|
||||
"NormalFloat",
|
||||
"FloatBorder",
|
||||
"Comment",
|
||||
"Folded",
|
||||
"GitSignsAdd",
|
||||
"GitSignsDelete",
|
||||
"GitSignsChange",
|
||||
"FoldColumn",
|
||||
"WinBar",
|
||||
"WinBarNC",
|
||||
"NotifyBackground",
|
||||
"TabLine",
|
||||
"TabLineFill",
|
||||
},
|
||||
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")
|
||||
-- create auto command to set transparent
|
||||
vim.cmd("TransparentDisable")
|
||||
vim.cmd("TransparentEnable")
|
||||
vim.api.nvim_set_hl(0, "MasonHeader", { bold = true, bg = "NONE", fg = "#838FA7" })
|
||||
vim.api.nvim_set_hl(0, "MasonMutedBlock", { bg = "NONE", fg = "#838FA7" })
|
||||
vim.api.nvim_set_hl(0, "MasonHighlightBlockBold", { bold = true, bg = "NONE", fg = "#ABB2BF" })
|
||||
vim.api.nvim_set_hl(0, "LazyH1", { bold = true, bg = "NONE", fg = "#ABB2BF" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-notify",
|
||||
opts = function(_, opts)
|
||||
opts.background_colour = "#00000000"
|
||||
end,
|
||||
},
|
||||
}
|
10
lua/pcode/plugins/extras/treesittercontex.lua
Normal file
10
lua/pcode/plugins/extras/treesittercontex.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
lazy = true,
|
||||
event = { "BufRead", "VeryLazy" },
|
||||
opts = {},
|
||||
keys = {
|
||||
{ "<leader>T", "", desc = " TS Context" },
|
||||
{ "<leader>Tt", "<cmd>TSContextToggle<cr>", desc = "Toggle Context" },
|
||||
},
|
||||
}
|
27
lua/pcode/plugins/extras/verticalcolumn.lua
Normal file
27
lua/pcode/plugins/extras/verticalcolumn.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
return {
|
||||
{
|
||||
"lukas-reineke/virt-column.nvim",
|
||||
event = "BufRead",
|
||||
opts = {},
|
||||
config = function()
|
||||
local icons = require("pcode.user.icons")
|
||||
require("virt-column").overwrite({
|
||||
exclude = {
|
||||
filetypes = { "help", "text", "markdown" },
|
||||
},
|
||||
char = icons.ui.LineMiddle,
|
||||
})
|
||||
-- Mengatur colum color max 80 caracter
|
||||
vim.api.nvim_create_autocmd("BufWinEnter", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.opt.formatoptions = "croql"
|
||||
vim.opt.textwidth = 80
|
||||
vim.opt.colorcolumn = "+1"
|
||||
vim.opt.lazyredraw = false
|
||||
-- vim.cmd "hi ColorColumn guibg=#1B2430 ctermbg=246"
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
64
lua/pcode/plugins/extras/visualmulti.lua
Normal file
64
lua/pcode/plugins/extras/visualmulti.lua
Normal file
|
@ -0,0 +1,64 @@
|
|||
return {
|
||||
--[[ "mg979/vim-visual-multi",
|
||||
event = { "BufRead", "InsertEnter", "BufNewFile" },
|
||||
branch = "master",
|
||||
lazy = true,
|
||||
init = function()
|
||||
-- Nonaktifkan mapping default jika ingin custom
|
||||
vim.g.VM_default_mappings = 0
|
||||
|
||||
vim.g.VM_mouse_mappings = 1 -- equal CTRL + Left Click on VSCODE
|
||||
vim.g.VM_maps = {
|
||||
["Find Under"] = "<C-d>", -- equal CTRL+D on VSCODE
|
||||
["Find Subword Under"] = "<C-d>", -- equal CTRL+D on VSCODE
|
||||
["Select Cursor Down"] = "<M-C-Down>", -- equal CTRL+ALT+DOWN on VSCODE
|
||||
["Select Cursor Up"] = "<M-C-Up>", -- equal CTRL+ALT+UP on VSCODE
|
||||
["Undo"] = "u", -- undo
|
||||
["Redo"] = "<C-r>", -- redo
|
||||
}
|
||||
end, ]]
|
||||
{
|
||||
"brenton-leighton/multiple-cursors.nvim",
|
||||
version = "*",
|
||||
opts = {},
|
||||
event = { "BufRead", "InsertEnter", "BufNewFile" },
|
||||
keys = {
|
||||
-- 🧠 Seperti Ctrl + D di VS Code → pilih kata berikutnya yang sama
|
||||
{
|
||||
"<C-d>",
|
||||
function()
|
||||
vim.cmd("MultipleCursorsAddJumpNextMatch")
|
||||
vim.schedule(function()
|
||||
vim.notify(
|
||||
"🖊️ Multiple cursor: menambahkan seleksi berikutnya",
|
||||
vim.log.levels.INFO,
|
||||
{ title = "MultipleCursors" }
|
||||
)
|
||||
end)
|
||||
end,
|
||||
mode = { "n", "x" },
|
||||
desc = "Select next match",
|
||||
},
|
||||
|
||||
-- 👇 Menambah kursor ke bawah seperti Ctrl + Alt + ↓
|
||||
{ "<C-M-Down>", "<Cmd>MultipleCursorsAddDown<CR>", mode = { "n", "i", "x" }, desc = "Add cursor down" },
|
||||
|
||||
-- 👆 Menambah kursor ke atas seperti Ctrl + Alt + ↑
|
||||
{ "<C-M-Up>", "<Cmd>MultipleCursorsAddUp<CR>", mode = { "n", "i", "x" }, desc = "Add cursor up" },
|
||||
|
||||
-- 🖱️ Tambah/hapus kursor dengan Ctrl + Klik mouse
|
||||
{
|
||||
"<M-LeftMouse>",
|
||||
"<Cmd>MultipleCursorsMouseAddDelete<CR>",
|
||||
mode = { "n", "i" },
|
||||
desc = "Add/remove cursor with mouse",
|
||||
},
|
||||
|
||||
-- 🔲 Tambah kursor ke seluruh baris visual yang dipilih (pakai Leader + m)
|
||||
{ "<Leader>m", "<Cmd>MultipleCursorsAddVisualArea<CR>", mode = { "x" }, desc = "Add cursors to visual lines" },
|
||||
|
||||
-- 🔒 Lock semua kursor supaya siap edit serentak
|
||||
{ "<Leader>L", "<Cmd>MultipleCursorsLock<CR>", mode = { "n", "x" }, desc = "Lock cursors" },
|
||||
},
|
||||
},
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue