diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..9e3f87b8 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,19 @@ +core: + - all: + - changed-files: + - any-glob-to-any-file: "lua/lazyvim/**" + - all-globs-to-all-files: "!lua/lazyvim/plugins/**" + +core-plugins: + - all: + - changed-files: + - any-glob-to-any-file: "lua/lazyvim/plugins/**" + - all-globs-to-all-files: "!lua/lazyvim/plugins/extras/**" + +extras: + - changed-files: + - any-glob-to-any-file: "lua/lazyvim/plugins/extras/**" + +extras-lang: + - changed-files: + - any-glob-to-any-file: "lua/lazyvim/plugins/extras/lang/**" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b36e4c7..fddf82ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,16 @@ on: pull_request: jobs: + stylua: + name: Stylua Formatting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: JohnnyMorganz/stylua-action@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: latest + args: --check . tests: strategy: matrix: @@ -25,7 +35,7 @@ jobs: run: | nvim --version [ ! -d tests ] && exit 0 - nvim --headless -u tests/init.lua -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/init.lua', sequential = true}" + ./tests/run docs: runs-on: ubuntu-latest needs: tests @@ -54,13 +64,10 @@ jobs: - tests runs-on: ubuntu-latest steps: - - uses: google-github-actions/release-please-action@v4 + - uses: googleapis/release-please-action@v4 id: release with: release-type: simple - package-name: LazyVim - extra-files: | - lua/lazyvim/config/init.lua - uses: actions/checkout@v4 - name: tag stable versions if: ${{ steps.release.outputs.release_created }} diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 00000000..52474c6a --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,12 @@ +name: "Pull Request Labeler" +on: + - pull_request_target + +jobs: + labeler: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v5 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..0401a4d8 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,41 @@ +name: "Lint PR" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +permissions: + pull-requests: read + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + requireScope: true + subjectPattern: ^(?![A-Z]).+$ + scopes: | + .+ + types: | + build + chore + ci + docs + feat + fix + merge + perf + refactor + revert + style + test + wip + ignoreLabels: | + autorelease: pending diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..9ebbb312 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,27 @@ +name: Close stale issues and PRs + +on: + workflow_dispatch: + schedule: + - cron: "30 1 * * *" + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v9 + with: + operations-per-run: 300 + # default stale time + days-before-stale: 30 + days-before-close: 7 + # never stale pull requests + # days-before-pr-stale: -1 + days-before-pr-close: -1 + # exclude issues with certain labels + exempt-issue-labels: pinned,wip,security,notice + # never stale issues attached to a milestone + # exempt-all-milestones: true + stale-issue-message: "This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days." + stale-pr-message: "This PR is stale because it has been open 60 days with no activity." + close-issue-message: "This issue was closed because it has been stalled for 7 days with no activity." diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e2899c6..0ee7de6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,35 @@ # Changelog +## [12.5.0](https://github.com/LazyVim/LazyVim/compare/v12.4.0...v12.5.0) (2024-06-05) + + +### Features + +* **bufferline:** add keymaps for BufferLineMovePrev / BufferLineMoveNext ([#1935](https://github.com/LazyVim/LazyVim/issues/1935)) ([1806ea7](https://github.com/LazyVim/LazyVim/commit/1806ea710fe391d5b00c1916ed9331bf58cfdb49)) +* **editor:** added extra for inc-rename.nvim ([#3432](https://github.com/LazyVim/LazyVim/issues/3432)) ([c50018b](https://github.com/LazyVim/LazyVim/commit/c50018b791a6295fb0f3219fe637209a381db4c4)) +* enabled `ts-plugin` support for `astro` and `svelte` ([d64d761](https://github.com/LazyVim/LazyVim/commit/d64d7615392d70c2ca1957f66725856d0a306b87)) +* **extras:** Add extra for angular lspconfig ([#2806](https://github.com/LazyVim/LazyVim/issues/2806)) ([987bd22](https://github.com/LazyVim/LazyVim/commit/987bd2207f7f2f7f72f65b0e7e811ec04c03aa32)) +* **keymaps:** add keymap to close all tab pages except the current one ([#2975](https://github.com/LazyVim/LazyVim/issues/2975)) ([de9e337](https://github.com/LazyVim/LazyVim/commit/de9e337f0dcd27a7621f6ab741ad3a5d769dbd7c)) +* **lazydev:** use lazydev with neodev types (not the plugin) on Neovim 0.9.x ([1677b3b](https://github.com/LazyVim/LazyVim/commit/1677b3b84f53d410d50c5a2aca32ca7c5e900917)) +* **python:** switch to regexp branch for a rewrite the venv selector plugin ([#3301](https://github.com/LazyVim/LazyVim/issues/3301)) ([1cdb5bd](https://github.com/LazyVim/LazyVim/commit/1cdb5bdf412933bb1be44a3ae5905202124718d9)) +* **statuscol:** statuscolumn options for open fold indicator and fold hl ([#2923](https://github.com/LazyVim/LazyVim/issues/2923)) ([fa706b3](https://github.com/LazyVim/LazyVim/commit/fa706b320b4c94da28136bdbab2ee1841974707c)) + + +### Bug Fixes + +* cleanup unnecessary treesitter langs and mason lsp servers ([f8268fa](https://github.com/LazyVim/LazyVim/commit/f8268faa7c705cca7047fbaef5984905b47a7324)) +* **extra.lang.scala:** Fix the always initializing regardless of file… ([#3455](https://github.com/LazyVim/LazyVim/issues/3455)) ([c1f5fcf](https://github.com/LazyVim/LazyVim/commit/c1f5fcf9c7ed2659c9d5ac41b3bb8a93e0a3c6a0)) +* **extras:** added recommended for helm/haskell ([ca0b9ee](https://github.com/LazyVim/LazyVim/commit/ca0b9ee915c7e5ddc4ca828688c2cb87f4f0c438)) +* **keymaps:** use root dir for git log ([662e2ff](https://github.com/LazyVim/LazyVim/commit/662e2ffe0ff8f43e15cf97029a5e1ec84bb1e376)) +* **lazydev:** add cmd ([ae0d94e](https://github.com/LazyVim/LazyVim/commit/ae0d94e048423903743b657be3a827d9685761c3)) +* **lsp:** Enable using `deno.enablePaths` in denols settings ([#3446](https://github.com/LazyVim/LazyVim/issues/3446)) ([9a635ef](https://github.com/LazyVim/LazyVim/commit/9a635ef8d690a3cfcf6d3bf54e8ad61156b9d150)) +* **python:** removed the `python-semshi` extra ([e32d191](https://github.com/LazyVim/LazyVim/commit/e32d1918ae676dbab3f5f121a9fa623cb4ee20bd)) +* **tex:** remove latex treesitter support since it's not needed with vimtex and it needs treesitter-cli ([3df8af3](https://github.com/LazyVim/LazyVim/commit/3df8af369c49e13763a7c8962a005aef7604d018)) +* **toggle:** Restore width/height values when closing while maximized is toggled on ([#3453](https://github.com/LazyVim/LazyVim/issues/3453)) ([8971ea2](https://github.com/LazyVim/LazyVim/commit/8971ea25f953f778c8db999da4de240a07713aaa)) +* **toggle:** slightly better maximize ([452b70a](https://github.com/LazyVim/LazyVim/commit/452b70ad15714593a91bed90448313228dd5135a)) +* **toggle:** un-maximize when quiting Neovim ([1c58365](https://github.com/LazyVim/LazyVim/commit/1c583650e66b6f468e8ece4292bfe8bd3f7e1c94)) +* **util:** don't print warning message in headless ([73c767c](https://github.com/LazyVim/LazyVim/commit/73c767c2f3e43cf7edd2964f951b7e574ee5b283)) + ## [12.4.0](https://github.com/LazyVim/LazyVim/compare/v12.3.0...v12.4.0) (2024-06-04) diff --git a/README-JP.md b/README-JP.md new file mode 100644 index 00000000..316ede80 --- /dev/null +++ b/README-JP.md @@ -0,0 +1,139 @@ +
+ +
+ +
+ +

+ インストール + · + 設定 + · + ドキュメント +

+ +

+ + Latest release + + + Last commit + + + License + + + Stars + + + Issues + + + Repo Size + + + follow on Twitter + +

+ +LazyVimは、設定の拡張と変更を容易にするために[💤 lazy.nvim](https://github.com/folke/lazy.nvim)によって提供されるNeovimセットアップです。 +LazyVimは、ゼロから始めるか、あらかじめ作成されたディストリビューションを使用するかの選択を迫ることなく、 +必要に応じて設定を調整する柔軟性と、事前に設定されたセットアップの利便性を両方叶える最高の世界を提供します。 + +![image](https://user-images.githubusercontent.com/292349/211285846-0b7bb3bf-0462-4029-b64c-4ee1d037fc1c.png) + +![image](https://user-images.githubusercontent.com/292349/213447056-92290767-ea16-430c-8727-ce994c93e9cc.png) + +## ✨ 機能 + +- 🔥 Neovimを本格的なIDEへと変身させます +- 💤 [lazy.nvim](https://github.com/folke/lazy.nvim)で簡単にカスタマイズと拡張が可能 +- 🚀 驚くほどの高速さ +- 🧹 Options, autocmds, そしてkeymapsのための合理的なデフォルト設定 +- 📦 事前に設定がされ、使用可能なプラグインが豊富についてきます + +## ⚡️ 必要要件 + +- Neovim >= **0.9.0** (**LuaJIT**でビルドされている必要があります) +- Git >= **2.19.0** (部分的なcloneサポートのため) +- [Nerd Font](https://www.nerdfonts.com/) **_(任意)_** +- `nvim-treesitter`用の**C**コンパイラ。詳細は[こちら](https://github.com/nvim-treesitter/nvim-treesitter#requirements) + +## 🚀 Getting Started + +**lazyvim**のスターターテンプレートは[こちら](https://github.com/lazyvim/starter)。 + +
Dockerで試す + +```sh +docker run -w /root -it --rm alpine:edge sh -uelic ' + apk add git lazygit neovim ripgrep alpine-sdk --update + git clone https://github.com/LazyVim/starter ~/.config/nvim + cd ~/.config/nvim + nvim +' +``` + +
+ +
LazyVim Starterをインストール + +- 既存のNeovimファイルのバックアップを作成します。 + + ```sh + mv ~/.config/nvim ~/.config/nvim.bak + mv ~/.local/share/nvim ~/.local/share/nvim.bak + ``` + +- スターターをcloneします。 + + ```sh + git clone https://github.com/LazyVim/starter ~/.config/nvim + ``` + +- 後ほど自分のリポジトリに加えられるように、`.git`フォルダを削除します。 + ```sh + rm -rf ~/.config/nvim/.git + ``` + +- Neovimを起動します! + + ```sh + nvim + ``` + + **LazyVim**をカスタマイズするために、ファイルのコメントを参照してください。 + +
+ +--- + +[@elijahmanor](https://github.com/elijahmanor)氏によって作成された始めるにあたっての概要動画があります。 + +[![動画を見る](https://img.youtube.com/vi/N93cTbtLCIM/hqdefault.jpg)](https://www.youtube.com/watch?v=N93cTbtLCIM) + +## 📂 ファイル構造 + +config配下にあるファイルは適切なタイミングで自動的にロードされる為、 +手動でそれらのファイルをrequireする必要はありません。 +LazyVimには、自分で設定したものより先にロードされるデフォルトの設定ファイルが付属しています。詳しくは[こちら](https://github.com/LazyVim/LazyVim/tree/main/lua/lazyvim/config)。 +カスタムプラグインをlua/plugins/の下に追加することができます。lua/plugins/配下の全てのファイルは[lazy.nvim](https://github.com/folke/lazy.nvim)によって自動的にロードされます。 + +
+~/.config/nvim
+├── lua
+│   ├── config
+│   │   ├── autocmds.lua
+│   │   ├── keymaps.lua
+│   │   ├── lazy.lua
+│   │   └── options.lua
+│   └── plugins
+│       ├── spec1.lua
+│       ├── **
+│       └── spec2.lua
+└── init.lua
+
+ +## ⚙️ 設定 + +こちらの[ドキュメント](https://lazyvim.github.io)を参照してください。 diff --git a/README-KO.md b/README-KO.md new file mode 100644 index 00000000..eb5cdb1d --- /dev/null +++ b/README-KO.md @@ -0,0 +1,139 @@ +
+ +
+ +
+ +

+ 설치하기 + · + 설정하기 + · + 문서 +

+ +

+ + 최신 업데이트 + + + 마지막 커밋 + + + 라이센스 + + + 스타 + + + 이슈 + + + 레파지토리 크기 + + + 트위터 + +

+ +LazyVim은 [💤 lazy.nvim](https://github.com/folke/lazy.nvim)를 기반으로 작동하는 Neovim 셋업입니다. 더 커스터마이징 가능하고, 설정들을 바꾸는 것을 쉽게 만들기위해 시작되었죠. 그저 처음부터 모든 설정들을 만지고 시작하는 방법, 또는 이미 만들어진 배포용 설정을 사용하는 방법이 있지만, LazyVIM은 이미 잘 설정된 환경과, 필요에 따라 쉽게 바꿀 수 있는 유연성을 모두 포괄합니다. 이를 통해 훨신 쉽고 편리한, 전에는 만나보실 수 없었던 새로운 Nvim의 세계를 경험하실 수 있으실 겁니다. + +![image](https://user-images.githubusercontent.com/292349/211285846-0b7bb3bf-0462-4029-b64c-4ee1d037fc1c.png) + +![image](https://user-images.githubusercontent.com/292349/213447056-92290767-ea16-430c-8727-ce994c93e9cc.png) + +## ✨ 기능 + +- 🔥 Neovim을 완벽한 IDE로 바꾸어보세요. +- 💤 lazy.vim과 함께 쉽게 커스터마이징하고, 확장하세요. +- 🚀 완전히 빠른 속도를 경험해보세요. +- 🧹 기본적으로 만져져있는 옵션, 자동커멘드, 그리고 단축키들을 아무런 추가적인 설정없이 사용해보세요. +- 📦 안정적이고 미리 설정되어져있는 플러그인들과 함게 코딩하세요. + +## ⚡️ 요구사항 + +- **0.9.0**이상의 Neovim (LuaJIT과 함께 개발이 되어져있어야함니다.) +- **2.19.0**이상의 Git (이것은 부분적인 클론기능을 지원하기 위함입니다.) +- [Nerd Font](https://www.nerdfonts.com/) **_(옵션)_** +- `nvim-treesitter`를 위한 **C** 컴파일러. [이 문서](https://github.com/nvim-treesitter/nvim-treesitter#requirements)를 확인해주시기바랍니다. + +## 🚀 시작하기 + +[이 깃헙 레파지토리](https://github.com/LazyVim/starter)에서 스타터 템플릿을 찾으실 수 있습니다. + +
도커와 함께 시작해보기 + +```sh +docker run -w /root -it --rm alpine:edge sh -uelic ' + apk add git lazygit neovim ripgrep alpine-sdk --update + git clone https://github.com/LazyVim/starter ~/.config/nvim + cd ~/.config/nvim + nvim +' +``` + +
+ +
LazyVim 스타터와 함께 시작해보기 + +- 현재 Neovim 파일들을 미리 백업: + + ```sh + mv ~/.config/nvim ~/.config/nvim.bak + mv ~/.local/share/nvim ~/.local/share/nvim.bak + ``` + +- Lazyvim 스타터 깃헙 레파지토리 복제: + + ```sh + git clone https://github.com/LazyVim/starter ~/.config/nvim + ``` + +- 나중에 본인의 레파지토리에 저장할 경우를 대비해 .git 폴더 지우기 + + ```sh + rm -rf ~/.config/nvim/.git + ``` + +- Neovim! + + ```sh + nvim + ``` + + LazyVim를 커스터마이징 하는 법에 대해 다룬 설명을 참조해주시기 바랍니다. + +
+ +--- + +유튜브에 LazyVim시작하기에 대해 [@elijahmanor](https://github.com/elijahmanor)에 의해 만들어진 영상이 있으니, 시청해 보시는 것을 추천드립니다. + +[![Watch the video](https://img.youtube.com/vi/N93cTbtLCIM/hqdefault.jpg)](https://www.youtube.com/watch?v=N93cTbtLCIM) + +## 📂 파일 구조 + +config 폴더 안에 있는 모든 파일들은 적절한 시간내에 자동으로 로드가 되기에, 아무 파일도 require를 하지 않아도 됩니다. **LazyVim**은 config폴더 안에 있는 모든 기본 파일들을 당신의 config 파일들 **전**에 불어옵니다. 이것에 대해서는, [이 문서](https://github.com/LazyVim/LazyVim/tree/main/lua/lazyvim/config)를 확인해 보시기 바랍니다. + +추가적인 플러그인을 설치하시거나, 미리 설치되고 설정된 플러그인들을 또 덮어서 설정을 바꾸거나, 지우거나, 추가하고 싶으실 경우에는, 그에 해당하는 lua 파일들을 `lua/plugins` 폴더 안에 추가하시면, lazy.nvim이 자동적으로 그 파일들을 로드 할 것입니다. + +
+~/.config/nvim
+├── lua
+│   ├── config
+│   │   ├── autocmds.lua
+│   │   ├── keymaps.lua
+│   │   ├── lazy.lua
+│   │   └── options.lua
+│   └── plugins
+│       ├── spec1.lua
+│       ├── **
+│       └── spec2.lua
+└── init.lua
+
+ +## ⚙️ 설정 + +[Lazyvim 공식문서](https://lazyvim.github.io)를 확인해 주시기 바랍니다. + +LazyVim 공식문서의 한국어 지원은 현재 번역 중에 있습니다. diff --git a/README-PT.md b/README-PT.md new file mode 100644 index 00000000..7fb8572e --- /dev/null +++ b/README-PT.md @@ -0,0 +1,146 @@ +
+ +
+ +
+ +

+ Instalar + · + Configurar + · + Documentação +

+ +

+ + Latest release + + + Last commit + + + License + + + Stars + + + Issues + + + Repo Size + + + follow on Twitter + +

+ +LazyVim é uma configuração de Neovim potenciada por [💤 lazy.nvim](https://github.com/folke/lazy.nvim) +para tornar fácil customizar e extender a tua configuração. +Em vez de ter de escolher entre começar de raiz ou usar +uma distribuição pré-feita, LazyVim oferece o melhor +dos dois mundos - a flexibilidade de alterar a tua configuração +como necessário, junto com a conveniência de um setup pré-configurado. + +![imagem](https://user-images.githubusercontent.com/292349/211285846-0b7bb3bf-0462-4029-b64c-4ee1d037fc1c.png) + +![imagem](https://user-images.githubusercontent.com/292349/213447056-92290767-ea16-430c-8727-ce994c93e9cc.png) + +## ✨ Características + +- 🔥 Transforma o teu Neovim num IDE completo. +- 💤 Customiza e extende a tua configuração facilmente com [lazy.nvim](https://github.com/folke/lazy.nvim) +- 🚀 Super rápido +- 🧹 Definições comuns para options, autocms e keymaps +- 📦 Contém uma variedade de plugins pré-configurados e preparados a usar + +## ⚡️ Requesitos + +- Neovim >= **0.9.0** (preciso fazer build com **LuaJIT**) +- Git >= **2.19.0** (para suporte parcial de clones) +- uma [Nerd Font](https://www.nerdfonts.com/) **_(opcional)_** +- um compilador de **C** para `nvim-treesitter`. Mais informações [aqui](https://github.com/nvim-treesitter/nvim-treesitter#requirements) + +## 🚀 Como Começar + +Podes encontrar uma template **LazyVim** starter para começar, [aqui](https://github.com/LazyVim/starter) + +
Experimenta com docker + +```sh +docker run -w /root -it --rm alpine:edge sh -uelic ' + apk add git lazygit neovim ripgrep alpine-sdk --update + git clone https://github.com/LazyVim/starter ~/.config/nvim + cd ~/.config/nvim + nvim +' +``` + +
+ +
Instala a template LazyVim Starter + +- Faz um backup da tua configuração atual de Neovim: + + ```sh + mv ~/.config/nvim ~/.config/nvim.bak + mv ~/.local/share/nvim ~/.local/share/nvim.bak + ``` + +- Clona a template + + ```sh + git clone https://github.com/LazyVim/starter ~/.config/nvim + ``` + +- Remove o diretório `.git`, para poderes adicionar ao teu próprio repositório mais tarde + + ```sh + rm -rf ~/.config/nvim/.git + ``` + +- Inicia o Neovim! + + ```sh + nvim + ``` + + Consulta os comentários nos ficheiros sobre como customizar **LazyVim**. + +
+ +--- + +Existe um excelente video criado por [@elijahmanor](https://github.com/elijahmanor) com um passo a passo para começar. + +[![Vê o video](https://img.youtube.com/vi/N93cTbtLCIM/hqdefault.jpg)](https://www.youtube.com/watch?v=N93cTbtLCIM) + +## 📂 Extrutura de ficheiros + +Os ficheiros no diretório **config** serão carregados automaticamente +no momento apropriado, por isso não é necessário carregar os plugins manualmente. +**LazyVim** vem com um conjunto de ficheiros +que serão carregados **_antes_** dos teus. Lẽ mais [aqui](https://github.com/LazyVim/LazyVim/tree/main/lua/lazyvim/config) + +Tu podes acrescentar a tua configuração em `lua/plugins`. Todos os ficheiros +neste diretório serão carregados automaticamente por [lazy.nvim](https://github.com/folke/lazy.nvim) + +
+~/.config/nvim
+├── lua
+│   ├── config
+│   │   ├── autocmds.lua
+│   │   ├── keymaps.lua
+│   │   ├── lazy.lua
+│   │   └── options.lua
+│   └── plugins
+│       ├── spec1.lua
+│       ├── **
+│       └── spec2.lua
+└── init.lua
+
+ +## ⚙️ Configuração + +Consulta a [documentação](https://lazyvim.github.io) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 2bb782fc..768a41b8 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -141,8 +141,11 @@ map("n", "gf", function() end, { desc = "Lazygit Current File History" }) map("n", "gl", function() - LazyVim.lazygit({ args = { "log" } }) + LazyVim.lazygit({ args = { "log" }, cwd = LazyVim.root.git() }) end, { desc = "Lazygit Log" }) +map("n", "gL", function() + LazyVim.lazygit({ args = { "log" } }) +end, { desc = "Lazygit Log (cwd)" }) -- quit map("n", "qq", "qa", { desc = "Quit All" }) @@ -182,6 +185,7 @@ map("n", "m", function() LazyVim.toggle.maximize() end, { desc = "Maximi -- tabs map("n", "l", "tablast", { desc = "Last Tab" }) +map("n", "o", "tabonly", { desc = "Close Other Tabs" }) map("n", "f", "tabfirst", { desc = "First Tab" }) map("n", "", "tabnew", { desc = "New Tab" }) map("n", "]", "tabnext", { desc = "Next Tab" }) diff --git a/lua/lazyvim/plugins/extras/lang/ansible.lua b/lua/lazyvim/plugins/extras/lang/ansible.lua index 5f080395..0a3987a6 100644 --- a/lua/lazyvim/plugins/extras/lang/ansible.lua +++ b/lua/lazyvim/plugins/extras/lang/ansible.lua @@ -5,14 +5,6 @@ return { root = { "ansible.cfg", ".ansible-lint" }, }) end, - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - if type(opts.ensure_installed) == "table" then - vim.list_extend(opts.ensure_installed, { "yaml" }) - end - end, - }, { "williamboman/mason.nvim", opts = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/lang/clangd.lua b/lua/lazyvim/plugins/extras/lang/clangd.lua index 86a1afe7..f9fb1f13 100644 --- a/lua/lazyvim/plugins/extras/lang/clangd.lua +++ b/lua/lazyvim/plugins/extras/lang/clangd.lua @@ -18,7 +18,7 @@ return { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) if type(opts.ensure_installed) == "table" then - vim.list_extend(opts.ensure_installed, { "c", "cpp" }) + vim.list_extend(opts.ensure_installed, { "cpp" }) end end, }, diff --git a/lua/lazyvim/plugins/extras/lang/elixir.lua b/lua/lazyvim/plugins/extras/lang/elixir.lua index a6b9c260..503dbbed 100644 --- a/lua/lazyvim/plugins/extras/lang/elixir.lua +++ b/lua/lazyvim/plugins/extras/lang/elixir.lua @@ -15,14 +15,6 @@ return { }) end, }, - { - "williamboman/mason.nvim", - opts = function(_, opts) - vim.list_extend(opts.ensure_installed, { - "elixir-ls", - }) - end, - }, { "nvim-neotest/neotest", optional = true, diff --git a/lua/lazyvim/plugins/extras/lang/haskell.lua b/lua/lazyvim/plugins/extras/lang/haskell.lua index be1636bf..5ec5a5ec 100644 --- a/lua/lazyvim/plugins/extras/lang/haskell.lua +++ b/lua/lazyvim/plugins/extras/lang/haskell.lua @@ -1,4 +1,10 @@ return { + recommended = function() + return LazyVim.extras.wants({ + ft = { "haskell", "lhaskell" }, + root = { "hie.yaml", "stack.yaml", "cabal.project", "*.cabal", "package.yaml" }, + }) + end, -- Add Haskell to treesitter { diff --git a/lua/lazyvim/plugins/extras/lang/helm.lua b/lua/lazyvim/plugins/extras/lang/helm.lua index 3f1fe00d..566e7975 100644 --- a/lua/lazyvim/plugins/extras/lang/helm.lua +++ b/lua/lazyvim/plugins/extras/lang/helm.lua @@ -9,6 +9,13 @@ LazyVim.lsp.on_attach(function(client, buffer) end) return { + recommended = function() + return LazyVim.extras.wants({ + ft = "helm", + root = "Chart.yaml", + }) + end, + { "towolf/vim-helm", ft = "helm" }, { "neovim/nvim-lspconfig", @@ -19,12 +26,4 @@ return { }, }, }, - { - "williamboman/mason.nvim", - opts = function(_, opts) - vim.list_extend(opts.ensure_installed, { - "helm-ls", - }) - end, - }, } diff --git a/lua/lazyvim/plugins/extras/lang/json.lua b/lua/lazyvim/plugins/extras/lang/json.lua index 3f1de268..688432ec 100644 --- a/lua/lazyvim/plugins/extras/lang/json.lua +++ b/lua/lazyvim/plugins/extras/lang/json.lua @@ -11,7 +11,7 @@ return { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) if type(opts.ensure_installed) == "table" then - vim.list_extend(opts.ensure_installed, { "json", "json5", "jsonc" }) + vim.list_extend(opts.ensure_installed, { "json5" }) end end, }, diff --git a/lua/lazyvim/plugins/extras/lang/markdown.lua b/lua/lazyvim/plugins/extras/lang/markdown.lua index 81f4cc88..fe7c8be4 100644 --- a/lua/lazyvim/plugins/extras/lang/markdown.lua +++ b/lua/lazyvim/plugins/extras/lang/markdown.lua @@ -15,19 +15,11 @@ return { }, }, }, - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - if type(opts.ensure_installed) == "table" then - vim.list_extend(opts.ensure_installed, { "markdown", "markdown_inline" }) - end - end, - }, { "williamboman/mason.nvim", opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "markdownlint", "marksman" }) + vim.list_extend(opts.ensure_installed, { "markdownlint" }) end, }, { diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index 7a716b3e..8e4f942d 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -26,7 +26,7 @@ return { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) if type(opts.ensure_installed) == "table" then - vim.list_extend(opts.ensure_installed, { "ninja", "python", "rst", "toml" }) + vim.list_extend(opts.ensure_installed, { "ninja", "rst" }) end end, }, @@ -112,20 +112,17 @@ return { }, { "linux-cultist/venv-selector.nvim", + branch = "regexp", -- Use this branch for the new version cmd = "VenvSelect", - opts = function(_, opts) - if LazyVim.has("nvim-dap-python") then - opts.dap_enabled = true - end - return vim.tbl_deep_extend("force", opts, { - name = { - "venv", - ".venv", - "env", - ".env", + opts = { + settings = { + options = { + notify_user_on_venv_activation = true, }, - }) - end, + }, + }, + -- Call config for python files and load the cached venv automatically + ft = "python", keys = { { "cv", ":VenvSelect", desc = "Select VirtualEnv", ft = "python" } }, }, { diff --git a/lua/lazyvim/plugins/extras/lang/r.lua b/lua/lazyvim/plugins/extras/lang/r.lua index 49b3dd9c..b8279e8a 100644 --- a/lua/lazyvim/plugins/extras/lang/r.lua +++ b/lua/lazyvim/plugins/extras/lang/r.lua @@ -40,7 +40,7 @@ return { }) end, }, - pdfviewer = "" + pdfviewer = "", }, config = function(_, opts) vim.g.rout_follow_colorscheme = true @@ -61,7 +61,7 @@ return { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) if type(opts.ensure_installed) == "table" then - vim.list_extend(opts.ensure_installed, { "markdown", "markdown_inline", "r", "rnoweb" }) + vim.list_extend(opts.ensure_installed, { "r", "rnoweb" }) end end, }, diff --git a/lua/lazyvim/plugins/extras/lang/ruby.lua b/lua/lazyvim/plugins/extras/lang/ruby.lua index 40ff8005..c9686432 100644 --- a/lua/lazyvim/plugins/extras/lang/ruby.lua +++ b/lua/lazyvim/plugins/extras/lang/ruby.lua @@ -13,14 +13,6 @@ return { }) end, }, - { - "williamboman/mason.nvim", - opts = function(_, opts) - vim.list_extend(opts.ensure_installed, { - "solargraph", - }) - end, - }, { "neovim/nvim-lspconfig", opts = { diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index 5a3c59d7..e53e881e 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -32,7 +32,7 @@ return { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "ron", "rust", "toml" }) + vim.list_extend(opts.ensure_installed, { "ron", "rust" }) end, }, diff --git a/lua/lazyvim/plugins/extras/lang/svelte.lua b/lua/lazyvim/plugins/extras/lang/svelte.lua index 4319b509..cf824dda 100644 --- a/lua/lazyvim/plugins/extras/lang/svelte.lua +++ b/lua/lazyvim/plugins/extras/lang/svelte.lua @@ -27,7 +27,28 @@ return { "neovim/nvim-lspconfig", opts = { servers = { - svelte = {}, + svelte = { + keys = { + { + "co", + function() + vim.lsp.buf.code_action({ + apply = true, + context = { + only = { "source.organizeImports" }, + diagnostics = {}, + }, + }) + end, + desc = "Organize Imports", + }, + }, + capabilities = { + workspace = { + didChangeWatchedFiles = vim.fn.has("nvim-0.10") == 0 and { dynamicRegistration = true }, + }, + }, + }, }, }, }, @@ -45,4 +66,14 @@ return { }) end, }, + + { + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + ["svelte"] = { "prettier" }, + }, + }, + }, } diff --git a/lua/lazyvim/plugins/extras/lang/tex.lua b/lua/lazyvim/plugins/extras/lang/tex.lua index 5d667b40..0b7796b5 100644 --- a/lua/lazyvim/plugins/extras/lang/tex.lua +++ b/lua/lazyvim/plugins/extras/lang/tex.lua @@ -19,6 +19,7 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) + opts.highlight = opts.highlight or {} if type(opts.ensure_installed) == "table" then vim.list_extend(opts.ensure_installed, { "bibtex" }) end diff --git a/lua/lazyvim/plugins/extras/lang/toml.lua b/lua/lazyvim/plugins/extras/lang/toml.lua index 9dcc029d..7b34bce0 100644 --- a/lua/lazyvim/plugins/extras/lang/toml.lua +++ b/lua/lazyvim/plugins/extras/lang/toml.lua @@ -5,27 +5,10 @@ return { root = "*.toml", }) end, - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - if type(opts.ensure_installed) == "table" then - vim.list_extend(opts.ensure_installed, { "toml" }) - end - end, - }, - { - "williamboman/mason.nvim", - opts = function(_, opts) - opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "taplo" }) - end, - }, - { - "neovim/nvim-lspconfig", - opts = { - servers = { - taplo = {}, - }, + "neovim/nvim-lspconfig", + opts = { + servers = { + taplo = {}, }, }, } diff --git a/lua/lazyvim/plugins/extras/lang/yaml.lua b/lua/lazyvim/plugins/extras/lang/yaml.lua index 0aa23a2b..b34e2a26 100644 --- a/lua/lazyvim/plugins/extras/lang/yaml.lua +++ b/lua/lazyvim/plugins/extras/lang/yaml.lua @@ -5,16 +5,6 @@ return { }) end, - -- add yaml specific modules to treesitter - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - if type(opts.ensure_installed) == "table" then - vim.list_extend(opts.ensure_installed, { "yaml" }) - end - end, - }, - -- yaml schema support { "b0o/SchemaStore.nvim", diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 18aa5200..5ef3405e 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -67,6 +67,8 @@ return { { "", "BufferLineCycleNext", desc = "Next Buffer" }, { "[b", "BufferLineCyclePrev", desc = "Prev Buffer" }, { "]b", "BufferLineCycleNext", desc = "Next Buffer" }, + { "[B", "BufferLineMovePrev", desc = "Move buffer prev" }, + { "]B", "BufferLineMoveNext", desc = "Move buffer next" }, }, opts = { options = { @@ -346,15 +348,15 @@ return { header = vim.split(logo, "\n"), -- stylua: ignore center = { - { action = LazyVim.telescope("files"), desc = " Find File", icon = " ", key = "f" }, - { action = "ene | startinsert", desc = " New File", icon = " ", key = "n" }, - { action = "Telescope oldfiles", desc = " Recent Files", icon = " ", key = "r" }, - { action = "Telescope live_grep", desc = " Find Text", icon = " ", key = "g" }, - { action = [[lua LazyVim.telescope.config_files()()]], desc = " Config", icon = " ", key = "c" }, - { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, - { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" }, - { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, - { action = function() vim.api.nvim_input("qa") end, desc = " Quit", icon = " ", key = "q" }, + { action = LazyVim.telescope("files"), desc = " Find File", icon = " ", key = "f" }, + { action = "ene | startinsert", desc = " New File", icon = " ", key = "n" }, + { action = "Telescope oldfiles", desc = " Recent Files", icon = " ", key = "r" }, + { action = "Telescope live_grep", desc = " Find Text", icon = " ", key = "g" }, + { action = [[lua LazyVim.telescope.config_files()()]], desc = " Config", icon = " ", key = "c" }, + { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, + { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" }, + { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, + { action = function() vim.api.nvim_input("qa") end, desc = " Quit", icon = " ", key = "q" }, }, footer = function() local stats = require("lazy").stats() diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index e6927069..9b13b50d 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -245,7 +245,7 @@ function M.get_pkg_path(pkg, path, opts) opts.warn = opts.warn == nil and true or opts.warn path = path or "" local ret = root .. "/packages/" .. pkg .. "/" .. path - if opts.warn and not vim.loop.fs_stat(ret) then + if opts.warn and not vim.loop.fs_stat(ret) and not require("lazy.core.config").headless() then M.warn( ("Mason package path not found for **%s**:\n- `%s`\nYou may need to force update the package."):format(pkg, path) ) diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..1d1b8b1d --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "release-type": "simple", + "extra-files": ["lua/lazyvim/config/init.lua"] +} diff --git a/tests/extras/lang_spec.lua b/tests/extras/lang_spec.lua new file mode 100644 index 00000000..86cd0823 --- /dev/null +++ b/tests/extras/lang_spec.lua @@ -0,0 +1,99 @@ +---@module 'luassert' + +local Plugin = require("lazy.core.plugin") +_G.LazyVim = require("lazyvim.util") + +describe("Extra", function() + local Config = require("lazy.core.config") + assert(vim.tbl_count(Config.plugins) > 0, "Lazy not properly setup") + + ---@type {modname:string, modpath:string}[] + local extras = vim.tbl_map( + ---@param path string + function(path) + local modname = path:sub(5):gsub("%.lua$", ""):gsub("/", ".") + return { modname = modname, modpath = path } + end, + vim.fs.find(function(name) + return name:match("%.lua$") + end, { limit = math.huge, type = "file", path = "lua/lazyvim/plugins/extras" }) + ) + + local ignore = { "lazyvim.plugins.extras.ui.treesitter-rewrite" } + extras = vim.tbl_filter(function(extra) + return not vim.tbl_contains(ignore, extra.modname) + end, extras) + + local lsp_to_pkg = require("mason-lspconfig.mappings.server").lspconfig_to_package + + local tsspec = Plugin.Spec.new({ + import = "lazyvim.plugins.treesitter", + }, { optional = true }) + + local tsopts = Plugin.values(tsspec.plugins["nvim-treesitter"], "opts", false) + + local tsensure = tsopts.ensure_installed + assert(type(tsensure) == "table", "No ensure_installed in nvim-treesitter spec") + + for _, extra in ipairs(extras) do + local name = extra.modname:sub(#"lazyvim.plugins.extras" + 2) + describe(name, function() + ---@type any, LazySpecLoader + local mod, spec + + it("spec is valid", function() + mod = require(extra.modname) + assert.is_not_nil(mod) + spec = Plugin.Spec.new({ + { "williamboman/mason.nvim", opts = { ensure_installed = {} } }, + { "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = {} } }, + mod, + }, { optional = true }) + assert(#spec.notifs == 0, "Invalid spec: " .. vim.inspect(spec.notifs)) + end) + + if extra.modname:find("%.lang%.") then + it("has recommended set", function() + assert(mod.recommended, "`recommended` not set for " .. extra.modname) + end) + end + + local lspconfig = spec.plugins["nvim-lspconfig"] + if lspconfig then + it("does not install LSP servers with mason.nvim", function() + local lspconfig_opts = Plugin.values(lspconfig, "opts", false) + local mason = spec.plugins["mason.nvim"] + local mason_opts = Plugin.values(mason, "opts", false) + + for lsp in pairs(lspconfig_opts.servers or {}) do + local lsp_pkg = lsp_to_pkg[lsp] + assert( + not (lsp_pkg and vim.tbl_contains(mason_opts.ensure_installed, lsp_pkg)), + "LSP server " + .. lsp + .. " with pkg " + .. (lsp_pkg or "foo") + .. " is installed automatically. Please remove from the mason.nvim spec" + ) + end + end) + end + + local ts = spec.plugins["nvim-treesitter"] + local opts = Plugin.values(ts, "opts", false) + + if not vim.tbl_isempty(opts.ensure_installed) then + it("does not install defaut Treesitter langs", function() + local invalid = vim.tbl_filter(function(v) + return vim.tbl_contains(tsensure, v) + end, opts.ensure_installed or {}) + assert.same( + {}, + invalid, + "These Treesitter langs are installed by default. Please remove them from the extra." + ) + end) + end + end) + end +end) diff --git a/tests/init.lua b/tests/init.lua new file mode 100644 index 00000000..ca44aab6 --- /dev/null +++ b/tests/init.lua @@ -0,0 +1,55 @@ +-- DO NOT change the paths and don't remove the colorscheme +local root = vim.fn.fnamemodify("./.tests", ":p") + +-- set stdpaths to use .repro +for _, name in ipairs({ "config", "data", "state", "cache" }) do + vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name +end + +-- bootstrap lazy +local lazypath = root .. "/plugins/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + print("Bootstrapping lazy.nvim") + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath }) +end +vim.opt.runtimepath:prepend(lazypath) + +-- install plugins +local plugins = { + "LazyVim/starter", + { "nvim-lua/plenary.nvim" }, + { "folke/lazy.nvim" }, + "williamboman/mason-lspconfig.nvim", + "williamboman/mason.nvim", +} + +local function main() + print("Installing plugins") + require("lazy").setup(plugins, { + root = root .. "/plugins", + performance = { + rtp = { + reset = false, + }, + }, + }) + + if vim.o.filetype == "lazy" then + vim.cmd.close() + end + + print("Updating plugins") + -- update plugins, wait for it to finish and don't show the output + require("lazy").update({ wait = true, show = false }) + -- require("lazy.core.cache").reset() + + vim.opt.rtp:append(".") +end + +local Util = require("lazy.core.util") +Util.try(main, { + on_error = function(err) + print(err) + os.exit(1) + end, +}) diff --git a/tests/run b/tests/run new file mode 100755 index 00000000..631fb09a --- /dev/null +++ b/tests/run @@ -0,0 +1,3 @@ +#!/bin/sh + +nvim --headless -u tests/init.lua -c "PlenaryBustedDirectory tests {init = 'tests//init.lua', sequential = true}"