diff --git a/.__abstract__ b/.__abstract__ deleted file mode 100644 index e69de29..0000000 diff --git a/.gitignore b/.gitignore deleted file mode 100644 index d7ad043..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -plugin/ diff --git a/.stylua.toml b/.stylua.toml deleted file mode 100644 index b1aeb38..0000000 --- a/.stylua.toml +++ /dev/null @@ -1,6 +0,0 @@ -column_width = 120 -line_endings = "Unix" -indent_type = "Tabs" -indent_width = 4 -quote_style = "AutoPreferDouble" -call_parentheses = "Always" diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 03338db..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021 Ali Shahid - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index 1952b90..4640904 100644 --- a/README.md +++ b/README.md @@ -1,92 +1 @@ -
- -

- -

- - -
- Screenshots - Request Feature - - ![Contributors](https://img.shields.io/github/contributors/Abstract-IDE/Abstract?color=dark-green) ![Issues](https://img.shields.io/github/issues/Abstract-IDE/Abstract) ![License](https://img.shields.io/github/license/Abstract-IDE/Abstract) -
- - - - - -## Table Of Contents - -* [About](#about) -* [Documentaton](#documentaton) -* [Project Stracture](#project-stracture) -* [License](#license) -* [Screenshots](#screenshots) -* [To-do](#to-do) - - -## About - -Abstract, The NeoVim configuration to achieve the power of Modern IDE - -![2022-07-25_20-56](https://user-images.githubusercontent.com/41078534/180812465-8e65807c-a25e-4bc6-8abd-38d32538259e.png) - - - -## Documentaton -more about Abstract and installation can be found on [DOCS](https://abstract-ide.github.io/site/docs/getting-started/installation/abstract) - - - -### Project Stracture - -``` -├── extra/ -│ └── snippets/ / custom defined snippets -│ ... -├── init.lua / load/source configs | heart of Abstract -├── lua/ -│ ├── autocmd.lua / auto command configs -│ ├── configs.lua / configs that's don't depends on plugins -│ ├── mappings.lua / mappings that don't depends on plugins -│ ├── packer_nvim.lua / manage plugins -│ ├── customs/ -│ │ ├── override_defalut.lua / configs to override defined config -│ │ └── abstractline.lua / i am working on it. btw it's a status line -│ └── plugins/ / dir containing configs for plugins. each plugin has it's own config and can be locaed through init.lua file -│ ... -├── plugin/ / auto-created by plugin manager -└── setup.py / python-script to install/update Abstract -``` - - - -## License - -Distributed under the MIT License. -

- - - -## Screenshots - ![screenshot_buff_and_nerdtree](https://user-images.githubusercontent.com/41078534/177386049-93fc7a75-2f23-4d53-92a3-9ce8999283bf.png) - ![screenshot_python_lsp](https://user-images.githubusercontent.com/41078534/177386239-f77ea88e-a934-4979-8806-017f39225e9d.png) - ![screenshot_running_c](https://user-images.githubusercontent.com/41078534/177386287-53ea37a3-6349-40f6-b0f3-fcb5942fdb8f.png) - ![screenshot_telescope_as_fuzzy_finder](https://user-images.githubusercontent.com/41078534/177386330-4863acdb-9c66-4f68-9b6a-96f379becf05.png) - ![screenshot_packer](https://user-images.githubusercontent.com/41078534/177386379-955c7ddf-8750-4497-8e94-1d4fde28d6da.png) - ![screenshot_codeaction_in_flutter_app](https://user-images.githubusercontent.com/41078534/177386497-bb984c56-9bf2-40e5-a9df-88f87767feb0.png) -
- - - -## To-Do - -- add installer(setup.py) support for Windows and Mac os - - - -## Known Bugs - -- there is no known bugs yet. Please open the issue if you find one. - +# TODO diff --git a/code/.cargo/config.toml b/code/.cargo/config.toml new file mode 100644 index 0000000..d47f983 --- /dev/null +++ b/code/.cargo/config.toml @@ -0,0 +1,11 @@ +[target.x86_64-apple-darwin] +rustflags = [ + "-C", "link-arg=-undefined", + "-C", "link-arg=dynamic_lookup", +] + +[target.aarch64-apple-darwin] +rustflags = [ + "-C", "link-arg=-undefined", + "-C", "link-arg=dynamic_lookup", +] diff --git a/code/.gitignore b/code/.gitignore new file mode 100644 index 0000000..2f7896d --- /dev/null +++ b/code/.gitignore @@ -0,0 +1 @@ +target/ diff --git a/code/.taplo.toml b/code/.taplo.toml new file mode 100644 index 0000000..a91c82e --- /dev/null +++ b/code/.taplo.toml @@ -0,0 +1,12 @@ +[formatting] +align_entries = true +compact_arrays = true +array_auto_expand = false +reorder_keys = false # optional: keeps your order + +[formatting.tables] +# Makes sure dependencies stay inline +[formatting.tables.dependencies] +inline_array_auto_expand = false +compact_inline_tables = true +align_entries = true diff --git a/code/Cargo.lock b/code/Cargo.lock new file mode 100644 index 0000000..c25fade --- /dev/null +++ b/code/Cargo.lock @@ -0,0 +1,1758 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "abspm" +version = "0.1.0" +dependencies = [ + "chrono", + "dirs", + "futures", + "git2", + "hex", + "parking_lot", + "sha2", + "shellexpand", + "tempfile", + "tokio-test", + "toml", +] + +[[package]] +name = "abstract" +version = "0.1.0" +dependencies = [ + "abspm", + "abstract-autogood", + "abstract-indent", + "abstract-utils", + "anyhow", + "git2", + "nvim-oxi", + "once_cell", + "strum", + "thiserror", + "tokio", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "abstract-autogood" +version = "0.1.0" +dependencies = [ + "abstract-utils", + "nvim-oxi", + "once_cell", +] + +[[package]] +name = "abstract-indent" +version = "0.1.0" +dependencies = [ + "abstract-utils", + "memmap2", + "nvim-oxi", + "rayon", + "serde", + "serde_json", +] + +[[package]] +name = "abstract-utils" +version = "0.1.0" +dependencies = [ + "strum", + "strum_macros", +] + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + +[[package]] +name = "async-stream" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bstr" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" + +[[package]] +name = "bytes" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" + +[[package]] +name = "camino" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48" +dependencies = [ + "serde_core", +] + +[[package]] +name = "cargo-platform" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cc" +version = "1.2.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a0aeaff4ff1a90589618835a598e545176939b97874f7abc7851caa0618f203" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chrono" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "find-msvc-tools" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645cbb3a84e60b7531617d5ae4e57f7e27308f6445f5abf653209ea76dec8dff" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", +] + +[[package]] +name = "git2" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e2b37e2f62729cdada11f0e6b3b6fe383c69c29fc619e391223e12856af308c" +dependencies = [ + "bitflags", + "libc", + "libgit2-sys", + "log", + "openssl-probe", + "openssl-sys", + "url", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "iana-time-zone" +version = "0.1.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "itoa" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.179" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5a2d376baa530d1238d133232d15e239abad80d05838b4b59354e5268af431f" + +[[package]] +name = "libgit2-sys" +version = "0.18.3+1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9b3acc4b91781bb0b3386669d325163746af5f6e4f73e6d2d630e09a35f3487" +dependencies = [ + "cc", + "libc", + "libssh2-sys", + "libz-sys", + "openssl-sys", + "pkg-config", +] + +[[package]] +name = "libredox" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" +dependencies = [ + "bitflags", + "libc", +] + +[[package]] +name = "libssh2-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "220e4f05ad4a218192533b300327f5150e809b54c4ec83b5a1d91833601811b9" +dependencies = [ + "cc", + "libc", + "libz-sys", + "openssl-sys", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "libz-sys" +version = "1.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15d118bbf3771060e7311cc7bb0545b01d08a8b4a7de949198dec1fa0ca1c0f7" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "memmap2" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714098028fe011992e1c3962653c96b2d578c4b4bce9036e15ff220319b1e0e3" +dependencies = [ + "libc", +] + +[[package]] +name = "mio" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "mlua" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1f5f8fbebc7db5f671671134b9321c4b9aa9adeafccfd9a8c020ae45c6a35d0" +dependencies = [ + "bstr", + "either", + "mlua-sys", + "num-traits", + "parking_lot", + "rustc-hash", + "rustversion", +] + +[[package]] +name = "mlua-sys" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380c1f7e2099cafcf40e51d3a9f20a346977587aa4d012eae1f043149a728a93" +dependencies = [ + "cc", + "cfg-if", + "pkg-config", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "nvim-oxi" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54489e0e1515ff8fdbd07eb198ac1f8b082b849e2ed3b7607d6705e24b74af5c" +dependencies = [ + "cargo_metadata", + "mlua", + "nvim-oxi-api", + "nvim-oxi-luajit", + "nvim-oxi-macros", + "nvim-oxi-types", + "thiserror", +] + +[[package]] +name = "nvim-oxi-api" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89a662cfeae9de93b4a6a1779e9e37e15c354f8f9acc933e2d79105d601c8fd4" +dependencies = [ + "nvim-oxi-luajit", + "nvim-oxi-macros", + "nvim-oxi-types", + "serde", + "serde_repr", + "thiserror", +] + +[[package]] +name = "nvim-oxi-luajit" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bba46ec2ab57e840cd33067e0d1d7c89c2c7feafd02bbbb11a90a4220491a1c9" +dependencies = [ + "thiserror", +] + +[[package]] +name = "nvim-oxi-macros" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c03daabc1d9efd2d5aff2746199b4ed60f2cc24c321d6fcb2aa023169b0f13" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "nvim-oxi-types" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f079f687853419cf83879ab060d23171e31689d090a0c8d5c6aa0e3210c83ec" +dependencies = [ + "libc", + "nvim-oxi-luajit", + "serde", + "thiserror", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-sys" +version = "0.9.111" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + +[[package]] +name = "proc-macro2" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_users" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +dependencies = [ + "getrandom 0.2.16", + "libredox", + "thiserror", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c" + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustix" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.148" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3084b546a1dd6289475996f182a22aba973866ea8e8b02c51d9f46b1336a22da" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_repr" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_spanned" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776" +dependencies = [ + "serde_core", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shellexpand" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b1fdf65dd6331831494dd616b30351c38e96e45921a27745cf98490458b90bb" +dependencies = [ + "dirs", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "slab" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strum" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "syn" +version = "2.0.113" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678faa00651c9eb72dd2020cbdf275d92eccb2400d568e419efdd64838145cb4" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tempfile" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +dependencies = [ + "fastrand", + "getrandom 0.3.4", + "once_cell", + "rustix", + "windows-sys", +] + +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "signal-hook-registry", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-stream" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-test" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2468baabc3311435b55dd935f702f42cd1b8abb7e754fb7dfb16bd36aa88f9f7" +dependencies = [ + "async-stream", + "bytes", + "futures-core", + "tokio", + "tokio-stream", +] + +[[package]] +name = "toml" +version = "0.9.10+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0825052159284a1a8b4d6c0c86cbc801f2da5afd2b225fa548c72f2e74002f48" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime", + "toml_parser", + "toml_writer", + "winnow", +] + +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_parser" +version = "1.0.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" +dependencies = [ + "winnow", +] + +[[package]] +name = "toml_writer" +version = "1.0.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "url" +version = "2.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "winnow" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zmij" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30e0d8dffbae3d840f64bda38e28391faef673a7b5a6017840f2a106c8145868" diff --git a/code/Cargo.toml b/code/Cargo.toml new file mode 100644 index 0000000..bd42bb3 --- /dev/null +++ b/code/Cargo.toml @@ -0,0 +1,66 @@ +[workspace] +resolver = "2" +members = [ + # Libs + "src/libs/utils", + "src/neovim/editor", + # Plugins + "src/plugins/abspm", + "src/plugins/autogood", + "src/plugins/indent", +] + +[workspace.package] +version = "0.1.0" +edition = "2024" +rust-version = "1.91.1" +license = "MIT" +authors = ["Ali Shahid "] +description = "Abstract the neovim" +categories = ["editor", "ide"] +keywords = ["neovim", "ide", "editor"] +documentation = "https://github.com/Abstract-IDE/Abstract" +repository = "https://github.com/Abstract-IDE/Abstract" +homepage = "https://github.com/Abstract-IDE/Abstract" + + +[workspace.dependencies] +# === Libraries === # +wl_utils = { package = "abstract-utils", path = "./src/libs/utils" } +# === Plugins === # +wp_indent = { package = "abstract-indent", path = "./src/plugins/indent" } +wp_abspm = { package = "abspm", path = "./src/plugins/abspm" } +wp_autogood = { package = "abstract-autogood", path = "./src/plugins/autogood" } + +# === 3rd Parties === # +anyhow = { version = "1.0.100" } +chrono = { version = "0.4.42", features = ["serde"] } +dirs = { version = "6.0.0" } +futures = { version = "0.3.31" } +git2 = { version = "0.20.3", default-features = false, features = ["ssh", "https"] } +hex = { version = "0.4.3" } +memmap2 = { version = "0.9.10" } +mlua = { version = "0.11.5", default-features = false, features = ["luajit52", "async", "send", "anyhow", "serde", "macros"] } +nvim-oxi = { version = "0.6.0", features = ["neovim-nightly", "mlua", "test"] } +once_cell = { version = "1.21.3" } +parking_lot = { version = "0.12.5" } +rayon = { version = "1.11.0", default-features = false } +serde = { version = "1.0.228", features = ["derive"] } +serde_json = { version = "1.0.145" } +sha2 = { version = "0.10.9" } +shellexpand = { version = "3.1.1" } +strum = { version = "0.27.2", features = ["derive"] } +strum_macros = { version = "0.27.2" } +tempfile = { version = "3.24.0" } +thiserror = { version = "2.0.17" } +tokio = { version = "1.48.0", features = ["sync", "macros", "rt-multi-thread", "fs", "time", "process"] } +tokio-test = { version = "0.4.4" } +toml = { version = "0.9.10" } +tracing = { version = "0.1.44" } +tracing-subscriber = { version = "0.3.22", features = ["env-filter"] } + +[profile.release] +lto = true +codegen-units = 1 +strip = true +panic = "abort" diff --git a/code/clippy.toml b/code/clippy.toml new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/code/clippy.toml @@ -0,0 +1 @@ + diff --git a/code/lua/init.lua b/code/lua/init.lua new file mode 100644 index 0000000..a0fa9f4 --- /dev/null +++ b/code/lua/init.lua @@ -0,0 +1,22 @@ +return function(data, repo) + vim.g.ABSTRACT_DATA = data + vim.g.ABSTRACT_ROOT = repo + + local code = repo .. "/code" + local profile = "debug" + local lib_ext = vim.fn.has("mac") == 1 and "dylib" or "so" + local lib_path = code .. "/target/" .. profile .. "/libabstract." .. lib_ext + + if vim.fn.filereadable(lib_path) == 0 then + vim.notify("[Abstract] Building (" .. profile .. ")...", vim.log.levels.INFO) + local cmd = profile == "release" and "cargo build --release" or "cargo build" + local result = vim.fn.system("cd " .. code .. " && " .. cmd .. " 2>&1") + if vim.v.shell_error ~= 0 then + vim.notify("[Abstract] Build failed:\n" .. result, vim.log.levels.ERROR) + return + end + end + + package.cpath = package.cpath .. ";" .. code .. "/target/" .. profile .. "/?." .. lib_ext + require("libabstract") +end diff --git a/code/rust-toolchain.toml b/code/rust-toolchain.toml new file mode 100644 index 0000000..78cef87 --- /dev/null +++ b/code/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +version = "1.91.1" +channel = "stable" diff --git a/code/rustfmt.toml b/code/rustfmt.toml new file mode 100644 index 0000000..c16888c --- /dev/null +++ b/code/rustfmt.toml @@ -0,0 +1,30 @@ +# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md + +# Basic +edition = "2024" +max_width = 120 +use_small_heuristics = "Max" + +# Imports +group_imports = "StdExternalCrate" +imports_granularity = "Crate" +reorder_imports = true + +# Consistency +newline_style = "Unix" + +# Misc +chain_width = 100 +spaces_around_ranges = false +binop_separator = "Back" +reorder_impl_items = false +match_arm_leading_pipes = "Preserve" +match_arm_blocks = false +match_block_trailing_comma = true +trailing_comma = "Vertical" +trailing_semicolon = false +use_field_init_shorthand = true + +# Format comments +comment_width = 140 +wrap_comments = true diff --git a/code/src/libs/utils/Cargo.toml b/code/src/libs/utils/Cargo.toml new file mode 100644 index 0000000..2c14662 --- /dev/null +++ b/code/src/libs/utils/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "abstract-utils" +version = { workspace = true } +edition = { workspace = true } + +[dependencies] +strum = { workspace = true } +strum_macros = { workspace = true } diff --git a/code/src/libs/utils/src/lib.rs b/code/src/libs/utils/src/lib.rs new file mode 100644 index 0000000..afc4d1d --- /dev/null +++ b/code/src/libs/utils/src/lib.rs @@ -0,0 +1 @@ +pub mod neovim; diff --git a/code/src/libs/utils/src/neovim/mod.rs b/code/src/libs/utils/src/neovim/mod.rs new file mode 100644 index 0000000..cd40856 --- /dev/null +++ b/code/src/libs/utils/src/neovim/mod.rs @@ -0,0 +1 @@ +pub mod types; diff --git a/code/src/libs/utils/src/neovim/types/events.rs b/code/src/libs/utils/src/neovim/types/events.rs new file mode 100644 index 0000000..b3f91b0 --- /dev/null +++ b/code/src/libs/utils/src/neovim/types/events.rs @@ -0,0 +1,394 @@ +use strum_macros::{ + AsRefStr, + Display, + EnumString, // +}; + +/// Neovim autocommand events. +/// +/// These correspond to `:help autocmd-events`. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, AsRefStr, EnumString, Display)] +#[strum(ascii_case_insensitive)] +pub enum Events { + /// After a buffer is added to the buffer list. + /// Happens before `BufEnter`. + BufAdd, + + /// Before a buffer is deleted from the buffer list. + BufDelete, + + /// After entering a buffer (existing or new). + BufEnter, + + /// After changing the name of the current buffer. + BufFilePost, + + /// Before changing the name of the current buffer. + BufFilePre, + + /// Before a buffer becomes hidden (no windows display it). + BufHidden, + + /// Before leaving the current buffer. + BufLeave, + + /// After the `'modified'` flag of a buffer changes. + BufModifiedSet, + + /// After creating a new buffer. + BufNew, + + /// When starting to edit a file that does not exist. + BufNewFile, + + /// After reading a file into a new buffer. + BufReadPost, + + /// Before reading a file into a new buffer. + BufReadPre, + + /// Before reading a file into a buffer; handler should read it. + BufReadCmd, + + /// Before unloading a buffer and freeing its text. + BufUnload, + + /// After a buffer is displayed in a window. + BufWinEnter, + + /// Before a buffer is removed from a window. + BufWinLeave, + + /// Before completely deleting a buffer. + BufWipeout, + + /// Before writing the whole buffer to a file. + BufWritePre, + + /// After writing the whole buffer to a file. + BufWritePost, + + /// Before writing the buffer; handler should write it. + BufWriteCmd, + + /// State of an RPC channel changed. + ChanInfo, + + /// Just after a channel is opened. + ChanOpen, + + /// When an undefined user command is invoked. + CmdUndefined, + + /// After the command-line text changes. + CmdlineChanged, + + /// After entering the command-line. + CmdlineEnter, + + /// Before leaving the command-line. + CmdlineLeave, + + /// After entering the command-line window. + CmdwinEnter, + + /// Before leaving the command-line window. + CmdwinLeave, + + /// After loading a colorscheme. + ColorScheme, + + /// Before loading a colorscheme. + ColorSchemePre, + + /// After the insert-mode completion menu changes. + CompleteChanged, + + /// After insert-mode completion finishes (before cleanup). + CompleteDonePre, + + /// After insert-mode completion finishes. + CompleteDone, + + /// Triggered when the cursor is idle in Normal mode. + CursorHold, + + /// Triggered when the cursor is idle in Insert mode. + CursorHoldI, + + /// After the cursor moves in Normal or Visual mode. + CursorMoved, + + /// After the cursor moves in Insert mode. + CursorMovedI, + + /// After the cursor moves in the command-line. + CursorMovedC, + + /// After diffs have been updated. + DiffUpdated, + + /// After the working directory changes. + DirChanged, + + /// Before the working directory changes. + DirChangedPre, + + /// When Vim is about to exit due to a quit command. + ExitPre, + + /// Before appending to a file; handler should append. + FileAppendCmd, + + /// After appending to a file. + FileAppendPost, + + /// Before appending to a file. + FileAppendPre, + + /// Before modifying a read-only file. + FileChangedRO, + + /// When Vim detects a file changed outside of Vim. + FileChangedShell, + + /// After handling an external file change. + FileChangedShellPost, + + /// Before reading a file via `:read`; handler should read. + FileReadCmd, + + /// After reading a file via `:read`. + FileReadPost, + + /// Before reading a file via `:read`. + FileReadPre, + + /// When the `filetype` option is set. + FileType, + + /// Before writing part of a buffer; handler should write. + FileWriteCmd, + + /// After writing part of a buffer. + FileWritePost, + + /// Before writing part of a buffer. + FileWritePre, + + /// After reading from a filter command. + FilterReadPost, + + /// Before reading from a filter command. + FilterReadPre, + + /// After writing to a filter command. + FilterWritePost, + + /// Before writing to a filter command. + FilterWritePre, + + /// When Neovim gains focus. + FocusGained, + + /// When Neovim loses focus. + FocusLost, + + /// When an undefined user function is called. + FuncUndefined, + + /// After a UI attaches to Neovim. + UIEnter, + + /// After a UI detaches from Neovim. + UILeave, + + /// When toggling Insert/Replace mode via ``. + InsertChange, + + /// Before inserting a character in Insert mode. + InsertCharPre, + + /// Just before entering Insert or Replace mode. + InsertEnter, + + /// Just before leaving Insert mode. + InsertLeavePre, + + /// Just after leaving Insert mode. + InsertLeave, + + /// When an LSP client attaches to a buffer. + LspAttach, + + /// When an LSP client detaches from a buffer. + LspDetach, + + /// When an LSP notification is received. + LspNotify, + + /// When LSP progress updates are reported. + LspProgress, + + /// When an LSP request is sent. + LspRequest, + + /// When semantic tokens are updated by LSP. + LspTokenUpdate, + + /// Before showing the popup menu (right-click). + MenuPopup, + + /// After the editor mode changes. + ModeChanged, + + /// After an option is set. + OptionSet, + + /// Before running a quickfix command. + QuickFixCmdPre, + + /// After running a quickfix command. + QuickFixCmdPost, + + /// Before quitting a window or Vim. + QuitPre, + + /// When a reply from a remote Vim server is received. + RemoteReply, + + /// When a search wraps around the file. + SearchWrapped, + + /// When macro recording starts. + RecordingEnter, + + /// When macro recording stops. + RecordingLeave, + + /// When Neovim reaches a safe idle state. + SafeState, + + /// After loading a session file. + SessionLoadPost, + + /// After writing a session file. + SessionWritePost, + + /// After executing a shell command. + ShellCmdPost, + + /// After executing a shell filter command. + ShellFilterPost, + + /// Before sourcing a script file. + SourcePre, + + /// After sourcing a script file. + SourcePost, + + /// When sourcing a script file; handler must source it. + SourceCmd, + + /// When a spell file is missing. + SpellFileMissing, + + /// After reading stdin during startup. + StdinReadPost, + + /// Before reading stdin during startup. + StdinReadPre, + + /// When an existing swap file is detected. + SwapExists, + + /// When the `syntax` option is set. + Syntax, + + /// After entering a tab page. + TabEnter, + + /// Before leaving a tab page. + TabLeave, + + /// When creating a new tab page. + TabNew, + + /// After entering a newly created tab page. + TabNewEntered, + + /// After closing a tab page. + TabClosed, + + /// When a terminal job starts. + TermOpen, + + /// After entering Terminal mode. + TermEnter, + + /// After leaving Terminal mode. + TermLeave, + + /// When a terminal job exits. + TermClose, + + /// When a terminal child emits an OSC/DCS/APC sequence. + TermRequest, + + /// When the host terminal responds to an OSC/DCS query. + TermResponse, + + /// After text changes in Normal mode. + TextChanged, + + /// After text changes in Insert mode. + TextChangedI, + + /// After text changes in Insert mode with popup menu visible. + TextChangedP, + + /// After text changes in Terminal mode. + TextChangedT, + + /// After a yank or delete operation. + TextYankPost, + + /// User-defined custom event (triggered via `:doautocmd`). + User, + + /// Fired after Vim finishes startup. + VimEnter, + + /// Before Vim exits. + VimLeave, + + /// Before Vim exits, prior to writing shada. + VimLeavePre, + + /// After Vim window is resized. + VimResized, + + /// After Vim resumes from suspend. + VimResume, + + /// Before Vim suspends. + VimSuspend, + + /// When a window is closed. + WinClosed, + + /// After entering a window. + WinEnter, + + /// Before leaving a window. + WinLeave, + + /// When a new window is created. + WinNew, + + /// After a window scrolls or changes size. + WinScrolled, + + /// After a window is resized. + WinResized, +} diff --git a/code/src/libs/utils/src/neovim/types/mod.rs b/code/src/libs/utils/src/neovim/types/mod.rs new file mode 100644 index 0000000..a9970c2 --- /dev/null +++ b/code/src/libs/utils/src/neovim/types/mod.rs @@ -0,0 +1 @@ +pub mod events; diff --git a/code/src/neovim/editor/Cargo.toml b/code/src/neovim/editor/Cargo.toml new file mode 100644 index 0000000..ed7e0a0 --- /dev/null +++ b/code/src/neovim/editor/Cargo.toml @@ -0,0 +1,36 @@ +[package] +name = "abstract" +description = "Abstract the neovim" +version = { workspace = true } +edition = { workspace = true } +authors = { workspace = true } +license = { workspace = true } +rust-version = { workspace = true } + + +[lib] +crate-type = ["cdylib"] + + +[dependencies] +# local libraries +wl_utils = { workspace = true } +wp_abspm = { workspace = true } +wp_autogood = { workspace = true } +wp_indent = { workspace = true } + +# 3rd parties libraries +anyhow = { workspace = true } +git2 = { workspace = true } +nvim-oxi = { workspace = true } +once_cell = { workspace = true } +thiserror = { workspace = true } +tokio = { workspace = true } +tracing = { workspace = true } +tracing-subscriber = { workspace = true } +strum = { workspace = true } +# mlua = { workspace = true } + + +[build-dependencies] +nvim-oxi = { workspace = true } diff --git a/code/src/neovim/editor/build.rs b/code/src/neovim/editor/build.rs new file mode 100644 index 0000000..b671b32 --- /dev/null +++ b/code/src/neovim/editor/build.rs @@ -0,0 +1,8 @@ +use nvim_oxi::tests::BuildError; + +fn main() -> Result<(), BuildError> { + // TODO + // + + Ok(()) +} diff --git a/code/src/neovim/editor/plugin-lock.json b/code/src/neovim/editor/plugin-lock.json new file mode 100644 index 0000000..a8c1031 --- /dev/null +++ b/code/src/neovim/editor/plugin-lock.json @@ -0,0 +1,76 @@ +{ + "Abstract-cs": { "branch": "rewrite-2", "commit": "871bc7e5b830fcfda8ff2c8013a1b7a76102c09d" }, + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, + "LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" }, + "abstract-cursor": { "branch": "main", "commit": "9dca0e33a8881768e842655488fcbfb2c6351fd6" }, + "abstract-line": { "branch": "main", "commit": "ee8826f948c9ba6a4bf3c046160c19461f41089c" }, + "abstract-plugs.nvim": { "branch": "main", "commit": "b55595fed0ca179fc72bc0bcc204730e48a17a23" }, + "awesome-flutter-snippets": { "branch": "master", "commit": "48d4b8ba44dc0133c2299d9d810eceb5efa441a7" }, + "blink.cmp": { "branch": "main", "commit": "4b18c32adef2898f95cdef6192cbd5796c1a332d" }, + "code_runner.nvim": { "branch": "main", "commit": "3be33a8d4ce36e453fc09258c9093f9ecf452964" }, + "colorful-menu.nvim": { "branch": "master", "commit": "b51a659459df8d078201aefc995db8175ed55e84" }, + "csvview.nvim": { "branch": "main", "commit": "7022e18a0fbae9aecf99a3ba02b2a541edc2b8a1" }, + "dart-vim-plugin": { "branch": "master", "commit": "db2ef169d6ae08e2bdb7ca44aac3ebb3367c9802" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "dropbar.nvim": { "branch": "master", "commit": "ce202248134e3949aac375fd66c28e5207785b10" }, + "fff.nvim": { "branch": "main", "commit": "ac8df4c9e4926d23f196f30be052518454dfe251" }, + "fidget.nvim": { "branch": "main", "commit": "7fa433a83118a70fe24c1ce88d5f0bd3453c0970" }, + "flutter-tools.nvim": { "branch": "main", "commit": "677cc07c16e8b89999108d2ebeefcfc5f539b73c" }, + "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, + "gitgraph.nvim": { "branch": "main", "commit": "c16daa7d7dd597caf9085644c009cfa80b75db8e" }, + "gitsigns.nvim": { "branch": "main", "commit": "7c4faa3540d0781a28588cafbd4dd187a28ac6e3" }, + "goto-preview": { "branch": "main", "commit": "d2d6923c9b9e0e43f0b9b566f261a8b1ae016540" }, + "grapple.nvim": { "branch": "main", "commit": "b41ddfc1c39f87f3d1799b99c2f0f1daa524c5f7" }, + "helpview.nvim": { "branch": "main", "commit": "518789535a0cb146224a428edf93a70f98b795db" }, + "hop.nvim": { "branch": "master", "commit": "08ddca799089ab96a6d1763db0b8adc5320bf050" }, + "hovercraft.nvim": { "branch": "main", "commit": "20323b149877e22d18594b9288ce0336a35b98e8" }, + "kulala.nvim": { "branch": "main", "commit": "6656c9d332735ca6a27725e0fb45a1715c4372d9" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "markview.nvim": { "branch": "main", "commit": "239feb70ed1cfc26e2c91b32590fd63f7b015599" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "a324581a3c83fdacdb9804b79de1cbe00ce18550" }, + "mason-null-ls.nvim": { "branch": "main", "commit": "8e7806acaa87fae64f0bfde25bb4b87c18bd19b4" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "9a10e096703966335bd5c46c8c875d5b0690dade" }, + "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, + "mini.icons": { "branch": "main", "commit": "5b9076dae1bfbe47ba4a14bc8b967cde0ab5d77e" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "9d6826582a3e8c84787bd7355df22a2812a1ad59" }, + "neotest": { "branch": "master", "commit": "deadfb1af5ce458742671ad3a013acb9a6b41178" }, + "neovim-session-manager": { "branch": "master", "commit": "89d253a6c68af60b49570044591d5b8701866601" }, + "noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" }, + "none-ls.nvim": { "branch": "main", "commit": "f61f46ded0ca9edce7a09b674f8e162d10921426" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" }, + "nvim-bqf": { "branch": "main", "commit": "f65fba733268ffcf9c5b8ac381287eca7c223422" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "ef211089af881bea206c7aa3f2693a81feee7e90" }, + "nvim-dap": { "branch": "master", "commit": "a9d8cb68ee7184111dc66156c4a2ebabfbe01bc5" }, + "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, + "nvim-java": { "branch": "main", "commit": "602a5f7fa92f9c1d425a2159133ff9de86842f0a" }, + "nvim-lspconfig": { "branch": "master", "commit": "2163c54bb6cfec53e3e555665ada945b8c8331b9" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-surround": { "branch": "main", "commit": "61319d4bd1c5e336e197defa15bd104c51f0fb29" }, + "nvim-treesitter": { "branch": "main", "commit": "5cb05e1b0fa3c469958a2b26f36b3fe930af221c" }, + "nvim-ts-autotag": { "branch": "main", "commit": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, + "nvim-web-devicons": { "branch": "master", "commit": "737cf6c657898d0c697311d79d361288a1343d50" }, + "oil.nvim": { "branch": "master", "commit": "0fcc83805ad11cf714a949c98c605ed717e0b83e" }, + "penvim": { "branch": "main", "commit": "028c19f81eba9eaf4fe4876c60e3491b3389322f" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "renamer.nvim": { "branch": "master", "commit": "1614d466df53899f11dd5395eaac3c09a275c384" }, + "rustaceanvim": { "branch": "master", "commit": "88575b98bb9937fb9983ddec5e532b67e75ce677" }, + "schemastore.nvim": { "branch": "main", "commit": "e75f2362624698864957a694d80ca0c116bd24d3" }, + "snacks.nvim": { "branch": "main", "commit": "9912042fc8bca2209105526ac7534e9a0c2071b2" }, + "spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" }, + "tabby.nvim": { "branch": "main", "commit": "3c130e1fcb598ce39a9c292847e32d7c3987cf11" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" }, + "tiny-code-action.nvim": { "branch": "main", "commit": "8e72efa075ba3154bbc4c7d1db532b03b4e68373" }, + "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, + "typescript-tools.nvim": { "branch": "master", "commit": "c2f5910074103705661e9651aa841e0d7eea9932" }, + "typst-preview.nvim": { "branch": "master", "commit": "e123a7ab64e52d836e00dea9251e85b201f38966" }, + "vim-dadbod": { "branch": "master", "commit": "6d1d41da4873a445c5605f2005ad2c68c99d8770" }, + "vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" }, + "vim-dadbod-ui": { "branch": "master", "commit": "07e92e22114cc5b1ba4938d99897d85b58e20475" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } +} diff --git a/code/src/neovim/editor/src/core/configs.rs b/code/src/neovim/editor/src/core/configs.rs new file mode 100644 index 0000000..2fa978d --- /dev/null +++ b/code/src/neovim/editor/src/core/configs.rs @@ -0,0 +1,155 @@ +use std::path::PathBuf; + +use nvim_oxi::{ + self, + api, // +}; + +use crate::utils::api::{ + append_opt, + listchars, // + set_opt, +}; + +/// Plugin independent Configs +/// +/// This struct handles all Neovim configuration that is independent of any plugin. +pub struct Config {} + +impl Config { + pub fn init() -> nvim_oxi::Result<()> { + // ---------------------------- + // Leader keys + // ---------------------------- + // To see the current mapping for ||, type :echo mapleader. + // If it reports an undefined variable, it means the leader key is set to the default of '\'. + api::set_var("mapleader", " ")?; + api::set_var("maplocalleader", "|")?; + + // ---------------------------- + // UI options + // ---------------------------- + set_opt("termguicolors", true)?; // Enable GUI colors for the terminal to get truecolor + set_opt("list", true)?; // show whitespace + set_opt( + "listchars", + listchars(&[ + ("nbsp", "⦸"), // CIRCLED REVERSE SOLIDUS (U+29B8) + ("extends", "»"), // RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB) + ("precedes", "«"), // LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB) + ("tab", "➔ "), // WHITE RIGHT-POINTING TRIANGLE + BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL + ("trail", "•"), // BULLET (U+2022) + ("space", " "), // space + ]), + )?; + set_opt( + "fillchars", + listchars(&[ + ("diff", "∙"), // BULLET OPERATOR (U+2219) + ("eob", " "), // NO-BREAK SPACE to suppress ~ at EndOfBuffer + ("fold", "·"), // MIDDLE DOT (U+00B7) + ("vert", "│"), // window border when window splits vertically + ]), + )?; + + // ---------------------------- + // Backup related options + // ---------------------------- + + // Resolve stdpath("data") like Lua's `vim.fn.stdpath("data")` + let backup_dir = { + let path: String = api::eval("stdpath('data')")?; + PathBuf::from(path).join(".cache") + }; + + set_opt("backup", true)?; // make backups before writing + set_opt("undofile", false)?; // persistent undos + set_opt("writebackup", true)?; // Make backup before overwriting current buffer + set_opt("backupcopy", "yes")?; // Overwrite the original backup file + set_opt("directory", backup_dir.join("swap").to_string_lossy().as_ref())?; // swap files directory + set_opt("backupdir", backup_dir.join("backedUP").to_string_lossy().as_ref())?; // backup files + set_opt("undodir", backup_dir.join("undos").to_string_lossy().as_ref())?; // undo files + set_opt("viewdir", backup_dir.join("view").to_string_lossy().as_ref())?; // :mkview storage + set_opt("shada", format!("'100,<50,f50,n{}", backup_dir.join("shada/shada").to_string_lossy()))?; + + // ---------------------------- + // Clipboard + // ---------------------------- + append_opt("clipboard", "unnamedplus")?; // copy & paste + + // ---------------------------- + // Wrapping / matching + // ---------------------------- + set_opt("wrap", false)?; // don't automatically wrap on load + set_opt("showmatch", true)?; // show matching part of pairs [] {} () + + // ---------------------------- + // Cursor / search + // ---------------------------- + set_opt("cursorline", true)?; // highlight current line + set_opt("number", true)?; // show line numbers + set_opt("relativenumber", true)?; // show relative line number + set_opt("incsearch", true)?; // incremental search + set_opt("hlsearch", true)?; // highlighted search results + set_opt("ignorecase", true)?; // ignore case while searching + set_opt("smartcase", true)?; // smartcase + + // ---------------------------- + // Scrolling + // ---------------------------- + set_opt("scrolloff", 1)?; // keep cursor 1 line away from screen border + set_opt("sidescrolloff", 2)?; // keep 2 columns visible left/right of cursor + + // ---------------------------- + // Editing behavior + // ---------------------------- + set_opt("backspace", "indent,start,eol")?; // backspace behaves normally + set_opt("mouse", "a")?; // enable mouse interaction + set_opt("mousescroll", "ver:3,hor:2")?; // scroll speed + set_opt("updatetime", 500)?; // CursorHold interval + + // ---------------------------- + // Tabs / indentation + // ---------------------------- + set_opt("softtabstop", 4)?; // soft tab stops + set_opt("shiftwidth", 4)?; // shift width + set_opt("tabstop", 4)?; // tab width + set_opt("smarttab", true)?; // / in leading whitespace + set_opt("autoindent", true)?; // maintain indent of current line + // set_opt("expandtab", false)?; // don't expand tabs into spaces + set_opt("shiftround", true)?; // round indent on shift + + // ---------------------------- + // Splits / layout + // ---------------------------- + set_opt("splitbelow", true)?; // horizontal splits below current window + set_opt("splitright", true)?; // vertical splits to right + set_opt("laststatus", 3)?; // always show status line (3 = global status) + // set_opt("colorcolumn", "79")?; // vertical word limit line + set_opt("cmdheight", 1)?; // command height + + // ---------------------------- + // Buffers / commands + // ---------------------------- + set_opt("hidden", true)?; // hide buffers with unsaved changes + set_opt("inccommand", "split")?; // live preview of :s results + set_opt("shell", "zsh")?; // shell for :! or system() + // set_opt("lazyredraw", true)?; // faster scrolling + + // ---------------------------- + // Wildignore / completion + // ---------------------------- + append_opt("wildignore", "*.o")?; + append_opt("wildignore", "*.rej")?; + append_opt("wildignore", "*.so")?; + set_opt("completeopt", "menuone,noselect,noinsert")?; // completion options + + // ---------------------------- + // Misc + // ---------------------------- + set_opt("showmode", false)?; // disable insert/replace/visual mode messages + // set_opt("cmdheight", 0)?; // command height + + Ok(()) + } +} diff --git a/code/src/neovim/editor/src/core/keymaps.lua b/code/src/neovim/editor/src/core/keymaps.lua new file mode 100644 index 0000000..3ce4bf7 --- /dev/null +++ b/code/src/neovim/editor/src/core/keymaps.lua @@ -0,0 +1,336 @@ +-- ── Keymaps ── +-- All keymap definitions for Abstract. +-- Injected into plugin configs via lua_section! + +_G.ABSTRACT_PLUGIN_GROUP = { + lsp = "LSP", + workspace = "Workspace", + preview = "Preview", + debug = "Debug", + terminal = "Terminal", + files = "Files", + logs = "Logs", + git = "Version Control - Git", + find = "Find", + manager = "Manager", + session = "Session", + http = "HTTP", + run_code = "Run Code", + close = "Close", + ui = "UI", + trouble = "Trouble", + lazygit = "Lazygit", + git_repos = "Git - Repos", + more_git = "More git", + go = "Go", +} + +local M = {} + +M.builtin = --@builtin +{ + { "\\", ":bnext", desc = "Goto next buffer" }, + { "|", ":bprevious", desc = "Goto previous buffer" }, + -- Window + { "", ":close ", desc = "Close current window" }, + { "", ":only ", desc = "Close all window except current one" }, + -- TAB + { "", ":tabclose", desc = "Close current tab" }, + { "", ":tabonly", desc = "Close all other tab" }, + { "", ":tabn", desc = "Goto next tab" }, + { "", ":tabp", desc = "Goto previous tab" }, + { "", ":-tabmove", desc = "Move tab to next position" }, + { "", ":+tabmove", desc = "Move tab to previous position" }, + -- LOGS + { "Lm", ":messages", desc = "Messages history" }, +} +--@end + +M.which_key = --@which_key +{ + { "?", function() require('which-key').show({ global = false }) end, desc = "Buffer Local Keymaps /which-key" }, +} +--@end + +M.lsp_config = --@lsp_config +{ + { "l", group = _G.ABSTRACT_PLUGIN_GROUP.lsp }, + { "lf", function() vim.lsp.buf.format({ timeout_ms = 3000 }) end, desc = "Format document" }, + { "la", function() require('tiny-code-action').code_action({}) end, desc = "Code action" }, + { "lA", function() vim.lsp.buf.range_code_action() end, desc = "Range code action" }, + { "ld", function() vim.lsp.buf.definition() end, desc = "Jumps to definition" }, + { "lD", function() vim.lsp.buf.declaration() end, desc = "Jumps to declaration" }, + { "le", function() vim.diagnostic.open_float() end, desc = "Show diagnostics" }, + { "li", function() vim.lsp.buf.implementation() end, desc = "Lists all symbol implementations" }, + { "ls", function() vim.lsp.buf.signature_help() end, desc = "Show symbol signature information" }, + { "lT", function() vim.lsp.buf.type_definition() end, desc = "Jumps to type definition" }, + { "lh", function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) end, desc = "Inlay hints /toggle" }, + { "ln", function() vim.diagnostic.jump({ count = 1, float = true }) end, desc = "Move to next diagnostic" }, + { "lb", function() vim.diagnostic.jump({ count = -1, float = true }) end, desc = "Move to previous diagnostic" }, + { "lr", function() require('snacks').picker.lsp_references() end, nowait = true, desc = "References" }, + { "lR", function() require('renamer').rename({}) end, desc = "Rename symbol" }, + { + { "lw", group = _G.ABSTRACT_PLUGIN_GROUP.workspace }, + { "lwa", function() vim.lsp.buf.add_workspace_folder() end, desc = "Add workspace folder" }, + { "lwr", function() vim.lsp.buf.remove_workspace_folder() end, desc = "Remove workspace folders" }, + { "lwl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, desc = "List workspace folders" }, + }, + { "Ll", function() vim.cmd('tabnew ' .. vim.lsp.get_log_path()) end, desc = "LSP logs" }, +} +--@end + +M.hovercraft = --@hovercraft +{ + { + "K", + function() + local hovercraft = require("hovercraft") + if hovercraft.is_visible() then hovercraft.enter_popup() else hovercraft.hover() end + end, + desc = "Hover" + }, +} +--@end + +M.trouble = --@trouble +{ + { "lt", group = _G.ABSTRACT_PLUGIN_GROUP.trouble }, + { "ltt", "Trouble diagnostics toggle", desc = "Diagnostics /project" }, + { "ltL", "Trouble loclist toggle", desc = "Location List" }, + { "ltT", "Trouble diagnostics toggle filter.buf=0", desc = "Diagnostics /buffer" }, + { "ltl", "Trouble lsp toggle focus=false win.position=right", desc = "LSP Definitions/references/..." }, + { "ltq", "Trouble qflist toggle", desc = "Quickfix List" }, + { "lts", "Trouble symbols toggle focus=false", desc = "Symbols" }, +} +--@end + +M.neo_tree = --@neo_tree +{ + { ";f", ":Neotree toggle", desc = "File Explorer(toggle)" }, +} +--@end + +M.hop = --@hop +{ + { "f", "lua require'hop'.hint_words()", desc = "Jump anywhere" }, +} +--@end + +M.goto_preview = --@goto_preview +{ + { "lp", group = _G.ABSTRACT_PLUGIN_GROUP.preview }, + { "lpd", function() require('goto-preview').goto_preview_definition({}) end, desc = "Definition preview" }, + { "lpt", function() require('goto-preview').goto_preview_type_definition({}) end, desc = "Type definition preview" }, + { "lpi", function() require('goto-preview').goto_preview_implementation({}) end, desc = "Implementation preview" }, + { "lpD", function() require('goto-preview').goto_preview_declaration({}) end, desc = "Declaration preview" }, + { "lpr", function() require('goto-preview').goto_preview_references() end, desc = "References preview" }, + { "lpQ", function() require('goto-preview').close_all_win() end, desc = "Close all window preview" }, +} +--@end + +M.oil = --@oil +{ + { "-", group = _G.ABSTRACT_PLUGIN_GROUP.files }, + { "-", "Oil", desc = "Open parent directory" }, +} +--@end + +M.git_graph = --@git_graph +{ + { "v", group = _G.ABSTRACT_PLUGIN_GROUP.git }, + { "vg", function() require("gitgraph").draw({}, { all = true, max_count = 5000 }) end, desc = "Git graph" }, +} +--@end + +M.code_runner = --@code_runner +{ + { "o", group = _G.ABSTRACT_PLUGIN_GROUP.run_code }, + { "oo", ":RunCode", desc = "Runs based on file type (Run Code)" }, + { "of", ":RunFile", desc = "Execute command from its key in current directory (Run Code)" }, + { "ot", ":RunFile tab", desc = "Run the current file (optionally you can select an opening mode)." }, + { "op", ":RunProject", desc = "Run the current project(If you are in a project otherwise you will not do anything)." }, + { "oq", ":RunClose", desc = "Close runner (Run Code)" }, + { "oj", ":CRFiletype", desc = "Open json with supported files (Run Code)" }, + { "oJ", ":CRProjects", desc = "Open json with list of projects (Run Code)" }, +} +--@end + +M.kulala = --@kulala +{ + { "r", group = _G.ABSTRACT_PLUGIN_GROUP.http }, + { "rr", "lua require('kulala').run()", desc = "Make HTTP request" }, + { "rh", "lua require('kulala').jump_prev()", desc = "Jump to the previous request" }, + { "rl", "lua require('kulala').jump_next()", desc = "Jump to the next request" }, + { "re", "lua require('kulala').set_selected_env()", desc = "Select environment" }, + { "rt", "lua require('kulala').toggle_view()", desc = "Response view /toggle" }, +} +--@end + +M.snacks = --@snacks +{ + { "L", group = _G.ABSTRACT_PLUGIN_GROUP.logs }, + { "Ln", "lua Snacks.notifier.show_history()", desc = "Notification history /snacks" }, +} +--@end + +M.snacks_bufdelete = --@snacks_bufdelete +{ + { "", group = _G.ABSTRACT_PLUGIN_GROUP.close }, + { "", "lua Snacks.bufdelete()", desc = "Delete current buffer" }, + { "", "lua Snacks.bufdelete.other()", desc = "Delete all buffers except the current one" }, +} +--@end + +M.snacks_lazygit = --@snacks_lazygit +{ + { "vL", group = _G.ABSTRACT_PLUGIN_GROUP.lazygit }, + { "vl", "lua Snacks.lazygit()", desc = "open lazygit" }, + { "vLl", "lua Snacks.lazygit.log()", desc = "log view" }, + { "vLf", "lua Snacks.lazygit.log_file()", desc = "log of the current file" }, +} +--@end + +M.snacks_gh = --@snacks_gh +{ + { "vg", group = _G.ABSTRACT_PLUGIN_GROUP.git_repos }, + { "vgp", "lua Snacks.picker.gh_pr()", desc = "Browse open pull requests" }, + { "vgP", "lua Snacks.picker.gh_pr({state='all'})", desc = "Browse open pull requests (All)" }, + { "vgi", "lua Snacks.picker.gh_issue()", desc = "Browse open issues" }, + { "vgI", "lua Snacks.picker.gh_issue({ state = 'all' })", desc = "Browse open issues (All)" }, +} +--@end + +M.snacks_gitbrowse = --@snacks_gitbrowse +{ + { "vm", group = _G.ABSTRACT_PLUGIN_GROUP.more_git }, + { "vmb", "lua Snacks.gitbrowse()", desc = "Git Browse" }, +} +--@end + +M.snacks_picker = --@snacks_picker +{ + { + { "", "lua Snacks.picker.buffers()", desc = "Buffers" }, + { "", "lua Snacks.picker.files()", desc = "Find Files /project" }, + { "", "lua Snacks.picker.files({ cwd = vim.fn.expand('%:p:h') })", desc = "Find Files /current", mode = { "n", "x" } }, + }, + { + { "", group = _G.ABSTRACT_PLUGIN_GROUP.find }, + { "g", "lua Snacks.picker.grep()", desc = "Find word /project" }, + { "w", "lua Snacks.picker.grep_word()", desc = "Find under Visual selection or word" }, + { "l", "lua Snacks.picker.lines()", desc = "Search Buffer Lines" }, + { "c", "lua Snacks.picker.commands()", desc = "Commands" }, + { "m", "lua Snacks.picker.keymaps()", desc = "Mappings" }, + { "h", "lua Snacks.picker.help()", desc = "Help" }, + { "p", "lua Snacks.picker.pick()", desc = "Snacks builtin cmds" }, + }, + { + { "m", group = _G.ABSTRACT_PLUGIN_GROUP.manager }, + { "mp", "lua Snacks.picker.projects()", desc = "Projects" }, + }, +} +--@end + +M.fff = --@fff +{ + { "", group = _G.ABSTRACT_PLUGIN_GROUP.find }, + { "", function() require('fff').find_files() end, desc = "Find Files /project" }, + { "", function() require('fff').find_files_in_dir(vim.fn.expand('%:p:h')) end, desc = "Find Files /current", mode = { "n", "x" } }, + { "", "lua Snacks.picker.buffers()", desc = "Buffers" }, + { "", "lua Snacks.picker.grep()", desc = "Find word /project" }, + { "", "lua Snacks.picker.grep_word()", desc = "Find under Visual selection or word" }, + -- { "", function() require('fff').live_grep() end, desc = "Find word /project" }, +} +--@end + +M.markview = --@markview +{} +--@end + +M.abstract_window = --@abstract_window +{ + mode = { "i", "n", "t" }, + { "", function() require("abs").window().toggle.maximize() end, desc = "Window maximizer /toggle" }, +} +--@end + +M.abstract_terminal = --@abstract_terminal +{ + mode = { "i", "n", "t" }, + { "", group = _G.ABSTRACT_PLUGIN_GROUP.terminal }, + { "", function() require("abs").terminal().toggle() end, desc = "Terminal /toggle" }, + { + mode = { "t" }, + { "n", function() require("abs").terminal().new() end, desc = "Open new terminal" }, + { "", function() require("abs").terminal().prev() end, desc = "Goto previous terminal" }, + { "", function() require("abs").terminal().next() end, desc = "Goto next terminal" }, + }, +} +--@end + +M.dap = --@dap +{ + { "d", group = _G.ABSTRACT_PLUGIN_GROUP.debug }, + { "db", function() require('dap').toggle_breakpoint() end, desc = "Breakpoint /toggle" }, + { "dc", function() require('dap').continue() end, desc = "Continue debug" }, + { "di", function() require('dap').step_into() end, desc = "Step into" }, + { "dl", function() require('dap').run_last() end, desc = "Run last" }, + { "do", function() require('dap').step_out() end, desc = "Step out" }, + { "dr", function() require('dap').repl.open() end, desc = "Open REPL" }, + { "ds", function() require('dap').step_over() end, desc = "Step over" }, + { + { "du", group = _G.ABSTRACT_PLUGIN_GROUP.ui }, + { "dup", function() require('dap.ui.widgets').preview() end, desc = "Preview widget" }, + { + "duf", + function() + local widgets = require('dap.ui.widgets') + widgets.centered_float(widgets.frames) + end, + desc = "Frames widget" + }, + { + "duc", + function() + local widgets = require('dap.ui.widgets') + widgets.centered_float(widgets.scopes) + end, + desc = "Scopes widget" + }, + }, +} +--@end + +M.grapple = --@grapple +{ + { "g", group = _G.ABSTRACT_PLUGIN_GROUP.go }, + { "gt", " Grapple open_tags", desc = "Show tags" }, + { "gl", " Grapple open_loaded", desc = "Show loaded" }, + { "gs", " Grapple open_scopes", desc = "Show scopes" }, + { "ga", " Grapple toggle", desc = "Tag /toggle" }, + { "gk", " Grapple toggle_tags", desc = "Tags /toggle" }, + { "gK", " Grapple toggle_scopes", desc = "Scopes /toggle" }, + { "gn", " Grapple cycle forward", desc = "Goto next tag" }, + { "gp", " Grapple cycle backward", desc = "Goto previous tag" }, + { "", " Grapple select index=1", desc = "Grapple select 1" }, + { "", " Grapple select index=2", desc = "Grapple select 2" }, + { "", " Grapple select index=3", desc = "Grapple select 3" }, + { "", " Grapple select index=4", desc = "Grapple select 4" }, + { "", " Grapple select index=5", desc = "Grapple select 5" }, +} +--@end + +M.session_manager = --@session_manager +{ + { "ms", group = _G.ABSTRACT_PLUGIN_GROUP.session }, + { "mS", ":SessionManager available_commands", desc = "Session commands" }, + { "msc", ":SessionManager available_commands", desc = "Session commands" }, + { "msl", ":SessionManager load_session", desc = "Load sessions" }, + { "msL", ":SessionManager load_current_dir_session", desc = "Load current dir session" }, + { "mss", ":SessionManager save_current_session", desc = "Save current session" }, + { "msd", ":SessionManager delete_session", desc = "Delete sessions" }, + { "msD", ":SessionManager delete_current_dir_session", desc = "Delete current dir sessions" }, +} +--@end + +return M diff --git a/code/src/neovim/editor/src/core/keymaps.rs b/code/src/neovim/editor/src/core/keymaps.rs new file mode 100644 index 0000000..370ffd2 --- /dev/null +++ b/code/src/neovim/editor/src/core/keymaps.rs @@ -0,0 +1,104 @@ +use std::sync::{LazyLock, Mutex}; + +use nvim_oxi::{self, mlua}; +use strum::IntoStaticStr; + +use crate::plugins::spec::extract_section_raw; + +const KEYMAPS: &str = include_str!("keymaps.lua"); + +#[allow(unused, clippy::enum_variant_names)] +#[derive(Hash, Eq, PartialEq, Debug, Clone, Copy, IntoStaticStr)] +#[strum(serialize_all = "snake_case")] +pub enum Key { + Builtin, + // + AbstractTerminal, + AbstractWindow, + CodeRunner, + Dap, + Fff, + GitGraph, + GotoPreview, + Grapple, + Hop, + Hovercraft, + Kulala, + LspConfig, + Markview, + NeoTree, + Oil, + SessionManager, + Snacks, + SnacksBufdelete, + SnacksGh, + SnacksGitBrowse, + SnacksLazygit, + SnacksPicker, + Trouble, + WhichKey, +} + +// Global static keymap +pub static MAPPING: LazyLock = LazyLock::new(Mapping::new); +pub static LOADED_PLUGINS: LazyLock>> = LazyLock::new(|| Mutex::new(Vec::new())); + +#[derive(Debug, Copy, Clone)] +pub struct Mapping; + +impl Mapping { + pub fn new() -> Self { + let _ = mlua::lua().load(KEYMAPS).exec().inspect_err(|e| { + eprintln!("{e}"); + }); + + Self + } + + /// Fire-and-forget signal. + pub fn signal(self, plugin: Key) { + if let Ok(mut loaded) = LOADED_PLUGINS.lock() { + loaded.push(plugin); + } else { + nvim_oxi::api::err_writeln("MapLoader: LOADED_PLUGINS mutex poisoned; signal ignored"); + } + } + + /// Registers all collected keymaps with which-key. + pub fn register_all(&self) -> nvim_oxi::Result<()> { + let loaded = LOADED_PLUGINS + .lock() + .map_err(|_| mlua::Error::RuntimeError("MapLoader: LOADED_PLUGINS mutex poisoned".to_string()))?; + + let lua = mlua::lua(); + + for plugin in loaded.iter().copied() { + let keymap = self.get_map(plugin); + let code = format!("require('which-key').add({})", keymap); + lua.load(&code).exec()?; + } + + Ok(()) + } +} + +#[allow(unused)] +impl Mapping { + pub fn set_map(&self, key: Key) -> nvim_oxi::Result<()> { + let which_key = format!("require'which-key'.add({})", self.get_map(key)); + mlua::lua().load(which_key).exec().inspect_err(|e| { + eprintln!("{e}"); + })?; + + Ok(()) + } + + pub fn set_map_str(&self, key: Key) -> &'static str { + Box::leak(format!("require'which-key'.add({})", self.get_map(key)).into_boxed_str()) + } + + pub fn get_map(&self, key: Key) -> &'static str { + let section: &'static str = key.into(); + extract_section_raw(KEYMAPS, section) + } +} diff --git a/code/src/neovim/editor/src/core/lsp.lua b/code/src/neovim/editor/src/core/lsp.lua new file mode 100644 index 0000000..7ba1aa5 --- /dev/null +++ b/code/src/neovim/editor/src/core/lsp.lua @@ -0,0 +1,149 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +LSP Configuration +Core LSP setup: diagnostics, client configs, and keymaps +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +--@setup + +-- ── Diagnostics ── +local severity = vim.diagnostic.severity + +vim.diagnostic.config({ + underline = true, + update_in_insert = true, + + virtual_text = { + prefix = function(_, index, _) + if index == 1 then + return " " .. "■" + end + return "■" + end, + current_line = true, + severity = { severity.ERROR, severity.WARN, severity.INFO, severity.HINT }, + }, + + float = { + border = "single", + focusable = true, + style = "minimal", + source = true, + header = "", + prefix = "", + }, + + signs = { + text = { + [severity.ERROR] = "", + [severity.WARN] = "", + [severity.INFO] = "", + [severity.HINT] = "", + }, + linehl = { + [severity.ERROR] = "DiagnosticSignError", + [severity.WARN] = "DiagnosticSignWarn", + [severity.INFO] = "DiagnosticSignInfo", + [severity.HINT] = "DiagnosticSignHint", + }, + numhl = { + [severity.ERROR] = "DiagnosticSignError", + [severity.WARN] = "DiagnosticSignWarn", + [severity.INFO] = "DiagnosticSignInfo", + [severity.HINT] = "DiagnosticSignHint", + }, + }, +}) + +-- ── LSP Keymaps (on attach) ── +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("ABSTRACT_LSP", { clear = true }), + pattern = "*", + desc = "Setup keymaps when LSP attaches", + callback = function() + require("which-key").add( --[[@rs $LSP_MAPPING ]]) + end, +}) + +-- ── LSP Client Configs ── +local configs = { + ["*"] = { + root_markers = { ".git" }, + capabilities = { + textDocument = { + semanticTokens = { + multilineTokenSupport = true, + }, + completion = { + completionItem = { + snippetSupport = true, + }, + }, + }, + }, + flags = { + debounce_text_changes = 150, + }, + }, + ["swift"] = { + capabilities = { + workspace = { + didChangeWatchedFiles = { + dynamicRegistration = true, + }, + }, + }, + }, + ["html"] = { + filetypes = { "html", "htmldjango" }, + }, + ["jsonls"] = { + settings = { + json = { + schemas = require("schemastore").json.schemas(), + validate = { enable = true }, + }, + }, + }, + ["pyright"] = { + settings = { + python = { + analysis = { + autoSearchPaths = true, + useLibraryCodeForTypes = true, + }, + }, + }, + }, + ["yamlls"] = { + settings = { + yaml = { + schemaStore = { + enable = false, + url = "", + }, + schemas = require("schemastore").yaml.schemas(), + }, + }, + }, + ["ccls"] = { + capabilities = { + textDocument = { + completion = { + completionItem = { + snippetSupport = true, + }, + }, + }, + }, + }, +} + +for lsp, config in pairs(configs) do + vim.lsp.config(lsp, config) +end + +--@end diff --git a/code/src/neovim/editor/src/core/mod.rs b/code/src/neovim/editor/src/core/mod.rs new file mode 100644 index 0000000..7188a6b --- /dev/null +++ b/code/src/neovim/editor/src/core/mod.rs @@ -0,0 +1,2 @@ +pub(crate) mod configs; +pub(crate) mod keymaps; diff --git a/code/src/neovim/editor/src/init.rs b/code/src/neovim/editor/src/init.rs new file mode 100644 index 0000000..e7e6780 --- /dev/null +++ b/code/src/neovim/editor/src/init.rs @@ -0,0 +1,85 @@ +use std::panic; + +use nvim_oxi::{self}; +use wp_autogood::{self}; +use wp_indent::setup_indent_autocmds; + +use crate::{ + core::{ + configs::Config, + keymaps, // + }, + plugins::lazy, + utils::{ + runtime, + trace::{self, NotifyLevel}, // + }, +}; + +#[nvim_oxi::plugin] +fn libabstract() -> nvim_oxi::Result<()> { + // Initialize tracing first so all subsequent code can use tracing macros + trace::init(); + tracing::info!("Abstract initializing..."); + + // Catch any panics so they show as error messages instead of killing Neovim + let result = panic::catch_unwind(plugins_init); + + match result { + Ok(Ok(())) => { + tracing::info!("Abstract initialized successfully"); + Ok(()) + }, + Ok(Err(e)) => { + let msg = format!("[Abstract] {e}"); + tracing::error!("{msg}"); + trace::vim_notify(&msg, NotifyLevel::Error); + Ok(()) + }, + Err(panic_info) => { + let panic_msg = if let Some(s) = panic_info.downcast_ref::<&str>() { + s.to_string() + } else if let Some(s) = panic_info.downcast_ref::() { + s.clone() + } else { + "Unknown panic".to_string() + }; + let msg = format!("[Abstract] PANIC: {panic_msg}"); + tracing::error!("{msg}"); + trace::vim_notify(&msg, NotifyLevel::Error); + Ok(()) + }, + } +} + +fn plugins_init() -> nvim_oxi::Result<()> { + Config::init()?; + plugins_setup()?; + runtime::spawn(async { + let _ = async_setup().await; + }); + + Ok(()) +} + +fn plugins_setup() -> nvim_oxi::Result<()> { + wp_autogood::Init::new().keymaps().autocmds(); + lazy::PluginManager::new()?; + + // indent + setup_indent_autocmds()?; + + // Register builtin keymaps + keymaps::MAPPING.set_map(keymaps::Key::Builtin)?; + // NOTE: this must be called after initilizing PluginManager as mapping depends on external plugin key-map + // setup which-key for builtin keymaps (keymaps that don't depends on 3rd parties plugins) + keymaps::MAPPING.register_all()?; + + Ok(()) +} + +async fn async_setup() -> anyhow::Result { + tokio::time::sleep(std::time::Duration::from_secs(1)).await; + + Ok("Hello from async setup!".into()) +} diff --git a/code/src/neovim/editor/src/lib.rs b/code/src/neovim/editor/src/lib.rs new file mode 100644 index 0000000..532a1d8 --- /dev/null +++ b/code/src/neovim/editor/src/lib.rs @@ -0,0 +1,4 @@ +mod core; +mod init; +mod plugins; +mod utils; diff --git a/code/src/neovim/editor/src/plugins/configs/abstract-cs.lua b/code/src/neovim/editor/src/plugins/configs/abstract-cs.lua new file mode 100644 index 0000000..4d075cf --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/abstract-cs.lua @@ -0,0 +1,25 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: Abstract-cs +Source: https://github.com/Abstract-IDE/Abstract-cs + +Colorscheme for (neo)vim written in lua, +specially made for roshnivim with Tree-sitter support. +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "Abstract-IDE/Abstract-cs", + branch = "rewrite-2", + lazy = false, + priority = 1000, +} + + +spec.config = function() + require("abstract_cs").setup() +end + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/abstract-cursor.lua b/code/src/neovim/editor/src/plugins/configs/abstract-cursor.lua new file mode 100644 index 0000000..5e28e96 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/abstract-cursor.lua @@ -0,0 +1,55 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: abstract-cursor +Source: https://github.com/Abstract-IDE/abstract-cursor + +dynamic cursor +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + + +local spec = { + "Abstract-IDE/abstract-cursor", + event = { "BufRead" }, + +} + +spec.opts = { + Visual = { + enable = true, + colors = {}, + }, + + CursorLine = { + enable = true, + colors = {}, + }, + + CursorLineNr = { + enable = true, + colors = { + i = { + fg = "#ac3131", + reverse = true, + }, + v = { + fg = "#d1d1d1", + reverse = true, + }, + reverse = true, + V = { + fg = "#ffffff", + reverse = true, + }, + ["^V"] = { + fg = "#d1d1d1", + reverse = true, + }, + }, + } + +} + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/abstract-line.lua b/code/src/neovim/editor/src/plugins/configs/abstract-line.lua new file mode 100644 index 0000000..d947679 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/abstract-line.lua @@ -0,0 +1,15 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: abstract-line +Source: https://github.com/Abstract-IDE/abstract-line + +status line for Abstract-IDE +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "Abstract-IDE/abstract-line", + opts = {}, +} diff --git a/code/src/neovim/editor/src/plugins/configs/abstract-plugs.lua b/code/src/neovim/editor/src/plugins/configs/abstract-plugs.lua new file mode 100644 index 0000000..52c43a5 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/abstract-plugs.lua @@ -0,0 +1,31 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: abstract-plugs.nvim +Source: https://github.com/Abstract-IDE/abstract-plugs.nvim + +collections of neovim plugins +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "Abstract-IDE/abstract-plugs.nvim", +} + +spec.config = function() + local abstract = require('abs') + abstract.window().setup() + abstract.terminal().setup({ + height = 0.4, + width = 0.6, + offset_row = 0.9, + offset_col = 0.5, + border = "rounded", + }) + abstract.whitespace().setup() + + --[[@rs $TERMINAL_MAPPING_SET ]] +end + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/autopairs.lua b/code/src/neovim/editor/src/plugins/configs/autopairs.lua new file mode 100644 index 0000000..5370fbd --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/autopairs.lua @@ -0,0 +1,17 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: nvim-autopairs +Source: https://github.com/windwp/nvim-autopairs + +autopairs for neovim written in lua +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "windwp/nvim-autopairs", + lazy = true, + event = "InsertEnter", + opts = {}, +} diff --git a/code/src/neovim/editor/src/plugins/configs/blink.lua b/code/src/neovim/editor/src/plugins/configs/blink.lua new file mode 100644 index 0000000..f40d0d5 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/blink.lua @@ -0,0 +1,295 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: blink.cmp +Source: https://github.com/Saghen/blink.cmp + +Performant, batteries-included completion plugin for Neovim +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + + +local spec = { + "saghen/blink.cmp", + lazy = false, + event = { "CmdlineEnter", "InsertEnter" }, + + -- use a release tag to download pre-built binaries + -- OR build from source, requires nightly-https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + version = "1.*", + -- allows extending the providers array elsewhere in your config without having to redefine it + opts_extend = { "sources.default" }, +} + +spec.opts = { + + enabled = function() + if vim.b.completion == false then + return false + end + local buftype = vim.bo.buftype + if + buftype == "prompt" + or buftype == "alpha" + or buftype == "neo-tree" + or buftype == "neo-tree-popup" + or buftype == "nofile" + or buftype == "TelescopePrompt" + then + return false + end + return true + end, + + -- https://cmp.saghen.dev/configuration/sources.html + sources = { + -- default = { "lsp", "path", "snippets", "buffer" }, + default = function() + local success, node = pcall(vim.treesitter.get_node) + if success and node and vim.tbl_contains({ "comment", "line_comment", "block_comment" }, node:type()) then + return { "path", "buffer" } + end + return { "lazydev", "lsp", "path", "snippets", "buffer" } + end, + providers = { + path = { + opts = { + -- Path completion from cwd instead of current buffer's directory + -- get_cwd = function(_) + -- return vim.fn.getcwd() + -- end, + }, + }, + lazydev = { + name = "LazyDev", + module = "lazydev.integrations.blink", + -- make lazydev completions top priority (see `:h blink.cmp`) + score_offset = 100, + }, + }, + }, + + -- https://cmp.saghen.dev/configuration/snippets.html + snippets = { + --NOTE: luasnip needs to be properly setup with blink + preset = "luasnip", + -- expand = function(snippet) + -- local luasnip = require("abstract.plugins.LuaSnip").setup() + -- luasnip.lsp_expand(snippet) + -- end, + -- active = function(filter) + -- local luasnip = require("abstract.plugins.LuaSnip").setup() + -- if filter and filter.direction then + -- return luasnip.jumpable(filter.direction) + -- end + -- return luasnip.in_snippet() + -- end, + -- jump = function(direction) + -- local luasnip = require("abstract.plugins.LuaSnip").setup() + -- luasnip.jump(direction) + -- end, + }, + + signature = { + enabled = true, + window = { + border = "single", + show_documentation = false, -- only show the signature, and not the documentation. + }, + }, + + -- https://cmp.saghen.dev/configuration/fuzzy + fuzzy = { + implementation = "prefer_rust_with_warning", + sorts = { + "exact", + -- default sorts + "score", + "sort_text", + }, + }, + + completion = { + -- https://cmp.saghen.dev/configuration/completion.html#keyword + -- 'prefix' will fuzzy match on the text before the cursor + -- 'full' will fuzzy match on the text before _and_ after the cursor + -- example: 'foo_|_bar' will match 'foo_' for 'prefix' and 'foo__bar' for 'full' + keyword = { range = "full" }, + + trigger = { + -- SRC: https://cmp.saghen.dev/configuration/completion.html#trigger + show_in_snippet = true, -- When false, will not show the completion window automatically when in a snippet + show_on_keyword = true, -- Shows after typing a keyword, typically an alphanumeric character or _ + show_on_trigger_character = true, -- Shows after typing a trigger character, defined by the sources. For example for Lua or Rust, the LSP will define . as a trigger character. + show_on_insert_on_trigger_character = true, -- Shows after entering insert mode on top of a trigger character. + }, + + -- https://cmp.saghen.dev/configuration/completion.html#list-go-to-default-configuration + list = { + -- Maximum number of items to display + max_items = 200, + selection = { + preselect = false, + auto_insert = true, + }, + + cycle = { + -- When `true`, calling `select_next` at the _bottom_ of the completion list will select the _first_ completion item. + -- from_bottom = true, + -- When `true`, calling `select_prev` at the _top_ of the completion list will select the _last_ completion item. + -- from_top = true, + }, + }, + accept = { + -- Create an undo point when accepting a completion item + create_undo_point = true, + }, + -- Displays a preview of the selected item on the current line + ghost_text = { + enabled = false, + }, + menu = { + enabled = true, + min_width = 10, + max_height = 16, + border = "rounded", + scrolloff = 0, -- keep the cursor X lines away from the top/bottom of the window + + draw = { + align_to = "none", -- Aligns the keyword you've typed to a component in the menu. 'label' or 'none' to disable, or 'cursor' to align to the cursor + -- columns = { { "kind_icon", "label", "kind", gap = 1 } }, + columns = { { "kind_icon", "label", gap = 2 } }, + components = { + label = { + width = { max = 40, fill = true }, + text = function(ctx) + return require("colorful-menu").blink_components_text(ctx) + end, + highlight = function(ctx) + return require("colorful-menu").blink_components_highlight(ctx) + end, + }, + }, + }, + + -- draw = { + -- -- padding = 1, -- Left and right padding, optionally { left, right } for different padding on each side + -- -- gap = 1, -- Gap between columns + + -- align_to = "none", -- Aligns the keyword you've typed to a component in the menu. 'label' or 'none' to disable, or 'cursor' to align to the cursor + -- treesitter = { "lsp" }, -- Use treesitter to highlight the label text for the given list of sources + -- columns = { { "kind_icon", "label", "label_description", "kind" } }, + -- components = { + -- kind_icon = { + -- text = function(ctx) + -- return ctx.kind_icon .. " " + -- end, + -- }, + -- label = { + -- width = { max = 30, fill = false }, + -- }, + -- label_description = { + -- width = { max = 14, fill = true }, + -- text = function(ctx) + -- return " " .. ctx.label_description + -- end, + -- }, + -- kind = { + -- ellipsis = false, + -- width = { fill = false }, + -- }, + -- }, + -- }, + }, + documentation = { + auto_show = true, + auto_show_delay_ms = 500, -- Delay before showing the documentation window + update_delay_ms = 150, -- Delay before updating the documentation window when selecting a new item, while an existing item is still visible + -- Whether to use treesitter highlighting, disable if you run into performance issues + treesitter_highlighting = true, + window = { + max_width = 60, + max_height = 20, + border = "rounded", + }, + }, + }, + appearance = { + -- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + + kind_icons = { + Text = "", + Method = "", + Function = "ƒ", + Constructor = "󰒓", + + Field = "󰜢", + Variable = "󰆦", + Property = "󰖷", + + Class = "", + Interface = "", + Struct = "", + Module = "󰅩", + + Unit = "", + Value = "󰦨", + Enum = "", + EnumMember = "", + + Keyword = "󰻾", + Constant = "󰏿", + + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "󰉋", + Event = "", + Operator = "", + TypeParameter = " ", + }, + }, + + cmdline = { + enabled = true, + keymap = { + preset = "inherit", + }, + completion = { + menu = { auto_show = true }, + ghost_text = { enabled = true }, + + list = { + selection = { + preselect = false, + auto_insert = true, + }, + }, + }, + }, + + -- When specifying 'preset' in the keymap table, the custom key mappings are merged with the preset, + -- and any conflicting keys will overwrite the preset mappings. + -- The "fallback" command will run the next non blink keymap. + keymap = { + [""] = { "show", "show_documentation", "hide_documentation" }, + [""] = { "hide", "fallback" }, + [""] = { "accept", "fallback" }, + + [""] = { "select_prev", "fallback" }, + [""] = { "select_next", "fallback" }, + + [""] = { "select_next", "snippet_forward", "fallback" }, + [""] = { "select_prev", "snippet_backward", "fallback" }, + + [""] = { "scroll_documentation_up", "fallback" }, + [""] = { "scroll_documentation_down", "fallback" }, + }, +} + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/bqf.lua b/code/src/neovim/editor/src/plugins/configs/bqf.lua new file mode 100644 index 0000000..42afa88 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/bqf.lua @@ -0,0 +1,38 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: nvim-bqf +Source: https://github.com/kevinhwang91/nvim-bqf + +Better quickfix window in Neovim, polish old quickfix window. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + 'kevinhwang91/nvim-bqf', + lazy = false, + opts = { + auto_enable = true, + auto_resize_height = true, + preview = { + delay_syntax = 400, + show_title = true, + }, + -- make `drop` and `tab drop` to become preferred + func_map = { + drop = "o", + openc = "O", + split = "", + tabdrop = "", + tabc = "", + ptogglemode = "z,", + }, + filter = { + fzf = { + action_for = { ["ctrl-s"] = "split", ["ctrl-t"] = "tab drop" }, + extra_opts = { "--bind", "ctrl-o:toggle-all", "--prompt", "> " }, + }, + }, + }, +} diff --git a/code/src/neovim/editor/src/plugins/configs/code-runner.lua b/code/src/neovim/editor/src/plugins/configs/code-runner.lua new file mode 100644 index 0000000..3751097 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/code-runner.lua @@ -0,0 +1,24 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: code_runner.nvim +Source: https://github.com/CRAG666/code_runner.nvim + +Neovim plugin. The best code runner you could have, +it is like the one in vscode but with super powers, +it manages projects like in intellij but without being slow +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "CRAG666/code_runner.nvim", + event = { "BufRead", "BufNewFile", }, + cmd = "RunCode", +} + +spec.config = function() + --[[@rs $MAPPING_SET ]] +end + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/colorful-menu.lua b/code/src/neovim/editor/src/plugins/configs/colorful-menu.lua new file mode 100644 index 0000000..753b2a0 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/colorful-menu.lua @@ -0,0 +1,23 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: colorful-menu.nvim +Source: https://github.com/xzbdmw/colorful-menu.nvim + +Bring enjoyment to your auto completion. +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "xzbdmw/colorful-menu.nvim", + lazy = true, + opts = { + -- If provided, the plugin truncates the final displayed text to + -- this width (measured in display cells). Any highlights that extend + -- beyond the truncation point are ignored. When set to a float + -- between 0 and 1, it'll be treated as percentage of the width of + -- the window: math.floor(max_width * vim.api.nvim_win_get_width(0)) + max_width = 40, + } +} diff --git a/code/src/neovim/editor/src/plugins/configs/colorizer.lua b/code/src/neovim/editor/src/plugins/configs/colorizer.lua new file mode 100644 index 0000000..8845e48 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/colorizer.lua @@ -0,0 +1,40 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: nvim-colorizer.lua +Source: https://github.com/catgoose/nvim-colorizer.lua + +A high-performance color highlighter for Neovim which has +no external dependencies! Written in performant Luajit. + +NOTE: +Originally NvChad (https://github.com/NvChad/nvim-colorizer.lua) +forked it from https://github.com/norcalli/nvim-colorizer.lua +now it moved to https://github.com/catgoose/nvim-colorizer.lua +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "catgoose/nvim-colorizer.lua", + event = { "BufReadPre", "BufNewFile", "InsertEnter" }, + opts = { + user_default_options = { + names = false, + RRGGBBAA = true, + AARRGGBB = true, + rgb_fn = true, + hsl_fn = true, + mode = "background", + virtualtext = "■", + }, + + -- all the sub-options of filetypes apply to buftypes + filetypes = { + "*", + css = { rgb_fn = true, names = true }, + }, + + buftypes = {}, + } +} diff --git a/code/src/neovim/editor/src/plugins/configs/comment_nvim.lua b/code/src/neovim/editor/src/plugins/configs/comment_nvim.lua new file mode 100644 index 0000000..5f8b0c3 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/comment_nvim.lua @@ -0,0 +1,73 @@ +--[[ + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: Comment.nvim +Source: https://github.com/numToStr/Comment.nvim + +🧠 💪 // Smart and powerful comment plugin for neovim. +Supports treesitter, dot repeat, left-right/up-down motions, hooks, and more +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "numToStr/Comment.nvim", + keys = { "cc", "gc", "gb", { "cc", mode = "v" }, { "gc", mode = "v" }, { "gb", mode = "v" } }, + dependencies = { + --[[@rs $TS_CONTEXT_COMMENTSTRING, ]] + }, +} + +spec.opts = { + ---Add a space b/w comment and the line + ---@type boolean + padding = true, + + ---Whether the cursor should stay at its position + ---NOTE: This only affects NORMAL mode mappings and doesn't work with dot-repeat + ---@type boolean + sticky = true, + + ---Lines to be ignored while comment/uncomment. + ---Could be a regex string or a function that returns a regex string. + ---Example: Use '^$' to ignore empty lines + ---@type string|function + ignore = "^$", + + ---Post-hook, called after commenting is done + ---@type function|nil + post_hook = nil, + + mappings = { + basic = true, + extra = true, + extended = false, + }, + + ---LHS of toggle mapping in NORMAL + ---@type table + toggler = { + line = "cc", ---line-comment keymap + block = "cb", ---block-comment keymap + }, + + ---LHS of operator-pending mapping in VISUAL mode + ---@type table + opleader = { + line = "gc", ---line-comment keymap + block = "gb", ---block-comment keymap + }, +} + +spec.config = function(_, opts) + --[[@rs $HOOK_SETUP ]] + + ---Pre-hook, called before commenting the line + -- NOTE: implemented with JoosepAlviste/nvim-ts-context-commentstring + opts.pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook() + require("Comment").setup(opts) +end + + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/comment_nvim.rs b/code/src/neovim/editor/src/plugins/configs/comment_nvim.rs new file mode 100644 index 0000000..e21b29e --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/comment_nvim.rs @@ -0,0 +1,27 @@ +/* +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: Comment.nvim +Source: https://github.com/numToStr/Comment.nvim + +🧠 💪 // Smart and powerful comment plugin for neovim. +Supports treesitter, dot repeat, left-right/up-down motions, hooks, and more +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +*/ + +use crate::{lua_section, lua_spec}; + +pub struct Plugin; + +impl Plugin { + pub fn spec() -> crate::plugins::spec::SpecInfo { + lua_spec!( + "comment_nvim.lua", + &[ + ("TS_CONTEXT_COMMENTSTRING", lua_section!("ts-context-commentstring.lua", "spec")), + ("HOOK_SETUP", lua_section!("ts-context-commentstring.lua", "setup")), + ] + ) + } +} diff --git a/code/src/neovim/editor/src/plugins/configs/csvview.lua b/code/src/neovim/editor/src/plugins/configs/csvview.lua new file mode 100644 index 0000000..38b8e6e --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/csvview.lua @@ -0,0 +1,27 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: csvview.nvim +Source: https://github.com/hat0uma/csvview.nvim + +lightweight CSV file viewer plugin for Neovim. +With this plugin, you can easily view and edit CSV files within Neovim. +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + 'hat0uma/csvview.nvim', + lazy = true, + ft = "csv", + opts = { + view = { + ---@type integer + min_column_width = 5, + ---@type integer + spacing = 2, + ---@type "highlight" | "border" + display_mode = "highlight", + }, + } +} diff --git a/code/src/neovim/editor/src/plugins/configs/dap.lua b/code/src/neovim/editor/src/plugins/configs/dap.lua new file mode 100644 index 0000000..1d1e8e5 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/dap.lua @@ -0,0 +1,61 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: nvim-dap +Source: https://github.com/mfussenegger/nvim-dap +Debug Adapter Protocol client implementation for Neovim +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "mfussenegger/nvim-dap", + dependencies = { + --[[ + ──────────────────────────────────────────────── + Plugin: nvim-dap-ui + Source: https://github.com/rcarriga/nvim-dap-ui + A UI for nvim-dap which provides a good out of the box configuration. + ──────────────────────────────────────────────── + --]] + { + "rcarriga/nvim-dap-ui", + config = function() + local dapui = require("dapui") + dapui.setup() + + local dap = require("dap") + -- nvim-dap events to open and close the windows automatically (:help dap-extensions) + dap.listeners.before.attach.dapui_config = function() + dapui.open() + end + dap.listeners.before.launch.dapui_config = function() + dapui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + dapui.close() + end + end, + }, + --[[ + ──────────────────────────────────────────────── + Plugin: nvim-dap-virtual-text + Source: https://github.com/theHamsta/nvim-dap-virtual-text + This plugin adds virtual text support to nvim-dap. + ──────────────────────────────────────────────── + --]] + { + "theHamsta/nvim-dap-virtual-text", + virt_text_pos = 'eol', + }, + }, +} + +spec.config = function() + --[[@rs $MAPPING_SET ]] +end + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/dart-vim-plugin.lua b/code/src/neovim/editor/src/plugins/configs/dart-vim-plugin.lua new file mode 100644 index 0000000..db8a3f5 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/dart-vim-plugin.lua @@ -0,0 +1,22 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: dart-vim-plugin +Source: https://github.com/dart-lang/dart-vim-plugin + +dart-vim-plugin provides filetype detection, syntax highlighting, +and indentation for Dart code in Vim. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "dart-lang/dart-vim-plugin", + lazy = true, + ft = { "dart" }, + config = function() + vim.g.dart_html_in_string = "v.true" + vim.g.dart_style_guide = 2 + vim.g.dart_format_on_save = 0 + end, +} diff --git a/code/src/neovim/editor/src/plugins/configs/dropbar-nvim.lua b/code/src/neovim/editor/src/plugins/configs/dropbar-nvim.lua new file mode 100644 index 0000000..ed6c483 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/dropbar-nvim.lua @@ -0,0 +1,67 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: dropbar.nvim +Source: https://github.com/Bekaboo/dropbar.nvim + +IDE-like breadcrumbs, out of the box +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "Bekaboo/dropbar.nvim", + event = { "BufRead" }, + lazy = true, + + -- optional, but required for fuzzy finder support + dependencies = { + 'nvim-telescope/telescope-fzf-native.nvim', + build = 'make', + lazy = true, + }, +} + +spec.config = function() + local sources = require('dropbar.sources') + + local custom_path = { + get_symbols = function(buff, win, cursor) + local symbols = sources.path.get_symbols(buff, win, cursor) + symbols[#symbols].name_hl = 'DropBarFileName' + if vim.bo[buff].modified then + symbols[#symbols].name = symbols[#symbols].name .. '●' + symbols[#symbols].name_hl = 'DiffChange' + end + -- from filename (don't show dir) + return { symbols[#symbols] } + end, + } + + require("dropbar").setup({ + bar = { + sources = function(buf, _) + if vim.bo[buf].ft == 'markdown' then + return { + custom_path, + sources.markdown, + } + end + if vim.bo[buf].buftype == 'terminal' then + return { + sources.terminal, + } + end + return { + custom_path, + require('dropbar.utils').source.fallback { + sources.lsp, + sources.treesitter, + }, + } + end, + }, + }) +end + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/fff.lua b/code/src/neovim/editor/src/plugins/configs/fff.lua new file mode 100644 index 0000000..a25e602 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/fff.lua @@ -0,0 +1,92 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: fff.nvim +Source: https://github.com/dmtrKovalenko/fff.nvim + +Finally a smart fuzzy file picker for neovim. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "dmtrKovalenko/fff.nvim", + build = function() + require("fff.download").download_or_build_binary() + end, + --[[@rs keys = $MAPPING, ]] +} + +spec.opts = { + base_path = vim.fn.getcwd(), + prompt = '🔎 ', + title = 'Find files', + max_results = 100, + max_threads = 4, + lazy_sync = true, + layout = { + height = 0.9, + width = 0.9, + prompt_position = 'top', + preview_position = 'right', -- or 'left', 'right', 'top', 'bottom' + preview_size = 0.5, + show_scrollbar = false, -- Show scrollbar for pagination + flex = { -- set to false to disable flex layout + size = 80, -- column threshold: if screen width >= size, use preview_position; otherwise use wrap + wrap = 'bottom', -- position to use when screen is narrower than size + }, + }, + preview = { + enabled = true, + max_size = 10 * 1024 * 1024, + chunk_size = 8192, + binary_file_threshold = 1024, + imagemagick_info_format_str = '%m: %wx%h, %[colorspace], %q-bit', + line_numbers = false, + wrap_lines = false, + show_file_info = true, + filetypes = { + svg = { wrap_lines = true }, + markdown = { wrap_lines = true }, + text = { wrap_lines = true }, + }, + }, + keymaps = { + close = '', + select = '', + select_split = '', + select_vsplit = '', + select_tab = '', + move_up = { '', '', '' }, + move_down = { '', '', '' }, + preview_scroll_up = '', + preview_scroll_down = '', + toggle_debug = '', + }, + hl = { + border = 'FloatBorder', + normal = 'Normal', + cursor = 'CursorLine', + matched = 'IncSearch', + title = 'Title', + prompt = 'Question', + active_file = 'Visual', + frecency = 'Number', + debug = 'Comment', + }, + frecency = { + enabled = true, + db_path = vim.fn.stdpath('cache') .. '/fff_nvim', + }, + debug = { + enabled = false, + show_scores = false, + }, + logging = { + enabled = true, + log_file = vim.fn.stdpath('log') .. '/fff.log', + log_level = 'info', + } +} + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/fidget.lua b/code/src/neovim/editor/src/plugins/configs/fidget.lua new file mode 100644 index 0000000..d6f7697 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/fidget.lua @@ -0,0 +1,23 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: fidget.nvim +Source: https://github.com/j-hui/fidget.nvim + +💫 Extensible UI for Neovim notifications and LSP progress messages. +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "j-hui/fidget.nvim", + lazy = true, + event = { "LspAttach" }, + opts = { + notification = { + window = { + winblend = 100, + } + } + } +} diff --git a/code/src/neovim/editor/src/plugins/configs/flutter-tools.lua b/code/src/neovim/editor/src/plugins/configs/flutter-tools.lua new file mode 100644 index 0000000..6a2aa6b --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/flutter-tools.lua @@ -0,0 +1,20 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: flutter-tools.nvim +Source: https://github.com/nvim-flutter/flutter-tools.nvim + +Tools to help create flutter apps in neovim using the native lsp +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "nvim-flutter/flutter-tools.nvim", + lazy = false, + opts = { + widget_guides = { + enabled = true, + }, + }, +} diff --git a/code/src/neovim/editor/src/plugins/configs/gitgraph.lua b/code/src/neovim/editor/src/plugins/configs/gitgraph.lua new file mode 100644 index 0000000..afecebb --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/gitgraph.lua @@ -0,0 +1,31 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: gitgraph.nvim +Source: https://github.com/isakbm/gitgraph.nvim +Git Graph plugin for neovim. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "isakbm/gitgraph.nvim", + dependencies = { "sindrets/diffview.nvim" }, + event = { "CmdlineEnter", "BufRead", "BufNewFile", "InsertEnter" }, +} + +spec.config = function() + require('gitgraph').setup({ + symbols = { + merge_commit = "M", + commit = "*", + }, + format = { + timestamp = "%H:%M:%S %d-%m-%Y", + fields = { "hash", "timestamp", "author", "branch_name", "tag" }, + }, + }) + --[[@rs $MAPPING_SET ]] +end + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/gitsigns.lua b/code/src/neovim/editor/src/plugins/configs/gitsigns.lua new file mode 100644 index 0000000..f23b0e7 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/gitsigns.lua @@ -0,0 +1,57 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: gitsigns.nvim +Source: https://github.com/lewis6991/gitsigns.nvim + +Deep buffer integration for Git + + ┃ ┃ │ ┆ +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "lewis6991/gitsigns.nvim", + lazy = true, + event = { "BufReadPre", "BufNewFile", "InsertEnter" }, + 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 = { + follow_files = true, + }, + auto_attach = true, + attach_to_untracked = false, + current_line_blame = false, + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", + delay = 1000, + ignore_whitespace = false, + virt_text_priority = 100, + }, + current_line_blame_formatter = ", - ", + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, + max_file_length = 40000, + preview_config = { + border = "single", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + }, + }, +} diff --git a/code/src/neovim/editor/src/plugins/configs/goto-preview.lua b/code/src/neovim/editor/src/plugins/configs/goto-preview.lua new file mode 100644 index 0000000..a8824e5 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/goto-preview.lua @@ -0,0 +1,39 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: goto-preview +Source: https://github.com/rmagatti/goto-preview +A small Neovim plugin for previewing native LSP's goto definition, type definition, +implementation, declaration and references calls in floating windows. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "rmagatti/goto-preview", + event = { "LspAttach" }, +} + +spec.config = function() + require("goto-preview").setup({ + width = 80, + height = 15, + border = { "↖", "─", "┐", "│", "┘", "─", "└", "│" }, + default_mappings = false, + debug = false, + opacity = nil, + resizing_mappings = false, + post_close_hook = nil, + references = {}, + focus_on_open = true, + dismiss_on_move = false, + force_close = true, + bufhidden = "wipe", + stack_floating_preview_windows = true, + preview_window_title = { enable = true, position = "left" }, + zindex = 1, + }) + --[[@rs $MAPPING_SET ]] +end + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/grapple.lua b/code/src/neovim/editor/src/plugins/configs/grapple.lua new file mode 100644 index 0000000..37b4d76 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/grapple.lua @@ -0,0 +1,23 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: grapple-nvim +Source: https://github.com/cbochs/grapple.nvim + +Grapple is a plugin that aims to provide immediate navigation +to important files (and their last known cursor location). +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "cbochs/grapple.nvim", + event = { "BufReadPost", "BufNewFile" }, + cmd = "Grapple", + opts = { + ---@type boolean + icons = true, + ---@type "basename" | "relative" + style = "basename", + }, +} diff --git a/code/src/neovim/editor/src/plugins/configs/helpview.lua b/code/src/neovim/editor/src/plugins/configs/helpview.lua new file mode 100644 index 0000000..878bc66 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/helpview.lua @@ -0,0 +1,16 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: helpview.nvim +Source: https://github.com/OXY2DEV/helpview.nvim + +An impractical way to view vimdoc/help files +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "OXY2DEV/helpview.nvim", + ft = "help", + opts = {}, +} diff --git a/code/src/neovim/editor/src/plugins/configs/hop.lua b/code/src/neovim/editor/src/plugins/configs/hop.lua new file mode 100644 index 0000000..7d649ff --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/hop.lua @@ -0,0 +1,25 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: hop.nvim +Source: https://github.com/smoka7/hop.nvim + (forked of: https://github.com/phaazon/hop.nvim) + +Hop is an EasyMotion-like plugin allowing you to jump +anywhere in a document with as few keystrokes as possible +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "smoka7/hop.nvim", + version = "*", + --[[@rs keys= $MAPPING, ]] +} + +spec.opts = { + keys = "qwertyuiopasdfghjklzxcvbnm", + jump_on_sole_occurrence = false, +} + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/hovercraft.lua b/code/src/neovim/editor/src/plugins/configs/hovercraft.lua new file mode 100644 index 0000000..30543d6 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/hovercraft.lua @@ -0,0 +1,42 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: hovercraft.nvim +Source: https://github.com/patrickpichler/hovercraft.nvim + +hovercraft.nvim is a plug and play framework for writing custom hover provider. +It brings a few providers out of the box, such as a LSP, as well as a Dictionary. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "patrickpichler/hovercraft.nvim", + lazy = true, + --[[@rs keys=$MAPPING, ]] +} + +spec.config = function() + return { + providers = { + providers = { + { "LSP", require("hovercraft.provider.lsp.hover").new() }, + { "Man", require("hovercraft.provider.man").new() }, + { "Dictionary", require("hovercraft.provider.dictionary").new() }, + }, + }, + + window = { + border = "rounded", + }, + + keys = { + { "", function() require("hovercraft").scroll({ delta = -2 }) end }, + { "", function() require("hovercraft").scroll({ delta = 2 }) end }, + { "", function() require("hovercraft").hover_next() end }, + { "", function() require("hovercraft").hover_next({ step = -1 }) end }, + }, + } +end + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/java.lua b/code/src/neovim/editor/src/plugins/configs/java.lua new file mode 100644 index 0000000..36e09c4 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/java.lua @@ -0,0 +1,16 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: nvim-java +Source: https://github.com/nvim-java/nvim-java + +Painless Java in Neovim +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "nvim-java/nvim-java", + ft = { "java", "kotlin" }, + opts = {}, +} diff --git a/code/src/neovim/editor/src/plugins/configs/kulala.lua b/code/src/neovim/editor/src/plugins/configs/kulala.lua new file mode 100644 index 0000000..bf58294 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/kulala.lua @@ -0,0 +1,42 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: kulala.nvim +Source: https://github.com/mistweaverco/kulala.nvim +A minimal REST-Client Interface for Neovim. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "mistweaverco/kulala.nvim", + lazy = true, + ft = "http", +} + +spec.config = function() + require("kulala").setup({ + split_direction = "horizontal", + default_view = "body", + default_env = "dev", + debug = false, + formatters = { + json = { "jq", "." }, + xml = { "xmllint", "--format", "-" }, + html = { "xmllint", "--format", "--html", "-" }, + }, + icons = { + inlay = { + loading = "⏳", + done = "✅", + error = "❌", + }, + lualine = "🐼", + }, + additional_curl_options = {}, + winbar = false, + }) + --[[@rs $MAPPING_SET ]] +end + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/lazy.lua b/code/src/neovim/editor/src/plugins/configs/lazy.lua new file mode 100644 index 0000000..3c51f2e --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/lazy.lua @@ -0,0 +1,61 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: lazy.nvim +Source: https://github.com/folke/lazy.nvim + +💤 A modern plugin manager for Neovim +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local setup = function() + require("lazy").setup({ + + --[[@rs spec = $SPEC, ]] + + root = "--[[@rs $NVIM_PLUGINS_HOME ]]", -- directory where plugins will be installed + -- TODO: change it later with proper path + lockfile = "--[[@rs $NVIM_LOCK_PATH ]]" .. "/plugin-lock.json", -- lockfile generated after running update. + + performance = { + cache = { enabled = true }, + reset_packpath = true, -- reset the package path to improve startup time + rtp = { + reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory + -- add any custom paths here that you want to includes in the rtp + ---@type string[] + paths = { + -- ABSTRACT["INSTALL_PATH"], + "--[[@rs $NVIM_TS_HOME ]]" + }, + ---@type string[] list any plugins you want to disable here + disabled_plugins = { "tutor" }, -- "gzip", "matchit", "matchparen", "netrwPlugin", "tarPlugin", "tohtml", "zipPlugin", + + }, + + install = { + -- install missing plugins on startup. This doesn't increase startup time. + missing = true, + -- try to load one of these colorschemes when starting an installation during startup + colorscheme = { "abscs", "default" }, + }, + + ui = { + -- a number <1 is a percentage., >1 is a fixed size + size = { width = 0.8, height = 0.8 }, + wrap = true, -- wrap the lines in the ui + border = "rounded", -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|. + title_pos = "center", ---@type "center" | "left" | "right" + throttle = 20, -- how frequently should the ui process render events + backdrop = 100, -- The backdrop opacity. 0 is fully opaque, 100 is fully transparent. + }, + } + }) +end + +local ok, err = pcall(setup) + +if not ok then + vim.notify("[Abstract] lazy.nvim setup failed:\n" .. tostring(err), vim.log.levels.ERROR) +end diff --git a/code/src/neovim/editor/src/plugins/configs/lazydev-nvim.lua b/code/src/neovim/editor/src/plugins/configs/lazydev-nvim.lua new file mode 100644 index 0000000..b5050b6 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/lazydev-nvim.lua @@ -0,0 +1,26 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: lazydev.nvim +Source: https://github.com/folke/lazydev.nvim + +plugin that properly configures LuaLS for editing your Neovim config by +lazily updating your workspace libraries. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "folke/lazydev.nvim", + ft = "lua", +} + +spec.opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + }, +} + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/luasnip.lua b/code/src/neovim/editor/src/plugins/configs/luasnip.lua new file mode 100644 index 0000000..173ae73 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/luasnip.lua @@ -0,0 +1,37 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: LuaSnip +Source: https://github.com/L3MON4D3/LuaSnip + +Snippet Engine for Neovim written in Lua. +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "L3MON4D3/LuaSnip", + version = "v2.*", + build = "make install_jsregexp", + lazy = true, + dependencies = { + { "rafamadriz/friendly-snippets", lazy = true }, + { "Neevash/awesome-flutter-snippets", lazy = true, ft = "dart" }, + }, + config = function() + local luasnip = require("luasnip") + + luasnip.config.set_config({ + history = false, + update_events = "TextChanged,TextChangedI", + region_check_events = "CursorMoved", + }) + + luasnip.filetype_extend("javascriptreact", { "html" }) + luasnip.filetype_extend("typescriptreact", { "html" }) + luasnip.filetype_extend("htmldjango", { "html" }) + + local from_vscode = require("luasnip.loaders.from_vscode") + from_vscode.lazy_load() + end +} diff --git a/code/src/neovim/editor/src/plugins/configs/markdown-preview.lua b/code/src/neovim/editor/src/plugins/configs/markdown-preview.lua new file mode 100644 index 0000000..bcee4b0 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/markdown-preview.lua @@ -0,0 +1,21 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: markdown-preview.nvim +Source: https://github.com/iamcco/markdown-preview.nvim + +Preview Markdown in your modern browser with synchronised +scrolling and flexible configuration. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + ft = { "markdown" }, + build = "cd app && yarn install", + init = function() + vim.g.mkdp_filetypes = { "markdown" } + end, +} diff --git a/code/src/neovim/editor/src/plugins/configs/markview.lua b/code/src/neovim/editor/src/plugins/configs/markview.lua new file mode 100644 index 0000000..bc65b93 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/markview.lua @@ -0,0 +1,31 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: markview.nvim +Source: https://github.com/OXY2DEV/markview.nvim +A hackable markdown, Typst, latex, html(inline) & YAML previewer for Neovim +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "OXY2DEV/markview.nvim", + lazy = false, +} + +spec.config = function() + require("markview").setup({ + experimental = { + check_rtp = false + }, + html = { enable = false }, + latex = { enable = false }, + markdown = { enable = false }, + markdown_inline = { enable = false }, + typst = { enable = false }, + yaml = { enable = false }, + }) + --[[@rs $MAPPING_SET ]] +end + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/mason-lspconfig.lua b/code/src/neovim/editor/src/plugins/configs/mason-lspconfig.lua new file mode 100644 index 0000000..d95d5df --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/mason-lspconfig.lua @@ -0,0 +1,35 @@ +--[[ +──────────────────────────────────────────────── +Plugin: mason-lspconfig.nvim +Source: https://github.com/mason-org/mason-lspconfig.nvim + +Extension to mason.nvim that makes it easier to use lspconfig with mason.nvim. +──────────────────────────────────────────────── +--]] + + +local _ = --@spec +{ + "mason-org/mason-lspconfig.nvim", + lazy = true, + dependencies = { + { "neovim/nvim-lspconfig", lazy = true }, + }, +} +--@end + +--@setup +require("mason-lspconfig").setup({ + automatic_enable = { + true, -- will automatically enable (vim.lsp.enable()) installed servers + exclude = { + "rust_analyzer", + "ts_ls", + }, + }, + + -- A list of servers to automatically install if they're not already installed. Example: { "rust_analyzer@nightly", "lua_ls" } + ---@type string[] + -- ensure_installed = ensure_installed, +}) +--@end diff --git a/code/src/neovim/editor/src/plugins/configs/mason-null-ls.lua b/code/src/neovim/editor/src/plugins/configs/mason-null-ls.lua new file mode 100644 index 0000000..3890476 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/mason-null-ls.lua @@ -0,0 +1,32 @@ +--[[ +──────────────────────────────────────────────── +Plugin: mason-null-ls.nvim +Source: https://github.com/jay-babu/mason-null-ls.nvim + +mason-null-ls bridges mason.nvim with the null-ls plugin + - making it easier to use both plugins together. +──────────────────────────────────────────────── +--]] + +local _ = --@spec +{ + "jay-babu/mason-null-ls.nvim", + lazy = true, + event = { "BufReadPre", "BufNewFile" }, +} +--@end + +--@setup +require("mason-null-ls").setup({ + -- A list of sources to install if they're not already installed. + ensure_installed = {}, + -- Enable or disable null-ls methods to get set up + -- This setting is useful if some functionality is handled by other plugins such as `conform` and `nvim-lint` + methods = { + formatting = true, + code_actions = true, + }, + automatic_installation = false, + handlers = {}, +}) +--@end diff --git a/code/src/neovim/editor/src/plugins/configs/mason-nvim-dap.lua b/code/src/neovim/editor/src/plugins/configs/mason-nvim-dap.lua new file mode 100644 index 0000000..7666e34 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/mason-nvim-dap.lua @@ -0,0 +1,42 @@ +--[==[ +Plugin: mason-nvim-dap.nvim +Source: https://github.com/jay-babu/mason-nvim-dap.nvim + +mason-nvim-dap bridges mason.nvim with the nvim-dap plugin +- making it easier to use both plugins together. +--]==] + +local _ = --@spec +{ + "jay-babu/mason-nvim-dap.nvim", + lazy = true, +} +--@end + + +--@setup +require("mason-nvim-dap").setup({ + automatic_installation = false, + ensure_installed = { "python", "delve" }, + handlers = { + function(cnf) + -- all sources with no handler get passed here + + -- Keep original functionality + require('mason-nvim-dap').default_setup(cnf) + end, + -- python = function(cnf) + -- config.adapters = { + -- type = "executable", + -- command = "/usr/bin/python3", + -- args = { + -- "-m", + -- "debugpy.adapter", + -- }, + -- } + -- require('mason-nvim-dap').default_setup(cnf) -- don't forget this! + -- end, + }, + +}) +--@end diff --git a/code/src/neovim/editor/src/plugins/configs/mason.lua b/code/src/neovim/editor/src/plugins/configs/mason.lua new file mode 100644 index 0000000..3b9713d --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/mason.lua @@ -0,0 +1,50 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: mason.nvim +Source: https://github.com/mason-org/mason.nvim + +Git Graph plugin for neovim. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local M = { + "mason-org/mason.nvim", + lazy = true, + event = { "CmdlineEnter", "BufRead", "BufNewFile", "InsertEnter" }, + dependencies = { + --[[@rs $NONE_LS_SPEC, ]] + --[[@rs $LSPCONFIG_SPEC, ]] + --[[@rs $NULL_LS_SPEC, ]] + --[[@rs $NVIM_DAP_SPEC, ]] + }, +} + +M.config = function() + require("mason").setup({ + log_level = vim.log.levels.INFO, + max_concurrent_installers = 4, + ui = { + check_outdated_packages_on_open = true, + border = "rounded", + width = 0.8, + height = 0.9, + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, + }) + + -- === must be loaded after mason === + -- WARN! order matters + --[[@rs $LSP_SETUP ]] + --[[@rs $LSPCONFIG_SETUP ]] + --[[@rs $MASON_NULL_LS_SETUP ]] + --[[@rs $NVIM_DAP_SETUP ]] + --[[@rs $NONE_LS_SETUP ]] +end + +return M diff --git a/code/src/neovim/editor/src/plugins/configs/mason.rs b/code/src/neovim/editor/src/plugins/configs/mason.rs new file mode 100644 index 0000000..f1b7efa --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/mason.rs @@ -0,0 +1,40 @@ +/* +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: mason.nvim +Source: https://github.com/mason-org/mason.nvim + +Git Graph plugin for neovim. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +*/ + +use crate::{ + core::keymaps::{Key, MAPPING}, + lua_section, lua_spec, +}; + +pub struct Plugin; +impl Plugin { + pub fn spec() -> crate::plugins::spec::SpecInfo { + lua_spec!( + "mason.lua", + &[ + // specs + ("NONE_LS_SPEC", lua_section!("none-ls.lua", "spec")), + ("LSPCONFIG_SPEC", lua_section!("mason-lspconfig.lua", "spec")), + ("NULL_LS_SPEC", lua_section!("mason-null-ls.lua", "spec")), + ("NVIM_DAP_SPEC", lua_section!("mason-nvim-dap.lua", "spec")), + // setups + ( + "LSP_SETUP", + lua_section!("../../core/lsp.lua", "setup", &[("LSP_MAPPING", MAPPING.get_map(Key::LspConfig))]) + ), + ("LSPCONFIG_SETUP", lua_section!("mason-lspconfig.lua", "setup")), + ("MASON_NULL_LS_SETUP", lua_section!("mason-null-ls.lua", "setup")), + ("NONE_LS_SETUP", lua_section!("none-ls.lua", "setup")), + ("NVIM_DAP_SETUP", lua_section!("mason-nvim-dap.lua", "setup")), + ] + ) + } +} diff --git a/code/src/neovim/editor/src/plugins/configs/mini-icons.lua b/code/src/neovim/editor/src/plugins/configs/mini-icons.lua new file mode 100644 index 0000000..d0aa8e0 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/mini-icons.lua @@ -0,0 +1,15 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: mini.icons +Source: https://github.com/nvim-mini/mini.icons + +Icon provider. Part of 'mini.nvim' library. +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "nvim-mini/mini.icons", + lazy = true +} diff --git a/code/src/neovim/editor/src/plugins/configs/mod.rs b/code/src/neovim/editor/src/plugins/configs/mod.rs new file mode 100644 index 0000000..9e93fac --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/mod.rs @@ -0,0 +1,4 @@ +// Plugins with multi-plugin coordination (lua_section! / signal + template vars) +pub mod comment_nvim; +pub mod mason; +pub mod snack; diff --git a/code/src/neovim/editor/src/plugins/configs/neo-tree.lua b/code/src/neovim/editor/src/plugins/configs/neo-tree.lua new file mode 100644 index 0000000..da34914 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/neo-tree.lua @@ -0,0 +1,162 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: neo-tree.nvim +Source: https://github.com/nvim-neo-tree/neo-tree.nvim +Neovim plugin to manage the file system and other tree like structures. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = {}, +} + +spec.config = function() + require("neo-tree").setup({ + source_selector = { + winbar = true, + statusline = true, + }, + enable_modified_markers = true, + enable_opened_markers = true, + enable_refresh_on_write = true, + close_if_last_window = false, + enable_cursor_hijack = false, + git_status_async = true, + git_status_async_options = { + batch_size = 1000, + batch_delay = 10, + max_lines = 10000, + }, + popup_border_style = "rounded", + enable_git_status = true, + enable_diagnostics = true, + event_handlers = { + { + event = "neo_tree_popup_input_ready", + ---@param input NuiInput + handler = function(input) + vim.cmd("stopinsert") + end, + }, + }, + open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, + sort_case_insensitive = false, + sort_function = nil, + default_component_configs = { + container = { + enable_character_fade = true, + }, + indent = { + indent_size = 2, + padding = 1, + with_markers = true, + indent_marker = "│", + last_indent_marker = "└", + highlight = "NeoTreeIndentMarker", + with_expanders = nil, + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + icon = { + folder_closed = "", + folder_open = "", + folder_empty = "󰜌", + default = "*", + highlight = "NeoTreeFileIcon", + }, + modified = { + symbol = "●", + highlight = "NeoTreeModified", + }, + name = { + trailing_slash = false, + use_git_status_colors = true, + highlight = "NeoTreeFileName", + }, + git_status = { + symbols = { + added = "", + modified = "", + deleted = "✖", + renamed = "󰁕", + untracked = "", + ignored = "", + unstaged = "", + staged = "", + conflict = "", + }, + }, + file_size = { + enabled = true, + required_width = 64, + }, + type = { + enabled = true, + required_width = 122, + }, + last_modified = { + enabled = true, + required_width = 88, + }, + created = { + enabled = true, + required_width = 110, + }, + symlink_target = { + enabled = false, + }, + }, + commands = {}, + window = { + position = "left", + width = 30, + mapping_options = { + noremap = true, + nowait = true, + }, + }, + nesting_rules = {}, + filesystem = { + filtered_items = { + visible = false, + hide_dotfiles = true, + hide_gitignored = true, + hide_hidden = true, + hide_by_name = {}, + hide_by_pattern = {}, + always_show = {}, + never_show = {}, + never_show_by_pattern = {}, + }, + follow_current_file = { + enabled = true, + leave_dirs_open = false, + }, + group_empty_dirs = false, + hijack_netrw_behavior = "open_default", + use_libuv_file_watcher = false, + commands = {}, + }, + buffers = { + follow_current_file = { + enabled = true, + leave_dirs_open = false, + }, + group_empty_dirs = true, + show_unloaded = true, + }, + git_status = { + window = { + position = "float", + }, + }, + }) + --[[@rs $MAPPING_SET ]] +end + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/neotest.lua b/code/src/neovim/editor/src/plugins/configs/neotest.lua new file mode 100644 index 0000000..c7b711e --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/neotest.lua @@ -0,0 +1,18 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: Neotest +Source: https://github.com/nvim-neotest/neotest + +An extensible framework for interacting with tests within NeoVim. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "nvim-neotest/neotest", + dependencies = {"antoinemadec/FixCursorHold.nvim"}, + config = function() + + end, +} diff --git a/code/src/neovim/editor/src/plugins/configs/nio.lua b/code/src/neovim/editor/src/plugins/configs/nio.lua new file mode 100644 index 0000000..394b5e1 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/nio.lua @@ -0,0 +1,19 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: nvim-nio +Source: https://github.com/nvim-neotest/nvim-nio + +A library for asynchronous IO in Neovim, inspired by +the asyncio library in Python. The library focuses +on providing both common asynchronous primitives and +asynchronous APIs for Neovim's core. +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "nvim-neotest/nvim-nio", + version = "*", + lazy = true +} diff --git a/code/src/neovim/editor/src/plugins/configs/noice.lua b/code/src/neovim/editor/src/plugins/configs/noice.lua new file mode 100644 index 0000000..369efb5 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/noice.lua @@ -0,0 +1,36 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: noice.nvim +Source: https://github.com/folke/noice.nvim + +💥 Highly experimental plugin that completely replaces +the UI for messages, cmdline and the popupmenu. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + lsp = { + signature = { enabled = false }, + hover = { enabled = false }, + }, + presets = { + bottom_search = false, + command_palette = true, + long_message_to_split = true, + inc_rename = false, + lsp_doc_border = true, + }, + health = { + checker = false, + }, + cmdline = { + enabled = true, + view = "cmdline", + }, + }, +} diff --git a/code/src/neovim/editor/src/plugins/configs/none-ls.lua b/code/src/neovim/editor/src/plugins/configs/none-ls.lua new file mode 100644 index 0000000..f57c875 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/none-ls.lua @@ -0,0 +1,77 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: none-ls.nvim +Source: https://github.com/nvimtools/none-ls.nvim + +null-ls.nvim reloaded / Use Neovim as a language server +to inject LSP diagnostics, code actions, and more via Lua. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local _ = --@spec +{ + "nvimtools/none-ls.nvim", + lazy = true, +} +--@end + +-- NOTE: +-- we need the IIFE for scoping (to avoid local name collisions), so prefix with ; +--@setup +; (function() + -- https://github.com/nvimtools/none-ls.nvim/blob/main/doc/BUILTINS.md + local null = require("null-ls") + + local formatting = null.builtins.formatting + -- local completion = null.builtins.completion + -- local diagnostics = null.builtins.diagnostics + -- local code_actions = null.builtins.code_actions + + -- register any number of sources simultaneously + local sources = {} + + -- === FORMATTING === --- + -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting + + -- Go + if vim.fn.executable("gofmt") == 1 then + sources[#sources + 1] = formatting.gofmt.with({}) + end + + -- === CODEACTION === -- + -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/code_actions + + -- -- Javascript + -- if vim.fn.executable("clang-format") == 1 then + -- sources[#sources + 1] = code_actions.eslint.with({ + -- command = "eslint", + -- filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "vue" }, + -- args = { "-f", "json", "--stdin", "--stdin-filename", "$FILENAME" }, + -- to_stdin = true, + -- }) + -- end + + -- === DIAGNOSTICS === -- + -- -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics + + -- -- Django ("htmldjango") + -- if vim.fn.executable("djlint") == 1 then + -- sources[#sources+1] = diagnostics.djlint.with({ + -- command = "djlint", + -- args = { "$FILENAME" }, + -- }) + -- end + + -- === COMPLETION === -- + -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/completion + + -- === HOVER === -- + -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/hover + + + -- setup null-ls + null.setup({ debug = false, sources = sources }) +end)() +--@end diff --git a/code/src/neovim/editor/src/plugins/configs/nui.lua b/code/src/neovim/editor/src/plugins/configs/nui.lua new file mode 100644 index 0000000..d73ae76 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/nui.lua @@ -0,0 +1,15 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: MunifTanjim/nui.nvim +Source: https://github.com/MunifTanjim/nui.nvim + +UI Component Library for Neovim. +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "MunifTanjim/nui.nvim", + lazy = true +} diff --git a/code/src/neovim/editor/src/plugins/configs/oil.lua b/code/src/neovim/editor/src/plugins/configs/oil.lua new file mode 100644 index 0000000..a0e8791 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/oil.lua @@ -0,0 +1,117 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: oil.nvim +Source: https://github.com/stevearc/oil.nvim + +Neovim file explorer: edit your filesystem like a buffer +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "stevearc/oil.nvim", + --[[@rs keys=$MAPPING, ]] +} + +spec.opts = { + default_file_explorer = true, + columns = { + "icon", + }, + buf_options = { + buflisted = false, + bufhidden = "hide", + }, + win_options = { + wrap = false, + signcolumn = "no", + cursorcolumn = false, + foldcolumn = "0", + spell = false, + list = false, + conceallevel = 3, + concealcursor = "nvic", + }, + delete_to_trash = false, + skip_confirm_for_simple_edits = false, + prompt_save_on_select_new_entry = true, + cleanup_delay_ms = 2000, + lsp_file_methods = { + timeout_ms = 1000, + autosave_changes = false, + }, + constrain_cursor = "editable", + use_default_keymaps = true, + view_options = { + show_hidden = false, + is_hidden_file = function(name, bufnr) + return vim.startswith(name, ".") + end, + is_always_hidden = function(name, bufnr) + return false + end, + sort = { + { "type", "asc" }, + { "name", "asc" }, + }, + }, + float = { + padding = 2, + max_width = 0, + max_height = 0, + border = "rounded", + win_options = { + winblend = 0, + }, + override = function(conf) + return conf + end, + }, + preview = { + max_width = 0.9, + min_width = { 40, 0.4 }, + width = nil, + max_height = 0.9, + min_height = { 12, 0.4 }, + height = nil, + border = "rounded", + win_options = { + winblend = 0, + }, + update_on_cursor_moved = true, + }, + progress = { + max_width = 0.9, + min_width = { 40, 0.4 }, + width = nil, + max_height = { 10, 0.9 }, + min_height = { 5, 0.1 }, + height = nil, + border = "rounded", + minimized_border = "none", + win_options = { + winblend = 0, + }, + }, + keymaps = { + ["g?"] = "actions.show_help", + [""] = "actions.select", + [""] = "actions.select_vsplit", + [""] = "actions.select_split", + [""] = "actions.select_tab", + [""] = "actions.preview", + [""] = "actions.close", + [""] = "actions.refresh", + ["-"] = "actions.parent", + ["_"] = "actions.open_cwd", + ["`"] = "actions.cd", + ["~"] = "actions.tcd", + ["gs"] = "actions.change_sort", + ["gx"] = "actions.open_external", + ["g."] = "actions.toggle_hidden", + ["g\\"] = "actions.toggle_trash", + }, +} + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/penvim.lua b/code/src/neovim/editor/src/plugins/configs/penvim.lua new file mode 100644 index 0000000..3cd984b --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/penvim.lua @@ -0,0 +1,29 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: penvim +Source: https://github.com/Abstract-IDE/penvim + +project's root directory and documents indentation detector with project based config loader +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "Abstract-IDE/penvim", + opts = { + project_env = { + enable = true, + config_name = ".__nvim__.lua", + }, + rooter = { + enable = true, + patterns = { ".__nvim__.lua" }, + }, + indentor = { + enable = true, + indent_length = 4, + indent_type = "auto", + }, + }, +} diff --git a/code/src/neovim/editor/src/plugins/configs/plenary.lua b/code/src/neovim/editor/src/plugins/configs/plenary.lua new file mode 100644 index 0000000..b32a6a7 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/plenary.lua @@ -0,0 +1,16 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: plenary.nvim +Source: https://github.com/nvim-lua/plenary.nvim + +full; complete; entire; absolute; unqualified. +All the lua functions I don't want to write twice. +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "nvim-lua/plenary.nvim", + lazy = true +} diff --git a/code/src/neovim/editor/src/plugins/configs/renamer.lua b/code/src/neovim/editor/src/plugins/configs/renamer.lua new file mode 100644 index 0000000..7c7c95a --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/renamer.lua @@ -0,0 +1,40 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: renamer.nvim +Source: https://github.com/filipdutescu/renamer.nvim + +VS Code-like renaming UI for Neovim, writen in Lua. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "filipdutescu/renamer.nvim", + branch = "master", + event = { "LspAttach" }, + config = function() + local mappings_utils = require("renamer.mappings.utils") + require("renamer").setup({ + title = "Rename", + padding = { top = 0, left = 0, bottom = 0, right = 0 }, + min_width = 15, + max_width = 45, + border = true, + border_chars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + show_refs = true, + with_qf_list = true, + with_popup = true, + handler = nil, + mappings = { + [""] = mappings_utils.set_cursor_to_start, + [""] = mappings_utils.set_cursor_to_end, + [""] = mappings_utils.set_cursor_to_word_end, + [""] = mappings_utils.set_cursor_to_word_start, + [""] = mappings_utils.clear_line, + [""] = mappings_utils.undo, + [""] = mappings_utils.redo, + }, + }) + end, +} diff --git a/code/src/neovim/editor/src/plugins/configs/rustaceanvim.lua b/code/src/neovim/editor/src/plugins/configs/rustaceanvim.lua new file mode 100644 index 0000000..20d7118 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/rustaceanvim.lua @@ -0,0 +1,60 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: rustaceanvim +Source: https://github.com/mrcjkb/rustaceanvim + +Supercharge your Rust experience in Neovim! +A heavily modified fork of rust-tools.nvim +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "mrcjkb/rustaceanvim", + version = "^6", + lazy = false, +} + +spec.config = function() + vim.g.rustaceanvim = { + -- Plugin configuration + tools = { + float_win_config = { + border = "rounded", + }, + }, + + -- LSP configuration + server = { + on_attach = function(client, bufnr) + -- you can also put keymaps in here + end, + default_settings = { + -- rust-analyzer language server configuration + ['rust-analyzer'] = { + procMacro = { + ignored = { + -- Leptos + -- https://book.leptos.dev/getting_started/leptos_dx.html#2-editor-autocompletion-inside-component-and-server + leptos_macro = { + -- optional: -- + -- "component", + "server", + }, + }, + }, + cargo = { + -- Leptos + -- https://book.leptos.dev/getting_started/leptos_dx.html#3-enable-features-in-rust-analyzer-for-your-editor-optional + features = "all", -- Enable all features + }, + }, + }, + }, + -- DAP configuration + dap = {}, + } +end + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/schema-store.lua b/code/src/neovim/editor/src/plugins/configs/schema-store.lua new file mode 100644 index 0000000..da6d089 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/schema-store.lua @@ -0,0 +1,16 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: SchemaStore.nvim +Source: https://github.com/b0o/SchemaStore.nvim + +A Neovim plugin that provides the SchemaStore +catalog for use with jsonls and yamlls. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "b0o/schemastore.nvim", + lazy = true, +} diff --git a/code/src/neovim/editor/src/plugins/configs/session-manager.lua b/code/src/neovim/editor/src/plugins/configs/session-manager.lua new file mode 100644 index 0000000..748ad87 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/session-manager.lua @@ -0,0 +1,35 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: neovim-session-manager +Source: https://github.com/Shatur/neovim-session-manager +A simple wrapper around :mksession. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "Shatur/neovim-session-manager", + event = "BufWinEnter", + cmd = { "SessionManager" }, +} + +spec.config = function() + require("session_manager").setup({ + sessions_dir = vim.fn.stdpath("data") .. "/.cache/sessions", + path_replacer = "__", + colon_replacer = "++", + autoload_mode = require("session_manager.config").AutoloadMode.Disabled, + autosave_last_session = true, + autosave_ignore_not_normal = true, + autosave_ignore_filetypes = { + "gitcommit", + "gitrebase", + }, + autosave_only_in_session = false, + max_path_length = 80, + }) + --[[@rs $MAPPING_SET ]] +end + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/snack.lua b/code/src/neovim/editor/src/plugins/configs/snack.lua new file mode 100644 index 0000000..93fe269 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/snack.lua @@ -0,0 +1,570 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: snacks.nvim +Source: github.com/folke/snacks.nvim + +A collection of small QoL plugins for Neovim. +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + +} + +local configs = {} + +spec.config = function() + require("snacks").setup({ + bigfile = configs.bigfile, + bufdelete = configs.bufdelete(), + dashboard = configs.dashboard, + indent = configs.indent, + input = configs.input, + notifier = configs.notifier, + + -- NOTE: using fff for now + -- picker = configs.picker(), + }) +end + + + +-- === BUFFER DELETE === -- +-- https://github.com/folke/snacks.nvim/blob/main/docs/bufdelete.md +configs.bufdelete = function() + --[[@rs $MAPPING_BUFDELETE ]] + return { + enabled = true, + } +end + + +-- === NOTIFIER === +-- https://github.com/folke/snacks.nvim/blob/main/docs/notifier.md +configs.notifier = { + enabled = true, + timeout = 3000, -- default timeout in ms + width = { min = 40, max = 0.4 }, + height = { min = 1, max = 0.6 }, + -- editor margin to keep free. tabline and statusline are taken into account automatically + margin = { top = 0, right = 1, bottom = 0 }, + padding = true, -- add 1 cell of left/right padding to the notification window + sort = { "level", "added" }, -- sort by level and time + -- minimum log level to display. TRACE is the lowest + -- all notifications are stored in history + level = vim.log.levels.TRACE, + icons = { + error = " ", + warn = " ", + info = " ", + debug = " ", + trace = " ", + }, + keep = function(notif) + return vim.fn.getcmdpos() > 0 + end, + + ---@type snacks.notifier.style + -- compact: use border for icon and title + -- minimal: no border, only icon and message + -- fancy: similar to the default nvim-notify style + style = "compact", + top_down = true, -- place notifications from top to bottom + date_format = "%R", -- time format for notifications + -- format for footer when more lines are available + -- `%d` is replaced with the number of lines. + -- only works for styles with a border + ---@type string|boolean + more_format = " ↓ %d lines ", + refresh = 50, -- refresh at most every 50ms +} + +-- === PICKER === -- +-- https://github.com/folke/snacks.nvim/blob/main/docs/picker.md +configs.picker = function() + --[[@rs $MAPPING_PICKER ]] + return { + enabled = true, + prompt = "🔎 ", --  + sources = {}, + focus = "input", + layout = { + cycle = true, + --- Use the default layout or vertical if the window is too narrow + preset = function() + return vim.o.columns >= 100 and "default" or "vertical" + end, + }, + + ---@class snacks.picker.matcher.Config + matcher = { + fuzzy = true, -- use fuzzy matching + smartcase = true, -- use smartcase + ignorecase = true, -- use ignorecase + sort_empty = false, -- sort results when the search string is empty + filename_bonus = true, -- give bonus for matching file names (last part of the path) + file_pos = true, -- support patterns like `file:line:col` and `file:line` + -- the bonusses below, possibly require string concatenation and path normalization, + -- so this can have a performance impact for large lists and increase memory usage + cwd_bonus = false, -- give bonus for matching files in the cwd + frecency = false, -- frecency bonus + history_bonus = false, -- give more weight to chronological order + }, + + sort = { + -- default sort is by score, text length and index + fields = { "score:desc", "#text", "idx" }, + }, + + ui_select = true, -- replace `vim.ui.select` with the snacks picker + ---@class snacks.picker.formatters.Config + formatters = { + text = { + ft = nil, ---@type string? filetype for highlighting + }, + file = { + filename_first = false, -- display filename before the file path + truncate = 40, -- truncate the file path to (roughly) this length + filename_only = false, -- only show the filename + icon_width = 2, -- width of the icon (in characters) + git_status_hl = true, -- use the git status highlight group for the filename + }, + selected = { + show_always = false, -- only show the selected column when there are multiple selections + unselected = true, -- use the unselected icon for unselected items + }, + severity = { + icons = true, -- show severity icons + level = false, -- show severity level + ---@type "left"|"right" + pos = "left", -- position of the diagnostics + }, + }, + + ---@class snacks.picker.previewers.Config + previewers = { + diff = { + builtin = true, -- use Neovim for previewing diffs (true) or use an external tool (false) + cmd = { "delta" }, -- example to show a diff with delta + }, + git = { + builtin = true, -- use Neovim for previewing git output (true) or use git (false) + args = {}, -- additional arguments passed to the git command. Useful to set pager options usin `-c ...` + }, + file = { + max_size = 1024 * 1024, -- 1MB + max_line_length = 500, -- max line length + ft = nil, ---@type string? filetype for highlighting. Use `nil` for auto detect + }, + man_pager = nil, ---@type string? MANPAGER env to use for `man` preview + }, + ---@class snacks.picker.jump.Config + jump = { + jumplist = true, -- save the current position in the jumplist + tagstack = false, -- save the current position in the tagstack + reuse_win = false, -- reuse an existing window if the buffer is already open + close = true, -- close the picker when jumping/editing to a location (defaults to true) + match = false, -- jump to the first match position. (useful for `lines`) + }, + toggles = { + follow = "f", + hidden = "h", + ignored = "i", + modified = "m", + regex = { icon = "R", value = false }, + }, + + win = { + -- input window + input = { + keys = { + -- to close the picker on ESC instead of going to normal mode, + -- add the following keymap to your config + -- [""] = { "close", mode = { "n", "i" } }, + ["/"] = "toggle_focus", + [""] = { "history_forward", mode = { "i", "n" } }, + [""] = { "history_back", mode = { "i", "n" } }, + [""] = { "cancel", mode = "i" }, + [""] = { "", mode = { "i" }, expr = true, desc = "delete word" }, + [""] = { "confirm", mode = { "n", "i" } }, + [""] = { "list_down", mode = { "i", "n" } }, + [""] = "cancel", + [""] = { { "pick_win", "jump" }, mode = { "n", "i" } }, + [""] = { "select_and_prev", mode = { "i", "n" } }, + [""] = { "select_and_next", mode = { "i", "n" } }, + -- Preview + [""] = { "toggle_preview", mode = { "i", "n" } }, + [""] = { "preview_scroll_up", mode = { "i", "n" } }, + [""] = { "preview_scroll_down", mode = { "i", "n" } }, + -- + [""] = { "list_up", mode = { "i", "n" } }, + [""] = { "inspect", mode = { "n", "i" } }, + [""] = { "toggle_follow", mode = { "i", "n" } }, + [""] = { "toggle_hidden", mode = { "i", "n" } }, + [""] = { "toggle_ignored", mode = { "i", "n" } }, + [""] = { "toggle_maximize", mode = { "i", "n" } }, + [""] = { "cycle_win", mode = { "i", "n" } }, + [""] = { "select_all", mode = { "n", "i" } }, + -- [""] = { "list_scroll_down", mode = { "i", "n" } }, + -- [""] = { "list_scroll_up", mode = { "i", "n" } }, + [""] = { "toggle_live", mode = { "i", "n" } }, + [""] = { "list_down", mode = { "i", "n" } }, + [""] = { "list_up", mode = { "i", "n" } }, + [""] = { "list_down", mode = { "i", "n" } }, + [""] = { "list_up", mode = { "i", "n" } }, + [""] = { "qflist", mode = { "i", "n" } }, + [""] = { "edit_split", mode = { "i", "n" } }, + [""] = { "tab", mode = { "n", "i" } }, + [""] = { "edit_vsplit", mode = { "i", "n" } }, + ["#"] = { "insert_alt", mode = "i" }, + ["%"] = { "insert_filename", mode = "i" }, + [""] = { "insert_cWORD", mode = "i" }, + [""] = { "insert_file", mode = "i" }, + [""] = { "insert_line", mode = "i" }, + [""] = { "insert_file_full", mode = "i" }, + [""] = { "insert_cword", mode = "i" }, + ["H"] = "layout_left", + ["J"] = "layout_bottom", + ["K"] = "layout_top", + ["L"] = "layout_right", + ["?"] = "toggle_help_input", + ["G"] = "list_bottom", + ["gg"] = "list_top", + ["j"] = "list_down", + ["k"] = "list_up", + ["q"] = "close", + }, + b = { + minipairs_disable = true, + }, + }, + -- result list window + list = { + keys = { + ["/"] = "toggle_focus", + ["<2-LeftMouse>"] = "confirm", + [""] = "confirm", + [""] = "list_down", + [""] = "cancel", + [""] = { { "pick_win", "jump" } }, + [""] = { "select_and_prev", mode = { "n", "x" } }, + [""] = { "select_and_next", mode = { "n", "x" } }, + -- Preview + [""] = "toggle_preview", + [""] = "preview_scroll_up", + [""] = "preview_scroll_down", + -- + [""] = "list_up", + [""] = "inspect", + [""] = "toggle_follow", + [""] = "toggle_hidden", + [""] = "toggle_ignored", + [""] = "toggle_maximize", + [""] = "cycle_win", + [""] = "select_all", + -- [""] = "list_scroll_down", + -- [""] = "list_scroll_up", + [""] = "list_down", + [""] = "list_up", + [""] = "list_down", + [""] = "list_up", + [""] = "qflist", + [""] = "edit_split", + [""] = "tab", + [""] = "edit_vsplit", + ["H"] = "layout_left", + ["J"] = "layout_bottom", + ["K"] = "layout_top", + ["L"] = "layout_right", + ["?"] = "toggle_help_list", + ["G"] = "list_bottom", + ["gg"] = "list_top", + ["i"] = "focus_input", + ["j"] = "list_down", + ["k"] = "list_up", + ["q"] = "close", + ["zb"] = "list_scroll_bottom", + ["zt"] = "list_scroll_top", + ["zz"] = "list_scroll_center", + }, + wo = { + conceallevel = 2, + concealcursor = "nvc", + }, + }, + -- preview window + preview = { + keys = { + [""] = "cancel", + ["q"] = "close", + ["i"] = "focus_input", + [""] = "cycle_win", + }, + }, + }, + ---@class snacks.picker.icons + icons = { + files = { + enabled = true, -- show file icons + dir = "󰉋 ", + dir_open = "󰝰 ", + file = "󰈔 ", + }, + keymaps = { + nowait = "󰓅 ", + }, + tree = { + vertical = "│ ", + middle = "├╴", + last = "└╴", + }, + undo = { + saved = " ", + }, + ui = { + live = "󰐰 ", + hidden = "h", + ignored = "i", + follow = "f", + selected = "● ", + unselected = "○ ", + -- selected = " ", + }, + git = { + enabled = true, -- show git icons + commit = "󰜘 ", -- used by git log + staged = "●", -- staged changes. always overrides the type icons + added = "", + deleted = "", + ignored = " ", + modified = "○", + renamed = "", + unmerged = " ", + untracked = "?", + }, + diagnostics = { + Error = " ", + Warn = " ", + Hint = " ", + Info = " ", + }, + lsp = { + unavailable = "", + enabled = " ", + disabled = " ", + attached = "󰖩 ", + }, + kinds = { + Array = " ", + Boolean = "󰨙 ", + Class = " ", + Color = " ", + Control = " ", + Collapsed = " ", + Constant = "󰏿 ", + Constructor = " ", + Copilot = " ", + Enum = " ", + EnumMember = " ", + Event = " ", + Field = " ", + File = " ", + Folder = " ", + Function = "󰊕 ", + Interface = " ", + Key = " ", + Keyword = " ", + Method = "󰊕 ", + Module = " ", + Namespace = "󰦮 ", + Null = " ", + Number = "󰎠 ", + Object = " ", + Operator = " ", + Package = " ", + Property = " ", + Reference = " ", + Snippet = "󱄽 ", + String = " ", + Struct = "󰆼 ", + Text = " ", + TypeParameter = " ", + Unit = " ", + Unknown = " ", + Value = " ", + Variable = "󰀫 ", + }, + }, + ---@class snacks.picker.db.Config + db = { + -- path to the sqlite3 library + -- If not set, it will try to load the library by name. + -- On Windows it will download the library from the internet. + sqlite3_path = nil, ---@type string? + }, + ---@class snacks.picker.debug + debug = { + scores = false, -- show scores in the list + leaks = false, -- show when pickers don't get garbage collected + explorer = false, -- show explorer debug info + files = false, -- show file debug info + grep = false, -- show file debug info + proc = false, -- show proc debug info + extmarks = false, -- show extmarks errors + }, + } +end + +-- === DASHBOARD === -- +-- https://github.com/folke/snacks.nvim/blob/main/docs/dashboard.md +configs.dashboard = { + enabled = true, + width = 40, + sections = function() + local header = function() + local _header = "" + _header = _header .. "┃█████ " .. "\n" + _header = _header .. "┃██ ██ " .. "\n" + _header = _header .. "┃██ ██ " .. "\n" + _header = _header .. "┃██ ████████ " .. "\n" + _header = _header .. "┃██ ██ " .. "\n" + _header = _header .. "┃██ ██ " .. "\n" + return _header + end + + local info = function() + local _datetime, datetime = pcall(os.date, " %I:%M:%p (%d-%m-%Y)") + local version = vim.version() + local nvim_verion = string.format("v%d.%d.%d", version.major, version.minor, version.patch) + if _datetime then + return nvim_verion .. " | " .. datetime + end + return nvim_verion + end + + local session = function() + vim.cmd([[SessionManager load_session]]) + end + + -- stylua: ignore + return { + { align = "center", text = { header() } }, + { + gap = 0, + indent = 0, + padding = 4, + { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" }, + { icon = " ", key = "r", desc = "Recent Files", action = ":lua Snacks.dashboard.pick('oldfiles')" }, + { icon = " ", key = "s", desc = "Sessions", action = session }, + -- { icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" }, + { icon = " ", key = "f", desc = "Find File", action = function() require('fff').find_files() end }, + { icon = " ", key = "g", desc = "Find Text", action = ":lua Snacks.dashboard.pick('live_grep')" }, + { icon = "󰒲 ", key = "L", desc = "Lazy", action = ":Lazy", enabled = package.loaded.lazy ~= nil }, + { icon = " ", key = "q", desc = "Quit", action = ":qa" }, + }, + { + align = "center", + gap = 0, + { section = "startup" }, + { text = { info() } }, + } + } + end, + +} + +-- === Indent === -- +-- https://github.com/folke/snacks.nvim/blob/main/docs/indent.md +---@class snacks.indent.Config +configs.indent = { + enabled = true, + indent = { + enabled = true, -- enable indent guides + priority = 1, + char = "│", + only_scope = false, -- only show indent guides of the scope + only_current = false, -- only show indent guides in the current window + hl = "SnacksIndent", ---@type string|string[] hl groups for indent guides + }, + ---@class snacks.indent.Scope.Config: snacks.scope.Config + scope = { + enabled = true, -- enable highlighting the current scope + priority = 200, + char = "│", -- │ | ¦ ┆ ┊ ║ ▎ + underline = true, -- underline the start of the scope + only_current = false, -- only show scope in the current window + hl = "SnacksIndentScope", ---@type string|string[] hl group for scopes + }, + chunk = { + -- when enabled, scopes will be rendered as chunks, except for the + -- top-level scope which will be rendered as a scope. + enabled = false, + -- only show chunk scopes in the current window + only_current = false, + priority = 100, + hl = "SnacksIndentChunk", ---@type string|string[] hl group for chunk scopes + char = { + corner_top = "╭", -- ╭ ┌ + corner_bottom = "╰", -- ╰ └ + horizontal = "─", + vertical = "│", + arrow = ">", + }, + }, + + ---@class snacks.indent.animate: snacks.animate.Config + animate = { + enabled = true, -- vim.fn.has("nvim-0.10") == 1, + --- * out: animate outwards from the cursor + --- * up: animate upwards from the cursor + --- * down: animate downwards from the cursor + --- * up_down: animate up or down based on the cursor position + style = "out", + easing = "linear", + duration = { + step = 20, -- ms per step + total = 300, -- maximum duration + }, + }, +} + +-- === Bigfile === -- +-- https://github.com/folke/snacks.nvim/blob/main/docs/bigfile.md +---@class snacks.bigfile.Config +configs.bigfile = { + enabled = true, + notify = true, -- show notification when big file detected + size = 5 * 1024 * 1024, -- 5MB + line_length = 1000, -- average line length (useful for minified files) + -- Enable or disable features when big file detected + ---@param ctx {buf: number, ft:string} + setup = function(ctx) + if vim.fn.exists(":NoMatchParen") ~= 0 then + vim.cmd([[NoMatchParen]]) + end + Snacks.util.wo(0, { foldmethod = "manual", statuscolumn = "", conceallevel = 0 }) + vim.b.minianimate_disable = true + vim.schedule(function() + if vim.api.nvim_buf_is_valid(ctx.buf) then + vim.bo[ctx.buf].syntax = ctx.ft + end + end) + end, +} + + +-- === Input === -- +-- Better vim.ui.input +-- https://github.com/folke/snacks.nvim/blob/main/docs/input.md +---@class snacks.input.Config +configs.input = { + enabled = true, +} + + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/snack.rs b/code/src/neovim/editor/src/plugins/configs/snack.rs new file mode 100644 index 0000000..db0bbc1 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/snack.rs @@ -0,0 +1,31 @@ +/* +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: snacks.nvim +Source: github.com/folke/snacks.nvim + +A collection of small QoL plugins for Neovim. +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +*/ + +use crate::{ + core::keymaps::{Key, MAPPING}, + lua_spec, +}; + +pub struct Plugin; + +impl Plugin { + pub fn spec() -> crate::plugins::spec::SpecInfo { + MAPPING.signal(Key::Snacks); + + lua_spec!( + "snack.lua", + &[ + ("MAPPING_BUFDELETE", MAPPING.set_map_str(Key::SnacksBufdelete)), + ("MAPPING_PICKER", MAPPING.set_map_str(Key::SnacksPicker)), + ] + ) + } +} diff --git a/code/src/neovim/editor/src/plugins/configs/surround.lua b/code/src/neovim/editor/src/plugins/configs/surround.lua new file mode 100644 index 0000000..8af94f4 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/surround.lua @@ -0,0 +1,49 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: nvim-surround +Source: https://github.com/kylechui/nvim-surround + +Add/change/delete surrounding delimiter pairs with ease. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "kylechui/nvim-surround", + version = "*", + keys = { "c", "s" }, + opts = { + keymaps = { + visual = "S", + delete = "ds", + change = "cs", + insert = "s", + }, + surrounds = { + ["("] = { add = { "( ", " )" } }, + [")"] = { add = { "(", ")" } }, + ["{"] = { add = { "{ ", " }" } }, + ["}"] = { add = { "{", "}" } }, + ["<"] = { add = { "< ", " >" } }, + [">"] = { add = { "<", ">" } }, + ["["] = { add = { "[ ", " ]" } }, + ["]"] = { add = { "[", "]" } }, + ["'"] = { add = { "'", "'" } }, + ['"'] = { add = { '"', '"' } }, + ["`"] = { add = { "`", "`" } }, + }, + aliases = { + ["a"] = ">", + ["b"] = ")", + ["B"] = "}", + ["r"] = "]", + ["q"] = { '"', "'", "`" }, + ["s"] = { ")", "]", "}", ">", "'", '"', "`" }, + }, + highlight = { + duration = 0, + }, + move_cursor = "begin", + }, +} diff --git a/code/src/neovim/editor/src/plugins/configs/tabby.lua b/code/src/neovim/editor/src/plugins/configs/tabby.lua new file mode 100644 index 0000000..270cbba --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/tabby.lua @@ -0,0 +1,94 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: tabby.nvim +Source: https://github.com/nanozuki/tabby.nvim + +A declarative, highly configurable, and neovim style tabline plugin. +Use your nvim tabs as a workspace multiplexer! +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "nanozuki/tabby.nvim", + event = { "TabEnter", "TabLeave", "TabNew", "TabClosed" }, + config = function() + local tab = function() + local tabs = tostring(#vim.api.nvim_list_tabpages()) + local tabpage = tostring(vim.api.nvim_tabpage_get_number(0)) + return tabpage .. "/" .. tabs + end + + -- Merge duplicate buffer names across windows in the same tab + local wins_in_tab = function(line, theme) + local unique_buffers = {} + + return line.wins_in_tab(line.api.get_current_tab()).foreach(function(win) + local buf_name = win.buf_name() + unique_buffers[buf_name] = unique_buffers[buf_name] or { is_current = false, lines = {} } + unique_buffers[buf_name].is_current = unique_buffers[buf_name].is_current or win.is_current() + + if not vim.tbl_contains(unique_buffers[buf_name].lines, buf_name) then + table.insert(unique_buffers[buf_name].lines, buf_name) + local is_same_buff = vim.fn.bufnr(buf_name) == vim.fn.bufnr() + + local icon = " " .. win.file_icon() .. " " + local hl = is_same_buff and theme.current_win or theme.win + + return { + line.sep("", theme.win, theme.fill), + icon, + buf_name, + line.sep("", theme.win, theme.tab), + hl = hl, + margin = "", + } + end + end) + end + + local theme = { + fill = "TabLineFill", + head = "TabLine", + current_tab = "TabLineSel", + tab = "TabLine", + win = "TabLine", + current_win = "TabLineCurrentWin", + tail = "TabLine", + } + + local view = function(line) + return { + { + { tab(), hl = theme.head }, + line.sep(" ", theme.head, theme.tab), + }, + line.tabs().foreach(function(tab) + local hl = tab.is_current() and theme.current_tab or theme.tab + return { + " ", + tab.name(), + " ", + hl = hl, + } + end), + line.sep(" ", theme.head, theme.tab), + line.spacer(), + wins_in_tab(line, theme), + } + end + + local opt = { + buf_name = { + mode = "unique", + }, + } + + -- Save and restore in session + vim.opt.sessionoptions = "curdir,folds,globals,help,tabpages,terminal,winsize" + vim.o.showtabline = 1 + + require("tabby.tabline").set(view, opt) + end +} diff --git a/code/src/neovim/editor/src/plugins/configs/tiny-code-action.lua b/code/src/neovim/editor/src/plugins/configs/tiny-code-action.lua new file mode 100644 index 0000000..5312dc3 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/tiny-code-action.lua @@ -0,0 +1,18 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: tiny-code-action.nvim +Source: https://github.com/rachartier/tiny-code-action.nvim + +A Neovim plugin that provides a simple way to +run and visualize code actions with Telescope. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +return { + "rachartier/tiny-code-action.nvim", + lazy = true, + event = { "LspAttach" }, + opts = {}, +} diff --git a/code/src/neovim/editor/src/plugins/configs/treesitter.lua b/code/src/neovim/editor/src/plugins/configs/treesitter.lua new file mode 100644 index 0000000..45be507 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/treesitter.lua @@ -0,0 +1,34 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +───────────────────────────────────────────────── +Plugin: nvim-treesitter +Source: https://github.com/nvim-treesitter/nvim-treesitter + +Nvim Treesitter configurations and abstraction layer +───────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + 'nvim-treesitter/nvim-treesitter', + lazy = false, + build = ':TSUpdate', +} + +spec.init = function() + local register = vim.treesitter.language.register + register("html", { "htmldjango" }) + register("bash", { "zsh" }) + register('xml', { 'svg', 'xslt' }) +end + +spec.config = function() + require('nvim-treesitter').setup({ + -- Directory to install parsers and queries to (prepended to `runtimepath` to have priority) + -- NOTE!: Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers") + -- NOTE!: we are adding to rtp using lazy.nvim + install_dir = "--[[@rs $NVIM_TS_HOME ]]" + }) +end + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/trouble.lua b/code/src/neovim/editor/src/plugins/configs/trouble.lua new file mode 100644 index 0000000..288600c --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/trouble.lua @@ -0,0 +1,190 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: trouble.nvim +Source: https://github.com/folke/trouble.nvim + +A pretty diagnostics, references, telescope results, quickfix and +location list to help you solve all the trouble your code is causing. +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "folke/trouble.nvim", + event = { "LspAttach" }, +} + +spec.config = function() + --[[@rs $MAPPING_SET ]] + + require('trouble').setup({ + auto_close = true, -- auto close when there are no items + auto_open = false, -- auto open when there are items + auto_preview = true, -- automatically open preview when on an item + auto_refresh = true, -- auto refresh when open + auto_jump = false, -- auto jump to the item when there's only one + focus = true, -- Focus the window when opened + restore = true, -- restores the last location in the list when opening + follow = true, -- Follow the current item + indent_guides = true, -- show indent guides + max_items = 200, -- limit number of items that can be displayed per section + multiline = true, -- render multi-line messages + pinned = false, -- When pinned, the opened trouble window will be bound to the current buffer + warn_no_results = true, -- show a warning when there are no results + open_no_results = false, -- open the trouble window when there are no results + win = {}, -- window options for the results window. Can be a split or a floating window. + -- Window options for the preview window. Can be a split, floating window, + -- or `main` to show the preview in the main editor window. + preview = { + type = "main", + -- when a buffer is not yet loaded, the preview window will be created + -- in a scratch buffer with only syntax highlighting enabled. + -- Set to false, if you want the preview to always be a real loaded buffer. + scratch = true, + }, + -- Throttle/Debounce settings. Should usually not be changed. + throttle = { + refresh = 20, -- fetches new data when needed + update = 10, -- updates the window + render = 10, -- renders the window + follow = 100, -- follows the current item + preview = { ms = 100, debounce = true }, -- shows the preview for the current item + }, + -- Key mappings can be set to the name of a builtin action, + -- or you can define your own custom action. + keys = { + ["?"] = "help", + r = "refresh", + R = "toggle_refresh", + q = "close", + o = "jump_close", + [""] = "cancel", + [""] = "jump", + ["<2-leftmouse>"] = "jump", + [""] = "jump_split", + [""] = "jump_vsplit", + -- go down to next item (accepts count) + -- j = "next", + ["}"] = "next", + ["]]"] = "next", + -- go up to prev item (accepts count) + -- k = "prev", + ["{"] = "prev", + ["[["] = "prev", + i = "inspect", + p = "preview", + P = "toggle_preview", + zo = "fold_open", + zO = "fold_open_recursive", + zc = "fold_close", + zC = "fold_close_recursive", + za = "fold_toggle", + zA = "fold_toggle_recursive", + zm = "fold_more", + zM = "fold_close_all", + zr = "fold_reduce", + zR = "fold_open_all", + zx = "fold_update", + zX = "fold_update_all", + zn = "fold_disable", + zN = "fold_enable", + zi = "fold_toggle_enable", + gb = { -- example of a custom action that toggles the active view filter + action = function(view) + view:filter({ buf = 0 }, { toggle = true }) + end, + desc = "Toggle Current Buffer Filter", + }, + s = { -- example of a custom action that toggles the severity + action = function(view) + local f = view:get_filter("severity") + local severity = ((f and f.filter.severity or 0) + 1) % 5 + view:filter({ severity = severity }, { + id = "severity", + template = "{hl:Title}Filter:{hl} {severity}", + del = severity == 0, + }) + end, + desc = "Toggle Severity Filter", + }, + }, + modes = { + symbols = { + desc = "document symbols", + mode = "lsp_document_symbols", + focus = false, + win = { position = "right" }, + filter = { + -- remove Package since luals uses it for control flow structures + ["not"] = { ft = "lua", kind = "Package" }, + any = { + -- all symbol kinds for help / markdown files + ft = { "help", "markdown" }, + -- default set of symbol kinds + kind = { + "Class", + "Constructor", + "Enum", + "Field", + "Function", + "Interface", + "Method", + "Module", + "Namespace", + "Package", + "Property", + "Struct", + "Trait", + }, + }, + }, + }, + }, + -- stylua: ignore + icons = { + indent = { + top = "│ ", + middle = "├╴", + last = "╰╴", -- rounded + -- last = "└╴", + -- last = "-╴", + fold_open = " ", + fold_closed = " ", + ws = " ", + }, + folder_closed = " ", + folder_open = " ", + kinds = { + Array = " ", + Boolean = "󰨙 ", + Class = " ", + Constant = "󰏿 ", + Constructor = " ", + Enum = " ", + EnumMember = " ", + Event = " ", + Field = " ", + File = " ", + Function = "󰊕 ", + Interface = " ", + Key = " ", + Method = "󰊕 ", + Module = " ", + Namespace = "󰦮 ", + Null = " ", + Number = "󰎠 ", + Object = " ", + Operator = " ", + Package = " ", + Property = " ", + String = " ", + Struct = "󰆼 ", + TypeParameter = " ", + Variable = "󰀫 ", + }, + }, + }) +end + +return spec diff --git a/code/src/neovim/editor/src/plugins/configs/ts-autotag.lua b/code/src/neovim/editor/src/plugins/configs/ts-autotag.lua new file mode 100644 index 0000000..97e676b --- /dev/null +++ b/code/src/neovim/editor/src/plugins/configs/ts-autotag.lua @@ -0,0 +1,41 @@ +--[[ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +──────────────────────────────────────────────── +Plugin: nvim-ts-autotag +Source: github.com/windwp/nvim-ts-autotag + +Use treesitter to auto close and auto rename html tag +──────────────────────────────────────────────── +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +--]] + +local spec = { + "windwp/nvim-ts-autotag", + event = { "InsertEnter", "LspAttach" }, + -- stylua: ignore + ft = { + "astro", "glimmer", "handlebars", "hbs", "html", "javascript", + "javascriptreact", "jsx", "markdown", "php", "rescript", + "svelte", "tsx", "typescript", "typescriptreact", "vue", "xml", + }, +} + +spec.opts = { + opts = { + enable_close = true, -- Auto close tags + enable_rename = true, -- Auto rename pairs of tags + enable_close_on_slash = false -- Auto close on trailing ", mode = "nixsotc" }, + }, + -- Start hidden and wait for a key to be pressed before showing the popup + -- Only used by enabled xo mapping modes. + ---@param ctx { mode: string, operator: string } + defer = function(ctx) + return ctx.mode == "V" or ctx.mode == "" + end, + plugins = { + marks = true, -- shows a list of your marks on ' and ` + registers = true, -- shows your registers on " in NORMAL or in INSERT mode + -- the presets plugin, adds help for a bunch of default keybindings in Neovim + -- No actual key bindings are created + spelling = { + enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions + suggestions = 20, -- how many suggestions should be shown in the list? + }, + presets = { + operators = true, -- adds help for operators like d, y, ... + motions = true, -- adds help for motions + text_objects = true, -- help for text objects triggered after entering an operator + windows = true, -- default bindings on + nav = true, -- misc bindings to work with windows + z = true, -- bindings for folds, spelling and others prefixed with z + g = true, -- bindings for prefixed with g + }, + }, + ---@type wk.Win.opts + win = { + -- don't allow the popup to overlap with the cursor + no_overlap = true, + -- width = 1, + -- height = { min = 4, max = 25 }, + -- col = 0, + -- row = math.huge, + -- border = "none", + padding = { 1, 2 }, -- extra window padding [top/bottom, right/left] + title = true, + title_pos = "center", + zindex = 1000, + -- Additional vim.wo and vim.bo options + bo = {}, + wo = { + -- winblend = 10, -- value between 0-100 0 for fully opaque and 100 for fully transparent + }, + }, + layout = { + width = { min = 20 }, -- min and max width of the columns + spacing = 3, -- spacing between columns + }, + keys = { + scroll_down = "", -- binding to scroll down inside the popup + scroll_up = "", -- binding to scroll up inside the popup + }, + ---@type (string|wk.Sorter)[] + --- Mappings are sorted using configured sorters and natural sort of the keys + --- Available sorters: + --- * local: buffer-local mappings first + --- * order: order of the items (Used by plugins like marks / registers) + --- * group: groups last + --- * alphanum: alpha-numerical first + --- * mod: special modifier keys last + --- * manual: the order the mappings were added + --- * case: lower-case first + sort = { "local", "order", "group", "alphanum", "mod" }, + ---@type number|fun(node: wk.Node):boolean? + expand = 1, -- expand groups when <= n mappings + -- expand = function(node) + -- return not node.desc -- expand all nodes without a description + -- end, + -- Functions/Lua Patterns for formatting the labels + ---@type table + replace = { + key = { + function(key) + return require("which-key.view").format(key) + end, + -- { "", "SPC" }, + }, + desc = { + { "%(?(.*)%)?", "%1" }, + { "^%+", "" }, + { "<[cC]md>", "" }, + { "<[cC][rR]>", "" }, + { "<[sS]ilent>", "" }, + { "^lua%s+", "" }, + { "^call%s+", "" }, + { "^:%s*", "" }, + }, + }, + icons = { + breadcrumb = "»", -- symbol used in the command line area that shows your active key combo + separator = "➜", -- symbol used between a key and it's label + group = "+", -- symbol prepended to a group + ellipsis = "…", + -- set to false to disable all mapping icons, + -- both those explicitely added in a mapping + -- and those from rules + mappings = false, + --- See `lua/which-key/icons.lua` for more details + --- Set to `false` to disable keymap icons from rules + ---@type wk.IconRule[]|false + rules = {}, + -- use the highlights from mini.icons + -- When `false`, it will use `WhichKeyIcon` instead + colors = true, + -- used by key format + keys = { + Up = " ", + Down = " ", + Left = " ", + Right = " ", + C = "󰘴 ", + M = "󰘵 ", + D = "󰘳 ", + S = "󰘶 ", + CR = "󰌑 ", + Esc = "󱊷 ", + ScrollWheelDown = "󱕐 ", + ScrollWheelUp = "󱕑 ", + NL = "󰌑 ", + BS = "󰁮", + Space = "󱁐 ", + Tab = "󰌒 ", + F1 = "󱊫", + F2 = "󱊬", + F3 = "󱊭", + F4 = "󱊮", + F5 = "󱊯", + F6 = "󱊰", + F7 = "󱊱", + F8 = "󱊲", + F9 = "󱊳", + F10 = "󱊴", + F11 = "󱊵", + F12 = "󱊶", + }, + }, + show_help = true, -- show a help message in the command line for using WhichKey + show_keys = true, -- show the currently pressed key and its label as a message in the command line + -- disable WhichKey for certain buf types and file types. + disable = { + ft = {}, + bt = {}, + }, + debug = false, -- enable wk.log in the current directory +} + +return spec diff --git a/code/src/neovim/editor/src/plugins/lazy.rs b/code/src/neovim/editor/src/plugins/lazy.rs new file mode 100644 index 0000000..78ce92a --- /dev/null +++ b/code/src/neovim/editor/src/plugins/lazy.rs @@ -0,0 +1,306 @@ +use std::path::PathBuf; + +use git2::build::RepoBuilder; +use nvim_oxi::{ + self, + mlua, // +}; + +use super::{configs, spec::SpecInfo}; +use crate::{ + core::keymaps::{Key, MAPPING}, + lua_spec, + utils::{ + constants, + trace::{self, NotifyLevel}, + }, +}; + +pub struct PluginManager; + +impl PluginManager { + pub fn new() -> nvim_oxi::Result { + Self::setup()?; + Ok(Self) + } + + // Setup lazy.nvim with plugins + fn setup() -> nvim_oxi::Result<()> { + // + let lua = mlua::lua(); + Self::bootstrap(lua.clone())?; + + let spec = Self::validated_spec(&lua); + let nvim_treesitter_home: &str = &constants::NVIM_TREESITTER_HOME; + let nvim_plugins_home: &str = &constants::NVIM_PM_INSTALL_HOME; + let nvim_lock_path: &str = &constants::NVIM_PM_LOCK; + + let lazy_config = lua_spec!( + "configs/lazy.lua", + &[ + ("SPEC", &spec), + ("NVIM_TS_HOME", nvim_treesitter_home), + ("NVIM_PLUGINS_HOME", nvim_plugins_home), + ("NVIM_LOCK_PATH", nvim_lock_path) + ] + ); + + lua.load(lazy_config.spec).exec()?; + + Ok(()) + } + + fn bootstrap(lua: mlua::Lua) -> nvim_oxi::Result<()> { + let lazypath: PathBuf = PathBuf::from(&*constants::NVIM_PM_INSTALL_HOME).join("lazy.nvim"); + + if !lazypath.exists() { + let lazy_remote = "https://github.com/folke/lazy.nvim.git"; + + tracing::info!("lazy.nvim not found, installing from {lazy_remote}"); + + let mut fo = git2::FetchOptions::new(); + fo.depth(1); + if let Err(e) = RepoBuilder::new().branch("main").fetch_options(fo).clone(lazy_remote, &lazypath) { + tracing::error!("Failed to clone lazy.nvim: {e}"); + } + }; + + let exec = format!("vim.opt.rtp:prepend({:?})", lazypath); + lua.load(exec).exec()?; + + Ok(()) + } +} + +impl PluginManager { + /// Formats a spec error with the actual Rust source file, line number, and offending code. + /// + /// Example output: + /// ```text + /// [Abstract] Invalid spec 'vim_dadbod' + /// --> src/neovim/editor/src/plugins/configs/vim_dadbod.rs:31 + /// | + /// 30 | init = function() + /// > 31 | TESTING FOR ERROR + /// 32 | -- Your DBUI configuration + /// | + /// = '=' expected near 'FOR' + /// ``` + fn format_spec_error(name: &str, info: &SpecInfo, raw_error: &str) -> String { + let lua_line = Self::extract_error_line(raw_error); + let error_msg = Self::extract_error_message(raw_error); + + if info.spec.contains("--@src:") { + Self::format_file_error(name, info, lua_line, error_msg) + } else { + Self::format_inline_error(name, info, lua_line, error_msg) + } + } + + /// Format error for `lua_spec!(r#"..."#)` — Lua is inline in Rust file. + fn format_inline_error(name: &str, info: &SpecInfo, lua_line: Option, error_msg: &str) -> String { + let lines: Vec<&str> = info.spec.lines().collect(); + let rust_line = lua_line.map(|l| info.spec_line as usize + l - 1); + + let mut report = format!("[Abstract] Invalid spec '{name}'\n"); + report.push_str(&format!(" --> {}:{}\n", info.file, rust_line.map(|l| l.to_string()).unwrap_or_default())); + + if let Some(lua_ln) = lua_line { + let start = lua_ln.saturating_sub(2); + let end = (lua_ln + 1).min(lines.len()); + + (start..end).for_each(|i| { + let display_line = info.spec_line as usize + i; + let marker = if i + 1 == lua_ln { ">" } else { " " }; + report.push_str(&format!("{marker} {display_line:4} | {}\n", lines[i])); + }); + } + + report.push_str(&format!(" = {error_msg}")); + report + } + + /// Format error for `lua_spec!(lua_file!(...), ...)` — Lua is in external .lua file. + /// Shows chronological trace: Rust file → Lua file. + fn format_file_error(name: &str, info: &SpecInfo, lua_line: Option, error_msg: &str) -> String { + use crate::plugins::spec::{resolve_full_path, resolve_source}; + + let mut report = format!("[Abstract] Invalid spec '{name}'\n"); + + // 1. Rust source (where the spec is built) + report.push_str(&format!(" 1 --> {}:{} (spec definition)\n", info.file, info.spec_line)); + + if let Some(lua_ln) = lua_line { + if let Some(resolved) = resolve_source(info.spec, lua_ln) { + let full_path = resolve_full_path(info.file, &resolved.relative_path); + + // 2. Lua file (where the error is) + report.push_str(&format!(" 2 --> {}:{}\n", full_path, resolved.source_line)); + + // Code snippet + let lines: Vec<&str> = info.spec.lines().collect(); + let start = lua_ln.saturating_sub(2); + let end = (lua_ln + 1).min(lines.len()); + + for (i, line_content) in lines.iter().enumerate().take(end).skip(start) { + let display_num = resolved.source_line as isize - (lua_ln as isize - 1 - i as isize); + let marker = if i + 1 == lua_ln { ">" } else { " " }; + if line_content.trim().starts_with("--@src:") { + continue; + } + if display_num > 0 { + report.push_str(&format!("{marker} {:4} | {}\n", display_num, line_content)); + } + } + } else { + // No marker — fallback to composed spec line + let lines: Vec<&str> = info.spec.lines().collect(); + let start = lua_ln.saturating_sub(2); + let end = (lua_ln + 1).min(lines.len()); + + (start..end).for_each(|i| { + let marker = if i + 1 == lua_ln { ">" } else { " " }; + report.push_str(&format!("{marker} {:4} | {}\n", i + 1, lines[i])); + }); + } + } + + report.push_str(&format!(" = {error_msg}")); + report + } + + /// Parse line number from Lua error like `[string "plugin:foo"]:2: msg` + fn extract_error_line(error: &str) -> Option { + let after_bracket = error.find("]:")?; + let rest = &error[after_bracket + 2..]; + let colon = rest.find(':')?; + rest[..colon].trim().parse().ok() + } + + /// Extract just the error message, stripping the `[string "..."]:N:` prefix + fn extract_error_message(error: &str) -> &str { + if let Some(bracket_pos) = error.find("]:") { + let rest = &error[bracket_pos + 2..]; + if let Some(colon_pos) = rest.find(':') { + let msg = &rest[colon_pos + 1..]; + return msg.trim(); + } + } + error.trim() + } +} + +/// Macro to build the (name, spec_info) list without repeating yourself. +/// Usage: `specs![module_a, module_b, ...]` +/// Expands to: `vec![("module_a", module_a::Plugin::spec()), ...]` +macro_rules! specs { + (@entry $module:ident) => { + (stringify!($module), $module::Plugin::spec()) + }; + (@entry ($path:literal)) => {{ + let name = $path.rsplit('/').next().unwrap_or($path).trim_end_matches(".lua"); + (name, lua_spec!($path)) + }}; + (@entry ($path:literal, $args:expr)) => {{ + let name = $path.rsplit('/').next().unwrap_or($path).trim_end_matches(".lua"); + (name, lua_spec!($path, $args)) + }}; + ($($entry:tt),* $(,)?) => { + vec![$(specs!(@entry $entry)),*] + }; +} + +impl PluginManager { + /// Validate each plugin spec individually and return only valid ones. + /// Invalid specs show a friendly error message with the offending code line. + fn validated_spec(lua: &mlua::Lua) -> String { + use configs::*; + + let specs: Vec<(&str, SpecInfo)> = specs![ + // Dependencies + ("configs/colorful-menu.lua"), + ("configs/mini-icons.lua"), + ("configs/nio.lua"), + ("configs/nui.lua"), + ("configs/plenary.lua"), + ("configs/web-devicons.lua"), + // + ("configs/abstract-cs.lua"), + ("configs/abstract-cursor.lua"), + ("configs/abstract-line.lua"), + ("configs/abstract-plugs.lua", &[("TERMINAL_MAPPING_SET", MAPPING.set_map_str(Key::AbstractTerminal))]), + ("configs/autopairs.lua"), + ("configs/blink.lua"), + ("configs/bqf.lua"), + ("configs/code-runner.lua", &[("MAPPING_SET", MAPPING.set_map_str(Key::CodeRunner))]), + ("configs/colorizer.lua"), + ("configs/csvview.lua"), + ("configs/dap.lua", &[("MAPPING_SET", MAPPING.set_map_str(Key::Dap))]), + ("configs/dart-vim-plugin.lua"), + ("configs/dropbar-nvim.lua"), + ("configs/fff.lua", &[("MAPPING", MAPPING.get_map(Key::Fff))]), + ("configs/fidget.lua"), + ("configs/flutter-tools.lua"), + ("configs/gitgraph.lua", &[("MAPPING_SET", MAPPING.set_map_str(Key::GitGraph))]), + ("configs/gitsigns.lua"), + ("configs/goto-preview.lua", &[("MAPPING_SET", MAPPING.set_map_str(Key::GotoPreview))]), + ("configs/grapple.lua"), + ("configs/helpview.lua"), + ("configs/hop.lua", &[("MAPPING", MAPPING.get_map(Key::Hop))]), + ("configs/hovercraft.lua", &[("MAPPING", MAPPING.get_map(Key::Hovercraft))]), + ("configs/java.lua"), + ("configs/kulala.lua", &[("MAPPING_SET", MAPPING.set_map_str(Key::Kulala))]), + ("configs/lazydev-nvim.lua"), + ("configs/luasnip.lua"), + ("configs/markdown-preview.lua"), + ("configs/markview.lua", &[("MAPPING_SET", MAPPING.set_map_str(Key::Markview))]), + ("configs/neo-tree.lua", &[("MAPPING_SET", MAPPING.set_map_str(Key::NeoTree))]), + ("configs/neotest.lua"), + ("configs/noice.lua"), + ("configs/oil.lua", &[("MAPPING", MAPPING.get_map(Key::Oil))]), + ("configs/penvim.lua"), + ("configs/renamer.lua"), + ("configs/rustaceanvim.lua"), + ("configs/schema-store.lua"), + ("configs/session-manager.lua", &[("MAPPING_SET", MAPPING.set_map_str(Key::SessionManager))]), + ("configs/surround.lua"), + ("configs/tabby.lua"), + ("configs/tiny-code-action.lua"), + ("configs/treesitter.lua", &[("NVIM_TS_HOME", &constants::NVIM_TREESITTER_HOME)]), + ("configs/trouble.lua", &[("MAPPING_SET", MAPPING.set_map_str(Key::Trouble))]), + ("configs/ts-autotag.lua"), + ("configs/typescript-tools.lua"), + ("configs/typst-preview.lua"), + ("configs/vim-dadbod.lua"), + ("configs/which-key.lua", &[("MAPPING", MAPPING.get_map(Key::WhichKey))]), + comment_nvim, + mason, + snack, + ]; + + let mut valid_specs = Vec::with_capacity(specs.len()); + + for (name, info) in &specs { + let check_code = format!("local _ = {}", info.spec); + let chunk_name = format!("plugin:{name}"); + + match lua.load(&check_code).set_name(&chunk_name).exec() { + Ok(()) => { + valid_specs.push(info.spec); + }, + Err(e) => { + let report = Self::format_spec_error(name, info, &e.to_string()); + tracing::error!("Plugin spec validation failed:\n{report}"); + if info.spec.contains("--@src:") { + trace::vim_notify_error_report(&report); + } else { + trace::vim_notify(&report, NotifyLevel::Error); + } + }, + } + } + + tracing::info!("Validated {}/{} plugin specs", valid_specs.len(), specs.len()); + format!("{{\n{}\n}}", valid_specs.join(",\n")) + } +} diff --git a/code/src/neovim/editor/src/plugins/mod.rs b/code/src/neovim/editor/src/plugins/mod.rs new file mode 100644 index 0000000..b1dfffb --- /dev/null +++ b/code/src/neovim/editor/src/plugins/mod.rs @@ -0,0 +1,3 @@ +pub mod configs; +pub mod lazy; +pub mod spec; diff --git a/code/src/neovim/editor/src/plugins/spec.rs b/code/src/neovim/editor/src/plugins/spec.rs new file mode 100644 index 0000000..c58b1b8 --- /dev/null +++ b/code/src/neovim/editor/src/plugins/spec.rs @@ -0,0 +1,228 @@ +// ── Plugin Spec System ── +// +// Two macros to define plugins: +// +// lua_spec!("plugin.lua") +// lua_spec!("plugin.lua", &[("VAR", "value")]) +// lua_spec!(raw r#"{ "author/plugin", lazy = true }"#) +// +// One macro for section extraction: +// +// lua_section!("sub_plugin.lua", "spec") +// lua_section!("sub_plugin.lua", "setup", &[("VAR", "value")]) + +use crate::utils::trace; + +pub struct SpecInfo { + pub spec: &'static str, + pub file: &'static str, + pub spec_line: u32, +} + +#[macro_export] +macro_rules! lua_spec { + // Inline Lua string (legacy) + (raw $spec:expr) => { + $crate::plugins::spec::SpecInfo { spec: $spec, file: file!(), spec_line: line!() } + }; + // File, no args + ($path:literal) => {{ + let content = include_str!($path); + let parsed = $crate::plugins::spec::parse_lua(content, &[], $path, file!(), line!()); + let tagged = format!("(function()\n--@src:{}\n{parsed}\nend)()", $path); + $crate::plugins::spec::SpecInfo { spec: Box::leak(tagged.into_boxed_str()), file: file!(), spec_line: line!() } + }}; + // File with args + ($path:literal, $args:expr) => {{ + let content = include_str!($path); + let parsed = $crate::plugins::spec::parse_lua(content, $args, $path, file!(), line!()); + let tagged = format!("(function()\n--@src:{}\n{parsed}\nend)()", $path); + $crate::plugins::spec::SpecInfo { spec: Box::leak(tagged.into_boxed_str()), file: file!(), spec_line: line!() } + }}; +} + +#[macro_export] +macro_rules! lua_section { + ($path:literal, $section:literal) => { + $crate::plugins::spec::extract_section(($path, include_str!($path)), $section, &[]) + }; + ($path:literal, $section:literal, $args:expr) => { + $crate::plugins::spec::extract_section(($path, include_str!($path)), $section, $args) + }; +} + +// ── Template Parser ── +// +// Replaces `--[[@rs $VAR ]]` markers in Lua files with values from Rust. +// Reports to Neovim if a `$VAR` has no matching arg. + +pub fn parse_lua(content: &str, args: &[(&str, &str)], lua_path: &str, rust_file: &str, rust_line: u32) -> String { + let mut result = String::with_capacity(content.len()); + let mut rest = content; + let arg_names: Vec<&str> = args.iter().map(|(n, _)| *n).collect(); + + while let Some(start) = rest.find("--[[@rs") { + result.push_str(&rest[..start]); + + let after_marker = &rest[start + 7..]; + if let Some(end) = after_marker.find("]]") { + let template = after_marker[..end].trim(); + + if check_unresolved(template, &arg_names, lua_path, rust_file, rust_line) { + let mut expanded = template.to_string(); + for (name, val) in args { + let pattern = format!("${name}"); + let mut replaced = String::new(); + let mut scan = expanded.as_str(); + while let Some(pos) = scan.find(&pattern) { + replaced.push_str(&scan[..pos]); + let after = &scan[pos + pattern.len()..]; + // Word boundary check: only replace if next char isn't alphanumeric or _ + let next_ch = after.chars().next(); + if next_ch.is_none_or(|c| !c.is_alphanumeric() && c != '_') { + replaced.push_str(val); + } else { + replaced.push_str(&pattern); + } + scan = after; + } + replaced.push_str(scan); + expanded = replaced; + } + + let marker_newlines = rest[start..start + 7 + end + 2].chars().filter(|&c| c == '\n').count(); + let expanded_newlines = expanded.chars().filter(|&c| c == '\n').count(); + + result.push_str(&expanded); + + // Multi-line expansion shifts lines — re-anchor + if expanded_newlines > marker_newlines { + let consumed = content.len() - after_marker[end + 2..].len(); + let next_original_line = content[..consumed].chars().filter(|&c| c == '\n').count() + 1; + result.push_str(&format!("\n--@src:{lua_path}:{next_original_line}\n")); + } + } + + rest = &after_marker[end + 2..]; + } else { + result.push_str(&rest[start..start + 7]); + rest = &rest[start + 7..]; + } + } + + result.push_str(rest); + result +} + +fn check_unresolved(template: &str, arg_names: &[&str], lua_path: &str, rust_file: &str, rust_line: u32) -> bool { + let mut scan = template; + while let Some(pos) = scan.find('$') { + let var_end = scan[pos + 1..].find(|c: char| !c.is_alphanumeric() && c != '_').unwrap_or(scan.len() - pos - 1); + let var_name = &scan[pos + 1..pos + 1 + var_end]; + if !var_name.is_empty() && !arg_names.contains(&var_name) { + let msg = format!( + "[Abstract] Unresolved variable `${var_name}`\n \ + --> template: {lua_path}\n \ + --> called from: {rust_file}:{rust_line}\n \ + Hint: pass (\"{var_name}\", \"value\") in the args", + ); + tracing::error!("{msg}"); + trace::vim_notify(&msg, trace::NotifyLevel::Error); + return false; + } + scan = &scan[pos + 1 + var_end..]; + } + true +} + +// ── Source Resolution ── +// +// Scans `--@src:path` or `--@src:path:offset` markers in the composed +// spec string and maps Lua error lines back to the original .lua file. + +pub struct ResolvedSource { + pub relative_path: String, + pub source_line: usize, +} + +pub fn resolve_source(spec: &str, lua_error_line: usize) -> Option { + let mut last_path: Option = None; + let mut last_line: usize = 0; + let mut last_offset: usize = 0; + + for (i, line) in spec.lines().enumerate() { + let line_num = i + 1; + if line_num > lua_error_line { + break; + } + if let Some(marker_pos) = line.find("--@src:") { + let rest = &line[marker_pos + 7..]; + let rest = rest.trim_end(); + let parts: Vec<&str> = rest.rsplitn(2, ':').collect(); + if parts.len() == 2 { + if let Ok(offset) = parts[0].parse::() { + last_path = Some(parts[1].to_string()); + last_offset = offset; + } else { + last_path = Some(rest.to_string()); + last_offset = 0; + } + } else { + last_path = Some(rest.to_string()); + last_offset = 0; + } + last_line = line_num; + } + } + + last_path.map(|path| ResolvedSource { + relative_path: path, + source_line: if last_offset > 0 { + last_offset + (lua_error_line - last_line) - 1 + } else { + lua_error_line - last_line + }, + }) +} + +pub fn resolve_full_path(rust_file: &str, relative_lua_path: &str) -> String { + match rust_file.rfind('/') { + Some(pos) => format!("{}/{}", &rust_file[..pos], relative_lua_path), + None => relative_lua_path.to_string(), + } +} + +// ── Section Extraction ── +// +// Extracts content between `--@section` and `--@end` markers. +// Used for splitting sub-plugin files into spec + setup parts. +// Injects `--@src:path:offset` for error tracing and resolves +// any `--[[@rs $VAR ]]` templates if args are provided. + +pub fn extract_section((path, content): (&str, &str), section: &str, args: &[(&str, &str)]) -> &'static str { + let body = extract_section_raw(content, section); + if body.is_empty() { + return ""; + } + + let body_start = content.find(body).unwrap_or(0); + let line_offset = content[..body_start].chars().filter(|&c| c == '\n').count() + 1; + + let parsed = if args.is_empty() { body.to_string() } else { parse_lua(body, args, path, path, 0) }; + + Box::leak(format!("--@src:{path}:{line_offset}\n{parsed}").into_boxed_str()) +} + +pub fn extract_section_raw<'a>(content: &'a str, section: &str) -> &'a str { + let start_marker = format!("--@{section}"); + let end_marker = "--@end"; + + let Some(start_pos) = content.find(&start_marker) else { + return ""; + }; + let after = start_pos + start_marker.len(); + let start = content[after..].find('\n').map(|nl| after + nl + 1).unwrap_or(after); + let rest = &content[start..]; + let end = rest.find(end_marker).map(|i| start + i).unwrap_or(content.len()); + content[start..end].trim() +} diff --git a/code/src/neovim/editor/src/utils/api.rs b/code/src/neovim/editor/src/utils/api.rs new file mode 100644 index 0000000..ded353e --- /dev/null +++ b/code/src/neovim/editor/src/utils/api.rs @@ -0,0 +1,26 @@ +use nvim_oxi::{ + self, + api, // +}; + +/// Set an option value +pub fn set_opt(name: &str, value: Opt) -> nvim_oxi::Result<()> +where + Opt: nvim_oxi::conversion::ToObject, +{ + api::set_option_value(name, value, &Default::default())?; + Ok(()) +} + +/// Build a `listchars` option value +pub fn listchars(pairs: &[(&str, &str)]) -> String { + pairs.iter().map(|(k, v)| format!("{k}:{v}")).collect::>().join(",") +} + +/// Append to a comma-separated string option +pub fn append_opt(name: &str, suffix: &str) -> nvim_oxi::Result<()> { + let current = api::get_option_value::(name, &Default::default())?; + let new = if current.is_empty() { suffix.to_string() } else { format!("{current},{suffix}") }; + api::set_option_value(name, new, &Default::default())?; + Ok(()) +} diff --git a/code/src/neovim/editor/src/utils/constants.rs b/code/src/neovim/editor/src/utils/constants.rs new file mode 100644 index 0000000..054f29e --- /dev/null +++ b/code/src/neovim/editor/src/utils/constants.rs @@ -0,0 +1,30 @@ +#![allow(unused)] + +use std::sync::LazyLock; + +use crate::utils::nvim_path; +use nvim_oxi::mlua; + +fn vim_global(key: &str) -> Option { + let lua = mlua::lua(); + lua.load(format!("return vim.g.{key}")).eval::().ok() +} + +pub static ABSTRACT_ROOT: LazyLock = + LazyLock::new(|| vim_global("ABSTRACT_ROOT").unwrap_or_else(|| nvim_path::nvim_stdpath_str("abstract-repo"))); + +pub static ABSTRACT_DATA: LazyLock = + LazyLock::new(|| vim_global("ABSTRACT_DATA").unwrap_or_else(|| nvim_path::nvim_stdpath_str("data"))); + +pub static NVIM_DATA_HOME: LazyLock = LazyLock::new(|| format!("{}/data", ABSTRACT_DATA.as_str())); + +pub static NVIM_TREESITTER_HOME: LazyLock = LazyLock::new(|| { + vim_global("ABSTRACT_TREESITTER_HOME").unwrap_or_else(|| format!("{}/treesitter", NVIM_DATA_HOME.as_str())) +}); + +pub static NVIM_PM_INSTALL_HOME: LazyLock = LazyLock::new(|| { + vim_global("ABSTRACT_PM_INSTALL_HOME").unwrap_or_else(|| format!("{}/plugins", NVIM_DATA_HOME.as_str())) +}); + +pub static NVIM_PM_LOCK: LazyLock = + LazyLock::new(|| vim_global("ABSTRACT_PM_LOCK").unwrap_or_else(|| env!("CARGO_MANIFEST_DIR").to_string())); diff --git a/code/src/neovim/editor/src/utils/mod.rs b/code/src/neovim/editor/src/utils/mod.rs new file mode 100644 index 0000000..7bdfaf3 --- /dev/null +++ b/code/src/neovim/editor/src/utils/mod.rs @@ -0,0 +1,5 @@ +pub mod api; +pub mod constants; +pub mod nvim_path; +pub mod runtime; +pub mod trace; diff --git a/code/src/neovim/editor/src/utils/nvim_path.rs b/code/src/neovim/editor/src/utils/nvim_path.rs new file mode 100644 index 0000000..5ea3792 --- /dev/null +++ b/code/src/neovim/editor/src/utils/nvim_path.rs @@ -0,0 +1,62 @@ +#![allow(unused)] + +use std::{ + env, + path::PathBuf, // +}; + +/// Return the user's home directory (cross-platform) +fn home_dir() -> PathBuf { + if cfg!(windows) { + env::var_os("USERPROFILE").map(PathBuf::from).expect("USERPROFILE not set") + } else { + env::var_os("HOME").map(PathBuf::from).expect("HOME not set") + } +} + +/// XDG helper with fallback +fn xdg(var: &str, fallback: &str) -> PathBuf { + env::var_os(var).map(PathBuf::from).unwrap_or_else(|| home_dir().join(fallback)) +} + +/// Neovim-compatible stdpath implementation +pub fn nvim_stdpath(kind: &str) -> PathBuf { + match kind { + // === UNIX (Linux / macOS) === // + #[cfg(not(windows))] + "config" => xdg("XDG_CONFIG_HOME", ".config").join("nvim"), + + #[cfg(not(windows))] + "data" => xdg("XDG_DATA_HOME", ".local/share").join("nvim"), + + #[cfg(not(windows))] + "cache" => xdg("XDG_CACHE_HOME", ".cache").join("nvim"), + + #[cfg(not(windows))] + "state" => xdg("XDG_STATE_HOME", ".local/state").join("nvim"), + + // === WINDOWS === // + #[cfg(windows)] + "config" => env::var_os("LOCALAPPDATA").map(PathBuf::from).expect("LOCALAPPDATA not set").join("nvim"), + + #[cfg(windows)] + "data" => env::var_os("LOCALAPPDATA").map(PathBuf::from).expect("LOCALAPPDATA not set").join("nvim-data"), + + #[cfg(windows)] + "cache" => env::var_os("TEMP").map(PathBuf::from).expect("TEMP not set").join("nvim"), + + #[cfg(windows)] + "state" => env::var_os("LOCALAPPDATA").map(PathBuf::from).expect("LOCALAPPDATA not set").join("nvim-state"), + + // === ALL PLATFORMS === + "runtime" => env::var_os("VIMRUNTIME") + .map(PathBuf::from) + .expect("VIMRUNTIME not set (must be run inside Neovim)"), + + _ => panic!("invalid stdpath: {kind}"), + } +} + +pub fn nvim_stdpath_str(kind: &str) -> String { + nvim_stdpath(kind).to_string_lossy().into_owned() +} diff --git a/code/src/neovim/editor/src/utils/runtime.rs b/code/src/neovim/editor/src/utils/runtime.rs new file mode 100644 index 0000000..da974d5 --- /dev/null +++ b/code/src/neovim/editor/src/utils/runtime.rs @@ -0,0 +1,21 @@ +use std::future::Future; + +use once_cell::sync::Lazy; +use tokio::runtime::Runtime; + +pub static TOKIO: Lazy = Lazy::new(|| { + // Builder::new_multi_thread() + // // .worker_threads(2) // keep this small + // // .enable_time() + // // .enable_io() + // .build() + // .expect("Failed to build Tokio runtime"); + Runtime::new().expect("tokio runtime") +}); + +pub fn spawn(future: F) +where + F: Future + Send + 'static, +{ + TOKIO.spawn(future); +} diff --git a/code/src/neovim/editor/src/utils/trace.rs b/code/src/neovim/editor/src/utils/trace.rs new file mode 100644 index 0000000..0ea53d3 --- /dev/null +++ b/code/src/neovim/editor/src/utils/trace.rs @@ -0,0 +1,98 @@ +use std::{fs, path::PathBuf, sync::Once}; + +use nvim_oxi::mlua; +use tracing_subscriber::{EnvFilter, fmt, prelude::*}; + +use crate::utils::constants; + +static INIT: Once = Once::new(); + +/// Initialize the tracing/logging system. +/// +/// - **File logging**: All levels written to `{NVIM_DATA_HOME}/abstract.log` +/// - **Env filter**: Respects `ABSTRACT_LOG` env var (defaults to `info`) +/// +/// Safe to call multiple times — only initializes once. +pub fn init() { + INIT.call_once(|| { + let log_path = log_file_path(); + + // Ensure the parent directory exists + if let Some(parent) = log_path.parent() { + let _ = fs::create_dir_all(parent); + } + + // Open log file (append mode) + let file = match fs::OpenOptions::new().create(true).append(true).open(&log_path) { + Ok(f) => f, + Err(_) => { + // If we can't open the log file, just skip file logging + eprintln!("[Abstract] Failed to open log file: {}", log_path.display()); + return; + }, + }; + + // Env filter: ABSTRACT_LOG=debug, ABSTRACT_LOG=trace, etc. + let filter = EnvFilter::try_from_env("ABSTRACT_LOG").unwrap_or_else(|_| EnvFilter::new("info")); + + let file_writer = std::sync::Mutex::new(file); + + let file_layer = fmt::layer() + .with_writer(file_writer) + .with_ansi(false) + .with_target(true) + .with_thread_ids(false) + .with_thread_names(false); + + tracing_subscriber::registry().with(filter).with(file_layer).init(); + }); +} + +/// Get the log file path: `{NVIM_DATA_HOME}/abstract.log` +pub fn log_file_path() -> PathBuf { + PathBuf::from(constants::NVIM_DATA_HOME.as_str()).join("abstract.log") +} + +/// Send a notification to Neovim's `vim.notify`. +/// Uses Lua long strings `[==[...]==]` to safely handle any content. +pub fn vim_notify(msg: &str, level: NotifyLevel) { + let lua = mlua::lua(); + let level_str = match level { + NotifyLevel::Error => "vim.log.levels.ERROR", + NotifyLevel::Warn => "vim.log.levels.WARN", + NotifyLevel::Info => "vim.log.levels.INFO", + }; + let _ = lua.load(format!("vim.notify([==[{msg}]==], {level_str})")).exec(); +} + +#[allow(unused)] +pub enum NotifyLevel { + Error, + Warn, + Info, +} + +/// Send a colored error report to Neovim using nvim_echo with highlight groups. +pub fn vim_notify_error_report(report: &str) { + let lua = mlua::lua(); + + let mut chunks = String::from("vim.api.nvim_echo({"); + for line in report.lines() { + let escaped = line.replace('\\', "\\\\").replace('"', "\\\""); + let hl = if line.starts_with("[Abstract]") { + "ErrorMsg" + } else if line.contains("-->") { + "Directory" + } else if line.starts_with('>') { + "WarningMsg" + } else if line.starts_with(" =") { + "ErrorMsg" + } else { + "Comment" + }; + chunks.push_str(&format!("{{\"{escaped}\\n\", \"{hl}\"}},")); + } + chunks.push_str("}, true, {})"); + + let _ = lua.load(&chunks).exec(); +} diff --git a/code/src/plugins/abspm/Cargo.toml b/code/src/plugins/abspm/Cargo.toml new file mode 100644 index 0000000..e101676 --- /dev/null +++ b/code/src/plugins/abspm/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "abspm" +version = { workspace = true } +edition = { workspace = true } + +[dependencies] +chrono = { workspace = true } +dirs = { workspace = true } +futures = { workspace = true } +git2 = { workspace = true } +hex = { workspace = true } +parking_lot = { workspace = true } +sha2 = { workspace = true } +shellexpand = { workspace = true } +toml = { workspace = true } + +[dev-dependencies] +tempfile = { workspace = true } +tokio-test = { workspace = true } diff --git a/code/src/plugins/abspm/README.md b/code/src/plugins/abspm/README.md new file mode 100644 index 0000000..a8ac73f --- /dev/null +++ b/code/src/plugins/abspm/README.md @@ -0,0 +1,2 @@ +# ABSPM +ABSTRACT PLUGIN MANAGER diff --git a/code/src/plugins/abspm/src/lib.rs b/code/src/plugins/abspm/src/lib.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/code/src/plugins/abspm/src/lib.rs @@ -0,0 +1 @@ + diff --git a/code/src/plugins/autogood/Cargo.toml b/code/src/plugins/autogood/Cargo.toml new file mode 100644 index 0000000..642a4d8 --- /dev/null +++ b/code/src/plugins/autogood/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "abstract-autogood" +version = { workspace = true } +edition = { workspace = true } +authors = { workspace = true } +license = { workspace = true } +rust-version = { workspace = true } + +[dependencies] +# local libraries +wl_utils = { workspace = true } + +# 3rd parties libraries +nvim-oxi = { workspace = true } +once_cell = { workspace = true } diff --git a/code/src/plugins/autogood/README.md b/code/src/plugins/autogood/README.md new file mode 100644 index 0000000..d2cb2b6 --- /dev/null +++ b/code/src/plugins/autogood/README.md @@ -0,0 +1,3 @@ +sane good defaults + +# TODO: write proper documentation diff --git a/code/src/plugins/autogood/src/autocmds.rs b/code/src/plugins/autogood/src/autocmds.rs new file mode 100644 index 0000000..d5914b1 --- /dev/null +++ b/code/src/plugins/autogood/src/autocmds.rs @@ -0,0 +1,111 @@ +use nvim_oxi::{ + Result, + api::{ + self, + create_autocmd, // + opts::{ + CreateAugroupOpts, + CreateAutocmdOpts, // + }, + }, +}; + +use wl_utils::neovim::types::events::Events; + +pub struct AutoCmds {} + +impl AutoCmds { + pub fn new(name: &str) -> Result { + let opts = CreateAugroupOpts::builder().clear(true).build(); + let group_id = api::create_augroup(name, &opts)?; + + Self::highlight_on_yank(group_id, Some(150))?; + Self::open_file_last_position(group_id)?; + Self::remove_whitespace_on_save(group_id)?; + Self::clear_last_used_search(group_id)?; + Self::dont_suspend_with_cz(group_id)?; + + Ok(Self {}) + } + + // WARN: it was supposed to called by callback not the command. this function can be improved + fn highlight_on_yank(group_id: u32, timeout_ms: Option) -> Result<()> { + let timeout = timeout_ms.unwrap_or(150); + let cmd = format!("lua vim.hl.on_yank({{higroup = 'Search', timeout = {}, on_visual = true}})", timeout); + + let opts = CreateAutocmdOpts::builder() + .group(group_id) + .desc("highlight text on yank") + .patterns(["*"]) + .command(cmd) + .build(); + create_autocmd([Events::TextYankPost.as_ref()], &opts)?; + + Ok(()) + } + + fn open_file_last_position(group_id: u32) -> Result<()> { + let opts = CreateAutocmdOpts::builder() + .group(group_id) + .desc("jump to the last position when reopening a file") + .patterns(["*"]) + .command(r#"if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif"#) + .build(); + + create_autocmd([Events::BufWinEnter.as_ref()], &opts)?; + + Ok(()) + } + + fn remove_whitespace_on_save(group_id: u32) -> Result<()> { + let opts = CreateAutocmdOpts::builder() + .desc("remove whitespaces on save") + .group(group_id) + .patterns(["*"]) + .command("%s/\\s\\+$//e") + .build(); + + create_autocmd([Events::BufWritePre.as_ref()], &opts)?; + + Ok(()) + } + + fn _no_autocomment_newline(group_id: u32) -> Result<()> { + let opts = CreateAutocmdOpts::builder() + .desc("don't auto comment new line") + .group(group_id) + .patterns(["*"]) + .command("setlocal formatoptions-=c formatoptions-=r formatoptions-=o") + .build(); + + create_autocmd([Events::BufEnter.as_ref(), Events::FileType.as_ref()], &opts)?; + + Ok(()) + } + + fn clear_last_used_search(group_id: u32) -> Result<()> { + let opts = CreateAutocmdOpts::builder() + .desc("clear the last used search pattern") + .group(group_id) + .patterns(["*"]) + .command("let @/ = ''") + .build(); + + create_autocmd([Events::BufWinEnter.as_ref()], &opts)?; + + Ok(()) + } + + fn dont_suspend_with_cz(group_id: u32) -> Result<()> { + let opts = CreateAutocmdOpts::builder() + .desc("map ctrl+z to nothing so that it doesn't suspend terminal") + .group(group_id) + .patterns(["*"]) + .command("nnoremap ") + .build(); + + create_autocmd([Events::BufEnter.as_ref()], &opts)?; + + Ok(()) + } +} diff --git a/code/src/plugins/autogood/src/init.rs b/code/src/plugins/autogood/src/init.rs new file mode 100644 index 0000000..4f7bb52 --- /dev/null +++ b/code/src/plugins/autogood/src/init.rs @@ -0,0 +1,48 @@ +use std::marker::PhantomData; + +use crate::{ + autocmds::AutoCmds, + keymaps::Mapping, // +}; + +pub struct KeymapsUnset; +pub struct KeymapsSet; +pub struct AutocmdsUnset; +pub struct AutocmdsSet; + +// Init builder +#[derive(Default)] +pub struct Init { + _keymaps: PhantomData, + _autocmds: PhantomData, +} + +// Initial state +impl Init { + pub fn new() -> Self { + Self { _keymaps: PhantomData, _autocmds: PhantomData } + } +} + +// keymaps(): callable only once +impl Init { + pub fn keymaps(self) -> Init { + let _ = Mapping::init(); + + Init { _keymaps: PhantomData, _autocmds: PhantomData } + } +} + +// autocmds(): callable only once +impl Init { + pub fn autocmds(self) -> Init { + let _ = AutoCmds::new("ABSTRACT_AUTOCMDS"); + + Init { _keymaps: PhantomData, _autocmds: PhantomData } + } +} + +// Optional: finalize step +impl Init { + pub fn build(self) {} +} diff --git a/code/src/plugins/autogood/src/keymaps.rs b/code/src/plugins/autogood/src/keymaps.rs new file mode 100644 index 0000000..473caab --- /dev/null +++ b/code/src/plugins/autogood/src/keymaps.rs @@ -0,0 +1,108 @@ +use nvim_oxi::{ + Function, Result, + api::{ + command, + get_current_line, + opts::SetKeymapOpts, + set_keymap, + types::Mode, // + }, +}; + +pub struct Mapping; + +impl Mapping { + pub fn init() -> Result<()> { + Self::smart_dd()?; + Self::visually_codeblock_shift()?; + Self::move_selected_upndown()?; + Self::go_back_normal_in_terminal()?; + Self::ctrl_backspace_delete()?; + Self::smart_visual_paste()?; + Self::smart_save_in_insert_mode()?; + Self::scroll_from_center()?; + Self::search_within_visual()?; + + Ok(()) + } + + pub fn smart_dd() -> Result<()> { + let callback = Function::from_fn(move |_| -> Result<()> { + let line = get_current_line()?; + + if line.trim().is_empty() { + command("normal! \"_dd")?; + } else { + command("normal! dd")?; + } + + Ok(()) + }); + + let opts = SetKeymapOpts::builder().noremap(true).silent(true).callback(callback).build(); + + set_keymap(Mode::Normal, "dd", "", &opts)?; + + Ok(()) + } + + // easier moving of code blocks + fn visually_codeblock_shift() -> Result<()> { + set_keymap(Mode::Visual, "<", "", ">gv", &default_key_opts())?; + Ok(()) + } + + // move selected line(s) up/down + fn move_selected_upndown() -> Result<()> { + set_keymap(Mode::Visual, "J", ":m '>+1gv=gv", &default_key_opts())?; + set_keymap(Mode::Visual, "K", ":m '<-2gv=gv", &default_key_opts())?; + Ok(()) + } + + // escape terminal to normal mode + fn go_back_normal_in_terminal() -> Result<()> { + set_keymap(Mode::Terminal, "", "", &default_key_opts())?; + Ok(()) + } + + // Ctrl+Backspace delete (insert + cmdline) + fn ctrl_backspace_delete() -> Result<()> { + let map_opts = SetKeymapOpts::builder().noremap(true).build(); + set_keymap(Mode::CmdLine, "", "", &map_opts)?; + set_keymap(Mode::Insert, "", "", &map_opts)?; + Ok(()) + } + + // paste without overwriting yank + fn smart_visual_paste() -> Result<()> { + set_keymap(Mode::Visual, "p", r#"silent! normal! "_dP"#, &default_key_opts())?; + Ok(()) + } + + // smart save (insert + normal) + fn smart_save_in_insert_mode() -> Result<()> { + let rhs = "ma:update `a"; + set_keymap(Mode::Insert, "", rhs, &default_key_opts())?; + set_keymap(Mode::Normal, "", rhs, &default_key_opts())?; + Ok(()) + } + + // scroll from center + fn scroll_from_center() -> Result<()> { + set_keymap(Mode::Normal, "", "zz", &default_key_opts())?; + set_keymap(Mode::Normal, "", "zz", &default_key_opts())?; + Ok(()) + } + + // search within visual selection + fn search_within_visual() -> Result<()> { + let opts = SetKeymapOpts::builder().noremap(true).build(); + set_keymap(Mode::Visual, "/", "/\\%V", &opts)?; + Ok(()) + } +} + +fn default_key_opts() -> SetKeymapOpts { + SetKeymapOpts::builder().noremap(true).silent(true).build() +} diff --git a/code/src/plugins/autogood/src/lib.rs b/code/src/plugins/autogood/src/lib.rs new file mode 100644 index 0000000..097843e --- /dev/null +++ b/code/src/plugins/autogood/src/lib.rs @@ -0,0 +1,5 @@ +mod autocmds; +mod init; +mod keymaps; + +pub use init::Init; diff --git a/code/src/plugins/indent/Cargo.toml b/code/src/plugins/indent/Cargo.toml new file mode 100755 index 0000000..8e1eecf --- /dev/null +++ b/code/src/plugins/indent/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "abstract-indent" +version = "0.1.0" +edition = "2024" + +[lib] +crate-type = ["rlib", "cdylib"] + +[dependencies] +wl_utils = { workspace = true } +# +memmap2 = { workspace = true } +nvim-oxi = { workspace = true } +rayon = { workspace = true } +serde = { workspace = true } + +[dev-dependencies] +serde_json = { workspace = true } diff --git a/code/src/plugins/indent/src/core/README.md b/code/src/plugins/indent/src/core/README.md new file mode 100755 index 0000000..e031719 --- /dev/null +++ b/code/src/plugins/indent/src/core/README.md @@ -0,0 +1,17 @@ +# Indentation Detection Library + +# Features + +- **Indentation Style Detection:** Distinguishes between space indentation (and the typical indent width), tab indentation, mixed indentation, no indentation, or binary content. +- **Memory Mapping:** Uses `memmap2` to efficiently memory-map files for fast reading of large files (with a fallback to normal I/O if mapping is not possible). +- **Parallel Analysis:** Utilizes `rayon` to speed up analysis of large files by parallelizing line inspection. +- **Robust Encoding Handling:** Gracefully handles UTF-8 files and falls back to byte-based analysis for files with invalid UTF-8 or other encodings (including detection of UTF-16 via BOM). +- **Binary Detection:** Defensively detects binary or non-text files using null-byte presence and entropy analysis to avoid misclassifying binary content as text:contentReference[oaicite:0]{index=0}. +- **Configurable Sampling:** Supports analyzing the entire file or only a sample (first N lines or first N% of the file) for performance. + +# How it Works + +The library reads the file (via memory map or buffered I/O) and inspects the beginning of each line to count leading whitespace characters. +It determines if the indentation is consistently spaces or tabs, or if both are used. +It also treats files with no indentation as `IndentStyle::None`, and uses heuristics (null bytes and Shannon entropy) to mark a file as `IndentStyle::Binary` if it's not likely text:contentReference[oaicite:1]{index=1}. +For files with invalid UTF-8 sequences, it will fall back to analyzing the raw bytes to still detect indentation correctly. diff --git a/code/src/plugins/indent/src/core/analyzer.rs b/code/src/plugins/indent/src/core/analyzer.rs new file mode 100755 index 0000000..dbdfb9a --- /dev/null +++ b/code/src/plugins/indent/src/core/analyzer.rs @@ -0,0 +1,179 @@ +//! Core logic to determine the indentation style from text content. +//! +//! The `analyzer` module processes the content of a file (as bytes) to determine which indentation style is used. +//! It inspects each line's leading whitespace and classifies the file's indent style as tabs, spaces, mixed, none, or binary (the latter is typically flagged during scanning). +//! +//! The analysis logic handles different line endings (LF, CRLF, CR) and operates on raw bytes, making it robust even if the input is not valid UTF-8. + +use rayon::prelude::*; + +use super::types::IndentStyle; + +/// Analyzer for indentation patterns. +pub struct IndentAnalyzer; + +impl IndentAnalyzer { + pub fn new() -> Self { + Self + } + + /// Analyze the given content bytes and determine the indentation style. + /// + /// This method assumes the input is not binary (for binary content, detection should be handled in the scanning phase). + /// It will interpret the bytes, handling UTF-8 or other encodings gracefully by focusing only on ASCII whitespace and line breaks. + pub fn analyze(&self, content: &[u8]) -> IndentStyle { + if content.is_empty() { + return IndentStyle::None; + } + // Split the content into lines (handles LF, CRLF, and CR line endings). + let lines = Self::split_lines(content); + + // Counters for lines that use spaces, tabs, or mixed indent. + let (space_count, tab_count, mixed_count) = lines + .par_iter() + .map(|line| Self::classify_line_indent(line)) + .reduce(|| (0, 0, 0), |(s1, t1, m1), (s2, t2, m2)| (s1 + s2, t1 + t2, m1 + m2)); + + // Determine the overall indentation style. + match (mixed_count > 0, space_count > 0, tab_count > 0) { + (true, _, _) | (_, true, true) => IndentStyle::Mixed, + (_, true, _) => IndentStyle::Space(Self::infer_space_indent_width(&lines)), + (_, _, true) => IndentStyle::Tab, + _ => IndentStyle::None, + } + } + + /// Infer the typical number of spaces per indent level by examining space-indented lines. + /// Returns a common indent size (like 2 or 4) if it can be determined, or 1 if inconsistent or only single-space indents. + fn infer_space_indent_width(lines: &[Vec]) -> usize { + // Collect indent lengths (leading spaces count) for each line that is indented with spaces. + let mut indent_lengths: Vec = lines + .iter() + .filter_map(|line| { + if line.is_empty() || line[0] != b' ' { + None + } else { + let count = line.iter().take_while(|&&b| b == b' ').count(); + if count > 0 { Some(count) } else { None } + } + }) + .collect(); + if indent_lengths.is_empty() { + return 1; + } + indent_lengths.sort_unstable(); + let min = indent_lengths[0]; + if min == 0 { + return 1; + } + // If all indent lengths are multiples of the smallest, assume that as indent unit. + if indent_lengths.iter().all(|&len| len % min == 0) { + return min; + } + // Otherwise, find the greatest common divisor of all indent lengths as a guess. + let mut g = indent_lengths[0]; + for &len in &indent_lengths[1..] { + g = gcd(g, len); + if g <= 1 { + break; + } + } + + g.max(1) + } + + /// Classify a single line's leading indent characters. + /// Returns a tuple `(spaces, tabs, mixed)` counts, where each is 0 or 1 for this line. + fn classify_line_indent(line: &[u8]) -> (usize, usize, usize) { + if line.is_empty() { + return (0, 0, 0); + } + let mut space = 0; + let mut tab = 0; + let mut mixed = 0; + let mut i = 0; + // Count leading spaces or tabs + while i < line.len() { + match line[i] { + b' ' => { + if tab > 0 { + mixed = 1; + break; // already saw a tab, now a space -> mixed indent + } + space = 1; + }, + b'\t' => { + if space > 0 { + mixed = 1; + break; + } + tab = 1; + }, + _ => break, // first non-whitespace character reached + } + i += 1; + } + // Note: if a line is only whitespace (indent and nothing else), we treat those indent characters as valid evidence. + if mixed == 1 { + (0, 0, 1) + } else if tab == 1 { + (0, 1, 0) + } else if space == 1 { + (1, 0, 0) + } else { + (0, 0, 0) + } + } + + /// Split content into lines, handling different line terminators (LF, CRLF, CR). + /// Returns a vector of lines, each as a `Vec` of its bytes (excluding newline characters). + fn split_lines(content: &[u8]) -> Vec> { + let mut lines = Vec::new(); + let len = content.len(); + if len == 0 { + return lines; + } + let mut start = 0; + let mut i = 0; + while i < len { + match content[i] { + b'\n' => { + // LF found – mark end of line + let end = if i > 0 && content[i - 1] == b'\r' { + i - 1 // exclude the preceding CR from the line + } else { + i + }; + lines.push(content[start..end].to_vec()); + start = i + 1; + }, + b'\r' => { + if i == len - 1 { + // CR at EOF (no LF after), treat as line break + lines.push(content[start..i].to_vec()); + start = i + 1; + } + // If CR is followed by LF, the LF branch above will handle pushing the line. + }, + _ => { /* normal character, continue */ }, + } + i += 1; + } + // Push the last line if the file doesn't end with a newline + if start < len { + lines.push(content[start..len].to_vec()); + } + + lines + } +} + +impl Default for IndentAnalyzer { + fn default() -> Self { + Self::new() + } +} + +fn gcd(a: usize, b: usize) -> usize { + if b == 0 { a } else { gcd(b, a % b) } +} diff --git a/code/src/plugins/indent/src/core/error.rs b/code/src/plugins/indent/src/core/error.rs new file mode 100755 index 0000000..33bd7e4 --- /dev/null +++ b/code/src/plugins/indent/src/core/error.rs @@ -0,0 +1,30 @@ +use std::{ + fmt, + io, // +}; + +#[derive(Debug)] +pub enum IndentError { + /// An underlying I/O error occurred (e.g., file not found, permission denied, read error). + Io(io::Error), + /// An invalid configuration was provided (e.g., invalid sample percentage). + InvalidConfig(String), +} + +impl fmt::Display for IndentError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + IndentError::Io(err) => write!(f, "I/O error: {}", err), + IndentError::InvalidConfig(msg) => write!(f, "Invalid configuration: {}", msg), + } + } +} + +impl std::error::Error for IndentError { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + IndentError::Io(err) => Some(err), + IndentError::InvalidConfig(_) => None, + } + } +} diff --git a/code/src/plugins/indent/src/core/indent.rs b/code/src/plugins/indent/src/core/indent.rs new file mode 100755 index 0000000..213e364 --- /dev/null +++ b/code/src/plugins/indent/src/core/indent.rs @@ -0,0 +1,54 @@ +use std::path::Path; + +pub use super::{ + analyzer::IndentAnalyzer, + error::IndentError, + scanner::{ScanResult, Scanner}, + types::{IndentConfig, IndentStyle}, +}; + +/// Main public interface for indentation detection. +pub struct Indent { + config: IndentConfig, +} + +#[allow(unused)] +impl Indent { + pub fn new(config: IndentConfig) -> Self { + Self { config } + } + + /// Detect indentation by reading directly from a file path on disk. + pub fn detect_from_file>(&self, path: P) -> Result { + detect_indent_file(path.as_ref(), &self.config) + } + + /// Detect indentation from an existing in-memory byte slice (e.g. a Neovim buffer). + pub fn detect_from_bytes(&self, bytes: &[u8]) -> Result { + detect_indent_bytes(bytes, &self.config) + } +} + +/// Standalone function to scan and analyze a file. +pub fn detect_indent_file>(path: P, config: &IndentConfig) -> Result { + let scanner = Scanner::new(config.clone()); + let scan_result = scanner.scan_file(path.as_ref())?; + analyze_scan_result(scan_result) +} + +/// Standalone function to scan and analyze raw in-memory bytes. +pub fn detect_indent_bytes(bytes: &[u8], config: &IndentConfig) -> Result { + let scanner = Scanner::new(config.clone()); + let scan_result = scanner.scan_bytes(bytes)?; + analyze_scan_result(scan_result) +} + +/// Routes the output of the Scanner to the IndentAnalyzer. +fn analyze_scan_result(scan_result: ScanResult) -> Result { + if scan_result.is_binary { + return Ok(IndentStyle::Binary); + } + + let style = IndentAnalyzer::new().analyze(&scan_result.content); + Ok(style) +} diff --git a/code/src/plugins/indent/src/core/mod.rs b/code/src/plugins/indent/src/core/mod.rs new file mode 100755 index 0000000..4b38b7a --- /dev/null +++ b/code/src/plugins/indent/src/core/mod.rs @@ -0,0 +1,5 @@ +pub mod analyzer; +pub mod error; +pub mod indent; +pub mod scanner; +pub mod types; diff --git a/code/src/plugins/indent/src/core/scanner.rs b/code/src/plugins/indent/src/core/scanner.rs new file mode 100755 index 0000000..8bc1d6b --- /dev/null +++ b/code/src/plugins/indent/src/core/scanner.rs @@ -0,0 +1,172 @@ +use std::{ + fs::File, + io::{BufRead, BufReader, Cursor, Read, Seek, SeekFrom}, + path::Path, +}; + +use super::{ + error::IndentError, + types::{IndentConfig, SampleMode}, +}; + +/// Result of scanning a file or buffer, containing the extracted bytes +/// and a flag indicating if the content appears to be binary. +pub struct ScanResult { + pub content: Vec, + pub is_binary: bool, +} + +/// Handles reading and sampling data from files or memory buffers, +/// applying binary detection heuristics before full processing. +pub struct Scanner { + config: IndentConfig, +} + +impl Scanner { + pub fn new(config: IndentConfig) -> Self { + Scanner { config } + } + + /// Scans a file from disk. Attempts memory mapping for performance + /// if a full read is requested, falling back to buffered reading. + pub fn scan_file(&self, path: &Path) -> Result { + let file = File::open(path).map_err(IndentError::Io)?; + let file_size = file.metadata().map_err(IndentError::Io)?.len(); + + // Fast-path: Memory map full files instead of copying bytes into memory + if let SampleMode::Full = self.config.sample_mode + && file_size > 0 + { + // SAFETY: We assume the underlying file is not truncated or modified + // by another process while the map is active. + if let Ok(mmap) = unsafe { memmap2::Mmap::map(&file) } { + return self.process_raw_bytes(&mmap, file_size); + } + } + + let mut reader = BufReader::new(file); + self.scan_reader(&mut reader, file_size) + } + + /// Scans an in-memory byte slice (e.g., a live Neovim buffer). + pub fn scan_bytes(&self, bytes: &[u8]) -> Result { + let size = bytes.len() as u64; + + if let SampleMode::Full = self.config.sample_mode { + return self.process_raw_bytes(bytes, size); + } + + // Wrap the slice in a Cursor so it implements Read + Seek, + // allowing us to reuse the exact same logic as file reading. + let mut reader = Cursor::new(bytes); + self.scan_reader(&mut reader, size) + } + + /// The core reading engine. Handles binary peeking and configured sampling strategies. + fn scan_reader(&self, reader: &mut R, total_size: u64) -> Result { + // 1. Peek at the first 1KB to run binary heuristics before doing heavy lifting + let mut buf = [0u8; 1024]; + let n = reader.read(&mut buf).map_err(IndentError::Io)?; + reader.seek(SeekFrom::Start(0)).map_err(IndentError::Io)?; + + if self.is_buffer_binary(&buf[..n], total_size) { + return Ok(ScanResult { content: Vec::new(), is_binary: true }); + } + + // 2. Extract content based on the requested sampling mode + let content = match self.config.sample_mode { + SampleMode::Full => { + let mut buffer = Vec::with_capacity(total_size as usize); + reader.read_to_end(&mut buffer).map_err(IndentError::Io)?; + buffer + }, + SampleMode::Lines(num_lines) => { + let mut buffer = Vec::new(); + let mut line = String::new(); + let mut lines_read = 0; + + while lines_read < num_lines { + line.clear(); + let bytes = reader.read_line(&mut line).map_err(IndentError::Io)?; + if bytes == 0 { + break; + } + + lines_read += 1; + buffer.extend_from_slice(line.as_bytes()); + } + buffer + }, + SampleMode::Percent(percent) => { + let bytes_to_read = ((total_size * percent.min(100) as u64) / 100).max(1).min(total_size); + let mut buffer = Vec::with_capacity(bytes_to_read as usize); + + // Use by_ref() to avoid consuming the original reader wrapper + let mut chunk_reader = reader.by_ref().take(bytes_to_read); + chunk_reader.read_to_end(&mut buffer).map_err(IndentError::Io)?; + + buffer + }, + }; + + Ok(ScanResult { content, is_binary: false }) + } + + /// Fast-path helper for mmap and fully-loaded in-memory buffers. + fn process_raw_bytes(&self, bytes: &[u8], total_size: u64) -> Result { + let peek_size = (total_size as usize).min(1024); + + if self.is_buffer_binary(&bytes[..peek_size], total_size) { + Ok(ScanResult { content: Vec::new(), is_binary: true }) + } else { + Ok(ScanResult { content: bytes.to_vec(), is_binary: false }) + } + } + + /// Uses multiple heuristics to determine if a byte slice is likely binary data. + fn is_buffer_binary(&self, buffer: &[u8], total_size: u64) -> bool { + // Absolute indicator: text files rarely contain null bytes + if buffer.contains(&0) { + return true; + } + if total_size == 0 { + return false; + } + + let len = buffer.len() as f64; + if len == 0.0 { + return false; + } + + // Calculate Shannon entropy to detect highly randomized/compressed data + let mut freq = [0usize; 256]; + for &b in buffer { + freq[b as usize] += 1; + } + + let mut entropy = 0.0; + for &count in freq.iter() { + if count == 0 { + continue; + } + let p = count as f64 / len; + entropy -= p * p.log2(); + } + + // Entropy > 7.5 bits per byte strongly suggests binary/compressed data + if entropy > 7.5 { + return true; + } + + // Check ratio of printable ASCII characters + common whitespace + let printable_count = + buffer.iter().filter(|&&b| b == 0x09 || b == 0x0A || b == 0x0D || (0x20..0x7F).contains(&b)).count(); + + // If less than 30% of the buffer is standard text, assume it's binary + if (printable_count as f64) < 0.3 { + return true; + } + + false + } +} diff --git a/code/src/plugins/indent/src/core/types.rs b/code/src/plugins/indent/src/core/types.rs new file mode 100755 index 0000000..1ab00d9 --- /dev/null +++ b/code/src/plugins/indent/src/core/types.rs @@ -0,0 +1,70 @@ +use std::{ + default::Default, + fmt, // +}; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum IndentStyle { + /// Indentation uses tabs exclusively. + Tab, + /// Indentation uses spaces exclusively. + /// The associated value is an estimate of spaces per indent level (e.g., 4 or 2 spaces). + Space(usize), + /// Mixed indentation (some lines use tabs, others use spaces, or tabs and spaces mixed in the same line). + Mixed, + /// No indentation detected (e.g., all lines start at column 0, or the file is empty). + None, + /// The file is binary or not recognized as text, so indentation style is not applicable. + Binary, +} + +impl fmt::Display for IndentStyle { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match *self { + IndentStyle::Tab => write!(f, "Tabs"), + IndentStyle::Space(n) => { + if n > 1 { + write!(f, "Spaces ({} spaces per indent)", n) + } else { + write!(f, "Spaces") + } + }, + IndentStyle::Mixed => write!(f, "Mixed"), + IndentStyle::None => write!(f, "None"), + IndentStyle::Binary => write!(f, "Binary"), + } + } +} + +/// Specifies how much of the file to analyze. +#[derive(Debug, Clone)] +pub enum SampleMode { + /// Analyze the entire file. + Full, + /// Analyze only the first N lines of the file. + Lines(usize), + /// Analyze only the first N percent of the file (1-100). + Percent(u8), +} + +/// Configuration options for indentation detection. +#[derive(Debug, Clone)] +pub struct IndentConfig { + /// Sampling mode for reading the file (full vs partial). + pub sample_mode: SampleMode, +} + +impl IndentConfig { + /// Builder-style method to set the sampling mode. + pub fn with_sample_mode(mut self, mode: SampleMode) -> Self { + self.sample_mode = mode; + self + } +} + +impl Default for IndentConfig { + /// Create a default configuration that analyzes the full file. + fn default() -> Self { + Self { sample_mode: SampleMode::Full } + } +} diff --git a/code/src/plugins/indent/src/lib.rs b/code/src/plugins/indent/src/lib.rs new file mode 100755 index 0000000..7296b8c --- /dev/null +++ b/code/src/plugins/indent/src/lib.rs @@ -0,0 +1,10 @@ +pub mod core; +mod utils; + +pub use utils::{ + apply_buffer_indent, + auto_detect_and_apply, + detect_buffer_indent, + setup_indent_autocmds, + // +}; diff --git a/code/src/plugins/indent/src/utils.rs b/code/src/plugins/indent/src/utils.rs new file mode 100644 index 0000000..221ff56 --- /dev/null +++ b/code/src/plugins/indent/src/utils.rs @@ -0,0 +1,90 @@ +use std::io::Error; + +use nvim_oxi::api::{ + self, Buffer, + opts::{CreateAugroupOpts, CreateAutocmdOpts, OptionOpts}, +}; + +use wl_utils::neovim::types::events::Events; + +use crate::core::{ + error::IndentError, + indent::Indent, + types::{IndentConfig, IndentStyle}, +}; + +/// Detects the indentation style directly from an open Neovim buffer's live memory. +pub fn detect_buffer_indent(buffer: &Buffer, config: IndentConfig) -> Result { + // Extract lines from Neovim's memory using `..` to mean the entire buffer + let lines = buffer + .get_lines(.., false) + .map_err(|e| -> IndentError { IndentError::Io(Error::other(e.to_string())) })?; + + let mut content = String::new(); + for line in lines { + // to_string_lossy() converts nvim_oxi::String to standard Rust Cow safely + content.push_str(&line.to_string_lossy()); + content.push('\n'); + } + + let indent = Indent::new(config); + indent.detect_from_bytes(content.as_bytes()) +} + +/// Applies the detected indentation style to the given Neovim buffer. +pub fn apply_buffer_indent(buffer: &Buffer, style: IndentStyle) -> Result<(), nvim_oxi::Error> { + let opts = OptionOpts::builder().buffer(buffer.clone()).build(); + + match style { + IndentStyle::Space(n) => { + api::set_option_value("expandtab", true, &opts)?; + api::set_option_value("shiftwidth", n, &opts)?; + api::set_option_value("tabstop", n, &opts)?; + api::set_option_value("softtabstop", n, &opts)?; + }, + IndentStyle::Tab => { + api::set_option_value("expandtab", false, &opts)?; + api::set_option_value("shiftwidth", 0, &opts)?; + // TODO: make it configureable + // 'tabstop' is left untouched to respect user's preferred visual width + }, + IndentStyle::Mixed | IndentStyle::None | IndentStyle::Binary => { + // Do nothing, fall back to Neovim defaults + }, + } + + Ok(()) +} + +pub fn auto_detect_and_apply() { + let cbuff = api::get_current_buf(); + let config = IndentConfig::default(); + + match detect_buffer_indent(&cbuff, config) { + Ok(style) => { + if let Err(e) = apply_buffer_indent(&cbuff, style) { + api::err_writeln(&format!("Indent: Failed to set options: {}", e)); + } + }, + Err(e) => { + api::err_writeln(&format!("Indent: Failed to detect indent: {:?}", e)); + }, + } +} + +pub fn setup_indent_autocmds() -> Result<(), nvim_oxi::Error> { + let group_opts = CreateAugroupOpts::builder().clear(true).build(); + let group_id = api::create_augroup("ABSTRACT_INDENT", &group_opts)?; + + let autocmd_opts = CreateAutocmdOpts::builder() + .group(group_id) + .callback(|_args| -> nvim_oxi::Result { + auto_detect_and_apply(); + Ok(false) + }) + .build(); + + api::create_autocmd([Events::BufReadPost.as_ref()], &autocmd_opts)?; + + Ok(()) +} diff --git a/code/src/plugins/indent/tests/core_tests.rs b/code/src/plugins/indent/tests/core_tests.rs new file mode 100755 index 0000000..a6f1ca9 --- /dev/null +++ b/code/src/plugins/indent/tests/core_tests.rs @@ -0,0 +1,147 @@ +mod utils; + +use abstract_indent::core::{ + indent::Indent, + types::{IndentConfig, IndentStyle, SampleMode}, +}; + +use crate::utils::write_temp_file; + +#[test] +fn test_spaces_indentation() { + let content = b"hello\n world\n foo\n"; + let path = write_temp_file("test_spaces.txt", content); + + let indent = Indent::new(IndentConfig::default()); + let style_file = indent.detect_from_file(&path).expect("failed to detect indent from file"); + let style_bytes = indent.detect_from_bytes(content).expect("failed to detect indent from bytes"); + + assert!(matches!(style_file, IndentStyle::Space(n) if n == 4)); + assert_eq!(style_file, style_bytes); +} + +#[test] +fn test_tabs_indentation() { + let content = b"line1\n\tline2\n\t\tline3\n"; + let path = write_temp_file("test_tabs.txt", content); + + let indent = Indent::new(IndentConfig::default()); + let style_file = indent.detect_from_file(&path).unwrap(); + let style_bytes = indent.detect_from_bytes(content).unwrap(); + + assert_eq!(style_file, IndentStyle::Tab); + assert_eq!(style_file, style_bytes); +} + +#[test] +fn test_mixed_indentation() { + let content = b"def\n\tif True:\n return 42\n"; + let path = write_temp_file("test_mixed.txt", content); + + let indent = Indent::new(IndentConfig::default()); + let style_file = indent.detect_from_file(&path).unwrap(); + let style_bytes = indent.detect_from_bytes(content).unwrap(); + + assert_eq!(style_file, IndentStyle::Mixed); + assert_eq!(style_file, style_bytes); +} + +#[test] +fn test_none_indentation() { + let content = b"foo\nbar\nbaz\n"; + let path = write_temp_file("test_none.txt", content); + + let indent = Indent::new(IndentConfig::default()); + let style_file = indent.detect_from_file(&path).unwrap(); + let style_bytes = indent.detect_from_bytes(content).unwrap(); + + assert_eq!(style_file, IndentStyle::None); + assert_eq!(style_file, style_bytes); +} + +#[test] +fn test_crlf_handling() { + let content = b"first\r\n second\r\n\tthird\r\n"; + let path = write_temp_file("test_crlf.txt", content); + + let indent = Indent::new(IndentConfig::default()); + let style_file = indent.detect_from_file(&path).unwrap(); + let style_bytes = indent.detect_from_bytes(content).unwrap(); + + assert_eq!(style_file, IndentStyle::Mixed); + assert_eq!(style_file, style_bytes); +} + +#[test] +fn test_binary_detection_null_bytes() { + let content = b"\xFF\x00\xFF\x00"; + let path = write_temp_file("test_bin_null.dat", content); + + let indent = Indent::new(IndentConfig::default()); + let style_file = indent.detect_from_file(&path).unwrap(); + let style_bytes = indent.detect_from_bytes(content).unwrap(); + + assert_eq!(style_file, IndentStyle::Binary); + assert_eq!(style_file, style_bytes); +} + +#[test] +fn test_binary_detection_entropy() { + let mut content = Vec::with_capacity(256); + for i in 0..256u16 { + content.push((i % 256) as u8); + } + let path = write_temp_file("test_bin_entropy.dat", &content); + + let indent = Indent::new(IndentConfig::default()); + let style_file = indent.detect_from_file(&path).unwrap(); + let style_bytes = indent.detect_from_bytes(&content).unwrap(); + + assert_eq!(style_file, IndentStyle::Binary); + assert_eq!(style_file, style_bytes); +} + +#[test] +fn test_sampling_first_lines() { + let content = b"noindent\n indent_space\n\tindent_tab\n"; + let path = write_temp_file("test_sample_lines.txt", content); + + // Test 1 line sample + let config_1 = IndentConfig::default().with_sample_mode(SampleMode::Lines(1)); + let indent_1 = Indent::new(config_1); + + assert_eq!(indent_1.detect_from_file(&path).unwrap(), IndentStyle::None); + assert_eq!(indent_1.detect_from_bytes(content).unwrap(), IndentStyle::None); + + // Test 2 line sample + let config_2 = IndentConfig::default().with_sample_mode(SampleMode::Lines(2)); + let indent_2 = Indent::new(config_2); + + let style2_file = indent_2.detect_from_file(&path).unwrap(); + let style2_bytes = indent_2.detect_from_bytes(content).unwrap(); + + assert!(matches!(style2_file, IndentStyle::Space(_))); + assert_eq!(style2_file, style2_bytes); +} + +#[test] +fn test_sampling_first_percent() { + let mut content = Vec::new(); + content.extend_from_slice(b" spaced\n"); + for _ in 0..1000 { + content.extend_from_slice(b"x\n"); + } + content.extend_from_slice(b"\tTabbed\n"); + + let path = write_temp_file("test_sample_percent.txt", &content); + + let config = IndentConfig::default().with_sample_mode(SampleMode::Percent(50)); + let indent = Indent::new(config); + + let style_file = indent.detect_from_file(&path).unwrap(); + let style_bytes = indent.detect_from_bytes(&content).unwrap(); + + assert!(matches!(style_file, IndentStyle::Space(_))); + assert_ne!(style_file, IndentStyle::Mixed); + assert_eq!(style_file, style_bytes); +} diff --git a/code/src/plugins/indent/tests/utils.rs b/code/src/plugins/indent/tests/utils.rs new file mode 100755 index 0000000..813fb95 --- /dev/null +++ b/code/src/plugins/indent/tests/utils.rs @@ -0,0 +1,14 @@ +use std::{ + fs, + io::Write, // +}; + +pub fn write_temp_file(file_name: &str, content: &[u8]) -> std::path::PathBuf { + let dir = std::env::temp_dir(); + let path = dir.join(file_name); + + let mut file = fs::File::create(&path).expect("Failed to create temp file"); + file.write_all(content).expect("Failed to write temp file"); + + path +} diff --git a/extra/snippets/lua.json b/extra/snippets/lua.json deleted file mode 100644 index 169e580..0000000 --- a/extra/snippets/lua.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "require": { - "prefix": "req", - "body": ["require(\"${1:module}\")"], - "description": "Require module" - }, - "return": { - "prefix": "rt", - "body": ["return $0"], - "description": "return value" - }, - "assigment": { - "prefix": "ll", - "body": ["local ${1:varName} = ${0:value}"], - "description": "create a variable" - }, - "local": { - "prefix": "l", - "body": ["local ${0}"], - "description": "create a variable" - }, - "locreq": { - "prefix": "lreq", - "body": ["local ${1:var} = require(\"${2:module}\")"], - "description": "Require module as a variable" - }, - "class": { - "prefix": "cl", - "body": [ - "${1:className} = {}\n", - "$1.${2:new} = function($3)", - "\tlocal ${4:varName} = ${5:{}}\n", - "\t${6: --code}\n", - "\treturn $4", - "end" - ], - "description": "Create a class" - }, - "if": { - "prefix": "if", - "body": ["if ${1:true} then", "\t$0", "end"] - }, - "elseif": { - "prefix": "elseif", - "body": ["elseif ${1:true} then", "\t$0"] - }, - "for": { - "prefix": "for", - "body": ["for ${1:i}=${2:1},${3:10} do", "\t$0", "end"], - "description": "for loop range" - }, - "foreach": { - "prefix": "foreach", - "body": ["for i, ${1:x} in pairs(${2:table}) do", "\t$0", "end"] - }, - "forline": { - "prefix": "forline", - "body": [ - "f = io.open(${1:\"${2:filename}\"}, \"${3:r}\")\n", - "while true do", - "\tline = f:read()", - "\tif line == nil then break end\n", - "\t${0:-- code}", - "end" - ], - "description": "read file line by line" - }, - "function": { - "prefix": "fu", - "body": ["function ${1:name}($2)", "\t${3:-- code}", "end"] - }, - "inline-function": { - "prefix": "f=", - "body": ["local ${1:name} = function($2)", "\t${0:-- code}", "end"] - }, - "print": { - "prefix": "p", - "body": ["print(${0})"] - }, - "self": { - "prefix": "self:", - "body": ["function self:${1:methodName}($2)", "\t$0", "end"] - }, - "while": { - "prefix": "while", - "body": ["while ${1:true} do", "\t$0", "end"] - }, - "lua": { - "prefix": "lua", - "body": ["lua << EOF", "$0", "EOF"] - }, - - - "template plugin" : { - "prefix": "template plugin", - "body": [ - "\n", - "-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ --", - "-- ───────────────────────────────────────────────── --", - "-- Plugin: $1", - "-- Github: github.com/$2/$1", - "-- ───────────────────────────────────────────────── --", - "-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ --", - - "\n\n\n\n", - - "-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ --", - "-- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ --", - "-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ --", - "\n$0\n", - "-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ --", - "-- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ --", - "-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ --", - - "\n\n\n", - - "-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ --", - "-- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ --", - "-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ --", - "\n", - "-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ --", - "-- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ --", - "-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ --", - "\n", - "" - ] - } - -} - diff --git a/extra/snippets/package.json b/extra/snippets/package.json deleted file mode 100644 index 2ee7c82..0000000 --- a/extra/snippets/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "dotfiles", - "engines": { - "vscode": "^1.11.0" - }, - "contributes": { - "snippets": [ - { - "language": "lua", - "path": "lua.json" - } - ] - } -} - diff --git a/init.lua b/init.lua deleted file mode 100644 index 1dfbe7b..0000000 --- a/init.lua +++ /dev/null @@ -1,37 +0,0 @@ - --- Author: Ali Shahid --- Github: github.com/shaeinst - - - --- ───────────────────────────────────────────────── -- --- ────────────────❰ Leader Mapping ❱─────────────── -- --- mapping leader here. it will work for every mapped - -vim.g.mapleader = ';' -vim.g.maplocalleader = '|' --- ───────────────────────────────────────────────── -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━❰ Load/Source Configs ❱━━━━━━━━━━━━━ -- - --- plugin config to improve start-up time. --- it should be always on the top of init.lua file -require('plugins/impatient_nvim') -- impatient needs to be setup before any other lua plugin is loaded so it is recommended you add the following near the start of your - -require('configs') -- plugin independent configs -require('mappings') -- plugin independent mappings -require('customs/abstractline') -- status line -require('customs/override_defalut') -- always put this config(override_defalut) at last because it's use to overide the any already defined config - --- load/source PLUGINS CONFIGS --- loading plugins and its configs are managed in seperate config file, ~/.config/nvim/lua/plugins/packer_nvim.lua --- NOTE: always load plugins at last -require('packer_nvim') - --- ━━━━━━━━━━━━━━━━━❰ end of Load ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/configs.lua b/lua/configs.lua deleted file mode 100644 index 98ef811..0000000 --- a/lua/configs.lua +++ /dev/null @@ -1,196 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━❰ Plugin-Independent Configs ❱━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - ---[[ - NOTE: - every configs in this file are independent of any plugin - configs for plugins are in "lua/plugins" directory and each plugin has - it's own config file. some settings are already default in neovim so you - don't need to define explicitly but it won't make any difference - :end of NOTE ---]] - -local opt = vim.opt -local api = vim.api - --- set theme -pcall(require, 'plugins.Abstract_cs') - -opt.termguicolors = true -- Enable GUI colors for the terminal to get truecolor -opt.list = true -- show whitespace -opt.listchars = { - nbsp = '⦸', -- CIRCLED REVERSE SOLIDUS (U+29B8, UTF-8: E2 A6 B8) - extends = '»', -- RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB, UTF-8: C2 BB) - precedes = '«', -- LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB, UTF-8: C2 AB) - tab = ' ', -- '▷─' WHITE RIGHT-POINTING TRIANGLE (U+25B7, UTF-8: E2 96 B7) + BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL (U+2505, UTF-8: E2 94 85) - trail = '•', -- BULLET (U+2022, UTF-8: E2 80 A2) - space = ' ', -} -opt.fillchars = { - diff = '∙', -- BULLET OPERATOR (U+2219, UTF-8: E2 88 99) - eob = ' ', -- NO-BREAK SPACE (U+00A0, UTF-8: C2 A0) to suppress ~ at EndOfBuffer - fold = '·', -- MIDDLE DOT (U+00B7, UTF-8: C2 B7) - vert = '│', -- window border when window splits vertically ─ ┴ ┬ ┤ ├ ┼ -} - --- backup related options --- neovim backup directory -local backup_dir = vim.fn.stdpath('data').."/.cache" -opt.backup = true -- make backups before writing -opt.undofile = false -- persistent undos - undo after you re-open the file -opt.writebackup = true -- Make backup before overwriting the current buffer -opt.backupcopy = 'yes' -- Overwrite the original backup file -opt.directory = backup_dir .. '/swap' -- directory to place swap files in -opt.backupdir = backup_dir .. '/backedUP' -- where to put backup files -opt.undodir = backup_dir .. '/undos' -- where to put undo files -opt.viewdir = backup_dir .. '/view' -- where to store files for :mkview -opt.shada = "'100,<50,f50,n"..backup_dir.."/shada/shada" - -opt.clipboard = vim.opt.clipboard + "unnamedplus" -- copy & paste -opt.wrap = false -- don't automatically wrap on load -opt.showmatch = true -- show the matching part of the pair for [] {} and () - -opt.cursorline = true -- highlight current line -opt.number = true -- show line numbers -opt.relativenumber = false -- show relative line number - -opt.incsearch = true -- incremental search -opt.hlsearch = true -- highlighted search results -opt.ignorecase = true -- ignore case sensetive while searching -opt.smartcase = true - -opt.scrolloff = 1 -- when scrolling, keep cursor 1 lines away from screen border -opt.sidescrolloff = 2 -- keep 30 columns visible left and right of the cursor at all times -opt.backspace = 'indent,start,eol' -- make backspace behave like normal again -opt.mouse = "a" -- turn on mouse interaction -opt.mousescroll = 'ver:3,hor:2' -- vertical and horizontal scroll speed -opt.updatetime = 500 -- CursorHold interval - -opt.softtabstop = 4 -opt.shiftwidth = 4 -- spaces per tab (when shifting), when using the >> or << commands, shift lines by 4 spaces -opt.tabstop = 4 -- spaces per tab -opt.smarttab = true -- / indent/dedent in leading whitespace -opt.autoindent = true -- maintain indent of current line --- opt.expandtab = false, -- don't expand tabs into spaces - -opt.shiftround = true - -opt.splitbelow = true -- open horizontal splits below current window -opt.splitright = true -- open vertical splits to the right of the current window -opt.laststatus = 3 -- always show status line. 3 means Global Status Line --- opt.colorcolumn = "79", -- vertical word limit line -opt.cmdheight = 1 -- command height - -opt.hidden = true -- allows you to hide buffers with unsaved changes without being prompted -opt.inccommand = 'split' -- live preview of :s results -opt.shell = 'zsh' -- shell to use for `!`, `:!`, `system()` etc. -opt.lazyredraw = true -- faster scrolling - -opt.wildignore = vim.opt.wildignore + '*.o,*.rej,*.so' -- patterns to ignore during file-navigation -opt.completeopt = 'menuone,noselect,noinsert' -- completion options - --- -- configs --- if vim.api.nvim_call_function('has', {'nvim-0.8'}) == 1 then --- vim.opt.cmdheight = 0 -- command height --- end - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Automate ❱━━━━━━━━━━━━━━━━━━━━ -- - -local group = api.nvim_create_augroup("AbstractAutoGroup", {clear=true}) - -api.nvim_create_autocmd( - "TextYankPost", - { - desc = "highlight text on yank", - pattern = "*", - group = group, - callback = function() - vim.highlight.on_yank { - higroup="Search", timeout=150, on_visual=true - } - end, - } -) - -api.nvim_create_autocmd( - "BufWinEnter", - { - desc = "jump to the last position when reopening a file", - pattern = "*", - group = group, - command = [[ if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif ]] - } -) - -api.nvim_create_autocmd( - "BufWritePre", - { - desc = "remove whitespaces on save", - pattern = "*", - group = group, - command = "%s/\\s\\+$//e", - } -) - -api.nvim_create_autocmd( - {"BufEnter", "FileType"}, - { - desc = "don't auto comment new line", - pattern = "*", - group = group, - command = "setlocal formatoptions-=c formatoptions-=r formatoptions-=o", - } -) - --- api.nvim_create_autocmd( --- "VimResized", --- { --- desc = "auto resize splited windows", --- pattern = "*", --- group = group, --- command = "tabdo wincmd =", --- } --- ) - -api.nvim_create_autocmd( - "BufWinEnter", - { - desc = "clear the last used search pattern", - pattern = "*", - group = group, - command = "let @/ = ''", - } -) - -local init_color_fg = vim.api.nvim_get_hl_by_name("CursorLineNr", true).foreground -local init_color_bg = vim.api.nvim_get_hl_by_name("CursorLineNr", true).background -api.nvim_create_autocmd( - { 'ModeChanged', 'InsertLeave'}, - { - desc = "change cursor color on mode change", - group = group, - callback = function() - local mode = vim.api.nvim_get_mode().mode - if mode == "i" then - api.nvim_set_hl(0, "CursorLineNr", {fg="#000000", bg="#ac3131", bold=true}) - elseif mode == "v" or mode == "V" or mode == "" then - api.nvim_set_hl(0, "CursorLineNr", {fg="#000000", bg="#d1d1d1", bold=true}) - else - vim.api.nvim_set_hl(0, "CursorLineNr", {fg=init_color_fg, bg=init_color_bg, bold=true}) - end - end, - } -) - --- ━━━━━━━━━━━━━━━━❰ end of Automate ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━❰ end of Plugin-Independent Configs ❱━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/customs/abstractline.lua b/lua/customs/abstractline.lua deleted file mode 100644 index 3fdd470..0000000 --- a/lua/customs/abstractline.lua +++ /dev/null @@ -1,364 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- infinite statusline on the earth and they all sucks. --- by @Abstract --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━❰ functions ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local api = vim.api -local bo = vim.bo -local cmd = vim.cmd -local fn = vim.fn - -local foreground_color = "#b7b7b7" -local background_color = "#072b2c" -local global_color = "#141414" - -local exclude_filetype = { - -- this block of code is inspired from: https://github.com/cseickel/dotfiles/blob/main/config/nvim/lua/status.lua#L40 - ["NvimTree"] = true, - ["Outline"] = true, - ["TelescopePrompt"] = true, - ["Trouble"] = true, - ["alpha"] = true, - ["dashboard"] = true, - ["lir"] = true, - ["neo-tree"] = true, - ["neogitstatus"] = true, - ["packer"] = true, - ["spectre_panel"] = true, - ["startify"] = true, - ["toggleterm"] = true, -} - - -local function init_highlight() - vim.api.nvim_set_hl(0, "Abstractline", {fg=foreground_color, bg=background_color}) - vim.api.nvim_set_hl(0, "AbstractlineFilemodify", {fg="#ff0000", bg=background_color}) - vim.api.nvim_set_hl(0, "AbstractlineFilename", {fg=foreground_color, bg=background_color, italic=true}) - vim.api.nvim_set_hl(0, "AbstractlineFilesize", {fg=foreground_color, bg=global_color}) - vim.api.nvim_set_hl(0, "AbstractlineGit", {fg="#b44200", bg=global_color, bold=true}) - vim.api.nvim_set_hl(0, "AbstractlineGitAdded", {fg="#4c7f33", bg=global_color, bold=true}) - vim.api.nvim_set_hl(0, "AbstractlineGitChanged", {fg="#985401", bg=global_color, bold=true}) - vim.api.nvim_set_hl(0, "AbstractlineGitRemoved", {fg="#d10000", bg=global_color, bold=true}) - vim.api.nvim_set_hl(0, "AbstractlineLsprovider", {fg=foreground_color, bg=global_color}) - vim.api.nvim_set_hl(0, "AbstractlineLsprovidername",{fg="#51A0CF", bg=global_color}) - vim.api.nvim_set_hl(0, "AbstractlinePsedostring",{fg="#060606", bg="#060606"}) - vim.api.nvim_set_hl(0, "AbstractlineSearch", {fg="#abab18", bg=global_color}) - vim.api.nvim_set_hl(0, "AbstractlineSplitter", {fg=background_color, bg=global_color}) - - vim.api.nvim_set_hl(0, "AbstractlineLSPDiagError",{fg="#a81818", bg=global_color}) - vim.api.nvim_set_hl(0, "AbstractlineLSPDiagWarn", {fg="#5d5d00", bg=global_color}) - vim.api.nvim_set_hl(0, "AbstractlineLSPDiagHint", {fg="#336481", bg=global_color}) - vim.api.nvim_set_hl(0, "AbstractlineLSPDiagInfo", {fg="#812900", bg=global_color}) - - vim.api.nvim_set_hl(0, "AbstractlineVirtualEnv", {fg="#b44200", bg=global_color, bold=true}) -end - - -local function splitter(icon) - return "%#AbstractlineSplitter#" .. icon .. "%*" -end - - -local function vim_mode() - -- get mode (normal/insert/visual/command) - local mode_color - local mode = api.nvim_exec('echo mode()', true) - if mode == "" then - mode = "C" - mode_color = "#ffaa00" - vim.api.nvim_set_hl(0, "AbstractlineMode", {fg=mode_color, bg=global_color, bold=true}) - elseif mode == "n" then - mode_color = "#178c94" - vim.api.nvim_set_hl(0, "AbstractlineMode", {fg=mode_color, bg=global_color, bold=true}) - elseif mode == "i" then - mode_color = "#fd4848" - vim.api.nvim_set_hl(0, "AbstractlineMode", {fg=mode_color, bg=global_color, bold=true}) - elseif mode == "v" then - mode_color = "#d1d1d1" - vim.api.nvim_set_hl(0, "AbstractlineMode", {fg=mode_color, bg=global_color, bold=true}) - elseif mode == "R" then - mode_color = "#fd4848" - vim.api.nvim_set_hl(0, "AbstractlineMode", {fg=mode_color, bg=global_color, bold=true}) - else - mode_color = "#f12bff" - vim.api.nvim_set_hl(0, "AbstractlineMode", {fg=mode_color, bg=global_color, bold=true}) - end - mode = string.upper(mode) - return " " .. "%#AbstractlineMode#".. mode .. "%*" .. " " -end - - -local function get_filetype_icon() - local has_devicons, devicons = pcall(require, 'nvim-web-devicons') - if not has_devicons then - return false - end - - local file_name, file_ext = fn.expand('%:t'), fn.expand('%:e') - - local icon, icon_color = devicons.get_icon_color(file_name, file_ext, { default = true }) - return { - icon = icon, - icon_color = icon_color - } -end - - -local function file_info () - local modified_flag = "" - local readonly_flag = "" - if bo.modified then modified_flag = "●" end - if bo.readonly then readonly_flag = " 🔒" end - - local file_name = api.nvim_buf_get_name(0) - local file = fn.pathshorten(fn.fnamemodify(file_name, ':~:.')) - file = readonly_flag .. file .. " " .. "%#AbstractlineFilemodify#" .. modified_flag .. "%*" - - local filetype = bo.filetype - if filetype == "alpha" then - file = filetype - filetype = "" - end - - local fileicon = get_filetype_icon() - if fileicon then - vim.api.nvim_set_hl(0, "AbstractlineFilenameIcon", {fg=fileicon.icon_color, bg=background_color}) - local icon_filetype = "%#AbstractlineFilenameIcon#" .. fileicon.icon .. " " .. filetype .. "%*" - filetype = "%#Abstractline#" .. "[" .. "%*".. icon_filetype .. "%#Abstractline#" .. "] " .. "%*" - file = "%#AbstractlineFilename#" .. " " .. file .. "%*" - end - - return file .. filetype -end - - -local function virtualenv_status() - local _, name_with_path = pcall(os.getenv, 'VIRTUAL_ENV') - if name_with_path == nil then - return "" - end - local venv = {}; - for match in (name_with_path .. "/"):gmatch("(.-)" .. "/") do - table.insert(venv, match); - end - return "%#AbstractlineVirtualEnv#" .. "" .. venv[#venv] .. "%*" -end - - -local function git_status() - local head = vim.b.gitsigns_head or '' - if head == '' then - return '' - end - local git_signs = vim.b.gitsigns_status_dict - local icon = " " - local sign_added = "" - local sign_changed = "" - local sign_removed = "" - - if git_signs then - local sa = git_signs["added"] or 0 - local sr = git_signs["removed"] or 0 - local sc = git_signs["changed"] or 0 - - if sa > 0 then - sign_added = "%#AbstractlineGitAdded#" .. "+" .. tostring(sa) .. "%*" - end - if sc > 0 then - sign_changed = "%#AbstractlineGitChanged#" .. "~" .. tostring(sc) .. "%*" - end - if sr > 0 then - sign_removed = "%#AbstractlineGitRemoved#" .. "-" .. tostring(sr) .. "%*" - end - end - local signs = sign_added .. sign_changed .. sign_removed - local result = "%#AbstractlineGit#" .. icon .. head .. "%*" - if signs ~= '' then - result = result .. "" .. signs - end - return " " .. result -end - - -local function get_filesize() - -- https://github.com/echasnovski/mini.nvim/blob/793d40f807b3c0f959f19d15cc2fe814dc16938b/lua/mini/statusline.lua#L553 - local size = fn.getfsize(fn.getreg('%')) - local result - if size < 1 then - result = string.format('%dB ', 0) - elseif size < 1024 then - result = string.format('%dB ', size) - elseif size < 1048576 then - result = string.format('%.2fK ', size / 1024) - else - result = string.format('%.2fM ', size / 1048576) - end - return " " .. "%#AbstractlineFilesize#" .. result .. "%*" -end - - -local function search_info() - -- thanks: https://github.com/nvim-lualine/lualine.nvim/issues/186#issuecomment-1170637440 - local final = "" - local hlsearch = api.nvim_get_vvar("hlsearch") - if hlsearch == nil then goto empty end - if hlsearch == 1 then - local result = fn.searchcount({ maxcount = 999, timeout = 1000 }) - local total = result.total - if total == nil then goto empty end - if total > 0 then - local search_string = fn.getreg("/") - final = string.format("%s %d/%d", search_string, result.current, total) - end - end - ::empty:: - return "%#AbstractlineSearch#" .. final .. "%*" .. " " -end - - -local function line_info() - local loc = api.nvim_buf_line_count(0) -- total lines of code in current file - local line_col = fn.col(".") - local curr_line_num = api.nvim_win_get_cursor(0)[1] - if curr_line_num == nil then - return - end - - local loc_percentage = math.ceil((100*curr_line_num)/loc) - return string.format("  %2d:%-2d- %d(%2d%%%%)",curr_line_num, line_col, loc, loc_percentage) -end - - -local function lsp_diagnostics_count() - local diagnostic = vim.diagnostic - - local error= diagnostic.severity.ERROR - local warn = diagnostic.severity.WARN - local info = diagnostic.severity.INFO - local hint = diagnostic.severity.HINT - - local count_error = vim.tbl_count(diagnostic.get(0, error and { severity = error })) - local count_warn = vim.tbl_count(diagnostic.get(0, warn and { severity = warn })) - local count_info = vim.tbl_count(diagnostic.get(0, info and { severity = info })) - local count_hint = vim.tbl_count(diagnostic.get(0, hint and { severity = hint })) - - return { - count_error = count_error, - count_warn = count_warn, - count_info = count_info, - count_hint = count_hint - } -end - - -local function lsp_provider() - local msg = '' - local buf_ft = api.nvim_buf_get_option(0, 'filetype') - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then - return msg - end - - local lsp_diag = lsp_diagnostics_count() - local count_error = lsp_diag.count_error - local count_warn = lsp_diag.count_warn - local count_info = lsp_diag.count_info - local count_hint = lsp_diag.count_hint - local sign_added, sign_changed, sign_removed, sign_hint = "", "", "", "" - - if count_error > 0 then - sign_added = "%#AbstractlineLSPDiagError#" .. "  " .. tostring(count_error) .. "%*" - end - if count_warn > 0 then - sign_changed = "%#AbstractlineLSPDiagWarn#" .. "  " .. tostring(count_warn) .. "%*" - end - if count_info > 0 then - sign_removed = "%#AbstractlineLSPDiagInfo#" .. "  " .. tostring(count_info) .. "%*" - end - if count_hint > 0 then - sign_hint = "%#AbstractlineLSPDiagHint#" .. "  " .. tostring(count_hint) .. "%*" - end - - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - if client.name ~= "null-ls" then - local sign_count = sign_added .. sign_changed .. sign_removed .. sign_hint - local msg1 = sign_count .. " " .. "%#abstractlineLsprovider#" .. "LSP[" .. "%*" - local msg2 = "%#abstractlineLsprovider#" .. "]" .. "%*" - msg = msg1 .. "%#abstractlineLsprovidername#" .. client.name .. "%*" .. msg2 - goto final - end - end - end - - ::final:: - return msg -end - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━❰ end functions ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - -function status_line() - local filetype = bo.filetype - if exclude_filetype[filetype] then - -- a hack to make statusline line invisiable on alpha - if filetype == "alpha" then - local c = "----------" - for _ = 1, 5 do - c = c .. c - end - return "%#AbstractlinePsedostring#" .. c .. "%*" - end - return "%f" - end - - return table.concat { - -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -- ━━━━━━━━━━━━━━━━❰ LEFT ❱━━━━━━━━━━━━━━━━ -- - vim_mode(), - splitter(""), - file_info(), - splitter(""), - get_filesize(), - virtualenv_status(), - git_status(), - -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -- ━━━━━━━━━━━━━━━❰ MIDDLE ❱━━━━━━━━━━━━━━━ -- - -- MIDDLE -- - "%=", - lsp_provider(), - -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -- ━━━━━━━━━━━━━━━━❰ RIGHT ❱━━━━━━━━━━━━━━━ -- - "%=", - search_info(), - "%#Abstractline#", - line_info(), - "%*", - -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - } -end - - -init_highlight() -vim.o.statusline = "%!luaeval('status_line()')" - diff --git a/lua/customs/override_defalut.lua b/lua/customs/override_defalut.lua deleted file mode 100644 index 51b70d2..0000000 --- a/lua/customs/override_defalut.lua +++ /dev/null @@ -1,72 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ─────────────────────────────────────────────── -- --- Override configs --- this config file is used to override the already defined config/mappings. --- This make config more readable and less complicated. - --- ─────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - ---[===[ Examples for Config - -local exec = vim.api.nvim_exec -- execute Vimscript -local opt = vim.opt -- global options -local cmd = vim.cmd -- execute Vim commands -local fn = vim.fn -- call Vim functions -local g = vim.g -- global variables -local b = vim.bo -- buffer-scoped options -local w = vim.wo -- windows-scoped options - --- don't automatically wrap on load -opt.wrap = false - --- highlight on yank -exec([[ - augroup YankHighlight - autocmd! - autocmd TextYankPost * silent! lua vim.highlight.on_yank{higroup="IncSearch", timeout=500, on_visual=true} - augroup end -]], false) - --- 4 spaces for selected filetypes -cmd([[ autocmd FileType python,c,cpp setlocal shiftwidth=4 tabstop=4 ]]) - -]===] - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - ---[===[ Examples for Config -local keymap = vim.api.nvim_set_keymap - --- to save file -keymap('i', '', ':w ', { noremap=true, silent=true }) - -]===] - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/mappings.lua b/lua/mappings.lua deleted file mode 100644 index 4eaa89b..0000000 --- a/lua/mappings.lua +++ /dev/null @@ -1,113 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━❰ Plugin-Independent Mapping ❱━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- ---[===[ - This config file contains the mappings that don't depend on any plugin. - Mappings for plugin-dependent actions are in the "lua/plugin" directory. Each plugin has its own config file. - - To see the current mapping for ||, type :echo mapleader. - If it reports an undefined variable, it means the leader key is set to the "default of '\'. - I have defined the leader at the very start of the init.lua file so that every keymap will work. ---]===] - - -local keymap = vim.api.nvim_set_keymap -local cmd = vim.cmd -local options = {noremap = true, silent = true} -local silent = {silent = true} - - --- TODO: fiqure out to implement q to quit only one buffer or one window at a time --- Close buffer -cmd([[ autocmd BufEnter * nmap q :bd ]]) - -vim.api.nvim_create_autocmd( - "FileType", - { - pattern = { - "man", "help", "lspinfo", "null-ls-info", "lsp-installer" - }, - command = "nnoremap q :close", - } -) - - --- map ctl+z to nothing so that it don't suspend terminal -vim.api.nvim_create_autocmd( - "BufEnter", - { - pattern = "*", - command = "nnoremap " - } -) - --- keymap('n', 'q',':q ', options) --- write/save when the buffer has been modified. -keymap('i', '', 'ma:update `a', options) -keymap('n', '', 'ma:update `a', options) - --- scroll window up/down -keymap('i', '', '', silent) -keymap('i', '', '', silent) - --- scroll window horizontally (scroll-horizontal) --- < reference: https://unix.stackexchange.com/questions/110251/how-to-put-current-line-at-top-center-bottom-of-screen-in-vim -keymap('n', '', 'zh', silent) -- left -keymap('n', '', 'zl', silent) -- right - --- number line enable -keymap('n', 'n', ':set rnu! ', silent) - --- clear Search Results -keymap('n', '??', ':noh ', silent) - ---[[ - on[ly] close all other windows but leave all buffers open. ---]] -keymap('n', '', ':only', silent) - --- Resize splits more quickly --- ──────────────────────────────────────────────────── --- resize up and down -keymap('n', ';k', ':resize +3 ', options) -keymap('n', ';j', ':resize -3 ', options) --- resize right and left -keymap('n', ';l', ':vertical resize +3 ', options) -keymap('n', ';h', ':vertical resize -3 ', options) --- ──────────────────────────────────────────────────── - ---[[ - easier moving of code blocks - Try to go into visual mode (v), thenselect several lines of code - here and then press ``>`` several times. ---]] -keymap('v', '<', '', '>gv', options) - --- going back to normal mode which works even in vim's terminal --- you will need this if you use floaterm to escape terminal -keymap('t', '', '', options) - --- move selected line(s) up or down -keymap('v', 'J', ":m '>+1gv=gv", options) -keymap('v', 'K', ":m '<-2gv=gv", options) - --- delete a word backward in insert mode with Ctrl+Backspace -keymap('i', '', '', { noremap = true }) - --- smart deletion, dd --- It solves the issue, where you want to delete empty line, but dd will override your last yank. --- Code below will check if u are deleting empty line, if so - use black hole register. --- [src: https://www.reddit.com/r/neovim/comments/w0jzzv/comment/igfjx5y/?utm_source=share&utm_medium=web2x&context=3] -local function smart_dd() - if vim.api.nvim_get_current_line():match("^%s*$") then - return "\"_dd" - else return "dd" end -end -vim.keymap.set("n", "dd", smart_dd, { noremap = true, expr = true }) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━❰ end of Plugin Mapping ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/packer_nvim.lua b/lua/packer_nvim.lua deleted file mode 100644 index d07e73e..0000000 --- a/lua/packer_nvim.lua +++ /dev/null @@ -1,358 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: packer.nvim --- Github: github.com/wbthomason/packer.nvim - --- A use-package inspired plugin manager for Neovim. --- Uses native packages, supports Luarocks dependencies, --- written in Lua, allows for expressive config --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- NOTE:1 --- If you want to automatically ensure that packer.nvim is installed on any machine you clone your configuration to, --- add the following snippet (which is due to @Iron-E) somewhere in your config before your first usage of packer: -local fn = vim.fn -local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' -if fn.empty(fn.glob(install_path)) > 0 then - Packer_bootstrap = fn.system({ - 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', - install_path - }) -end - --- safely import packer -local import_packer, packer = pcall(require, "packer") -if not import_packer then return end - -local commits = require("plugins.commits") - - -return packer.startup { - - config = { - -- Move to lua dir so impatient.nvim can cache it - compile_path = vim.fn.stdpath('config') .. '/plugin/packer_compiled.lua', - - display = { - open_fn = function() - return require('packer.util').float({border = 'single'}) - end - }, - git = { - cmd = 'git', -- The base command for git operations - depth = 1, -- Git clone depth - clone_timeout = 600, -- Timeout, in seconds, for git clones - }, - }, - - - function() - - -- ━━━━━━━━━━━━━━━━━❰ Required plugins ❱━━━━━━━━━━━━━━━━━ -- - use { -- All the lua functions I don't want to write twice. - 'nvim-lua/plenary.nvim', - commit=commits.plenary_nvim, - } - - use { -- lua `fork` of vim-web-devicons for neovim - 'kyazdani42/nvim-web-devicons', - commit = commits.nvim_web_devicons, - config = [[ require('plugins/nvim-web-devicons') ]] - } - -- ━━━━━━━━━━━━━━━━❰ end Required Plugin ❱━━━━━━━━━━━━━━━━ -- - - use { -- Packer can manage itself - 'wbthomason/packer.nvim', - commit = commits.packer_nvim, - } - - -- Improve Start-UP time - use { -- Speed up loading Lua modules in Neovim to improve startup time. - 'lewis6991/impatient.nvim', - commit = commits.impatient_nvim, - } - - use { -- colorscheme for (neo)vim written in lua specially made for Abstract - 'Abstract-IDE/Abstract-cs', - commit = commits.Abstract_cs, - } - - use { -- A collection of common configurations for Neovim's built-in language server client - 'neovim/nvim-lspconfig', - commit = commits.nvim_lspconfig, - event = 'BufRead', - requires = { - { -- Companion plugin for nvim-lspconfig that allows you to seamlessly install LSP servers locally (inside :echo stdpath("data")). - 'williamboman/mason.nvim', - run = ":MasonUpdate", -- :MasonUpdate updates registry contents - commit = commits.mason_nvim, - requires = { - { 'williamboman/mason-lspconfig.nvim', commit=commits.mason_lspconfig_nvim }, -- Extension to mason.nvim that makes it easier to use lspconfig with mason.nvim - { -- Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua. - 'jose-elias-alvarez/null-ls.nvim', - commit = commits.null_ls_nvim, - after = "mason.nvim" - } - }, - }, - { -- A pretty diagnostics, references, telescope results, quickfix and location list to help you solve all the trouble your code is causing. - 'folke/trouble.nvim', - commit = commits.trouble_nvim, - after = "nvim-lspconfig", - config = [[ require('plugins/trouble_nvim') ]] - }, - { -- preview native LSP's goto definition calls in floating windows. - 'rmagatti/goto-preview', - commit = commits.goto_preview, - after = 'nvim-lspconfig', - keys = {'gp'}, - config = [[ require('plugins/goto-preview') ]] - }, - { -- Standalone UI for nvim-lsp progress - 'j-hui/fidget.nvim', - commit = commits.fidget_nvim, - event = 'BufRead', - config = [[ require('plugins/fidget_nivm') ]] - }, - use { -- Simple winbar/statusline plugin that shows your current code context - 'SmiteshP/nvim-navic', - commit = commits.nvim_navic, - after = 'nvim-lspconfig', - event = 'BufRead', - config = [[ require('plugins/nvim_navic') ]] - }, - use { -- LSP signature hint as you type - 'ray-x/lsp_signature.nvim', - commit = commits.lsp_signature_nvim, - after = 'nvim-lspconfig', - event = 'BufRead', - config = [[ require('plugins/lsp_signature_nvim') ]] - } - }, - config = [[ - require('plugins/nvim-lspconfig') - require('plugins/null-ls_nvim') - ]] - } - - use { -- Nvim Treesitter configurations and abstraction layer - 'nvim-treesitter/nvim-treesitter', - commit = commits.nvim_treesitter, - run = function() vim.cmd([[TSUpdate]]) end, - requires = { - { -- Treesitter playground integrated into Neovim - 'nvim-treesitter/playground', - commit=commits.playground, - after='nvim-treesitter' - }, - { -- Use treesitter to auto close and auto rename html tag, work with html,tsx,vue,svelte,php. - "windwp/nvim-ts-autotag", - commit = commits.nvim_ts_autotag, - after = 'nvim-treesitter', - ft = { 'html', 'htmldjango', 'tsx', 'jsx', 'javascriptreact', 'typescriptreact', 'vue', 'svelte', 'php' }, - config = [[ require('plugins/nvim-ts-autotag') ]] - }, - { -- Neovim treesitter plugin for setting the commentstring based on the cursor location in a file. - 'JoosepAlviste/nvim-ts-context-commentstring', - commit = commits.nvim_ts_context_commentstring, - after = 'nvim-treesitter', - config = [[ require('plugins/nvim-ts-context-commentstring') ]] - } - }, - config = [[ require('plugins/nvim-treesitter') ]] - } - - use { -- A completion plugin for neovim coded in Lua. - 'hrsh7th/nvim-cmp', - commit = commits.nvim_cmp, - event = 'InsertEnter', - requires = { - { -- Snippet Engine for Neovim written in Lua. - 'L3MON4D3/LuaSnip', - commit = commits.LuaSnip, - module = "luasnip", - requires = { - { 'rafamadriz/friendly-snippets', after="LuaSnip", commit=commits.friendly_snippets }, -- Snippets collection for a set of different programming languages for faster development. - { 'Neevash/awesome-flutter-snippets', ft='dart', commit=commits.awesome_flutter_snippets }, -- collection snippets and shortcuts for commonly used Flutter functions and classes - }, - }, - { -- A super powerful autopairs for Neovim. It support multiple character. - 'windwp/nvim-autopairs', - commit=commits.nvim_autopairs, - after = "nvim-cmp", - config = [[ require('plugins/nvim-autopairs') ]] - }, - { 'hrsh7th/cmp-nvim-lsp', after='nvim-cmp', commit=commits.cmp_nvim_lsp }, -- nvim-cmp source for neovim builtin LSP client - { 'hrsh7th/cmp-nvim-lua', after='nvim-cmp', commit=commits.cmp_nvim_lua}, -- nvim-cmp source for nvim lua - { 'hrsh7th/cmp-buffer', after='nvim-cmp', commit=commits.cmp_buffer }, -- nvim-cmp source for buffer words. - { 'hrsh7th/cmp-path', after='nvim-cmp', commit=commits.cmp_path}, -- nvim-cmp source for filesystem paths. - { 'saadparwaiz1/cmp_luasnip', after='nvim-cmp', commit=commits.cmp_luasnip}, -- luasnip completion source for nvim-cmp - }, - config = [[ - require('plugins/nvim-cmp') - require('plugins/LuaSnip') - ]] - } - - use { -- Add/change/delete surrounding delimiter pairs with ease. - 'kylechui/nvim-surround', - commit = commits.nvim_surround, - event = 'InsertEnter', - keys = {'c'}, - config = [[ require('plugins/nvim-surround') ]] - } - - use { -- Find, Filter, Preview, Pick. All lua, all the time. - 'nvim-telescope/telescope.nvim', - commit = commits.telescope_nvim, - event = {'CmdlineEnter', 'CursorHold'}, - keys = { "t", "", "", "" }, - requires = { - {'nvim-telescope/telescope-fzf-native.nvim', commit=commits.telescope_fzf_native_nvim, run = 'make'}, -- FZF sorter for telescope written in c - {'nvim-telescope/telescope-file-browser.nvim', commit=commits.telescope_file_browser_nvim}, -- File Browser extension for telescope.nvim - {'nvim-telescope/telescope-media-files.nvim', commit=commits.telescope_media_files_nvim}, -- Telescope extension to preview media files using Ueberzug. - {'nvim-telescope/telescope-ui-select.nvim', commit=commits.telescope_ui_select_nvim}, -- It sets vim.ui.select to telescope. - {'nvim-telescope/telescope-symbols.nvim', commit=commits.telescope_symbols_nvim, after='telescope.nvim'}, -- telescope-symbols provide its users with the ability of picking symbols and insert them at point. - }, - config = [[ require('plugins/telescope_nvim') ]] - } - - use { -- Use (neo)vim terminal in the floating/popup window. - 'voldikss/vim-floaterm', - commit = commits.vim_floaterm, - config = [[ require('plugins/vim-floaterm') ]] - } - - use { -- Maximizes and restores the current window in Vim - 'szw/vim-maximizer', - commit = commits.vim_maximizer, - config = [[ require('plugins/vim-maximizer') ]] - } - - use { -- Smart and powerful comment plugin for neovim. Supports commentstring, dot repeat, left-right/up-down motions, hooks, and more - 'numToStr/Comment.nvim', - commit = commits.Comment_nvim, - keys = { "cc", "gc", "gb" }, - config = [[ require('plugins/Comment_nvim') ]] - } - - use { -- The fastest Neovim colorizer. - 'NvChad/nvim-colorizer.lua', - commit = commits.nvim_colorizer_lua, - config = [[ require('plugins/nvim-colorizer_lua') ]] - } - - use { -- Indent guides for Neovim - 'lukas-reineke/indent-blankline.nvim', - commit = commits.indent_blankline_nvim, - main = "ibl", - opts = {}, - config = [[ require('plugins/indent-blankline_nvim') ]] - } - - use { -- Git signs written in pure lua - 'lewis6991/gitsigns.nvim', - commit = commits.gitsigns_nvim, - config = [[ require('plugins/gitsigns_nvim') ]] - } - - use { -- A snazzy bufferline for Neovim - 'akinsho/nvim-bufferline.lua', - commit = commits.nvim_bufferline_lua, - event = "BufWinEnter", - config = [[ require('plugins/nvim-bufferline_lua') ]] - } - - use { -- Neovim plugin to manage the file system and other tree like structures. - 'nvim-neo-tree/neo-tree.nvim', - branch = "v2.x", - requires = { - { -- UI Component Library for Neovim. - "MunifTanjim/nui.nvim" - } - }, - config = [[ require('plugins/neo-tree_nvim') ]] - } - - use { -- fast and highly customizable greeter for neovim. - "goolord/alpha-nvim", - commit = commits.alpha_nvim, - config = [[ require('plugins/alpha-nvim') ]] - } - - use { -- smart indent and project detector with project based config loader - 'Abstract-IDE/penvim', - commit = commits.penvim, - config = [[ require('plugins/penvim') ]] - } - - use { -- A simple wrapper around :mksession - 'Shatur/neovim-session-manager', - commit = commits.neovim_session_manager, - config = [[ require('plugins/neovim-session-manager') ]] - } - - use { -- VS Code-like renaming UI for Neovim, writen in Lua. - 'filipdutescu/renamer.nvim', - commit = commits.renamer_nvim, - branch = 'master', - config = [[ require('plugins/renamer_nvim') ]] - } - - use { -- Neovim motions on speed! - 'phaazon/hop.nvim', - commit = commits.hop_nvim, - config = [[ require('plugins/hop_nvim') ]] - } - - -- ━━━━━━━━━━━━━━━━━❰ DEVELOPMENT ❱━━━━━━━━━━━━━━━━━ -- - - -- [ WEB ] - use { -- live edit html, css, and javascript in vim - 'turbio/bracey.vim', - commit = commits.bracey_vim, - run = 'npm install --prefix server', - ft = {'html', 'css', 'javascript'} - } - - -- [ flutter | dart ] - use { -- Tools to help create flutter apps in neovim using the native lsp - 'akinsho/flutter-tools.nvim', - commit = commits.flutter_tools_nvim, - after = "nvim-lspconfig", - ft = {'dart'}, - requires = { - { - 'dart-lang/dart-vim-plugin', -- Syntax highlighting for Dart in Vim - commit = commits.dart_vim_plugin, - ft = {'dart'}, - config = [[ require('plugins/dart-vim-plugin') ]] - } - }, - config = [[ require('plugins/flutter-tools_nvim') ]] - } - -- ━━━━━━━━━━━━━━❰ end of DEVELOPMENT ❱━━━━━━━━━━━━━ -- - - - -- Automatically set up your configuration after cloning packer.nvim - -- Put this at the end after all plugins - if Packer_bootstrap then - packer.sync() - end - end -} - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/Abstract_cs.lua b/lua/plugins/Abstract_cs.lua deleted file mode 100644 index e285686..0000000 --- a/lua/plugins/Abstract_cs.lua +++ /dev/null @@ -1,27 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: Abstract-cs --- Github: github.com/Abstract-IDE/Abstract-cs --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- apply colorscheme without throwing any errors -local apply_cs, _ = pcall(vim.cmd, 'colorscheme abscs') -if not apply_cs then return end - --- theme name -vim.g.abscs_theme_name = 'aqua' - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/Comment_nvim.lua b/lua/plugins/Comment_nvim.lua deleted file mode 100644 index 66ec669..0000000 --- a/lua/plugins/Comment_nvim.lua +++ /dev/null @@ -1,81 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: Comment.nvim --- Github: github.com/numToStr/Comment.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- safely import Comment -local comment_imported_ok, comment = pcall(require, 'Comment') -if not comment_imported_ok then return end - -comment.setup({ - ---Add a space b/w comment and the line - ---@type boolean - padding = true, - - ---Whether the cursor should stay at its position - ---NOTE: This only affects NORMAL mode mappings and doesn't work with dot-repeat - ---@type boolean - sticky = true, - - ---Lines to be ignored while comment/uncomment. - ---Could be a regex string or a function that returns a regex string. - ---Example: Use '^$' to ignore empty lines - ---@type string|function - ignore = '^$', - - ---Pre-hook, called before commenting the line - ---@type function|nil - -- NOTE: Already implemented with JoosepAlviste/nvim-ts-context-commentstring - -- pre_hook = nil, - - ---Post-hook, called after commenting is done - ---@type function|nil - post_hook = nil, - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - mappings = { - basic = true, ---Includes `gcc`, `gcb`, `gc[count]{motion}` and `gb[count]{motion}` - extra = true, ---Includes `gco`, `gcO`, `gcA` - extended = false, ---Includes `g>`, `g<`, `g>[count]{motion}` and `g<[count]{motion}` - }, - - ---LHS of toggle mapping in NORMAL - ---@type table - toggler = { - line = 'cc', ---line-comment keymap - block = 'cb', ---block-comment keymap - }, - - ---LHS of operator-pending mapping in VISUAL mode - ---@type table - opleader = { - line = 'gc', ---line-comment keymap - block = 'gb', ---block-comment keymap - }, -}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/LuaSnip.lua b/lua/plugins/LuaSnip.lua deleted file mode 100644 index 44fddc0..0000000 --- a/lua/plugins/LuaSnip.lua +++ /dev/null @@ -1,61 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: LuaSnip --- Github: github.com/L3MON4D3/LuaSnip --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local import_ls, luasnip = pcall(require, "luasnip") -if not import_ls then return end - -luasnip.config.set_config({ - history = false, -- If true, Snippets that were exited can still be jumped back into. - update_events = "TextChanged,TextChangedI", -- Update more often, :h events for more info. - region_check_events = "CursorMoved", -- Ref: https://github.com/L3MON4D3/LuaSnip/issues/91 -}) - - --- enable html snippets in javascript/javascript(REACT) -luasnip.filetype_extend("javascriptreact", {"html"}) -luasnip.filetype_extend("typescriptreact", {"html"}) - --- enable html snippets in Django (htmldjango) -luasnip.filetype_extend("htmldjango", {"html"}) - --- this will lazy load all filetypes -require("luasnip/loaders/from_vscode").lazy_load() - --- lazy loading so you only get in memory snippets of languages you use -require'luasnip/loaders/from_vscode'.lazy_load({ - paths = {"~/.config/nvim/extra/snippets"}, -}) - --- ───────────────────────────────────────────────── -- --- NOTE: not working, need some fix --- firendl-snippets -local filetype = vim.bo.filetype - -if filetype == "javascriptreact" then - require("luasnip/loaders/from_vscode").load({include = {"javascriptreact"}}) - return -end -if filetype == "typescriptreact" then - require("luasnip/loaders/from_vscode").load({include = {"typescriptreact"}}) - return -end --- ───────────────────────────────────────────────── -- - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/alpha-nvim.lua b/lua/plugins/alpha-nvim.lua deleted file mode 100644 index 06c03cd..0000000 --- a/lua/plugins/alpha-nvim.lua +++ /dev/null @@ -1,82 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: alpha-nvim --- Github: github.com/goolord/alpha-nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local alpha_ok, alpha = pcall(require, "alpha") -if not alpha_ok then return end - -local dashboard_ok, dashboard = pcall(require, "alpha.themes.dashboard") -if not dashboard_ok then return end - --- set highlights -vim.api.nvim_set_hl(0, "AlphaDashboard", {fg="#1D918B"}) -dashboard.section.header.opts.hl = 'AlphaDashboard' -dashboard.section.footer.opts.hl = 'AlphaDashboard' - - -local function footer() - local datetime_ok, datetime = pcall(os.date, " %I:%M:%p (%d-%m-%Y)") - local version = vim.version() - local nvim_verion = string.format("v%d.%d.%d ", version.major, version.minor, version.patch ) - if not datetime_ok then - return nvim_verion - end - return nvim_verion .. " | " .. datetime -end - - --- Set header -dashboard.section.header.val = { - "┃█████ ", - "┃██ ██ ", - "┃██ ██ ", - "┃██ ████████", - "┃██ ██ ", - "┃██ ██", -} - - --- Set menu -local options = {} -local update_cmd = ":FloatermNew cd ~/.config/nvim/ && " -update_cmd = update_cmd .. "echo updating configs... && " -update_cmd = update_cmd .. "git pull && " -update_cmd = update_cmd .. "echo updating plugins... && " -update_cmd = update_cmd .. "nvim --headless -c 'autocmd User PackerComplete quitall' -c PackerSync && " -update_cmd = update_cmd .. "echo updated && " -update_cmd = update_cmd .. " " -dashboard.section.buttons.val = { - dashboard.button("n", " New file", ":ene startinsert ", options), - dashboard.button("r", " Recent", ":Telescope oldfiles", options), - dashboard.button("s", "s Sessions", ":SessionManager load_session", options), - dashboard.button("f", "🔎 Find file", ":Telescope find_files", options), - dashboard.button("u", "🔨 Update Plugins", update_cmd, options), - dashboard.button("q", " Quit NVIM", ":qa", options), -} - -dashboard.section.footer.val = footer() - --- Send config to alpha -alpha.setup(dashboard.opts) - --- Disable folding on alpha buffer -vim.cmd([[ - autocmd FileType alpha setlocal nofoldenable -]]) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/barbar_nvim.lua b/lua/plugins/barbar_nvim.lua deleted file mode 100644 index 5a4ac4a..0000000 --- a/lua/plugins/barbar_nvim.lua +++ /dev/null @@ -1,65 +0,0 @@ ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---─────────────────────────────────────────────────-- --- Plugin: barbar.nvim --- Github: github.com/romgrk/barbar.nvim ---─────────────────────────────────────────────────-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - - - - - - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - -local keymap = vim.api.nvim_set_keymap -local options = { noremap=true, silent=true } - - --- Move to previous/next -keymap('n', '', ':BufferNext', options) -keymap('n', '', ':BufferPrevious', options) --- Goto buffer in position... -keymap('n', '1', ':BufferGoto 1', options) -keymap('n', '2', ':BufferGoto 2', options) -keymap('n', '3', ':BufferGoto 3', options) -keymap('n', '4', ':BufferGoto 4', options) -keymap('n', '5', ':BufferGoto 5', options) -keymap('n', '6', ':BufferGoto 6', options) -keymap('n', '7', ':BufferGoto 7', options) -keymap('n', '8', ':BufferGoto 8', options) -keymap('n', '9', ':BufferGoto 9', options) - --- Re-order to previous/next -keymap('n', ',', ':BufferMovePrevious 9', options) -keymap('n', '.', ':BufferMoveNext 9', options) - - --- Close buffer --- nnoremap :BufferClose -keymap('n', 'q', ':BufferClose', options) - --- Magic buffer-picking mode -keymap('n', 'm', ':BufferPick', options) - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - diff --git a/lua/plugins/bubbly_nvim.lua b/lua/plugins/bubbly_nvim.lua deleted file mode 100644 index 960d503..0000000 --- a/lua/plugins/bubbly_nvim.lua +++ /dev/null @@ -1,132 +0,0 @@ -vim.g.bubbly_tabline = 1 -vim.g.bubbly_statusline = { - 'mode', - 'path', - 'filetype', - - 'divisor', - 'progress', -} - - -vim.g.bubbly_palette = { - background = "#1B1717", - foreground = "Black", - black = "Black", - red = "Red", - green = "Green", - yellow = "Yellow", - blue = "Blue", - purple = "Magenta", - cyan = "Cyan", - white = "White", - lightgrey = "LightGrey", - darkgrey = "Grey", -} - - -vim.g.bubbly_characters = { - -- Bubble delimiters - left = '', - right = '', - -- Close character for the tabline - close = 'x', - -- Bubble separators - bubble_separator = '', -} - - - -vim.g.bubbly_symbols = { - default = 'PANIC!', - - path = { - readonly = 'RO', - unmodifiable = '', - modified = '*', - }, - signify = { - added = '+%s', -- requires 1 '%s' - modified = '~%s', -- requires 1 '%s' - removed = '-%s', -- requires 1 '%s' - }, - coc = { - error = 'E%s', -- requires 1 '%s' - warning = 'W%s', -- requires 1 '%s' - }, - builtinlsp = { - diagnostic_count = { - error = 'E%s', -- requires 1 '%s' - warning = 'W%s', --requires 1 '%s' - }, - }, - branch = ' %s', -- requires 1 '%s' - total_buffer_number = '﬘ %s', --requires 1 '%d' - lsp_status = { - diagnostics = { - error = 'E%d', - warning = 'W%d', - hint = 'H%d', - info = 'I%d', - }, - }, -} - - - - - -vim.g.bubbly_colors = { - default = 'red', - - mode = { - normal = 'Blue', -- uses by default 'background' as the foreground color. - insert = 'Red', - visual = 'White', - visualblock = 'red', - command = 'red', - terminal = 'blue', - replace = 'yellow', - default = 'white' - }, - path = { - readonly = { background = 'lightgrey', foreground = 'foreground' }, - unmodifiable = { background = 'darkgrey', foreground = 'foreground' }, - path = 'white', - modified = { background = 'lightgrey', foreground = 'foreground' }, - }, - branch = 'purple', - signify = { - added = 'green', - modified = 'blue', - removed = 'red', - }, - paste = 'red', - builtinlsp = { - diagnostic_count = { - error = 'red', - warning = 'yellow', - }, - current_function = 'purple', - }, - filetype = 'blue', - progress = { - rowandcol = { background = 'lightgrey', foreground = 'foreground' }, - percentage = { background = 'darkgrey', foreground = 'foreground' }, - }, - tabline = { - active = 'blue', - inactive = 'white', - close = 'darkgrey', - }, - total_buffer_number = 'cyan', - lsp_status = { - messages = 'white', - diagnostics = { - error = 'red', - warning = 'yellow', - hint = 'white', - info = 'blue', - }, - }, -} diff --git a/lua/plugins/commits.lua b/lua/plugins/commits.lua deleted file mode 100644 index 9b2cab8..0000000 --- a/lua/plugins/commits.lua +++ /dev/null @@ -1,60 +0,0 @@ - -return { - Abstract_cs = "", - alpha_nvim = "", - awesome_flutter_snippets = "", - bracey_vim = "", - Comment_nvim = "", - cmp_buffer = "", - cmp_luasnip = "", - cmp_nvim_lsp = "", - cmp_nvim_lsp_signature_help = "", - cmp_nvim_lua = "", - cmp_path = "", - dart_vim_plugin = "", - editorconfig_nvim = "", - feline_nvim = "", - fidget_nvim = "", - filetype_nvim = "", - flutter_tools_nvim = "", - friendly_snippets = "", - gitsigns_nvim = "", - goto_preview = "", - hop_nvim = "", - impatient_nvim = "", - indent_blankline_nvim = "", - lsp_signature_nvim = "", - LuaSnip = "", - mason_lspconfig_nvim = "", - mason_nvim = "", - neovim_session_manager = "", - null_ls_nvim = "", - nvim_autopairs = "", - nvim_bufferline_lua = "", - nvim_cmp = "", - nvim_colorizer_lua = "", - nvim_lsp_installer = "", - nvim_lspconfig = "", - nvim_navic = "", - nvim_surround = "", - nvim_tree_lua = "", - nvim_treesitter = "", - nvim_ts_autotag = "", - nvim_ts_context_commentstring = "", - nvim_web_devicons = "", - packer_nvim = "", - penvim = "", - playground = "", - plenary_nvim = "", - renamer_nvim = "", - scope_nvim = "", - telescope_file_browser_nvim = "", - telescope_fzf_native_nvim = "", - telescope_media_files_nvim = "", - telescope_nvim = "", - telescope_symbols_nvim = "", - telescope_ui_select_nvim = "", - trouble_nvim = "", - vim_floaterm = "", - vim_maximizer = "", -} diff --git a/lua/plugins/context_vt_nvim.lua b/lua/plugins/context_vt_nvim.lua deleted file mode 100644 index e69de29..0000000 diff --git a/lua/plugins/dart-vim-plugin.lua b/lua/plugins/dart-vim-plugin.lua deleted file mode 100644 index 79aeeb1..0000000 --- a/lua/plugins/dart-vim-plugin.lua +++ /dev/null @@ -1,25 +0,0 @@ --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: dart-vim-plugin --- Github: github.com/dart-lang/dart-vim-plugin --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- Enable HTML syntax highlighting inside Dart strings (default: false) -vim.g.dart_html_in_string = "v.true" --- Enable Dart style guide syntax (like 2-space indentation) -vim.g.dart_style_guide = 2 --- Enable DartFmt execution on buffer save with -vim.g.dart_format_on_save = 0 - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/desktop-notify_nvim.lua b/lua/plugins/desktop-notify_nvim.lua deleted file mode 100644 index dca454a..0000000 --- a/lua/plugins/desktop-notify_nvim.lua +++ /dev/null @@ -1,26 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: desktop-notify.nvim --- Github: github.com/simrat39/desktop-notify.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- safely import desktop-notify -local notify_imported, notify = pcall(require, 'desktop-notify') -if not notify_imported then return end - -notify.override_vim_notify() - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/feline_nvim.lua b/lua/plugins/feline_nvim.lua deleted file mode 100644 index 6caddc7..0000000 --- a/lua/plugins/feline_nvim.lua +++ /dev/null @@ -1,330 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: feline.nvim --- Github: github.com/feline-nvim/feline.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local import_feline, feline = pcall(require, 'feline') -if not import_feline then return end - -local lsp = require('feline.providers.lsp') -local vi_mode_utils = require('feline.providers.vi_mode') - --- local lsp_status = require('lsp-status') --- lsp_status.register_progress() - -local b = vim.b -local fn = vim.fn -local api = vim.api - -local components = {active = {}, inactive = {}} - -vim.opt.termguicolors = true -- Enable GUI colors for the terminal to get truecolor - -components.active[1] = { - {provider = ' ', hl = {fg = 'skyblue'}}, - { - provider = function () - local mode = api.nvim_exec('echo mode()', true) - if mode == "" then - return "C" - end - return string.upper(mode) - end, - hl = function() - return { - name = vi_mode_utils.get_mode_highlight_name(), - fg = vi_mode_utils.get_mode_color(), - style = 'bold', - } - end, - right_sep = '', - }, - { - provider = { - name = "file_info", - opts = { type = "relative-short" } - }, - hl = {fg = 'black', bg = 'f_color', style = 'italic'}, - left_sep = { - ' ', - 'slant_left_2', - {str = ' ', hl = {bg = 'f_color', fg = 'NONE'}}, - }, - }, - { - provider = function () - local filetype = vim.bo.filetype - if filetype ~= "" and filetype ~= "alpha" then - return " [" .. filetype .. "]" - end - return " " - end, - hl = {fg = 'black', bg = 'f_color', style = 'NONE'}, - right_sep = {'slant_right_2', ' '}, - }, - { - provider = 'file_size', - enabled = function() return fn.getfsize(fn.expand('%:p')) > 0 end, - right_sep = {' ', {str = ' ', hl = {fg = 'fg', bg = 'bg'}}}, - }, - { - provider = function() - local name_with_path = os.getenv('VIRTUAL_ENV') - local venv = {}; - for match in (name_with_path .. "/"):gmatch("(.-)" .. "/") do - table.insert(venv, match); - end - return "" .. venv[#venv] - end, - enabled = function() return os.getenv('VIRTUAL_ENV') ~= nil end, - right_sep = " ", - }, - { - provider = 'git_branch', - hl = {fg = 'cyan2', bg = 'bg', style = 'bold'}, - right_sep = function() - local val = {hl = {fg = 'NONE', bg = 'bg'}} - if b.gitsigns_status_dict then - val.str = ' ' - else - val.str = '' - end - return val - end, - }, - { - provider = 'git_diff_added', - icon = {str = ' +', hl = {fg = 'green', style = 'bold'}}, - hl = {fg = 'green', style = 'bold'}, - }, - { - provider = 'git_diff_changed', - icon = {str = ' ~', hl = {fg = 'orange', style = 'bold'}}, - hl = {fg = 'orange', style = 'bold'}, - }, - { - provider = 'git_diff_removed', - icon = {str = ' -', hl = {fg = 'red', style = 'bold'}}, - hl = {fg = 'red', style = 'bold'}, - right_sep = function() - local val = {hl = {fg = 'NONE', bg = 'bg'}} - if b.gitsigns_status_dict then - val.str = ' ' - else - val.str = '' - end - return val - end, - }, -} - -components.active[2] = { - { - provider = 'diagnostic_errors', - enabled = function() - return lsp.diagnostics_exist(vim.diagnostic.severity.ERROR) - end, - hl = {fg = 'red'}, - }, - { - provider = 'diagnostic_warnings', - enabled = function() - return lsp.diagnostics_exist(vim.diagnostic.severity.WARN) - end, - hl = {fg = 'yellow'}, - }, - { - provider = 'diagnostic_hints', - enabled = function() - return lsp.diagnostics_exist(vim.diagnostic.severity.HINT) - end, - hl = {fg = 'cyan'}, - }, - { - provider = 'diagnostic_info', - enabled = function() - return lsp.diagnostics_exist(vim.diagnostic.severity.INFO) - end, - hl = {fg = 'skyblue'}, - }, - { - provider = function() - local msg = '' - local buf_ft = api.nvim_buf_get_option(0, 'filetype') - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then return msg end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - if client.name ~= "null-ls" then return "LSP[" .. client.name .. "]" end - end - end - return msg - end, - -- hl = {style = 'italic'}, - hl = {fg='black'}, - left_sep = {' ', {str = ' ', hl = {fg = 'fg', bg = 'bg'}}}, - }, - -- { - -- provider = function () - -- return lsp_status.status() - -- end - -- }, - -} - -components.active[3] = { - { - provider = function() - -- thanks: https://github.com/nvim-lualine/lualine.nvim/issues/186#issuecomment-1170637440 - local hlsearch = api.nvim_get_vvar("hlsearch") - if hlsearch == nil then goto empty end - if hlsearch == 1 then - local result = fn.searchcount({ maxcount = 999, timeout = 1000 }) - local total = result.total - if total == nil then goto empty end - if total > 0 then - local search_string = fn.getreg("/") - return string.format("%s %d/%d", search_string, result.current, total) - end - end - ::empty:: - return "" - end, - left_sep = ' ', - hl = {fg = 'yellow'} - }, - { - provider = '  %l:%-2c- %L ', - left_sep = ' ', - hl = {fg = 'black', bg = 'f_color'}, - }, - { - -- provider = 'scroll_bar', - provider = ' ', - hl = { - fg = 'black', - bg = 'f_color', - -- style = 'bold', - left_sep = ' ', - -- right_sep = ' ' - }, - }, -} - --- components.inactive[1] = { } - --- This table is equal to the default colors table -local colors = { - fg = '#C8C8C8', - bg = '#141414', - black = "#b7b7b7", - black1 = '#1B1B1B', - skyblue = '#50B0F0', - cyan2 = '#006c6c', - cyan = '#009090', - green = '#60A040', - oceanblue = '#0066cc', - magenta = '#C26BDB', - orange = '#FF9000', - red = '#D10000', - violet = '#9E93E8', - white = '#FFFFFF', - f_color = '#072b2c', - yellow = '#E1E120', -} - --- This table is equal to the default separators table -local separators = { - vertical_bar = '┃', - vertical_bar_thin = '│', - left = '', - right = '', - block = '█', - right_filled = '', - left_filled = '', - slant_left = '', - slant_right = '', - slant_left_2 = '', - slant_right_2 = '', - slant_left_thin = '', - slant_right_thin = '', - slant_left_2_thin = '', - slant_right_2_thin = '', - left_rounded_thin = '', - right_rounded_thin = '', - left_rounded = '', - right_rounded = '', - circle = '●', -} - --- This table is equal to the default vi_mode_colors table -local vi_mode_colors = { - ['NORMAL'] = 'green', - ['OP'] = 'green', - ['INSERT'] = 'red', - ['VISUAL'] = 'skyblue', - ['LINES'] = 'skyblue', - ['BLOCK'] = 'skyblue', - ['REPLACE'] = 'violet', - ['V-REPLACE'] = 'violet', - ['ENTER'] = 'cyan', - ['MORE'] = 'cyan', - ['SELECT'] = 'orange', - ['COMMAND'] = 'green', - ['SHELL'] = 'green', - ['TERM'] = 'green', - ['NONE'] = 'yellow', -} - --- This table is equal to the default force_inactive table -local force_inactive = { - filetypes = { - 'NvimTree', - 'packer', - 'startify', - 'fugitive', - 'fugitiveblame', - 'qf', - 'help', - }, - buftypes = {'terminal'}, - bufnames = {}, -} - --- This table is equal to the default disable table -local disable = {filetypes = {}, buftypes = {}, bufnames = {}} - --- This table is equal to the default update_triggers table -local update_triggers = { - 'VimEnter', - 'WinEnter', - 'WinClosed', - 'FileChangedShellPost', -} - -feline.setup({ - theme = colors, - separators = separators, - vi_mode_colors = vi_mode_colors, - force_inactive = force_inactive, - disable = disable, - update_triggers = update_triggers, - components = components, -}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/fidget_nivm.lua b/lua/plugins/fidget_nivm.lua deleted file mode 100644 index a7e232f..0000000 --- a/lua/plugins/fidget_nivm.lua +++ /dev/null @@ -1,62 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: fidget.nvim --- Github: github.com/j-hui/fidget.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local imported_fidget, fidget = pcall(require, "fidget") -if not imported_fidget then return end - -fidget.setup { - text = { - spinner = "pipe", -- animation shown when tasks are ongoing - done = "✔", -- character shown when all tasks are complete - commenced = "Started", -- message shown when task starts - completed = "Completed", -- message shown when task completes - }, - align = { - bottom = false, -- align fidgets along bottom edge of buffer - right = true, -- align fidgets along right edge of buffer - }, - timer = { - spinner_rate = 125, -- frame rate of spinner animation, in ms - fidget_decay = 2000, -- how long to keep around empty fidget, in ms - task_decay = 1000, -- how long to keep around completed task, in ms - }, - window = { - relative = "win", -- where to anchor, either "win" or "editor" - blend = 0, -- &winblend for the window - zindex = nil, -- the zindex value for the window - }, - fmt = { - leftpad = true, -- right-justify text in fidget box - stack_upwards = false, -- list of tasks grows upwards - max_width = 0, -- maximum width of the fidget box - fidget = function(fidget_name, spinner) -- function to format fidget title - return string.format("%s %s", spinner, fidget_name) - end, - task = function(task_name, message, percentage) -- function to format each task line - return string.format( - "%s%s [%s]", - message, - percentage and string.format(" (%s%%)", percentage) or "", - task_name - ) - end, - }, -} - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/filetype_nvim.lua b/lua/plugins/filetype_nvim.lua deleted file mode 100644 index 9d2f2a5..0000000 --- a/lua/plugins/filetype_nvim.lua +++ /dev/null @@ -1,22 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: filetype.nvim --- Github: github.com/nathom/filetype.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -pcall(require, "filetype") - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/flutter-tools_nvim.lua b/lua/plugins/flutter-tools_nvim.lua deleted file mode 100644 index 00ae948..0000000 --- a/lua/plugins/flutter-tools_nvim.lua +++ /dev/null @@ -1,90 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: flutter-tools.nvim --- Github: github.com/akinsho/flutter-tools.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local import_flutter, flutter = pcall(require, 'flutter-tools') -if not import_flutter then return end - - -flutter.setup { - - ui = { - -- the border type to use for all floating windows, the same options/formats - -- used for ":h nvim_open_win" e.g. "single" | "shadow" | {} - border = "rounded", - }, - - debugger = { -- integrate with nvim dap + install dart code debugger - enabled = false, - }, - - widget_guides = {enabled = true}, - closing_tags = { - prefix = "//", -- character to use for close tag e.g. > Widget - enabled = true, -- set to false to disable - }, - - dev_log = { - open_cmd = "tabedit", -- command to use to open the log buffer - }, - - dev_tools = { - autostart = false, -- autostart devtools server if not detected - auto_open_browser = false, -- Automatically opens devtools in the browser - }, - - outline = { - open_cmd = "35vnew", -- command to use to open the outline buffer - }, -} - ---- Telescope Integration ---- In order to set this up, you can explicitly load the extension. -local import_telescope, telescope = pcall(require, 'telescope') -if import_telescope then - telescope.load_extension("flutter") -end - --- --> Highlights/Colors --- Widget guides --- FlutterWidgetGuides - this changes the highlight of the Widget guides --- Notifications --- The highlights for flutter-tools notifications and popups can be changed by overriding the default highlight groups --- FlutterNotificationNormal - this changes the highlight of the notification content. --- FlutterNotificationBorder - this changes the highlight of the notification border. --- FlutterPopupNormal - this changes the highlight of the popup content. --- FlutterPopupBorder - this changes the highlight of the popup border. --- FlutterPopupSelected - this changes the highlight of the popup's selected line. - -vim.cmd([[ autocmd VimEnter *.dart highlight FlutterWidgetGuides guifg=#8C8C8C ]]) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- to list available commands in flutter-tools plugin -vim.cmd([[ autocmd VimEnter *.dart nnoremap o :Telescope flutter commands ]]) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/formatter.lua b/lua/plugins/formatter.lua deleted file mode 100644 index 83573ff..0000000 --- a/lua/plugins/formatter.lua +++ /dev/null @@ -1,107 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: formatter.nvim --- Github: github.com/mhartington/formatter.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -require('formatter').setup({ - logging = false, - - filetype = { - -- C++ - cpp = { - function() - return { - exe = "clang-format", - args = { - '-assume-filename=', - vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), - '-style="{BasedOnStyle: Microsoft, UseTab: Always}"' - }, - stdin = true - } - end - }, - - -- C - c = { - function() - return { - exe = "clang-format", - args = { - '-assume-filename=', - vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), - '-style="{BasedOnStyle: Microsoft, UseTab: Always}"' - }, - stdin = true - } - end - }, - - -- Python - python = {function() return {exe = "yapf", stdin = true} end}, - - -- Javascript - javascript = { - function() - return { - exe = "js-beautify", - args = {'--indent-size 4', '--max-preserve-newlines 3'}, - stdin = true - } - end - }, - - -- Lua - lua = { - function() - return { - exe = "lua-format", - args = {'--indent-width 1', '--tab-width 4', '--use-tab'}, - stdin = true - } - end - } - } - -}) - --- Format on save --- To enable format on save, you can create a autocmd to trigger the formater using FormatWrite, --- which will format and write to the current saved file. --- vim.api.nvim_exec([[ --- augroup FormatAutogroup --- autocmd! --- autocmd BufWritePost *.py,*.c,*.cpp,*.js FormatWrite --- augroup END --- ]], true) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- local keymap = vim.api.nvim_set_keymap --- keymap('n', 'fm', ':Format', {noremap = true, silent = true}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/fterm_nvim.lua b/lua/plugins/fterm_nvim.lua deleted file mode 100644 index 4622f75..0000000 --- a/lua/plugins/fterm_nvim.lua +++ /dev/null @@ -1,53 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: FTerm.nvim --- Github: github.com/numtostr/FTerm.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -require'FTerm'.setup({ - -- Filetype of the terminal buffer - ft = 'FTerm', - -- Command to run inside the terminal. It could be a `string` or `table` - cmd = os.getenv('SHELL'), - -- Neovim's native window border. See `:h nvim_open_win` for more configuration options. - border = 'single', - -- Close the terminal as soon as shell/command exits. - -- Disabling this will mimic the native terminal behaviour. - auto_close = true, - -- Highlight group for the terminal. See `:h winhl` - hl = 'Normal', - -- Transparency of the floating window. See `:h winblend` - blend = 0, - -- Object containing the terminal window dimensions. - -- The value for each field should be between `0` and `1` - dimensions = { - height = 0.8, -- Height of the terminal window - width = 0.8, -- Width of the terminal window - x = 0.5, -- X axis of the terminal window - y = 0.5, -- Y axis of the terminal window - }, - -- Callback invoked when the terminal exits. - -- See `:h jobstart-options` - on_exit = nil, - -- Callback invoked when the terminal emits stdout data. - -- See `:h jobstart-options` - on_stdout = nil, - -- Callback invoked when the terminal emits stderr data. - -- See `:h jobstart-options` - on_stderr = nil, -}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/galaxyline_nvim.lua b/lua/plugins/galaxyline_nvim.lua deleted file mode 100644 index 1d800d6..0000000 --- a/lua/plugins/galaxyline_nvim.lua +++ /dev/null @@ -1,354 +0,0 @@ - ---[[ ---copied and modified from https://github.com/zootedb0t/dotfiles/blob/master/.config/nvim/lua/plugins/nvim-galaxyline.lua ---]] - - -local gl = require('galaxyline') - -local colors = { - bg = '#292D38', - yellow = '#DCDCAA', - dark_yellow = '#D7BA7D', - cyan = '#4EC9B0', - green = '#608B4E', - light_green = '#B5CEA8', - string_orange = '#CE9178', - orange = '#FF8800', - purple = '#C586C0', - magenta = '#D16D9E', - grey = '#43454F', - -- blue = '#569CD6', - blue = '#178c94', - - vivid_blue = '#4FC1FF', - light_blue = '#9CDCFE', - red = '#D16969', - error_red = '#F44747', - - info_yellow = '#FFCC66', - fg_green = '#65a380', - line_bg = '#202733', - fg = '#8FBCBB', - - darkblue = '#83A598', -} -local condition = require('galaxyline.condition') -local gls = gl.section -gl.short_line_list = {'NvimTree', 'packer', 'undotree'} - - - -- Lsp server name . -local function lspservername() - local msg = '' - local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then return msg end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return "LSP[" .. client.name .. "]" - end - end - return msg -end - -local mode_color = function() - local mode_colors = { - n = colors.blue, - i = colors.red, - c = colors.orange, - V = colors.magenta, - [''] = colors.magenta, - v = colors.magenta, - R = colors.red, - } - - local color = mode_colors[vim.fn.mode()] - - if color == nil then - color = colors.red - end - - return color -end - -gls.left[1] = { - ViMode = { - provider = function() - local alias = { - n = 'NORMAL', - i = 'INSERT', - c = 'COMMAND', - V = 'VISUAL', - [''] = 'VISUAL', - v = 'VISUAL', - Rv = 'R&V', - R = 'REPLACE', - C = 'C', - ['r?'] = ':CONFIRM', - rm = '--MORE', - s = 'S', - S = 'S', - ['r'] = 'HIT-ENTER', - t = 'T', - ['!'] = 'SH', - } - vim.api.nvim_command('hi GalaxyViMode gui=bold guibg='..mode_color()) - local alias_mode = alias[vim.fn.mode()] - if alias_mode == nil then - alias_mode = vim.fn.mode() - end - return ' '..alias_mode..' ' - end, - separator = '', - highlight = { colors.bg, colors.section_bg }, - -- separator_highlight = {colors.bg, colors.section_bg }, - separator_highlight = {colors.bg, colors.blue }, - }, -} - - - - - - - - - - - - - - - - - - - ---------------------------------------------------------------- - -gls.left[2] = { - FileName = { - provider = function () - local file_name = vim.fn.expand('%f') - local file_lenght = string.len(file_name) - if file_lenght > 20 then - return ' ..'..string.sub(file_name, -25)..' ' - end - return ' '..file_name..' ' - end, - condition = buffer_not_empty, - separator = '', - separator_highlight = {colors.orange, colors.bg}, - highlight = {"#55ffff", colors.grey} - } -} -gls.left[3] = { - BufferType = { - provider = 'FileIcon', - condition = condition.buffer_not_empty, - separator = '', - separator_highlight = {colors.orange, colors.bg}, - highlight = {"#55aaff", colors.grey} - } -} - -gls.left[4] = { - FileSize = { - provider = 'FileSize', - condition = condition.buffer_not_empty, - highlight = {"#ffaa7f", colors.grey} - } -} - - -gls.left[5] = { - FileEncode = { - provider = 'FileEncode', - condition = condition.buffer_not_empty, - highlight = {"#fff66f", colors.grey}, - separator = ' ', - separator_highlight = {'NONE', colors.grey}, - } -} - - - - --- This function gives space on the right side -gls.left[6] = { - Space = { - provider = function() return ' ' end, - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.orange, colors.bg} - } -} ---------------------------------------------------------------- -gls.left[7] = { - GitIcon = { - provider = function() return '' end, - condition = condition.check_git_workspace, - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {colors.orange, colors.bg} - } -} - -gls.left[8] = { - GitBranch = { - provider = 'GitBranch', - condition = condition.check_git_workspace, - separator = ' ', - separator_highlight = {'NONE', colors.bg}, - highlight = {"#55aaff", colors.bg} - } -} -gls.left[9] = { - DiffAdd = { - provider = 'DiffAdd', - condition = condition.hide_in_width, - icon = ' +', - highlight = {colors.green, colors.bg} - } -} -gls.left[10] = { - DiffModified = { - provider = 'DiffModified', - condition = condition.hide_in_width, - icon = ' ~', - highlight = {colors.yellow, colors.bg} - } -} - -gls.left[11] = { - DiffRemove = { - provider = 'DiffRemove', - condition = condition.hide_in_width, - icon = ' -', - highlight = {colors.red, colors.bg} - } -} ----------------------------------------------------- - - - - - - - -local lsp_status = require('lsp-status') -lsp_status.register_progress() -LspStat = lsp_status.status - -gls.mid[1] = { - LspStat = { - provider = LspStat, - highlight = {colors.green,colors.bg}, - } -} - - - - ----------------------------------------------------- - - - - - - - ----------------------------------------------------- - -gls.right[1] = { - DiagnosticError = { - provider = 'DiagnosticError', - icon = ' ✗ ', - highlight = {colors.error_red, colors.bg} - } -} -gls.right[2] = { - DiagnosticWarn = { - provider = 'DiagnosticWarn', - icon = ' ⚠ ', - highlight = {colors.orange, colors.bg} - } -} - -gls.right[3] = { - DiagnosticHint = { - provider = 'DiagnosticHint', - icon = '  ', - highlight = {colors.info_yellow, colors.bg} - } -} - -gls.right[4] = { - DiagnosticInfo = { - provider = 'DiagnosticInfo', - icon = '  ', - highlight = {colors.info_yellow, colors.bg} - } -} - - - - - - -gls.right[5] = { - ShowLspClient = { - provider = function() - local msg = '' - local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then return msg end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return "LSP[" .. client.name .. "]" - end - end - return msg end, - highlight = {colors.cyan, colors.bg}, - } -} - - ---------------------------------------------------- - - --- for line position and numbers -gls.right[6] = { - LineColumn = { - provider = function () - local max_lines = vim.fn.line('$') - local line = vim.fn.line('.') - local column = vim.fn.col('.') - local ld = " " - if string.len(max_lines) > 3 then - ld = string.format(" %5d/%2d :%6d ", line, column, max_lines) - end - ld =string.format(" %3d/%2d :%2d ", line, column, max_lines) - return ld - end, - highlight = {"#000000", colors.blue}, - } -} - - - ---------------------------------------------------- - --- for inactive/focused window -gls.short_line_left[1] = { - FileName = { - provider = 'FileName', - separator =' ', - highlight = { colors.fg, colors.bg_inactive }, - separator_highlight = { colors.fg, colors.bg_inactive }, - } -} - diff --git a/lua/plugins/gitblame.lua b/lua/plugins/gitblame.lua deleted file mode 100644 index a1999ca..0000000 --- a/lua/plugins/gitblame.lua +++ /dev/null @@ -1,33 +0,0 @@ ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---─────────────────────────────────────────────────-- --- Plugin: git-blame.nvim --- Github: github.com/f-person/git-blame.nvim ---─────────────────────────────────────────────────-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - -local g = vim.g -- global variables - - - -g.gitblame_enabled = 1 - --- The template for the blame message that will be shown. --- Available options: , , , , , -g.gitblame_message_template = '' - --- The format of the date fields. -g.gitblame_date_format = '%c' - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - diff --git a/lua/plugins/github-nvim-theme.lua b/lua/plugins/github-nvim-theme.lua deleted file mode 100644 index 28b99c5..0000000 --- a/lua/plugins/github-nvim-theme.lua +++ /dev/null @@ -1,25 +0,0 @@ ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---─────────────────────────────────────────────────-- --- Plugin: github-nvim-theme --- Github: github.com/projekt0n/github-nvim-theme ---─────────────────────────────────────────────────-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - -require("github-theme").setup({ - theme_style = "dark_default", - -- other config -}) - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- diff --git a/lua/plugins/gitsigns_nvim.lua b/lua/plugins/gitsigns_nvim.lua deleted file mode 100644 index c951851..0000000 --- a/lua/plugins/gitsigns_nvim.lua +++ /dev/null @@ -1,124 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: gitsigns.nvim --- Github: github.com/lewis6991/gitsigns.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local import_gitsigns, gitsigns = pcall(require, "gitsigns") -if not import_gitsigns then return end - -require('gitsigns').setup { - signs = { - add = { - hl = 'GitSignsAdd', - text = '│', - numhl = 'GitSignsAddNr', - linehl = 'GitSignsAddLn', - }, - change = { - hl = 'GitSignsChange', - text = '│', - numhl = 'GitSignsChangeNr', - linehl = 'GitSignsChangeLn', - }, - delete = { - hl = 'GitSignsDelete', - text = '_', - numhl = 'GitSignsDeleteNr', - linehl = 'GitSignsDeleteLn', - }, - topdelete = { - hl = 'GitSignsDelete', - text = '‾', - numhl = 'GitSignsDeleteNr', - linehl = 'GitSignsDeleteLn', - }, - changedelete = { - hl = 'GitSignsChange', - text = '~', - numhl = 'GitSignsChangeNr', - linehl = 'GitSignsChangeLn', - }, - }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = false, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` - word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - - 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, - }, - current_line_blame_formatter_opts = {relative_time = false}, - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, - preview_config = { - -- Options passed to nvim_open_win - border = 'single', - style = 'minimal', - relative = 'cursor', - row = 0, - col = 1, - }, - diff_opts = {internal = true}, -- If vim.diff or luajit is present - yadm = {enable = false}, -} --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - ---[===[ -require('gitsigns').setup { - keymaps = { - -- Default keymap options - noremap = true, - - ['n ]c'] = { expr = true, "&diff ? ']c' : 'lua require\"gitsigns.actions\".next_hunk()'"}, - ['n [c'] = { expr = true, "&diff ? '[c' : 'lua require\"gitsigns.actions\".prev_hunk()'"}, - - ['n hs'] = 'lua require"gitsigns".stage_hunk()', - ['v hs'] = 'lua require"gitsigns".stage_hunk({vim.fn.line("."), vim.fn.line("v")})', - ['n hu'] = 'lua require"gitsigns".undo_stage_hunk()', - ['n hr'] = 'lua require"gitsigns".reset_hunk()', - ['v hr'] = 'lua require"gitsigns".reset_hunk({vim.fn.line("."), vim.fn.line("v")})', - ['n hR'] = 'lua require"gitsigns".reset_buffer()', - ['n hp'] = 'lua require"gitsigns".preview_hunk()', - ['n hb'] = 'lua require"gitsigns".blame_line(true)', - ['n hS'] = 'lua require"gitsigns".stage_buffer()', - ['n hU'] = 'lua require"gitsigns".reset_buffer_index()', - - -- Text objects - ['o ih'] = ':lua require"gitsigns.actions".select_hunk()', - ['x ih'] = ':lua require"gitsigns.actions".select_hunk()' - }, -} - ---]===] - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/goto-preview.lua b/lua/plugins/goto-preview.lua deleted file mode 100644 index d620ef4..0000000 --- a/lua/plugins/goto-preview.lua +++ /dev/null @@ -1,75 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: goto-preview --- Github: github.com/rmagatti/goto-preview --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local import_goto_preview, goto_preview = pcall(require, "goto-preview") -if not import_goto_preview then return end -local import_themes, telescope_themes = pcall(require, 'telescope.themes') - -goto_preview.setup { - width = 80, -- Width of the floating window - height = 15, -- Height of the floating window - border = {"↖", "─", "┐", "│", "┘", "─", "└", "│"}, -- Border characters of the floating window - default_mappings = false, -- Bind default mappings - debug = false, -- Print debug information - opacity = nil, -- 0-100 opacity level of the floating window where 100 is fully transparent. - resizing_mappings = false, -- Binds arrow keys to resizing the floating window. - -- A function taking two arguments, a buffer and a window to be ran as a hook. - post_open_hook = function() - -- add preview window to buffer list - local buffer_num = vim.api.nvim_get_current_buf() -- current buffer - vim.api.nvim_buf_set_option(buffer_num, "buflisted") - end, - references = { -- Configure the telescope UI for slowing the references cycling window. - telescope = import_themes and { - telescope_themes.get_dropdown { - winblend = 15, - layout_config = {prompt_position = "top", width = 64, height = 15}, - border = {}, - previewer = false, - shorten_path = false, - }, - }, - }, - -- These two configs can also be passed down to the goto-preview definition and implementation calls for one off "peak" functionality. - focus_on_open = true, -- Focus the floating window when opening it. - dismiss_on_move = false, -- Dismiss the floating window when moving the cursor. - force_close = true, -- passed into vim.api.nvim_win_close's second argument. See :h nvim_win_close - bufhidden = "wipe", -- the bufhidden option to set on the floating window. See :h bufhidden -} - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local options = { noremap=true } -vim.api.nvim_set_keymap("n", "gpd", "lua require('goto-preview').goto_preview_definition()", options) -vim.api.nvim_set_keymap("n", "gpi", "lua require('goto-preview').goto_preview_implementation()", options) --- Only set if telescope is installed -vim.api.nvim_set_keymap("n", "gpr", "lua require('goto-preview').goto_preview_references()", options) - -vim.api.nvim_set_keymap("n", "gP", "lua require('goto-preview').close_all_win()", options) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/hardline_nvim.lua b/lua/plugins/hardline_nvim.lua deleted file mode 100644 index 7ba5e43..0000000 --- a/lua/plugins/hardline_nvim.lua +++ /dev/null @@ -1,22 +0,0 @@ - -require('hardline').setup { - bufferline = false, -- enable bufferline - theme = 'default', -- change theme - sections = { -- define sections - {class = 'mode', item = require('hardline.parts.mode').get_item}, - {class = 'high', item = require('hardline.parts.git').get_item, hide = 80}, - '%<', - {class = 'med', item = require('hardline.parts.filename').get_item}, - {class = 'high', item = require('hardline.parts.filetype').get_item, hide = 80}, - {class = 'med', item ='%='}, - {class = 'low', item = require('hardline.parts.wordcount').get_item, hide = 80}, - {class = 'error', item = require('hardline.parts.lsp').get_error}, - {class = 'warning', item = require('hardline.parts.lsp').get_warning}, - {class = 'warning', item = require('hardline.parts.whitespace').get_item}, - {class = 'mode', item = require('hardline.parts.line').get_item}, - }, - bufferline_settings = { - exclude_terminal = false, -- don't show terminal buffers in bufferline - show_index = false, -- show buffer indexes (not the actual buffer numbers) in bufferline - }, -} diff --git a/lua/plugins/hop_nvim.lua b/lua/plugins/hop_nvim.lua deleted file mode 100644 index df32eb7..0000000 --- a/lua/plugins/hop_nvim.lua +++ /dev/null @@ -1,45 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: hop.nvim --- Github: github.com/phaazon/hop.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local imported_hop, hop = pcall(require, "hop") -if not imported_hop then return end - -hop.setup { - keys = 'qwertyuiopasdfghjklzxcvbnm', - jump_on_sole_occurrence = false -} - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local keymap = vim.api.nvim_set_keymap -local options = {noremap = true, silent = true} - -keymap( 'n', 'f', "lua require'hop'.hint_words()", options) - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/hydra_nvim.lua b/lua/plugins/hydra_nvim.lua deleted file mode 100644 index 6bcd0eb..0000000 --- a/lua/plugins/hydra_nvim.lua +++ /dev/null @@ -1,69 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: hydra.nvim --- Github: github.com/anuvyklack/hydra.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local imported_hydra, Hydra = pcall(require, 'hydra') -if not imported_hydra then return end - -Hydra({ - hint = [[ - ^^^^^^ Move ^^^^^^ ^^ Split ^^^^ Size - ^^^^^^--------------^^^^^^ ^^--------------- ^^^^------------- - ^ ^ _k_ ^ ^ ^ ^ _K_ ^ ^ _s_: horizontally _+_ _-_: height - _h_ ^ ^ _l_ _H_ ^ ^ _L_ _v_: vertically _>_ _<_: width - ^ ^ _j_ ^ ^ ^ ^ _J_ ^ ^ _q_: close ^ _=_ ^: equalize - focus^^^^^^ window^^^^^^ - ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ __ -]], - config = { - -- timeout = 4000, - invoke_on_body = false, - hint = { - border = 'rounded', - -- position = 'bottom', - }, - }, - mode = 'n', - body = '', - heads = { - -- Move focus - {'h', 'h'}, - {'j', 'j'}, - {'k', 'k'}, - {'l', 'l'}, - -- Move window - {'H', 'WinShift left'}, - {'J', 'WinShift down'}, - {'K', 'WinShift up'}, - {'L', 'WinShift right'}, - -- Split - {'s', 's'}, - {'v', 'v'}, - {'q', 'try | close | catch | endtry', {desc = 'close window'}}, - -- Size - {'+', '+'}, - {'-', '-'}, - {'>', '2>', {desc = 'increase width'}}, - {'<', '2<', {desc = 'decrease width'}}, - {'=', '=', {desc = 'equalize'}}, - -- - {'', nil, {exit = true}}, - }, -}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/impatient_nvim.lua b/lua/plugins/impatient_nvim.lua deleted file mode 100644 index af8815b..0000000 --- a/lua/plugins/impatient_nvim.lua +++ /dev/null @@ -1,28 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: impatient.nvim --- Github: github.com/lewis6991/impatient.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - -local impatient_ok, _ = pcall(require, "impatient") -if not impatient_ok then - return -end - -require('impatient') - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/indent-blankline_nvim.lua b/lua/plugins/indent-blankline_nvim.lua deleted file mode 100644 index 3ed54d0..0000000 --- a/lua/plugins/indent-blankline_nvim.lua +++ /dev/null @@ -1,59 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: indent-blankline.nvim --- Github: github.com/lukas-reineke/indent-blankline.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - ---[===[ - NOTE: - to know more about filetype_exclude and buftype_exclude - https://github.com/lukas-reineke/indent-blankline.nvim/issues/284 - :set buftype ---]===] - -local ibl_import, ibl = pcall(require, "ibl") -if not ibl_import then return end - -ibl.setup { - - debounce = 100, - indent = { - char = "▎", -- | ¦ ┆ ┊ ║ ▎ - tab_char= "▎", - smart_indent_cap = true, - priority = 2, - highlight = { - "IndentBlanklineIndent1", "IndentBlanklineIndent2", "IndentBlanklineIndent3", "IndentBlanklineIndent4", - "IndentBlanklineIndent5", "IndentBlanklineIndent6", "IndentBlanklineIndent7", "IndentBlanklineIndent8", - }, - }, - whitespace = { - highlight = { "Whitespace", "NonText" }, - remove_blankline_trail = true, - }, - scope = { - enabled = true, - }, - exclude = { - filetypes = { - "rust", "lspinfo", "packer", "checkhealth", "help", "man", "gitcommit", "TelescopePrompt", - "TelescopeResults", 'startify', 'alpha', 'dashboard', 'neogitstatus', 'NvimTree', '', - }, - buftypes = { "terminal",'nofile', }, - } -} - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/indentLine.lua b/lua/plugins/indentLine.lua deleted file mode 100644 index c5caf2c..0000000 --- a/lua/plugins/indentLine.lua +++ /dev/null @@ -1,35 +0,0 @@ ---"--------------------------------------------------------------------- ---" PluginName: indentLine ---" Github: github.com/Yggdroot/indentLine ---"--------------------------------------------------------------------- --- --- --- --- --- ---"--------------------------------------------------------------------- ---" CONFIGS ---"--------------------------------------------------------------------- --- ---" Change Conceal Behaviour ---" This plugin enables the Vim conceal feature which automatically hides stretches of text based on syntax highlighting. ---" For example, users utilizing the built in json.vim syntax file will no longer see quotation marks in their JSON files. ---" so for .json file, disable conceal Behaviour - -vim.cmd([[ autocmd BufRead,BufNewFile *.json let g:indentLine_setConceal = 0 ]]) - ---" enable/disable indent line guide -vim.g.indentLine_enabled = 1 - ---" Change Indent Char -vim.g.indentLine_char = '▏' ---" to display more beautiful lines. ---" let g:indentLine_char_list = ['|', '¦', '┆', '┊'] --- ---" customize conceal color(indent line guide color ) -vim.g.indentLine_color_gui = '#222F22' - ---"--------------------------------------------------------------------- ---" end of CONFIGS ---"--------------------------------------------------------------------- --- diff --git a/lua/plugins/kommentary.lua b/lua/plugins/kommentary.lua deleted file mode 100644 index 22fd2b4..0000000 --- a/lua/plugins/kommentary.lua +++ /dev/null @@ -1,76 +0,0 @@ ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---─────────────────────────────────────────────────-- --- Plugin: kommentary --- Github: github.com/b3nj5m1n/kommentary ---─────────────────────────────────────────────────-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - --- For global -require('kommentary.config').configure_language( - "default", - { - prefer_single_line_comments = true, - } -) - ---Configure unsupported language -require('kommentary.config').configure_language( - "Rust", - { - single_line_comment_string = "//", - multi_line_comment_strings = {"/*", "*/"}, - } -) - -require('kommentary.config').configure_language( - "cpp", - { - single_line_comment_string = "//", - multi_line_comment_strings = {"/*", "*/"}, - } -) - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - - - - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- --- If you don't want to use the default mappings, -vim.g.kommentary_create_default_mappings = false - - ---[[ -vim.api.nvim_set_keymap("n", "cic", "kommentary_line_increase", {}) -vim.api.nvim_set_keymap("n", "ci", "kommentary_motion_increase", {}) -vim.api.nvim_set_keymap("x", "ci", "kommentary_visual_increase", {}) -vim.api.nvim_set_keymap("n", "cdc", "kommentary_line_decrease", {}) -vim.api.nvim_set_keymap("n", "cd", "kommentary_motion_decrease", {}) -vim.api.nvim_set_keymap("x", "cd", "kommentary_visual_decrease", {}) -]] - -vim.api.nvim_set_keymap("n", "cc", "kommentary_line_default", {}) -vim.api.nvim_set_keymap("n", "cm", "kommentary_motion_default", {}) -vim.api.nvim_set_keymap("x", "cmc", "kommentary_visual_default", {}) - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - diff --git a/lua/plugins/lsp_signature_nvim.lua b/lua/plugins/lsp_signature_nvim.lua deleted file mode 100644 index 04e5491..0000000 --- a/lua/plugins/lsp_signature_nvim.lua +++ /dev/null @@ -1,84 +0,0 @@ - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---─────────────────────────────────────────────────-- --- Plugin: lsp_signature.nvim --- Github: github.com/ray-x/lsp_signature.nvim - --- Simple winbar/statusline plugin that shows --- your current code context ---─────────────────────────────────────────────────-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - -local import_signature, lsp_signature = pcall(require, "lsp_signature") -if not import_signature then return end - - -local cfg = { - debug = false, -- set to true to enable debug logging - log_path = vim.fn.stdpath("cache") .. "/lsp_signature.log", -- log dir when debug is on - -- default is ~/.cache/nvim/lsp_signature.log - verbose = false, -- show debug line number - - bind = true, -- This is mandatory, otherwise border config won't get registered. - -- If you want to hook lspsaga or other signature handler, pls set to false - doc_lines = 10, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated); - -- set to 0 if you DO NOT want any API comments be shown - -- This setting only take effect in insert mode, it does not affect signature help in normal - -- mode, 10 by default - - max_height = 12, -- max height of signature floating_window - max_width = 80, -- max_width of signature floating_window - wrap = true, -- allow doc/signature text wrap inside floating_window, useful if your lsp return doc/sig is too long - - floating_window = true, -- show hint in a floating window, set to false for virtual text only mode - - floating_window_above_cur_line = true, -- try to place the floating above the current line when possible Note: - -- will set to true when fully tested, set to false will use whichever side has more space - -- this setting will be helpful if you do not want the PUM and floating win overlap - - floating_window_off_x = 1, -- adjust float windows x position. - floating_window_off_y = 0, -- adjust float windows y position. e.g -2 move window up 2 lines; 2 move down 2 lines - - close_timeout = 4000, -- close floating window after ms when laster parameter is entered - fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters - hint_enable = true, -- virtual hint enable - hint_prefix = "🐼 ", -- Panda for parameter, NOTE: for the terminal not support emoji, might crash - hint_scheme = "String", - hi_parameter = "LspSignatureActiveParameter", -- how your parameter will be highlight - handler_opts = { - border = "single", -- double, rounded, single, shadow, none - }, - - always_trigger = false, -- sometime show signature on new line or in middle of parameter can be confusing, set it to false for #58 - - auto_close_after = nil, -- autoclose signature float win after x sec, disabled if nil. - extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","} - zindex = 200, -- by default it will be on top of all floating windows, set to <= 50 send it to bottom - - padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc - - transparency = nil, -- disabled by default, allow floating win transparent value 1~100 - shadow_blend = 36, -- if you using shadow as border use this set the opacity - shadow_guibg = "Black", -- if you using shadow as border use this set the color e.g. 'Green' or '#121315' - timer_interval = 200, -- default timer check interval set to lower value if you want to reduce latency - toggle_key = nil, -- toggle signature on and off in insert mode, e.g. toggle_key = '' - - select_signature_key = nil, -- cycle to next signature, e.g. '' function overloading - move_cursor_key = nil, -- imap, use nvim_set_current_win to move cursor between current win and floating -} - --- require'lspconfig'.gopls.setup() -lsp_signature.setup(cfg) - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - diff --git a/lua/plugins/lspinstall.lua b/lua/plugins/lspinstall.lua deleted file mode 100644 index 31f962a..0000000 --- a/lua/plugins/lspinstall.lua +++ /dev/null @@ -1,35 +0,0 @@ ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---─────────────────────────────────────────────────-- --- Plugin: nvim-lspinstall --- Github: github.com/kabouzeid/nvim-lspinstall ---─────────────────────────────────────────────────-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - ---[[ we are going to use lua/plugin_confs/lspconfig.lua - file to change any setting related to LSP - we aren't going to use lua/plugin_confs/lspinstall.lua - file or if you prefer anyway, commentout dupilcate codes - for lspconfig.lua file]]-- - -require'lspinstall'.setup() ---[[ -require'lspinstall'.setup() -- important - -local servers = require'lspinstall'.installed_servers() -for _, server in pairs(servers) do - require'lspconfig'[server].setup{} -end ---]] - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - diff --git a/lua/plugins/lspkind-nvim.lua b/lua/plugins/lspkind-nvim.lua deleted file mode 100644 index 085e0aa..0000000 --- a/lua/plugins/lspkind-nvim.lua +++ /dev/null @@ -1,57 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: lspkind-nvim --- Github: github.com/onsails/lspkind-nvim --- Description: vscode-like pictograms for neovim lsp completion items --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local lspkind_imported_ok, lspkind = pcall(require, "lspkind") -if not lspkind_imported_ok then return end - -lspkind.init({ - -- enables text annotations (default: true) - mode = true, - - -- enables text annotations (default: 'default') - -- default symbol map can be either 'default' or 'codicons' for codicon preset (requires vscode-codicons font installed) - preset = 'codicons', - - -- override preset symbols (default: {}) - symbol_map = { - Text = '', - Method = 'ƒ', - Function = '', - Constructor = '', - Variable = '', - Class = '', - Interface = 'ﰮ', - Module = '', - Property = '', - Unit = '', - Value = '', - Enum = '了', - Keyword = '', - Snippet = '﬌', - Color = '', - File = '', - Folder = '', - EnumMember = '', - Constant = '', - Struct = '', - }, -}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/lspsaga_nvim.lua b/lua/plugins/lspsaga_nvim.lua deleted file mode 100644 index 20ad3f3..0000000 --- a/lua/plugins/lspsaga_nvim.lua +++ /dev/null @@ -1,132 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- --- ─────────────────────────────────────────────────-- --- Plugin: lspsaga.nvim --- Github: github.com/glepnir/lspsaga.nvim --- ─────────────────────────────────────────────────-- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━-- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - -local import_saga, saga = pcall(require, 'lspsaga') -if not import_saga then return end - - -saga.init_lsp_saga({ - - -- Options with default value - -- "single" | "double" | "rounded" | "bold" | "plus" - border_style = "single", - -- the range of 0 for fully opaque window (disabled) to 100 for fully - -- transparent background. Values between 0-30 are typically most useful. - saga_winblend = 0, - -- when cursor in saga window you config these to move - -- Error, Warn, Info, Hint - -- use emoji like - -- { "🙀", "😿", "😾", "😺" } - -- or - -- { "😡", "😥", "😤", "😐" } - -- and diagnostic_header can be a function type - -- must return a string and when diagnostic_header - -- is function type it will have a param `entry` - -- entry is a table type has these filed - -- { bufnr, code, col, end_col, end_lnum, lnum, message, severity, source } - diagnostic_header = {" ", " ", " ", "ﴞ "}, - -- show diagnostic source - show_diagnostic_source = true, - -- add bracket or something with diagnostic source, just have 2 elements - diagnostic_source_bracket = {}, - -- preview lines of lsp_finder and definition preview - max_preview_lines = 10, - -- use emoji lightbulb in default - code_action_icon = "💡", - -- if true can press number to execute the codeaction in codeaction window - code_action_num_shortcut = true, - -- same as nvim-lightbulb but async - code_action_lightbulb = { - enable = false, - sign = true, - enable_in_insert = true, - sign_priority = 20, - virtual_text = true, - }, - -- finder icons - finder_icons = {def = ' ', ref = '諭 ', link = ' '}, - -- custom finder title winbar function type - -- param is current word with symbol icon string type - -- return a winbar format string like `%#CustomFinder#Test%*` - -- finder_title_bar = function(param) do your stuff here end, - - rename_in_select = true, - definition_preview_icon = " ", - -- show symbols in winbar must nightly - symbol_in_winbar = { - in_custom = false, - enable = false, - separator = ' ', - show_file = true, - click_support = false, - }, - -- show outline - show_outline = { - win_position = 'right', - -- set special filetype win that outline window split.like NvimTree neotree - -- defx, db_ui - win_with = '', - win_width = 30, - auto_enter = true, - auto_preview = true, - virt_text = '┃', - jump_key = 'o', - -- auto refresh when change buffer - auto_refresh = true, - }, - -- if you don't use nvim-lspconfig you must pass your server name and - -- the related filetypes into this table - -- like server_filetype_map = { metals = { "sbt", "scala" } } - server_filetype_map = {}, - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━-- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━━-- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - move_in_saga = {prev = '', next = ''}, - finder_action_keys = { - open = "o", - vsplit = "s", - split = "i", - tabe = "t", - quit = {"q", "Esc"},-- quit can be a table - scroll_down = "", - scroll_up = "", - }, - code_action_keys = {quit = "q", exec = ""}, - rename_action_quit = "", -}) - - -local options = {noremap = true, silent = true} -local keymap = vim.api.nvim_set_keymap - --- Rename -keymap('n', 'R', 'Lspsaga rename', options) -keymap('v', 'R', 'Lspsaga rename', options) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━-- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - diff --git a/lua/plugins/lspstatus.lua b/lua/plugins/lspstatus.lua deleted file mode 100644 index 2a34ea8..0000000 --- a/lua/plugins/lspstatus.lua +++ /dev/null @@ -1,39 +0,0 @@ ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---─────────────────────────────────────────────────-- --- Plugin: lsp-status.nvim --- Github: github.com/nvim-lua/lsp-status.nvim ---─────────────────────────────────────────────────-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - - - -require('lsp-status').status() -require('lsp-status').register_progress() -require('lsp-status').config({ - indicator_errors = '✗', - indicator_warnings = '⚠', - indicator_info = '', - indicator_hint = '', - indicator_ok = '✔', - current_function = true, - diagnostics = false, - select_symbol = nil, - update_interval = 100, - status_symbol = ' 🇻', -}) - - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua deleted file mode 100644 index 7742a87..0000000 --- a/lua/plugins/lualine.lua +++ /dev/null @@ -1,318 +0,0 @@ ---[[------------------------------------------------------------------- - PluginName: lualine.nvim - Github: github.com/hoob3rt/lualine.nvim ---]]------------------------------------------------------------------- - - - - - --- ------------------------------------------------------------------- --- CONFIGS --- ------------------------------------------------------------------- - --- -------- USER DEFINED --------------- --- Color table for highlights -local colors = { - bg = '#202328', - fg = '#bbc2cf', - black = '#1c1e26', - white = '#FFFFFF', - white1 = '#6C6F93', - red = '#F43E5C', - red_error = '#800000', - green = '#09F7A0', - blue = '#25B2BC', - yellow = '#F09383', - gray = '#E95678', - darkgray = '#1A1C23', - lightgray = '#2E303E', - inactivegray = '#1C1E26', - yellow = '#ECBE7B', - cyan = '#008080', - darkblue = '#081633', - orange = '#FF8800', - violet = '#a9a1e1', - magenta = '#c678dd' -} - - --- copied from https://gist.github.com/hoob3rt/b200435a765ca18f09f83580a606b878#file-evil_lualine-lua-L21 -local conditions = { - buffer_not_empty = function() return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 end, - hide_in_width = function() return vim.fn.winwidth(0) > 80 end, - check_git_workspace = function() - local filepath = vim.fn.expand('%:p:h') - local gitdir = vim.fn.finddir('.git', filepath .. ';') - return gitdir and #gitdir > 0 and #gitdir < #filepath - end -} - - --- copied and modified from https://github.com/hoob3rt/lualine.nvim/issues/77#issuecomment-765067579 -function diagnostics_m() - local errors = 0 - local warnings = 0 - local hints = 0 - local cur_buf_errors = 0 - local cur_buf_warnings = 0 - local cur_buf_hints = 0 - - for _, buffer in ipairs(vim.fn['getbufinfo']()) do -- Loop through buffers - if buffer.listed == 1 and buffer.name ~= '' then -- If the buffer is listed and it is not a no-name buffer - local bufnr = buffer.bufnr - local buf_errors = vim.lsp.diagnostic.get_count(bufnr, [[Error]]) - local buf_warnings = vim.lsp.diagnostic.get_count(bufnr, [[Warning]]) - local buf_hints = vim.lsp.diagnostic.get_count(bufnr, [[Hint]]) - - errors = errors + buf_errors -- Add this buffer's errors to the total errors - warnings = warnings + buf_warnings -- Same with warnings - hints = hints + buf_hints - - if bufnr == vim.fn.bufnr() then -- If this buffer is the currently open buffer - cur_buf_errors = buf_errors - cur_buf_warnings = buf_warnings - cur_buf_hints = buf_hints - end - end - end - if errors ~= 0 or warnings ~= 0 or hints~=0 then -- If there is at least one error or warning or hints - return '✗:' .. errors .. ' ⚠:' .. warnings .. ' :' .. hints - else - return '' - end -end - - -- Lsp server name . -local function lspservername() - local msg = '' - local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then return msg end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return "LSP[" .. client.name .. "]" - end - end - return msg -end - - - -local lsp_status = require('lsp-status') -lsp_status.register_progress() -local lsp_config = require('lspconfig') - - ---[[ ---------------------------------------------- --- Some arbitrary servers -lsp_config.clangd.setup({ - --handlers = lsp_status.extensions.clangd.setup(), - --on_attach = lsp_status.on_attach, - capabilities = lsp_status.capabilities -}) - -lsp_config.pyright.setup({ - settings = { python = { workspaceSymbols = { enabled = true }}}, - on_attach = lsp_status.on_attach, - capabilities = lsp_status.capabilities -}) - -lsp_config.ghcide.setup({ - on_attach = lsp_status.on_attach, - capabilities = lsp_status.capabilities -}) - -lsp_config.rust_analyzer.setup({ - on_attach = lsp_status.on_attach, - capabilities = lsp_status.capabilities -}) ---------------------------------------------- -]] - - - --- -------- end of USER DEFINED --------------- - - - - - ---[[ -Lualine has sections as shown below. -+-------------------------------------------------+ -| A | B | C X | Y | Z | -+-------------------------------------------------+ -]] - - - -require'lualine'.setup { - --[[ Setting a theme: - All available themes are listed in https://github.com/hoob3rt/lualine.nvim/blob/master/THEMES.md - 16color, ayu_dark, ayu_light, ayu_mirage, codedark, dracula, everforest, gruvbox, gruvbox_light, gruvbox_material, - horizon, iceberg_dark, iceberg_light, jellybeans, material, modus_vivendi, molokai, nightfly, nord, oceanicnext, - onedark, onelight, palenight, papercolor_dark, papercolor_light, powerline, seoul256, solarized_dark, solarized_light, - tomorrow, wombat - Symbols: - ║ ⋰  ∫ - ]] - options = { - theme = 'ayu_mirage', - section_separators = {'', ''}, -- separators between sections - --component_separators = {'⋰', '⋰'}, - disabled_filetypes = {}, -- disable lualine for specific filetypes - icons_enabled = 1, -- displays icons in alongside component - --padding = 0, -- adds padding to the left and right of components - left_padding = 0, -- adds padding to the left of components - right_padding = 0, -- adds padding to the right of components - upper = false, -- displays components in uppercase - lower = false, -- displays components in lowercase - format = nil -- format function, formats component's output - }, - - sections = { - - lualine_a = { - { - 'mode', - right_padding =1, - left_padding = 1, - component_separators = '' - }, - { - 'branch', - -- icon = '', - condition = conditions.check_git_workspace, - right_padding =1, - component_separators = '' - }, - { - 'diff', - symbols = {added = '+ ', modified = '~ ', removed = '- '}, - color_added = colors.green, - color_modified = colors.orange, - color_removed = colors.red, - condition = conditions.hide_in_width, - right_padding = 1, - }, - }, - - - lualine_b = { - { - 'filename', - file_status = true, -- displays file status (readonly status, modified status) - path = 1, -- 0 = just filename, 1 = relative path, 2 = absolute path - condition = conditions.buffer_not_empty, - left_padding = 1, -- adds padding to the left of components - right_padding = 1, -- adds padding to the right of components - component_separators = '', - icons_enabled = true, - }, - { - 'filetype', - colored = true, -- displays filetype icon in color if set to `true` , - format = function() return " " end, - - }, - { - 'fileformat', - upper = true, - icons_enabled = true, - left_padding = 1, -- adds padding to the right of components - - component_separators = '' - }, - { - 'encoding', - component_separators = '', - left_padding = 1, -- adds padding to the right of components - right_padding = 1, - }, - }, - - lualine_c = {''}, - - - - lualine_x = { - { - lsp_status.status, - left_padding = 1, -- adds padding to the left of components - right_padding = 1, -- adds padding to the right of components - component_separators = '', - }, - { - diagnostics_m, - color = {fg=colors.red, gui='bold'} , - left_padding = 1, -- adds padding to the left of components - right_padding = 1, -- adds padding to the right of components - component_separators = '', - }, - { - lspservername, - color = {fg=colors.white, gui='bold'} , - left_padding = 1, -- adds padding to the left of components - right_padding = 1, -- adds padding to the right of components - component_separators = '', - }, - - }, - - - - lualine_y = { - }, - - lualine_z = { - { - 'progress', - left_padding = 1, - }, - { - 'location', - right_padding = 0, - icon ='' - }, - } - }, - - - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {'filename'}, - lualine_x = {'location'}, - lualine_y = {}, - lualine_z = {} - }, - - tabline = {}, - extensions = {} -} - - - - - - - - - - - - - - - - - - --- ------------------------------------------------------------------- --- end of CONFIGS --- ------------------------------------------------------------------- - - diff --git a/lua/plugins/mason_nvim.lua b/lua/plugins/mason_nvim.lua deleted file mode 100644 index 5829267..0000000 --- a/lua/plugins/mason_nvim.lua +++ /dev/null @@ -1,91 +0,0 @@ - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: mason.nvim --- Github: github.com/williamboman/mason.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local M = {} - -M.setup = { - - ui = { - -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|. - border = "rounded", - - icons = { - -- The list icon to use for installed packages. - package_installed = "✓", - -- The list icon to use for packages that are installing, or queued for installation. - package_pending = "➜", - -- The list icon to use for packages that are not installed. - package_uninstalled = "✗", - }, - - keymaps = { - -- Keymap to expand a package - toggle_package_expand = "", - -- Keymap to install the package under the current cursor position - install_package = "i", - -- Keymap to reinstall/update the package under the current cursor position - update_package = "u", - -- Keymap to check for new version for the package under the current cursor position - check_package_version = "c", - -- Keymap to update all installed packages - update_all_packages = "U", - -- Keymap to check which installed packages are outdated - check_outdated_packages = "C", - -- Keymap to uninstall a package - uninstall_package = "X", - -- Keymap to cancel a package installation - cancel_installation = "", - -- Keymap to apply language filter - apply_language_filter = "", - }, - }, - - -- The directory in which to install packages. - -- install_root_dir = path.concat { vim.fn.stdpath "data", "mason" }, - - pip = { - -- These args will be added to `pip install` calls. Note that setting extra args might impact intended behavior - -- and is not recommended. - -- - -- Example: { "--proxy", "https://proxyserver" } - install_args = {}, - }, - - -- Controls to which degree logs are written to the log file. It's useful to set this to vim.log.levels.DEBUG when - -- debugging issues with package installations. - log_level = vim.log.levels.INFO, - - -- Limit for the maximum amount of packages to be installed at the same time. Once this limit is reached, any further - -- packages that are requested to be installed will be put in a queue. - max_concurrent_installers = 4, - - github = { - -- The template URL to use when downloading assets from GitHub. - -- The placeholders are the following (in order): - -- 1. The repository (e.g. "rust-lang/rust-analyzer") - -- 2. The release version (e.g. "v0.3.0") - -- 3. The asset name (e.g. "rust-analyzer-v0.3.0-x86_64-unknown-linux-gnu.tar.gz") - download_url_template = "https://github.com/%s/releases/download/%s/%s", - }, -} - -return M - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/modes_nvim.lua b/lua/plugins/modes_nvim.lua deleted file mode 100644 index 430fb10..0000000 --- a/lua/plugins/modes_nvim.lua +++ /dev/null @@ -1,39 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: modes.nvim --- Github: github.com/mvllow/modes.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -require('modes').setup({ - - colors = { - copy = "#f5c359", - delete = "#c75c6a", - insert = "#3c6662", - visual = "#9745be", - }, - - -- Cursorline highlight opacity - line_opacity = 0.1, - - -- Highlight cursor - set_cursor = false, - - -- Highlight in active window only - focus_only = false, -}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/neo-tree_nvim.lua b/lua/plugins/neo-tree_nvim.lua deleted file mode 100644 index e6cd1f7..0000000 --- a/lua/plugins/neo-tree_nvim.lua +++ /dev/null @@ -1,268 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: neo-tree.nvim --- Github: github.com/nvim-neo-tree/neo-tree.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local import_ntree, neo_tree = pcall(require, "neo-tree") -if not import_ntree then - return -end - -vim.api.nvim_set_keymap("n", "f", ":Neotree toggle", { noremap = true, silent = true }) - -local windows_mapping = { - [""] = { - "toggle_node", - nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use - }, - ["<2-LeftMouse>"] = "open", - [""] = "open", - [""] = "revert_preview", - ["p"] = { "toggle_preview", config = { use_float = true } }, - ["l"] = "focus_preview", - ["S"] = "open_split", - ["s"] = "open_vsplit", - -- ["S"] = "split_with_window_picker", - -- ["s"] = "vsplit_with_window_picker", - ["t"] = "open_tabnew", - -- [""] = "open_drop", - -- ["t"] = "open_tab_drop", - ["w"] = "open_with_window_picker", - --["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing - ["C"] = "close_node", - -- ['C'] = 'close_all_subnodes', - ["z"] = "close_all_nodes", - --["Z"] = "expand_all_nodes", - ["a"] = { - "add", - -- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details - -- some commands may take optional config options, see `:h neo-tree-mappings` for details - config = { - show_path = "none", -- "none", "relative", "absolute" - }, - }, - ["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion. - ["d"] = "delete", - ["r"] = "rename", - ["y"] = "copy_to_clipboard", - ["x"] = "cut_to_clipboard", - ["P"] = "paste_from_clipboard", - ["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add": - -- ["c"] = { - -- "copy", - -- config = { - -- show_path = "none" -- "none", "relative", "absolute" - -- } - --} - ["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add". - ["q"] = "close_window", - ["R"] = "refresh", - ["?"] = "show_help", - ["<"] = "prev_source", - [">"] = "next_source", -} -local filesystem_mapping = { - mappings = { - [""] = "navigate_up", - ["."] = "set_root", - ["H"] = "toggle_hidden", - ["/"] = "fuzzy_finder", - ["D"] = "fuzzy_finder_directory", - ["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm - -- ["D"] = "fuzzy_sorter_directory", - ["f"] = "filter_on_submit", - [""] = "clear_filter", - ["[g"] = "prev_git_modified", - ["]g"] = "next_git_modified", - }, - fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode - [""] = "move_cursor_down", - [""] = "move_cursor_down", - [""] = "move_cursor_up", - [""] = "move_cursor_up", - }, -} - -local git_mapping = { - ["A"] = "git_add_all", - ["gu"] = "git_unstage_file", - ["ga"] = "git_add_file", - ["gr"] = "git_revert_file", - ["gc"] = "git_commit", - ["gp"] = "git_push", - ["gg"] = "git_commit_and_push", -} -local buffer_mapping = { - ["bd"] = "buffer_delete", - [""] = "navigate_up", - ["."] = "set_root", -} - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -neo_tree.setup({ - - source_selector = { - winbar = true, - statusline = false, - }, - close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab - popup_border_style = "rounded", - enable_git_status = true, - enable_diagnostics = false, - open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes - sort_case_insensitive = false, -- used when sorting files and directories in the tree - sort_function = nil, -- use a custom function for sorting files and directories in the tree - -- sort_function = function (a,b) - -- if a.type == b.type then - -- return a.path > b.path - -- else - -- return a.type > b.type - -- end - -- end , -- this sorts files and directories descendantly - default_component_configs = { - container = { - enable_character_fade = true, - }, - indent = { - indent_size = 2, - padding = 1, -- extra padding on left hand side - -- indent guides - with_markers = true, - indent_marker = "│", - last_indent_marker = "└", - highlight = "NeoTreeIndentMarker", - -- expander config, needed for nesting files - with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders - expander_collapsed = "", - expander_expanded = "", - expander_highlight = "NeoTreeExpander", - }, - icon = { - folder_closed = "", - folder_open = "", - folder_empty = "ﰊ", - -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there - -- then these will never be used. - default = "*", - highlight = "NeoTreeFileIcon", - }, - modified = { - symbol = "●", - highlight = "NeoTreeModified", - }, - name = { - trailing_slash = false, - use_git_status_colors = true, - highlight = "NeoTreeFileName", - }, - git_status = { - symbols = { - -- Change type - added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name - modified = "", -- or "", but this is redundant info if you use git_status_colors on the name - deleted = "✖", -- this can only be used in the git_status source - renamed = "", -- this can only be used in the git_status source - -- Status type - untracked = "", - ignored = "", - unstaged = "", - staged = "", - conflict = "", - }, - }, - }, - -- A list of functions, each representing a global custom command - -- that will be available in all sources (if not overridden in `opts[source_name].commands`) - -- see `:h neo-tree-global-custom-commands` - commands = {}, - window = { - position = "left", - width = 31, - mapping_options = { - noremap = true, - nowait = true, - }, - mappings = windows_mapping, - }, - nesting_rules = {}, - filesystem = { - filtered_items = { - visible = false, -- when true, they will just be displayed differently than normal items - hide_dotfiles = true, - hide_gitignored = true, - hide_hidden = true, -- only works on Windows for hidden files/directories - hide_by_name = { - --"node_modules" - }, - hide_by_pattern = { -- uses glob style patterns - --"*.meta", - --"*/src/*/tsconfig.json", - }, - always_show = { -- remains visible even if other settings would normally hide it - --".gitignored", - }, - never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show - --".DS_Store", - --"thumbs.db" - }, - never_show_by_pattern = { -- uses glob style patterns - --".null-ls_*", - }, - }, - follow_current_file = true, -- This will find and focus the file in the active buffer every - -- time the current file is changed while the tree is open. - group_empty_dirs = false, -- when true, empty folders will be grouped together - hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree - -- in whatever position is specified in window.position - -- "open_current", -- netrw disabled, opening a directory opens within the - -- window like netrw would, regardless of window.position - -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs - use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes - -- instead of relying on nvim autocmd events. - window = { - mappings = filesystem_mapping.mappings, - fuzzy_finder_mappings = filesystem_mapping.fuzzy_finder_mappings, - }, - - commands = {}, -- Add a custom command or override a global one using the same function name - }, - buffers = { - follow_current_file = true, -- This will find and focus the file in the active buffer every - -- time the current file is changed while the tree is open. - group_empty_dirs = true, -- when true, empty folders will be grouped together - show_unloaded = true, - window = { mappings = buffer_mapping }, - }, - git_status = { - window = { - position = "float", - mappings = git_mapping, - }, - }, -}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/neoscroll_nvim.lua b/lua/plugins/neoscroll_nvim.lua deleted file mode 100644 index 489c1ae..0000000 --- a/lua/plugins/neoscroll_nvim.lua +++ /dev/null @@ -1,49 +0,0 @@ ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---─────────────────────────────────────────────────-- --- Plugin: neoscroll.nvim --- Github: github.com/karb94/neoscroll.nvim ---─────────────────────────────────────────────────-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - -require('neoscroll').setup({ - easing_function = "quadratic" -- Default easing function - -- Set any other options as needed -}) - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- -local t = {} --- Syntax: t[keys] = {function, {function arguments}} -t[''] = {'scroll', {'-vim.wo.scroll', 'true', '250'}} -t[''] = {'scroll', { 'vim.wo.scroll', 'true', '250'}} -t[''] = {'scroll', {'-vim.api.nvim_win_get_height(0)', 'true', '450'}} -t[''] = {'scroll', { 'vim.api.nvim_win_get_height(0)', 'true', '450'}} -t[''] = {'scroll', {'-0.10', 'false', '100'}} -t[''] = {'scroll', { '0.10', 'false', '100'}} -t['zt'] = {'zt', {'250'}} -t['zz'] = {'zz', {'250'}} -t['zb'] = {'zb', {'250'}} - -require('neoscroll.config').set_mappings(t) ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - diff --git a/lua/plugins/neovim-session-manager.lua b/lua/plugins/neovim-session-manager.lua deleted file mode 100644 index 31eafeb..0000000 --- a/lua/plugins/neovim-session-manager.lua +++ /dev/null @@ -1,49 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: neovim-session-manager --- Github: github.com/Shatur/neovim-session-manager --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- safely import session_manager -local session_imported, session = pcall(require, 'session_manager') -if not session_imported then return end - -session.setup({ - sessions_dir = vim.fn.stdpath('data').."/.cache/sessions", -- The directory where the session files will be saved. - path_replacer = '__', -- The character to which the path separator will be replaced for session files. - colon_replacer = '++', -- The character to which the colon symbol will be replaced for session files. - autoload_mode = require('session_manager.config').AutoloadMode.Disabled, -- Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession - autosave_last_session = true, -- Automatically save last session on exit and on session switch. - autosave_ignore_not_normal = true, -- Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed. - autosave_ignore_filetypes = { -- All buffers of these file types will be closed before the session is saved. - 'gitcommit', - }, - autosave_only_in_session = false, -- Always autosaves session. If true, only autosaves after a session is active. - max_path_length = 80, -- Shorten the display path if length exceeds this threshold. Use 0 if don't want to shorten the path at all. -}) - - --- -- if you would like to have NvimTree or any other file tree automatically opened after a session load, --- local config_group = vim.api.nvim_create_augroup('MyConfigGroup', {}) -- A global group for all your config autocommands --- vim.api.nvim_create_autocmd( --- { 'SessionLoadPost' }, { --- group = config_group, --- callback = function() --- require('nvim-tree').toggle(false, true) --- end, --- }) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/null-ls_nvim.lua b/lua/plugins/null-ls_nvim.lua deleted file mode 100644 index 811213f..0000000 --- a/lua/plugins/null-ls_nvim.lua +++ /dev/null @@ -1,220 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: null-ls.nvim --- Github: github.com/jose-elias-alvarez/null-ls.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md - --- safley import null-ls -local imported_null, null = pcall(require, "null-ls") -if not imported_null then return end - --- Packages(LSP, Formatter, Linter, DAP) are installed and managed by 'williamboman/mason.nvim' -local imported_packages, packages = pcall(require, "mason-registry") -if not imported_packages then return end --- get all installed Packages -local installed_packages = packages.get_installed_package_names() - -local formatting = null.builtins.formatting --- local completion = null.builtins.completion --- local diagnostics = null.builtins.diagnostics --- local code_actions = null.builtins.code_actions - --- register any number of sources simultaneously -local sources = {} -local load = false - -local api = vim.api -local fn = vim.fn - --- ───────────────────────────────────────────────── -- --- ─────────────────❰ FORMATTING ❱────────────────── -- --- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting - -for _, package in pairs(installed_packages) do - -- Lua - if package == "luaformatter" then - load = true - sources[#sources+1] = formatting.lua_format.with({ - command = "lua-format", - args = { - "--indent-width", - "1", - "--tab-width", - "4", - "--use-tab", - "--chop-down-table", - "--extra-sep-at-table-end", - }, - }) - goto loop_continue - end - if package == "stylua" then - load = true - sources[#sources+1] = formatting.stylua.with({ - command = "stylua", - args = { - "--search-parent-directories", - "--stdin-filepath", - "$FILENAME", - "-", - }, - }) - goto loop_continue - end - -- Python - if package == "black" then - load = true - sources[#sources+1] = formatting.black.with({ - command = "black", - args = {"--quiet", "--fast", "-"}, - }) - goto loop_continue - end - -- Django ("htmldjango") - if package == "djlint" then - load = true - sources[#sources + 1] = formatting.djlint.with({ - command = "djlint", - args = {"--reformat", "-"}, - }) - goto loop_continue - end - -- "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", - -- "css", "scss", "less", "html", "json", "yaml", "markdown", "graphql" - if package == "prettier" then - load = true - sources[#sources+1] = formatting.prettier.with({ - command = "prettier", - args = {"--stdin-filepath", "$FILENAME"}, - }) - goto loop_continue - end - -- C, C++, CS, Java - if package == "clang-format" then - load = true - sources[#sources+1] = formatting.clang_format.with({ - command = "clang-format", - args = { - "-assume-filename", - "$FILENAME", - }, - to_stdin = true, - }) - goto loop_continue - end - -- Rust - if package == "rustfmt" then - load = true - sources[#sources + 1] = formatting.rustfmt.with({ - command = "rustfmt" - }) - goto loop_continue - end - - ::loop_continue:: -end - --- Go -if fn.executable("gofmt") == 1 then - load = true - sources[#sources+1] = formatting.gofmt.with({}) -end - --- ───────────────❰ end FORMATTING ❱──────────────── -- --- ───────────────────────────────────────────────── -- - - --- ───────────────────────────────────────────────── -- --- ─────────────────❰ CODEACTION ❱────────────────── -- --- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/code_actions - ---[===[ --- Javascript -if vim.fn.executable("clang-format") == 1 then - load = true - sources[#sources+1] = code_actions.eslint.with({ - command = "eslint", - filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "vue" }, - args = { "-f", "json", "--stdin", "--stdin-filename", "$FILENAME" }, - to_stdin = true, - }) -end ----]===] - --- ───────────────❰ end CODEACTION ❱──────────────── -- --- ───────────────────────────────────────────────── -- - - --- ───────────────────────────────────────────────── -- --- ─────────────────❰ DIAGNOSTICS ❱───────────────── -- --- -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics --- -- Django ("htmldjango") --- if vim.fn.executable("djlint") == 1 then --- load = true --- sources[#sources+1] = diagnostics.djlint.with({ --- command = "djlint", --- args = { "$FILENAME" }, --- }) --- end --- ───────────────❰ end DIAGNOSTICS ❱─────────────── -- --- ───────────────────────────────────────────────── -- - - --- ───────────────────────────────────────────────── -- --- ─────────────────❰ COMPLETION ❱────────────────── -- --- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/completion --- ───────────────❰ end COMPLETION ❱──────────────── -- --- ───────────────────────────────────────────────── -- - --- ───────────────────────────────────────────────── -- --- ───────────────────❰ HOVER ❱───────────────────── -- --- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/hover --- ─────────────────❰ end HOVER ❱─────────────────── -- --- ───────────────────────────────────────────────── -- - - --- setup null-ls -if load then - null.setup({ - sources = sources - }) -end - --- give border to null-ls window -local group = api.nvim_create_augroup("AbstractNulllsAutoGroup", {clear=true}) -api.nvim_create_autocmd("FileType", { - pattern = "null-ls-info", - group = group, - callback = function() api.nvim_win_set_config(0, {border = "rounded"}) end, -}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local keymap = vim.api.nvim_set_keymap -keymap('n', 'f', ':lua vim.lsp.buf.format({ timeout_ms = 2000 })', {noremap = true, silent = true}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/nvim-autopairs.lua b/lua/plugins/nvim-autopairs.lua deleted file mode 100644 index 8f797cc..0000000 --- a/lua/plugins/nvim-autopairs.lua +++ /dev/null @@ -1,72 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ─────────────────────────────────────────────────-- --- Plugin: nvim-autopairs --- Github: github.com/windwp/nvim-autopairs --- ─────────────────────────────────────────────────-- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Configs ❱━━━━━━━━━━━━━━━━━━━ -- - --- safely import nvim-autopairs -local autopairs_imported_ok, autopairs = pcall(require, 'nvim-autopairs') -if not autopairs_imported_ok then return end - -autopairs.setup({ - enable_check_bracket_line = true, -- Don't add pairs if it already have a close pairs in same line - disable_filetype = {"TelescopePrompt", "vim"}, -- - enable_afterquote = false, -- add bracket pairs after quote - enable_moveright = true, - - -- use treesitter to check for a pair. - check_ts = true, - ts_config = { - -- lua = {'string'},-- it will not add a pair on that treesitter node - -- javascript = {'template_string', 'string'}, - -- java = false,-- don't check treesitter on java - } - -}) - --- this is nvim-cmp Plugin dependent setting --- If you want insert `(` after select function or method item -local cmp_autopairs = require('nvim-autopairs.completion.cmp') -if not cmp_autopairs then return end - -local import_cmp, cmp = pcall(require, 'cmp') -if not import_cmp then return end -cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done()) - -local Rule = require('nvim-autopairs.rule') - -autopairs.add_rules { - -- before insert after - -- (|) ( |) ( | ) - Rule(' ', ' '):with_pair( - function(opts) - local pair = opts.line:sub(opts.col - 1, opts.col) - return vim.tbl_contains({'()', '[]', '{}'}, pair) - end - ), - Rule('( ', ' )'):with_pair(function() return false end):with_move( - function(opts) return opts.prev_char:match('.%)') ~= nil end):use_key(')'), - Rule('{ ', ' }'):with_pair(function() return false end):with_move( - function(opts) return opts.prev_char:match('.%}') ~= nil end):use_key('}'), - Rule('[ ', ' ]'):with_pair(function() return false end):with_move( - function(opts) return opts.prev_char:match('.%]') ~= nil end):use_key(']'), - --[===[ - arrow key on javascript - Before Insert After - (item)= > (item)=> { } - --]===] - -- Rule('%(.*%)%s*%=>$', ' { }', {'typescript', 'typescriptreact', 'javascript'}):use_regex( true):set_end_pair_length(2), -} - --- ━━━━━━━━━━━━━━━━━❰ end Configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/nvim-bufferline_lua.lua b/lua/plugins/nvim-bufferline_lua.lua deleted file mode 100644 index e258c89..0000000 --- a/lua/plugins/nvim-bufferline_lua.lua +++ /dev/null @@ -1,194 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: nvim-bufferline.lua --- Github: github.com/akinsho/nvim-bufferline.lua --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- safely import bufferline -local bufferline_imported, bufferline = pcall(require, 'bufferline') -if not bufferline_imported then return end - -bufferline.setup { - - options = { - - mode = "buffers", -- set to "tabs" to only show tabpages instead - numbers = "ordinal", -- "none" | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string - always_show_bufferline = false, -- don't show bufferline if there is only one file is opened - - close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions" - right_mouse_command = "bdelete! %d", -- can be a string | function, see "Mouse actions" - left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" - middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" - - -- NOTE: this plugin is designed with this icon in mind, - -- and so changing this is NOT recommended, this is intended - -- as an escape hatch for people who cannot bear it for whatever reason - indicator = { - icon = '▎', -- this should be omitted if indicator style is not 'icon' - style = 'underline', -- 'icon' | 'underline' | 'none', - }, - buffer_close_icon = '', - modified_icon = '●', - close_icon = '', - left_trunc_marker = '', - right_trunc_marker = '', - - --- name_formatter can be used to change the buffer's label in the bufferline. - --- Please note some names can/will break the - --- bufferline so use this at your discretion knowing that it has - --- some limitations that will *NOT* be fixed. - name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr" - -- remove extension from markdown files for example - if buf.name:match('%.md') then return vim.fn.fnamemodify(buf.name, ':t:r') end - end, - - max_name_length = 22, - max_prefix_length = 18, -- prefix used when a buffer is de-duplicate - tab_size = 22, - - show_close_icon = false, - show_buffer_icons = true, -- disable filetype icons for buffers - show_buffer_close_icons = false, - show_tab_indicators = true, - enforce_regular_tabs = false, -- if set true, tabs will be prevented from extending beyond the tab size and all tabs will be the same length - - view = "multiwindow", - -- can also be a table containing 2 custom separators - -- [focused and unfocused]. eg: { '|', '|' } - separator_style = {"", ""}, -- options "slant" | "thick" | "thin" | { 'any', 'any' }, - offsets = { - -- options function , text_" "h always_show_bufferline = false - {filetype = "NvimTree", text = "EXPLORER", text_align = "center"}, - {filetype = "neo-tree", text = "EXPLORER", text_align = "center"}, - }, - }, - - highlights = { - fill = {bg={highlight="BufferLineFill", attribute="bg"}}, - background = { -- current tab - fg={highlight="BufferCurrent", attribute="fg"}, - bg={highlight="BufferCurrent", attribute="bg"}, - }, - buffer_selected = { - fg={highlight="fg", attribute="fg"}, - bg={highlight="BufferSelected", attribute="bg"}, - italic = false - }, - close_button_selected = { - fg={highlight="BufferCloseButtonSelected", attribute="fg"}, - bg={highlight="BufferCloseButtonSelected", attribute="bg"}, - }, - duplicate = { - fg={highlight="fg", attribute="fg"}, - bg={highlight="BufferCurrent", attribute="bg"}, - }, - duplicate_selected = { - fg={highlight="fg", attribute="fg"}, - bg={highlight="BufferCurrent", attribute="bg"}, - }, - indicator_selected = { bg={highlight="BufferSelected", attribute="bg"}, }, - modified = { - fg={highlight="BufferCurrentSign", attribute="fg"}, - bg={highlight="BufferLineFill", attribute="bg"}, - }, - modified_selected = { - fg={highlight="BufferCurrentSign", attribute="fg"}, - bg={highlight="BufferLineFill", attribute="bg"}, - }, - numbers = { bg={highlight="BuffNumbers", attribute="bg"}, }, - numbers_selected = { bg={highlight="BuffNumbers", attribute="bg"}, italic = false, }, - tab_selected = { - fg={highlight="TabSelectedFG", attribute="fg"}, - bg={highlight="TabSelectedBG", attribute="bg"}, - }, - tab = { - fg={highlight="TabFG", attribute="fg"}, - bg={highlight="TabBG", attribute="bg"}, - }, - tab_close = { - fg={highlight="TabFG", attribute="fg"}, - bg={highlight="TabBG", attribute="bg"}, - }, - close_button = { - fg={highlight="TabFG", attribute="fg"}, - bg={highlight="TabBG", attribute="bg"}, - }, - - -- duplicate_visible = { - -- }, - -- close_button = { - -- }, - -- close_button_visible = { - -- }, - -- tab_selected = { - -- }, - -- buffer_visible = { - -- }, - -- buffer_selected = { - -- }, - -- modified_visible = { - -- }, - -- separator_visible = { - -- }, - -- indicator_selected = { - -- }, - }, - -} - --- vim.cmd("autocmd BufDelete * if len(getbufinfo({'buflisted':1})) -1 < 1 | set showtabline=1 | endif") - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local keymap = vim.api.nvim_set_keymap -local options = {noremap = true, silent = true} - --- Move to previous/next -keymap('n', '\\', ':BufferLineCycleNext', options) -keymap('n', '|', ':BufferLineCyclePrev', options) - --- Re-order to previous/next -keymap('n', '.', ':BufferLineMoveNext', options) -keymap('n', ',', ':BufferLineMovePrev', options) - --- Close buffer --- nnoremap :BufferClose - --- Magic buffer-picking mode -keymap('n', '<\\>', ':BufferLinePick', options) - --- go to buffer number -keymap('n', '1', ':BufferLineGoToBuffer 1', options) -keymap('n', '2', ':BufferLineGoToBuffer 2', options) -keymap('n', '3', ':BufferLineGoToBuffer 3', options) -keymap('n', '4', ':BufferLineGoToBuffer 4', options) -keymap('n', '5', ':BufferLineGoToBuffer 5', options) -keymap('n', '6', ':BufferLineGoToBuffer 6', options) -keymap('n', '7', ':BufferLineGoToBuffer 7', options) -keymap('n', '8', ':BufferLineGoToBuffer 8', options) -keymap('n', '9', ':BufferLineGoToBuffer 9', options) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua deleted file mode 100644 index 354c3b5..0000000 --- a/lua/plugins/nvim-cmp.lua +++ /dev/null @@ -1,192 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: nvim-cmp --- Github: github.com/hrsh7th/nvim-cmp --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- Set completeopt to have a better completion experience -vim.o.completeopt = 'menuone,noselect' - -local import_cmp, cmp = pcall(require, 'cmp') -if not import_cmp then return end - -local import_luasnip, luasnip = pcall(require, 'luasnip') -if not import_luasnip then return end - - -cmp.setup({ - - -- -- Disabling completion in certain contexts, such as comments - -- enabled = function() - -- -- disable completion in comments - -- local context = require 'cmp.config.context' - -- -- keep command mode completion enabled when cursor is in a comment - -- if vim.api.nvim_get_mode().mode == 'c' then - -- return true - -- else - -- return not context.in_treesitter_capture("comment") - -- and not context.in_syntax_group("Comment") - -- end - -- end, - - completion = { - -- completeopt = 'menu,menuone,noinsert', - }, - - snippet = { - expand = function(args) luasnip.lsp_expand(args.body) end, - }, - - formatting = { - - fields = {"kind", "abbr", "menu"}, - - format = function(entry, vim_item) - local kind_icons = { - Text = "", - Method = "", - Function = "", - Constructor = "", - Field = "", --  - Variable = "", - Class = '', -- ﴯ - Interface = "", - Module = "", - Property = "ﰠ", - Unit = "", - Value = "", - Enum = "", - Keyword = "", - Snippet = "", - Color = "", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - Event = "", - Operator = '', --  - TypeParameter = ' ', - } - - vim_item.kind = (kind_icons[vim_item.kind] or '') .. " " - -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- show icons with the name of the item kind - - -- limit completion width - local MAX_LABEL_WIDTH = 35 - local label = vim_item.abbr - local truncated_label = vim.fn.strcharpart(label, 0, MAX_LABEL_WIDTH) - if truncated_label ~= label then - vim_item.abbr = truncated_label .. '…' - end - - -- set a name for each source - vim_item.menu = ({ - buffer = "[Buffer]", - nvim_lsp = "[LSP]", - luasnip = "[Snippet]", - nvim_lua = "[Lua]", - latex_symbols = "[LaTeX]", - })[entry.source.name] - - return vim_item - end, - }, - - sources = { - {name = 'nvim_lsp'}, - -- {name = 'nvim_lsp_signature_help' }, -- using ray-x/lsp_signature.nvim instead - {name = 'nvim_lua'}, - {name = 'path'}, - {name = 'luasnip'}, - {name = 'buffer', keyword_length = 1}, - -- {name = 'calc'}, - }, - - window = { - documentation = { - border = {"┌", "─", "┐", "│", "┘", "─", "└", "│"}, - }, - completion = { - border = {"┌", "─", "┐", "│", "┘", "─", "└", "│"}, - } - }, - - experimental = { - -- ghost_text = true, - }, - -}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- -- Require function for tab to work with LUA-SNIP --- local has_words_before = function() --- local line, col = unpack(vim.api.nvim_win_get_cursor(0)) --- return col ~= 0 and --- vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1] --- :sub(col, col) --- :match("%s") == nil --- end - -cmp.setup({ - mapping = { - [''] = cmp.mapping.complete({}), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = false, - }), - - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - -- this will auto complete if our cursor in next to a word and we press tab - -- elseif has_words_before() then - -- cmp.complete() - else - fallback() - end - end, {"i", "s"}), - - [""] = 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"}), - - }, -}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/nvim-colorizer_lua.lua b/lua/plugins/nvim-colorizer_lua.lua deleted file mode 100644 index a9d1cbb..0000000 --- a/lua/plugins/nvim-colorizer_lua.lua +++ /dev/null @@ -1,54 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: nvim-colorizer.lua --- Github: github.com/NvChad/nvim-colorizer.lua --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- safely import colorizer -local colorizer_imported_ok, colorizer = pcall(require, 'colorizer') -if not colorizer_imported_ok then return end - -colorizer.setup { - - user_default_options = { - -- RGB = true, -- #RGB hex codes - -- RRGGBB = true, -- #RRGGBB hex codes - names = false, -- "Name" codes like Blue or blue - RRGGBBAA = true, -- #RRGGBBAA hex codes - AARRGGBB = true, -- 0xAARRGGBB 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 for `mode`: foreground, background, virtualtext - mode = "background", -- Set the display mode. - virtualtext = "■", - }, - - -- all the sub-options of filetypes apply to buftypes - filetypes = { - '*', -- Highlight all files, but customize some others. - css = { rgb_fn = true, names = true }, - -- html = { names = false; }, -- Disable parsing "names" like Blue or Gray - -- '!vim', -- Exclude vim from highlighting. - -- 'javascript', -- Highlight for javascript file - -- html = { mode = 'foreground'; } - }, - - buftypes = {}, -} - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/nvim-dap.lua b/lua/plugins/nvim-dap.lua deleted file mode 100644 index f586882..0000000 --- a/lua/plugins/nvim-dap.lua +++ /dev/null @@ -1,150 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: nvim-dap | nvim-dap-ui | nvim-dap-virtual-text | telescope-dap.nvim --- Github: github.com/mfussenegger/nvim-dap --- github.com/rcarriga/nvim-dap-ui --- github.com/theHamsta/nvim-dap-virtual-text --- github.com/nvim-telescope/telescope-dap.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - ---[====[ - -this plugin is not implemented yet. Will do in future - - - -- use { -- DAP, Debug Adapter Protocol client implementation for Neovim - -- 'mfussenegger/nvim-dap', - -- requires = { - -- {'rcarriga/nvim-dap-ui'}, -- A UI for nvim-dap - -- { - -- 'theHamsta/nvim-dap-virtual-text', -- This plugin adds virtual text support to nvim-dap. nvim-treesitter is used to find variable definitions. - -- requires = {'nvim-treesitter/nvim-treesitter'}, - -- }, - -- { - -- 'nvim-telescope/telescope-dap.nvim', -- Integration for nvim-dap with telescope.nvim - -- requires = {'nvim-telescope/telescope.nvim'}, - -- }, - -- }, - -- config = [[ require('plugins/nvim-dap') ]] - -- } - ---]====] - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --------------------------- --- telescope-dap.nvim -pcall(require'telescope'.load_extension, 'dap') --------------------------- - - --------------------------- --- nvim-dap-ui -require("dapui").setup({ - icons = {expanded = "▾", collapsed = "▸"}, - -- Expand lines larger than the window - -- Requires >= 0.7 - expand_lines = vim.fn.has("nvim-0.7"), - sidebar = { - -- You can change the order of elements in the sidebar - elements = { - -- Provide as ID strings or tables with "id" and "size" keys - { - id = "scopes", - size = 0.25, -- Can be float or integer > 1 - }, - {id = "breakpoints", size = 0.25}, - {id = "stacks", size = 0.25}, - {id = "watches", size = 00.25}, - }, - size = 40, - position = "left", -- Can be "left", "right", "top", "bottom" - }, - tray = { - elements = {"repl", "console"}, - size = 10, - position = "bottom", -- Can be "left", "right", "top", "bottom" - }, - floating = { - max_height = nil, -- These can be integers or a float between 0 and 1. - max_width = nil, -- Floats will be treated as percentage of your screen. - border = "single", -- Border style. Can be "single", "double" or "rounded" - mappings = {close = {"q", ""}}, - }, - windows = {indent = 1}, - render = { - max_type_length = nil, -- Can be integer or nil. - }, -}) - --- end nvim-dap-ui --------------------------- - --------------------------- --- nvim-dap-virtual-text -require("nvim-dap-virtual-text").setup { - enabled = true, -- enable this plugin (the default) - enabled_commands = true, -- create commands DapVirtualTextEnable, DapVirtualTextDisable, DapVirtualTextToggle, (DapVirtualTextForceRefresh for refreshing when debug adapter did not notify its termination) - highlight_changed_variables = true, -- highlight changed values with NvimDapVirtualTextChanged, else always NvimDapVirtualText - highlight_new_as_changed = false, -- highlight new variables in the same way as changed variables (if highlight_changed_variables) - show_stop_reason = true, -- show stop reason when stopped for exceptions - commented = false, -- prefix virtual text with comment string - only_first_definition = true, -- only show virtual text at first definition (if there are multiple) - all_references = false, -- show virtual text on all all references of the variable (not only definitions) - filter_references_pattern = '", "<2-LeftMouse>"}, - open = "o", - remove = "d", - edit = "e", - repl = "r", - toggle = "t", - }, -}) --------------------------- - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/nvim-lsp-installer.lua b/lua/plugins/nvim-lsp-installer.lua deleted file mode 100644 index 61d7d27..0000000 --- a/lua/plugins/nvim-lsp-installer.lua +++ /dev/null @@ -1,79 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: nvim-lsp-installer --- Github: github.com/williamboman/nvim-lsp-installer --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local M = {} - -M.setup = { - - -- A list of servers to automatically install if they're not already installed. Example: { "rust_analyzer", "sumneko_lua" } - -- This setting has no relation with the `automatic_installation` setting. - -- ensure_installed = {"sumneko_lua"}, - - -- Whether servers that are set up (via lspconfig) should be automatically installed if they're not already installed. - -- This setting has no relation with the `ensure_installed` setting. - -- Can either be: - -- - false: Servers are not automatically installed. - -- - true: All servers set up via lspconfig are automatically installed. - -- - { exclude: string[] }: All servers set up via lspconfig, except the ones provided in the list, are automatically installed. - -- Example: automatic_installation = { exclude = { "rust_analyzer", "solargraph" } } - automatic_installation = false, - - ui = { - -- Whether to automatically check for outdated servers when opening the UI window. - check_outdated_servers_on_open = true, - -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|. - border = "rounded", - icons = { - server_installed = "✓", - server_pending = "➜", - server_uninstalled = "✗", - }, - keymaps = { - -- Keymap to expand a server in the UI - toggle_server_expand = "", - -- Keymap to install the server under the current cursor position - install_server = "i", - -- Keymap to reinstall/update the server under the current cursor position - update_server = "u", - -- Keymap to check for new version for the server under the current cursor position - check_server_version = "c", - -- Keymap to update all installed servers - update_all_servers = "U", - -- Keymap to check which installed servers are outdated - check_outdated_servers = "C", - -- Keymap to uninstall a server - uninstall_server = "X", - }, - }, - - -- The directory in which to install all servers. - -- install_root_dir = path.concat { vim.fn.stdpath "data", "lsp_servers" }, - - -- Controls to which degree logs are written to the log file. It's useful to set this to vim.log.levels.DEBUG when - -- debugging issues with server installations. - log_level = vim.log.levels.INFO, - - -- Limit for the maximum amount of servers to be installed at the same time. Once this limit is reached, any further - -- servers that are requested to be installed will be put in a queue. - max_concurrent_installers = 4, -} - -return M - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/nvim-lspconfig.lua b/lua/plugins/nvim-lspconfig.lua deleted file mode 100644 index aa826f3..0000000 --- a/lua/plugins/nvim-lspconfig.lua +++ /dev/null @@ -1,285 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: nvim-lspconfig --- Github: github.com/neovim/nvim-lspconfig --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ───────────────────────────────────────────────── -- -local lspconfig_imported, lspconfig = pcall(require, 'lspconfig') -if not lspconfig_imported then return end - -local imported_mason, mason = pcall(require, 'mason') -if not imported_mason then return end - -local lsp = vim.lsp -local api = vim.api -local handlers = lsp.handlers --- ───────────────────────────────────────────────── -- - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- Use an on_attach function to only map the following keys --- after the language server attaches to the current buffer --- ───────────────────────────────────────────────── -- -local on_attach = function(client, bufnr) - - -- lsp support on winbar - local import_navic, navic = pcall(require, "nvim-navic") - if import_navic then - if client.server_capabilities.documentSymbolProvider then - navic.attach(client, bufnr) - end - end - - local function buf_set_keymap(...) api.nvim_buf_set_keymap(bufnr, ...) end - local function buf_set_option(...) api.nvim_buf_set_option(bufnr, ...) end - - --------------------- - -- Avoiding LSP formatting conflicts - -- ref: https://github.com/jose-elias-alvarez/null-ls.nvim/wiki/Avoiding-LSP-formatting-conflicts - -- 2nd red: https://github.com/neovim/nvim-lspconfig/issues/1891#issuecomment-1157964108 - -- neovim 0.8 - client.server_capabilities.documentFormattingProvider = false - client.server_capabilities.documentRangeFormattingProvider = false - -------------------------- - - -- Enable completion triggered by - buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') - - -- Mappings. - local options = {noremap = true, silent = true} - - -- See `:help vim.lsp.*` for documentation on any of the below functions - -- ───────────────────────────────────────────────── -- - buf_set_keymap('n', 'e', 'lua vim.diagnostic.open_float()', options) - buf_set_keymap('n', 'n', 'lua vim.diagnostic.goto_next()', options) - buf_set_keymap('n', 'b', 'lua vim.diagnostic.goto_prev()', options) - - buf_set_keymap('n', 'd', 'lua vim.lsp.buf.definition()', options) - buf_set_keymap('n', 'D', 'lua vim.lsp.buf.declaration()', options) - buf_set_keymap('n', 'T', 'lua vim.lsp.buf.type_definition()', options) - buf_set_keymap('n', 'i', 'lua vim.lsp.buf.implementation()', options) - buf_set_keymap('n', 's', 'lua vim.lsp.buf.signature_help()', options) - buf_set_keymap('n', 'h', 'lua vim.lsp.buf.hover()', options) - buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', options) - -- using 'filipdutescu/renamer.nvim' for rename - -- buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) - buf_set_keymap('n', 'r', 'Telescope lsp_references', options) - buf_set_keymap("n", "f", 'lua vim.lsp.buf.format({ timeout_ms = 2000 })', options) - - buf_set_keymap('n', 'a', 'lua vim.lsp.buf.code_action()', options) - buf_set_keymap('x', 'a', 'lua vim.lsp.buf.range_code_action()', options) - - -- buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workleader_folder()', opts) - -- buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workleader_folder()', opts) - -- buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workleader_folders()))', opts) -end - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local function setup_lsp_config() - - -- options for lsp diagnostic - -- ───────────────────────────────────────────────── -- - vim.diagnostic.config({ - float = { - border = "single", - focusable = true, - style = "minimal", - source = "always", - header = "", - prefix = "", - }, - }) - - handlers["textDocument/publishDiagnostics"] = lsp.with( - lsp.diagnostic.on_publish_diagnostics, - { - underline = true, - signs = true, - update_in_insert = true, - virtual_text = { - true, - spacing = 6, - -- severity_limit='Error' -- Only show virtual text on error - }, - } - ) - - handlers["textDocument/hover"] = lsp.with(handlers.hover, {border = "single"}) - handlers["textDocument/signatureHelp"] = lsp.with(handlers.signature_help, {border = "single"}) - - -- show diagnostic on float window(like auto complete) - -- vim.api.nvim_command [[ autocmd CursorHold *.lua,*.sh,*.bash,*.dart,*.py,*.cpp,*.c,js lua vim.lsp.diagnostic.show_line_diagnostics() ]] - - -- set LSP diagnostic symbols/signs - -- ─────────────────────────────────────────────────-- - api.nvim_command [[ sign define DiagnosticSignError text= texthl=DiagnosticSignError linehl= numhl= ]] - api.nvim_command [[ sign define DiagnosticSignWarn text= texthl=DiagnosticSignWarn linehl= numhl= ]] - api.nvim_command [[ sign define DiagnosticSignInfo text= texthl=DiagnosticSignInfo linehl= numhl= ]] - api.nvim_command [[ sign define DiagnosticSignHint text= texthl=DiagnosticSignHint linehl= numhl= ]] - - api.nvim_command [[ hi DiagnosticUnderlineError cterm=underline gui=underline guisp=#840000 ]] - api.nvim_command [[ hi DiagnosticUnderlineHint cterm=underline gui=underline guisp=#07454b ]] - api.nvim_command [[ hi DiagnosticUnderlineWarn cterm=underline gui=underline guisp=#2f2905 ]] - api.nvim_command [[ hi DiagnosticUnderlineInfo cterm=underline gui=underline guisp=#265478 ]] - - -- Auto-format files prior to saving them - -- vim.api.nvim_command[[autocmd BufWritePre lua vim.lsp.buf.formatting_sync(nil, 1000)]] - - --[[ - " to change colors, it's better to define in color scheme - " highlight LspDiagnosticsUnderlineError guifg=#EB4917 gui=undercurl - " highlight LspDiagnosticsUnderlineWarning guifg=#EBA217 gui=undercurl - " highlight LspDiagnosticsUnderlineInformation guifg=#17D6EB gui=undercurl - " highlight LspDiagnosticsUnderlineHint guifg=#17EB7A gui=undercurl - --]] -end - - --- ───────────────────────────────────────────────── -- --- setup LSPs --- ───────────────────────────────────────────────── -- -local function setup_lsp(mason_lspconfig) - - local tbl_deep_extend = vim.tbl_deep_extend - local capabilities = lsp.protocol.make_client_capabilities() - local lsp_options = { - on_attach = on_attach, - flags = { - debounce_text_changes = 150, - }, - capabilities = capabilities - } - local import_cmp_lsp, cmp_lsp = pcall(require, 'cmp_nvim_lsp') - if import_cmp_lsp then - lsp_options.capabilities = (cmp_lsp).default_capabilities(capabilities) - end - - -- for Flutter and Dart - -- don't put this on setup_handlers to set it because dart LSP is installed and maintained by akinsho/flutter-tools.nvim - lspconfig["dartls"].setup(lsp_options) - - mason_lspconfig.setup_handlers({ - - function (server_name) - require("lspconfig")[server_name].setup(lsp_options) - end, - - ["clangd"] = function () - lspconfig.clangd.setup( - tbl_deep_extend( - "force", lsp_options, - { capabilities = { offsetEncoding = { "utf-16" } } } - ) - ) - end, - ["html"] = function () - lspconfig.html.setup( - tbl_deep_extend( - "force", lsp_options, - { filetypes = {"html", "htmldjango"} } - ) - ) - end, - ["cssls"] = function () - lspconfig.cssls.setup( - tbl_deep_extend( - "force", lsp_options, - { - capabilities = { - textDocument = { completion= { completionItem = { snippetSupport = true } } } - }, - } - ) - ) - end, - ["lua_ls"] = function () - lspconfig.lua_ls.setup( - tbl_deep_extend( - "force", lsp_options, - { - settings = { - Lua = { - diagnostics = { - -- Get the language server to recognize the 'vim', 'use' global - globals = {'vim', 'use', 'require'}, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = api.nvim_get_runtime_file("", true), - -- don't ask about working environment on every startup - checkThirdParty = false, - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = {enable = false}, - }, - } - } - ) - ) - end, - ["rust_analyzer"] = function () - lspconfig.rust_analyzer.setup( - tbl_deep_extend( - "force", lsp_options, - { - settings = { - ["rust-analyzer"] = { - diagnostics = { - enable = true; - }, - checkOnSave = { - enable = true; - } - } - } - } - ) - ) - end, - }) -end - --- make sure `lspconfig` is not loaded after `mason-lspconfig`. --- Also, make sure not to set up any servers via `lspconfig` _before_ calling `mason-lspconfig`'s setup function. - - -local import_mlspconfig, mason_lspconfig = pcall(require, "mason-lspconfig") -if not import_mlspconfig then return end - --- import nvim-lsp-installer configs -local import_mconfig, mconfig = pcall(require, "plugins.mason_nvim") -if not import_mconfig then return end - -mason.setup(mconfig.setup) -- setup mason -setup_lsp_config() -- setup lsp configs (mainly UI) -setup_lsp(mason_lspconfig) -- setup lsp (like pyright, ccls ...) - --- ───────────────────────────────────────────────── -- --- end LSP setup --- ───────────────────────────────────────────────── -- - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/nvim-surround.lua b/lua/plugins/nvim-surround.lua deleted file mode 100644 index 2caacae..0000000 --- a/lua/plugins/nvim-surround.lua +++ /dev/null @@ -1,66 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: nvim-surround --- Github: github.com/kylechui/nvim-surround --- Description: Add/change/delete surrounding delimiter pairs with ease. --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local imported_surround, surround = pcall(require, 'nvim-surround') -if not imported_surround then return end - - -surround.setup({ - keymaps = { -- vim-surround style keymaps - visual = "S", - delete = "ds", - change = "cs", - insert = "s", - -- insert_line = "S", - -- normal = "ys", - -- normal_cur = "yss", - -- normal_line = "yS", - -- normal_cur_line = "ySS", - -- visual_line = "gS", - }, - surrounds = { - ["("] = { add = { "( ", " )" }, }, - [")"] = { add = { "(", ")" }, }, - ["{"] = { add = { "{ ", " }" }, }, - ["}"] = { add = { "{", "}" }, }, - ["<"] = { add = { "< ", " >" }, }, - [">"] = { add = { "<", ">" }, }, - ["["] = { add = { "[ ", " ]" }, }, - ["]"] = { add = { "[", "]" }, }, - ["'"] = { add = { "'", "'" }, }, - ['"'] = { add = { '"', '"' }, }, - ["`"] = { add = { "`", "`" }, }, - }, - aliases = { - ["a"] = ">", -- Single character aliases apply everywhere - ["b"] = ")", - ["B"] = "}", - ["r"] = "]", - -- Table aliases only apply for changes/deletions - ["q"] = { '"', "'", "`" }, -- Any quote character - ["s"] = { ")", "]", "}", ">", "'", '"', "`" }, -- Any surrounding delimiter - }, - highlight= { -- Highlight before inserting/changing surrounds - duration = 0, - }, - move_cursor = "begin", -}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/nvim-tree_lua.lua b/lua/plugins/nvim-tree_lua.lua deleted file mode 100644 index 5a1636a..0000000 --- a/lua/plugins/nvim-tree_lua.lua +++ /dev/null @@ -1,157 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: nvim-tree.lua --- Github: github.com/kyazdani42/nvim-tree.lua --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -vim.api.nvim_set_keymap('n', 'f', ':NvimTreeToggle', {noremap = true, silent = true}) - -local function on_attach(bufnr) - local api = require('nvim-tree.api') - - local function opts(desc) - return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } - end - - - -- Default mappings. Feel free to modify or remove as you wish. - -- - -- BEGIN_DEFAULT_ON_ATTACH - vim.keymap.set('n', '', api.tree.change_root_to_node, opts('CD')) - vim.keymap.set('n', '', api.node.open.replace_tree_buffer, opts('Open: In Place')) - vim.keymap.set('n', '', api.node.show_info_popup, opts('Info')) - vim.keymap.set('n', '', api.fs.rename_sub, opts('Rename: Omit Filename')) - vim.keymap.set('n', '', api.node.open.tab, opts('Open: New Tab')) - vim.keymap.set('n', '', api.node.open.vertical, opts('Open: Vertical Split')) - vim.keymap.set('n', '', api.node.open.horizontal, opts('Open: Horizontal Split')) - vim.keymap.set('n', '', api.node.navigate.parent_close, opts('Close Directory')) - vim.keymap.set('n', '', api.node.open.edit, opts('Open')) - vim.keymap.set('n', '', api.node.open.preview, opts('Open Preview')) - vim.keymap.set('n', '>', api.node.navigate.sibling.next, opts('Next Sibling')) - vim.keymap.set('n', '<', api.node.navigate.sibling.prev, opts('Previous Sibling')) - vim.keymap.set('n', '.', api.node.run.cmd, opts('Run Command')) - vim.keymap.set('n', '-', api.tree.change_root_to_parent, opts('Up')) - vim.keymap.set('n', 'a', api.fs.create, opts('Create')) - vim.keymap.set('n', 'bmv', api.marks.bulk.move, opts('Move Bookmarked')) - vim.keymap.set('n', 'B', api.tree.toggle_no_buffer_filter, opts('Toggle No Buffer')) - vim.keymap.set('n', 'c', api.fs.copy.node, opts('Copy')) - vim.keymap.set('n', 'C', api.tree.toggle_git_clean_filter, opts('Toggle Git Clean')) - vim.keymap.set('n', '[c', api.node.navigate.git.prev, opts('Prev Git')) - vim.keymap.set('n', ']c', api.node.navigate.git.next, opts('Next Git')) - vim.keymap.set('n', 'd', api.fs.remove, opts('Delete')) - vim.keymap.set('n', 'D', api.fs.trash, opts('Trash')) - vim.keymap.set('n', 'E', api.tree.expand_all, opts('Expand All')) - vim.keymap.set('n', 'e', api.fs.rename_basename, opts('Rename: Basename')) - vim.keymap.set('n', ']e', api.node.navigate.diagnostics.next, opts('Next Diagnostic')) - vim.keymap.set('n', '[e', api.node.navigate.diagnostics.prev, opts('Prev Diagnostic')) - vim.keymap.set('n', 'F', api.live_filter.clear, opts('Clean Filter')) - vim.keymap.set('n', 'f', api.live_filter.start, opts('Filter')) - vim.keymap.set('n', 'g?', api.tree.toggle_help, opts('Help')) - vim.keymap.set('n', 'gy', api.fs.copy.absolute_path, opts('Copy Absolute Path')) - vim.keymap.set('n', 'H', api.tree.toggle_hidden_filter, opts('Toggle Dotfiles')) - vim.keymap.set('n', 'I', api.tree.toggle_gitignore_filter, opts('Toggle Git Ignore')) - vim.keymap.set('n', 'J', api.node.navigate.sibling.last, opts('Last Sibling')) - vim.keymap.set('n', 'K', api.node.navigate.sibling.first, opts('First Sibling')) - vim.keymap.set('n', 'm', api.marks.toggle, opts('Toggle Bookmark')) - vim.keymap.set('n', 'o', api.node.open.edit, opts('Open')) - vim.keymap.set('n', 'O', api.node.open.no_window_picker, opts('Open: No Window Picker')) - vim.keymap.set('n', 'p', api.fs.paste, opts('Paste')) - vim.keymap.set('n', 'P', api.node.navigate.parent, opts('Parent Directory')) - vim.keymap.set('n', 'q', api.tree.close, opts('Close')) - vim.keymap.set('n', 'r', api.fs.rename, opts('Rename')) - vim.keymap.set('n', 'R', api.tree.reload, opts('Refresh')) - vim.keymap.set('n', 's', api.node.run.system, opts('Run System')) - vim.keymap.set('n', 'S', api.tree.search_node, opts('Search')) - vim.keymap.set('n', 'U', api.tree.toggle_custom_filter, opts('Toggle Hidden')) - vim.keymap.set('n', 'W', api.tree.collapse_all, opts('Collapse')) - vim.keymap.set('n', 'x', api.fs.cut, opts('Cut')) - vim.keymap.set('n', 'y', api.fs.copy.filename, opts('Copy Name')) - vim.keymap.set('n', 'Y', api.fs.copy.relative_path, opts('Copy Relative Path')) - vim.keymap.set('n', '<2-LeftMouse>', api.node.open.edit, opts('Open')) - vim.keymap.set('n', '<2-RightMouse>', api.tree.change_root_to_node, opts('CD')) - -- END_DEFAULT_ON_ATTACH - - - -- Mappings migrated from view.mappings.list - -- - -- You will need to insert "your code goes here" for any mappings with a custom action_cb - vim.keymap.set('n', 'g?', api.tree.toggle_help, opts('Help')) - -end - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local import_ntree, nvim_tree = pcall(require, "nvim-tree") -if not import_ntree then return end - -local import_treecb, tree_cb = pcall(require, "nvim-tree.config") -if import_treecb then - tree_cb = tree_cb.nvim_tree_callback -end - -local cmd = vim.cmd -- execute Vim commands -cmd('autocmd ColorScheme * highlight highlight NvimTreeBg guibg=None') -cmd('autocmd FileType NvimTree setlocal winhighlight=Normal:NvimTreeBg') - - - --- each of these are documented in `:help nvim-tree.OPTION_NAME` -nvim_tree.setup ({ - - on_attach = on_attach, -- mappings - - disable_netrw = false, - hijack_netrw = false, - -- auto_close = false, - open_on_tab = false, - hijack_cursor = false, - update_cwd = false, - hijack_directories = {enable = true, auto_open = true}, - diagnostics = { - enable = false, - icons = {hint = "", info = "", warning = "", error = ""}, - }, - git = {enable = false}, - update_focused_file = {enable = true, update_cwd = false, ignore_list = {}}, - system_open = {cmd = nil, args = {}}, - filters = {dotfiles = false, custom = {}}, - - renderer = { - indent_markers = { - enable = true, -- show indent markers when folders are open - }, - -- highlight_opened_files = "all", -- Highlight icons and/or names for opened files. Value can be `"none"`, `"icon"`, `"name"` or `"all"`. - }, - - view = { - width = 25, - hide_root_folder = false, - side = 'left', - signcolumn = "no", - -- auto_resize = true, - - }, -}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- diff --git a/lua/plugins/nvim-treesitter.lua b/lua/plugins/nvim-treesitter.lua deleted file mode 100644 index cc02f96..0000000 --- a/lua/plugins/nvim-treesitter.lua +++ /dev/null @@ -1,93 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: nvim-treesitter --- Github: github.com/nvim-treesitter/nvim-treesitter --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- safely import tree-sitter -local treesitter_imported_ok, treesitter = pcall(require, 'nvim-treesitter.configs') -if not treesitter_imported_ok then return end - - -local register = vim.treesitter.language.register -register('html', 'htmldjango') -- enable html parser in htmldjango file -register('bash', 'zsh') -- enable bash parser in zsh file - - -treesitter.setup { - modules = {}, -- this option is not mentioned in doc. i am providing it to hide warning emmiting when editing this config - ensure_installed = {}, -- A list of parser names, or "all" (the five listed parsers should always be installed) - sync_install = false, -- Install parsers synchronously (only applied to `ensure_installed`) - auto_install = false, -- Automatically install missing parsers when entering buffer. Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - ignore_install = {}, -- List of parsers to ignore installing (or "all") - - -- Indentation based on treesitter for the = operator. NOTE: This is an experimental feature. - indent = { - enable = true - }, - - highlight = { - enable = true, -- {"c", "cpp", "dart", "python", "javascript"}, enable = true (false will disable the whole extension) - -- disable lighlight if file is too long - disable = function() -- Disable in large C++ buffers - -- disable highlight if file has > 6000 LOC - return vim.api.nvim_buf_line_count(0) > 6000 - -- return lang == "cpp" and vim.api.nvim_buf_line_count(bufnr) > 50000 - end, - -- disable = { "c", "rust" }, -- list of language that will be disabled - custom_captures = { - -- Highlight the @foo.bar capture group with the "Identifier" highlight group. - ["foo.bar"] = "Identifier", - }, - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = true, - }, - - playground = { - enable = true, - disable = {}, - updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code - persist_queries = false, -- Whether the query persists across vim sessions - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -- keybindings = { - -- toggle_query_editor = 'o', - -- toggle_hl_groups = 'i', - -- toggle_injected_languages = 't', - -- toggle_anonymous_nodes = 'a', - -- toggle_language_display = 'I', - -- focus_language = 'f', - -- unfocus_language = 'F', - -- update = 'R', - -- goto_node = '', - -- show_help = '?' - -- } - }, -} - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/nvim-ts-autotag.lua b/lua/plugins/nvim-ts-autotag.lua deleted file mode 100644 index 2c64f56..0000000 --- a/lua/plugins/nvim-ts-autotag.lua +++ /dev/null @@ -1,48 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: nvim-ts-autotag --- Github: github.com/windwp/nvim-ts-autotag --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local import_tag, autotag = pcall(require, "nvim-ts-autotag") -if not import_tag then return end - -autotag.setup({ - - autotag = { - enable = true, - }, - - filetypes = { - 'html', 'htmldjango', - 'javascript', 'javascriptreact', 'jsx', - 'typescript', 'typescriptreact', 'tsx', - 'rescript', - 'svelte', - 'vue', - 'xml', - 'php', - 'markdown', - 'glimmer','handlebars','hbs' - }, - - skip_tags = { - 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'slot', - 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr', 'menuitem' - } -}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/nvim-ts-context-commentstring.lua b/lua/plugins/nvim-ts-context-commentstring.lua deleted file mode 100644 index fdfba95..0000000 --- a/lua/plugins/nvim-ts-context-commentstring.lua +++ /dev/null @@ -1,78 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: nvim-ts-context-commentstring --- Github: github.com/JoosepAlviste/nvim-ts-context-commentstring --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- safely import tree-sitter -local treesitter_imported_ok, treesitter = pcall(require, 'nvim-treesitter.configs') -if not treesitter_imported_ok then return end - -treesitter.setup { - context_commentstring = { - enable = true, - enable_autocmd = false, - - config = { - javascript = { - __default = '// %s', - jsx_element = '{/* %s */}', - jsx_fragment = '{/* %s */}', - jsx_attribute = '// %s', - comment = '// %s', - __parent = { - -- if a node has this as the parent, use the `//` commentstring - jsx_expression = '// %s', - }, - }, - css = '// %s', - } - }, -} - --- safely import Comment -local comment_imported_ok, comment = pcall(require, 'Comment') -if not comment_imported_ok then return end - -comment.setup({ - - -- Integration of nvim-ts-context-commentstring to numToStr/Comment.nvim - ---Pre-hook, called before commenting the line - -- NOTE: Comment.nvim already supports treesitter out-of-the-box except for tsx/jsx. - pre_hook = function(ctx) - -- Only calculate commentstring for jsx/tsx filetypes - local filetype = vim.bo.filetype - if filetype == 'typescriptreact' or filetype == "javascriptreact" then - local import_U, U = pcall(require, 'Comment.utils') - if not import_U then return end - -- Determine whether to use linewise or blockwise commentstring - local type = ctx.ctype == U.ctype.linewise and '__default' or '__multiline' - -- Determine the location where to calculate commentstring from - local location = nil - if ctx.ctype == U.ctype.blockwise then - location = require('ts_context_commentstring.utils').get_cursor_location() - elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then - location = require('ts_context_commentstring.utils').get_visual_start_location() - end - return require('ts_context_commentstring.internal').calculate_commentstring({ - key = type, - location = location, - }) - end - end, -}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/nvim-web-devicons.lua b/lua/plugins/nvim-web-devicons.lua deleted file mode 100644 index 0818116..0000000 --- a/lua/plugins/nvim-web-devicons.lua +++ /dev/null @@ -1,26 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: nvim-web-devicons --- Github: github.com/kyazdani42/nvim-web-devicons --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local import_icons, icons = pcall(require, "nvim-web-devicons") -if not import_icons then return end - --- Get all icons -icons.get_icons() - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/nvim_navic.lua b/lua/plugins/nvim_navic.lua deleted file mode 100644 index 8a2c433..0000000 --- a/lua/plugins/nvim_navic.lua +++ /dev/null @@ -1,229 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: nvim-navic --- Github: github.com/SmiteshP/nvim-navic --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local import_navic, navic = pcall(require, "nvim-navic") -if not import_navic then return end - - -navic.setup({ - highlight = true, - separator = " ", - depth_limit = 0, - depth_limit_indicator = "..", - - icons = { - File = " ", - Module = " ", - Namespace = " ", - Package = " ", - Class = " ", - Method = " ", - Property = " ", - Field = " ", - Constructor = " ", - Enum = " ", - Interface = " ", - Function = " ", - Variable = " ", - Constant = " ", - String = " ", - Number = " ", - Boolean = " ", - Array = " ", - Object = " ", - Key = " ", - Null = " ", - EnumMember = " ", - Struct = " ", - Event = " ", - Operator = " ", - TypeParameter = " ", - }, -}) - - -local function set_highlight(group, fg, bg, style) - local options = { fg=fg, bg=bg } - if style ~= nil then - local italic, bold = false, false - if style == 'italic' then italic = true end - if style == 'bold' then bold = true end - options = { fg=fg, bg=bg, italic=italic, bold=bold } - end - vim.api.nvim_set_hl(0, group, options) -end - - -local function init_highlight() - set_highlight("NavicFileName", "#acacac", "#080808") - set_highlight("NavicSeparator", "#51578f", "#080808", "italic") - set_highlight("NavicText", "#666666", "#080808", "italic") - - set_highlight("NavicIconsArray", "#8b1540", "#080808", "italic") - set_highlight("NavicIconsBoolean", "#015c8a", "#080808", "italic") - set_highlight("NavicIconsClass", "#8d5c18", "#080808", "italic") - set_highlight("NavicIconsConstant", "#FFFADE", "#080808", "italic") - set_highlight("NavicIconsConstructor", "#015e8c", "#080808", "italic") - set_highlight("NavicIconsEnum", "#168888", "#080808", "italic") - set_highlight("NavicIconsEnumMember", "#0c494a", "#080808", "italic") - set_highlight("NavicIconsEvent", "#8f476b", "#080808", "italic") - set_highlight("NavicIconsField", "#038286", "#080808", "italic") - -- set_highlight("NavicIconsFile", "#666666", "#080808", "italic") - set_highlight("NavicIconsFunction", "#722587", "#080808", "italic") - set_highlight("NavicIconsInterface", "#8b2c27", "#080808", "italic") - set_highlight("NavicIconsKey", "#8a0015", "#080808", "italic") - set_highlight("NavicIconsMethod", "#73538c", "#080808", "italic") - set_highlight("NavicIconsModule", "#8d7138", "#080808", "italic") - set_highlight("NavicIconsNamespace", "#FFFFFF", "#080808", "italic") - set_highlight("NavicIconsNull", "#8c0015", "#080808", "italic") - set_highlight("NavicIconsNumber", "#8a6e37", "#080808", "italic") - set_highlight("NavicIconsObject", "#8d008d", "#080808", "italic") - set_highlight("NavicIconsOperator", "#8b1540", "#080808", "italic") - set_highlight("NavicIconsPackage", "#005a83", "#080808", "italic") - set_highlight("NavicIconsProperty", "#008f6b", "#080808", "italic") - set_highlight("NavicIconsString", "#8a3c24", "#080808", "italic") - set_highlight("NavicIconsStruct", "#8c1717", "#080808", "italic") - set_highlight("NavicIconsTypeParameter","#4d748f", "#080808", "italic") - set_highlight("NavicIconsVariable", "#008470", "#080808", "italic") -end - -local function filetype_exclude(filetype) - -- disable winbar in these filetypes - local filetype_to_exclude = { - "", - "alpha", - "dap-repl", - "dap-terminal", - "dapui_breakpoints", - "dapui_console", - "dapui_scopes", - "dapui_stacks", - "dapui_watches", - "dashboard", - "DressingSelect", - "harpoon", - "help", - "Jaq", - "lab", - "lir", - "Markdown", - "mason", - "neo-tree", - "neogitstatus", - "notify", - "NvimTree", - "Outline", - "packer", - "spectre_panel", - "startify", - "TelescopePrompt", - "toggleterm", - "Trouble", - } - if vim.tbl_contains(filetype_to_exclude, filetype) then - return true - end - return false -end - - -local function get_filetype_icon() - local import_devicons, devicons = pcall(require, 'nvim-web-devicons') - if not import_devicons then - return false - end - local file_name = vim.fn.expand('%:t') - local ext = vim.fn.expand "%:e" - local icon, icon_color = devicons.get_icon_color(file_name, ext, { default = true }) - - return { - icon = icon, - icon_color = icon_color - } -end - - -local function winbar() - if filetype_exclude(vim.bo.filetype) then - return - end - local filename = vim.fn.expand "%:t" - local file = "" - local winbar_data = "" - - if filename ~= "" or filename ~= nil then - local dev_icon = get_filetype_icon() - if dev_icon then - local icon = dev_icon.icon - local icon_color = dev_icon.icon_color - if icon == "" or icon == nil then - icon = " " - end - set_highlight("NavicFileIcon", icon_color, "#080808") - file = " " .. "%#NavicFileIcon#" .. icon .. "%*" .. " " .. "%#NavicFileName#" .. filename .. "%*" - end - - -- show modified flag/icon if file is being modified and not saved - if vim.bo.modified then - file = file .. "%#NavicFileName#" .. "" .. "%*" - end - winbar_data = file - - if navic.is_available() then - local status_getlocation, navic_location = pcall(navic.get_location, {}) - if not status_getlocation then - goto continue_winbar - end - if navic_location == "error" then - goto continue_winbar - end - if not (navic_location == "" or navic_location == nil ) then - -- winbar_data = "%#NavicSeparator#"..">" .. "%*" .. " " .. navic_location - winbar_data = " " .. navic_location - else - goto continue_winbar - end - winbar_data = file .. winbar_data - end - end - - ::continue_winbar:: - local status_setwinbar, _ = pcall(vim.api.nvim_set_option_value, "winbar", winbar_data, { scope = "local" }) - if not status_setwinbar then - return - end -end - - -init_highlight() - -vim.api.nvim_create_autocmd( - { "BufFilePost", "BufWinEnter", "BufWritePost", "CursorHold", "CursorMoved", "InsertEnter", "TabClosed" }, - { - desc = "don't load winbar for certain filetypes and buffers", - pattern = "*", - group = vim.api.nvim_create_augroup("AbstractWinbarAutoGroup", {clear=true}), - - callback = function() - winbar() - end, - } -) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/penvim.lua b/lua/plugins/penvim.lua deleted file mode 100644 index 576bed5..0000000 --- a/lua/plugins/penvim.lua +++ /dev/null @@ -1,48 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: penvim --- Github: github.com/shaeinst/penvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local imported_penvim, penvim = pcall(require, "penvim") -if not imported_penvim then return end - -penvim.setup({ - - project_env = { - enable = true, - config_name = '.__nvim__.lua' - }, - - rooter = { - enable = true, - patterns = {'.__nvim__.lua'}, - - }, - - indentor = { - enable = true, - indent_length = 4, - indent_type = "auto", -- auto|tab|space - }, - - -- langs = { - -- enable = true, - -- } - -}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/renamer_nvim.lua b/lua/plugins/renamer_nvim.lua deleted file mode 100644 index 7b69777..0000000 --- a/lua/plugins/renamer_nvim.lua +++ /dev/null @@ -1,78 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: renamer.nvim --- Github: github.com/filipdutescu/renamer.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local imported_renamer, renamer = pcall(require, 'renamer') -if not imported_renamer then return end - -local mappings_utils = require('renamer.mappings.utils') - -renamer.setup { - -- The popup title, shown if `border` is true - title = 'Rename', - -- The padding around the popup content - padding = { top = 0, left = 0, bottom = 0, right = 0, }, - -- The minimum width of the popup - min_width = 15, - -- The maximum width of the popup - max_width = 45, - -- Whether or not to shown a border around the popup - border = true, - -- The characters which make up the border - border_chars = { '─', '│', '─', '│', '╭', '╮', '╯', '╰' }, - -- Whether or not to highlight the current word references through LSP - show_refs = true, - -- Whether or not to add resulting changes to the quickfix list - with_qf_list = true, - -- Whether or not to enter the new name through the UI or Neovim's `input` prompt - with_popup = true, - -- The keymaps available while in the `renamer` buffer. The example below - -- overrides the default values, but you can add others as well. - -- Custom handler to be run after successfully renaming the word. Receives - -- the LSP 'textDocument/rename' raw response as its parameter. - handler = nil, - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -- mappings for renamer popup window - mappings = { - [''] = mappings_utils.set_cursor_to_start, - [''] = mappings_utils.set_cursor_to_end, - [''] = mappings_utils.set_cursor_to_word_end, - [''] = mappings_utils.set_cursor_to_word_start, - [''] = mappings_utils.clear_line, - [''] = mappings_utils.undo, - [''] = mappings_utils.redo, - }, -} - --- to rename -local options = {noremap = true, silent = true} -local keymap = vim.api.nvim_set_keymap -keymap('n', 'R', 'lua require("renamer").rename()', options) -keymap('v', 'R', 'lua require("renamer").rename()', options) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/rooter_nvim.lua b/lua/plugins/rooter_nvim.lua deleted file mode 100644 index a9f26e9..0000000 --- a/lua/plugins/rooter_nvim.lua +++ /dev/null @@ -1,39 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: rooter.nvim --- Github: github.com/ygm2/rooter.nvim --- ───────────────────────────────────────────────── -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- List of patterns(file or folder) which describes a directory as project root li -vim.g.rooter_pattern = { - '.__abstract__', - '.__Abstract__', - '.__nvim__.lua', - '.__project__', - '.git', - 'Makefile', - '_darcs', - '.hg', - '.bzr', - '.svn', - 'node_modules', - 'CMakeLists.txt', -} - --- Whether to change directory to outermost root directory or not -vim.g.outermost_root = false - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/staline_nvim.lua b/lua/plugins/staline_nvim.lua deleted file mode 100644 index e5c3cd1..0000000 --- a/lua/plugins/staline_nvim.lua +++ /dev/null @@ -1,46 +0,0 @@ - - -- Lsp server name . -function lspservername() - local msg = '' - local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then return msg end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return "LSP[" .. client.name .. "]" - end - end - return msg -end - - - - - - -require('staline').setup { - defaults = { - left_separator = "", - right_separator = "", - line_column = "[%l:%c /%L] 並%p%%", -- `:h stl` to see all flags. - fg = "#000000", -- Foreground text color. - bg = "#031118", -- Default background is transparent. - cool_symbol = " ", -- Change this to override defult OS icon. - full_path = false, - filename_section = '%{luaeval("lspservername()")}', - - }, - mode_colors = { - n = "#25B2BC", - i = "#859f96", - c = "#e27d60", - v = "#4799eb", - }, - mode_icons = { - n = " ", - i = " ", - c = " ", - v = " ", - }, -} diff --git a/lua/plugins/surround_nvim.lua b/lua/plugins/surround_nvim.lua deleted file mode 100644 index 02252b1..0000000 --- a/lua/plugins/surround_nvim.lua +++ /dev/null @@ -1,33 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: surround.nvim --- Github: github.com/blackcauldron7/surround.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/telescope_nvim.lua b/lua/plugins/telescope_nvim.lua deleted file mode 100644 index 68a43b4..0000000 --- a/lua/plugins/telescope_nvim.lua +++ /dev/null @@ -1,192 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- PluginName: telescope.nvim --- Github: github.com/nvim-telescope/telescope.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- safely import telescope -local import_telescope, telescope = pcall(require, 'telescope') -if not import_telescope then return end - -telescope.setup { - - defaults = { - vimgrep_arguments = { - 'rg', - '--color=never', - '--no-heading', - '--with-filename', - '--line-number', - '--column', - '--smart-case', - }, - - initial_mode = "insert", - selection_strategy = "reset", - sorting_strategy = "ascending", - layout_strategy = "horizontal", - layout_config = { - horizontal = { - mirror = false, - prompt_position = "top", - preview_width = 0.4, - }, - vertical = { mirror = false, }, - width = 0.8, - height = 0.9, - preview_cutoff = 80, - }, - file_ignore_patterns = { - "__pycache__/", "__pycache__/*", - - "build/", "gradle/", "node_modules/", "node_modules/*", "obj/Debug", - "smalljre_*/*", "target/", "vendor/*", "bin/Debug", "venv/", - - ".dart_tool/", ".git/", ".github/", ".gradle/",".idea/", ".vscode/", - - "%.sqlite3", "%.ipynb", "%.lock", "%.pdb", "%.so", - "%.dll", "%.class", "%.exe", "%.cache", "%.pdf", "%.dylib", - "%.jar", "%.docx", "%.met", "%.burp", "%.mp4", "%.mkv", "%.rar", - "%.zip", "%.7z", "%.tar", "%.bz2", "%.epub", "%.flac", "%.tar.gz", - }, - - file_sorter = require'telescope.sorters'.get_fuzzy_file, - generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter, - file_previewer = require'telescope.previewers'.vim_buffer_cat.new, - grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new, - qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new, - - prompt_prefix = "🔎 ", - selection_caret = "➤ ", - entry_prefix = " ", - winblend = 0, - border = {}, - borderchars = {'─', '│', '─', '│', '┌', '┐', '┘', '└'}, -- │ ─ ╭ ╮ ╰ ╯ - color_devicons = true, - use_less = true, - set_env = {['COLORTERM'] = 'truecolor'}, -- default = nil, - path_display = {'truncate'}, -- How file paths are displayed () - - preview = { - msg_bg_fillchar = " ", - treesitter = false, - }, - - live_grep = { - preview = { - treesitter = false - } - }, - - -- Developer configurations: Not meant for general override - buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker, - }, - - extensions = { - - fzf = { - fuzzy = true, -- false will only do exact matching - override_generic_sorter = true, -- override the generic sorter - override_file_sorter = true, -- override the file sorter - case_mode = "smart_case", -- or "ignore_case" or "respect_case". the default case_mode is "smart_case" - }, - - media_files = { - -- filetypes whitelist - filetypes = {"png", "jpg", "mp4", "webm", "pdf"}, - find_cmd = "fd" -- find command (defaults to `fd`) - }, - - file_browser = { - theme = "ivy", - -- disables netrw and use telescope-file-browser in its place - hijack_netrw = true, - }, - - ["ui-select"] = { - require("telescope.themes").get_dropdown { - winblend = 15, - layout_config = { - prompt_position = "top", - width = 64, - height = 15, - }, - border = {}, - previewer = false, - shorten_path = false, - }, - } - - }, - -} --- To get telescope-extension loaded and working with telescope, --- you need to call load_extension, somewhere after setup function: -telescope.load_extension('fzf') -telescope.load_extension('file_browser') -telescope.load_extension('media_files') -telescope.load_extension("ui-select") - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local keymap = vim.api.nvim_set_keymap -local options = { silent = true, noremap = true } - --- --> Launch Telescope without any argument -keymap('n', "tt", "lua require('telescope.builtin').builtin() ", options) - --- --> Lists available Commands -keymap('n', "tc", "lua require('telescope.builtin').commands() ", options) - --- --> Lists available help tags and opens a new window with the relevant help info on -keymap('n', "th", "lua require('telescope.builtin').help_tags() ", options) - --- --> show all availabe MAPPING -keymap('n', "tm", "lua require('telescope.builtin').keymaps() ", options) - --- --> show buffers/opened files -keymap('n', "", "lua require('telescope.builtin').buffers() ", options) -keymap('n', "tb", "lua require('telescope.builtin').buffers() ", options) - --- --> show and grep current buffer -keymap('n', "tw", "lua require('telescope.builtin').current_buffer_fuzzy_find() ", options) -keymap('n', "tg", "lua require('telescope.builtin').live_grep() ", options) - --- --> Find Files --- NOTE1: to get project root's directory, https://github.com/Abstract-IDE/penvim plugin is used. --- any config related to project root is in seperate config file (lua/plugin_confs/penvim.lua) --- to change settings related to working directory, refer to penvim.lua config file - --- Find files from current file's project -keymap('n', "", ":Telescope find_files ", options) -keymap('n', "tp", ":Telescope find_files ", options) --- show all files from current working directory -keymap('n', "", "lua require('telescope.builtin').find_files( { cwd = vim.fn.expand('%:p:h') }) ", options) -keymap('n', "tf", "lua require('telescope.builtin').find_files( { cwd = vim.fn.expand('%:p:h') }) ", options) - --- --> show symbols (@nvim-telescope/telescope-symbols.nvim) -keymap('n', "ts", "lua require('telescope.builtin').symbols{ sources = {'emoji', 'kaomoji', 'gitmoji'} } ", options) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/trouble_nvim.lua b/lua/plugins/trouble_nvim.lua deleted file mode 100644 index 9ff3a4d..0000000 --- a/lua/plugins/trouble_nvim.lua +++ /dev/null @@ -1,104 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: trouble.nvim --- Github: github.com/folke/trouble.nvim --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local import_trouble, trouble = pcall(require, "trouble") -if not import_trouble then return end - -trouble.setup { - position = "bottom", -- position of the list can be: bottom, top, left, right - height = 7, -- height of the trouble list when position is top or bottom - width = 50, -- width of the list when position is left or right - icons = true, -- use devicons for filenames - mode = "workspace_diagnostics", -- lsp_document_diagnostics", "quickfix", "lsp_references", "loclist" - fold_open = "", -- icon used for open folds - fold_closed = "", -- icon used for closed folds - - indent_lines = true, -- add an indent guide below the fold icons - auto_open = false, -- automatically open the list when you have diagnostics - auto_close = true, -- automatically close the list when you have no diagnostics - auto_preview = false, -- automatyically preview the location of the diagnostic. to close preview and go back to last window - auto_fold = false, -- automatically fold a file trouble list at creation - signs = { - -- icons / text used for a diagnostic - error = "", - warning = "", - hint = "", - information = "", - other = "﫠", - }, - use_lsp_diagnostic_signs = false, -- enabling this will use the signs defined in your lsp client - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - action_keys = { -- key mappings for actions in the trouble list - -- map to {} to remove a mapping, for example: - -- close = {}, - close = "q", -- close the list - cancel = "", -- cancel the preview and get back to your last window / buffer / cursor - refresh = "r", -- manually refresh - jump = {"", ""}, -- jump to the diagnostic or open / close folds - open_split = {""}, -- open buffer in new split - open_vsplit = {""}, -- open buffer in new vsplit - open_tab = {""}, -- open buffer in new tab - jump_close = {"o"}, -- jump to the diagnostic and close the list - toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode - toggle_preview = "P", -- toggle auto_preview - hover = "K", -- opens a small poup with the full multiline message - preview = "p", -- preview the diagnostic location - close_folds = {"zM", "zm"}, -- close all folds - open_folds = {"zR", "zr"}, -- open all folds - toggle_fold = {"zA", "za"}, -- toggle fold of current file - previous = "k", -- preview item - next = "j", -- next item - }, -} - -local keymap = vim.api.nvim_set_keymap -local opts = {silent = true, noremap = true} - -keymap("n", "t", "TroubleToggle", opts) - ---[===[ -keymap("n", "xw", "Trouble lsp_workspace_diagnostics", - {silent = true, noremap = true} -) -keymap("n", "xd", "Trouble lsp_document_diagnostics", - {silent = true, noremap = true} -) -keymap("n", "xl", "Trouble loclist", - {silent = true, noremap = true} -) -keymap("n", "xq", "Trouble quickfix", - {silent = true, noremap = true} -) -keymap("n", "gR", "Trouble lsp_references", - {silent = true, noremap = true} -) ---]===] - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/vim-floaterm.lua b/lua/plugins/vim-floaterm.lua deleted file mode 100644 index 047ba42..0000000 --- a/lua/plugins/vim-floaterm.lua +++ /dev/null @@ -1,97 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: vim-floaterm --- Github: github.com/voldikss/vim-floaterm --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- Set floating window border line color to cyan, and background to orange -vim.cmd("hi FloatermBorder guibg=none guifg=grey") --- Set floaterm window's background to black -vim.cmd("hi Floaterm guibg=black") --- Set floaterm window background to gray once the cursor moves out from it -vim.cmd("hi FloatermNC guibg=gray") - --- Show floaterm info(e.g., 'floaterm: 1/3' implies there are 3 floaterms in total --- and the current is the first one) at the top left corner of floaterm window. -vim.g.floaterm_title = 'Terminal: $1/$2' - --- Set it to 'split' or 'vsplit' if you don't want to use floating or popup window. -vim.g.floaterm_wintype = 'float' --- don't auto close terminal (useful when you try to compile/run code) -vim.g.floaterm_autoclose = 0 - --- Type Number (number of columns) or Float (between 0 and 1). If Float, the width is relative to &columns. -vim.g.floaterm_width = 0.6 --- Type Number (number of lines) or Float (between 0 and 1). If Float, the height is relative to &lines. -vim.g.floaterm_height = 0.7 - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local keymap = vim.api.nvim_set_keymap -local options = { noremap=true, silent=true } - --- use this (global, g) if you want your keymap works on any view(normal, insert, ...) -vim.g.floaterm_keymap_toggle = '' -- toggle open/close floaterm --- vim.g.floaterm_keymap_prev = 'tk' -- go to previous floaterm window --- vim.g.floaterm_keymap_next = 'tj' -- go to next floaterm window --- vim.g.floaterm_keymap_new = 'tn' -- create new terminal --- vim.g.floaterm_keymap_kill = 'tq' -- quit current terminal - --- go to previous floaterm window -keymap('n', 'tk', ':FloatermPrev', options) --- go to next floaterm window -keymap('n', 'tj', ':FloatermNext', options) --- create new floaterm window -keymap('n', 'tn', ':FloatermNew', options) --- exit floaterm window -keymap('n', 'tq', ':FloatermKill', options) - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━❰ Build and Run ❱━━━━━━━━━━━━━━━━━ -- - --- compile, run or compile and run program. --- it depends on python script, https://github.com/shaeinst/lazy-builder. visit to know more. - -local lazy_builder_py = "~/.local/share/nvim/custom_tools/lazy-builder/build.py" -local build_path = "~/.cache/build_files" -local buffer_num = vim.api.nvim_get_current_buf() -- current buffer -local filename = vim.api.nvim_buf_get_name(buffer_num) -- current filename with full location --- local filename_with_dir = vim.fn.expand('%:p') --- local filename_dir= vim.fn.expand('%:p:h') - -local run = ":w | :FloatermNew python " .. lazy_builder_py .. " -o " .. build_path .. " -r 1 " .. filename .. " " -local build = ":w | :FloatermNew time python " .. lazy_builder_py .. " -o " .. build_path .. " -b 1 " .. filename .. " " -local buildrun = ":w | :FloatermNew time python " .. lazy_builder_py .. " -o " .. build_path .. " -br 1 " .. filename .. " " - -keymap('n', 'r', run, {noremap = true, silent = true}) -- Run -keymap('n', 'o', build, {noremap = true, silent = true}) -- build -keymap('n', 'O', buildrun, {noremap = true, silent = true}) -- build and run - --- ━━━━━━━━━━━━━━━━❰ end Build/Run ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/vim-maximizer.lua b/lua/plugins/vim-maximizer.lua deleted file mode 100644 index 2b605f9..0000000 --- a/lua/plugins/vim-maximizer.lua +++ /dev/null @@ -1,37 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: vim-maximizer --- Github: github.com/szw/vim-maximizer --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - --- "Whether Maximizer should set default mappings or not: -vim.g.maximizer_set_default_mapping = 0 - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -vim.api.nvim_set_keymap('n', 'm', ':MaximizerToggle ', - {silent = true, noremap = true}) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/vim_commentary.lua b/lua/plugins/vim_commentary.lua deleted file mode 100644 index 31c33a5..0000000 --- a/lua/plugins/vim_commentary.lua +++ /dev/null @@ -1,26 +0,0 @@ --- -------------------------------------------------------------------- --- tpope/vim-commentary --- -------------------------------------------------------------------- - -local keymap = vim.api.nvim_set_keymap - - --- for custom file support -vim.cmd([[ autocmd FileType kivy setlocal commentstring=#\ %s ]]) - --- Visual mode -keymap('x', 'cm', "Commentary", {silent=true}) --- Normal mode -keymap('n', 'cm', "Commentary", {silent=true}) --- Operator pending mode (this lets you do e.g. `dmc` to delete a block of comments) -keymap('o', 'cm', "Commentary", {silent=true}) - --- Normal mode, current line -keymap('n', 'cmc', "CommentaryLine", {silent=true}) - --- Special case cgc (you can skip this one, but then `cmc` will also delete an extra blank line) --- nmap cmc ChangeCommentary --- --------------------------------------------------------------------- --- end of tpope/vim-commentary --- -------------------------------------------------------------------- - diff --git a/lua/plugins/vim_rooter.lua b/lua/plugins/vim_rooter.lua deleted file mode 100644 index d2abcdf..0000000 --- a/lua/plugins/vim_rooter.lua +++ /dev/null @@ -1,71 +0,0 @@ --- -------------------------------------------------------------------- --- PluginName: vim-rooter --- Github: github.com/airblade/vim-rooter --- -------------------------------------------------------------------- - --- HELP NOTE --> --- Using root-finding functionality in other scripts The public function FindRootDirectory() --- returns the absolute path to the root directory as a string, --- if a root directory is found, or an empty string otherwise. - - - --- -------------------------------------------------------------------- --- CONFIGS --- -------------------------------------------------------------------- --- How to identify a root directory --- Set g:rooter_patterns to a list of identifiers. They are checked breadth-first as --- Rooter walks up the directory tree and the first match is used. - --- To specify the root has a certain directory or file (which may be a glob), just give the name: -vim.cmd([[ let g:rooter_patterns = ['.git', 'Makefile', '*.sln', 'build/env.sh'] ]]) --- To specify the root is a certain directory, prefix it with =. --- let g:rooter_patterns = ['=src'] --- To specify the root has a certain directory as an ancestor (useful for excluding directories), prefix it with ^: --- let g:rooter_patterns = ['^fixtures'] --- To specify the root has a certain directory as its direct ancestor / parent (useful when you put working projects in a common directory), prefix it with >: --- let g:rooter_patterns = ['>Latex'] --- To exclude a pattern, prefix it with !. --- let g:rooter_patterns = ['!.git/worktrees', '!=extras', '!^fixtures', '!build/env.sh'] - --- By default vim-rooter uses :cd to change directory. To use :lcd or :tcd instead: --- let g:rooter_cd_cmd = 'lcd' - --- To stop Rooter echoing the project directory: -vim.g.rooter_silent_chdir = 1 - --- By default Rooter doesn't resolve symbolic links in the file or directory which triggers it. To do so: --- let g:rooter_resolve_links = 1 - - - --- --Which buffers trigger Rooter-- --- By default all files and directories trigger Rooter. Configure a comma separated list of --- patterns to specify which files trigger. Include / to trigger on directories. For example: --- Everything (default) --> let g:rooter_targets = '/,*' --- All files --> let g:rooter_targets = '*' --- YAML files --> let g:rooter_targets = '*.yml,*.yaml' --- Directories and YAML files --> let g:rooter_targets = '/,*.yml,*.yaml' --- let g:rooter_targets = '$HOME/.config/nvim/configs, ~/codeDNA/dev, $HOME/codeDNA/LearnTeach_Code' - --- --Non-project files-- --- Don't change directory (default). --> let g:rooter_change_directory_for_non_project_files = '' --- Change to file's directory (similar to autochdir). --> let g:rooter_change_directory_for_non_project_files = 'current' --- Change to home directory. --> let g:rooter_change_directory_for_non_project_files = 'home' - --- -------------------------------------------------------------------- --- end of CONFIGS --- -------------------------------------------------------------------- - - - - - --- -------------------------------------------------------------------- --- MAPPINGS --- -------------------------------------------------------------------- - --- -------------------------------------------------------------------- --- enf of MAPPINGS --- -------------------------------------------------------------------- - diff --git a/lua/plugins/vim_surround.lua b/lua/plugins/vim_surround.lua deleted file mode 100644 index eba0129..0000000 --- a/lua/plugins/vim_surround.lua +++ /dev/null @@ -1,5 +0,0 @@ ---------------------------------------------------------------------- --- PluginName: vim-surround - -- Github: github.com/tpope/vim-surround - ---------------------------------------------------------------------- diff --git a/lua/plugins/vimspector.lua b/lua/plugins/vimspector.lua deleted file mode 100644 index e2bb90d..0000000 --- a/lua/plugins/vimspector.lua +++ /dev/null @@ -1,46 +0,0 @@ - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ───────────────────────────────────────────────── -- --- Plugin: vimspector --- Github: github.com/puremourning/vimspector --- ───────────────────────────────────────────────── -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local g = vim.g - -g.vimspector_enable_mappings = 'HUMAN' - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - - - - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - -local keymap = vim.api.nvim_set_keymap -local options = {noremap = true, silent = true} --- local cmd = vim.cmd --- cmd([[ autocmd BufEnter * nmap silent q :bd ]]) - -keymap('n', 'dd', ':call vimspector#Launch()', options) -keymap('n', 'dr', ':VimspectorReset', options) -keymap('n', 'de', ':VimspectorEval ', options) -keymap('n', 'dw', ':VimspectorWatch ', options) -keymap('n', 'do', ':VimspectorShowOutput', options) - --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━ -- --- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- - diff --git a/lua/plugins/vsnip.lua b/lua/plugins/vsnip.lua deleted file mode 100644 index 618b9ac..0000000 --- a/lua/plugins/vsnip.lua +++ /dev/null @@ -1,68 +0,0 @@ ---"--------------------------------------------------------------------- ---" PluginName: vim-vsnip ---" Github: github.com/hrsh7th/vim-vsnip --- ---"--------------------------------------------------------------------- - - - - ---"--------------------------------------------------------------------- ---" CONFIGS ---"--------------------------------------------------------------------- ---" location to store vsnip files -vim.g.vsnip_snippet_dir = vim.fn.expand('~/.config/nvim/extra/snippets/vsnip') - --- How to use LSP snippet? -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities.textDocument.completion.completionItem.snippetSupport = true -capabilities.textDocument.completion.completionItem.resolveSupport = { - properties = { - 'documentation', - 'detail', - 'additionalTextEdits', - } -} - -require'lspconfig'.rust_analyzer.setup { - capabilities = capabilities, -} ---------------------------------------------------------------------- --- end of CONFIGS ---------------------------------------------------------------------- - - - - - ------------------------------------------------------------------------ --- MAPPINGS ------------------------------------------------------------------------ - ---[[ --- we difine moving in lua/plugin_configs/compe.lua file because vicompie and --- vsnip could conflict or override one another's mappig so we defined Mapping --- smartly so that it will work for both without any unexpected result - --- pmenu and vim-vsnip -local keymap = vim.api.nvim_set_keymap -options = {silent=true, expr=true} - - --- Jump forward or backward --- pmenu and vim-vsnip -keymap('i', '', "pumvisible() ? '' : vsnip#jumpable(1) ? '(vsnip-jump-next)' : ''", options) -keymap('i', '', "pumvisible() ? '' : vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : ''", options) --- vim-vsnip -keymap('s', '', "vsnip#jumpable(1) ? '(vsnip-jump-next)' : ''", options) -keymap('s', '', "vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : ''", options) -]] ---------------------------------------------------------------------- --- enf of MAPPINGS ---------------------------------------------------------------------- - - - - - - diff --git a/lua/plugins/windline_nvim.lua b/lua/plugins/windline_nvim.lua deleted file mode 100644 index a8dbc48..0000000 --- a/lua/plugins/windline_nvim.lua +++ /dev/null @@ -1,306 +0,0 @@ ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---─────────────────────────────────────────────────-- --- Plugin: windline.nvim --- Github: github.com/windwp/windline.nvim ---─────────────────────────────────────────────────-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━❰ configs ❱━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - -local windline = require('windline') -local helper = require('windline.helpers') -local sep = helper.separators -local vim_components = require('windline.components.vim') - -local b_components = require('windline.components.basic') -local state = _G.WindLine.state - -local lsp_comps = require('windline.components.lsp') -local git_comps = require('windline.components.git') - -local hl_list = { - Black = { 'white', 'black' }, - White = { 'black', 'white' }, - Inactive = { 'InactiveFg', 'InactiveBg' }, - Active = { 'ActiveFg', 'ActiveBg' }, -} -local basic = {} - -basic.divider = { b_components.divider, '' } -basic.space = { ' ', '' } -basic.bg = { ' ', 'StatusLine' } -basic.file_name_inactive = { b_components.full_file_name, hl_list.Inactive } -basic.line_col_inactive = { b_components.line_col, hl_list.Inactive } -basic.progress_inactive = { b_components.progress, hl_list.Inactive } - -basic.vi_mode = { - hl_colors = { - Normal = { 'black', 'blue', 'bold' }, - Insert = { 'black', 'red', 'bold' }, - Visual = { 'black', 'white', 'bold' }, - Replace = { 'black', 'blue_light', 'bold' }, - Command = { 'black', 'magenta', 'bold' }, - NormalBefore = { 'blue', 'black' }, - InsertBefore = { 'red', 'black' }, - VisualBefore = { 'white', 'black' }, - ReplaceBefore = { 'blue_light', 'black' }, - CommandBefore = { 'magenta', 'black' }, - NormalAfter = { 'white', 'blue' }, - InsertAfter = { 'white', 'red' }, - VisualAfter = { 'white', 'white' }, - ReplaceAfter = { 'white', 'blue_light' }, - CommandAfter = { 'white', 'magenta' }, - }, - text = function() - return { - { sep.left_rounded, state.mode[2] .. 'Before' }, - { state.mode[1] .. ' ', state.mode[2] }, - } - end, -} - -basic.lsp_diagnos = { - width = 90, - hl_colors = { - red = { 'red', 'black' }, - yellow = { 'yellow', 'black' }, - blue = { 'blue', 'black' }, - }, - text = function() - if lsp_comps.check_lsp() then - return { - { lsp_comps.lsp_error({ format = '  %s' }), 'red' }, - { lsp_comps.lsp_warning({ format = '  %s' }), 'yellow' }, - { lsp_comps.lsp_hint({ format = '  %s' }), 'blue' }, - } - end - return '' - end, -} - - -local icon_comp = b_components.cache_file_icon({ default = '', hl_colors = {'white','black_light'} }) - -basic.file = { - hl_colors = { - default = { 'white', 'black_light' }, - }, - text = function(bufnr) - return { - { ' ', 'default' }, - icon_comp(bufnr), - { ' ', 'default' }, - { b_components.cache_file_name('[No Name]', ''), '' }, - { b_components.file_modified(' '), '' }, - -- { b_components.cache_file_size(), '' }, - } - end, -} -basic.right = { - hl_colors = { - sep_before = { 'black_light', 'white_light' }, - sep_after = { 'white_light', 'black' }, - text = { 'black', 'white_light' }, - }, - text = function() - return { - -- { b_components.line_col, 'text' }, - { b_components.progress, 'text' }, - { sep.right_rounded, 'sep_after' }, - } - end, -} -basic.git = { - width = 90, - hl_colors = { - green = { 'green', 'black' }, - red = { 'red', 'black' }, - blue = { 'blue', 'black' }, - }, - text = function() - if git_comps.is_git() then - return { - { ' ', '' }, - { git_comps.diff_added({ format = '+%s' }), 'green' }, - { git_comps.diff_removed({ format = '-%s' }), 'red' }, - { git_comps.diff_changed({ format = '~%s' }), 'blue' }, - } - end - return '' - end, -} -basic.logo = { - hl_colors = { - sep_before = { 'blue', 'black' }, - default = { 'black', 'blue' }, - }, - text = function() - return { - { sep.left_rounded, 'sep_before' }, - { ' ', 'default' }, - } - end, -} - - - - - - - - - --- LSP status -local lsp_status = require('lsp-status') -lsp_status.register_progress() -local lsp_config = require('lspconfig') - - - -- Lsp server name . -function lspservername() - local msg = '' - local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then return msg end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return "LSP[" .. client.name .. "]" - end - end - return msg -end - - -basic.lsp = { - width = 90, - hl_colors = { - red = { 'red', 'black' }, - yellow = { 'yellow', 'black' }, - blue = { 'blue', 'black' }, - }, - text = function() - return { - { lsp_status.status, 'red' }, - {" ", ""}, - { lspservername(), 'red' }, - } - end, -} - - - - -basic.git_branch = { - - text = function() - return { - { git_comps.git_branch(), { 'green', 'black', '' }, 90 }, - } - end, -} - - - - - - - - - - -local default = { - filetypes = { 'default' }, - active = { - basic.vi_mode, - { git_comps.git_branch(), { 'red', 'black', 'bold' }, 90 }, - basic.git, - basic.file, - { vim_components.search_count(), { 'red', 'black_light' } }, - { sep.right_rounded, { 'black_light', 'black' } }, - basic.divider, - basic.lsp_diagnos, - basic.lsp, - { ' ', hl_list.Black }, - basic.right, - -- { ' ', hl_list.Black }, - }, - in_active = { - basic.file_name_inactive, - basic.divider, - basic.divider, - basic.line_col_inactive, - { '', { 'white', 'InactiveBg' } }, - basic.progress_inactive, - }, -} - -local quickfix = { - filetypes = { 'qf', 'Trouble' }, - active = { - { '🚦 Quickfix ', { 'white', 'black' } }, - { helper.separators.slant_right, { 'black', 'black_light' } }, - { - function() - return vim.fn.getqflist({ title = 0 }).title - end, - { 'cyan', 'black_light' }, - }, - { ' Total : %L ', { 'cyan', 'black_light' } }, - { helper.separators.slant_right, { 'black_light', 'InactiveBg' } }, - { ' ', { 'InactiveFg', 'InactiveBg' } }, - basic.divider, - { helper.separators.slant_right, { 'InactiveBg', 'black' } }, - { '🧛 ', { 'white', 'black' } }, - }, - show_in_active = true, -} - -local explorer = { - filetypes = { 'fern', 'NvimTree', 'lir' }, - active = { - { '  ', { 'white', 'black' } }, - { helper.separators.slant_right, { 'black', 'black_light' } }, - { b_components.divider, '' }, - { b_components.file_name(''), { 'white', 'black_light' } }, - }, - show_in_active = true, -} -windline.setup({ - colors_name = function(colors) - -- ADD MORE COLOR HERE ---- - return colors - end, - statuslines = { - default, - quickfix, - explorer, - }, -}) - - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━❰ end configs ❱━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━❰ Mappings ❱━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - - ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━❰ end Mappings ❱━━━━━━━━━━━━━━━━-- ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-- - diff --git a/setup.py b/setup.py deleted file mode 100644 index 78adb2f..0000000 --- a/setup.py +++ /dev/null @@ -1,280 +0,0 @@ - -# importing required module -# ------------------------------- -import subprocess -from shutil import which -import argparse -from pathlib import Path -from datetime import datetime - -# import pynvim and install it if it's not already installed -try: - from pynvim import attach -except ImportError: - # install pip if it's not installed - try: - import pip - except ModuleNotFoundError: - command = ["python3", "-m", "ensurepip", "--default-pip"] - subprocess.run(command) - command = ['pip', 'install', 'pynvim'] - subprocess.run(command) - from pynvim import attach -# ------------------------------- - - -# argument handeling -# ------------------------------- -parser = argparse.ArgumentParser() -parser.add_argument( - "--delete", - "-d", - type=int, - default=0, - help="0 or 1, 0 means don't delete(Default) and 1 means delete the no \ - required file/directory (.git, LICENSE, README.md)", -) -parser.add_argument( - "--backup", - "-b", - type=int, - default=1, - help="0 or 1, 0 means don't backup and 1 means backup(Default) the \ - config before any configuration", -) -parser.add_argument( - "--update", - "-u", - type=int, - default=0, - help="0 or 1, 1 means update and 0 means don't update(Default) the \ - Abstract", -) - -args = parser.parse_args() -delete = args.delete -backup = args.backup -update = args.update -# ------------------------------- - - -# directory locations -# ------------------------------- -nvim = attach('child', argv=[which("env"), "nvim", "--embed", "--headless"]) - -HOME = Path.home() -NVIM_DATA_DIR = nvim.funcs.stdpath('data') -NVIM_CONF_PATH = nvim.funcs.stdpath('config') - -CONFIG = NVIM_CONF_PATH.split("nvim")[0] -CACHE = f"{NVIM_DATA_DIR}/.cache" -CUSTOM_TOOLS_DIR = f"{NVIM_DATA_DIR}/custom_tools" -CACHE_BUILD_PATH = f"{HOME}/.cache/build_files" -SCRIPT_PATH = Path(__file__).parent.absolute() -# ------------------------------- - - -# directories we must have -# ------------------------------- -require_dir = [ - f"{CONFIG}", - f"{CACHE}/swap", - f"{CACHE}/view", - f"{CACHE}/shada", - f"{CACHE}/backedUP", - f"{CACHE}/undos", - CUSTOM_TOOLS_DIR, - CACHE_BUILD_PATH, -] -# ------------------------------- - - -# ------------------------------- -def create_require_dir(dirs): - need_to_inform = False - once = True - - for dir in dirs: - if not Path(dir).exists(): - need_to_inform = True - if need_to_inform and once: - print("creating required directories...") - once = False - Path(dir).mkdir(parents=True) - print(" ", dir) -# ------------------------------- - - -# ------------------------------- -def clone_repro(path, repository, name): - subprocess.run(['git', 'clone', repository, name], cwd=path) -# ------------------------------- - - -# ------------------------------- -def update_abstract(): - subprocess.run(["git", "pull"], cwd=NVIM_CONF_PATH) -# ------------------------------- - - -# ------------------------------- -def backup_nvim(): - current_date = datetime.today().strftime("%Y-%m-%d_%T") - if Path(NVIM_CONF_PATH).exists(): - subprocess.run(['cp', '-rf', 'nvim', f'nvim-old_{current_date}'], cwd=CONFIG) - print(f"\nyour old config: {NVIM_CONF_PATH}_{current_date}\n") -# ------------------------------- - - -# ------------------------------- -def clean(): - if Path(NVIM_DATA_DIR+"/site/pack/packer").exists(): - subprocess.run(["rm", "-rf", NVIM_DATA_DIR+"/site/pack/packer"]) - print("\nREMOVED: ", NVIM_DATA_DIR+"/site/pack/packer") - if Path(NVIM_CONF_PATH+"/plugin").exists(): - subprocess.run(["rm", "-rf", NVIM_CONF_PATH+"/plugin"]) - print("\nREMOVED: ", NVIM_CONF_PATH+"/plugin") -# ------------------------------- - - -# ------------------------------- -def abstract_git(): - """check if abstract exist as a git project""" - - if Path(NVIM_CONF_PATH).exists(): - if Path(f"{NVIM_CONF_PATH}/.__abstract__").is_file(): - if Path(f"{NVIM_CONF_PATH}/.git").exists(): - return True - return False -# ------------------------------- - - -# ------------------------------- -def need_to_clone_abstract(): - """check if we need to clone the abstract repro, - if setup.py run without cloning abstract - """ - - if Path(f"{SCRIPT_PATH}/setup.py").is_file() and \ - Path(f"{SCRIPT_PATH}/.__abstract__").is_file(): - return False - - if abstract_git(): - return False - - return True -# ------------------------------- - - -# ------------------------------- -def compile_nvim(): - print("\nIf it's taking long time then press CTRL+C and run setup.py file again \n (2-5 minutes would be enough) \n") - packer_compile_cmd = ["nvim", "--headless", "-c", "autocmd User PackerComplete quitall", "-c", "PackerSync"] - subprocess.run(packer_compile_cmd) -# ------------------------------- - - -# ------------------------------- -def setup_packer(): - nvim_plugin_dir = str(f"{NVIM_DATA_DIR}/site/pack/packer/start") - packer_dir = nvim_plugin_dir+"/packer.nvim" - print("\nsetting up packer...") - - if not Path(nvim_plugin_dir).exists(): - Path(nvim_plugin_dir).mkdir(parents=True) - - if not Path(packer_dir).exists(): - print(packer_dir) - repository = "https://github.com/wbthomason/packer.nvim" - subprocess.run(["git", "clone", "--depth", "1", repository], cwd=nvim_plugin_dir) -# ------------------------------- - - -# ------------------------------- -def remove_no_require(): - subprocess.run(["rm", "-rf", ".git*", "LICENSE", "README.md", "setup.py", ".__*"], cwd=NVIM_CONF_PATH) - print("\nREMOVED: .git ,LICENSE ,README.md ,setup.py ,.__abstract__") -# ------------------------------- - - -# ------------------------------- -def main(): - - print("--------------------------------") - print("installing...this may take some time.") - print("--------------------------------\n") - - # backup config if backup argument is 1 - if backup == 1: - backup_nvim() - - # create required directories - create_require_dir(require_dir) - - if update == 1 and abstract_git(): - update_abstract() - - else: - if need_to_clone_abstract(): - print("\n") - clone_repro(CONFIG, "https://github.com/Abstract-IDE/Abstract", "nvim") - - else: - # prevent copying or removing if setup.up is running from ~/.config/nvim/ - if str(SCRIPT_PATH) != str(NVIM_CONF_PATH): - if Path(f"{SCRIPT_PATH}/setup.py").is_file() and Path(f"{SCRIPT_PATH}/.__abstract__").is_file(): - # remove ~/.config/nvim/ to prevent depth parent copy(eg: ~/.config/nvim/nvim) - subprocess.run(["rm", "-rf", NVIM_CONF_PATH]) - print("\ncopying config...") - subprocess.run(["cp", "-rf", SCRIPT_PATH, NVIM_CONF_PATH]) - - else: - update_abstract() - - else: - update_abstract() - - # compile configs - try: - clean() - setup_packer() - print("\ncompiling config and plugins...") - compile_nvim() - except KeyboardInterrupt: - print("\n\n") - print("!!!someting went wrong!!!!\n please re-run setup.py file") - - if delete == 1: - print("\ncleaning config...") - remove_no_require() - - # cloning lazy-builder tool (https://github.com/shaeinst/lazy-builder) - lazy_builder_path = f"{CUSTOM_TOOLS_DIR}/lazy-builder" - if not Path(lazy_builder_path).exists(): - try: - print("\ninstalling additional...") - repository = "https://github.com/Abstract-IDE/lazy-builder" - clone_repro(CUSTOM_TOOLS_DIR, repository, 'lazy-builder') - except KeyboardInterrupt: - print("additional tools didn't install\n") - else: - subprocess.run(["git", "pull"], cwd=lazy_builder_path) - - msg = """\n\n - !!!WARNING!!! - we try our best to auto setup as much as possible. - you may get some errors during installation (maybe it's your network problem?) - so, open nvim (from your terminal ) and if nvim throws any errors, - it means that installaton wasn't sucessfull. - In that case, please re-run setup.py or - python <(curl -s https://raw.githubusercontent.com/Abstract-IDE/Abstract/main/setup.py) - """ - print(msg) - - -# ------------------------------- - - -if __name__ == '__main__': - main() -