Compare commits

..

No commits in common. "main" and "v1.0.411" have entirely different histories.

428 changed files with 88579 additions and 10343 deletions

1
.gitignore vendored
View file

@ -1 +0,0 @@
db_ui

View file

@ -1,6 +0,0 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferDouble"
# no_call_parentheses = true

387
README.md
View file

@ -1,268 +1,187 @@
<div align="center">
# Nvim-Lazy
![Neovim](https://img.shields.io/badge/NeoVim-%2358A143.svg?&style=for-the-badge&logo=neovim&logoColor=white)
![Lua](https://img.shields.io/badge/lua-%233C2D72.svg?style=for-the-badge&logo=lua&logoColor=white)
<p align="center">
<a href="https://github.com/pojokcodeid/nvim-lazy/pulse">
<img src="https://img.shields.io/github/last-commit/pojokcodeid/nvim-lazy?style=for-the-badge&logo=github&color=8dc4e4&logoColor=D9E0EE&labelColor=302D41"/>
</a>
<a href="https://github.com/pojokcodeid/nvim-lazy/latest">
<img src="https://img.shields.io/github/v/release/pojokcodeid/nvim-lazy?style=for-the-badge&logo=gitbook&color=9bd5ca&logoColor=D9E0EE&labelColor=302D41"/>
</a>
<a href="https://github.com/pojokcodeid/nvim-lazy/stargazers">
<img src="https://img.shields.io/github/stars/pojokcodeid/nvim-lazy?style=for-the-badge&logo=apachespark&color=eed50f&logoColor=D9E0EE&labelColor=302D41"/>
</a>
<a href="https://github.com/pojokcodeid/nvim-lazy/blob/main/LICENSE"><img src="https://img.shields.io/github/license/pojokcodeid/nvim-lazy?color=%2362afef&style=for-the-badge"></a>
<a href="https://github.com/pojokcodeid/nvim-lazy/issues">
<img
alt="Issues"
src="https://img.shields.io/github/issues-raw/pojokcodeid/nvim-lazy?colorA=364A4f&colorB=F5A97F&logo=github&logoColor=D9E0EE&style=for-the-badge">
</a>
</a>
<a href="https://github.com/pojokcodeid/nvim-lazy">
<img alt="Repo Size" src="https://img.shields.io/github/repo-size/pojokcodeid/nvim-lazy?color=%24DDB6F2&label=SIZE&logo=codesandbox&style=for-the-badge&logoColor=D9E0EE&labelColor=302D41" />
</a>
<a href="https://twitter.com/intent/follow?screen_name=pojokcodeid_">
<img alt="follow on Twitter" src="https://img.shields.io/twitter/follow/pojokcodeid_?style=for-the-badge&logo=twitter&color=9aadf3&logoColor=D9E0EE&labelColor=302D41" />
</a>
</p>
</div>
# nvim-lazy
## HOME
![home!](img/home.png)
## Transparant
![home!](img/transparant.png)
## Demo
![demo!](img/demo.gif)
## Treesitter dan LSP
![demo!](img/ts_lsp.gif)
## Plugins Manager
![PlugManaget!](img/plugins_manager.png)
## Javascript Project
## PHP
![PlugManaget!](img/node.png)
![LARAVEL!](img/laravel.jpeg)
<!-- ## Layout -->
## JAVA
<!-- ![PlugManaget!](img/coding.png) -->
![JAVA!](img/Spring_boot_code.jpeg)
# NeoVim Install & Configuration Guide
# Panduan Install Dan Konfigurasi NeoVim
## Visit <a href="https://github.com/pojokcodeid/nvim-lazy/wiki/">Wiki</a>
## Kebutuhan Dasar
## Basic Requirement
1. Install Neovim 8.0+ https://github.com/neovim/neovim/releases/tag/v0.8.2
2. C++ (windows) Compiler https://www.msys2.org/
3. GIT https://git-scm.com/download/win
4. NodeJs https://nodejs.org/en/
5. Ripgrep https://github.com/BurntSushi/ripgrep
6. Lazygit https://github.com/jesseduffield/lazygit
7. Nerd Font https://github.com/ryanoasis/nerd-fonts
8. Windows Terminal (Windows) https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701?hl=en-id&gl=id
9. Powershell (windows) https://apps.microsoft.com/store/detail/powershell/9MZ1SNWT0N5D?hl=en-id&gl=id
2. Install Neovim 0.95+ https://github.com/neovim/neovim/releases/tag/stable
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
## Panduan Windows
# Windows
- Pastikan sudah menginstall kebutuhan dasar diatas
- Jalankan Script Dibawah pada Powershell
```
git clone https://github.com/pojokcodeid/neovim-starter.git "$env:LOCALAPPDATA\nvim"
git clone https://github.com/pojokcodeid/nvim-lazy-basic.git "$env:LOCALAPPDATA\nvim"
nvim
```
# Linux
## Panduan Linux (Debian Based)
```bash
git clone https://github.com/pojokcodeid/neovim-starter.git ~/.config/nvim
1. Pastikan Acess Administrator
```
visudo
[nama user] ALL=(ALL:ALL) ALL
[nama user] ALL=(ALL) NOPASSWD:ALL
```
# Uninstall
2. Install Neovim
```bash
# 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
# Windows PowerShell
rm -Force ~\AppData\Local\nvim
rm -Force ~\AppData\Local\nvim-data
sudo apt-get install wget
mkdir download
cd download
wget https://github.com/neovim/neovim/releases/download/v0.8.1/nvim-linux64.deb
sudo apt-get install ./nvim-linux64.deb
nvim --version
```
# Shortcut Most-Used
3. Check G++
<table>
<tr>
<td>:q or :quit</td>
<td>exit the form</td>
</tr>
<tr>
<td>:w or :write</td>
<td>write the typing result into a file (save)</td>
</tr>
<tr>
<td>:wq</td>
<td>save and exit</td>
</tr>
<tr>
<td>:q!</td>
<td>Exit and do not save</td>
</tr>
<tr>
<td>escape</td>
<td>normal mode</td>
</tr>
<tr>
<td>i</td>
<td>insert mode</td>
</tr>
<tr>
<td>v</td>
<td>visual mode, must be in normal mode first</td>
</tr>
<tr>
<td>h</td>
<td>left</td>
</tr>
<tr>
<td>j</td>
<td>down</td>
</tr>
<tr>
<td>k</td>
<td>up</td>
</tr>
<tr>
<td>l</td>
<td>right</td>
</tr>
<tr>
<td>:ter</td>
<td>open the terminal</td>
</tr>
<tr>
<td>0 or home</td>
<td>move the cursor to the beginning of the line</td>
</tr>
<tr>
<td>$ or end</td>
<td>move the cursor to the end of the line</td>
</tr>
<tr>
<td>gg</td>
<td>move the cursor to the top</td>
</tr>
<tr>
<td>G</td>
<td>move the cursor to the end of the page</td>
</tr>
<tr>
<td>w</td>
<td>move the cursor to the next word with out spaces</td>
</tr>
<tr>
<td>3w</td>
<td>move the cursor to the next 3 words</td>
</tr>
<tr>
<td>b</td>
<td>move the cursor to the previous word</td>
</tr>
<tr>
<td>3b</td>
<td>move the cursor to the previous 3 words</td>
</tr>
<tr>
<td>(</td>
<td>move the cursor to the previous paragraph</td>
</tr>
<tr>
<td>)</td>
<td>move the cursor to the next paragraph</td>
</tr>
<tr>
<td>dd</td>
<td>delete text 1 line</td>
</tr>
<tr>
<td>d$</td>
<td>delete words until the end of the line from the cursor position</td>
</tr>
<tr>
<td>d0</td>
<td>
delete words until the beginning of the line from the cursor position
</td>
</tr>
<tr>
<td>U</td>
<td>to undo</td>
</tr>
<tr>
<td>CTRL + r</td>
<td>Rendo</td>
</tr>
<tr>
<td>Yp</td>
<td>duplicate line code</td>
</tr>
<tr>
<td>yyp</td>
<td>same duplicate line code</td>
</tr>
<tr>
<td>:m+1</td>
<td>move 1 line down</td>
</tr>
<tr>
<td>:m-1</td>
<td>move 1 line up</td>
</tr>
<tr>
<td>d</td>
<td>delete code that is selected with view mode</td>
</tr>
<tr>
<td>:e newfolder/newfile.ext</td>
<td>create a new file in a new folder</td>
</tr>
<tr>
<td>:f newfolder/newfile.ext</td>
<td>to copy the file from the open file</td>
</tr>
<tr>
<td>bdw</td>
<td>delete 1 word</td>
</tr>
<tr>
<td>dw</td>
<td>delete to the right in 1 word at the cursor position</td>
</tr>
</table>
```bash
g++ --version
```
## Thanks To
4. Install NodeJS
```bash
sudo apt-get install curl
sudo apt install build-essential libssl-dev
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.bashrc
nvm install 18.13.0
node --version
npm --version
```
5. Install unzip, ripgrep
```bash
sudo apt-get install unzip
sudo apt-get install ripgrep
```
6. Install lazygit
```bash
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v*([^"]+)".*/\1/')
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
sudo tar xf lazygit.tar.gz -C /usr/local/bin lazygit
lazygit --version
```
7. Install Git
```bash
sudo apt-get install git
git --version
```
8. Clone Config
```bash
git clone https://github.com/pojokcodeid/nvim-lazy-basic.git ~/.config/nvim
```
## Setting LSP dan Treesitter
### Config LSP - Cari file nvim/lua/user/lsp/mason.lua
- Jalankan dengan commond mode
```
:MasonInstall html-lsp css-lsp typescript-language-server
```
- Rujukan Lnguage Support <br>
https://github.com/williamboman/mason.nvim/blob/main/PACKAGES.md
### Comfig Treesitter Cari file nvim/lua/user/treesitter.lua
- Jalankan Code Berikut pada command
```lua
:TSInstall html css javascript ..... dst
```
- Rujukan Language Support <br>
https://github.com/nvim-treesitter/nvim-treesitter#supported-languages
## Ubah Dashboard
### Cari File nvim/lua/custom/dashboard_example.lua , ubah nama file menjadi dashboard.lua
- Edit Bagian ini
```lua
M.dashboard = {
[[ __ ]],
[[ ___ ___ ___ __ __ /\_\ ___ ___ ]],
[[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]],
[[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
[[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]],
[[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]],
}
```
- Link Generate Dasboard
https://patorjk.com/software/taag/
## Seting Bahasa Pemprograman
- https://youtube.com/playlist?list=PLhzwHCJWMbnvhPy0wqZGVBRUEAgS93iuk
## List Plugins
- <a href="https://github.com/folke/lazy.nvim">Lazy </a>
- <a href="https://github.com/nvim-lua/plenary.nvim">Plenary </a>
- <a href="https://github.com/windwp/nvim-autopairs">Nvim-Autopairs </a>
- <a href="https://github.com/numToStr/Comment.nvim">Comment.nvim</a>
- <a href="https://github.com/JoosepAlviste/nvim-ts-context-commentstring">nvim-ts-context-commentstring</a>
- <a href="https://github.com/nvim-tree/nvim-web-devicons">nvim-web-devicons</a>
- <a href="https://github.com/nvim-tree/nvim-tree.lua">nvim-tree.lua</a>
- <a href="https://github.com/akinsho/bufferline.nvim">bufferline.nvim</a>
- <a href="https://github.com/moll/vim-bbye">vim-bbye</a>
- <a href="https://github.com/akinsho/toggleterm.nvim">toggleterm.nvim</a>
- <a href="https://github.com/lewis6991/impatient.nvim">impatient.nvim</a>
- <a href="https://github.com/lukas-reineke/indent-blankline.nvim">indent-blankline.nvim</a>
- <a href="https://github.com/goolord/alpha-nvim">alpha-nvim</a>
- <a href="https://github.com/folke/which-key.nvim">which-key.nvim</a>
- <a href="https://github.com/folke/tokyonight.nvim">tokyonight.nvim</a>
- <a href="https://github.com/hrsh7th/nvim-cmp">nvim-cmp</a>
- <a href="https://github.com/hrsh7th/cmp-buffer">cmp-buffer</a>
## key lazygit
<a href="https://github.com/jesseduffield/lazygit/blob/master/docs/keybindings/Keybindings_en.md?fbclid=IwAR3BogewbYeP0PbPY1pewCkq2c3PKua3eHi-00rHpdSdz9gSKrY71Pv10u4" target="_blank">Key Lazygit</a>
## Terima Kasih
https://github.com/LunarVim/Neovim-from-scratch <br>
https://github.com/AstroNvim/AstroNvim

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,014 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 MiB

View file

@ -1,14 +1 @@
if vim.g.vscode then
-- config vscode
Map = vim.keymap.set
Cmd = vim.cmd
VSCodeNotify = vim.fn.VSCodeNotify
VSCodeCall = vim.fn.VSCodeCall
require("_vscode.functions")
require("_vscode.mappings")
else
-- config neovim
require("pcode.core")
end
require("core")

View file

@ -1,58 +1,58 @@
{
"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": "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" }
}
"Comment.nvim": { "branch": "master", "commit": "d9cfae1059b62f7eacc09dba181efe4894e3b086" },
"LuaSnip": { "branch": "master", "commit": "500981ff6cefc7343e3959ef0f939bd0bfd49ba9" },
"alpha-nvim": { "branch": "main", "commit": "b3eef69e95674905bf26c7740dd4bbb09b355494" },
"bufdelete.nvim": { "branch": "master", "commit": "8933abc09df6c381d47dc271b1ee5d266541448e" },
"bufferline.nvim": { "branch": "main", "commit": "f4af7e5ad68fca928753f280515646803252611d" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
"cmp-nvim-lua": { "branch": "main", "commit": "f3491638d123cfd2c8048aefaf66d246ff250ca6" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"code_runner.nvim": { "branch": "main", "commit": "a010649236fe245eaab2641a13228cd601499715" },
"dressing.nvim": { "branch": "master", "commit": "db716a0f1279f79a886c0e0b6ab3c3d5ffdb42fe" },
"fidget.nvim": { "branch": "main", "commit": "688b4fec4517650e29c3e63cfbb6e498b3112ba1" },
"friendly-snippets": { "branch": "main", "commit": "6fa50a94ba5378bb73013a6e163376d8e69bd8a5" },
"gitsigns.nvim": { "branch": "main", "commit": "bb808fc7376ed7bac0fbe8f47b83d4bf01738167" },
"gruvbox-baby": { "branch": "main", "commit": "ea71b4225d0140103d99748ca4a33ecf22c03f62" },
"impatient.nvim": { "branch": "main", "commit": "969f2c5c90457612c09cf2a13fee1adaa986d350" },
"indent-blankline.nvim": { "branch": "master", "commit": "018bd04d80c9a73d399c1061fa0c3b14a7614399" },
"jaq-nvim": { "branch": "master", "commit": "236296aae555657487d1bb4d066cbde9d79d8cd4" },
"lazy.nvim": { "branch": "main", "commit": "f2cc9ef6acc7367c001b7507c82cab3ab7c29cae" },
"live-server": { "branch": "main", "commit": "ecd7c1418823b65dd2bca710587c80afe42c973e" },
"lualine.nvim": { "branch": "master", "commit": "e99d733e0213ceb8f548ae6551b04ae32e590c80" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "93e58e100f37ef4fb0f897deeed20599dae9d128" },
"mason-null-ls.nvim": { "branch": "main", "commit": "29ce60f9a16fef3de682a9365ef635f24ae92bf9" },
"mason.nvim": { "branch": "main", "commit": "718966fd3204bd1e4aa5af0a032ce1e916295ecd" },
"mini.indentscope": { "branch": "main", "commit": "d3e907b13298b0fc60db289fb804be7e9c561922" },
"neoscroll.nvim": { "branch": "master", "commit": "d7601c26c8a183fa8994ed339e70c2d841253e93" },
"null-ls.nvim": { "branch": "main", "commit": "a82aa08c0063843926947f3688b0e61fd71db680" },
"nvim-autopairs": { "branch": "master", "commit": "4fc96c8f3df89b6d23e5092d31c866c53a346347" },
"nvim-cmp": { "branch": "main", "commit": "8202df9561b90102b41dbc1ad71945534ef4ea39" },
"nvim-colorizer.lua": { "branch": "master", "commit": "760e27df4dd966607e8fb7fd8b6b93e3c7d2e193" },
"nvim-lsp-installer": { "branch": "main", "commit": "17e0bfa5f2c8854d1636fcd036dc8284db136baa" },
"nvim-lspconfig": { "branch": "master", "commit": "255e07ce2a05627d482d2de77308bba51b90470c" },
"nvim-navic": { "branch": "master", "commit": "7e9d2b2b601149fecdccd11b516acb721e571fe6" },
"nvim-notify": { "branch": "master", "commit": "bdd647f61a05c9b8a57c83b78341a0690e9c29d7" },
"nvim-scrollview": { "branch": "main", "commit": "ba6c48bf7919dd48a371e7b9c683b8858053e885" },
"nvim-tree.lua": { "branch": "master", "commit": "66c15afd13da5f86de52b82f38cd9d3f418d0dc3" },
"nvim-treesitter": { "branch": "master", "commit": "ad9ae9e7def54fee446c3e186ed0a0d44cca7b90" },
"nvim-ts-autotag": { "branch": "main", "commit": "fdefe46c6807441460f11f11a167a2baf8e4534b" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "a0f89563ba36b3bacd62cf967b46beb4c2c29e52" },
"nvim-ts-rainbow": { "branch": "master", "commit": "ef95c15a935f97c65a80e48e12fe72d49aacf9b9" },
"nvim-web-devicons": { "branch": "master", "commit": "4709a504d2cd2680fb511675e64ef2790d491d36" },
"plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" },
"smart-splits.nvim": { "branch": "master", "commit": "b38431f1f68bc43d6bf9d1edb21c2bcb06b1197c" },
"symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" },
"telescope.nvim": { "branch": "master", "commit": "f40e3e2304c633411ddf266075f7db5184b1db02" },
"todo-comments.nvim": { "branch": "main", "commit": "077c59586d9d0726b0696dc5680eb863f4e04bc5" },
"toggleterm.nvim": { "branch": "main", "commit": "2a787c426ef00cb3488c11b14f5dcf892bbd0bda" },
"tokyonight.nvim": { "branch": "main", "commit": "a0abe53df53616d13da327636cb0bcac3ea7f5af" },
"vim-bbye": { "branch": "master", "commit": "903f5eb17f72ebf7b0b1524bbb792c0b36761af6" },
"vim-illuminate": { "branch": "master", "commit": "49062ab1dd8fec91833a69f0a1344223dd59d643" },
"vim-startuptime": { "branch": "master", "commit": "5f52ed26e0296a3e1d1453935f417e5808eefab8" },
"vim-visual-multi": { "branch": "master", "commit": "1c9207b28c8898ab01b54e6d6b61b0b820a814bc" },
"which-key.nvim": { "branch": "main", "commit": "5224c261825263f46f6771f1b644cae33cd06995" },
"wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" },
"yanky.nvim": { "branch": "main", "commit": "9fb1c211775b5a6c83b9fe806cfd99f68c65f8a0" }
}

View file

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

View file

@ -1,76 +0,0 @@
-- n = normal mode
-- i = insert mode
-- v = visual mode
-- x = visual block mode
-- t = terminal mode
-- c = command mode
-- o = operator pending mode
Map({ "n", "x" }, "<Space>", Active_whichkey)
Map("", "U", Trim__save__format)
Map("n", "gD", Reveal_definition_aside)
Map("n", "gt", Go_to_implementation)
Map("n", "gq", Go_to_reference)
Map("n", ",r", Rename_symbol)
Map("n", "<<", Outdent)
Map("n", ">>", Indent)
Map("n", "gcc", Comment)
Map("n", "=s", Convert_to_spaces)
Map("n", "=t", Convert_to_tabs)
Map("n", "=d", Indent_with_spaces)
Map("n", "=g", Indent_with_tabs)
Map("n", "K", CloseEditor)
Map("n", ",K", UndoCloseEditor)
Map("n", "zk", Git_stage_file)
Map("n", "zK", Git_unstage_file)
Map("n", "zi", Git_open_changes)
Map("n", "zI", Git_open_all_changes)
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", "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)
Map("v", "<", Outdent_vis)
Map("v", ">", Indent_vis)
Map("v", "gc", Comment_vis)
Map({ "n", "v" }, "zJ", Git_revert_change)
Map({ "n", "v" }, "zj", Git_stage_change)
-- Map({ "n", "v" }, "zt", Vscode_ctrl_d)
-- Map({ "n", "v" }, "zb", Vscode_ctrl_u)
vim.api.nvim_exec(
[[
" THEME CHANGER
function! SetCursorLineNrColorInsert(mode)
" Insert mode: blue
if a:mode == "i"
call VSCodeNotify('nvim-theme.insert')
" Replace mode: red
elseif a:mode == "r"
call VSCodeNotify('nvim-theme.replace')
endif
endfunction
augroup CursorLineNrColorSwap
autocmd!
autocmd ModeChanged *:[vV\x16]* call VSCodeNotify('nvim-theme.visual')
autocmd ModeChanged *:[R]* call VSCodeNotify('nvim-theme.replace')
autocmd InsertEnter * call SetCursorLineNrColorInsert(v:insertmode)
autocmd InsertLeave * call VSCodeNotify('nvim-theme.normal')
autocmd CursorHold * call VSCodeNotify('nvim-theme.normal')
autocmd ModeChanged [vV\x16]*:* call VSCodeNotify('nvim-theme.normal')
augroup END
]],
false
)

View file

@ -1,76 +0,0 @@
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, {})

View file

@ -1,123 +0,0 @@
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, {})

View file

@ -1,289 +0,0 @@
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, {})

View file

@ -1,106 +0,0 @@
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, {})

View file

@ -1,109 +0,0 @@
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, {})

View file

@ -1,115 +0,0 @@
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, {})

View file

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

View file

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

38
lua/config/lazy.lua Normal file
View file

@ -0,0 +1,38 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not 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
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
vim.g.mapleader = " "
vim.g.maplocalleader = " "
require("lazy").setup({
spec = {
{ 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 = { border = "rounded", browser = "chrome", throttle = 40, custom_keys = { ["<localleader>l"] = false } },
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",
},
},
},
})

13
lua/core/init.lua Normal file
View file

@ -0,0 +1,13 @@
require("config.lazy")
-- require("user.options")
-- require("user.keymaps")
-- require("user.autocommands")
-- require("user.format_onsave")
-- require("user.colorscheme")
-- require("user.snip")
-- require("user.bufferline")
-- require("user.chat_gpt")
require("user.options")
require("user.keymaps")
require("user.autocommands")
require("user.format_onsave")

27
lua/custom/dashboard.lua Normal file
View file

@ -0,0 +1,27 @@
local M = {}
-- Untuk Ubah Dashboard
-- 1. Buka remark dash board dibawah
-- 2. Ubah dashboard sesuai keinginan dan kebutuhan
-- M.dashboard1 = {
-- [[ _ __ __ ]],
-- [[ ___ ___ (____ / /__ _______ ___/ ___ ]],
-- [[ / _ / _ \ / / _ \/ '_/ / __/ _ / _ / -_) ]],
-- [[ / .__\_____/ /\___/_/\_\ \__/\___\_,_/\__/ ]],
-- [[ /_/ |___/ ]],
-- }
-- M.dashboard2 = {
-- [[ __ ]],
-- [[ ___ ___ ___ __ __ /\_\ ___ ___ ]],
-- [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]],
-- [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
-- [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]],
-- [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]],
-- }
-- M.footer = "PCode"
M.model = 1 -- isi dengan 1 atau 2 untuk model dashboard
return M

View file

@ -0,0 +1,5 @@
local M = {
disable = 0, -- 0 ( format jalan) 1 (fromat off)
}
return M

View file

@ -0,0 +1,10 @@
-- 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
local m = {
lspinstall = {
"yamlls",
-- tambahkan di bawah sini setelah melakukan :masoninstall
},
}
return m

10
lua/custom/null-ls.lua Normal file
View file

@ -0,0 +1,10 @@
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
},
}
return m

View file

@ -0,0 +1,4 @@
return {
--- masukan plugin tambahan disini
{ "folke/trouble.nvim", enabled = false }, -- ini untuk disable plugin
}

View file

@ -0,0 +1,17 @@
-- untuk referesi support language kunjungi link dibawah
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
local m = {
lspreg = {
"bashls",
"yamlls",
"jdtls",
"intelephense",
"marksman",
"csharp_ls",
"clangd",
"dartls",
"kotlin_language_server",
-- tambahkan di bawah sini setelah melakukan :masoninstall
},
}
return m

View file

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

View file

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

View file

@ -1,9 +0,0 @@
_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" })

View file

@ -1,71 +0,0 @@
if vim.g.neovide then
local opts = { noremap = true, silent = true }
vim.g.neovide_input_use_logo = 1 -- enable use of the logo (cmd) key
vim.keymap.set("n", "<c-s>", ":w<CR>", opts) -- Save
vim.keymap.set("v", "<c-c>", '"+y', opts) -- Copy
vim.keymap.set("n", "<c-v>", '"+P', opts) -- Paste normal mode
vim.keymap.set("v", "<c-v>", '"+P', opts) -- Paste visual mode
vim.keymap.set("x", "<c-v>", '"+P', opts) -- Paste visual mode
vim.keymap.set("c", "<sc-v>", "<C-R>+", { noremap = true }) -- Paste command mode
vim.keymap.set("i", "<c-v>", '<ESC>l"+Pli', opts) -- Paste insert mode
vim.keymap.set(
"n",
"<c-/>",
"<esc><cmd>lua require('Comment.api').toggle.linewise.current()<cr>$i<Right><leader>",
opts
)
vim.keymap.set(
"i",
"<c-/>",
"<esc><cmd>lua require('Comment.api').toggle.linewise.current()<cr>$i<Right><leader>",
opts
)
vim.keymap.set("v", "<c-/>", "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", opts)
vim.o.guifont = "Hasklug_Nerd_Font:h15"
vim.g.neovide_padding_top = 0
vim.g.neovide_padding_bottom = 1
vim.g.neovide_padding_right = 1
vim.g.neovide_padding_left = 1
-- config for transparent
vim.g.neovide_transparency = 1
vim.g.neovide_hide_mouse_when_typing = false
vim.g.neovide_underline_automatic_scaling = false
vim.g.neovide_refresh_rate_idle = 5
vim.g.neovide_no_idle = true
vim.g.neovide_remember_window_size = true
vim.g.neovide_touch_drag_timeout = 0.17
vim.g.neovide_show_border = false
vim.g.neovide_theme = "auto"
vim.g.neovide_confirm_quit = true
vim.g.neovide_remember_window_size = true
vim.g.neovide_cursor_smooth_blink = true
-- animation config
--vim.g.neovide_scroll_animation_length = 0.3
--vim.g.neovide_cursor_animation_length = 0.13
vim.g.neovide_cursor_trail_size = 0.8
vim.g.neovide_cursor_antialiasing = true
vim.g.neovide_cursor_animate_in_insert_mode = true
vim.g.neovide_cursor_vfx_mode = "torpedo"
vim.opt.linespace = 0
vim.g.neovide_scale_factor = 1
vim.opt.cmdheight = 0
vim.opt.spell = false
vim.g.neovide_window_blurred = true
vim.g.neovide_floating_blur_amount_x = 2.0
vim.g.neovide_floating_blur_amount_y = 2.0
vim.g.neovide_floating_shadow = false
vim.g.neovide_floating_z_height = 10
vim.g.neovide_light_angle_degrees = 45
vim.g.neovide_light_radius = 5
end
-- -- Allow clipboard copy paste in neovim
-- vim.g.neovide_input_use_logo = 1
-- 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 })

View file

@ -1,55 +0,0 @@
_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 {}

View file

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

View file

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

View file

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

View file

@ -1,6 +0,0 @@
return {
"windwp/nvim-ts-autotag",
lazy = true,
event = { "BufRead", "InsertEnter" },
opts = {},
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,8 +0,0 @@
return {
"LunarVim/bigfile.nvim",
lazy = true,
event = "BufReadPre",
opts = {
file_size = 2,
},
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +0,0 @@
return {
"rachartier/tiny-devicons-auto-colors.nvim",
event = "VeryLazy",
config = function()
require("tiny-devicons-auto-colors").setup()
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

@ -1,14 +0,0 @@
return {
"j-hui/fidget.nvim",
lazy = true,
tag = "legacy",
event = "BufRead",
config = function()
require("fidget").setup({
window = {
blend = 0,
relative = "editor",
},
})
end,
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,8 +0,0 @@
return {
"karb94/neoscroll.nvim",
event = "VeryLazy",
lazy = true,
config = function()
require("neoscroll").setup({})
end,
}

View file

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

View file

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

View file

@ -1,37 +0,0 @@
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")
vim.g.rainbow_delimiters = {
strategy = {
[""] = rainbow_delimiters.strategy["global"],
vim = rainbow_delimiters.strategy["local"],
},
query = {
[""] = "rainbow-delimiters",
-- lua = "rainbow-blocks",
},
priority = {
[""] = 110,
lua = 210,
},
highlight = {
"RainbowDelimiterRed",
"RainbowDelimiterYellow",
"RainbowDelimiterBlue",
"RainbowDelimiterOrange",
"RainbowDelimiterGreen",
"RainbowDelimiterViolet",
"RainbowDelimiterCyan",
},
blacklist = {
"html",
"tsx",
},
}
end,
}

View file

@ -1,49 +0,0 @@
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 = {},
},
}

View file

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

View file

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

View file

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

View file

@ -1 +0,0 @@
return { "nvzone/showkeys", cmd = "ShowkeysToggle" }

View file

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

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

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

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

View file

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

View file

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

View file

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

View file

@ -1,19 +0,0 @@
return {
"gbprod/yanky.nvim",
event = "BufReadPre",
opts = {
ring = {
history_length = 50,
storage = "memory",
},
preserve_cursor_position = {
enabled = false,
},
},
config = function(_, opts)
require("yanky").setup(opts)
-- cycle through the yank history, only work after paste
vim.keymap.set("n", "[y", "<Plug>(YankyCycleForward)")
vim.keymap.set("n", "]y", "<Plug>(YankyCycleBackward)")
end,
}

View file

@ -1,21 +0,0 @@
return {
"folke/zen-mode.nvim",
event = "VeryLazy",
opts = {
plugins = {
options = {
-- hide statusline
laststatus = 0,
},
},
on_open = function(win)
require("notify")("Zen Mode ON")
end,
on_close = function()
require("notify")("Zen Mode OFF")
end,
},
keys = {
{ "<leader>z", "<cmd>ZenMode<cr>", desc = "󰤼 Toggle Zen Mode" },
},
}

View file

@ -1,66 +0,0 @@
return {
"lewis6991/gitsigns.nvim",
lazy = true,
enabled = vim.fn.executable("git") == 1,
ft = "gitcommit",
event = "BufRead",
opts = {
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "" },
topdelete = { text = "" },
changedelete = { text = "" },
untracked = { text = "" },
},
signcolumn = true,
numhl = false,
linehl = false,
word_diff = false,
watch_gitdir = {
interval = 1000,
follow_files = true,
},
attach_to_untracked = true,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
delay = 1000,
ignore_whitespace = false,
},
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
sign_priority = 6,
status_formatter = nil, -- Use default
update_debounce = 200,
max_file_length = 40000,
preview_config = {
-- Options passed to nvim_open_win
border = "rounded",
style = "minimal",
relative = "cursor",
row = 0,
col = 1,
},
},
config = function(_, opts)
require("gitsigns").setup(opts)
end,
-- stylua: ignore
keys = {
{ "<leader>g", "", desc = "  Git" },
{ "<leader>gg",function()LAZYGIT_TOGGLE()end,desc = "Lazygit"},
{ "<leader>gj",function()require("gitsigns").next_hunk()end,desc = "Next Hunk"},
{ "<leader>gk",function()require("gitsigns").prev_hunk()end,desc = "Prev Hunk"},
{ "<leader>gl",function()require("gitsigns").blame_line()end,desc = "Blame"},
{ "<leader>gp",function()require("gitsigns").preview_hunk()end,desc = "Preview Hunk"},
{ "<leader>gr",function()require("gitsigns").reset_hunk()end,desc = "Reset Hunk"},
{ "<leader>gR",function()require("gitsigns").reset_buffer()end,desc = "Reset Buffer"},
{ "<leader>gs",function()require("gitsigns").stage_hunk()end,desc = "Stage Hunge"},
{ "<leader>gu",function()require("gitsigns").undo_stage_hunk()end,desc = "Undo Stage Hunge"},
{ "<leader>go","<cmd>Telescope git_status<cr>",desc = "Opened Changed File"},
{ "<leader>gb","<cmd>Telescope git_branches<cr>",desc = "Checkout Branch"},
{ "<leader>gc","<cmd>Telescope git_commits<cr>",desc = "Checkout Commit"},
{ "<leader>gd","<cmd>Gitsigns diffthis HEAD<cr>",desc = "Diff"},
},
}

View file

@ -1,39 +0,0 @@
return {
--[[ "lukas-reineke/indent-blankline.nvim",
-- version = "3.5.4",
event = { "BufRead", "InsertEnter", "BufNewFile" },
lazy = true,
opts = {
indent = {
char = "",
tab_char = "",
},
scope = { enabled = false },
exclude = {
buftypes = {
"nofile",
"prompt",
"quickfix",
"terminal",
},
filetypes = {
"help",
"alpha",
"dashboard",
"neo-tree",
"Trouble",
"trouble",
"lazy",
"mason",
"notify",
"toggleterm",
"lazyterm",
"NvimTree",
"aerial",
"neogitstatus",
"startify",
},
},
},
main = "ibl", ]]
}

View file

@ -1,22 +0,0 @@
return {
"shellRaining/hlchunk.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("hlchunk").setup({
chunk = {
enable = true,
-- ...
},
indent = {
enable = true,
-- ...
},
exclude_filetypes = {
aerial = true,
dashboard = true,
alpha = true,
-- some other filetypes
},
})
end,
}

View file

@ -1,29 +0,0 @@
return {
{
"nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "angular", "scss", "typescript" })
end
vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
pattern = { "*.component.html", "*.container.html" },
callback = function()
vim.treesitter.start(nil, "angular")
end,
})
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "angularls", "ts_ls" })
end,
},
{
"williamboman/mason.nvim",
opts = {
ensure_installed = { "prettier" },
},
},
}

View file

@ -1,66 +0,0 @@
return {
{
"nvim-treesitter/nvim-treesitter",
event = "VeryLazy",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "cpp", "c" })
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "clangd" })
end,
},
{
"jay-babu/mason-nvim-dap.nvim",
event = "VeryLazy",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "codelldb" })
end,
},
{
"pojokcodeid/auto-conform.nvim",
event = "VeryLazy",
opts = function(_, opts)
local package = "clang-format"
vim.list_extend(opts.ensure_installed, { package })
opts.formatters_by_ft.cpp = { package }
opts.formatters_by_ft.c = { package }
end,
},
{
"nvim-neotest/neotest",
ft = { "cpp" },
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-neotest/nvim-nio",
"antoinemadec/FixCursorHold.nvim",
"nvim-lua/plenary.nvim",
"alfaix/neotest-gtest",
},
config = function()
require("neotest").setup({
adapters = {
require("neotest-gtest").setup({}),
},
})
end,
-- stylua: ignore
keys = {
{ "<leader>T","",desc="  Test"},
{ "<leader>Tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" },
{ "<leader>Tr", function() require("neotest").run.run() end, desc = "Run Nearest" },
{ "<leader>TT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" },
{ "<leader>Tl", function() require("neotest").run.run_last() end, desc = "Run Last" },
{ "<Leader>Ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" },
{ "<leader>To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" },
{ "<Leader>TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" },
{ "<Leader>TS", function() require("neotest").run.stop() end, desc = "Stop" },
{ "<leader>rc", "<cmd>terminal<cr>g++ --debug main.cpp -o main<cr>", desc = "Compile Debug main.cpp" },
},
},
}

View file

@ -1,149 +0,0 @@
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(
opts.ensure_installed,
{ "html", "javascript", "typescript", "tsx", "css", "json", "jsonc" }
)
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "html", "eslint", "cssls", "emmet_ls", "jsonls", "denols" })
end,
},
{
"pojokcodeid/auto-conform.nvim",
event = "VeryLazy",
opts = function(_, opts)
opts.formatters_by_ft = opts.formatters_by_ft or {}
local package = "prettier"
vim.list_extend(opts.ensure_installed, { package })
opts.formatters_by_ft.javascript = { package }
end,
},
{
"pojokcodeid/auto-lint.nvim",
opts = function(_, opts)
opts.linters_by_ft = opts.linters_by_ft or {}
vim.list_extend(opts.ensure_installed, { "eslint_d" })
opts.linters_by_ft.javascript = { "eslint_d" }
end,
},
{
"rcarriga/nvim-dap-ui",
lazy = true,
event = "BufRead",
dependencies = {
{ "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" }
for _, language in ipairs(js_based_languages) do
require("dap").configurations[language] = {
{
type = "pwa-node",
request = "launch",
name = "Launch file",
runtimeExecutable = "deno",
runtimeArgs = {
"run",
"--inspect-wait",
"--allow-all",
},
program = "${file}",
cwd = "${workspaceFolder}",
attachSimplePort = 9229,
},
}
end
end,
-- stylua: ignor
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" },
{ "<leader>T", "", desc = "  Test" },
{ "<leader>Tr", "<cmd>terminal deno test<cr>", desc = "Run Test" },
{ "<leader>Tp", "<cmd>terminal deno test --parallel<cr>", desc = "Run Parallel" },
{
"<leader>Ts",
function()
vim.cmd("terminal deno test " .. vim.fn.expand("%"))
end,
desc = "Run Current File",
},
{
"<leader>Tu",
function()
-- local current_word = vim.fn.expand("<cword>")
local extracted_text = ""
local input = vim.fn.getline(".")
local contains_double_quotes = input:match('"')
local contains_single_quotes = input:match("'")
if contains_double_quotes then
-- process jika ada double quote
input = input:gsub('"', "'")
local start_index, end_index = input:find("'([^']*)'") -- Mencari teks di dalam tanda petik satu
extracted_text = input:sub(start_index, end_index)
elseif contains_single_quotes then
input = input:gsub('"', "'")
local start_index, end_index = input:find("'([^']*)'") -- Mencari teks di dalam tanda petik satu
extracted_text = input:sub(start_index, end_index)
else
extracted_text = (input:gsub("Deno.test%(function", "")):gsub("%(%) %{", "")
end
vim.cmd("terminal deno test --filter " .. extracted_text)
end,
desc = "Run Under Cursor",
},
},
},
}

View file

@ -1,426 +0,0 @@
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "go", "gomod", "gosum", "gotmpl", "gowork" })
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
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, {})
-- Fungsi untuk membuat proyek Go
local function go_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
local function get_user_input(prompt, default_value)
vim.fn.inputsave()
local result = vim.fn.input(prompt, default_value)
vim.fn.inputrestore()
if result == "" then
create_notif("Input canceled.", "info")
return nil, true
end
return result, false
end
local project_name, canceled = get_user_input("Enter project name: ", "myapp")
if canceled then
return
end
local file_name, canceled = get_user_input("Enter file name (without .go): ", "main")
if canceled then
return
end
local function_name, canceled = get_user_input("Enter function name: ", "main")
if canceled then
return
end
local cwd = vim.fn.getcwd()
local project_path = cwd .. "/" .. project_name
if vim.fn.isdirectory(project_path) == 1 then
create_notif("Project directory already exists: " .. project_path, "error")
return
end
local mkdir_cmd = string.format("mkdir -p '%s'", project_path)
local gomod_cmd = string.format("cd '%s' && go mod init %s", project_path, project_name)
local entry_file = string.format("%s/%s.go", project_path, file_name)
local main_code = string.format(
[[
package main
import "fmt"
func %s() {
fmt.Println("Hello, world!")
}
]],
function_name
)
vim.fn.system(mkdir_cmd)
vim.fn.system(gomod_cmd)
local file = io.open(entry_file, "w")
if file then
file:write(main_code)
file:close()
create_notif("Go project created at " .. project_path, "info")
vim.cmd("cd " .. project_path)
-- Jika ada NvimTreeOpen, jalankan lalu kembalikan fokus ke file
if vim.fn.exists(":NvimTreeOpen") == 2 then
vim.cmd("NvimTreeOpen")
-- Penjadwalan agar kembali ke buffer file Go setelah NvimTree terbuka
vim.schedule(function()
vim.cmd("edit " .. entry_file)
-- Cari baris function
local lines = {}
for line in main_code:gmatch("([^\n]*)\n?") do
table.insert(lines, line)
end
local func_line = 1
for i, line in ipairs(lines) do
if line:find("func%s+" .. function_name .. "%s*%(") then
func_line = i
break
end
end
local target_line = func_line + 1
vim.api.nvim_win_set_cursor(0, { target_line, 4 })
vim.cmd("startinsert")
end)
else
vim.cmd("edit " .. entry_file)
local lines = {}
for line in main_code:gmatch("([^\n]*)\n?") do
table.insert(lines, line)
end
local func_line = 1
for i, line in ipairs(lines) do
if line:find("func%s+" .. function_name .. "%s*%(") then
func_line = i
break
end
end
local target_line = func_line + 1
vim.api.nvim_win_set_cursor(0, { target_line, 4 })
vim.cmd("startinsert")
end
else
create_notif("Failed to create file: " .. entry_file, "error")
end
end
vim.api.nvim_create_user_command("GoNewProject", go_new_project, {})
-- Fungsi untuk membuat file Go
local function go_new_file()
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 get_user_input(prompt, default_value)
vim.fn.inputsave()
local result = vim.fn.input(prompt, default_value)
vim.fn.inputrestore()
if result == "" then
create_notif("Input canceled.", "info")
return nil, true
end
return result, false
end
-- Ambil nama folder
local folder_name, canceled = get_user_input("Enter folder name (dot for current folder): ", ".")
if canceled then
return
end
-- Ambil nama file (tanpa .go)
local file_name, canceled = get_user_input("Enter file name (without .go): ", "newfile")
if canceled then
return
end
-- Ambil nama package
local package_name, canceled = get_user_input("Enter package name: ", "main")
if canceled then
return
end
-- Ambil nama function
local function_name, canceled = get_user_input("Enter function name: ", "main")
if canceled then
return
end
local cwd = vim.fn.getcwd()
local folder_path = (folder_name == "." or folder_name == "") and cwd or cwd .. "/" .. folder_name
-- Cek dan buat folder jika perlu
if vim.fn.isdirectory(folder_path) == 0 then
local mkdir_cmd = string.format("mkdir -p '%s'", folder_path)
vim.fn.system(mkdir_cmd)
end
local file_path = string.format("%s/%s.go", folder_path, file_name)
if vim.fn.filereadable(file_path) == 1 then
create_notif("File already exists: " .. file_path, "error")
return
end
local code = string.format(
[[
package %s
func %s() {
}
]],
package_name,
function_name
)
-- Buat file dan isi konten
local file = io.open(file_path, "w")
if file then
file:write(code)
file:close()
create_notif("Go file created: " .. file_path, "info")
-- Buka file dan tempatkan kursor di bawah function, mode insert
vim.cmd("edit " .. file_path)
local lines = {}
for line in code:gmatch("([^\n]*)\n?") do
table.insert(lines, line)
end
local func_line = 1
for i, line in ipairs(lines) do
if line:find("func%s+" .. function_name .. "%s*%(") then
func_line = i
break
end
end
local target_line = func_line + 1
vim.api.nvim_win_set_cursor(0, { target_line, 4 })
vim.cmd("startinsert")
else
create_notif("Failed to create file: " .. file_path, "error")
end
end
vim.api.nvim_create_user_command("GoNewFile", go_new_file, {})
end,
},
{
"pojokcodeid/auto-conform.nvim",
event = "VeryLazy",
opts = function(_, opts)
local package = "gofumpt"
vim.list_extend(opts.ensure_installed, { package })
opts.formatters_by_ft.gofumpt = { package }
end,
},
{
"pojokcodeid/auto-lint.nvim",
opts = function(_, opts)
opts.linters_by_ft = opts.linters_by_ft or {}
vim.list_extend(opts.ensure_installed, { "golangci-lint" })
opts.linters_by_ft.php = { "golangci-lint" }
end,
},
{
"nvim-neotest/neotest",
event = "VeryLazy",
ft = "go",
dependencies = {
"nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter",
"nvim-neotest/neotest-plenary",
"nvim-neotest/neotest-vim-test",
"nvim-neotest/nvim-nio",
{
"fredrikaverpil/neotest-golang",
dependencies = {
{
"leoluz/nvim-dap-go",
opts = {},
},
},
branch = "main",
},
},
opts = function(_, opts)
opts.adapters = opts.adapters or {}
opts.adapters["neotest-golang"] = {
go_test_args = {
"-v",
"-race",
"-count=1",
"-timeout=60s",
"-coverprofile=" .. vim.fn.getcwd() .. "/coverage.out",
},
dap_go_enabled = true,
}
end,
config = function(_, opts)
if opts.adapters then
local adapters = {}
for name, config in pairs(opts.adapters or {}) do
if type(name) == "number" then
if type(config) == "string" then
config = require(config)
end
adapters[#adapters + 1] = config
elseif config ~= false then
local adapter = require(name)
if type(config) == "table" and not vim.tbl_isempty(config) then
local meta = getmetatable(adapter)
if adapter.setup then
adapter.setup(config)
elseif meta and meta.__call then
adapter(config)
else
error("Adapter " .. name .. " does not support setup")
end
end
adapters[#adapters + 1] = adapter
end
end
opts.adapters = adapters
end
require("neotest").setup(opts)
end,
-- stylua: ignore
keys = {
{ "<leader>T","",desc="  Test"},
{ "<leader>Ta", function() require("neotest").run.attach() end, desc = "[t]est [a]ttach" },
{ "<leader>Tf", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "[t]est run [f]ile" },
{ "<leader>TA", function() require("neotest").run.run(vim.uv.cwd()) end, desc = "[t]est [A]ll files" },
{ "<leader>TS", function() require("neotest").run.run({ suite = true }) end, desc = "[t]est [S]uite" },
{ "<leader>Tn", function() require("neotest").run.run() end, desc = "[t]est [n]earest" },
{ "<leader>Tl", function() require("neotest").run.run_last() end, desc = "[t]est [l]ast" },
{ "<leader>Ts", function() require("neotest").summary.toggle() end, desc = "[t]est [s]ummary" },
{ "<leader>To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "[t]est [o]utput" },
{ "<leader>TO", function() require("neotest").output_panel.toggle() end, desc = "[t]est [O]utput panel" },
{ "<leader>Tt", function() require("neotest").run.stop() end, desc = "[t]est [t]erminate" },
{ "<leader>Td", function() require("neotest").run.run({ suite = false, strategy = "dap" }) end, desc = "Debug nearest test" },
},
},
{
"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" },
config = function()
require("mason-nvim-dap").setup({
automatic_installation = true,
automatic_setup = true,
handlers = {},
ensure_installed = { "delve" },
})
end,
},
}

View file

@ -1,111 +0,0 @@
local M = {}
M = {
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.skip_config = opts.skip_config or {}
vim.list_extend(opts.skip_config, { "jdtls" })
end,
},
{
"pojokcodeid/auto-java-project.nvim",
event = "VeryLazy",
config = function()
require("auto-java-project").setup()
vim.keymap.set("n", "<leader>Jc", ":CreateJavaClass<cr>", { desc = "Create Java Class" })
vim.keymap.set("n", "<leader>Jm", ":CreateJavaMainClass<cr>", { desc = "Create Java Main Class" })
vim.keymap.set("n", "<leader>Ji", ":CreateJavaInterface<cr>", { desc = "Create Java Interface" })
end,
},
{
"mfussenegger/nvim-jdtls",
dependencies = { "pojokcodeid/auto-jdtls.nvim" },
ft = { "java" },
-- your opts go here
opts = {},
config = function(_, opts)
require("auto-jdtls").setup(opts)
require("auto-jdtls.utils").lsp_keymaps()
require("auto-jdtls.utils").jdtls_keymaps()
vim.keymap.set("n", "<leader>rM", ":RunMvnSpringBoot<CR>", { desc = "Run Maven Sping Boot" })
vim.keymap.set("n", "<leader>rG", ":RunGradleSpringBoot<CR>", { desc = "Run Gradle Sping Boot" })
vim.keymap.set("n", "<leader>rm", ":RunMaven<CR>", { desc = "Run Maven Project" })
vim.keymap.set("n", "<leader>rg", ":RunGradle<CR>", { desc = "Run Gradle Project" })
end,
},
{
"nvim-neotest/neotest",
dependencies = {
"nvim-neotest/nvim-nio",
"nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter",
"andy-bell101/neotest-java",
},
-- enabled = vim.fn.findfile("build.gradle", vim.fn.getcwd()) == "build.gradle" or false,
config = function()
require("auto-jdtls.create_maven_project")
require("neotest").setup({
adapters = {
require("neotest-java"),
},
})
end,
-- stylua: ignore
keys = {
{ "<leader>T","",desc="  Test"},
{ "<leader>Tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" },
{ "<leader>Tr", function() require("neotest").run.run() end, desc = "Run Nearest" },
{ "<leader>TT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" },
{ "<leader>Tl", function() require("neotest").run.run_last() end, desc = "Run Last" },
{ "<Leader>Ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" },
{ "<leader>To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" },
{ "<Leader>TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" },
{ "<Leader>TS", function() require("neotest").run.stop() end, desc = "Stop" },
},
},
{
"rockerBOO/symbols-outline.nvim",
cmd = "SymbolsOutline",
config = function()
local icons = require("pcode.user.icons").kind
require("symbols-outline").setup({
symbols = {
File = { icon = icons.File, hl = "@text.uri" },
Module = { icon = icons.Module, hl = "@namespace" },
Namespace = { icon = icons.Namespace, hl = "@namespace" },
Package = { icon = icons.Package, hl = "@namespace" },
Class = { icon = icons.Class, hl = "@type" },
Method = { icon = icons.Method, hl = "@method" },
Property = { icon = icons.Property, hl = "@method" },
Field = { icon = icons.Field, hl = "@field" },
Constructor = { icon = icons.Constructor, hl = "@constructor" },
Enum = { icon = icons.Enum, hl = "@type" },
Interface = { icon = icons.Interface, hl = "@type" },
Function = { icon = icons.Function, hl = "@function" },
Variable = { icon = icons.Variable, hl = "@constant" },
Constant = { icon = icons.Constant, hl = "@constant" },
String = { icon = icons.String, hl = "@string" },
Number = { icon = icons.Number, hl = "@number" },
Boolean = { icon = icons.Boolean, hl = "@boolean" },
Array = { icon = icons.Array, hl = "@constant" },
Object = { icon = icons.Object, hl = "@type" },
Key = { icon = icons.Key, hl = "@type" },
Null = { icon = icons.Null, hl = "@type" },
EnumMember = { icon = icons.EnumMember, hl = "@field" },
Struct = { icon = icons.Struct, hl = "@type" },
Event = { icon = icons.Event, hl = "@type" },
Operator = { icon = icons.Operator, hl = "@operator" },
TypeParameter = { icon = icons.TypeParameter, hl = "@parameter" },
Component = { icon = icons.Component, hl = "@function" },
Fragment = { icon = icons.Fragment, hl = "@constant" },
},
})
end,
keys = {
{ "<leader>Js", "<cmd>SymbolsOutline<cr>", desc = "Toggle Outline" },
},
},
}
return M

View file

@ -1,47 +0,0 @@
return {
"nvim-java/nvim-java",
-- event = "VeryLazy",
ft = { "java" },
dependencies = {
"MunifTanjim/nui.nvim",
"neovim/nvim-lspconfig",
"mfussenegger/nvim-dap",
"williamboman/mason.nvim",
},
config = function()
require("java").setup({
notifications = {
dap = false,
},
jdk = {
auto_install = false,
},
})
require("lspconfig").jdtls.setup({
settings = {
java = {
configuration = {
runtimes = {
{
name = "JavaSE-17",
path = os.getenv("JAVA_HOME") or "",
default = true,
},
},
},
},
},
})
end,
keys = {
{ "<leader>rg", "", desc = "Gradle" },
{ "<leader>rgp", "<cmd>JavaProfile<cr>", desc = "Java Profile" },
{ "<leader>rgg", "<cmd>terminal<cr>gradle run<cr>", desc = "Run Gradle" },
{ "<leader>rgb", "<cmd>JavaBuildBuildWorkspace<cr>", desc = "Java Build Workspace" },
{ "<leader>rgd", "<cmd>JavaDapConfig<cr>", desc = "Java Configure DAP" },
{ "<leader>T", "", desc = "Test" },
{ "<leader>Tc", "<cmd>JavaTestRunCurrentClass<cr>", desc = "Test Current Class" },
{ "<leader>Tm", "<cmd>JavaTestRunCurrentMethod<cr>", desc = "Test Current Method" },
{ "<leader>Th", "<cmd>JavaTestViewLastReport<cr>", desc = "View Test Last Report" },
},
}

View file

@ -1,327 +0,0 @@
local M = {}
local java_filetypes = { "java" }
local 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
local function extend_or_override(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
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
M = {
{
"williamboman/mason-lspconfig.nvim",
-- stylua: ignore
opts = function(_, opts)
opts.skip_config = opts.skip_config or {}
vim.list_extend(opts.skip_config, { "jdtls" })
-- 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,
keys = {
{ "<leader>l", "", desc = "LSP", mode = { "n", "v" } },
},
},
{
"mfussenegger/nvim-jdtls",
ft = java_filetypes,
enabled = true,
opts = function()
return {
root_dir = require("jdtls.setup").find_root(root_markers),
project_name = function()
return vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t")
end,
-- Where are the config and workspace dirs for a project?
jdtls_config_dir = function(project_name)
return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/config"
end,
jdtls_workspace_dir = function(project_name)
return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/workspace"
end,
cmd = { vim.fn.exepath("jdtls") },
full_cmd = function(opts)
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t")
local cmd = vim.deepcopy(opts.cmd)
if project_name then
vim.list_extend(cmd, {
"-configuration",
opts.jdtls_config_dir(project_name),
"-data",
opts.jdtls_workspace_dir(project_name),
})
end
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",
},
},
},
},
}
end,
config = function(_, opts)
local opt = vim.opt
opt.shiftwidth = 4
opt.tabstop = 4
opt.softtabstop = 4
opt.ts = 4
opt.expandtab = true
local mason_registry = require("mason-registry")
local bundles = {} ---@type string[]
if 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 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
local function attach_jdtls()
-- Configuration can be augmented and overridden by opts.jdtls
local config = extend_or_override({
cmd = opts.full_cmd(opts),
root_dir = require("jdtls.setup").find_root(root_markers),
init_options = {
bundles = bundles,
},
settings = opts.settings,
-- enable CMP capabilities
-- capabilities = require("user.lsp.handlers").capabilities or nil,
-- capabilities = require("auto-lsp.lsp.handlers").capabilities or nil,
capabilities = capabilities() or nil,
}, opts.jdtls)
-- Existing server will be reused if the root_dir matches.
require("jdtls").start_or_attach(config)
-- not need to require("jdtls.setup").add_commands(), start automatically adds commands
end
vim.api.nvim_create_autocmd("FileType", {
pattern = java_filetypes,
callback = attach_jdtls,
})
-- Setup keymap and dap after the lsp is fully attached.
-- https://github.com/mfussenegger/nvim-jdtls#nvim-dap-configuration
-- https://neovim.io/doc/user/lsp.html#LspAttach
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
-- 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" })
if opts.dap and mason_registry.is_installed("java-debug-adapter") then
-- custom init for Java debugger
require("jdtls").setup_dap(opts.dap)
require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main)
end
-- User can set additional keymaps in opts.on_attach
if opts.on_attach then
opts.on_attach(args)
end
end
end,
})
-- Avoid race condition by calling attach the first time, since the autocmd won't fire.
attach_jdtls()
end,
},
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "java" })
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "jdtls" })
end,
},
{
"pojokcodeid/auto-conform.nvim",
event = "VeryLazy",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "java-debug-adapter", "java-test" })
opts.formatters_by_ft.java = { "lsp_fmt" }
end,
},
{
"nvim-neotest/neotest",
dependencies = {
"nvim-neotest/nvim-nio",
"nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter",
"andy-bell101/neotest-java",
},
config = function()
local project_type = "maven"
local gradle_file = vim.fn.findfile("build.gradle", vim.fn.getcwd())
if gradle_file then
project_type = "gradle"
end
require("neotest").setup({
adapters = {
require("neotest-java")({
-- function to determine which runner to use based on project path
determine_runner = function(project_root_path)
-- return should be "maven" or "gradle"
return project_type
end,
-- override the builtin runner discovery behaviour to always use given
-- tool. Default is "nil", so no override
force_runner = nil,
-- if the automatic runner discovery can't uniquely determine whether
-- to use Gradle or Maven, fallback to using this runner. Default is
-- "gradle or maven"
fallback_runner = project_type,
}),
},
})
end,
-- stylua: ignore
keys = {
{ "<leader>T","",desc="  Test"},
{ "<leader>Tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" },
{ "<leader>Tr", function() require("neotest").run.run() end, desc = "Run Nearest" },
{ "<leader>TT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" },
{ "<leader>Tl", function() require("neotest").run.run_last() end, desc = "Run Last" },
{ "<Leader>Ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" },
{ "<leader>To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" },
{ "<Leader>TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" },
{ "<Leader>TS", function() require("neotest").run.stop() end, desc = "Stop" },
{ "<leader>rg", "<cmd>terminal<cr>gradle run<cr>", desc = "Run Gradle", mode = "n" },
},
},
{
"rockerBOO/symbols-outline.nvim",
cmd = "SymbolsOutline",
config = function()
require("symbols-outline").setup({
symbols = {
File = { icon = "󰈔", hl = "@text.uri" },
Module = { icon = "", hl = "@namespace" },
Namespace = { icon = "󰅪", hl = "@namespace" },
Package = { icon = "", hl = "@namespace" },
Class = { icon = "𝓒", hl = "@type" },
Method = { icon = "ƒ", hl = "@method" },
Property = { icon = "", hl = "@method" },
Field = { icon = "", hl = "@field" },
Constructor = { icon = "", hl = "@constructor" },
Enum = { icon = "", hl = "@type" },
Interface = { icon = "", hl = "@type" },
Function = { icon = "", hl = "@function" },
Variable = { icon = "", hl = "@constant" },
Constant = { icon = "", hl = "@constant" },
String = { icon = "𝓐", hl = "@string" },
Number = { icon = "#", hl = "@number" },
Boolean = { icon = "󰨙 ", hl = "@boolean" },
Array = { icon = "", hl = "@constant" },
Object = { icon = "⦿", hl = "@type" },
Key = { icon = "🔐", hl = "@type" },
Null = { icon = "NULL", hl = "@type" },
EnumMember = { icon = "", hl = "@field" },
Struct = { icon = "𝓢", hl = "@type" },
Event = { icon = "🗲", hl = "@type" },
Operator = { icon = "+", hl = "@operator" },
TypeParameter = { icon = "𝙏", hl = "@parameter" },
Component = { icon = "󰅴", hl = "@function" },
Fragment = { icon = "󰅴", hl = "@constant" },
},
})
end,
keys = {
{ "<leader>S", "<cmd>SymbolsOutline<cr>", desc = "Toggle Outline" },
},
},
}
return M

View file

@ -1,32 +0,0 @@
return {
"nvim-java/nvim-java",
-- ft = { "java" },
dependencies = {
"MunifTanjim/nui.nvim",
"neovim/nvim-lspconfig",
"mfussenegger/nvim-dap",
"williamboman/mason.nvim",
},
opts = {
notifications = {
dap = false,
},
jdk = {
auto_install = false,
},
-- NOTE: One of these files must be in your project root directory.
-- Otherwise the debugger will end in the wrong directory and fail.
root_markers = {
"settings.gradle",
"settings.gradle.kts",
"pom.xml",
"build.gradle",
"mvnw",
"gradlew",
"build.gradle",
"build.gradle.kts",
".git",
},
},
}

View file

@ -1,235 +0,0 @@
local config_file = "jest.config.ts"
local M = {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "html", "javascript", "typescript", "tsx", "css", "json", "jsonc" })
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "html", "eslint", "cssls", "emmet_ls", "jsonls", "ts_ls" })
end,
},
{
"pojokcodeid/auto-conform.nvim",
event = "VeryLazy",
opts = function(_, opts)
opts.formatters_by_ft = opts.formatters_by_ft or {}
local package = "prettier"
vim.list_extend(opts.ensure_installed, { package })
opts.formatters_by_ft.javascript = { package }
end,
},
{
"nvim-neotest/neotest",
dependencies = {
"antoinemadec/FixCursorHold.nvim",
"nvim-neotest/neotest-jest",
"nvim-neotest/nvim-nio",
"marilari88/neotest-vitest",
},
ft = { "javascript", "typescript", "javascriptreact", "typescriptreact" },
opts = {
adapters = {
["neotest-jest"] = {
jestCommand = "npm test -- ",
jestConfigFile = function()
local file = vim.fn.expand("%:p")
if string.find(file, "/packages/") then
return string.match(file, "(.-/[^/]+/)src") .. config_file
end
return vim.fn.getcwd() .. "/" .. config_file
end,
cwd = function()
local file = vim.fn.expand("%:p")
if string.find(file, "/packages/") then
return string.match(file, "(.-/[^/]+/)src")
end
return vim.fn.getcwd()
end,
},
["neotest-vitest"] = {},
},
status = { virtual_text = true },
output = { open_on_run = true },
},
config = function(_, opts)
local neotest_ns = vim.api.nvim_create_namespace("neotest")
vim.diagnostic.config({
virtual_text = {
format = function(diagnostic)
-- Replace newline and tab characters with space for more compact diagnostics
local message = diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "")
return message
end,
},
}, neotest_ns)
opts.consumers = opts.consumers or {}
if opts.adapters then
local adapters = {}
for name, config in pairs(opts.adapters or {}) do
if type(name) == "number" then
if type(config) == "string" then
config = require(config)
end
adapters[#adapters + 1] = config
elseif config ~= false then
local adapter = require(name)
if type(config) == "table" and not vim.tbl_isempty(config) then
local meta = getmetatable(adapter)
if adapter.setup then
adapter.setup(config)
elseif meta and meta.__call then
adapter(config)
else
error("Adapter " .. name .. " does not support setup")
end
end
adapters[#adapters + 1] = adapter
end
end
opts.adapters = adapters
end
require("neotest").setup(opts)
end,
-- stylua: ignore
keys = {
{ "<leader>T","",desc="  Test"},
{ "<leader>Tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" },
{ "<leader>Tr", function() require("neotest").run.run() end, desc = "Run Nearest" },
{ "<leader>TT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" },
{ "<leader>Tl", function() require("neotest").run.run_last() end, desc = "Run Last" },
{ "<Leader>Ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" },
{ "<leader>To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" },
{ "<Leader>TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" },
{ "<Leader>TS", function() require("neotest").run.stop() end, desc = "Stop" },
},
},
{
"pojokcodeid/npm-runner.nvim",
event = "VeryLazy",
dependencies = {
"rcarriga/nvim-notify",
},
-- your opts go here
opts = {
command = {
dev = {
start = "NpmRunDev",
stop = "NpmStopDev",
cmd = "npm run dev",
},
prod = {
start = "NpmStart",
stop = "NpmStop",
cmd = "npm start",
},
},
opt = {
show_mapping = "<leader>nm",
hide_mapping = "<leader>nh",
width = 70,
height = 20,
},
},
keys = {
{ "<leader>n", "", desc = "  Npm" },
},
config = function(_, opts)
require("npm-runner").setup(opts.command, opts.opt)
end,
},
{
"rcarriga/nvim-dap-ui",
lazy = true,
event = "BufRead",
dependencies = {
{ "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
require("dap").configurations[language] = {
{
type = "pwa-node",
request = "launch",
name = "Launch file",
program = "${file}",
cwd = "${workspaceFolder}",
},
{
type = "pwa-node",
request = "attach",
name = "Attach",
processId = require("dap.utils").pick_process,
cwd = "${workspaceFolder}",
},
{
type = "pwa-chrome",
request = "launch",
name = 'Start Chrome with "localhost"',
url = "http://localhost:3000",
webRoot = "${workspaceFolder}",
userDataDir = "${workspaceFolder}/.vscode/vscode-chrome-debug-userdatadir",
},
}
end
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" },
},
},
}
return M

View file

@ -1,136 +0,0 @@
return {
-- install treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "kotlin" })
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "kotlin_language_server" })
end,
},
{
"pojokcodeid/auto-conform.nvim",
event = "VeryLazy",
opts = function(_, opts)
opts.formatters_by_ft = opts.formatters_by_ft or {}
local package = "ktfmt"
vim.list_extend(opts.ensure_installed, { package })
opts.formatters_by_ft.kotlin = { package }
end,
},
{
"pojokcodeid/auto-lint.nvim",
optional = true,
opts = function(_, opts)
opts.linters_by_ft = opts.linters_by_ft or {}
vim.list_extend(opts.ensure_installed, { "ktlint" })
opts.linters_by_ft.kotlin = { "ktlint" }
end,
},
{
"mason.nvim",
opts = {
ensure_installed = { "kotlin-debug-adapter" },
},
},
{
"rcarriga/nvim-dap-ui",
lazy = true,
event = "BufRead",
dependencies = {
{ "mfussenegger/nvim-dap", lazy = true },
{ "nvim-neotest/nvim-nio", lazy = true },
},
opts = function()
require("pcode.user.dapui")
local dap = require("dap")
if not dap.adapters.kotlin then
dap.adapters.kotlin = {
type = "executable",
command = "kotlin-debug-adapter",
options = { auto_continue_if_many_stopped = false },
}
end
dap.configurations.kotlin = {
{
type = "kotlin",
request = "launch",
name = "This file",
-- may differ, when in doubt, whatever your project structure may be,
-- it has to correspond to the class file located at `build/classes/`
-- and of course you have to build before you debug
mainClass = function()
local root = vim.uv.cwd()
local fname = vim.api.nvim_buf_get_name(0)
fname = fname:gsub(root, "")
fname = fname:gsub("/app/src/main/kotlin/", "")
fname = fname:gsub(".kt", "Kt"):gsub("/", ".")
-- src/main/kotlin/websearch/Main.kt -> websearch.MainKt
return fname
end,
projectRoot = "${workspaceFolder}",
jsonLogFile = "",
enableJsonLogging = false,
},
{
-- Use this for unit tests
-- First, run
-- ./gradlew --info cleanTest test --debug-jvm
-- then attach the debugger to it
type = "kotlin",
request = "attach",
name = "Attach to debugging session",
port = 5005,
args = {},
projectRoot = vim.fn.getcwd,
hostName = "localhost",
timeout = 2000,
},
}
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" },
-- setting cek
-- https://stackoverflow.com/questions/9356543/logging-while-testing-through-gradle
{ "<leader>T", "", desc = " Test" },
{ "<leader>Ta", "<cmd>terminal gradle test<cr>", desc = "Run All" },
{
"<leader>Tu",
function()
-- local current_word = vim.fn.expand("<cword>")
local current_word = ""
local input = vim.fn.getline(".")
current_word = all_trim((input:gsub("class", "")):gsub("{", "")) -- hilangkan bagian class
current_word = current_word:gsub("fun", "")
current_word = current_word:gsub("%(%)", "")
current_word = current_word:gsub("{", "")
current_word = current_word:gsub("@Test", "")
vim.cmd("terminal gradle test --tests *." .. all_trim(current_word))
end,
desc = "Run Under Cursor",
},
{ "<leader>rg", "<cmd>terminal<cr>gradle run<cr>", desc = "Run Gradle", mode = "n" },
},
},
}

View file

@ -1,149 +0,0 @@
return {
-- install treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "kotlin" })
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "kotlin_language_server" })
end,
},
{
"pojokcodeid/auto-conform.nvim",
event = "VeryLazy",
opts = function(_, opts)
opts.formatters_by_ft = opts.formatters_by_ft or {}
local package = "ktfmt"
vim.list_extend(opts.ensure_installed, { package })
opts.formatters_by_ft.kotlin = { package }
end,
},
{
"pojokcodeid/auto-lint.nvim",
optional = true,
opts = function(_, opts)
opts.linters_by_ft = opts.linters_by_ft or {}
vim.list_extend(opts.ensure_installed, { "ktlint" })
opts.linters_by_ft.kotlin = { "ktlint" }
end,
},
{
"mason.nvim",
opts = {
ensure_installed = { "kotlin-debug-adapter" },
},
},
{
"rcarriga/nvim-dap-ui",
lazy = true,
event = "BufRead",
dependencies = {
{ "mfussenegger/nvim-dap", lazy = true },
{ "nvim-neotest/nvim-nio", lazy = true },
},
opts = function()
require("pcode.user.dapui")
local dap = require("dap")
if not dap.adapters.kotlin then
dap.adapters.kotlin = {
type = "executable",
command = "kotlin-debug-adapter",
options = { auto_continue_if_many_stopped = false },
}
end
dap.configurations.kotlin = {
{
type = "kotlin",
request = "launch",
name = "This file",
-- may differ, when in doubt, whatever your project structure may be,
-- it has to correspond to the class file located at `build/classes/`
-- and of course you have to build before you debug
mainClass = function()
local root = vim.uv.cwd()
local fname = vim.api.nvim_buf_get_name(0)
fname = fname:gsub(root, "")
fname = fname:gsub("/app/src/main/kotlin/", "")
fname = fname:gsub(".kt", "Kt"):gsub("/", ".")
-- src/main/kotlin/websearch/Main.kt -> websearch.MainKt
return fname
end,
projectRoot = "${workspaceFolder}",
jsonLogFile = "",
enableJsonLogging = false,
},
{
-- Use this for unit tests
-- First, run
-- ./gradlew --info cleanTest test --debug-jvm
-- then attach the debugger to it
type = "kotlin",
request = "attach",
name = "Attach to debugging session",
port = 5005,
args = {},
projectRoot = vim.fn.getcwd,
hostName = "localhost",
timeout = 2000,
},
}
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" },
-- setting cek
-- https://stackoverflow.com/questions/9356543/logging-while-testing-through-gradle
{ "<leader>T", "", desc = " Test" },
{ "<leader>Ta", "<cmd>terminal gradle test<cr>", desc = "Run All" },
{
"<leader>Tu",
function()
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\\test\\kotlin\\", "")
relative_path = relative_path:gsub("app/src/test/kotlin/", "")
relative_path = relative_path:gsub("\\", ".")
relative_path = relative_path:gsub("/", ".")
return relative_path:sub(2)
end
local curr_file = vim.fn.expand("%:t")
curr_file = curr_file:gsub("kt", "")
local current_word = ""
local input = vim.fn.getline(".")
current_word = all_trim((input:gsub("class", "")):gsub("{", "")) -- hilangkan bagian class
current_word = current_word:gsub("fun", "")
current_word = current_word:gsub("%(%)", "")
current_word = current_word:gsub("{", "")
current_word = current_word:gsub("@Test", "")
vim.cmd(
"terminal gradle test --tests " .. get_default_package() .. "." .. curr_file .. all_trim(current_word)
)
end,
desc = "Run Under Cursor",
},
{ "<leader>rg", "<cmd>terminal<cr>gradle run<cr>", desc = "Run Gradle", mode = "n" },
},
},
}

View file

@ -1,102 +0,0 @@
return {
{
"pojokcodeid/auto-conform.nvim",
event = "VeryLazy",
optional = true,
opts = function(_, opts)
vim.list_extend(opts.formatters, {
["markdown-toc"] = {
condition = function(_, ctx)
for _, line in ipairs(vim.api.nvim_buf_get_lines(ctx.buf, 0, -1, false)) do
if line:find("<!%-%- toc %-%->") then
return true
end
end
end,
},
["markdownlint-cli2"] = {
condition = function(_, ctx)
local diag = vim.tbl_filter(function(d)
return d.source == "markdownlint"
end, vim.diagnostic.get(ctx.buf))
return #diag > 0
end,
},
})
vim.list_extend(opts.formatters_by_ft, {
["markdown"] = { "prettier", "markdownlint-cli2", "markdown-toc" },
["markdown.mdx"] = { "prettier", "markdownlint-cli2", "markdown-toc" },
})
end,
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "markdownlint-cli2", "markdown-toc" })
end,
},
{
"pojokcodeid/auto-lint.nvim",
event = "VeryLazy",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "markdownlint-cli2" })
end,
config = function(_, opts)
require("auto-lint").setup(opts)
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "marksman" })
end,
},
-- Markdown preview
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
build = function()
require("lazy").load({ plugins = { "markdown-preview.nvim" } })
vim.fn["mkdp#util#install"]()
end,
keys = {
{
"<leader>Cp",
ft = "markdown",
"<cmd>MarkdownPreviewToggle<cr>",
desc = "Markdown Preview",
},
},
config = function()
vim.cmd([[do FileType]])
end,
},
{
"MeanderingProgrammer/render-markdown.nvim",
opts = {
code = {
sign = false,
width = "block",
right_pad = 1,
},
heading = {
sign = false,
icons = {},
},
},
ft = { "markdown", "norg", "rmd", "org" },
config = function(_, opts)
require("render-markdown").setup(opts)
end,
keys = {
{ "<leader>C", "", desc = "  Markdown" },
{
"<leader>Cr",
"<cmd>RenderMarkdown<cr>",
desc = "Render Markdown",
},
},
},
}

View file

@ -1,223 +0,0 @@
local function is_laravel_project()
return vim.fn.isdirectory("app") == 1
and vim.fn.isdirectory("bootstrap") == 1
and vim.fn.isdirectory("config") == 1
and vim.fn.isdirectory("database") == 1
and vim.fn.isdirectory("routes") == 1
end
-- check parser php
-- local is_config = true
-- local parsers = require("nvim-treesitter.parsers").get_parser_configs()
-- if parsers.php ~= nil then
-- is_config = false
-- end
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, {
"c",
"lua",
"vim",
"vimdoc",
"query",
"markdown",
"markdown_inline",
"html",
"php_only",
"php",
"bash",
"blade",
"json",
})
end,
config = function(_, opts)
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.blade = {
install_info = {
url = "https://github.com/EmranMR/tree-sitter-blade",
files = { "src/parser.c" },
branch = "main",
},
filetype = "blade",
}
vim.filetype.add({
pattern = {
[".*%.blade%.php"] = "blade",
},
})
require("nvim-treesitter.configs").setup(opts)
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "intelephense", "stimulus_ls" })
end,
},
{
"pojokcodeid/auto-conform.nvim",
event = "VeryLazy",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "pretty-php", "blade-formatter" })
opts.formatters_by_ft.php = { "pretty-php" }
opts.formatters_by_ft.blade = { "blade-formatter" }
end,
},
{
"pojokcodeid/auto-lint.nvim",
event = "VeryLazy",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "phpcs" })
end,
config = function(_, opts)
require("auto-lint").setup(opts)
end,
},
{
"rcarriga/nvim-dap-ui",
lazy = true,
event = "BufRead",
dependencies = {
{ "mfussenegger/nvim-dap", lazy = true },
{ "nvim-neotest/nvim-nio", lazy = true },
{
"xdebug/vscode-php-debug",
version = "1.x",
build = "npm install && npm run build",
config = function()
require("dap.ext.vscode").load_launchjs()
end,
},
},
config = function()
require("pcode.user.dapui")
local dap = require("dap")
dap.adapters.php = {
type = "executable",
command = "node",
-- change this to where you build vscode-php-debug
args = { vim.fn.stdpath("data") .. "/lazy/vscode-php-debug/out/phpDebug.js" },
}
dap.configurations.php = {
-- to run php right from the editor
{
name = "run current script",
type = "php",
request = "launch",
port = 9003,
cwd = "${fileDirname}",
program = "${file}",
runtimeExecutable = "php",
},
-- to listen to any php call
{
name = "listen for Xdebug local",
type = "php",
request = "launch",
port = 9003,
},
-- to listen to php call in docker container
{
name = "listen for Xdebug docker",
type = "php",
request = "launch",
port = 9003,
-- this is where your file is in the container
pathMappings = {
["/opt/project"] = "${workspaceFolder}",
},
},
}
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" },
},
},
{
"nvim-neotest/neotest",
dependencies = {
"antoinemadec/FixCursorHold.nvim",
"olimorris/neotest-phpunit",
"nvim-neotest/nvim-nio",
},
config = function()
require("neotest-phpunit")({
filter_dirs = { "vendor" },
})
require("neotest").setup({
adapters = {
require("neotest-phpunit"),
},
})
end,
-- stylua: ignore
keys = {
{ "<leader>T","",desc="  Test"},
{ "<leader>Tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" },
{ "<leader>Tr", function() require("neotest").run.run() end, desc = "Run Nearest" },
{ "<leader>TT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" },
{ "<leader>Tl", function() require("neotest").run.run_last() end, desc = "Run Last" },
{ "<Leader>Ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" },
{ "<leader>To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" },
{ "<Leader>TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" },
{ "<Leader>TS", function() require("neotest").run.stop() end, desc = "Stop" },
},
},
{
"mfussenegger/nvim-lint",
opts = function(_, opts)
opts.linters_by_ft = opts.linters_by_ft or {}
opts.linters_by_ft.php = { "phpcs" }
opts.linters_by_ft.blade = { "tlint" }
end,
config = function(_, opts)
require("lint").linters_by_ft = opts.linters_by_ft
end,
},
-- untuk case tertentu install ini
-- npm install -g tree-sitter-cli
{
"adalessa/laravel.nvim",
enabled = is_laravel_project(), -- pastikan membuka laravel project
-- version = "v2.2.1",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"tpope/vim-dotenv",
"nvim-telescope/telescope.nvim",
"MunifTanjim/nui.nvim",
"kevinhwang91/promise-async",
},
cmd = { "Laravel" },
keys = {
{ "<leader>L", "", desc = " 󰫐 Laravel" },
{ "<leader>La", ":Laravel artisan<cr>" },
{ "<leader>Lr", ":Laravel routes<cr>" },
{ "<leader>Lm", ":Laravel related<cr>" },
},
event = { "VeryLazy" },
opts = {},
config = true,
},
}

View file

@ -1,57 +0,0 @@
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "prisma" })
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "prismals" })
vim.cmd([[
autocmd BufWritePost *.prisma silent! execute "!npx prisma format"
]])
end,
keys = {
{ "<leader>p", "", desc = "  Prisma" },
{
"<leader>pf",
function()
vim.cmd("execute '!npx prisma format'")
end,
desc = "Prisma Format",
},
{
"<leader>pm",
function()
vim.cmd("execute '!npx prisma init --datasource-provider mysql'")
end,
desc = "init MySQL",
},
{
"<leader>pp",
function()
vim.cmd("execute '!npx prisma init --datasource-provider postgresql'")
end,
desc = "init postgresql",
},
{
"<leader>pe",
function()
vim.cmd("execute '!npx prisma migrate dev --name init'")
end,
desc = "Migrate",
},
{
"<leader>ps",
function()
vim.cmd("terminal npx prisma studio")
end,
desc = "npx prisma Studio",
},
},
},
}

Some files were not shown because too many files have changed in this diff Show more