diff --git a/.github/workflows/update_flake.yml b/.github/workflows/update_flake.yml index 88090f3b7..9d9e31c51 100644 --- a/.github/workflows/update_flake.yml +++ b/.github/workflows/update_flake.yml @@ -11,8 +11,6 @@ jobs: contents: write steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Required to count the commits - uses: cachix/install-nix-action@v26 with: nix_path: nixpkgs=channel:nixos-unstable diff --git a/LICENSE b/LICENSE index 0203a8bed..33895b644 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,30 @@ -MIT License +BSD 3-Clause License Copyright (c) 2021 ayamir +Copyright (c) 2022 Jint-lzxy, CharlesChiuGit +Copyright (c) 2023 aarnphm, misumisumi -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: +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. -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. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index c8c20d666..f4af58f74 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Chinese introduction is [here](https://zhuanlan.zhihu.com/p/382092667). ### 🎐 Features -- **Fast.** Less than **30ms** to start (Depends on SSD and CPU, tested on Zephyrus G14 2022 version). +- **Fast.** Less than **50ms** to start (Depends on SSD and CPU, tested on Zephyrus G14 2022 version). - **Simple.** Runs out of the box. - **Modern.** Pure `lua` config. - **Modular.** Easy to customize. @@ -197,6 +197,8 @@ It's strongly recommended to read [Wiki: Prerequisites](https://github.com/ayami - [ayamir](https://github.com/ayamir) - [Jint-lzxy](https://github.com/Jint-lzxy) - [CharlesChiuGit](https://github.com/CharlesChiuGit) +- [aarnphm](https://github.com/aarnphm) +- [misumisumi](https://github.com/misumisumi) ## 🎉 Acknowledgement @@ -204,7 +206,7 @@ It's strongly recommended to read [Wiki: Prerequisites](https://github.com/ayami ## 📜 License -This Neovim configuration is released under the MIT license, which grants the following permissions: +This Neovim configuration is released under the BSD 3-Clause license, which grants the following permissions: - Commercial use - Distribution diff --git a/flake.lock b/flake.lock index ef96466e1..82e9e0ba1 100644 --- a/flake.lock +++ b/flake.lock @@ -2,15 +2,14 @@ "nodes": { "devshell": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1713532798, - "narHash": "sha256-wtBhsdMJA3Wa32Wtm1eeo84GejtI43pMrFrmwLXrsEc=", + "lastModified": 1722113426, + "narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=", "owner": "numtide", "repo": "devshell", - "rev": "12e914740a25ea1891ec619bb53cf5e6ca922e40", + "rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae", "type": "github" }, "original": { @@ -24,11 +23,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1715865404, - "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", + "lastModified": 1719994518, + "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", + "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", "type": "github" }, "original": { @@ -37,24 +36,6 @@ "type": "github" } }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -62,11 +43,11 @@ ] }, "locked": { - "lastModified": 1717097707, - "narHash": "sha256-HC5vJ3oYsjwsCaSbkIPv80e4ebJpNvFKQTBOGlHvjLs=", + "lastModified": 1722462338, + "narHash": "sha256-ss0G8t8RJVDewA3MyqgAlV951cWRK6EtVhVKEZ7J5LU=", "owner": "nix-community", "repo": "home-manager", - "rev": "0eb314b4f0ba337e88123e0b1e57ef58346aafd9", + "rev": "6e090576c4824b16e8759ebca3958c5b09659ee8", "type": "github" }, "original": { @@ -77,11 +58,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1704161960, - "narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=", + "lastModified": 1722073938, + "narHash": "sha256-OpX0StkL8vpXyWOGUD6G+MA26wAXK6SpT94kLJXo6B4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "63143ac2c9186be6d9da6035fa22620018c85932", + "rev": "e36e9f57337d0ff0cf77aceb58af4c805472bfae", "type": "github" }, "original": { @@ -93,23 +74,23 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1714640452, - "narHash": "sha256-QBx10+k6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94=", + "lastModified": 1719876945, + "narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" } }, "nixpkgs_2": { "locked": { - "lastModified": 1717112898, - "narHash": "sha256-7R2ZvOnvd9h8fDd65p0JnB7wXfUvreox3xFdYWd1BnY=", + "lastModified": 1722415718, + "narHash": "sha256-5US0/pgxbMksF92k1+eOa8arJTJiPvsdZj9Dl+vJkM4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6132b0f6e344ce2fe34fc051b72fb46e34f668e0", + "rev": "c3392ad349a5227f4a3464dce87bcc5046692fce", "type": "github" }, "original": { @@ -126,21 +107,6 @@ "home-manager": "home-manager", "nixpkgs": "nixpkgs_2" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index f24cfc588..9dd3840c7 100644 --- a/flake.nix +++ b/flake.nix @@ -33,21 +33,21 @@ name = "check-linker"; text = let - ldd_cmd = if pkgs.stdenv.isDarwin then "otool -L" else "${pkgs.glibc.bin}/bin/ldd"; + ldd_cmd = if pkgs.stdenv.isDarwin then "xcrun otool -L" else "${pkgs.glibc.bin}/bin/ldd"; in '' #shellcheck disable=SC1090 - source <(sed -ne :1 -e 'N;1,1b1' -e 'P;D' "${self.packages.${system}.testEnv}/home-path/bin/nvim") - echo "check file under ''${XDG_DATA_HOME}/''${NVIM_APPNAME:-nvim}/mason/bin" + source <(sed -ne :1 -e 'N;1,1b1' -e 'P;D' "${self.packages.${system}.testEnv}/home-path/bin/nvim") + echo "Checking files under ''${XDG_DATA_HOME}/''${NVIM_APPNAME:-nvim}/mason/bin..." find "''${XDG_DATA_HOME}/''${NVIM_APPNAME:-nvim}/mason/bin" -type l | while read -r link; do "${ldd_cmd}" "$(readlink -f "$link")" > /dev/zero 2>&1 || continue linkers=$("${ldd_cmd}" "$(readlink -f "$link")" | tail -n+2) echo "$linkers" | while read -r line; do [ -z "$line" ] && continue - echo "$line" | grep -q "/nix/store" || printf '%s: %s do not link to /nix/store \n' "$(basename "$link")" "$line" + echo "$line" | grep -q "/nix/store" || printf '%s: %s does not link to /nix/store \n' "$(basename "$link")" "$line" done done - echo "check done" + echo "*** Done ***" ''; }; }; @@ -69,7 +69,7 @@ motd = '' {202}🔨 Welcome to devshell{reset} Symlink configs to "''${XDG_CONFIG_HOME}"/nvimdots! - And NVIM_APPNAME=nvimdots is already configured, so neovim will put file under "\$XDG_xxx_HOME"/nvimdots. + And NVIM_APPNAME=nvimdots is already configured, so neovim will put files under "\$XDG_xxx_HOME"/nvimdots. To uninstall, remove "\$XDG_xxx_HOME"/nvimdots. $(type -p menu &>/dev/null && menu) diff --git a/lazy-lock.json b/lazy-lock.json index bb24492f3..d99d06827 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,13 +1,13 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "LuaSnip": { "branch": "master", "commit": "50fcf17db7c75af80e6b6109acfbfb4504768780" }, - "advanced-git-search.nvim": { "branch": "main", "commit": "198cc402af1790ab26830fdbf24a28c336a20ba6" }, - "aerial.nvim": { "branch": "master", "commit": "eb25396dae306cef5b8fffbe9ae98283d2f1c199" }, - "alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" }, - "autoclose.nvim": { "branch": "main", "commit": "dc42806540dcf448ecb2bad6b67204410cfbe629" }, + "LuaSnip": { "branch": "master", "commit": "7ad2eaeaca56d6ed63acacbfc114b99f1f67b982" }, + "advanced-git-search.nvim": { "branch": "main", "commit": "36ea105a7b7063a6879ac3b8afffe6fb326e27b1" }, + "aerial.nvim": { "branch": "master", "commit": "8d2a6c2ffad271b10c91f2c6f6ecef1f9625a9b9" }, + "alpha-nvim": { "branch": "main", "commit": "b6f4129302db197a7249e67a90de3f2b676de13e" }, + "autoclose.nvim": { "branch": "main", "commit": "b2077aa2c83df7ebc19b2a20a3a0654b24ae9c8f" }, "bigfile.nvim": { "branch": "main", "commit": "33eb067e3d7029ac77e081cfe7c45361887a311a" }, - "bufferline.nvim": { "branch": "main", "commit": "99337f63f0a3c3ab9519f3d1da7618ca4f91cffe" }, - "catppuccin": { "branch": "refactor/syntax-highlighting", "commit": "e34171a3273e6a2c881f28ae36b8b37a2c84f196" }, + "bufferline.nvim": { "branch": "main", "commit": "0b2fd861eee7595015b6561dade52fb060be10c4" }, + "catppuccin": { "branch": "refactor/syntax-highlighting", "commit": "4ba8c8bd0c6076773dea6e3831d36fc2e40576fc" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-latex-symbols": { "branch": "main", "commit": "165fb66afdbd016eaa1570e41672c4c557b57124" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, @@ -19,89 +19,90 @@ "cmp-treesitter": { "branch": "master", "commit": "c8e3a74b51597d69d240085a258636972ce98e15" }, "cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "crates.nvim": { "branch": "main", "commit": "909d233a8a86fd5ca8ef9eb1e404e89b81e05c41" }, - "csv.vim": { "branch": "master", "commit": "4d5255829afe3b6badb0c8a040116704c0d3213c" }, + "crates.nvim": { "branch": "main", "commit": "891063a2dc8471501b9742406a514be62a20c138" }, + "csv.vim": { "branch": "master", "commit": "bddfcbadd788ab11eb3dbba4550a38a412fe3705" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "dropbar.nvim": { "branch": "master", "commit": "79847a78ec0c58f5e5c0360192b03d0cee803e95" }, - "fidget.nvim": { "branch": "main", "commit": "ef99df04a1c53a453602421bc0f756997edc8289" }, - "flash.nvim": { "branch": "main", "commit": "43f67935d388fbb540f8b40e8cbfd80de54f978a" }, - "focus.nvim": { "branch": "master", "commit": "948b32e35f54b6900632312d51a1706fabdc12b8" }, - "friendly-snippets": { "branch": "main", "commit": "682157939e57bd6a2c86277dfd4d6fbfce63dbac" }, - "fzf": { "branch": "master", "commit": "b9d15569e88d5abc5cfeaaf64c5aed3f95ee71da" }, + "dropbar.nvim": { "branch": "master", "commit": "d26bf92161cd70e049dc138b44ffa0246dbf7178" }, + "fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" }, + "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, + "focus.nvim": { "branch": "master", "commit": "3841a38df972534567e85840d7ead20d3a26faa6" }, + "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, + "fzf": { "branch": "master", "commit": "8cb59e6fcac3dce8dfa44b678fdc94cf81efa11b" }, "fzy-lua-native": { "branch": "master", "commit": "820f745b7c442176bcc243e8f38ef4b985febfaf" }, "gitsigns.nvim": { "branch": "main", "commit": "0b04035bb7b3c83e999b9676e2fb46fd0aa9f910" }, "glance.nvim": { "branch": "master", "commit": "51059bcf21016387b6233c89eed220cf47fca752" }, - "hop.nvim": { "branch": "master", "commit": "036462a345792279c58f2f6445756efab706f04a" }, - "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" }, + "hop.nvim": { "branch": "master", "commit": "8f51ef02700bb3cdcce94e92eff16170a6343c4f" }, + "indent-blankline.nvim": { "branch": "master", "commit": "db926997af951da38e5004ec7b9fbdc480b48f5d" }, "knap": { "branch": "main", "commit": "0040760bb504a713ea5988c7c490a15faf477c57" }, - "lazy.nvim": { "branch": "main", "commit": "bc620783663ab09d16bff9fdecc07da65b2a1528" }, + "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, "local-highlight.nvim": { "branch": "master", "commit": "ae3ada3a332128b1036c84c8587b9069891c63da" }, "lsp-format-modifications.nvim": { "branch": "main", "commit": "006d4cd88f4f09fdc4375fcb75dd5b7d981a723b" }, - "lspsaga.nvim": { "branch": "main", "commit": "6f920cfabddb9b7de5a3a4d0b7cd4f0774ae23e2" }, - "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, + "lspsaga.nvim": { "branch": "main", "commit": "4ce44df854f447cf0a8972e5387b3aeb5efc798b" }, + "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "37a336b653f8594df75c827ed589f1c91d91ff6c" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "482350b050bd413931c2cdd4857443c3da7d57cb" }, "mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "f5425eb1d0d794f0305d5eeebddabb74614683ff" }, - "mason.nvim": { "branch": "main", "commit": "0950b15060067f752fde13a779a994f59516ce3d" }, - "mini.align": { "branch": "main", "commit": "68a8d3205f0e7ce1bded057f4a851f42ef8fc584" }, - "neoconf.nvim": { "branch": "main", "commit": "60f6dd6aa1006fa5c3ff4b7bf01586dcecbe9187" }, - "neodim": { "branch": "master", "commit": "0543414f1205d8937d8e703a73ae1f9948940b14" }, - "neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" }, - "none-ls.nvim": { "branch": "main", "commit": "cc0a3c45047e3daf85d07c1571d65476cfce6480" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "mini.align": { "branch": "main", "commit": "b54d88b16bfac62ca6b3d699566135639a3ca4fa" }, + "neoconf.nvim": { "branch": "main", "commit": "59b5aa97496b074ebee43b97cfd9beb57ea1a312" }, + "neodim": { "branch": "master", "commit": "d87470828690342d0139efc2fd56ea0b29e9ecb3" }, + "neoscroll.nvim": { "branch": "master", "commit": "532dcc8cea4287c4cad6bb77532989a8217cfc7b" }, + "none-ls.nvim": { "branch": "main", "commit": "cfa65d86e21eeb60544d5e823f6db43941322a53" }, "nvim-bqf": { "branch": "main", "commit": "1b24dc6050c34e8cd377b6b4cd6abe40509e0187" }, "nvim-bufdel": { "branch": "main", "commit": "523d58e94e7212fff3e05c247b962dc8f93bcfde" }, - "nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" }, - "nvim-dap": { "branch": "master", "commit": "6f79b822997f2e8a789c6034e147d42bc6706770" }, - "nvim-dap-ui": { "branch": "master", "commit": "b7267003ba4dd860350be86f75b9d9ea287cedca" }, - "nvim-highlight-colors": { "branch": "main", "commit": "30f305d57d658615cd827146f5e56db8b6833475" }, - "nvim-lspconfig": { "branch": "master", "commit": "5c33bf1f708ac8cb839469e1a03d45987fec305c" }, - "nvim-nio": { "branch": "master", "commit": "7969e0a8ffabdf210edd7978ec954a47a737bbcc" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-dap": { "branch": "master", "commit": "281a2e4cd1e7a17cea7ecb1745d84a8ab1249925" }, + "nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" }, + "nvim-highlight-colors": { "branch": "main", "commit": "a411550ef85cae467b889ba7d1a96bd78332d90e" }, + "nvim-lspconfig": { "branch": "master", "commit": "b21c166bbf337734f2a39734a905c1c3e298205c" }, + "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, - "nvim-scrollview": { "branch": "main", "commit": "fd334e5ad0c616987d1b9114890a59c97165cf83" }, - "nvim-spectre": { "branch": "master", "commit": "ec67d4b5370094b923dfcf6b09b39142f2964861" }, - "nvim-surround": { "branch": "main", "commit": "687ea2f33955df0042bf228853a82696265e7e2d" }, - "nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" }, + "nvim-scrollview": { "branch": "main", "commit": "401c0498689dcaa54b2e7483d823e33cdc051e72" }, + "nvim-spectre": { "branch": "master", "commit": "ba7fb777edff6c1fbbeffd343e113af64c04e90a" }, + "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" }, + "nvim-tree.lua": { "branch": "master", "commit": "ad0b95dee55955817af635fa121f6e2486b10583" }, "nvim-treehopper": { "branch": "master", "commit": "13559079e33665a310d9ccf0e43f4e9bb9f337e2" }, - "nvim-treesitter": { "branch": "master", "commit": "66ae8748fd4e8550c8b17cf115c9739aea1e4067" }, - "nvim-treesitter-context": { "branch": "master", "commit": "5efba33af0f39942e426340da7bc15d7dec16474" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, - "nvim-ts-autotag": { "branch": "main", "commit": "06fe07d7523ba8c755fac7c913fceba43b1720ee" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" }, - "nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" }, - "obsidian.nvim": { "branch": "main", "commit": "7e087da48bd88fb3a6c6229a97713ac35694337a" }, - "paint.nvim": { "branch": "main", "commit": "6ce64212804f425073c61ab0d9c2b034f0435260" }, - "persisted.nvim": { "branch": "main", "commit": "0a9eebf5cc92b1113a382a660ee73f21ffd62ae7" }, - "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, + "nvim-treesitter": { "branch": "master", "commit": "0b8b78f9d08dc338a146eb4cd4bcbed8dd36a783" }, + "nvim-treesitter-context": { "branch": "master", "commit": "0f3332788e0bd37716fbd25f39120dcfd557c90f" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "41e3abf6bfd9a9a681eb1f788bdeba91c9004b2b" }, + "nvim-ts-autotag": { "branch": "main", "commit": "0cb76eea80e9c73b88880f0ca78fbd04c5bdcac7" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "375c2d86cee6674afd75b4f727ce3a80065552f7" }, + "nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" }, + "obsidian.nvim": { "branch": "main", "commit": "14e0427bef6c55da0d63f9a313fd9941be3a2479" }, + "paint.nvim": { "branch": "main", "commit": "ef6f717a8669619ebbd098fb72f85115d64c6c92" }, + "persisted.nvim": { "branch": "main", "commit": "5593b1b8f1e2d579fe4513b4686993da6fa388cb" }, + "plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" }, "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "5c9660801ce345cd3835e1947c12b54290ab7e71" }, - "rustaceanvim": { "branch": "master", "commit": "1e7600b370db3caf37a1cd867e00aac27597a114" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "9f3d10e66a79e8975926f8cb930856e4930d9da4" }, + "render-markdown.nvim": { "branch": "main", "commit": "8b6663b0605b134173c0dd44b7a4a41d3f1ad37f" }, + "rustaceanvim": { "branch": "master", "commit": "7cba8e599deca98d4b44cac1bcbd720c62937d90" }, "search.nvim": { "branch": "main", "commit": "7b8f2315d031be73e14bc2d82386dfac15952614" }, - "smart-splits.nvim": { "branch": "master", "commit": "3d9fa9e4b31c30d6b328f2447a4dc7dceffbc2ea" }, + "smart-splits.nvim": { "branch": "master", "commit": "b518cfb5283a2da43fa9935e850ba9d77873453d" }, "smartyank.nvim": { "branch": "master", "commit": "d9e078fe08d6466e37ea45ac446a9f60e6866789" }, - "sniprun": { "branch": "master", "commit": "1420cff041a0582636f63960d7160f7832463c10" }, + "sniprun": { "branch": "master", "commit": "a29d7b1c313b00980015ad79fa0ab512a0729940" }, "suda.vim": { "branch": "master", "commit": "b97fab52f9cdeabe2bbb5eb98d82356899f30829" }, "telescope-bibtex.nvim": { "branch": "master", "commit": "289a6f86ebec06e8ae1590533b732b9981d84900" }, - "telescope-frecency.nvim": { "branch": "master", "commit": "78570e237c8b2494dd74ffe196fbd01d0c9e5460" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, - "telescope-live-grep-args.nvim": { "branch": "master", "commit": "8ad632f793fd437865f99af5684f78300dac93fb" }, - "telescope-undo.nvim": { "branch": "main", "commit": "95b61c01ea3a4c9e8747731148e905bbcf0ccaee" }, - "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" }, - "telescope.nvim": { "branch": "master", "commit": "c392f1b78eaaf870ca584bd698e78076ed301b26" }, - "todo-comments.nvim": { "branch": "main", "commit": "51e10f838e84b4756c16311d0b1ef0972c6482d2" }, - "toggleterm.nvim": { "branch": "main", "commit": "fee58a0473fd92b28c34f8f724e4918b15ba30a3" }, - "trouble.nvim": { "branch": "main", "commit": "2d8610a07033f2b367e71230ab128f8b89c2639d" }, + "telescope-frecency.nvim": { "branch": "master", "commit": "673585ee997b40d2600eb86c3693d552e4f5d79f" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, + "telescope-live-grep-args.nvim": { "branch": "master", "commit": "649b662a8f476fd2c0289570764459e95ebaa3f3" }, + "telescope-undo.nvim": { "branch": "main", "commit": "51be9ae7c42fc27c0b05505e3a0162e0f05fbb6a" }, + "telescope-zoxide": { "branch": "main", "commit": "6d23b6135eb01e0540ab46c838fd44351876917a" }, + "telescope.nvim": { "branch": "master", "commit": "5972437de807c3bc101565175da66a1aa4f8707a" }, + "todo-comments.nvim": { "branch": "main", "commit": "8f45f353dc3649cb9b44cecda96827ea88128584" }, + "toggleterm.nvim": { "branch": "main", "commit": "137d06fb103952a0fb567882bb8527e2f92d327d" }, + "trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" }, "typst-preview.nvim": { "branch": "master", "commit": "5867db936576741f378b558a9d7428b928819df5" }, - "typst.vim": { "branch": "main", "commit": "d9a7650e76c85f8ba437e056d08dd43b01b8bfd6" }, + "typst.vim": { "branch": "main", "commit": "4d18ced62599ffe5b3c0e5e49566d5456121bc02" }, "vim-cool": { "branch": "master", "commit": "662e7b11064cbeedad17c45d2fe926e78d3cd0b6" }, - "vim-fugitive": { "branch": "master", "commit": "64d6cafb9dcbacce18c26d7daf617ebb96b273f3" }, + "vim-fugitive": { "branch": "master", "commit": "0444df68cd1cdabc7453d6bd84099458327e5513" }, "vim-matchup": { "branch": "master", "commit": "1535a769d5dca851fe7d41b0be95f7c7203a4bef" }, "vim-pencil": { "branch": "master", "commit": "6d70438a8886eaf933c38a7a43a61adb0a7815ed" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, - "vimtex": { "branch": "master", "commit": "8ed94566e6fe3f5b163131dc374d224d2d320db7" }, - "which-key.nvim": { "branch": "main", "commit": "0099511294f16b81c696004fa6a403b0ae61f7a0" }, + "vimtex": { "branch": "master", "commit": "76ef99f73a5ff10be59836a4af4f928eaa8ad284" }, + "which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" }, "wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" }, "wrapping.nvim": { "branch": "master", "commit": "3a823200c297885b70515fa8d974e1763c578e26" }, - "zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" } + "zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" } } \ No newline at end of file diff --git a/lua/core/init.lua b/lua/core/init.lua index d01818bf3..7c92a2a35 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -4,11 +4,11 @@ local global = require("core.global") -- Create cache dir and data dirs local createdir = function() local data_dirs = { - global.cache_dir .. "backup", - global.cache_dir .. "session", - global.cache_dir .. "swap", - global.cache_dir .. "tags", - global.cache_dir .. "undo", + global.cache_dir .. "/backup", + global.cache_dir .. "/session", + global.cache_dir .. "/swap", + global.cache_dir .. "/tags", + global.cache_dir .. "/undo", } -- Only check whether cache_dir exists, this would be enough. if vim.fn.isdirectory(global.cache_dir) == 0 then @@ -22,58 +22,6 @@ local createdir = function() end end -local disable_distribution_plugins = function() - -- Disable menu loading - vim.g.did_install_default_menus = 1 - vim.g.did_install_syntax_menu = 1 - - -- Comment this if you define your own filetypes in `after/ftplugin` - -- vim.g.did_load_filetypes = 1 - - -- Do not load native syntax completion - vim.g.loaded_syntax_completion = 1 - - -- Do not load spell files - vim.g.loaded_spellfile_plugin = 1 - - -- Whether to load netrw by default - -- vim.g.loaded_netrw = 1 - -- vim.g.loaded_netrwFileHandlers = 1 - -- vim.g.loaded_netrwPlugin = 1 - -- vim.g.loaded_netrwSettings = 1 - -- newtrw liststyle: https://medium.com/usevim/the-netrw-style-options-3ebe91d42456 - vim.g.netrw_liststyle = 3 - - -- Do not load tohtml.vim - vim.g.loaded_2html_plugin = 1 - - -- Do not load zipPlugin.vim, gzip.vim and tarPlugin.vim (all of these plugins are - -- related to reading files inside compressed containers) - vim.g.loaded_gzip = 1 - vim.g.loaded_tar = 1 - vim.g.loaded_tarPlugin = 1 - vim.g.loaded_vimball = 1 - vim.g.loaded_vimballPlugin = 1 - vim.g.loaded_zip = 1 - vim.g.loaded_zipPlugin = 1 - - -- Do not use builtin matchit.vim and matchparen.vim because we're using vim-matchup - vim.g.loaded_matchit = 1 - vim.g.loaded_matchparen = 1 - - -- Disable sql omni completion - vim.g.loaded_sql_completion = 1 - - -- Set this to 0 in order to disable native EditorConfig support - vim.g.editorconfig = 1 - - -- Disable remote plugins - -- NOTE: - -- > Disabling rplugin.vim will make `wilder.nvim` complain about missing rplugins during :checkhealth, - -- > but since it's config doesn't require python rtp (strictly), it's fine to ignore that for now. - -- vim.g.loaded_remote_plugins = 1 -end - local leader_map = function() vim.g.mapleader = " " -- NOTE: @@ -149,7 +97,6 @@ end local load_core = function() createdir() - disable_distribution_plugins() leader_map() gui_config() diff --git a/lua/core/options.lua b/lua/core/options.lua index 6b9208606..d814faa14 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -2,10 +2,10 @@ local global = require("core.global") local function load_options() local global_local = { - -- backupdir = global.cache_dir .. "backup/", - -- directory = global.cache_dir .. "swap/", - spellfile = global.vim_path .. "/spell/en.uft-8.add", - -- viewdir = global.cache_dir .. "view/", + -- backupdir = global.cache_dir .. "/backup/", + -- directory = global.cache_dir .. "/swap/", + -- spellfile = global.cache_dir .. "/spell/en.uft-8.add", + -- viewdir = global.cache_dir .. "/view/", autoindent = true, autoread = true, autowrite = true, @@ -84,7 +84,7 @@ local function load_options() timeoutlen = 300, ttimeout = true, ttimeoutlen = 0, - undodir = global.cache_dir .. "undo/", + undodir = global.cache_dir .. "/undo/", undofile = true, -- Please do NOT set `updatetime` to above 500, otherwise most plugins may not function correctly updatetime = 200, @@ -126,4 +126,7 @@ local function load_options() vim.g.c_syntax_for_h = true end +-- Newtrw liststyle: https://medium.com/usevim/the-netrw-style-options-3ebe91d42456 +vim.g.netrw_liststyle = 3 + load_options() diff --git a/lua/core/pack.lua b/lua/core/pack.lua index 326bf3df9..5f3f5a7ed 100644 --- a/lua/core/pack.lua +++ b/lua/core/pack.lua @@ -124,6 +124,29 @@ function Lazy:load_lazy() reset = true, -- reset the runtime path to $VIMRUNTIME and the config directory ---@type string[] paths = {}, -- add any custom paths here that you want to include in the rtp + disabled_plugins = { + -- Set this to true in order to enable native EditorConfig support + -- WARN: Sleuth.vim already includes all the features provided by this plugin. + -- Do NOT enable both at the same time, or you risk breaking the entire detection system. + "editorconfig", + -- Do not load spell files + "spellfile", + -- Do not use builtin matchit.vim and matchparen.vim because we're using vim-matchup + "matchit", + "matchparen", + -- Do not load tohtml.vim + "tohtml", + -- Do not load zipPlugin.vim, gzip.vim and tarPlugin.vim (all of these plugins are + -- related to reading files inside compressed containers) + "gzip", + "tarPlugin", + "zipPlugin", + -- Disable remote plugins + -- NOTE: + -- > Disabling rplugin.vim will make `wilder.nvim` complain about missing rplugins during :checkhealth, + -- > but since it's config doesn't require python rtp (strictly), it's fine to ignore that for now. + -- "rplugin", + }, }, }, } diff --git a/lua/core/settings.lua b/lua/core/settings.lua index 933440ba1..17d13d1ff 100644 --- a/lua/core/settings.lua +++ b/lua/core/settings.lua @@ -8,14 +8,14 @@ settings["use_ssh"] = true ---@type boolean settings["use_copilot"] = false --- Set it to false if you want to turn off LSP Inlay Hints ----@type boolean -settings["lsp_inlayhints"] = true - -- Set it to false if there is no need to format on save. ---@type boolean settings["format_on_save"] = true +-- Set format timeout here (in ms). +---@type number +settings["format_timeout"] = 1000 + -- Set it to false if the notification after formatting is annoying. ---@type boolean settings["format_notify"] = true @@ -37,6 +37,24 @@ settings["format_disabled_dirs"] = { "~/format_disabled_dir", } +-- Filetypes in this list will skip lsp formatting if rhs is true. +---@type table +settings["formatter_block_list"] = { + lua = false, -- example +} + +-- Servers in this list will skip setting formatting capabilities if rhs is true. +---@type table +settings["server_formatting_block_list"] = { + lua_ls = true, + tsserver = true, + clangd = true, +} + +-- Set it to false if you want to turn off LSP Inlay Hints +---@type boolean +settings["lsp_inlayhints"] = true + -- Set it to false if diagnostics virtual text is annoying. -- If disabled, you may browse lsp diagnostics using trouble.nvim (press `gt` to toggle it). ---@type boolean @@ -85,20 +103,6 @@ settings["background"] = "dark" ---@type string settings["external_browser"] = "chrome-cli open" --- Filetypes in this list will skip lsp formatting if rhs is true. ----@type table -settings["formatter_block_list"] = { - lua = false, -- example -} - --- Servers in this list will skip setting formatting capabilities if rhs is true. ----@type table -settings["server_formatting_block_list"] = { - lua_ls = true, - tsserver = true, - clangd = true, -} - -- Set the language servers that will be installed during bootstrap here. -- check the below link for all the supported LSPs: -- https://github.com/neovim/nvim-lspconfig/tree/master/lua/lspconfig/server_configurations diff --git a/lua/keymap/lang.lua b/lua/keymap/lang.lua index 46ec703ff..aef337350 100644 --- a/lua/keymap/lang.lua +++ b/lua/keymap/lang.lua @@ -5,6 +5,11 @@ local map_cr = bind.map_cr -- local map_callback = bind.map_callback local plug_map = { + -- Plugin render-markdown.nvim + ["n|"] = map_cr("RenderMarkdown toggle") + :with_noremap() + :with_silent() + :with_desc("tool: toggle markdown preview within nvim"), -- Plugin MarkdownPreview ["n|"] = map_cr("MarkdownPreviewToggle"):with_noremap():with_silent():with_desc("tool: Preview markdown"), } diff --git a/lua/keymap/tool.lua b/lua/keymap/tool.lua index bd928f082..617a2d082 100644 --- a/lua/keymap/tool.lua +++ b/lua/keymap/tool.lua @@ -84,12 +84,46 @@ local plug_map = { :with_noremap() :with_silent() :with_desc("tool: Toggle command panel"), - ["n|f"] = map_callback(function() + ["n|fc"] = map_callback(function() _telescope_collections(require("telescope.themes").get_dropdown()) end) :with_noremap() :with_silent() - :with_desc("tool: Open Telescope"), + :with_desc("tool: Open Telescope collections"), + ["n|ff"] = map_callback(function() + require("search").open({ collection = "file" }) + end) + :with_noremap() + :with_silent() + :with_desc("tool: Find files"), + ["n|fp"] = map_callback(function() + require("search").open({ collection = "pattern" }) + end) + :with_noremap() + :with_silent() + :with_desc("tool: Find patterns"), + ["v|fs"] = map_cu("Telescope grep_string") + :with_noremap() + :with_silent() + :with_desc("tool: Find word under cursor"), + ["n|fg"] = map_callback(function() + require("search").open({ collection = "git" }) + end) + :with_noremap() + :with_silent() + :with_desc("tool: Locate Git objects"), + ["n|fd"] = map_callback(function() + require("search").open({ collection = "dossier" }) + end) + :with_noremap() + :with_silent() + :with_desc("tool: Retrieve dossiers"), + ["n|fm"] = map_callback(function() + require("search").open({ collection = "misc" }) + end) + :with_noremap() + :with_silent() + :with_desc("tool: Miscellaneous"), -- Plugin: dap ["n|"] = map_callback(function() diff --git a/lua/modules/configs/completion/cmp.lua b/lua/modules/configs/completion/cmp.lua index dfed6246f..109ee9878 100644 --- a/lua/modules/configs/completion/cmp.lua +++ b/lua/modules/configs/completion/cmp.lua @@ -90,6 +90,7 @@ return function() vim_item.kind = string.format(" %s %s", lspkind_icons[vim_item.kind] or icons.cmp.undefined, vim_item.kind or "") + -- set up labels for completion entries vim_item.menu = setmetatable({ cmp_tabnine = "[TN]", copilot = "[CPLT]", @@ -110,12 +111,18 @@ return function() end, })[entry.source.name] + -- cut down long results local label = vim_item.abbr local truncated_label = vim.fn.strcharpart(label, 0, 80) if truncated_label ~= label then vim_item.abbr = truncated_label .. "..." end + -- deduplicate results from nvim_lsp + if entry.source.name == "nvim_lsp" then + vim_item.dup = 0 + end + return vim_item end, }, @@ -128,15 +135,14 @@ return function() }, -- You can set mappings if you want mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Replace }), - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.close(), + [""] = cmp.mapping.abort(), [""] = cmp.mapping(function(fallback) if cmp.visible() then - cmp.select_next_item() + cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) elseif require("luasnip").expand_or_locally_jumpable() then require("luasnip").expand_or_jump() else @@ -145,13 +151,24 @@ return function() end, { "i", "s" }), [""] = cmp.mapping(function(fallback) if cmp.visible() then - cmp.select_prev_item() + cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) elseif require("luasnip").jumpable(-1) then require("luasnip").jump(-1) else fallback() end end, { "i", "s" }), + [""] = cmp.mapping({ + i = function(fallback) + if cmp.visible() and cmp.get_active_entry() then + cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = false }) + else + fallback() + end + end, + s = cmp.mapping.confirm({ select = true }), + c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true }), + }), }), snippet = { expand = function(args) @@ -172,7 +189,7 @@ return function() name = "buffer", option = { get_bufnrs = function() - return vim.api.nvim_list_bufs() + return vim.api.nvim_buf_line_count(0) < 7500 and vim.api.nvim_list_bufs() or {} end, }, }, diff --git a/lua/modules/configs/completion/formatting.lua b/lua/modules/configs/completion/formatting.lua index 4634d0451..0368efef7 100644 --- a/lua/modules/configs/completion/formatting.lua +++ b/lua/modules/configs/completion/formatting.lua @@ -6,12 +6,13 @@ local format_on_save = settings.format_on_save local format_notify = settings.format_notify local format_modifications_only = settings.format_modifications_only local server_formatting_block_list = settings.server_formatting_block_list +local format_timeout = settings.format_timeout vim.api.nvim_create_user_command("FormatToggle", function() M.toggle_format_on_save() end, {}) -local block_list = require("core.settings").formatter_block_list +local block_list = settings.formatter_block_list vim.api.nvim_create_user_command("FormatterToggleFt", function(opts) if block_list[opts.args] == nil then vim.notify( @@ -35,7 +36,7 @@ vim.api.nvim_create_user_command("FormatterToggleFt", function(opts) end, { nargs = 1, complete = "filetype" }) function M.enable_format_on_save(is_configured) - local opts = { pattern = "*", timeout = 1000 } + local opts = { pattern = "*", timeout = format_timeout } vim.api.nvim_create_augroup("format_on_save", { clear = true }) vim.api.nvim_create_autocmd("BufWritePre", { group = "format_on_save", @@ -156,7 +157,9 @@ function M.format(opts) { title = "LSP Formatter Warning" } ) return - elseif + end + + if format_modifications_only and require("lsp-format-modifications").format_modifications(client, bufnr).success then diff --git a/lua/modules/configs/completion/mason-lspconfig.lua b/lua/modules/configs/completion/mason-lspconfig.lua index c345c7f78..567ff9f94 100644 --- a/lua/modules/configs/completion/mason-lspconfig.lua +++ b/lua/modules/configs/completion/mason-lspconfig.lua @@ -25,7 +25,11 @@ M.setup = function() }) local opts = { - capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()), + capabilities = vim.tbl_deep_extend( + "force", + vim.lsp.protocol.make_client_capabilities(), + require("cmp_nvim_lsp").default_capabilities() + ), } ---A handler to setup all servers defined under `completion/servers/*.lua` ---@param lsp_name string diff --git a/lua/modules/configs/completion/null-ls.lua b/lua/modules/configs/completion/null-ls.lua index ff2efab17..72982d6ea 100644 --- a/lua/modules/configs/completion/null-ls.lua +++ b/lua/modules/configs/completion/null-ls.lua @@ -42,6 +42,7 @@ return function() log_level = "warn", update_in_insert = false, sources = sources, + default_timeout = require("core.settings").format_timeout, }) require("completion.mason-null-ls").setup() diff --git a/lua/modules/configs/editor/bigfile.lua b/lua/modules/configs/editor/bigfile.lua index 28071772a..6c4e79d1f 100644 --- a/lua/modules/configs/editor/bigfile.lua +++ b/lua/modules/configs/editor/bigfile.lua @@ -16,15 +16,16 @@ return function() } require("modules.utils").load_plugin("bigfile", { - filesize = 1, -- size of the file in MiB + filesize = 2, -- size of the file in MiB pattern = { "*" }, -- autocmd pattern features = { -- features to disable + "indent_blankline", "lsp", - "treesitter", "syntax", + "treesitter", "vimopts", - ftdetect, cmp, + ftdetect, }, }) end diff --git a/lua/modules/configs/editor/persisted.lua b/lua/modules/configs/editor/persisted.lua index 003d8cb9d..2f1f43492 100644 --- a/lua/modules/configs/editor/persisted.lua +++ b/lua/modules/configs/editor/persisted.lua @@ -1,23 +1,13 @@ return function() require("modules.utils").load_plugin("persisted", { - save_dir = vim.fn.expand(vim.fn.stdpath("data") .. "/sessions/"), -- directory where session files are saved - silent = false, -- silent nvim message when sourcing session file - use_git_branch = true, -- create session files based on the branch of the git enabled repository - autosave = true, -- automatically save session files when exiting Neovim - should_autosave = function() - if vim.bo.filetype == "alpha" then - return false - end - return true - end, -- function to determine if a session should be autosaved + save_dir = vim.fn.expand(vim.fn.stdpath("data") .. "/sessions/"), + autostart = true, -- Set `lazy = false` in `plugins/editor.lua` to enable this - autoload = false, -- automatically load the session for the cwd on Neovim startup - on_autoload_no_session = nil, -- function to run when `autoload = true` but there is no session to load - follow_cwd = true, -- change session file name to match current working directory if it changes - allowed_dirs = nil, -- table of dirs that the plugin will auto-save and auto-load from - ignored_dirs = nil, -- table of dirs that are ignored when auto-saving and auto-loading - telescope = { -- options for the telescope extension - reset_prompt_after_deletion = true, -- whether to reset prompt after session deleted - }, + autoload = false, + follow_cwd = true, + use_git_branch = true, + should_save = function() + return vim.bo.filetype == "alpha" and false or true + end, }) end diff --git a/lua/modules/configs/editor/rainbow_delims.lua b/lua/modules/configs/editor/rainbow_delims.lua index 0f1a50aa2..d2e681d23 100644 --- a/lua/modules/configs/editor/rainbow_delims.lua +++ b/lua/modules/configs/editor/rainbow_delims.lua @@ -2,6 +2,13 @@ return function() ---@param threshold number @Use global strategy if nr of lines exceeds this value local function init_strategy(threshold) return function() + -- Disable on very large files + local line_count = vim.api.nvim_buf_line_count(0) + if line_count > 7500 then + return nil + end + + -- Disable on parser error local errors = 200 vim.treesitter.get_parser():for_each_tree(function(lt) if lt:root():has_error() and errors >= 0 then @@ -11,7 +18,8 @@ return function() if errors < 0 then return nil end - return vim.fn.line("$") > threshold and require("rainbow-delimiters").strategy["global"] + + return line_count > threshold and require("rainbow-delimiters").strategy["global"] or require("rainbow-delimiters").strategy["local"] end end @@ -19,8 +27,8 @@ return function() vim.g.rainbow_delimiters = { strategy = { [""] = init_strategy(500), - c = init_strategy(200), - cpp = init_strategy(200), + c = init_strategy(300), + cpp = init_strategy(300), lua = init_strategy(500), vimdoc = init_strategy(300), vim = init_strategy(300), @@ -40,5 +48,6 @@ return function() "RainbowDelimiterViolet", }, } + require("modules.utils").load_plugin("rainbow_delimiters", nil, true) end diff --git a/lua/modules/configs/editor/treesitter.lua b/lua/modules/configs/editor/treesitter.lua index e9fe90151..5b25ebe95 100644 --- a/lua/modules/configs/editor/treesitter.lua +++ b/lua/modules/configs/editor/treesitter.lua @@ -9,7 +9,10 @@ return vim.schedule_wrap(function() highlight = { enable = true, disable = function(ft, bufnr) - if vim.tbl_contains({ "vim" }, ft) then + if + vim.tbl_contains({ "gitcommit" }, ft) + or (vim.api.nvim_buf_line_count(bufnr) > 7500 and ft ~= "vimdoc") + then return true end @@ -21,6 +24,7 @@ return vim.schedule_wrap(function() textobjects = { select = { enable = true, + lookahead = true, keymaps = { ["af"] = "@function.outer", ["if"] = "@function.inner", @@ -30,7 +34,7 @@ return vim.schedule_wrap(function() }, move = { enable = true, - set_jumps = true, -- whether to set jumps in the jumplist + set_jumps = true, goto_next_start = { ["]["] = "@function.outer", ["]m"] = "@class.outer", @@ -55,8 +59,8 @@ return vim.schedule_wrap(function() require("nvim-treesitter.install").prefer_git = true if use_ssh then local parsers = require("nvim-treesitter.parsers").get_parser_configs() - for _, p in pairs(parsers) do - p.install_info.url = p.install_info.url:gsub("https://github.com/", "git@github.com:") + for _, parser in pairs(parsers) do + parser.install_info.url = parser.install_info.url:gsub("https://github.com/", "git@github.com:") end end end) diff --git a/lua/modules/configs/lang/render-markdown.lua b/lua/modules/configs/lang/render-markdown.lua new file mode 100644 index 000000000..65ad80fec --- /dev/null +++ b/lua/modules/configs/lang/render-markdown.lua @@ -0,0 +1,21 @@ +return function() + require("modules.utils").load_plugin("render-markdown", { + -- Whether Markdown should be rendered by default or not + enabled = true, + -- Maximum file size (in MB) that this plugin will attempt to render + -- Any file larger than this will effectively be ignored + max_file_size = 2.0, + -- Milliseconds that must pass before updating marks, updates occur + -- within the context of the visible window, not the entire buffer + debounce = 100, + -- Vim modes that will show a rendered view of the markdown file + -- All other modes will be uneffected by this plugin + render_modes = { "n", "c", "t" }, + -- This enables hiding any added text on the line the cursor is on + -- This does have a performance penalty as we must listen to the 'CursorMoved' event + anti_conceal = { enabled = true }, + -- The level of logs to write to file: vim.fn.stdpath('state') .. '/render-markdown.log' + -- Only intended to be used for plugin development / debugging + log_level = "error", + }) +end diff --git a/lua/modules/configs/tool/search.lua b/lua/modules/configs/tool/search.lua index e01f50437..ffad69cbc 100644 --- a/lua/modules/configs/tool/search.lua +++ b/lua/modules/configs/tool/search.lua @@ -4,6 +4,7 @@ return function() require("modules.utils").load_plugin("search", { collections = { + -- Search using filenames file = { initial_tab = 1, tabs = { @@ -30,9 +31,16 @@ return function() builtin.oldfiles() end, }, + { + name = "Buffers", + tele_func = function() + builtin.buffers() + end, + }, }, }, - live_grep = { + -- Search using patterns + pattern = { initial_tab = 1, tabs = { { @@ -50,6 +58,7 @@ return function() }, }, }, + -- Search Git objects (branches, commits) git = { initial_tab = 1, tabs = { @@ -79,15 +88,10 @@ return function() }, }, }, - workspace = { + -- Retrieve dossiers + dossier = { initial_tab = 1, tabs = { - { - name = "Buffers", - tele_func = function() - builtin.buffers() - end, - }, { name = "Sessions", tele_func = function() @@ -108,6 +112,7 @@ return function() }, }, }, + -- Miscellaneous misc = { initial_tab = 1, tabs = { @@ -117,6 +122,12 @@ return function() builtin.colorscheme({ enable_preview = true }) end, }, + { + name = "Notify", + tele_func = function() + extensions.notify.notify() + end, + }, { name = "Undo History", tele_func = function() diff --git a/lua/modules/configs/tool/which-key.lua b/lua/modules/configs/tool/which-key.lua index c9d687ee6..e04e70117 100644 --- a/lua/modules/configs/tool/which-key.lua +++ b/lua/modules/configs/tool/which-key.lua @@ -6,66 +6,70 @@ return function() cmp = require("modules.utils.icons").get("cmp", true), } - require("which-key").register({ - [""] = { - b = { - name = icons.ui.Buffer .. " Buffer", - }, - d = { - name = icons.ui.Bug .. " Debug", - }, - f = { - name = icons.ui.Telescope .. " Fuzzy Find", - }, - g = { - name = icons.git.Git .. "Git", - }, - l = { - name = icons.misc.LspAvailable .. " Lsp", - }, - n = { - name = icons.ui.FolderOpen .. " Nvim Tree", - }, - p = { - name = icons.ui.Package .. " Package", - }, - s = { - name = icons.cmp.tmux .. "Session", - }, - S = { - name = icons.ui.Search .. " Search", - }, - W = { - name = icons.ui.Window .. " Window", - }, - }, - }) - require("modules.utils").load_plugin("which-key", { + preset = "classic", + delay = vim.o.timeoutlen, + triggers = { + { "", mode = "nixso" }, + }, plugins = { + marks = true, + registers = true, + spelling = { + enabled = true, + suggestions = 20, + }, presets = { - operators = false, motions = false, - text_objects = false, - windows = false, - nav = false, + operators = false, + text_objects = true, + windows = true, + nav = true, z = true, g = true, }, }, - + win = { + border = "none", + padding = { 1, 2 }, + wo = { winblend = 0 }, + }, + expand = 1, icons = { + group = "", + rules = false, + colors = false, breadcrumb = icons.ui.Separator, separator = icons.misc.Vbar, - group = "", + keys = { + C = "C-", + M = "A-", + S = "S-", + BS = " ", + CR = " ", + NL = " ", + Esc = " ", + Tab = " ", + Up = " ", + Down = " ", + Left = " ", + Right = " ", + Space = " ", + ScrollWheelUp = " ", + ScrollWheelDown = " ", + }, }, - - window = { - border = "none", - position = "bottom", - margin = { 1, 0, 1, 0 }, - padding = { 1, 1, 1, 1 }, - winblend = 0, + spec = { + { "g", group = icons.git.Git .. "Git" }, + { "d", group = icons.ui.Bug .. " Debug" }, + { "s", group = icons.cmp.tmux .. "Session" }, + { "b", group = icons.ui.Buffer .. " Buffer" }, + { "S", group = icons.ui.Search .. " Search" }, + { "W", group = icons.ui.Window .. " Window" }, + { "p", group = icons.ui.Package .. " Package" }, + { "l", group = icons.misc.LspAvailable .. " Lsp" }, + { "f", group = icons.ui.Telescope .. " Fuzzy Find" }, + { "n", group = icons.ui.FolderOpen .. " Nvim Tree" }, }, }) end diff --git a/lua/modules/configs/ui/alpha.lua b/lua/modules/configs/ui/alpha.lua index 73a489c12..befcbd2e3 100644 --- a/lua/modules/configs/ui/alpha.lua +++ b/lua/modules/configs/ui/alpha.lua @@ -39,55 +39,56 @@ return function() end local leader = " " + local icons = { + documents = require("modules.utils.icons").get("documents", true), + git = require("modules.utils.icons").get("git", true), + ui = require("modules.utils.icons").get("ui", true), + misc = require("modules.utils.icons").get("misc", true), + } + dashboard.section.buttons.val = { - button("space f c", " Scheme change", leader, nil, { - noremap = true, - silent = true, - nowait = true, - callback = function() - require("telescope.builtin").colorscheme() - end, - }), - button("space f r", " File frecency", leader, nil, { - noremap = true, - silent = true, - nowait = true, - callback = function() - require("telescope").extensions.frecency.frecency({}) - end, - }), - button("space f e", "󰋚 File history", leader, nil, { - noremap = true, - silent = true, - nowait = true, - callback = function() - require("telescope.builtin").oldfiles() - end, - }), - button("space f p", " Project find", leader, nil, { - noremap = true, - silent = true, - nowait = true, - callback = function() - require("telescope").extensions.projects.projects({}) - end, - }), - button("space f f", "󰈞 File find", leader, nil, { - noremap = true, - silent = true, - nowait = true, - callback = function() - require("telescope.builtin").find_files() - end, - }), - button("space f w", " Word find", leader, nil, { - noremap = true, - silent = true, - nowait = true, - callback = function() - require("telescope.builtin").live_grep() - end, - }), + button( + "space f c", + icons.misc.Neovim .. "Telescope collections", + leader, + nil, + { noremap = true, silent = true, nowait = true } + ), + button( + "space f f", + icons.documents.FileFind .. "Find files", + leader, + nil, + { noremap = true, silent = true, nowait = true } + ), + button( + "space f d", + icons.ui.FolderWithHeart .. "Retrieve dossiers", + leader, + nil, + { noremap = true, silent = true, nowait = true } + ), + button( + "space f p", + icons.documents.Word .. "Find patterns", + leader, + nil, + { noremap = true, silent = true, nowait = true } + ), + button( + "space f g", + icons.git.Git .. "Locate Git objects", + leader, + nil, + { noremap = true, silent = true, nowait = true } + ), + button( + "space f m", + icons.misc.Ghost .. "Miscellaneous artifacts", + leader, + nil, + { noremap = true, silent = true, nowait = true } + ), } dashboard.section.buttons.opts.hl = "AlphaButtons" diff --git a/lua/modules/configs/ui/catppuccin.lua b/lua/modules/configs/ui/catppuccin.lua index b7e933346..56cdfd5e8 100644 --- a/lua/modules/configs/ui/catppuccin.lua +++ b/lua/modules/configs/ui/catppuccin.lua @@ -83,6 +83,7 @@ return function() overseer = false, pounce = false, rainbow_delimiters = true, + render_markdown = true, sandwich = false, semantic_tokens = true, symbols_outline = false, diff --git a/lua/modules/configs/ui/gitsigns.lua b/lua/modules/configs/ui/gitsigns.lua index c70684266..de14cd5f5 100644 --- a/lua/modules/configs/ui/gitsigns.lua +++ b/lua/modules/configs/ui/gitsigns.lua @@ -2,45 +2,22 @@ return function() local mapping = require("keymap.ui") require("modules.utils").load_plugin("gitsigns", { 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", - }, + add = { text = "┃" }, + change = { text = "┃" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + untracked = { text = "┆" }, }, + auto_attach = true, on_attach = mapping.gitsigns, - watch_gitdir = { interval = 1000, follow_files = true }, - current_line_blame = true, - current_line_blame_opts = { delay = 1000, virtual_text_pos = "eol" }, + signcolumn = true, sign_priority = 6, update_debounce = 100, - status_formatter = nil, -- Use default word_diff = false, + current_line_blame = true, diff_opts = { internal = true }, + watch_gitdir = { follow_files = true }, + current_line_blame_opts = { delay = 1000, virt_text = true, virtual_text_pos = "eol" }, }) end diff --git a/lua/modules/configs/ui/lualine.lua b/lua/modules/configs/ui/lualine.lua index c9431b75e..2293570e1 100644 --- a/lua/modules/configs/ui/lualine.lua +++ b/lua/modules/configs/ui/lualine.lua @@ -311,6 +311,7 @@ return function() lualine_x = { { "encoding", + show_bomb = true, fmt = string.upper, padding = { left = 1 }, cond = conditionals.has_enough_room, diff --git a/lua/modules/plugins/completion.lua b/lua/modules/plugins/completion.lua index 6cd6d4e35..b7802ce97 100644 --- a/lua/modules/plugins/completion.lua +++ b/lua/modules/plugins/completion.lua @@ -26,7 +26,7 @@ completion["stevearc/aerial.nvim"] = { event = "LspAttach", config = require("completion.aerial"), } -completion["dnlhc/glance.nvim"] = { +completion["DNLHC/glance.nvim"] = { lazy = true, event = "LspAttach", config = require("completion.glance"), diff --git a/lua/modules/plugins/lang.lua b/lua/modules/plugins/lang.lua index 0a73cfadd..768f10ff9 100644 --- a/lua/modules/plugins/lang.lua +++ b/lua/modules/plugins/lang.lua @@ -21,6 +21,15 @@ lang["Saecki/crates.nvim"] = { config = require("lang.crates"), dependencies = { "nvim-lua/plenary.nvim" }, } +lang["MeanderingProgrammer/render-markdown.nvim"] = { + lazy = true, + ft = "markdown", + config = require("lang.render-markdown"), + dependencies = { + "nvim-tree/nvim-web-devicons", + "nvim-treesitter/nvim-treesitter", + }, +} lang["iamcco/markdown-preview.nvim"] = { lazy = true, ft = "markdown", diff --git a/lua/modules/plugins/tool.lua b/lua/modules/plugins/tool.lua index 711a5c44a..2af4bb937 100644 --- a/lua/modules/plugins/tool.lua +++ b/lua/modules/plugins/tool.lua @@ -109,8 +109,6 @@ tool["nvim-telescope/telescope.nvim"] = { config = require("tool.project"), }, { "nvim-telescope/telescope-bibtex.nvim" }, - { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, - { "nvim-telescope/telescope-bibtex.nvim" }, { "aaronhallaert/advanced-git-search.nvim", cmd = { "AdvancedGitSearch" }, diff --git a/lua/modules/utils/icons.lua b/lua/modules/utils/icons.lua index eab8da2c7..a050401b6 100644 --- a/lua/modules/utils/icons.lua +++ b/lua/modules/utils/icons.lua @@ -62,9 +62,11 @@ local data = { Default = "", File = "", Files = "", + FileFind = "󰈞", FileTree = "󰙅", Import = "", Symlink = "", + Word = "", }, git = { Add = "", diff --git a/nixos/neovim/default.nix b/nixos/neovim/default.nix index 93134d40f..420e7fac3 100644 --- a/nixos/neovim/default.nix +++ b/nixos/neovim/default.nix @@ -4,8 +4,15 @@ , pkgs , ... }: -with lib; let +let cfg = config.programs.neovim.nvimdots; + inherit (lib) flip warn const; + inherit (lib.attrsets) optionalAttrs; + inherit (lib.lists) optionals; + inherit (lib.modules) mkIf; + inherit (lib.options) mkEnableOption mkOption literalExpression; + inherit (lib.strings) concatStringsSep versionOlder versionAtLeast; + inherit (lib.types) listOf coercedTo package functionTo; in { options = { @@ -19,6 +26,15 @@ in Bind lazy-lock.json in your repository to $XDG_CONFIG_HOME/nvim. Very powerful in terms of keeping the environment consistent, but has the following side effects. You cannot update it even if you run the Lazy command, because it binds read-only. + You need to remove lazy-lock.json before enabling this option if `mergeLazyLock` is set. + ''; + mergeLazyLock = mkEnableOption '' + Merges the managed lazy-lock.json with the existing one under $XDG_CONFIG_HOME/nvim if its hash has changed on activation. + Upstream package version changes have high priority. + This means changes to lazy-lock.json in the config directory (likely due to installing package) will be preserved. + In other words, it achieves environment consistency while remaining adaptable to changes. + You need to unlink lazy-lock.json before enabling this option if `bindLazyLock` is set. + Please refer to the wiki for details on the behavior. ''; setBuildEnv = mkEnableOption '' Sets environment variables that resolve build dependencies as required by `mason.nvim` and `nvim-treesitter` @@ -34,9 +50,11 @@ in use Haskell plugins. ''; extraHaskellPackages = mkOption { - type = with types; - let fromType = listOf package; - in coercedTo fromType + type = + let + fromType = listOf package; + in + coercedTo fromType (flip warn const '' Assigning a plain list to extraHaskellPackages is deprecated. Please assign a function taking a package set as argument, so @@ -56,7 +74,7 @@ in ''; }; extraDependentPackages = mkOption { - type = with types; listOf package; + type = listOf package; default = [ ]; example = literalExpression "[ pkgs.openssl ]"; description = "Extra build depends to add `LIBRARY_PATH` and `CPATH`."; @@ -67,33 +85,30 @@ in config = let # Inspired from https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/programs/nix-ld.nix - build-dependent-pkgs = with pkgs; builtins.filter (package: !package.meta.unsupported) [ + build-dependent-pkgs = builtins.filter (package: !package.meta.unsupported) [ # manylinux - acl - attr - bzip2 - curl - glibc - libsodium - libssh - libxml2 - openssl - stdenv.cc.cc - stdenv.cc.cc.lib - systemd - util-linux - xz - zlib - zstd + pkgs.acl + pkgs.attr + pkgs.bzip2 + pkgs.curl + pkgs.glibc + pkgs.libsodium + pkgs.libssh + pkgs.libxml2 + pkgs.openssl + pkgs.stdenv.cc.cc + pkgs.stdenv.cc.cc.lib + pkgs.systemd + pkgs.util-linux + pkgs.xz + pkgs.zlib + pkgs.zstd # Packages not included in `nix-ld`'s NixOSModule - glib - libcxx + pkgs.glib + pkgs.libcxx ] ++ cfg.extraDependentPackages; - makePkgConfigPath = x: makeSearchPathOutput "dev" "lib/pkgconfig" x; - makeIncludePath = x: makeSearchPathOutput "dev" "include" x; - neovim-build-deps = pkgs.buildEnv { name = "neovim-build-deps"; paths = build-dependent-pkgs; @@ -112,19 +127,37 @@ in ]; in mkIf cfg.enable { + assertions = [ + { + assertion = ! (cfg.bindLazyLock && cfg.mergeLazyLock); + message = "bindLazyLock and mergeLazyLock cannot be enabled at the same time."; + } + ]; xdg.configFile = { "nvim/init.lua".source = ../../init.lua; "nvim/lua".source = ../../lua; "nvim/snips".source = ../../snips; "nvim/tutor".source = ../../tutor; - } // lib.optionalAttrs cfg.bindLazyLock { + } // optionalAttrs cfg.bindLazyLock { "nvim/lazy-lock.json".source = ../../lazy-lock.json; + } // optionalAttrs cfg.mergeLazyLock { + "nvim/lazy-lock.fixed.json" = { + source = ../../lazy-lock.json; + onChange = '' + if [ -f ${config.xdg.configHome}/nvim/lazy-lock.json ]; then + tmp=$(mktemp) + ${pkgs.jq}/bin/jq -r -s '.[0] * .[1]' ${config.xdg.configHome}/nvim/lazy-lock.json ${config.xdg.configFile."nvim/lazy-lock.fixed.json".source} > "''${tmp}" && mv "''${tmp}" ${config.xdg.configHome}/nvim/lazy-lock.json + else + ${pkgs.rsync}/bin/rsync --chmod 644 ${config.xdg.configFile."nvim/lazy-lock.fixed.json".source} ${config.xdg.configHome}/nvim/lazy-lock.json + fi + ''; + }; }; home = { - packages = with pkgs; [ - ripgrep + packages = [ + pkgs.ripgrep ]; - shellAliases = optionalAttrs (cfg.setBuildEnv && (lib.versionOlder config.home.stateVersion "24.05")) { + shellAliases = optionalAttrs (cfg.setBuildEnv && (versionOlder config.home.stateVersion "24.05")) { nvim = concatStringsSep " " buildEnv + " nvim"; }; }; @@ -134,33 +167,32 @@ in withNodeJs = true; withPython3 = true; - extraPackages = with pkgs; - [ - # Dependent packages used by default plugins - doq - tree-sitter - ] - ++ optionals cfg.withBuildTools [ - cargo - clang - cmake - gcc - gnumake - go - lua51Packages.luarocks - ninja - pkg-config - yarn - ] - ++ optionals cfg.withHaskell [ - (pkgs.writeShellApplication { - name = "stack"; - text = '' - exec "${pkgs.stack}/bin/stack" "--extra-include-dirs=${config.home.profileDirectory}/lib/nvim-depends/include" "--extra-lib-dirs=${config.home.profileDirectory}/lib/nvim-depends/lib" "$@" - ''; - }) - (haskellPackages.ghcWithPackages (ps: cfg.extraHaskellPackages ps)) - ]; + extraPackages = [ + # Dependent packages used by default plugins + pkgs.doq + pkgs.tree-sitter + ] + ++ optionals cfg.withBuildTools [ + pkgs.cargo + pkgs.clang + pkgs.cmake + pkgs.gcc + pkgs.gnumake + pkgs.go + pkgs.lua51Packages.luarocks + pkgs.ninja + pkgs.pkg-config + pkgs.yarn + ] + ++ optionals cfg.withHaskell [ + (pkgs.writeShellApplication { + name = "stack"; + text = '' + exec "${pkgs.stack}/bin/stack" "--extra-include-dirs=${config.home.profileDirectory}/lib/nvim-depends/include" "--extra-lib-dirs=${config.home.profileDirectory}/lib/nvim-depends/lib" "$@" + ''; + }) + (pkgs.haskellPackages.ghcWithPackages (ps: cfg.extraHaskellPackages ps)) + ]; extraPython3Packages = ps: with ps; [ docformatter @@ -168,8 +200,8 @@ in pynvim ]; } - // lib.optionalAttrs (lib.versionAtLeast config.home.stateVersion "24.05") { - extraWrapperArgs = lib.optionals cfg.setBuildEnv [ + // optionalAttrs (versionAtLeast config.home.stateVersion "24.05") { + extraWrapperArgs = optionals cfg.setBuildEnv [ "--suffix" "CPATH" ":" diff --git a/tutor/dots.tutor b/tutor/dots.tutor index 7def1078d..c4232b100 100644 --- a/tutor/dots.tutor +++ b/tutor/dots.tutor @@ -1,6 +1,6 @@ # Welcome to the nvimdots Tutor -Nvimdots is a [neovim](https://neovim.io/) config suite designed for extensibility, performance, and ease +Nvimdots is a [Neovim](https://neovim.io/) config suite designed for extensibility, performance, and ease of use. It provides the ability to work with text files yet feels like you are working within an IDE environment. @@ -64,7 +64,7 @@ Consequently, this segment of the status line provides insight into the context your cursor position. It's important to note that this feature relies on LSP, so it is disabled if the corresponding LSP is not attached to the current buffer. -You can press `li`{normal} to check LSP info. Upon doing so, you will notice that +You can press ``{normal}`l`{normal}`i`{normal} to check LSP info. Upon doing so, you will notice that there are two active clients attached to this buffer. Now, press [go](go) to toggle the code outline, which displays all symbols defined in @@ -85,32 +85,33 @@ to the next topic, which covers the basic workflow. # Lesson 1.2: FIND AND SEARCH -Nvimdots utilizes [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) as the primary fuzzy finder. It offers numerous -features for finding and searching. To open the file finder under the current -working directory, press `ff`{normal}. Then, input the keyword you wish to find and use -``{normal} and ``{normal} to navigate up and down the list of results. You can preview the -content of the selected file in the right window and press ``{normal} to open it -in a new buffer. - -Nvimdots also provide several additional search features. One commonly used keymap is -`fr`{normal}, especially if you frequently edit files across different projects. This -command lists files you have previously opened and sorts them by "frecency," a -concept similar to that used in Firefox's address bar. This feature utilizes "Lua -Bytecode" to permanently store the key-value pairs of file paths and their "frecency" -values at **~/.local/share/nvim/file_frecency.bin**. - -You can press `fw`{normal} to search for a word in the current working directory. This -feature utilizes [ripgrep](https://github.com/BurntSushi/ripgrep) for searching, allowing you to use it naturally as you would -with ripgrep. - -Nvimdots also provides project management features and integrates them seamlessly -with telescope. Press `fp`{normal} to open the recent project list. Please refrain from -quitting this interface; instead, you can add the current working directory to the -project list by pressing ``{normal}, and remove it by pressing ``{normal}. Typically, the -current working directory corresponds to the project directory, which is identified -by LSP and patterns such as *.git/*. However, you have the flexibility to set your own -patterns. Consequently, the project directory will automatically change when you -switch to another buffer whose file belongs to a different project. +Nvimdots utilizes [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) as the primary fuzzy finder, offering numerous +features for efficient finding and searching. To access the "file finder collection" +within the current working directory, press ``{normal}`f`{normal}`f`{normal}. Subsequently, enter the +desired keyword and use ``{normal} and ``{normal} to navigate through the list of results. The +content of the selected file can be previewed in the adjacent window, and pressing +``{normal} will open it in a new buffer. Additionally, ``{normal} and ``{normal} allow you to +switch between various tabs to locate files with different properties. For instance, +the "Frecency" and "Oldfiles" tabs enable searches based on the most frequently and +recently opened files, respectively, while the "Buffers" tab facilitates searches +among currently opened buffers. + +For pattern searches within the current working directory, press ``{normal}`f`{normal}`p`{normal}. This +functionality leverages [ripgrep](https://github.com/BurntSushi/ripgrep) for its search capabilities, making it as intuitive +to use as ripgrep itself. As with the "file finder collection", ``{normal} and ``{normal} can +be used to cycle through the search tabs. The "Word under cursor" tab displays all +instances of the word located under the current cursor position. + +Nvimdots also offers comprehensive dossier management, seamlessly integrated with +Telescope. Press ``{normal}`f`{normal}`d`{normal} to access the recent dossiers list. The first tab +presents the currently saved sessions; select a session and press ``{normal} to restore +the corresponding session. The second tab lists various projects. Instead of exiting +this interface, you can add the current working directory to the project list by +pressing ``{normal}, and remove it by pressing ``{normal}. Generally, the current working +directory corresponds to the current project's directory, identified by the LSP or +patterns such as *.git/*. You can also define your own patterns. Consequently, the +current working directory will automatically switch when you move to another buffer +containing a file from a different project. # Lesson 1.3: EDIT AND FORMAT