Compare commits

..

No commits in common. "main" and "v2.5.561" have entirely different histories.

35 changed files with 617 additions and 1979 deletions

View file

@ -67,14 +67,14 @@
## Basic Requirement ## Basic Requirement
2. Install Neovim 0.95+ https://github.com/neovim/neovim/releases/tag/stable 2. Install Neovim 0.95+ https://github.com/neovim/neovim/releases/tag/stable
1. C++ https://www.msys2.org/ 3. C++ https://www.msys2.org/
1. GIT https://git-scm.com/download/win 4. GIT https://git-scm.com/download/win
1. NodeJs https://nodejs.org/en/ 5. NodeJs https://nodejs.org/en/
1. Ripgrep https://github.com/BurntSushi/ripgrep 6. Ripgrep https://github.com/BurntSushi/ripgrep
1. Lazygit https://github.com/jesseduffield/lazygit 7. Lazygit https://github.com/jesseduffield/lazygit
1. Nerd Font https://www.nerdfonts.com/ or https://github.com/ryanoasis/nerd-fonts 8. 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 9. 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 10. Powershell (windows) https://apps.microsoft.com/store/detail/powershell/9MZ1SNWT0N5D?hl=en-id&gl=id
# Windows # Windows
@ -92,21 +92,15 @@ git clone https://github.com/pojokcodeid/neovim-starter.git ~/.config/nvim
# Uninstall # Uninstall
```bash ```bash
# Linux / MacOS (unix) # Linux / Macos (unix)
rm -rf ~/.config/nvim rm -rf ~/.config/nvim
rm -rf ~/.local/state/nvim
rm -rf ~/.local/share/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 # Windows CMD
rd -r ~\AppData\Local\nvim rd -r ~\AppData\Local\nvim
rd -r ~\AppData\Local\nvim-data rd -r ~\AppData\Local\nvim-data
# Windows PowerShell # Window PowerShell
rm -Force ~\AppData\Local\nvim rm -Force ~\AppData\Local\nvim
rm -Force ~\AppData\Local\nvim-data rm -Force ~\AppData\Local\nvim-data
``` ```

View file

@ -1,8 +1,7 @@
{ {
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"Eva-Theme.nvim": { "branch": "master", "commit": "9d743346eb0e7647d79468fff6f57352cd102655" },
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, "LuaSnip": { "branch": "master", "commit": "5271933f7cea9f6b1c7de953379469010ed4553a" },
"alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" }, "alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" },
"auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" }, "auto-bufferline.nvim": { "branch": "main", "commit": "f5835a4b62bfb6f6c829f8f050e5102ccf230b3e" },
"auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" }, "auto-conform.nvim": { "branch": "main", "commit": "5f0897235e84bf2f8ff9d634e81678d5bfa63ab8" },
@ -20,60 +19,59 @@
"code_runner.nvim": { "branch": "main", "commit": "65c8d11f507073b915f10faa88ea05bd4fbf69ce" }, "code_runner.nvim": { "branch": "main", "commit": "65c8d11f507073b915f10faa88ea05bd4fbf69ce" },
"codeium.vim": { "branch": "main", "commit": "272c6e2755e8faa90e26bcdcd9fde6b9e61751ea" }, "codeium.vim": { "branch": "main", "commit": "272c6e2755e8faa90e26bcdcd9fde6b9e61751ea" },
"conform.nvim": { "branch": "master", "commit": "8132ec733eed3bf415b97b76797ca41b59f51d7d" }, "conform.nvim": { "branch": "master", "commit": "8132ec733eed3bf415b97b76797ca41b59f51d7d" },
"dracula.nvim": { "branch": "main", "commit": "96c9d19ce81b26053055ad6f688277d655b3f7d2" },
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"gitsigns.nvim": { "branch": "main", "commit": "1b0350ab707713b2bc6c236151f1a324175347b1" }, "gitsigns.nvim": { "branch": "main", "commit": "d0f90ef51d4be86b824b012ec52ed715b5622e51" },
"inc-rename.nvim": { "branch": "main", "commit": "a3e31af13844534c66041ce92f29af7745883875" },
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "c4c84f4521d62de595c0d0f718a9a40c1890c8ce" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "bef29b653ba71d442816bf56286c2a686210be04" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" },
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
"menu": { "branch": "main", "commit": "7a0a4a2896b715c066cfbe320bdc048091874cc6" }, "menu": { "branch": "main", "commit": "7a0a4a2896b715c066cfbe320bdc048091874cc6" },
"mini.indentscope": { "branch": "main", "commit": "5fdc3edf7bb1b6365980c2c47dac2f19ec93c97b" }, "mini.indentscope": { "branch": "main", "commit": "8af2569a7d7fd37300dfa760e44e71efbbf322fd" },
"minty": { "branch": "main", "commit": "aafc9e8e0afe6bf57580858a2849578d8d8db9e0" }, "minty": { "branch": "main", "commit": "aafc9e8e0afe6bf57580858a2849578d8d8db9e0" },
"neotest": { "branch": "master", "commit": "ef492755730e59e1d8122c461abbd086bee4c76b" }, "neotest": { "branch": "master", "commit": "ef492755730e59e1d8122c461abbd086bee4c76b" },
"neotest-golang": { "branch": "main", "commit": "0a0acff3cf9a0bf140c84ea9e66d818df7c2608f" }, "neotest-golang": { "branch": "main", "commit": "c452301848418baf244e2da34491157bca7614c1" },
"neotest-jest": { "branch": "main", "commit": "dd82016c01704d9bbd5188749fe0586b3b620693" },
"neotest-plenary": { "branch": "master", "commit": "3523adcf9ffaad1911960c5813b0136c1b63a2ec" }, "neotest-plenary": { "branch": "master", "commit": "3523adcf9ffaad1911960c5813b0136c1b63a2ec" },
"neotest-vim-test": { "branch": "master", "commit": "75c4228882ae4883b11bfce9b8383e637eb44192" }, "neotest-vim-test": { "branch": "master", "commit": "75c4228882ae4883b11bfce9b8383e637eb44192" },
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
"npm-runner.nvim": { "branch": "main", "commit": "4acc407e07e16eb42e356b10bc17886b21744606" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-autopairs": { "branch": "master", "commit": "2647cce4cb64fb35c212146663384e05ae126bdf" }, "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" }, "nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" },
"nvim-dap": { "branch": "master", "commit": "2edd6375692d9ac1053d50acfe415c1eb2ba92d0" }, "nvim-dap": { "branch": "master", "commit": "ea82027c3447dc1a022be9a9884de276c05cd33a" },
"nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" },
"nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
"nvim-dap-vscode-js": { "branch": "main", "commit": "03bd29672d7fab5e515fc8469b7d07cc5994bbf6" }, "nvim-lint": { "branch": "master", "commit": "cc26ae6a620298bb3f33b0e0681f99a10ae57781" },
"nvim-lint": { "branch": "master", "commit": "2b0039b8be9583704591a13129c600891ac2c596" }, "nvim-lspconfig": { "branch": "master", "commit": "a182334ba933e58240c2c45e6ae2d9c7ae313e00" },
"nvim-lspconfig": { "branch": "master", "commit": "69a1624aff5dc30dddd0c59d99a947b63c80bf2a" },
"nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" }, "nvim-material-icon": { "branch": "main", "commit": "38fc13fe4811c4bf62533180ff5e7bbd237c5ef5" },
"nvim-navic": { "branch": "master", "commit": "f887d794a0f4594882814d7780980a949200a238" }, "nvim-navic": { "branch": "master", "commit": "f887d794a0f4594882814d7780980a949200a238" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" }, "nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" },
"nvim-scrollview": { "branch": "main", "commit": "095181bc2adb64af670dae73208871a731f0bb86" }, "nvim-scrollview": { "branch": "main", "commit": "b65192ef2e39c456e8dc5f8f5cdd9b8d13f121e4" },
"nvim-tree.lua": { "branch": "master", "commit": "b0b49552c9462900a882fe772993b01d780445fe" }, "nvim-tree.lua": { "branch": "master", "commit": "1c733e8c1957dc67f47580fe9c458a13b5612d5b" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
"nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" }, "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "55ad4fb76ab68460f700599b7449385f0c4e858e" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "55ad4fb76ab68460f700599b7449385f0c4e858e" },
"showkeys": { "branch": "main", "commit": "cb0a50296f11f1e585acffba8c253b9e8afc1f84" }, "refactoring.nvim": { "branch": "master", "commit": "9cd0186ffe76fe6abc64c0aafb775c8f776ab5ee" },
"smart-splits.nvim": { "branch": "master", "commit": "0098e376638602bc6aaf779bb8531b840a3fe26e" }, "smart-splits.nvim": { "branch": "master", "commit": "9af865e451e55a9835fae6862dd7c55396870ecb" },
"telescope-diff.nvim": { "branch": "master", "commit": "c797b722516e871b51def7e69266f0cc9875bacf" },
"telescope-treesitter-info.nvim": { "branch": "master", "commit": "4bed952c3c33015c4402007f179b478843d5aa3b" }, "telescope-treesitter-info.nvim": { "branch": "master", "commit": "4bed952c3c33015c4402007f179b478843d5aa3b" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "51f548421f8a74680eff27d283c9d5ea6e8d0074" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "51f548421f8a74680eff27d283c9d5ea6e8d0074" },
"toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" }, "toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" },
"transparent.nvim": { "branch": "main", "commit": "d41ae9b56ac2706cb3db4b16afe5cd6903013937" },
"vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" }, "vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" },
"vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" },
"virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" }, "virt-column.nvim": { "branch": "master", "commit": "b87e3e0864211a32724a2ebf3be37e24e9e2fa99" },
"volt": { "branch": "main", "commit": "7b8c5e790120d9f08c8487dcb80692db6d2087a1" }, "volt": { "branch": "main", "commit": "c45d5f48da8e802e608b5c6da471ca4d84276dfb" },
"vscode-js-debug": { "branch": "main", "commit": "a3279c2abc1162069b0f5c014542b8b849cefa70" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" },
"yanky.nvim": { "branch": "main", "commit": "04775cc6e10ef038c397c407bc17f00a2f52b378" } "yanky.nvim": { "branch": "main", "commit": "04775cc6e10ef038c397c407bc17f00a2f52b378" },
"zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" }
} }

View file

@ -1,50 +1,47 @@
return { return {
{ "nvim-lua/plenary.nvim", event = "VeryLazy" }, { "nvim-lua/plenary.nvim", event = "VeryLazy" },
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
event = { "BufRead", "VeryLazy" }, event = { "BufRead", "VeryLazy" },
version = false, version = false,
build = ":TSUpdate", build = ":TSUpdate",
lazy = true, lazy = true,
cmd = { cmd = {
"TSInstall", "TSInstall",
-- "TSInstallInfo", "TSInstallInfo",
"TSInstallSync", "TSInstallSync",
"TSUpdate", "TSUpdate",
"TSUpdateSync", "TSUpdateSync",
"TSUninstall", "TSUninstall",
"TSUninstallInfo", "TSUninstallInfo",
"TSInstallFromGrammar", "TSInstallFromGrammar",
}, },
opts = function() opts = function()
return { return {
highlight = { enable = true }, highlight = { enable = true },
indent = { enable = true }, indent = { enable = true },
ensure_installed = { "lua", "luadoc", "printf", "vim", "vimdoc" }, ensure_installed = { "lua", "luadoc", "printf", "vim", "vimdoc" },
incremental_selection = { incremental_selection = {
enable = true, enable = true,
}, },
autopairs = { autopairs = {
enable = true, enable = true,
}, },
} }
end, end,
config = function(_, opts) config = function(_, opts)
if type(opts.ensure_installed) == "table" then if type(opts.ensure_installed) == "table" then
---@type table<string, boolean> ---@type table<string, boolean>
local added = {} local added = {}
opts.ensure_installed = vim.tbl_filter(function(lang) opts.ensure_installed = vim.tbl_filter(function(lang)
if added[lang] then if added[lang] then
return false return false
end end
added[lang] = true added[lang] = true
return true return true
end, opts.ensure_installed) end, opts.ensure_installed)
end end
require("nvim-treesitter.configs").setup(opts) require("nvim-treesitter.configs").setup(opts)
vim.api.nvim_create_user_command("TSInstallInfo", function() end,
vim.cmd("Telescope treesitter_info") },
end, {})
end,
},
} }

View file

@ -2,8 +2,6 @@ return {
{ {
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
event = "InsertEnter", event = "InsertEnter",
version = "v2.*",
build = "make install_jsregexp",
opts = { opts = {
history = true, history = true,
delete_check_events = "TextChanged", delete_check_events = "TextChanged",

View file

@ -2,63 +2,51 @@
-- cpp="gcc $fileName -lstdc++ -o $fileNameWithoutExt && $fileNameWithoutExt" -- cpp="gcc $fileName -lstdc++ -o $fileNameWithoutExt && $fileNameWithoutExt"
local pyrun = "python -u" local pyrun = "python -u"
if vim.fn.has("win32") == 0 then if vim.fn.has("win32") == 0 then
pyrun = "python3 -u" pyrun = "python3 -u"
end end
local rfile = { local rfile = {
java = "cd $dir && javac $fileName && java $fileNameWithoutExt", java = "cd $dir && javac $fileName && java $fileNameWithoutExt",
python = pyrun, python = pyrun,
typescript = "ts-node $dir/$fileName", typescript = "ts-node $dir/$fileName",
rust = "cd $dir && rustc $fileName && $dir/$fileNameWithoutExt", rust = "cd $dir && rustc $fileName && $dir/$fileNameWithoutExt",
cpp = "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt", cpp = "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt",
scss = "sass $dir/$fileName $dir/$fileNameWithoutExt.css", scss = "sass $dir/$fileName $dir/$fileNameWithoutExt.css",
javascript = 'node "$dir/$fileName"', javascript = 'node "$dir/$fileName"',
-- go = "go run .", 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 { return {
"CRAG666/code_runner.nvim", "CRAG666/code_runner.nvim",
lazy = true, lazy = true,
cmd = { "RunCode", "RunFile", "RunProject", "RunClose" }, cmd = { "RunCode", "RunFile", "RunProject", "RunClose" },
opts = { opts = {
filetype = rfile, filetype = rfile,
project = runProject, mode = "float",
mode = "float", focus = true,
focus = true, startinsert = true,
startinsert = true, term = {
term = { position = "bot",
position = "bot", size = 50,
size = 50, },
}, float = {
float = { close_key = "<ESC>",
close_key = "<ESC>", border = "rounded",
border = "rounded", height = 0.8,
height = 0.8, width = 0.8,
width = 0.8, x = 0.5,
x = 0.5, y = 0.5,
y = 0.5, border_hl = "FloatBorder",
border_hl = "FloatBorder", float_hl = "Normal",
float_hl = "Normal", blend = 0,
blend = 0, },
}, },
}, config = function(_, opts)
config = function(_, opts) require("code_runner").setup(opts)
require("code_runner").setup(opts) end,
end, keys = {
keys = { { "<leader>r", "", desc = "  Run", mode = "n" },
{ "<leader>r", "", desc = "  Run", mode = "n" }, { "<leader>rr", "<cmd>RunCode<CR>", desc = "Run Code", mode = "n" },
{ "<leader>rr", "<cmd>RunCode<CR>", desc = "Run Code", mode = "n" }, { "<leader>rf", "<cmd>RunFile<CR>", desc = "Run File", mode = "n" },
{ "<leader>rf", "<cmd>RunFile<CR>", desc = "Run File", mode = "n" }, { "<leader>rp", "<cmd>RunProject<CR>", desc = "Run Project", mode = "n" },
{ "<leader>rp", "<cmd>RunProject<CR>", desc = "Run Project", mode = "n" }, },
},
} }

View file

@ -1,43 +1,40 @@
return { return {
"pojokcodeid/auto-conform.nvim", "pojokcodeid/auto-conform.nvim",
dependencies = { dependencies = {
"williamboman/mason.nvim", "williamboman/mason.nvim",
"stevearc/conform.nvim", "stevearc/conform.nvim",
}, },
event = "VeryLazy", event = "VeryLazy",
opts = function(_, opts) opts = function(_, opts)
opts.formatters = opts.formatters or {} opts.formatters = opts.formatters or {}
opts.formatters_by_ft = opts.formatters_by_ft or {} opts.formatters_by_ft = opts.formatters_by_ft or {}
opts.ensure_installed = opts.ensure_installed or {} opts.ensure_installed = opts.ensure_installed or {}
-- vim.list_extend(opts.ensure_installed, { "stylua" }) -- vim.list_extend(opts.ensure_installed, { "stylua" })
opts.lang_maps = opts.lang_maps or {} opts.lang_maps = opts.lang_maps or {}
opts.name_maps = opts.name_maps or {} opts.name_maps = opts.name_maps or {}
opts.add_new = opts.add_new or {} opts.add_new = opts.add_new or {}
opts.ignore = opts.ignore or {} opts.ignore = opts.ignore or {}
opts.format_on_save = opts.format_on_save or true opts.format_on_save = opts.format_on_save or true
opts.format_timeout_ms = opts.format_timeout_ms or 5000 opts.format_timeout_ms = opts.format_timeout_ms or 5000
end, end,
config = function(_, opts) config = function(_, opts)
require("auto-conform").setup(opts) require("auto-conform").setup(opts)
-- other conform config -- other conform config
local conform = require("conform") local conform = require("conform")
if opts.format_on_save then if opts.format_on_save then
conform.setup({ conform.setup({
format_on_save = { format_on_save = {
lsp_fallback = true, lsp_fallback = true,
timeout_ms = opts.format_timeout_ms or 5000, timeout_ms = opts.format_timeout_ms or 5000,
}, },
}) })
end end
vim.keymap.set({ "n", "v" }, "<leader>lF", function() vim.keymap.set({ "n", "v" }, "<leader>lF", function()
conform.format({ conform.format({
lsp_fallback = true, lsp_fallback = true,
async = false, async = false,
timeout_ms = opts.format_timeout_ms or 5000, timeout_ms = opts.format_timeout_ms or 5000,
}) })
end, { desc = "Format file or range (in visual mode)" }) end, { desc = "Format file or range (in visual mode)" })
end, end,
keys = {
{ "<leader>l", "", desc = " 󰘦 Lsp" },
},
} }

View 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,
}

View file

@ -1,35 +0,0 @@
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,
}

View file

@ -23,9 +23,6 @@ return {
"toggleterm", "toggleterm",
"Trouble", "Trouble",
"trouble", "trouble",
"term",
"terminal",
"zsh",
}, },
callback = function() callback = function()
vim.b.miniindentscope_disable = true vim.b.miniindentscope_disable = true

View file

@ -1,13 +1,12 @@
return { return {
{ {
"nvzone/menu", "nvchad/menu",
lazy = true, lazy = true,
event = { "VeryLazy" }, event = { "VeryLazy" },
dependencies = { dependencies = {
{ "nvzone/volt", lazy = true }, { "nvchad/volt", lazy = true },
{ "nvzone/showkeys", cmd = "ShowkeysToggle", lazy = true },
{ {
"nvzone/minty", "nvchad/minty",
cmd = { "Shades", "Huefy" }, cmd = { "Shades", "Huefy" },
lazy = true, lazy = true,
}, },
@ -23,12 +22,10 @@ return {
end, {}) end, {})
-- mouse users + nvimtree users! -- mouse users + nvimtree users!
vim.keymap.set({ "n", "v" }, "<RightMouse>", function() vim.keymap.set("n", "<RightMouse>", function()
require("menu.utils").delete_old_menus()
vim.cmd.exec('"normal! \\<RightMouse>"') vim.cmd.exec('"normal! \\<RightMouse>"')
local buf = vim.api.nvim_win_get_buf(vim.fn.getmousepos().winid) local options = vim.bo.ft == "NvimTree" and "nvimtree" or "default"
local options = vim.bo[buf].ft == "NvimTree" and "nvimtree" or "default"
require("menu").open(options, opts) require("menu").open(options, opts)
end, {}) end, {})
end, end,

View file

@ -1,26 +0,0 @@
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",
},
},
}

View file

@ -1,22 +0,0 @@
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,
}

View file

@ -55,10 +55,6 @@ return {
-- create auto command to set transparent -- create auto command to set transparent
vim.cmd("TransparentDisable") vim.cmd("TransparentDisable")
vim.cmd("TransparentEnable") 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, end,
}, },
{ {

View file

@ -11,46 +11,6 @@ return {
opts = function(_, opts) opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {} opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "gopls" }) vim.list_extend(opts.ensure_installed, { "gopls" })
vim.api.nvim_create_user_command("GoRun", function()
local filename = vim.fn.expand("%:p") -- path lengkap file aktif
if not filename:match("%.go$") then
vim.notify("current file is not a go file.", vim.log.levels.WARN, { title = "GoRun" })
return
end
local Terminal = require("toggleterm.terminal").Terminal
local go_runner = Terminal:new({
cmd = "go run " .. filename,
direction = "float",
close_on_exit = false,
hidden = true,
})
go_runner:toggle()
end, {})
vim.api.nvim_create_user_command("GoBuild", function()
local cwd = vim.fn.getcwd()
local go_mod_path = cwd .. "/go.mod"
if vim.fn.filereadable(go_mod_path) == 0 then
vim.notify("current project is not a go project.", vim.log.levels.WARN, { title = "GoBuild" })
return
end
local Terminal = require("toggleterm.terminal").Terminal
-- create file exe jika os adalah windows
local filename = "output"
if vim.fn.has("win32") == 1 then
filename = "output.exe"
end
local go_runner = Terminal:new({
cmd = "go build -o " .. filename .. " && ./" .. filename,
direction = "float",
close_on_exit = false,
hidden = true,
})
go_runner:toggle()
end, {})
end, end,
}, },
{ {

View file

@ -1,119 +1,104 @@
local config_file = "jest.config.ts" local config_file = "jest.config.ts"
local M = { local M = {
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
opts = function(_, opts) opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {} opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "html", "javascript", "typescript", "tsx", "css", "json", "jsonc" }) vim.list_extend(
end, opts.ensure_installed,
}, { "html", "javascript", "typescript", "tsx", "css", "json", "jsonc" }
{ )
"williamboman/mason-lspconfig.nvim", end,
opts = function(_, opts) },
opts.ensure_installed = opts.ensure_installed or {} {
vim.list_extend(opts.ensure_installed, { "html", "eslint", "cssls", "emmet_ls", "jsonls", "ts_ls" }) "williamboman/mason-lspconfig.nvim",
end, opts = function(_, opts)
}, opts.ensure_installed = opts.ensure_installed or {}
{ vim.list_extend(opts.ensure_installed, { "html", "eslint", "cssls", "emmet_ls", "jsonls", "ts_ls" })
"pojokcodeid/auto-conform.nvim", end,
event = "VeryLazy", },
opts = function(_, opts) {
opts.formatters_by_ft = opts.formatters_by_ft or {} "pojokcodeid/auto-conform.nvim",
local package = "prettier" event = "VeryLazy",
vim.list_extend(opts.ensure_installed, { package }) opts = function(_, opts)
opts.formatters_by_ft.javascript = { package } opts.formatters_by_ft = opts.formatters_by_ft or {}
end, local package = "prettier"
}, vim.list_extend(opts.ensure_installed, { package })
{ opts.formatters_by_ft.javascript = { package }
"nvim-neotest/neotest", end,
dependencies = { },
"antoinemadec/FixCursorHold.nvim", {
"nvim-neotest/neotest-jest", "nvim-neotest/neotest",
"nvim-neotest/nvim-nio", dependencies = {
}, "antoinemadec/FixCursorHold.nvim",
opts = { "nvim-neotest/neotest-jest",
adapters = { "nvim-neotest/nvim-nio",
["neotest-jest"] = { },
jestCommand = "npm test -- ", opts = {
jestConfigFile = function() adapters = {
local file = vim.fn.expand("%:p") ["neotest-jest"] = {
if string.find(file, "/packages/") then jestCommand = "npm test -- ",
return string.match(file, "(.-/[^/]+/)src") .. config_file jestConfigFile = function()
end local file = vim.fn.expand("%:p")
return vim.fn.getcwd() .. "/" .. config_file if string.find(file, "/packages/") then
end, return string.match(file, "(.-/[^/]+/)src") .. config_file
cwd = function() end
local file = vim.fn.expand("%:p") return vim.fn.getcwd() .. "/" .. config_file
if string.find(file, "/packages/") then end,
return string.match(file, "(.-/[^/]+/)src") cwd = function()
end local file = vim.fn.expand("%:p")
return vim.fn.getcwd() if string.find(file, "/packages/") then
end, return string.match(file, "(.-/[^/]+/)src")
}, end
}, return vim.fn.getcwd()
status = { virtual_text = true }, end,
output = { open_on_run = true }, },
}, },
config = function(_, opts) status = { virtual_text = true },
local neotest_ns = vim.api.nvim_create_namespace("neotest") output = { open_on_run = true },
vim.diagnostic.config({ },
virtual_text = { config = function(_, opts)
format = function(diagnostic) local neotest_ns = vim.api.nvim_create_namespace("neotest")
-- Replace newline and tab characters with space for more compact diagnostics vim.diagnostic.config({
local message = diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "") virtual_text = {
return message format = function(diagnostic)
end, -- Replace newline and tab characters with space for more compact diagnostics
}, local message =
}, neotest_ns) diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "")
return message
end,
},
}, neotest_ns)
opts.consumers = opts.consumers or {} opts.consumers = opts.consumers or {}
if opts.adapters then if opts.adapters then
local adapters = {} local adapters = {}
for name, config in pairs(opts.adapters or {}) do for name, config in pairs(opts.adapters or {}) do
if type(name) == "number" then if type(name) == "number" then
if type(config) == "string" then if type(config) == "string" then
config = require(config) config = require(config)
end end
adapters[#adapters + 1] = config adapters[#adapters + 1] = config
elseif config ~= false then elseif config ~= false then
local adapter = require(name) local adapter = require(name)
if type(config) == "table" and not vim.tbl_isempty(config) then if type(config) == "table" and not vim.tbl_isempty(config) then
local meta = getmetatable(adapter) local meta = getmetatable(adapter)
if adapter.setup then if adapter.setup then
adapter.setup(config) adapter.setup(config)
elseif meta and meta.__call then elseif meta and meta.__call then
adapter(config) adapter(config)
else else
error("Adapter " .. name .. " does not support setup") error("Adapter " .. name .. " does not support setup")
end end
end end
adapters[#adapters + 1] = adapter adapters[#adapters + 1] = adapter
end end
end end
opts.adapters = adapters opts.adapters = adapters
end end
require("neotest").setup(opts) require("neotest").setup(opts)
-- local command = pcode.npm_commad end,
-- or {
-- dev = {
-- start = "NpmRunDev",
-- stop = "NpmStopDev",
-- cmd = "npm run dev",
-- },
-- prod = {
-- start = "NpmStart",
-- stop = "NpmStop",
-- cmd = "npm start",
-- },
-- }
-- require("pcode.user.npmrun").setup(command, {
-- show_mapping = "<leader>nm",
-- hide_mapping = "<leader>nh",
-- width = 70,
-- height = 20,
-- })
end,
-- stylua: ignore -- stylua: ignore
keys = { keys = {
{ "<leader>T","",desc="  Test"}, { "<leader>T","",desc="  Test"},
@ -126,126 +111,92 @@ local M = {
{ "<Leader>TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, { "<Leader>TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" },
{ "<Leader>TS", function() require("neotest").run.stop() end, desc = "Stop" }, { "<Leader>TS", function() require("neotest").run.stop() end, desc = "Stop" },
}, },
}, },
{ {
"pojokcodeid/npm-runner.nvim", "rcarriga/nvim-dap-ui",
event = "VeryLazy", lazy = true,
dependencies = { event = "BufRead",
"rcarriga/nvim-notify", dependencies = {
}, { "mfussenegger/nvim-dap", lazy = true },
-- your opts go here { "nvim-neotest/nvim-nio", lazy = true },
opts = { {
command = { "mxsdev/nvim-dap-vscode-js",
dev = { dependencies = {
start = "NpmRunDev", "microsoft/vscode-js-debug",
stop = "NpmStopDev", version = "1.x",
cmd = "npm run dev", build = "npm i && npm run compile vsDebugServerBundle && mv dist out",
}, },
prod = { config = function()
start = "NpmStart", require("dap-vscode-js").setup({
stop = "NpmStop", -- node_path = "node", -- Path of node executable. Defaults to $NODE_PATH, and then "node"
cmd = "npm start", debugger_path = vim.fn.stdpath("data") .. "/lazy/vscode-js-debug",
}, -- debugger_cmd = { "extension" }, -- Command to use to launch the debug server. Takes precedence over `node_path` and `debugger_path`.
}, adapters = {
opt = { "chrome",
show_mapping = "<leader>nm", "pwa-node",
hide_mapping = "<leader>nh", "pwa-chrome",
width = 70, "pwa-msedge",
height = 20, "node-terminal",
}, "pwa-extensionHost",
}, "node",
keys = { "chrome",
{ "<leader>n", "", desc = "  Npm" }, }, -- which adapters to register in nvim-dap
}, -- log_file_path = "(stdpath cache)/dap_vscode_js.log" -- Path for file logging
config = function(_, opts) -- log_file_level = false -- Logging level for output to file. Set to false to disable file logging.
require("npm-runner").setup(opts.command, opts.opt) -- log_console_level = vim.log.levels.ERROR -- Logging level for output to console. Set to false to disable console output.
end, })
}, end,
{ },
"rcarriga/nvim-dap-ui", },
lazy = true, config = function()
event = "BufRead", require("pcode.user.dapui")
dependencies = { local js_based_languages = { "typescript", "javascript", "typescriptreact" }
{ "mfussenegger/nvim-dap", lazy = true },
{ "nvim-neotest/nvim-nio", lazy = true },
{
"mxsdev/nvim-dap-vscode-js",
dependencies = {
"microsoft/vscode-js-debug",
version = "1.x",
build = "npm i && npm run compile vsDebugServerBundle && mv dist out",
},
config = function()
require("dap-vscode-js").setup({
-- node_path = "node", -- Path of node executable. Defaults to $NODE_PATH, and then "node"
debugger_path = vim.fn.stdpath("data") .. "/lazy/vscode-js-debug",
-- debugger_cmd = { "extension" }, -- Command to use to launch the debug server. Takes precedence over `node_path` and `debugger_path`.
adapters = {
"chrome",
"pwa-node",
"pwa-chrome",
"pwa-msedge",
"node-terminal",
"pwa-extensionHost",
"node",
"chrome",
}, -- which adapters to register in nvim-dap
-- log_file_path = "(stdpath cache)/dap_vscode_js.log" -- Path for file logging
-- log_file_level = false -- Logging level for output to file. Set to false to disable file logging.
-- log_console_level = vim.log.levels.ERROR -- Logging level for output to console. Set to false to disable console output.
})
end,
},
},
config = function()
require("pcode.user.dapui")
local js_based_languages = { "typescript", "javascript", "typescriptreact" }
for _, language in ipairs(js_based_languages) do for _, language in ipairs(js_based_languages) do
require("dap").configurations[language] = { require("dap").configurations[language] = {
{ {
type = "pwa-node", type = "pwa-node",
request = "launch", request = "launch",
name = "Launch file", name = "Launch file",
program = "${file}", program = "${file}",
cwd = "${workspaceFolder}", cwd = "${workspaceFolder}",
}, },
{ {
type = "pwa-node", type = "pwa-node",
request = "attach", request = "attach",
name = "Attach", name = "Attach",
processId = require("dap.utils").pick_process, processId = require("dap.utils").pick_process,
cwd = "${workspaceFolder}", cwd = "${workspaceFolder}",
}, },
{ {
type = "pwa-chrome", type = "pwa-chrome",
request = "launch", request = "launch",
name = 'Start Chrome with "localhost"', name = 'Start Chrome with "localhost"',
url = "http://localhost:3000", url = "http://localhost:3000",
webRoot = "${workspaceFolder}", webRoot = "${workspaceFolder}",
userDataDir = "${workspaceFolder}/.vscode/vscode-chrome-debug-userdatadir", userDataDir = "${workspaceFolder}/.vscode/vscode-chrome-debug-userdatadir",
}, },
} }
end end
end, end,
keys = { keys = {
{ "<leader>d", "", desc = "  Debug" }, { "<leader>d", "", desc = "  Debug" },
{ "<leader>dt", "<cmd>lua require'dap'.toggle_breakpoint()<cr>", desc = "Toggle Breakpoint" }, { "<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>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'.continue()<cr>", desc = "Continue" },
{ "<leader>dC", "<cmd>lua require'dap'.run_to_cursor()<cr>", desc = "Run To Cursor" }, { "<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>dd", "<cmd>lua require'dap'.disconnect()<cr>", desc = "Disconnect" },
{ "<leader>dg", "<cmd>lua require'dap'.session()<cr>", desc = "Get Session" }, { "<leader>dg", "<cmd>lua require'dap'.session()<cr>", desc = "Get Session" },
{ "<leader>di", "<cmd>lua require'dap'.step_into()<cr>", desc = "Step Into" }, { "<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>do", "<cmd>lua require'dap'.step_over()<cr>", desc = "Step Over" },
{ "<leader>du", "<cmd>lua require'dap'.step_out()<cr>", desc = "Step Out" }, { "<leader>du", "<cmd>lua require'dap'.step_out()<cr>", desc = "Step Out" },
{ "<leader>dp", "<cmd>lua require'dap'.pause()<cr>", desc = "Pause" }, { "<leader>dp", "<cmd>lua require'dap'.pause()<cr>", desc = "Pause" },
{ "<leader>dr", "<cmd>lua require'dap'.repl.toggle()<cr>", desc = "Toggle Repl" }, { "<leader>dr", "<cmd>lua require'dap'.repl.toggle()<cr>", desc = "Toggle Repl" },
{ "<leader>ds", "<cmd>lua require'dap'.continue()<cr>", desc = "Start" }, { "<leader>ds", "<cmd>lua require'dap'.continue()<cr>", desc = "Start" },
{ "<leader>dq", "<cmd>lua require'dap'.close()<cr>", desc = "Quit" }, { "<leader>dq", "<cmd>lua require'dap'.close()<cr>", desc = "Quit" },
{ "<leader>dU", "<cmd>lua require'dapui'.toggle({reset = true})<cr>", desc = "Toggle UI" }, { "<leader>dU", "<cmd>lua require'dapui'.toggle({reset = true})<cr>", desc = "Toggle UI" },
}, },
}, },
} }
return M return M

View file

@ -3,7 +3,6 @@ return {
lazy = true, lazy = true,
event = "VeryLazy", event = "VeryLazy",
keys = { keys = {
{ "<leader>u", "", desc = " 󰀦 Notify" },
{ {
"<leader>uN", "<leader>uN",
function() function()

View file

@ -1,60 +1,45 @@
return { return {
"nvim-tree/nvim-tree.lua", "nvim-tree/nvim-tree.lua",
cmd = { "NvimTreeFindFileToggle", "NvimTree", "NvimTreeOpen", "NvimTreeToggle", "NvimTreeFocus", "NvimTreeClose" }, cmd = { "NvimTreeFindFileToggle", "NvimTree", "NvimTreeOpen", "NvimTreeToggle", "NvimTreeFocus", "NvimTreeClose" },
keys = { keys = {
{ "<leader>e", "<cmd>NvimTreeToggle<cr>", desc = "󰙅 Explorer" }, { "<leader>e", "<cmd>NvimTreeToggle<cr>", desc = "󰙅 Explorer" },
}, },
opts = function(_, opts) opts = function(_, opts)
local icons = require("pcode.user.icons") local icons = require("pcode.user.icons")
opts.auto_reload_on_write = false opts.disable_netrw = true
opts.disable_netrw = false opts.hijack_cursor = true
opts.hijack_cursor = false opts.sync_root_with_cwd = true
opts.hijack_netrw = true opts.update_focused_file = {
opts.hijack_unnamed_buffer_when_opening = false enable = true,
opts.sync_root_with_cwd = true update_root = false,
opts.sort = { }
sorter = "name", opts.view = {
folders_first = true, adaptive_size = false,
files_first = false, centralize_selection = true,
} width = 30,
opts.root_dirs = {} side = "left",
opts.prefer_startup_root = false preserve_window_proportions = false,
opts.sync_root_with_cwd = true number = false,
opts.reload_on_bufenter = false relativenumber = false,
opts.respect_buf_cwd = false signcolumn = "yes",
opts.on_attach = "default" float = {
opts.select_prompts = false enable = false,
opts.update_focused_file = { quit_on_focus_loss = true,
enable = true, open_win_config = {
update_root = false, relative = "editor",
} border = "rounded",
opts.view = { width = 30,
adaptive_size = false, height = 30,
centralize_selection = true, row = 1,
width = 30, col = 1,
side = "left", },
preserve_window_proportions = false, },
number = false, }
relativenumber = false, opts.renderer = {
signcolumn = "yes", root_folder_label = false,
float = { highlight_git = true,
enable = false, indent_markers = { enable = true },
quit_on_focus_loss = true, --[[ indent_markers = {
open_win_config = {
relative = "editor",
border = "rounded",
width = 30,
height = 30,
row = 1,
col = 1,
},
},
}
opts.renderer = {
root_folder_label = false,
highlight_git = true,
indent_markers = { enable = true },
--[[ indent_markers = {
enable = true, enable = true,
inline_arrows = true, inline_arrows = true,
icons = { icons = {
@ -64,111 +49,73 @@ return {
none = " ", none = " ",
}, },
}, ]] }, ]]
icons = { icons = {
webdev_colors = true, webdev_colors = true,
git_placement = "before", git_placement = "before",
padding = " ", padding = " ",
symlink_arrow = "", symlink_arrow = "",
show = { show = {
file = true, file = true,
folder = true, folder = true,
folder_arrow = true, folder_arrow = true,
git = true, git = true,
}, },
glyphs = { glyphs = {
default = icons.ui.Text, default = icons.ui.Text,
symlink = icons.ui.FileSymlink, symlink = icons.ui.FileSymlink,
bookmark = icons.ui.BookMark, bookmark = icons.ui.BookMark,
folder = { folder = {
arrow_closed = icons.ui.ChevronShortRight, arrow_closed = icons.ui.ChevronShortRight,
arrow_open = icons.ui.ChevronShortDown, arrow_open = icons.ui.ChevronShortDown,
default = icons.ui.Folder, default = icons.ui.Folder,
open = icons.ui.FolderOpen, open = icons.ui.FolderOpen,
empty = icons.ui.EmptyFolder, empty = icons.ui.EmptyFolder,
empty_open = icons.ui.EmptyFolderOpen, empty_open = icons.ui.EmptyFolderOpen,
symlink = icons.ui.FolderSymlink, symlink = icons.ui.FolderSymlink,
symlink_open = icons.ui.FolderOpen, symlink_open = icons.ui.FolderOpen,
}, },
git = { git = {
unstaged = icons.git.FileUnstaged, unstaged = icons.git.FileUnstaged,
staged = icons.git.FileStaged, staged = icons.git.FileStaged,
unmerged = icons.git.FileUnmerged, unmerged = icons.git.FileUnmerged,
renamed = icons.git.FileRenamed, renamed = icons.git.FileRenamed,
untracked = icons.git.FileUntracked, untracked = icons.git.FileUntracked,
deleted = icons.git.FileDeleted, deleted = icons.git.FileDeleted,
ignored = icons.git.FileIgnored, ignored = icons.git.FileIgnored,
}, },
}, },
}, },
special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" }, special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" },
symlink_destination = true, symlink_destination = true,
} }
opts.filters = { opts.filters = {
dotfiles = false, dotfiles = false,
git_clean = false, git_clean = false,
no_buffer = false, no_buffer = false,
custom = { "node_modules", "\\.cache", "\\.git" }, custom = { "node_modules", "\\.cache", "\\.git" },
exclude = { exclude = {
".gitignore", ".gitignore",
".prettierignore", ".prettierignore",
}, },
} }
opts.notify = { opts.notify = {
threshold = vim.log.levels.INFO, threshold = vim.log.levels.INFO,
} }
opts.git = { opts.git = {
enable = true, enable = true,
ignore = false, ignore = false,
show_on_dirs = true, show_on_dirs = true,
show_on_open_dirs = true, show_on_open_dirs = true,
disable_for_dirs = {}, disable_for_dirs = {},
timeout = 400, timeout = 400,
} }
return opts return opts
end, end,
config = function(_, opts) config = function(_, opts)
if pcode.nvimtree_float then require("nvim-tree").setup(opts)
-- set nvimtree float view (default left side) local api = require("nvim-tree.api")
opts.view = { api.events.subscribe(api.events.Event.FileCreated, function(file)
adaptive_size = false, vim.cmd("edit " .. file.fname)
centralize_selection = true, end)
side = "left", end,
preserve_window_proportions = false,
number = false,
relativenumber = false,
signcolumn = "yes",
float = {
enable = true,
open_win_config = function()
local screen_w = vim.opt.columns:get()
---@diagnostic disable-next-line: undefined-field
local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get()
local window_w = screen_w * 0.5
local window_h = screen_h * 0.9
local window_w_int = math.floor(window_w)
local window_h_int = math.floor(window_h)
local center_x = (screen_w - window_w) / 2
---@diagnostic disable-next-line: undefined-field
local center_y = ((vim.opt.lines:get() - window_h) / 2) - vim.opt.cmdheight:get()
return {
border = "rounded",
relative = "editor",
row = center_y,
col = center_x,
width = window_w_int,
height = window_h_int,
}
end,
},
width = function()
return math.floor(vim.opt.columns:get() * 0.5)
end,
}
end
require("nvim-tree").setup(opts)
local api = require("nvim-tree.api")
api.events.subscribe(api.events.Event.FileCreated, function(file)
vim.cmd("edit " .. file.fname)
end)
end,
} }

View file

@ -49,7 +49,6 @@ return {
Normal = { fg = colors.text, bg = transparent and colors.none or colors.base }, Normal = { fg = colors.text, bg = transparent and colors.none or colors.base },
NormalNC = { fg = colors.text, bg = transparent and colors.none or colors.base }, NormalNC = { fg = colors.text, bg = transparent and colors.none or colors.base },
StatusLine = { fg = colors.text, bg = colors.none }, StatusLine = { fg = colors.text, bg = colors.none },
MasonBackdrop = { link = "NormalFloat" },
} }
end, end,
highlight_overrides = { highlight_overrides = {

View file

@ -50,7 +50,6 @@ return {
LspReferenceWrite = { bg = "#3b4261" }, LspReferenceWrite = { bg = "#3b4261" },
WinBar = { bg = colors.bg }, WinBar = { bg = colors.bg },
WinBarNC = { fg = colors.fg, bg = colors.bg }, WinBarNC = { fg = colors.fg, bg = colors.bg },
MasonBackdrop = { link = "NormalFloat" },
}, },
transparent_bg = false, transparent_bg = false,
} }

View file

@ -23,7 +23,6 @@ return {
hi(0, "NormalFloat", { bg = color.background }) hi(0, "NormalFloat", { bg = color.background })
hi(0, "TabLine", { bg = color.background }) hi(0, "TabLine", { bg = color.background })
hi(0, "NormalNC", { bg = color.background }) hi(0, "NormalNC", { bg = color.background })
hi(0, "MasonBackdrop", { link = "NormalFloat" })
hi(0, "@tag.delimiter.javascript", { fg = color.punctuation }) hi(0, "@tag.delimiter.javascript", { fg = color.punctuation })
hi(0, "@tag.delimiter.tsx", { fg = color.punctuation }) hi(0, "@tag.delimiter.tsx", { fg = color.punctuation })
-- git -- git

View file

@ -53,7 +53,6 @@ return {
specs = {}, specs = {},
groups = { groups = {
all = { all = {
MasonBackdrop = { link = "NormalFloat" },
illuminatedWord = { bg = "#3b4261" }, illuminatedWord = { bg = "#3b4261" },
illuminatedCurWord = { bg = "#3b4261" }, illuminatedCurWord = { bg = "#3b4261" },
IlluminatedWordText = { bg = "#3b4261" }, IlluminatedWordText = { bg = "#3b4261" },

View file

@ -18,7 +18,6 @@ return {
["FoldColumn"] = { bg = "NONE" }, ["FoldColumn"] = { bg = "NONE" },
["Folded"] = { bg = "NONE" }, ["Folded"] = { bg = "NONE" },
["SignColumn"] = { bg = "NONE" }, ["SignColumn"] = { bg = "NONE" },
["MasonBackdrop"] = { link = "NormalFloat" },
}, },
} }
end, end,

View file

@ -33,7 +33,6 @@ return {
hi(0, "TelescopePromptNormal", { bg = colors.dark, fg = colors.grey }) hi(0, "TelescopePromptNormal", { bg = colors.dark, fg = colors.grey })
hi(0, "TelescopePromptPrefix", { bg = colors.dark, fg = colors.red }) hi(0, "TelescopePromptPrefix", { bg = colors.dark, fg = colors.red })
hi(0, "TelescopeResultsTitle", { bg = colors.olive_green, fg = colors.very_dark_gray }) hi(0, "TelescopeResultsTitle", { bg = colors.olive_green, fg = colors.very_dark_gray })
hi(0, "MasonBackdrop", { link = "NormalFloat" })
end, end,
}) })
local colorscheme = pcode.themes.jetbrains or "darcula-dark" local colorscheme = pcode.themes.jetbrains or "darcula-dark"

View file

@ -1,125 +1,124 @@
return { return {
"olimorris/onedarkpro.nvim", "olimorris/onedarkpro.nvim",
priority = 1000, priority = 1000,
config = function() config = function()
local is_transparent = false local is_transparent = false
require("onedarkpro").setup({ require("onedarkpro").setup({
styles = { styles = {
types = "NONE", types = "NONE",
methods = "NONE", methods = "NONE",
numbers = "NONE", numbers = "NONE",
strings = "NONE", strings = "NONE",
comments = "italic", comments = "italic",
keywords = "bold,italic", keywords = "bold,italic",
constants = "NONE", constants = "NONE",
functions = "italic", functions = "italic",
operators = "NONE", operators = "NONE",
variables = "NONE", variables = "NONE",
parameters = "NONE", parameters = "NONE",
conditionals = "italic", conditionals = "italic",
virtual_text = "NONE", virtual_text = "NONE",
tags = "italic", tags = "italic",
}, },
colors = { colors = {
bg_statusline = "#282c34", bg_statusline = "#282c34",
onedark = { onedark = {
green = "#99c379", green = "#99c379",
gray = "#8094b4", gray = "#8094b4",
red = "#e06c75", red = "#e06c75",
purple = "#c678dd", purple = "#c678dd",
yellow = "#e5c07a", yellow = "#e5c07a",
blue = "#61afef", blue = "#61afef",
cyan = "#56b6c2", cyan = "#56b6c2",
indentline = "#3b4261", indentline = "#3b4261",
float_bg = "#282c34", float_bg = "#282c34",
}, },
onedark_dark = { onedark_dark = {
bg_statusline = "#000", bg_statusline = "#000",
}, },
}, },
options = { options = {
cursorline = true, cursorline = true,
transparency = is_transparent, transparency = is_transparent,
terminal_colors = true, terminal_colors = true,
}, },
highlights = { highlights = {
-- overide cursor line fill colors -- overide cursor line fill colors
LineNr = { fg = "#49505E" }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. 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. CursorLineNr = { fg = "${blue}" }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line.
CursorLine = { bg = "#333842" }, CursorLine = { bg = "#333842" },
Cursor = { fg = "${bg}", bg = "${fg}" }, -- character under the cursor 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') 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| 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. CursorColumn = { bg = "#333842" }, -- Screen-column at the cursor, when 'cursorcolumn' is set.
-- overide nvimtree folder icon fill color -- overide nvimtree folder icon fill color
NvimTreeFolderIcon = { fg = "${gray}" }, NvimTreeFolderIcon = { fg = "${gray}" },
-- overide nvimtree text fill color folder opened -- overide nvimtree text fill color folder opened
NvimTreeOpenedFolderName = { fg = "${blue}" }, NvimTreeOpenedFolderName = { fg = "${blue}" },
-- overide nvimtree text fill color root folder -- overide nvimtree text fill color root folder
NvimTreeRootFolder = { fg = "${yellow}" }, NvimTreeRootFolder = { fg = "${yellow}" },
NvimTreeSpecialFile = { fg = "${orange}" }, NvimTreeSpecialFile = { fg = "${orange}" },
NvimTreeWinSeparator = { fg = "#202329" }, NvimTreeWinSeparator = { fg = "#202329" },
NvimTreeIndentMarker = { fg = "#3E4450" }, NvimTreeIndentMarker = { fg = "#3E4450" },
-- overide nvimtree cursorline -- overide nvimtree cursorline
NvimTreeCursorLine = { bg = "#333842" }, NvimTreeCursorLine = { bg = "#333842" },
-- overide indenline fill color -- overide indenline fill color
IblIndent = { fg = "#3E4450" }, IblIndent = { fg = "#3E4450" },
-- overide cmp cursorline fill color with #333842 -- overide cmp cursorline fill color with #333842
PmenuSel = { bg = "#333842" }, PmenuSel = { bg = "#333842" },
illuminatedWord = { bg = "#3b4261" }, illuminatedWord = { bg = "#3b4261" },
illuminatedCurWord = { bg = "#3b4261" }, illuminatedCurWord = { bg = "#3b4261" },
IlluminatedWordText = { bg = "#3b4261" }, IlluminatedWordText = { bg = "#3b4261" },
IlluminatedWordRead = { bg = "#3b4261" }, IlluminatedWordRead = { bg = "#3b4261" },
IlluminatedWordWrite = { bg = "#3b4261" }, IlluminatedWordWrite = { bg = "#3b4261" },
StatusLine = { fg = "#f8f8f2", bg = is_transparent and "NONE" or "${bg}" }, StatusLine = { fg = "#f8f8f2", bg = is_transparent and "NONE" or "${bg}" },
StatusLineTerm = { fg = "#f8f8f2", bg = "${bg}" }, StatusLineTerm = { fg = "#f8f8f2", bg = "${bg}" },
BufferLineFill = { bg = is_transparent and "NONE" or "${bg}" }, BufferLineFill = { bg = is_transparent and "NONE" or "${bg}" },
["@string.special.url.html"] = { fg = "${green}" }, ["@string.special.url.html"] = { fg = "${green}" },
["@lsp.type.parameter"] = { fg = "${gray}" }, ["@lsp.type.parameter"] = { fg = "${gray}" },
-- ["@text.uri.html"] = { fg = "${green}" }, -- ["@text.uri.html"] = { fg = "${green}" },
-- ["@tag.javascript"] = { fg = "${red}" }, -- ["@tag.javascript"] = { fg = "${red}" },
-- ["@tag.attribute"] = { fg = "${orange}", style = "italic" }, -- ["@tag.attribute"] = { fg = "${orange}", style = "italic" },
-- ["@constructor.javascript"] = { fg = "${red}" }, -- ["@constructor.javascript"] = { fg = "${red}" },
-- ["@variable"] = { fg = "${fg}", style = "NONE" }, -- various variable names -- ["@variable"] = { fg = "${fg}", style = "NONE" }, -- various variable names
-- ["@variable.builtin"] = { fg = "${red}", style = "NONE" }, -- ["@variable.builtin"] = { fg = "${red}", style = "NONE" },
-- ["@variable.member"] = "${cyan}", -- ["@variable.member"] = "${cyan}",
-- ["@variable.parameter"] = "${red}", -- ["@variable.parameter"] = "${red}",
-- ["@property"] = { fg = "${cyan}" }, -- similar to `@field` -- ["@property"] = { fg = "${cyan}" }, -- similar to `@field`
["@property.lua"] = { fg = "${red}", bg = "NONE" }, ["@property.lua"] = { fg = "${red}", bg = "NONE" },
["@lsp.type.property.lua"] = { fg = "${cyan}", bg = "NONE" }, ["@lsp.type.property.lua"] = { fg = "${cyan}", bg = "NONE" },
["@lsp.type.variable.lua"] = { fg = "${red}", bg = "NONE" }, ["@lsp.type.variable.lua"] = { fg = "${red}", bg = "NONE" },
NvimTreeGitDirty = { fg = "${yellow}" }, NvimTreeGitDirty = { fg = "${yellow}" },
Pmenu = { fg = "${fg}", bg = "${bg}" }, Pmenu = { fg = "${fg}", bg = "${bg}" },
PmenuThumb = { bg = "${gray}" }, -- Popup menu: Thumb of the scrollbar. PmenuThumb = { bg = "${gray}" }, -- Popup menu: Thumb of the scrollbar.
-- overide lualine fill color with bg color -- overide lualine fill color with bg color
LualineNormal = { bg = "${bg}" }, LualineNormal = { bg = "${bg}" },
-- overide lualine_c fill color with bg color -- overide lualine_c fill color with bg color
LualineC = { bg = "${bg}" }, LualineC = { bg = "${bg}" },
-- overide lualine_x fill color with bg color -- overide lualine_x fill color with bg color
LualineX = { bg = "${bg}" }, LualineX = { bg = "${bg}" },
-- overide which-key fill color with bg color -- overide which-key fill color with bg color
-- WhichKey = { bg = "${bg}" }, -- WhichKey = { bg = "${bg}" },
-- -- overide which-key fill color with bg color -- -- overide which-key fill color with bg color
-- WhichKeySeperator = { bg = "${bg}" }, -- WhichKeySeperator = { bg = "${bg}" },
-- -- overide which-key fill color with bg color -- -- overide which-key fill color with bg color
-- WhichKeyDesc = { fg = "${red}" }, -- WhichKeyDesc = { fg = "${red}" },
-- -- overide which-key fill color with bg color -- -- overide which-key fill color with bg color
-- WhichKeyFloat = { bg = "${bg}" }, -- WhichKeyFloat = { bg = "${bg}" },
WhichKeyFloat = { bg = is_transparent and "NONE" or "${bg}" }, WhichKeyFloat = { bg = is_transparent and "NONE" or "${bg}" },
-- -- overide which-key fill color with bg color -- -- overide which-key fill color with bg color
-- WhichKeyValue = { bg = "${bg}" }, -- WhichKeyValue = { bg = "${bg}" },
-- -- overide which-key fill color with bg color -- -- overide which-key fill color with bg color
-- WhichKeyBorder = { bg = "${bg}" }, -- WhichKeyBorder = { bg = "${bg}" },
LspInfoBorder = { fg = "${fg}" }, LspInfoBorder = { fg = "${fg}" },
NormalFloat = { fg = "${fg}", bg = is_transparent and "NONE" or "${bg}" }, NormalFloat = { fg = "${fg}", bg = is_transparent and "NONE" or "${bg}" },
Normal = { fg = "${fg}", bg = is_transparent and "NONE" or "${bg}" }, Normal = { fg = "${fg}", bg = is_transparent and "NONE" or "${bg}" },
NormalNC = { fg = "${fg}", bg = is_transparent and "NONE" or "${bg}" }, NormalNC = { fg = "${fg}", bg = is_transparent and "NONE" or "${bg}" },
FloatBorder = { fg = "${fg}", bg = is_transparent and "NONE" or "${bg}" }, FloatBorder = { fg = "${fg}", bg = is_transparent and "NONE" or "${bg}" },
NonText = { bg = "NONE", fg = "#3E4450" }, NonText = { bg = "NONE", fg = "#3E4450" },
MasonBackdrop = { link = "NormalFloat" }, },
}, })
}) local colorscheme = pcode.themes.onedarkpro or "onedark"
local colorscheme = pcode.themes.onedarkpro or "onedark" vim.cmd("colorscheme " .. colorscheme)
vim.cmd("colorscheme " .. colorscheme) end,
end,
} }

View file

@ -12,7 +12,6 @@ return {
-- custom hilights -- custom hilights
local hi = vim.api.nvim_set_hl local hi = vim.api.nvim_set_hl
hi(0, "FoldColumn", { bg = colors.bg2 }) hi(0, "FoldColumn", { bg = colors.bg2 })
hi(0, "MasonBackdrop", { link = "NormalFloat" })
end, end,
}) })
end, end,

View file

@ -71,7 +71,6 @@ return {
highlights["@tag.attribute"] = { fg = colors.green1, italic = true } highlights["@tag.attribute"] = { fg = colors.green1, italic = true }
-- highlights["@keyword.function"] = { fg = colors.blue, italic = true } -- highlights["@keyword.function"] = { fg = colors.blue, italic = true }
-- highlights["@function"] = { fg = colors.blue, italic = true } -- highlights["@function"] = { fg = colors.blue, italic = true }
highlights.MasonBackdrop = { link = "NormalFloat" }
end, end,
}) })
end, end,

View file

@ -124,264 +124,3 @@ vim.api.nvim_create_autocmd("ExitPre", {
-- vim.api.nvim_set_keymap("n", "<leader>rg", "<cmd>terminal<cr>gradle run<cr>", { noremap = true, silent = true }) -- vim.api.nvim_set_keymap("n", "<leader>rg", "<cmd>terminal<cr>gradle run<cr>", { noremap = true, silent = true })
-- end, -- end,
-- }) -- })
-- Extras
local function lsp_status()
local bufnr = vim.api.nvim_get_current_buf()
local clients = vim.lsp.get_clients and vim.lsp.get_clients({ bufnr = bufnr })
or vim.lsp.get_active_clients({ bufnr = bufnr })
if #clients == 0 then
print("󰅚 No LSP clients attached")
return
end
print("󰒋 LSP Status for buffer " .. bufnr .. ":")
print("─────────────────────────────────")
for i, client in ipairs(clients) do
print(string.format("󰌘 Client %d: %s (ID: %d)", i, client.name, client.id))
print(" Root: " .. (client.config.root_dir or "N/A"))
print(" Filetypes: " .. table.concat(client.config.filetypes or {}, ", "))
-- Check capabilities
local caps = client.server_capabilities
local features = {}
if caps.completionProvider then
table.insert(features, "completion")
end
if caps.hoverProvider then
table.insert(features, "hover")
end
if caps.definitionProvider then
table.insert(features, "definition")
end
if caps.referencesProvider then
table.insert(features, "references")
end
if caps.renameProvider then
table.insert(features, "rename")
end
if caps.codeActionProvider then
table.insert(features, "code_action")
end
if caps.documentFormattingProvider then
table.insert(features, "formatting")
end
print(" Features: " .. table.concat(features, ", "))
print("")
end
end
vim.api.nvim_create_user_command("LspStatus", lsp_status, { desc = "Show detailed LSP status" })
local function check_lsp_capabilities()
local bufnr = vim.api.nvim_get_current_buf()
local clients = vim.lsp.get_clients and vim.lsp.get_clients({ bufnr = bufnr })
or vim.lsp.get_active_clients({ bufnr = bufnr })
if #clients == 0 then
print("No LSP clients attached")
return
end
for _, client in ipairs(clients) do
print("Capabilities for " .. client.name .. ":")
local caps = client.server_capabilities
local capability_list = {
{ "Completion", caps.completionProvider },
{ "Hover", caps.hoverProvider },
{ "Signature Help", caps.signatureHelpProvider },
{ "Go to Definition", caps.definitionProvider },
{ "Go to Declaration", caps.declarationProvider },
{ "Go to Implementation", caps.implementationProvider },
{ "Go to Type Definition", caps.typeDefinitionProvider },
{ "Find References", caps.referencesProvider },
{ "Document Highlight", caps.documentHighlightProvider },
{ "Document Symbol", caps.documentSymbolProvider },
{ "Workspace Symbol", caps.workspaceSymbolProvider },
{ "Code Action", caps.codeActionProvider },
{ "Code Lens", caps.codeLensProvider },
{ "Document Formatting", caps.documentFormattingProvider },
{ "Document Range Formatting", caps.documentRangeFormattingProvider },
{ "Rename", caps.renameProvider },
{ "Folding Range", caps.foldingRangeProvider },
{ "Selection Range", caps.selectionRangeProvider },
}
for _, cap in ipairs(capability_list) do
local status = cap[2] and "" or ""
print(string.format(" %s %s", status, cap[1]))
end
print("")
end
end
vim.api.nvim_create_user_command("LspCapabilities", check_lsp_capabilities, { desc = "Show LSP capabilities" })
local function lsp_diagnostics_info()
local bufnr = vim.api.nvim_get_current_buf()
local diagnostics = vim.diagnostic.get(bufnr)
local counts = { ERROR = 0, WARN = 0, INFO = 0, HINT = 0 }
for _, diagnostic in ipairs(diagnostics) do
local severity = vim.diagnostic.severity[diagnostic.severity]
counts[severity] = counts[severity] + 1
end
print("󰒡 Diagnostics for current buffer:")
print(" Errors: " .. counts.ERROR)
print(" Warnings: " .. counts.WARN)
print(" Info: " .. counts.INFO)
print(" Hints: " .. counts.HINT)
print(" Total: " .. #diagnostics)
end
vim.api.nvim_create_user_command("LspDiagnostics", lsp_diagnostics_info, { desc = "Show LSP diagnostics count" })
local function lsp_info()
local bufnr = vim.api.nvim_get_current_buf()
local clients = vim.lsp.get_clients and vim.lsp.get_clients({ bufnr = bufnr })
or vim.lsp.get_active_clients({ bufnr = bufnr })
print("═══════════════════════════════════")
print(" LSP INFORMATION ")
print("═══════════════════════════════════")
print("")
-- Basic info
print("󰈙 Language client log: " .. vim.lsp.get_log_path())
print("󰈔 Detected filetype: " .. vim.bo.filetype)
print("󰈮 Buffer: " .. bufnr)
print("󰈔 Root directory: " .. (vim.fn.getcwd() or "N/A"))
print("")
if #clients == 0 then
print("󰅚 No LSP clients attached to buffer " .. bufnr)
print("")
print("Possible reasons:")
print(" • No language server installed for " .. vim.bo.filetype)
print(" • Language server not configured")
print(" • Not in a project root directory")
print(" • File type not recognized")
return
end
print("󰒋 LSP clients attached to buffer " .. bufnr .. ":")
print("─────────────────────────────────")
for i, client in ipairs(clients) do
print(string.format("󰌘 Client %d: %s", i, client.name))
print(" ID: " .. client.id)
print(" Root dir: " .. (client.config.root_dir or "Not set"))
print(" Command: " .. table.concat(client.config.cmd or {}, " "))
print(" Filetypes: " .. table.concat(client.config.filetypes or {}, ", "))
-- Server status
if client.is_stopped() then
print(" Status: 󰅚 Stopped")
else
print(" Status: 󰄬 Running")
end
-- Workspace folders
if client.workspace_folders and #client.workspace_folders > 0 then
print(" Workspace folders:")
for _, folder in ipairs(client.workspace_folders) do
print("" .. folder.name)
end
end
-- Attached buffers count
local attached_buffers = {}
for buf, _ in pairs(client.attached_buffers or {}) do
table.insert(attached_buffers, buf)
end
print(" Attached buffers: " .. #attached_buffers)
-- Key capabilities
local caps = client.server_capabilities
local key_features = {}
if caps.completionProvider then
table.insert(key_features, "completion")
end
if caps.hoverProvider then
table.insert(key_features, "hover")
end
if caps.definitionProvider then
table.insert(key_features, "definition")
end
if caps.documentFormattingProvider then
table.insert(key_features, "formatting")
end
if caps.codeActionProvider then
table.insert(key_features, "code_action")
end
if #key_features > 0 then
print(" Key features: " .. table.concat(key_features, ", "))
end
print("")
end
-- Diagnostics summary
local diagnostics = vim.diagnostic.get(bufnr)
if #diagnostics > 0 then
print("󰒡 Diagnostics Summary:")
local counts = { ERROR = 0, WARN = 0, INFO = 0, HINT = 0 }
for _, diagnostic in ipairs(diagnostics) do
local severity = vim.diagnostic.severity[diagnostic.severity]
counts[severity] = counts[severity] + 1
end
print(" 󰅚 Errors: " .. counts.ERROR)
print(" 󰀪 Warnings: " .. counts.WARN)
print(" 󰋽 Info: " .. counts.INFO)
print(" 󰌶 Hints: " .. counts.HINT)
print(" Total: " .. #diagnostics)
else
print("󰄬 No diagnostics")
end
print("")
print("Use :LspLog to view detailed logs")
print("Use :LspCapabilities for full capability list")
end
-- Create command
vim.api.nvim_create_user_command("LspInfo2", lsp_info, { desc = "Show comprehensive LSP information" })
vim.api.nvim_create_user_command("OpenBrowser", function(opts)
local url = opts.args
-- Jika tidak ada URL, pakai about:blank sebagai default
if url == "" then
url = "http://google.com"
end
-- Deteksi jika dijalankan di WSL
local is_wsl = vim.fn.system("uname -r"):find("WSL")
if is_wsl then
vim.fn.jobstart({ "/mnt/c/Windows/System32/cmd.exe", "/c", "start", url }, { detach = true })
return
end
-- Jika bukan WSL, gunakan cara biasa
local open_cmd
if vim.fn.has("mac") == 1 then
open_cmd = "open"
elseif vim.fn.has("unix") == 1 then
open_cmd = "xdg-open"
elseif vim.fn.has("win32") == 1 then
open_cmd = "start"
else
print("OS tidak didukung.")
return
end
vim.fn.jobstart({ open_cmd, url }, { detach = true })
end, { nargs = "?", complete = "file" })

View file

@ -47,23 +47,7 @@ return {
"williamboman/mason-lspconfig.nvim", "williamboman/mason-lspconfig.nvim",
opts = function(_, opts) opts = function(_, opts)
vim.list_extend(opts.skip_config, {}) vim.list_extend(opts.skip_config, {})
opts.virtual_text = false opts.virtual_text = true
vim.diagnostic.config({ virtual_lines = { current_line = true } })
-- sample custom diagnostic icon
vim.diagnostic.config({
underline = false,
virtual_text = false,
update_in_insert = false,
severity_sort = true,
signs = {
text = {
[vim.diagnostic.severity.ERROR] = "",
[vim.diagnostic.severity.WARN] = "",
[vim.diagnostic.severity.HINT] = "",
[vim.diagnostic.severity.INFO] = "",
},
},
})
end, end,
}, },
-- add whichkey mappings -- add whichkey mappings

View file

@ -9,7 +9,7 @@ pcode.lang = {
java2 = false, java2 = false,
java3 = false, java3 = false,
java4 = false, java4 = false,
javascript = true, javascript = false,
kotlin = false, kotlin = false,
markdown = false, markdown = false,
php = false, php = false,
@ -27,12 +27,12 @@ pcode.extras = {
minianimate = false, minianimate = false,
neoscroll = false, neoscroll = false,
nvimufo = false, nvimufo = false,
refactoring = false, refactoring = true,
rest = false, rest = false,
treesittercontex = false, treesittercontex = false,
codeium = true, codeium = true,
colorizer = true, colorizer = true,
dap = false, dap = true,
deviconcolor = true, deviconcolor = true,
illuminate = true, illuminate = true,
indentscupe = true, indentscupe = true,
@ -44,25 +44,22 @@ pcode.extras = {
verticalcolumn = true, verticalcolumn = true,
visualmulti = true, visualmulti = true,
yanky = true, yanky = true,
zenmode = false, zenmode = true,
lspsignatur = false, lspsignatur = false,
telescopetreesiterinfo = true, telescopetreesiterinfo = true,
fidget = false, fidget = false,
tinydignostic = false,
dressing = true,
telescopediff = true,
} }
-- activate config themes -- activate config themes
pcode.themes = { pcode.themes = {
-- note: open remark only one -- note: open remark only one
-- **:: Eva Theme ::** -- -- **:: Eva Theme ::** --
evatheme = "Eva-Dark", -- evatheme = "Eva-Dark",
-- evatheme = "Eva-Dark-Italic", -- evatheme = "Eva-Dark-Italic",
-- evatheme = "Eva-Dark-Bold", -- evatheme = "Eva-Dark-Bold",
-- evatheme = "Eva-Light", -- evatheme = "Eva-Light",
-- --
-- **:: Dracula Theme ::** -- -- **:: Dracula Theme ::** --
-- dracula = "dracula", dracula = "dracula",
-- dracula = "dracula-soft", -- dracula = "dracula-soft",
-- --
-- **:: Onedarkpro Theme ::** -- -- **:: Onedarkpro Theme ::** --
@ -96,7 +93,6 @@ pcode.themes = {
-- github = "github_dark_dimmed", -- github = "github_dark_dimmed",
} }
-- activate config transparent_bg -- activate config transparent_bg
pcode.transparent = false pcode.transparent = true
pcode.localcode = true pcode.localcode = true
pcode.snippets_path = vim.fn.stdpath("config") .. "/mysnippets" pcode.snippets_path = vim.fn.stdpath("config") .. "/mysnippets"
pcode.nvimtree_float = false

View file

@ -91,80 +91,3 @@ keymap("n", "<A-l>", "<cmd>terminal live-server<cr>", opts)
-- close current buffer -- close current buffer
keymap("n", "<S-t>", "<cmd>lua require('auto-bufferline.configs.utils').bufremove()<cr>", opts) keymap("n", "<S-t>", "<cmd>lua require('auto-bufferline.configs.utils').bufremove()<cr>", opts)
-- vim.keymap.set("n", "<leader>ti", function()
-- local api = vim.api
-- local parser_configs = require("nvim-treesitter.parsers").get_parser_configs()
-- local parsers = vim.tbl_keys(parser_configs)
-- table.sort(parsers)
--
-- local choices = {}
-- local lookup = {}
--
-- for _, parser in ipairs(parsers) do
-- local is_installed = #api.nvim_get_runtime_file("parser/" .. parser .. ".so", false) > 0
--
-- local label = (is_installed and "[✓] " or "[✗] ") .. parser
-- table.insert(choices, label)
-- lookup[label] = parser
-- end
--
-- vim.ui.select(choices, {
-- prompt = "Treesitter ([✓]= installed, [✗] = not installed)",
-- }, function(choice)
-- if choice then
-- local parser_name = lookup[choice]
-- if parser_name then
-- vim.cmd("TSInstall " .. parser_name)
-- end
-- end
-- end)
-- end, { desc = "Install Treesitter" })
--
-- vim.keymap.set("n", "<leader>tu", function()
-- local parsers = require("nvim-treesitter.info").installed_parsers()
-- table.sort(parsers)
-- local choices = {}
-- local lookup = {}
--
-- for _, parser in ipairs(parsers) do
-- local label = "[✓] " .. parser
-- table.insert(choices, label)
-- lookup[label] = parser
-- end
--
-- vim.ui.select(choices, {
-- prompt = "Uninstall Treesitter",
-- }, function(choice)
-- if choice then
-- local parser_name = lookup[choice]
-- if parser_name then
-- vim.cmd("TSUninstall " .. parser_name)
-- end
-- end
-- end)
-- end, { desc = "Uninstall Treesitter" })
vim.api.nvim_create_user_command("TSIsInstalled", function()
local parsers = require("nvim-treesitter.info").installed_parsers()
table.sort(parsers)
local choices = {}
local lookup = {}
for _, parser in ipairs(parsers) do
local label = "[✓] " .. parser
table.insert(choices, label)
lookup[label] = parser
end
vim.ui.select(choices, {
prompt = "Uninstall Treesitter",
}, function(choice)
if choice then
local parser_name = lookup[choice]
if parser_name then
vim.cmd("TSUninstall " .. parser_name)
end
end
end)
end, {})

View file

@ -1,262 +0,0 @@
local last_modal = nil -- global modal manager instance
local function modal_manager(opts)
opts = opts or {}
local win_id = nil
local buf_id = nil
local last_content = ""
local is_shown = false
local ever_shown = false
local function close()
if win_id and vim.api.nvim_win_is_valid(win_id) then
vim.api.nvim_win_close(win_id, true)
win_id = nil
end
is_shown = false
end
local function open(content)
local lines = vim.split(content or "", "\n")
local width = opts.width or 70
local height = math.min(opts.height or 15, #lines + 6)
local row = math.floor((vim.o.lines - height) / 2)
local col = math.floor((vim.o.columns - width) / 2)
if not buf_id or not vim.api.nvim_buf_is_valid(buf_id) then
buf_id = vim.api.nvim_create_buf(false, true)
vim.api.nvim_buf_set_keymap(buf_id, "n", "q", "", {
noremap = true,
silent = true,
callback = function()
close()
end,
})
end
pcall(vim.api.nvim_buf_set_option, buf_id, "modifiable", true)
pcall(vim.api.nvim_buf_set_lines, buf_id, 0, -1, false, lines)
pcall(vim.api.nvim_buf_set_option, buf_id, "modifiable", false)
if not win_id or not vim.api.nvim_win_is_valid(win_id) then
win_id = vim.api.nvim_open_win(buf_id, true, {
relative = "editor",
width = width,
height = height,
row = row,
col = col,
style = "minimal",
border = "rounded",
})
end
is_shown = true
ever_shown = true
end
local function show()
if is_shown then
return
end
if last_content ~= "" then
open(last_content)
end
end
local function hide()
close()
end
local function update(content)
last_content = content
if is_shown and buf_id and vim.api.nvim_buf_is_valid(buf_id) then
local lines = vim.split(content or "", "\n")
pcall(vim.api.nvim_buf_set_option, buf_id, "modifiable", true)
pcall(vim.api.nvim_buf_set_lines, buf_id, 0, -1, false, lines)
pcall(vim.api.nvim_buf_set_option, buf_id, "modifiable", false)
end
end
-- Hanya auto open saat pertama kali, tidak auto open setelah pernah di-close/hide
local function set_content(content)
last_content = content
if not ever_shown then
open(content)
elseif is_shown then
update(content)
end
-- jika ever_shown dan !is_shown, cukup simpan output saja
end
return {
show = show,
hide = hide,
update = update,
close = close,
set_content = set_content,
is_shown = function()
return is_shown
end,
}
end
local M = {}
M._last_modal = nil
local function log(message, level)
vim.notify(string.format("npm-dev-runner: %s", message), vim.log.levels[level])
end
local function find_cached_dir(dir, cache)
if not dir then
vim.notify("npm-dev-runner: No directory provided to find_cached_dir()", vim.log.levels.ERROR)
return
end
local cur = dir
while not cache[cur] do
if cur == "/" or string.match(cur, "^[A-Z]:\\$") then
return
end
cur = vim.fn.fnamemodify(cur, ":h")
end
return cur
end
local function is_running(dir, cache)
local cached_dir = find_cached_dir(dir, cache)
return cached_dir and cache[cached_dir]
end
local function is_windows()
return vim.loop.os_uname().version:match("Windows")
end
local default_opts = {
show_mapping = "<leader>nm",
hide_mapping = "<leader>nh",
}
M.setup = function(command_table, opts)
opts = vim.tbl_deep_extend("force", {}, default_opts, opts or {})
command_table = command_table or {}
-- Keymap global, pakai modal terakhir yang aktif
if opts.show_mapping then
vim.keymap.set("n", opts.show_mapping, function()
if last_modal then
last_modal.show()
end
end, { desc = "Show last NPM modal output" })
end
if opts.hide_mapping then
vim.keymap.set("n", opts.hide_mapping, function()
if last_modal then
last_modal.hide()
end
end, { desc = "Hide last NPM modal output" })
end
-- Tambah user command global untuk show/hide modal
vim.api.nvim_create_user_command("NpmModalShow", function()
if last_modal then
last_modal.show()
end
end, { desc = "Show last NPM modal output" })
vim.api.nvim_create_user_command("NpmModalHide", function()
if last_modal then
last_modal.hide()
end
end, { desc = "Hide last NPM modal output" })
for key, conf in pairs(command_table) do
local start_cmd = conf.start or ("NpmRun" .. key)
local stop_cmd = conf.stop or ("NpmStop" .. key)
local cmd_str = conf.cmd or "npm run dev"
local cache = {}
local function do_start(dir)
if is_running(dir, cache) then
log(cmd_str .. " already running", "INFO")
return
end
local all_output = {}
local modal = modal_manager(opts)
last_modal = modal
M._last_modal = modal
local cmd
if is_windows() then
cmd = { "cmd.exe", "/C" }
for word in cmd_str:gmatch("%S+") do
table.insert(cmd, word)
end
else
cmd = {}
for word in cmd_str:gmatch("%S+") do
table.insert(cmd, word)
end
end
local function process_lines(lines)
if not lines then
return
end
for _, l in ipairs(lines) do
table.insert(all_output, tostring(l))
end
modal.set_content(table.concat(all_output, "\n"))
end
local job_id = vim.fn.jobstart(cmd, {
cwd = dir,
stdout_buffered = false,
stderr_buffered = false,
on_stdout = function(_, data)
process_lines(data)
end,
on_stderr = function(_, data)
process_lines(data)
end,
on_exit = function(_, code)
table.insert(all_output, ("Process exited with code: %d"):format(code))
modal.set_content(table.concat(all_output, "\n"))
cache[dir] = nil
end,
})
cache[dir] = { job_id = job_id, modal = modal }
log(cmd_str .. " started", "INFO")
end
local function do_stop(dir)
local running = is_running(dir, cache)
if running then
local cached_dir = find_cached_dir(dir, cache)
if cached_dir then
local job_entry = cache[cached_dir]
if job_entry then
vim.fn.jobstop(job_entry.job_id)
if job_entry.modal then
job_entry.modal.close()
end
end
cache[cached_dir] = nil
log(cmd_str .. " stopped", "INFO")
end
end
end
local function find_dir(args)
local dir = args ~= "" and args or "%:p:h"
return vim.fn.expand(vim.fn.fnamemodify(vim.fn.expand(dir), ":p"))
end
vim.api.nvim_create_user_command(start_cmd, function(opts)
do_start(find_dir(opts.args))
end, { nargs = "?" })
vim.api.nvim_create_user_command(stop_cmd, function(opts)
do_stop(find_dir(opts.args))
end, { nargs = "?" })
end
end
return M

View file

@ -1,171 +0,0 @@
local function open_new_buffer(name)
local buf = vim.api.nvim_create_buf(true, false)
vim.api.nvim_set_current_buf(buf)
vim.api.nvim_buf_set_option(buf, "modifiable", true)
if name then
vim.api.nvim_buf_set_name(buf, name)
end
return buf
end
local M = {}
local main_cmd = "npm run dev" -- default
local function log(message, level)
vim.notify(string.format("npm-dev-runner: %s", message), vim.log.levels[level])
end
-- Cache: dir -> { job_id=..., buf=... }
local job_cache = {}
local function find_cached_dir(dir)
if not dir then
vim.notify("npm-dev-runner: No directory provided to find_cached_dir()", vim.log.levels.ERROR)
return
end
local cur = dir
while not job_cache[cur] do
if cur == "/" or string.match(cur, "^[A-Z]:\\$") then
return
end
cur = vim.fn.fnamemodify(cur, ":h")
end
return cur
end
local function is_running(dir)
local cached_dir = find_cached_dir(dir)
return cached_dir and job_cache[cached_dir]
end
local function is_windows()
return vim.loop.os_uname().version:match("Windows")
end
M.toggle = function(dir)
local running = is_running(dir)
if not running then
M.start(dir)
return
end
M.stop(dir)
end
--- Fungsi setup menerima argumen command utama, contoh: require("npmrun").setup("pnpm dev")
M.setup = function(cmd)
main_cmd = cmd or "npm run dev"
if not vim.fn.executable(main_cmd:match("%S+")) then
log(main_cmd .. " is not executable. Make sure it is installed and in PATH.", "ERROR")
return
end
local function find_dir(args)
local dir = args ~= "" and args or "%:p:h"
return vim.fn.expand(vim.fn.fnamemodify(vim.fn.expand(dir), ":p"))
end
vim.api.nvim_create_user_command("DevStart", function(opts)
M.start(find_dir(opts.args))
end, { nargs = "?" })
vim.api.nvim_create_user_command("DevStop", function(opts)
M.stop(find_dir(opts.args))
end, { nargs = "?" })
vim.api.nvim_create_user_command("DevToggle", function(opts)
M.toggle(find_dir(opts.args))
end, { nargs = "?" })
end
M.start = function(dir)
if is_running(dir) then
log(main_cmd .. " already running", "INFO")
return
end
local cmd
if is_windows() then
cmd = { "cmd.exe", "/C" }
for word in main_cmd:gmatch("%S+") do
table.insert(cmd, word)
end
else
cmd = {}
for word in main_cmd:gmatch("%S+") do
table.insert(cmd, word)
end
end
local buffer_name = "npmrun.txt"
local output_buf = open_new_buffer(buffer_name)
vim.api.nvim_buf_set_lines(output_buf, 0, -1, false, {})
local function append_to_buffer(lines)
if not lines then
return
end
if not vim.api.nvim_buf_is_valid(output_buf) then
return
end
local filtered = {}
for _, l in ipairs(lines) do
if l ~= "" then
table.insert(filtered, l)
end
end
if #filtered > 0 then
local line_count = vim.api.nvim_buf_line_count(output_buf)
vim.api.nvim_buf_set_lines(output_buf, line_count, line_count, false, filtered)
end
end
local function close_output_buffer()
if output_buf and vim.api.nvim_buf_is_valid(output_buf) then
vim.api.nvim_buf_delete(output_buf, { force = true })
end
end
local job_id = vim.fn.jobstart(cmd, {
cwd = dir,
stdout_buffered = false, -- streaming mode
stderr_buffered = false,
on_stdout = function(_, data)
append_to_buffer(data)
end,
on_stderr = function(_, data)
append_to_buffer(vim.tbl_map(function(l)
return "[ERR] " .. l
end, data))
end,
on_exit = function(_, code)
append_to_buffer({ string.format(main_cmd .. " exited with code %d", code) })
close_output_buffer()
job_cache[dir] = nil
end,
})
job_cache[dir] = { job_id = job_id, buf = output_buf }
log(main_cmd .. " started", "INFO")
end
M.stop = function(dir)
local running = is_running(dir)
if running then
local cached_dir = find_cached_dir(dir)
if cached_dir then
local job_entry = job_cache[cached_dir]
if job_entry then
vim.fn.jobstop(job_entry.job_id)
if job_entry.buf and vim.api.nvim_buf_is_valid(job_entry.buf) then
vim.api.nvim_buf_delete(job_entry.buf, { force = true })
end
end
job_cache[cached_dir] = nil
log(main_cmd .. " stopped", "INFO")
end
end
end
return M

View file

@ -1,174 +0,0 @@
local function show_modal(text)
local buf = vim.api.nvim_create_buf(false, true) -- buffer untuk modal
vim.api.nvim_buf_set_lines(buf, 0, -1, false, { text, "", "Press q to close" })
local width = 50
local height = 5
local row = math.floor((vim.o.lines - height) / 2)
local col = math.floor((vim.o.columns - width) / 2)
local win = vim.api.nvim_open_win(buf, true, {
relative = "editor",
width = width,
height = height,
row = row,
col = col,
style = "minimal",
border = "rounded",
})
-- keymap untuk menutup modal dengan 'q'
vim.api.nvim_buf_set_keymap(buf, "n", "q", "", {
noremap = true,
silent = true,
callback = function()
vim.api.nvim_win_close(win, true)
end,
})
end
local M = {}
local main_cmd = "npm run dev" -- default
local function log(message, level)
vim.notify(string.format("npm-dev-runner: %s", message), vim.log.levels[level])
end
-- Cache: dir -> { job_id=..., buf=... }
local job_cache = {}
local function find_cached_dir(dir)
if not dir then
vim.notify("npm-dev-runner: No directory provided to find_cached_dir()", vim.log.levels.ERROR)
return
end
local cur = dir
while not job_cache[cur] do
if cur == "/" or string.match(cur, "^[A-Z]:\\$") then
return
end
cur = vim.fn.fnamemodify(cur, ":h")
end
return cur
end
local function is_running(dir)
local cached_dir = find_cached_dir(dir)
return cached_dir and job_cache[cached_dir]
end
local function is_windows()
return vim.loop.os_uname().version:match("Windows")
end
M.toggle = function(dir)
local running = is_running(dir)
if not running then
M.start(dir)
return
end
M.stop(dir)
end
--- Fungsi setup menerima argumen command utama, contoh: require("npmrun").setup("pnpm dev")
M.setup = function(cmd)
main_cmd = cmd or "npm run dev"
if not vim.fn.executable(main_cmd:match("%S+")) then
log(main_cmd .. " is not executable. Make sure it is installed and in PATH.", "ERROR")
return
end
local function find_dir(args)
local dir = args ~= "" and args or "%:p:h"
return vim.fn.expand(vim.fn.fnamemodify(vim.fn.expand(dir), ":p"))
end
vim.api.nvim_create_user_command("DevStart", function(opts)
M.start(find_dir(opts.args))
end, { nargs = "?" })
vim.api.nvim_create_user_command("DevStop", function(opts)
M.stop(find_dir(opts.args))
end, { nargs = "?" })
vim.api.nvim_create_user_command("DevToggle", function(opts)
M.toggle(find_dir(opts.args))
end, { nargs = "?" })
end
M.start = function(dir)
if is_running(dir) then
log(main_cmd .. " already running", "INFO")
return
end
local cmd
if is_windows() then
cmd = { "cmd.exe", "/C" }
for word in main_cmd:gmatch("%S+") do
table.insert(cmd, word)
end
else
cmd = {}
for word in main_cmd:gmatch("%S+") do
table.insert(cmd, word)
end
end
local function append_to_buffer(lines)
if not lines then
return
end
for _, line in ipairs(lines) do
if line ~= "" then
line = tostring(line)
line = line:gsub("^%s*(.-)%s*$", "%1")
if string.find(line, "http") then
show_modal(line)
break
end
end
end
end
local job_id = vim.fn.jobstart(cmd, {
cwd = dir,
stdout_buffered = false, -- streaming mode
stderr_buffered = false,
on_stdout = function(_, data)
append_to_buffer(data)
end,
on_stderr = function(_, data)
append_to_buffer(vim.tbl_map(function(l)
return "[ERR] " .. l
end, data))
end,
on_exit = function(_, _)
job_cache[dir] = nil
end,
})
job_cache[dir] = { job_id = job_id }
log(main_cmd .. " started", "INFO")
end
M.stop = function(dir)
local running = is_running(dir)
if running then
local cached_dir = find_cached_dir(dir)
if cached_dir then
local job_entry = job_cache[cached_dir]
if job_entry then
vim.fn.jobstop(job_entry.job_id)
end
job_cache[cached_dir] = nil
log(main_cmd .. " stopped", "INFO")
end
end
end
return M

View file

@ -1,158 +0,0 @@
local function show_modal(text)
local buf = vim.api.nvim_create_buf(false, true)
vim.api.nvim_buf_set_lines(buf, 0, -1, false, { text, "", "Press q to close" })
local width = 50
local height = 5
local row = math.floor((vim.o.lines - height) / 2)
local col = math.floor((vim.o.columns - width) / 2)
local win = vim.api.nvim_open_win(buf, true, {
relative = "editor",
width = width,
height = height,
row = row,
col = col,
style = "minimal",
border = "rounded",
})
vim.api.nvim_buf_set_keymap(buf, "n", "q", "", {
noremap = true,
silent = true,
callback = function()
vim.api.nvim_win_close(win, true)
end,
})
end
local M = {}
local function log(message, level)
vim.notify(string.format("npm-dev-runner: %s", message), vim.log.levels[level])
end
-- Fungsi untuk mencari cache dir (supaya stop/start tetap per dir/project)
local function find_cached_dir(dir, cache)
if not dir then
vim.notify("npm-dev-runner: No directory provided to find_cached_dir()", vim.log.levels.ERROR)
return
end
local cur = dir
while not cache[cur] do
if cur == "/" or string.match(cur, "^[A-Z]:\\$") then
return
end
cur = vim.fn.fnamemodify(cur, ":h")
end
return cur
end
-- Fungsi cek proses running
local function is_running(dir, cache)
local cached_dir = find_cached_dir(dir, cache)
return cached_dir and cache[cached_dir]
end
local function is_windows()
return vim.loop.os_uname().version:match("Windows")
end
M.setup = function(command_table)
command_table = command_table or {}
for key, conf in pairs(command_table) do
local start_cmd = conf.start or ("NpmRun" .. key)
local stop_cmd = conf.stop or ("NpmStop" .. key)
local cmd_str = conf.cmd or "npm run dev"
-- cache khusus untuk mode ini
local cache = {}
-- Fungsi Start
local function do_start(dir)
if is_running(dir, cache) then
log(cmd_str .. " already running", "INFO")
return
end
local cmd
if is_windows() then
cmd = { "cmd.exe", "/C" }
for word in cmd_str:gmatch("%S+") do
table.insert(cmd, word)
end
else
cmd = {}
for word in cmd_str:gmatch("%S+") do
table.insert(cmd, word)
end
end
local function process_lines(lines)
if not lines then
return
end
for _, line in ipairs(lines) do
if line ~= "" then
local str = tostring(line):gsub("^%s*(.-)%s*$", "%1")
if string.find(str, "http") then
show_modal(str)
end
end
end
end
local job_id = vim.fn.jobstart(cmd, {
cwd = dir,
stdout_buffered = false,
stderr_buffered = false,
on_stdout = function(_, data)
process_lines(data)
end,
on_stderr = function(_, data)
process_lines(vim.tbl_map(function(l)
return "[ERR] " .. l
end, data))
end,
on_exit = function(_, _)
cache[dir] = nil
end,
})
cache[dir] = { job_id = job_id }
log(cmd_str .. " started", "INFO")
end
-- Fungsi Stop
local function do_stop(dir)
local running = is_running(dir, cache)
if running then
local cached_dir = find_cached_dir(dir, cache)
if cached_dir then
local job_entry = cache[cached_dir]
if job_entry then
vim.fn.jobstop(job_entry.job_id)
end
cache[cached_dir] = nil
log(cmd_str .. " stopped", "INFO")
end
end
end
local function find_dir(args)
local dir = args ~= "" and args or "%:p:h"
return vim.fn.expand(vim.fn.fnamemodify(vim.fn.expand(dir), ":p"))
end
-- Register Perintah
vim.api.nvim_create_user_command(start_cmd, function(opts)
do_start(find_dir(opts.args))
end, { nargs = "?" })
vim.api.nvim_create_user_command(stop_cmd, function(opts)
do_stop(find_dir(opts.args))
end, { nargs = "?" })
end
end
return M

View file

@ -61,7 +61,7 @@ vim.loader.enable()
-- Disable statusline in dashboard -- Disable statusline in dashboard
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = { "dbout", "dbui", "http", "httpResult", "checkhealth", "qf", "help", "lazy" }, pattern = { "dbout", "dbui", "http", "httpResult" },
callback = function() callback = function()
local opt = vim.opt local opt = vim.opt
opt.number = false -- Print line number opt.number = false -- Print line number