Compare commits
No commits in common. "master" and "rafi-fork" have entirely different histories.
|
@ -1,161 +0,0 @@
|
||||||
# [CONTRIBUTING](https://nvchad.github.io/contribute)
|
|
||||||
|
|
||||||
## NvChad install for contributors
|
|
||||||
|
|
||||||
If you wish to contribute to NvChad, you should:
|
|
||||||
1. [create a fork on GitHub](https://docs.github.com/en/get-started/quickstart/fork-a-repo)
|
|
||||||
2. clone your fork to your machine
|
|
||||||
- For ssh:
|
|
||||||
```shell
|
|
||||||
$ git clone git@github.com:<YOUR GITHUB USERNAME>/NvChad.git ~/.config/nvim
|
|
||||||
```
|
|
||||||
- For https:
|
|
||||||
```shell
|
|
||||||
$ git clone https://github.com/<YOUR GITHUB USERNAME>/NvChad.git ~/.config/nvim
|
|
||||||
```
|
|
||||||
3. [add a new remote repo to track](https://www.atlassian.com/git/tutorials/git-forks-and-upstreams)
|
|
||||||
- this means you can push/pull as normal to your own repo, but also easily track & update from the NvChad repo
|
|
||||||
- for ssh:
|
|
||||||
```shell
|
|
||||||
$ git remote add upstream git@github.com:NvChad/NvChad.git
|
|
||||||
```
|
|
||||||
- for https:
|
|
||||||
```shell
|
|
||||||
$ git remote add upstream https://github.com/NvChad/NvChad.git
|
|
||||||
```
|
|
||||||
4. any time you create a branch to do some work, use
|
|
||||||
```shell
|
|
||||||
$ git fetch upstream && git checkout -b dev-myFEAT upstream/main
|
|
||||||
```
|
|
||||||
5. only use the **--rebase** flag to update your dev branch
|
|
||||||
- this means that there are no `Merge NvChad/main into devBranch` commits, which are to be avoided
|
|
||||||
```shell
|
|
||||||
$ git pull upstream --rebase
|
|
||||||
```
|
|
||||||
|
|
||||||
## Things to know before contributing
|
|
||||||
|
|
||||||
- When making a PR (pull request), please be very descriptive about what you've done!
|
|
||||||
|
|
||||||
- PR titles should be formatted with 'fix', 'chore' or 'feat'. ex: `feat: add new plugin`
|
|
||||||
|
|
||||||
- PRs should follow the pull request formats where applicable
|
|
||||||
|
|
||||||
- We are open to all PRs, but may decline some for a myriad of reasons. Though don't be discouraged! We'll still be open to discussions.
|
|
||||||
|
|
||||||
- PR's are always welcomed however NvChad aims to be less bloated. So PR's regarding existing plugin's enhancement and creating new features with existing plugins itself ( without adding a new plugin), bug fixes and corrections are more encouraged.
|
|
||||||
|
|
||||||
- NvChad won't keep adding more and more features (like adding new plugins most likely) as requested if they feel unneeded and aren't usable by the majority!! If you think the plugin you want to be added is very useful and many NvChaders would find it useful, then such feature's PR is welcomed!
|
|
||||||
|
|
||||||
- But adding specific features like adding config for [wakatime](https://github.com/wakatime/vim-wakatime) etc will be added in this [chad user configs](https://github.com/NvChad/NvChad/wiki/Chad-user-configs). This lets the user select the things only they want ( adding configs from extra configs ).
|
|
||||||
|
|
||||||
## How to remove or edit commits from your PR
|
|
||||||
> You may have been directed here to remove a commit such as a merge commit: `Merge NvChad/main into devBranch` from your PR
|
|
||||||
|
|
||||||
> As these commands edit your git history, you may need to **force push** with `git push origin --force`
|
|
||||||
|
|
||||||
1. Run the following:
|
|
||||||
```
|
|
||||||
$ git rebase -i HEAD~<NUMBER OF COMMITS TO GO BACK>
|
|
||||||
```
|
|
||||||
<details><summary>Example</summary>
|
|
||||||
<p>
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ git rebase -i HEAD~4
|
|
||||||
```
|
|
||||||
|
|
||||||
```shell
|
|
||||||
pick 28b2dcb statusline add lsp status
|
|
||||||
pick dad9a39 feat: Added lsp radial progress
|
|
||||||
pick 68f72f1 add clickable btn for exiting nvim
|
|
||||||
pick b281b53 avoid using q! for quitting vim
|
|
||||||
|
|
||||||
# Rebase 52b655b..b281b53 onto 52b655b (4 commands)
|
|
||||||
#
|
|
||||||
# Commands:
|
|
||||||
# p, pick <commit> = use commit
|
|
||||||
# r, reword <commit> = use commit, but edit the commit message
|
|
||||||
# e, edit <commit> = use commit, but stop for amending
|
|
||||||
# s, squash <commit> = use commit, but meld into previous commit
|
|
||||||
# f, fixup <commit> = like "squash", but discard this commit's log message
|
|
||||||
# x, exec <command> = run command (the rest of the line) using shell
|
|
||||||
# b, break = stop here (continue rebase later with 'git rebase --continue')
|
|
||||||
# d, drop <commit> = remove commit
|
|
||||||
# l, label <label> = label current HEAD with a name
|
|
||||||
# t, reset <label> = reset HEAD to a label
|
|
||||||
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
|
|
||||||
# . create a merge commit using the original merge commit's
|
|
||||||
# . message (or the oneline, if no original merge commit was
|
|
||||||
# . specified). Use -c <commit> to reword the commit message.
|
|
||||||
#
|
|
||||||
# These lines can be re-ordered; they are executed from top to bottom.
|
|
||||||
#
|
|
||||||
# If you remove a line here THAT COMMIT WILL BE LOST.
|
|
||||||
#
|
|
||||||
# However, if you remove everything, the rebase will be aborted.
|
|
||||||
#
|
|
||||||
# Note that empty commits are commented out
|
|
||||||
```
|
|
||||||
|
|
||||||
</p>
|
|
||||||
</details>
|
|
||||||
|
|
||||||
2. Change the `pick` commands to whatever you wish, you may wish to `d` `drop` or `e` `edit` a commit. Then save & quit this git file to run it.
|
|
||||||
|
|
||||||
<details><summary>Example</summary>
|
|
||||||
<p>
|
|
||||||
|
|
||||||
```shell {3,4}
|
|
||||||
pick 28b2dcb statusline add lsp status
|
|
||||||
pick dad9a39 feat: Added lsp radial progress
|
|
||||||
edit 68f72f1 add clickable btn for exiting nvim
|
|
||||||
d b281b53 avoid using q! for quitting vim
|
|
||||||
|
|
||||||
# Rebase 52b655b..b281b53 onto 52b655b (4 commands)
|
|
||||||
#
|
|
||||||
# Commands:
|
|
||||||
# p, pick <commit> = use commit
|
|
||||||
# r, reword <commit> = use commit, but edit the commit message
|
|
||||||
# e, edit <commit> = use commit, but stop for amending
|
|
||||||
# s, squash <commit> = use commit, but meld into previous commit
|
|
||||||
# f, fixup <commit> = like "squash", but discard this commit's log message
|
|
||||||
# x, exec <command> = run command (the rest of the line) using shell
|
|
||||||
# b, break = stop here (continue rebase later with 'git rebase --continue')
|
|
||||||
# d, drop <commit> = remove commit
|
|
||||||
# l, label <label> = label current HEAD with a name
|
|
||||||
# t, reset <label> = reset HEAD to a label
|
|
||||||
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
|
|
||||||
# . create a merge commit using the original merge commit's
|
|
||||||
# . message (or the oneline, if no original merge commit was
|
|
||||||
# . specified). Use -c <commit> to reword the commit message.
|
|
||||||
#
|
|
||||||
# These lines can be re-ordered; they are executed from top to bottom.
|
|
||||||
#
|
|
||||||
# If you remove a line here THAT COMMIT WILL BE LOST.
|
|
||||||
#
|
|
||||||
# However, if you remove everything, the rebase will be aborted.
|
|
||||||
#
|
|
||||||
# Note that empty commits are commented out
|
|
||||||
```
|
|
||||||
|
|
||||||
</p>
|
|
||||||
</details>
|
|
||||||
|
|
||||||
3. If you picked `drop` you are done, if you picked `edit` then edit your files, then run:
|
|
||||||
```shell
|
|
||||||
$ git add <files>
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Once you have edited & added your files, run:
|
|
||||||
```shell
|
|
||||||
$ git rebase --continue
|
|
||||||
```
|
|
||||||
|
|
||||||
5. You will likely need to push using:
|
|
||||||
```shell
|
|
||||||
$ git push origin --force
|
|
||||||
```
|
|
||||||
|
|
||||||
## Help
|
|
||||||
For help with contributing and anything else nvChad related join the [discord](https://discord.gg/VyPxsGArXc)
|
|
|
@ -1,3 +0,0 @@
|
||||||
patreon: siduck
|
|
||||||
ko_fi: siduck
|
|
||||||
custom: ["https://www.buymeacoffee.com/siduck", "https://www.paypal.com/paypalme/siduck76"]
|
|
|
@ -1,34 +0,0 @@
|
||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
title: ''
|
|
||||||
labels: ''
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
<!-- Before reporting: update nvchad to the latest version,read breaking changes page,search existing issues. -->
|
|
||||||
|
|
||||||
**Describe the bug**
|
|
||||||
A clear and concise description of what the bug is.
|
|
||||||
|
|
||||||
**To Reproduce**
|
|
||||||
Steps to reproduce the behavior:
|
|
||||||
1. Go to '...'
|
|
||||||
2. Click on '....'
|
|
||||||
3. Scroll down to '....'
|
|
||||||
4. See error
|
|
||||||
|
|
||||||
**Expected behavior**
|
|
||||||
A clear and concise description of what you expected to happen.
|
|
||||||
|
|
||||||
**Screenshots**
|
|
||||||
If applicable, add screenshots to help explain your problem.
|
|
||||||
|
|
||||||
**Desktop (please complete the following information):**
|
|
||||||
- Operating System
|
|
||||||
- Terminal
|
|
||||||
- Version of Neovim
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context about the problem here.
|
|
|
@ -1,8 +0,0 @@
|
||||||
blank_issues_enabled: false
|
|
||||||
contact_links:
|
|
||||||
- name: Wiki
|
|
||||||
url: https://github.com/siduck76/NvChad/wiki
|
|
||||||
about: "Walks you through how to use and Configure NvChad."
|
|
||||||
- name: Visit our gitter chat
|
|
||||||
url: https://gitter.im/neovim-dotfiles/community
|
|
||||||
about: "A place where we dicuss NvChad related stuff."
|
|
|
@ -1,23 +0,0 @@
|
||||||
---
|
|
||||||
name: Feature request
|
|
||||||
about: Suggest an idea for this project
|
|
||||||
title: ''
|
|
||||||
labels: ''
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
|
||||||
A clear and concise description of what the problem was.
|
|
||||||
|
|
||||||
**Describe the solution you'd like**
|
|
||||||
A clear and concise description of what you want to happen.
|
|
||||||
|
|
||||||
**Describe alternatives you've considered**
|
|
||||||
A clear and concise description of any alternative solutions or features you've considered.
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context or screenshots about the feature request here.
|
|
||||||
|
|
||||||
**Screenshot**
|
|
||||||
Maybe a screenshot of the feature
|
|
|
@ -1,14 +0,0 @@
|
||||||
|
|
||||||
Fixes Issue # (If it doesn't fix an issue then delete this line)
|
|
||||||
|
|
||||||
Features Added:
|
|
||||||
- Plugin Name (Add links if possible too)
|
|
||||||
|
|
||||||
Reasoning:
|
|
||||||
List why the feature is needed
|
|
||||||
|
|
||||||
Speed (If applicable):
|
|
||||||
Show the impact on the speed of nvChad
|
|
||||||
|
|
||||||
Other:
|
|
||||||
Anything else relevant goes here
|
|
|
@ -1,16 +0,0 @@
|
||||||
(Make sure your title is either: 'fix', 'chore', or 'feat' then your title. ex: `fix: add new plugin`)
|
|
||||||
|
|
||||||
Fixes Issue # (If it doesn't fix an issue then delete this line)
|
|
||||||
|
|
||||||
Plugins Added:
|
|
||||||
- [Plugin Name](Plugin Link)
|
|
||||||
- [Plugin Name](Plugin Link)
|
|
||||||
|
|
||||||
Reasoning:
|
|
||||||
List why the plugin(s) should be added
|
|
||||||
|
|
||||||
Speed:
|
|
||||||
Show the impact on the speed of nvChad
|
|
||||||
|
|
||||||
Other:
|
|
||||||
Anything else relevant goes here
|
|
|
@ -1,121 +0,0 @@
|
||||||
<h1 align="center">NvChad</h1>
|
|
||||||
|
|
||||||
<div align="center">
|
|
||||||
<a href="https://nvchad.com/">Home</a>
|
|
||||||
<span> • </span>
|
|
||||||
<a href="https://nvchad.com/docs/quickstart/install">Install</a>
|
|
||||||
<span> • </span>
|
|
||||||
<a href="https://nvchad.com/docs/contribute">Contribute</a>
|
|
||||||
<span> • </span>
|
|
||||||
<a href="https://github.com/NvChad/NvChad#gift_heart-support">Support</a>
|
|
||||||
<span> • </span>
|
|
||||||
<a href="https://nvchad.com/docs/features">Features</a>
|
|
||||||
<p></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div align="center">
|
|
||||||
|
|
||||||
[![Neovim Minimum Version](https://img.shields.io/badge/Neovim-0.9.0-blueviolet.svg?style=flat-square&logo=Neovim&color=90E59A&logoColor=white)](https://github.com/neovim/neovim)
|
|
||||||
[![GitHub Issues](https://img.shields.io/github/issues/NvChad/NvChad.svg?style=flat-square&label=Issues&color=d77982)](https://github.com/NvChad/NvChad/issues)
|
|
||||||
[![Discord](https://img.shields.io/discord/869557815780470834?color=738adb&label=Discord&logo=discord&logoColor=white&style=flat-square)](https://discord.gg/gADmkJb9Fb)
|
|
||||||
[![Matrix](https://img.shields.io/badge/Matrix-40aa8b.svg?style=flat-square&logo=Matrix&logoColor=white)](https://matrix.to/#/#nvchad:matrix.org)
|
|
||||||
[![Telegram](https://img.shields.io/badge/Telegram-blue.svg?style=flat-square&logo=Telegram&logoColor=white)](https://t.me/DE_WM)
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
## Showcase
|
|
||||||
|
|
||||||
<img src="https://nvchad.com/features/nvdash.webp">
|
|
||||||
<img src="https://nvchad.com/banner.webp">
|
|
||||||
|
|
||||||
<img src="https://nvchad.com/screenshots/onedark.webp">
|
|
||||||
<img src="https://nvchad.com/screenshots/rxyhn1.webp">
|
|
||||||
|
|
||||||
## What is it?
|
|
||||||
|
|
||||||
- NvChad is a neovim config written in lua aiming to provide a base configuration with very beautiful UI and blazing fast startuptime (around 0.02 secs ~ 0.07 secs). We tweak UI plugins such as telescope, nvim-tree, bufferline etc well to provide an aesthetic UI experience.
|
|
||||||
|
|
||||||
- Lazy loading is done 93% of the time meaning that plugins will not be loaded by default, they will be loaded only when required also at specific commands, events etc. This lowers the startuptime and it was like 0.07~ secs tested on an old pentium machine 1.4ghz + 4gb ram & HDD.
|
|
||||||
|
|
||||||
- NvChad isn't a framework! It's supposed to be used as a "base" config, so users can tweak the defaults well, and also remove the things they don't like in the default config and build their config on top of it. Users can tweak the entire default config while staying in their custom config (lua/custom dir). This is the control center of the user's config and gitignored so the users can stay up-to-date with NvChad's latest config (main branch) while still controlling it with their chadrc (file that controls entire custom dir).
|
|
||||||
|
|
||||||
## Theme Showcase
|
|
||||||
|
|
||||||
<details><summary> <b>Images (Click to expand!)</b></summary>
|
|
||||||
|
|
||||||
![4 themes](https://nvchad.com/screenshots/four_Themes.webp)
|
|
||||||
![radium 1](https://nvchad.com/screenshots/radium1.webp)
|
|
||||||
![radium 2](https://nvchad.com/screenshots/radium2.webp)
|
|
||||||
![radium 3](https://nvchad.com/screenshots/radium3.webp)
|
|
||||||
|
|
||||||
|
|
||||||
(Note: these are just 4-5 themes, NvChad has around 56 themes)
|
|
||||||
</details>
|
|
||||||
|
|
||||||
## UI related plugins used
|
|
||||||
|
|
||||||
<details><summary> <b>Images (Click to expand!)</b></summary>
|
|
||||||
|
|
||||||
<h3> Nvim-tree.lua </h3>
|
|
||||||
|
|
||||||
Fast file tree:
|
|
||||||
|
|
||||||
<kbd><img src="https://nvchad.com/features/nvimtree.webp"></kbd>
|
|
||||||
|
|
||||||
<h3> Telescope-nvim </h3>
|
|
||||||
|
|
||||||
A fuzzy file finder, picker, sorter, previewer and much more:
|
|
||||||
|
|
||||||
<kbd><img src="https://nvchad.com/features/telescope.webp"></kbd>
|
|
||||||
|
|
||||||
<h3> Our own statusline written from scratch </h3>
|
|
||||||
|
|
||||||
[NvChad UI](https://github.com/NvChad/ui)
|
|
||||||
|
|
||||||
<kbd><img src="https://nvchad.com/features/statuslines.webp"></kbd>
|
|
||||||
|
|
||||||
<h3> Tabufline (our own pertab bufferline) </h3>
|
|
||||||
|
|
||||||
<kbd><img src="https://nvchad.com/features/tabufline.webp"></kbd>
|
|
||||||
- Here's a [video](https://www.youtube.com/watch?v=V_9iJ96U_k8&ab_channel=siduck) that showcases it.
|
|
||||||
|
|
||||||
<h3> NvCheatsheet ( our UI Plugin ) </h3>
|
|
||||||
<kbd> <img src="https://nvchad.com/features/nvcheatsheet.webp"/></kbd>
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
## Plugins list
|
|
||||||
|
|
||||||
- Inbuilt terminal toggling & management with [Nvterm](https://github.com/NvChad/nvterm)
|
|
||||||
- Lightweight & performant ui plugin with [NvChad UI](https://github.com/NvChad/ui) It provides statusline modules, tabufline ( tabs + buffer manager) , beautiful cheatsheets, NvChad updater, hide & unhide terminal buffers, theme switcher and much more!
|
|
||||||
- File navigation with [nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua)
|
|
||||||
- Beautiful and configurable icons with [nvim-web-devicons](https://github.com/kyazdani42/nvim-web-devicons)
|
|
||||||
- Git diffs and more with [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim)
|
|
||||||
- NeoVim Lsp configuration with [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) and [mason.nvim](https://github.com/williamboman/mason.nvim)
|
|
||||||
- Autocompletion with [nvim-cmp](https://github.com/hrsh7th/nvim-cmp)
|
|
||||||
- File searching, previewing image and text files and more with [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim).
|
|
||||||
- Syntax highlighting with [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
|
|
||||||
- Autoclosing braces and html tags with [nvim-autopairs](https://github.com/windwp/nvim-autopairs)
|
|
||||||
- Indentlines with [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim)
|
|
||||||
- Useful snippets with [friendly snippets](https://github.com/rafamadriz/friendly-snippets) + [LuaSnip](https://github.com/L3MON4D3/LuaSnip).
|
|
||||||
- Popup mappings keysheet [whichkey.nvim](https://github.com/folke/which-key.nvim)
|
|
||||||
|
|
||||||
## History
|
|
||||||
|
|
||||||
- I (@siduck i.e creator of NvChad) in my initial days of learning to program wanted a lightweight IDE for writing code, I had a very low end system which was like 1.4ghz pentium + 4gb ram & HDD. I was into web dev stuff so many suggested me to use vscode but that thing was very heavy on my system, It took more ram than my browser! ( minimal ungoogled chromium ) so I never tried it again, sublime text was nice but the fear of using proprietary software XD for a linux user bugged me a lot. Then I tried doom-emacs which looked pretty but it was slow and I was lost within its docs, I tried lunarvim but too lazy to read the docs. Doom-emacs and lunarvim inspired me to make a config which is the prettiest + very fast and simple.
|
|
||||||
|
|
||||||
- I'm decent at ricing i.e customizing system and making it look pretty so I posted my neovim rice on [neovim subreddit](https://www.reddit.com/r/neovim/comments/m3xl4f/neovim_rice/), my neovim-dotfiles github repo blew up and then I had to come up with a name, I was amazed by the chad meme lol so I put NvChad as the name, the chad word in here doesnt literally mean the chad guy but in the sense such as chad linux vs windows i.e meaning superior, best etc. NvChad was made for my personal use but it gained some popularity which inspired me to make a public config i.e config usable by many and less hassle to update as everyone's going to use the same base config (NvChad) with their custom modifications (which are gitignored so that wont mess up), without the custom config stuff users would have to keep a track of every commit and copy paste git diffs to manually update nvchad.
|
|
||||||
|
|
||||||
## :gift_heart: Support
|
|
||||||
|
|
||||||
If you like NvChad and would like to support & appreciate it via donation then I'll gladly accept it.
|
|
||||||
|
|
||||||
[![kofi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/siduck)
|
|
||||||
[![paypal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/siduck13)
|
|
||||||
[![buymeacoffee](https://img.shields.io/badge/Buy_Me_A_Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/siduck)
|
|
||||||
[![patreon](https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white)](https://www.patreon.com/siduck)
|
|
||||||
|
|
||||||
## Credits
|
|
||||||
|
|
||||||
- [Elianiva](https://github.com/elianiva) helped me with NeoVim Lua related issues many times, NvChad wouldn't exist without his help at all as he helped me in my initial neovim journey!
|
|
||||||
- @lorvethe for making the beautiful NvChad logo.
|
|
|
@ -1,22 +0,0 @@
|
||||||
name: 'Close stale issues and PRs'
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '30 1 * * *'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
stale:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/stale@v3
|
|
||||||
with:
|
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
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 5 days.'
|
|
||||||
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
|
|
||||||
close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
|
|
||||||
exempt-all-issue-assignees: true # doesn't close an issue if someone was assigned to it.
|
|
||||||
close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.'
|
|
||||||
exempt-all-pr-assignees: true # doesn't close a pr if someone was assigned to it.
|
|
||||||
days-before-issue-stale: 30
|
|
||||||
days-before-pr-stale: 45
|
|
||||||
days-before-issue-close: 5
|
|
||||||
days-before-pr-close: 10
|
|
|
@ -1,21 +0,0 @@
|
||||||
# Check Lua Formatting
|
|
||||||
name: Check Lua Formatting
|
|
||||||
on: pull_request_target
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
stylua-check:
|
|
||||||
if: github.repository == 'nvim-lua/kickstart.nvim'
|
|
||||||
name: Stylua Check
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout Code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
|
||||||
- name: Stylua Check
|
|
||||||
uses: JohnnyMorganz/stylua-action@v3
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
version: latest
|
|
||||||
args: --check .
|
|
||||||
|
|
|
@ -1,10 +1 @@
|
||||||
plugin
|
|
||||||
ftplugin
|
|
||||||
syntax
|
|
||||||
coc-settings.json
|
|
||||||
.luarc.json
|
|
||||||
lazy-lock.json
|
lazy-lock.json
|
||||||
after
|
|
||||||
**/.DS_Store
|
|
||||||
lua/custom/secret
|
|
||||||
lua/custom/configs/secret
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
column_width = 160
|
|
||||||
line_endings = "Unix"
|
|
||||||
indent_type = "Spaces"
|
|
||||||
indent_width = 2
|
|
||||||
quote_style = "AutoPreferSingle"
|
|
||||||
call_parentheses = "None"
|
|
19
LICENSE.md
19
LICENSE.md
|
@ -1,19 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
229
README.md
229
README.md
|
@ -1,229 +0,0 @@
|
||||||
# kickstart.nvim
|
|
||||||
|
|
||||||
## Introduction
|
|
||||||
|
|
||||||
A starting point for Neovim that is:
|
|
||||||
|
|
||||||
* Small
|
|
||||||
* Single-file
|
|
||||||
* Completely Documented
|
|
||||||
|
|
||||||
**NOT** a Neovim distribution, but instead a starting point for your configuration.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
### Install Neovim
|
|
||||||
|
|
||||||
Kickstart.nvim targets *only* the latest
|
|
||||||
['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest
|
|
||||||
['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim.
|
|
||||||
If you are experiencing issues, please make sure you have the latest versions.
|
|
||||||
|
|
||||||
### Install External Dependencies
|
|
||||||
|
|
||||||
External Requirements:
|
|
||||||
- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`)
|
|
||||||
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation)
|
|
||||||
- Clipboard tool (xclip/xsel/win32yank or other depending on platform)
|
|
||||||
- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
|
|
||||||
- if you have it set `vim.g.have_nerd_font` in `init.lua` to true
|
|
||||||
- Language Setup:
|
|
||||||
- If want to write Typescript, you need `npm`
|
|
||||||
- If want to write Golang, you will need `go`
|
|
||||||
- etc.
|
|
||||||
|
|
||||||
> **NOTE**
|
|
||||||
> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes
|
|
||||||
> and quick install snippets
|
|
||||||
|
|
||||||
### Install Kickstart
|
|
||||||
|
|
||||||
> **NOTE**
|
|
||||||
> [Backup](#FAQ) your previous configuration (if any exists)
|
|
||||||
|
|
||||||
Neovim's configurations are located under the following paths, depending on your OS:
|
|
||||||
|
|
||||||
| OS | PATH |
|
|
||||||
| :- | :--- |
|
|
||||||
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
|
|
||||||
| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` |
|
|
||||||
| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` |
|
|
||||||
|
|
||||||
#### Recommended Step
|
|
||||||
|
|
||||||
[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo
|
|
||||||
so that you have your own copy that you can modify, then install by cloning the
|
|
||||||
fork to your machine using one of the commands below, depending on your OS.
|
|
||||||
|
|
||||||
> **NOTE**
|
|
||||||
> Your fork's url will be something like this:
|
|
||||||
> `https://github.com/<your_github_username>/kickstart.nvim.git`
|
|
||||||
|
|
||||||
#### Clone kickstart.nvim
|
|
||||||
> **NOTE**
|
|
||||||
> If following the recommended step above (i.e., forking the repo), replace
|
|
||||||
> `nvim-lua` with `<your_github_username>` in the commands below
|
|
||||||
|
|
||||||
<details><summary> Linux and Mac </summary>
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details><summary> Windows </summary>
|
|
||||||
|
|
||||||
If you're using `cmd.exe`:
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\
|
|
||||||
```
|
|
||||||
|
|
||||||
If you're using `powershell.exe`
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### Post Installation
|
|
||||||
|
|
||||||
Start Neovim
|
|
||||||
|
|
||||||
```sh
|
|
||||||
nvim
|
|
||||||
```
|
|
||||||
|
|
||||||
That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
|
|
||||||
current plugin status. Hit `q` to close the window.
|
|
||||||
|
|
||||||
Read through the `init.lua` file in your configuration folder for more
|
|
||||||
information about extending and exploring Neovim. That also includes
|
|
||||||
examples of adding popularly requested plugins.
|
|
||||||
|
|
||||||
|
|
||||||
### Getting Started
|
|
||||||
|
|
||||||
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
|
|
||||||
|
|
||||||
### FAQ
|
|
||||||
|
|
||||||
* What should I do if I already have a pre-existing neovim configuration?
|
|
||||||
* You should back it up and then delete all associated files.
|
|
||||||
* This includes your existing init.lua and the neovim files in `~/.local`
|
|
||||||
which can be deleted with `rm -rf ~/.local/share/nvim/`
|
|
||||||
* Can I keep my existing configuration in parallel to kickstart?
|
|
||||||
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME`
|
|
||||||
to maintain multiple configurations. For example, you can install the kickstart
|
|
||||||
configuration in `~/.config/nvim-kickstart` and create an alias:
|
|
||||||
```
|
|
||||||
alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim'
|
|
||||||
```
|
|
||||||
When you run Neovim using `nvim-kickstart` alias it will use the alternative
|
|
||||||
config directory and the matching local directory
|
|
||||||
`~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim
|
|
||||||
distribution that you would like to try out.
|
|
||||||
* What if I want to "uninstall" this configuration:
|
|
||||||
* See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information
|
|
||||||
* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files?
|
|
||||||
* The main purpose of kickstart is to serve as a teaching tool and a reference
|
|
||||||
configuration that someone can easily use to `git clone` as a basis for their own.
|
|
||||||
As you progress in learning Neovim and Lua, you might consider splitting `init.lua`
|
|
||||||
into smaller parts. A fork of kickstart that does this while maintaining the
|
|
||||||
same functionality is available here:
|
|
||||||
* [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim)
|
|
||||||
* Discussions on this topic can be found here:
|
|
||||||
* [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218)
|
|
||||||
* [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473)
|
|
||||||
|
|
||||||
### Install Recipes
|
|
||||||
|
|
||||||
Below you can find OS specific install instructions for Neovim and dependencies.
|
|
||||||
|
|
||||||
After installing all the dependencies continue with the [Install Kickstart](#Install-Kickstart) step.
|
|
||||||
|
|
||||||
#### Windows Installation
|
|
||||||
|
|
||||||
<details><summary>Windows with Microsoft C++ Build Tools and CMake</summary>
|
|
||||||
Installation may require installing build tools and updating the run command for `telescope-fzf-native`
|
|
||||||
|
|
||||||
See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)
|
|
||||||
|
|
||||||
This requires:
|
|
||||||
|
|
||||||
- Install CMake and the Microsoft C++ Build Tools on Windows
|
|
||||||
|
|
||||||
```lua
|
|
||||||
{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
<details><summary>Windows with gcc/make using chocolatey</summary>
|
|
||||||
Alternatively, one can install gcc and make which don't require changing the config,
|
|
||||||
the easiest way is to use choco:
|
|
||||||
|
|
||||||
1. install [chocolatey](https://chocolatey.org/install)
|
|
||||||
either follow the instructions on the page or use winget,
|
|
||||||
run in cmd as **admin**:
|
|
||||||
```
|
|
||||||
winget install --accept-source-agreements chocolatey.chocolatey
|
|
||||||
```
|
|
||||||
|
|
||||||
2. install all requirements using choco, exit previous cmd and
|
|
||||||
open a new one so that choco path is set, and run in cmd as **admin**:
|
|
||||||
```
|
|
||||||
choco install -y neovim git ripgrep wget fd unzip gzip mingw make
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
<details><summary>WSL (Windows Subsystem for Linux)</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
wsl --install
|
|
||||||
wsl
|
|
||||||
sudo add-apt-repository ppa:neovim-ppa/unstable -y
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install make gcc ripgrep unzip git xclip neovim
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
|
|
||||||
#### Linux Install
|
|
||||||
<details><summary>Ubuntu Install Steps</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo add-apt-repository ppa:neovim-ppa/unstable -y
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install make gcc ripgrep unzip git xclip neovim
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
<details><summary>Debian Install Steps</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install make gcc ripgrep unzip git xclip curl
|
|
||||||
|
|
||||||
# Now we install nvim
|
|
||||||
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
|
|
||||||
sudo rm -rf /opt/nvim-linux64
|
|
||||||
sudo mkdir -p /opt/nvim-linux64
|
|
||||||
sudo chmod a+rX /opt/nvim-linux64
|
|
||||||
sudo tar -C /opt -xzf nvim-linux64.tar.gz
|
|
||||||
|
|
||||||
# make it available in /usr/local/bin, distro installs to /usr/bin
|
|
||||||
sudo ln -sf /opt/nvim-linux64/bin/nvim /usr/local/bin/
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
<details><summary>Fedora Install Steps</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo dnf install -y gcc make git ripgrep fd-find unzip neovim
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details><summary>Arch Install Steps</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
|
|
303
init.lua
303
init.lua
|
@ -1,206 +1,101 @@
|
||||||
vim.g.mapleader = ' '
|
local config = require("plex.config")
|
||||||
vim.g.maplocalleader = ';'
|
config.ensure_lazy()
|
||||||
-- vim.g.python3_host_prog = '/usr/bin/python3'
|
|
||||||
|
|
||||||
vim.opt.mouse = 'a' -- mouse does annoying things for me if it's not 'a'
|
|
||||||
vim.opt.signcolumn = 'yes'
|
|
||||||
vim.opt.clipboard = '' -- don't just use the system clipboard
|
|
||||||
vim.opt.wrap = false
|
|
||||||
vim.opt.breakindent = false
|
|
||||||
vim.opt.conceallevel = 2
|
|
||||||
vim.opt.concealcursor = 'c'
|
|
||||||
vim.opt.undofile = true
|
|
||||||
vim.opt.undolevels = 10000
|
|
||||||
vim.opt.writebackup = false
|
|
||||||
vim.opt.history = 5000
|
|
||||||
vim.opt.shada = { "'1000", '<50', 's10', 'h' }
|
|
||||||
vim.g.syntax = true
|
|
||||||
|
|
||||||
-- Tabs and Indents
|
|
||||||
-- ===
|
|
||||||
vim.opt.textwidth = 80 -- Text width maximum chars before wrapping
|
|
||||||
vim.opt.tabstop = 4 -- The number of spaces a tab is
|
|
||||||
vim.opt.shiftwidth = 4 -- Number of spaces to use in auto(indent)
|
|
||||||
vim.opt.smarttab = true -- Tab insert blanks according to 'shiftwidth'
|
|
||||||
vim.opt.autoindent = true -- Use same indenting on new lines
|
|
||||||
vim.opt.smartindent = true -- Smart autoindenting on new lines
|
|
||||||
vim.opt.shiftround = true -- Round indent to multiple of 'shiftwidth'
|
|
||||||
|
|
||||||
-- Timing
|
|
||||||
-- ===
|
|
||||||
vim.opt.ttimeout = true
|
|
||||||
vim.opt.timeoutlen = 500 -- Time out on mappings
|
|
||||||
vim.opt.ttimeoutlen = 10 -- Time out on key codes
|
|
||||||
vim.opt.updatetime = 250 -- Idle time to write swap and trigger CursorHold
|
|
||||||
|
|
||||||
-- Searching
|
|
||||||
-- ===
|
|
||||||
vim.opt.ignorecase = true -- Search ignoring case
|
|
||||||
vim.opt.smartcase = true -- Keep case when searching with *
|
|
||||||
vim.opt.infercase = true -- Adjust case in insert completion mode
|
|
||||||
vim.opt.incsearch = true -- Incremental search
|
|
||||||
vim.opt.hlsearch = true -- highlight searched stuff
|
|
||||||
|
|
||||||
-- Formatting
|
|
||||||
-- ===
|
|
||||||
|
|
||||||
vim.opt.wrap = false -- No wrap by default
|
|
||||||
vim.opt.linebreak = true -- Break long lines at 'breakat'
|
|
||||||
vim.opt.breakat = '\\ \\ ;:,!?' -- Long lines break chars
|
|
||||||
vim.opt.startofline = false -- Cursor in same column for few commands
|
|
||||||
vim.opt.splitbelow = true -- Splits open bottom right
|
|
||||||
vim.opt.splitright = true
|
|
||||||
vim.opt.breakindentopt = { shift = 2, min = 20 }
|
|
||||||
vim.opt.formatoptions = 'trowcnlm1jp' -- see :h fo-table & :h formatoptions
|
|
||||||
vim.opt.breakindent = true
|
|
||||||
|
|
||||||
-- Diff
|
|
||||||
-- ===
|
|
||||||
|
|
||||||
vim.opt.diffopt:append { 'iwhite', 'indent-heuristic', 'algorithm:patience' }
|
|
||||||
vim.opt.wildmode = 'longest:full,full' -- Command-line completion mode
|
|
||||||
|
|
||||||
-- Folds
|
|
||||||
-- ===
|
|
||||||
|
|
||||||
vim.opt.foldlevelstart = 60
|
|
||||||
vim.opt.foldlevel = 60
|
|
||||||
vim.opt.foldminlines = 5
|
|
||||||
|
|
||||||
-- Editor UI
|
|
||||||
-- ===
|
|
||||||
|
|
||||||
vim.o.guifont = 'FiraCode Nerd Font:h15'
|
|
||||||
vim.opt.termguicolors = true
|
|
||||||
vim.opt.shortmess = 'xsTOInfFitloCaAs'
|
|
||||||
vim.opt.showmode = true -- Show mode in cmd window
|
|
||||||
vim.opt.scrolloff = 6 -- Keep at least n lines above/below
|
|
||||||
vim.opt.sidescrolloff = 10 -- Keep at least n lines left/right
|
|
||||||
vim.opt.numberwidth = 2 -- Minimum number of columns to use for the line number
|
|
||||||
vim.opt.number = true -- Show line numbers
|
|
||||||
vim.opt.relativenumber = true -- Show relative line numbers
|
|
||||||
vim.opt.ruler = true -- Default status ruler
|
|
||||||
vim.opt.showtabline = 1 -- Don't change this, goes back to a vanilla vim default
|
|
||||||
vim.opt.laststatus = 3 -- Always show laststatus
|
|
||||||
|
|
||||||
-- Sets how neovim will display certain whitespace characters in the editor.
|
|
||||||
-- See `:help 'list'`
|
|
||||||
-- and `:help 'listchars'`
|
|
||||||
vim.opt.list = true
|
|
||||||
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
|
||||||
|
|
||||||
if vim.g.started_by_firenvim == true then
|
if vim.g.started_by_firenvim == true then
|
||||||
opt.showtabline = 1 -- Don't show tabline in firenvim, unless multitab
|
vim.o.guifont = "FiraCode Nerd Font:h18"
|
||||||
opt.laststatus = 1 -- Don't show laststatus in firenvim
|
vim.o.lines = vim.o.lines + 10
|
||||||
opt.wrap = true
|
vim.o.columns = vim.o.columns + 10
|
||||||
|
-- Start lazy.nvim plugin manager.
|
||||||
|
require("lazy").setup(vim.tbl_extend("keep", config.user_lazy_opts(), {
|
||||||
|
spec = {
|
||||||
|
{ import = "plex.plugins.core" },
|
||||||
|
{ import = "plex.plugins.editor" },
|
||||||
|
{ import = "plex.plugins.extras.browser" },
|
||||||
|
|
||||||
|
-- This will load a custom user lua/plugins.lua or lua/plugins/*
|
||||||
|
config.has_user_plugins() and { import = "plugins" } or nil,
|
||||||
|
},
|
||||||
|
concurrency = vim.loop.available_parallelism() * 2,
|
||||||
|
defaults = { lazy = true, version = false },
|
||||||
|
dev = { path = config.path_join(vim.fn.stdpath("config"), "dev") },
|
||||||
|
install = { missing = true, colorscheme = {} },
|
||||||
|
checker = { enabled = true, notify = false },
|
||||||
|
change_detection = { notify = false },
|
||||||
|
ui = { border = "rounded" },
|
||||||
|
diff = { cmd = "terminal_git" },
|
||||||
|
performance = {
|
||||||
|
rtp = {
|
||||||
|
disabled_plugins = {
|
||||||
|
"gzip",
|
||||||
|
"vimballPlugin",
|
||||||
|
"matchit",
|
||||||
|
"noice.nvim",
|
||||||
|
"nvim-notify",
|
||||||
|
"2html_plugin",
|
||||||
|
"tarPlugin",
|
||||||
|
"bufferline.nvim",
|
||||||
|
"tutor",
|
||||||
|
"zipPlugin",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
|
config.setup()
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<C-DOWN>", function()
|
||||||
|
vim.o.lines = vim.o.lines + 1
|
||||||
|
end, { expr = true, desc = "Make Display bigger" })
|
||||||
|
vim.keymap.set("n", "<C-UP>", function()
|
||||||
|
vim.o.lines = vim.o.lines - 1
|
||||||
|
end, { expr = true, desc = "Make Display smaller" })
|
||||||
|
else
|
||||||
|
vim.o.laststatus = 2
|
||||||
|
vim.o.showtabline = 2
|
||||||
|
|
||||||
|
-- Start lazy.nvim plugin manager.
|
||||||
|
require("lazy").setup(vim.tbl_extend("keep", config.user_lazy_opts(), {
|
||||||
|
spec = {
|
||||||
|
{ import = "plex.plugins" },
|
||||||
|
{ import = "plex.plugins.extras.coding" },
|
||||||
|
{ import = "plex.plugins.extras.ui" },
|
||||||
|
{ import = "plex.plugins.extras.treesitter" },
|
||||||
|
{ import = "plex.plugins.extras.formatting" },
|
||||||
|
{ import = "plex.plugins.extras.browser" },
|
||||||
|
{ import = "plex.plugins.extras.editor" },
|
||||||
|
{ import = "plex.plugins.extras.org" },
|
||||||
|
{ import = "plex.plugins.extras.lang.go" },
|
||||||
|
{ import = "plex.plugins.extras.lang.cpp" }, -- also does C and rust
|
||||||
|
{ import = "plex.plugins.extras.lang.json" },
|
||||||
|
{ import = "plex.plugins.extras.lang.polyglot" },
|
||||||
|
{ import = "plex.plugins.extras.lang.python" },
|
||||||
|
{ import = "plex.plugins.extras.lang.yaml" },
|
||||||
|
|
||||||
|
-- This will load a custom user lua/plugins.lua or lua/plugins/*
|
||||||
|
config.has_user_plugins() and { import = "plugins" } or nil,
|
||||||
|
},
|
||||||
|
concurrency = vim.loop.available_parallelism() * 2,
|
||||||
|
defaults = { lazy = true, version = false },
|
||||||
|
dev = { path = config.path_join(vim.fn.stdpath("config"), "dev") },
|
||||||
|
install = { missing = true, colorscheme = {} },
|
||||||
|
checker = { enabled = true, notify = false },
|
||||||
|
change_detection = { notify = false },
|
||||||
|
ui = { border = "rounded" },
|
||||||
|
diff = { cmd = "terminal_git" },
|
||||||
|
performance = {
|
||||||
|
rtp = {
|
||||||
|
disabled_plugins = {
|
||||||
|
"gzip",
|
||||||
|
"vimballPlugin",
|
||||||
|
"matchit",
|
||||||
|
"matchparen",
|
||||||
|
"2html_plugin",
|
||||||
|
"tarPlugin",
|
||||||
|
"tutor",
|
||||||
|
"zipPlugin",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
|
config.setup()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Preview substitutions live, as you type!
|
|
||||||
vim.opt.inccommand = 'split'
|
|
||||||
|
|
||||||
if vim.g.neovide == true then
|
|
||||||
-- fulscreen with F11
|
|
||||||
vim.api.nvim_set_keymap('n', '<F11>', ':let g:neovide_fullscreen = !g:neovide_fullscreen<CR>', {})
|
|
||||||
|
|
||||||
vim.g.neovide_underline_automatic_scaling = true
|
|
||||||
|
|
||||||
-- vim.g.neovide_floating_blur_amount_x = 2.0
|
|
||||||
-- vim.g.neovide_floating_blur_amount_y = 2.0
|
|
||||||
|
|
||||||
vim.g.neovide_scroll_animation_length = 0.1
|
|
||||||
-- vim.g.neovide_cursor_animation_length = 0
|
|
||||||
-- vim.g.neovide_cursor_trail_size = 0
|
|
||||||
vim.g.neovide_hide_mouse_when_typing = true
|
|
||||||
|
|
||||||
vim.g.neovide_fullscreen = true
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.opt.helpheight = 0 -- Disable help window resizing
|
|
||||||
vim.opt.winwidth = 30 -- Minimum width for active window
|
|
||||||
vim.opt.winminwidth = 1 -- Minimum width for inactive windows
|
|
||||||
vim.opt.winheight = 1 -- Minimum height for active window
|
|
||||||
vim.opt.winminheight = 1 -- Minimum height for inactive window
|
|
||||||
|
|
||||||
vim.opt.showcmd = false -- show command in status line
|
|
||||||
vim.opt.cmdheight = 0
|
|
||||||
vim.opt.cmdwinheight = 5 -- Command-line lines
|
|
||||||
vim.opt.equalalways = true -- Resize windows on split or close
|
|
||||||
vim.opt.colorcolumn = '80' -- Column highlight at textwidth's max character-limit
|
|
||||||
|
|
||||||
vim.opt.cursorline = true
|
|
||||||
vim.opt.cursorlineopt = { 'number', 'screenline' }
|
|
||||||
|
|
||||||
vim.opt.pumheight = 10 -- Maximum number of items to show in the popup menu
|
|
||||||
vim.opt.pumwidth = 10 -- Minimum width for the popup menu
|
|
||||||
vim.opt.pumblend = 10 -- Popup blend
|
|
||||||
|
|
||||||
-- Spelling correction
|
|
||||||
-- ===
|
|
||||||
|
|
||||||
vim.opt.spell = true -- manually enable spell with `set spell` or `<leader>ts`
|
|
||||||
vim.opt.spelllang = 'en,de_de'
|
|
||||||
vim.opt.spellsuggest = 'double,50,timeout:5000'
|
|
||||||
|
|
||||||
-- autocommands
|
|
||||||
-- ===
|
|
||||||
local function augroup(name)
|
|
||||||
return vim.api.nvim_create_augroup('plex_' .. name, {})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- [[ Basic Keymaps ]]
|
|
||||||
-- See `:help vim.keymap.set()`
|
|
||||||
|
|
||||||
-- [[ Basic Autocommands ]]
|
|
||||||
-- See `:help lua-guide-autocommands`
|
|
||||||
|
|
||||||
-- Highlight when yanking (copying) text
|
|
||||||
-- Try it with `yap` in normal mode
|
|
||||||
-- See `:help vim.highlight.on_yank()`
|
|
||||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
|
||||||
desc = 'Highlight when yanking (copying) text',
|
|
||||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
|
||||||
callback = function()
|
|
||||||
vim.highlight.on_yank()
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- [[ Install `lazy.nvim` plugin manager ]]
|
|
||||||
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
|
||||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
|
||||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
|
||||||
vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
|
||||||
end ---@diagnostic disable-next-line: undefined-field
|
|
||||||
vim.opt.rtp:prepend(lazypath)
|
|
||||||
|
|
||||||
require 'custom.maps'
|
|
||||||
require 'custom.autocmds'
|
|
||||||
require('lazy').setup({
|
|
||||||
{ import = 'custom.plugins' },
|
|
||||||
{ import = 'kickstart.plugins.debug' },
|
|
||||||
}, {
|
|
||||||
ui = {
|
|
||||||
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
|
||||||
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
|
|
||||||
icons = vim.g.have_nerd_font and {} or {
|
|
||||||
cmd = '⌘',
|
|
||||||
config = '🛠',
|
|
||||||
event = '📅',
|
|
||||||
ft = '📂',
|
|
||||||
init = '⚙',
|
|
||||||
keys = '🗝',
|
|
||||||
plugin = '🔌',
|
|
||||||
runtime = '💻',
|
|
||||||
require = '🌙',
|
|
||||||
source = '📄',
|
|
||||||
start = '🚀',
|
|
||||||
task = '📌',
|
|
||||||
lazy = '💤 ',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
require 'kickstart.health'
|
|
||||||
|
|
||||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
|
||||||
|
|
|
@ -1,106 +0,0 @@
|
||||||
local augroup = vim.api.nvim_create_augroup('plex_generic_autocmds', {})
|
|
||||||
|
|
||||||
-- enable text wrapping for text filetypes
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
|
||||||
group = augroup,
|
|
||||||
pattern = {
|
|
||||||
'tex',
|
|
||||||
'text',
|
|
||||||
'markdown',
|
|
||||||
'help',
|
|
||||||
'typst',
|
|
||||||
},
|
|
||||||
callback = function()
|
|
||||||
vim.opt_local.wrap = true
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- use html for htmldjango
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
|
||||||
group = augroup,
|
|
||||||
pattern = {
|
|
||||||
'html',
|
|
||||||
},
|
|
||||||
callback = function()
|
|
||||||
vim.bo.filetype = 'html'
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- always use the tex filetype for latex things, as those are most supported by
|
|
||||||
-- latex language servers.
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
|
||||||
group = augroup,
|
|
||||||
pattern = {
|
|
||||||
'latex',
|
|
||||||
'plaintex',
|
|
||||||
},
|
|
||||||
callback = function()
|
|
||||||
vim.bo.filetype = 'tex'
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- conceallevel is what converts things like **bold** to be displayed as bold
|
|
||||||
-- without the stars. This is useful, but we might not want it for some
|
|
||||||
-- filetypes.
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
|
||||||
group = augroup,
|
|
||||||
pattern = {
|
|
||||||
'latex',
|
|
||||||
'markdown',
|
|
||||||
'plaintex',
|
|
||||||
'tex',
|
|
||||||
'typst',
|
|
||||||
},
|
|
||||||
callback = function()
|
|
||||||
vim.opt_local.conceallevel = 0
|
|
||||||
vim.opt_local.concealcursor = ''
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Enable spellcheck for some types
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
|
||||||
group = augroup,
|
|
||||||
pattern = {
|
|
||||||
'latex',
|
|
||||||
'markdown',
|
|
||||||
'typst',
|
|
||||||
'plaintex',
|
|
||||||
'tex',
|
|
||||||
},
|
|
||||||
callback = function()
|
|
||||||
vim.cmd [[set spell]]
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- disable auto formatting for some filetypes
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
|
||||||
group = augroup,
|
|
||||||
pattern = {
|
|
||||||
'TelescopePrompt',
|
|
||||||
},
|
|
||||||
callback = function()
|
|
||||||
vim.opt_local.formatoptions = ''
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- tweak colorschemes and highlights after loading a new colorscheme
|
|
||||||
vim.api.nvim_create_autocmd('ColorScheme', {
|
|
||||||
group = augroup,
|
|
||||||
callback = function()
|
|
||||||
vim.cmd [[highlight Comment gui=NONE]] -- no italics for comments
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- pin main.typ for typst projects
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
|
||||||
group = augroup,
|
|
||||||
pattern = {
|
|
||||||
'typst',
|
|
||||||
},
|
|
||||||
callback = function()
|
|
||||||
-- pin the main file
|
|
||||||
vim.lsp.buf.execute_command { command = 'tinymist.pinMain', arguments = { vim.api.nvim_buf_get_name(0) } }
|
|
||||||
-- -- unpin the main file
|
|
||||||
-- vim.lsp.buf.execute_command { command = 'tinymist.pinMain', arguments = { nil } }
|
|
||||||
end,
|
|
||||||
})
|
|
|
@ -1,156 +0,0 @@
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- Toggles
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- Clear highlighted searched on pressing <Esc> in normal mode
|
|
||||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>', { desc = 'Hide search results' })
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>tn', '<cmd> set nu! <cr>', { desc = '[T]oggle line [N]umbers' })
|
|
||||||
vim.keymap.set('n', '<leader>trn', '<cmd> set rnu! <cr>', { desc = '[T]oggle [R]elative line [N]umbers' })
|
|
||||||
vim.keymap.set('n', '<leader>tw', '<cmd> set wrap! <cr>', { desc = '[T]oggle [W]rap' })
|
|
||||||
vim.keymap.set('n', '<leader>ts', '<cmd> set spell! <cr>', { desc = '[T]oggle [S]pellcheck' })
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- Movements
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- make big movements up and down
|
|
||||||
vim.keymap.set({ 't', 'i', 'v', 'n' }, '<A-j>', '<C-d>', { desc = 'move a many lines up' })
|
|
||||||
vim.keymap.set({ 't', 'i', 'v', 'n' }, '<A-k>', '<C-u>', { desc = 'move a many lines down' })
|
|
||||||
|
|
||||||
-- move to end and start of lines with H and L
|
|
||||||
vim.keymap.set({ 'v', 'n' }, 'H', '<Home>', { desc = 'move to start of line' })
|
|
||||||
vim.keymap.set({ 'v', 'n' }, 'L', '<End>', { desc = 'move to end of line' })
|
|
||||||
|
|
||||||
-- make j and k move by visual lines, not actual lines
|
|
||||||
vim.keymap.set({ 'v', 'n' }, 'j', 'gj', { desc = 'move up' })
|
|
||||||
vim.keymap.set({ 'v', 'n' }, 'k', 'gk', { desc = 'move down' })
|
|
||||||
|
|
||||||
-- move+scroll
|
|
||||||
vim.keymap.set({ 'v', 'n' }, 'zk', '<C-e>', { desc = 'move and scroll up' })
|
|
||||||
vim.keymap.set({ 'v', 'n' }, 'zj', '<C-y>', { desc = 'move and scroll down' })
|
|
||||||
|
|
||||||
-- go to beginning and end in insert mode
|
|
||||||
vim.keymap.set('i', '<C-S-h>', '<esc>^i', { desc = 'Go to the start of the line' })
|
|
||||||
vim.keymap.set('i', '<C-S-l>', '<End>', { desc = 'Go to the end of the line' })
|
|
||||||
vim.keymap.set('i', '<C-w>', '<esc>lwi', { desc = 'Go a word further' })
|
|
||||||
vim.keymap.set('i', '<C-b>', '<esc>lbi', { desc = 'Go a word backward' })
|
|
||||||
vim.keymap.set('i', '<C-e>', '<esc>lea', { desc = 'Go a to next word end' })
|
|
||||||
|
|
||||||
-- navigate hjkl in insert mode
|
|
||||||
vim.keymap.set('i', '<C-h>', '<Left>', { desc = 'Move left' })
|
|
||||||
vim.keymap.set('i', '<C-j>', '<Down>', { desc = 'Move down' })
|
|
||||||
vim.keymap.set('i', '<C-k>', '<Up>', { desc = 'Move up' })
|
|
||||||
vim.keymap.set('i', '<C-l>', '<Right>', { desc = 'Move right' })
|
|
||||||
|
|
||||||
-- move to window
|
|
||||||
-- See `:help wincmd` for a list of all window commands
|
|
||||||
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
|
||||||
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
|
||||||
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
|
||||||
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
|
||||||
|
|
||||||
-- diagnostics
|
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
|
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
|
|
||||||
|
|
||||||
-- let me out!!!
|
|
||||||
vim.keymap.set({ 'n', 'v' }, 'qqq', '<cmd>bnext<cr><cmd>bd #<cr>', { desc = '[Q]uit the current window' })
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<A-c>', '<cmd>bnext<cr><cmd>bd #<cr>', { desc = '[Q]uit the current window' })
|
|
||||||
|
|
||||||
vim.keymap.set({ 'n' }, '#', "'", { desc = '[Q]uit the current window' })
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- Workspace, buffer and window manipulation
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- split windows
|
|
||||||
vim.keymap.set('n', '<leader>"', '<cmd>vsplit<cr>', { desc = 'Split the window vertically' })
|
|
||||||
vim.keymap.set('n', '<leader>%', '<cmd>split<cr>', { desc = 'Split the window horizontally' })
|
|
||||||
vim.keymap.set('n', '<leader>w"', '<cmd>vnew<cr>', { desc = 'Split the window vertically (new buffer)' })
|
|
||||||
vim.keymap.set('n', '<leader>w%', '<cmd>new<cr>', { desc = 'Split the window horizontally (new buffer)' })
|
|
||||||
|
|
||||||
-- window actions
|
|
||||||
vim.keymap.set('n', '<leader>wbn', '<cmd>enew<cr>', { desc = 'Open a [N]ew buffer' })
|
|
||||||
vim.keymap.set('n', '<leader>wbc', '<cmd>bw<cr>', { desc = '[C]lose current buffer' }) -- :bd would keep in background
|
|
||||||
vim.keymap.set('n', '<C-Up>', '<cmd>resize +1<cr>', { desc = 'Resize window' })
|
|
||||||
vim.keymap.set('n', '<C-Down>', '<cmd>resize -1<cr>', { desc = 'Resize window' })
|
|
||||||
vim.keymap.set('n', '<C-Left>', '<cmd>vertical resize +1<cr>', { desc = 'Resize window vertically' })
|
|
||||||
vim.keymap.set('n', '<C-Right>', '<cmd>vertical resize -1<cr>', { desc = 'Resize window vertically' })
|
|
||||||
|
|
||||||
-- tabs/workspaces
|
|
||||||
vim.keymap.set('n', '<Tab>', '<cmd>bnext<cr>', { desc = 'Next Buffer' })
|
|
||||||
vim.keymap.set('n', '<S-Tab>', '<cmd>bprev<cr>', { desc = 'Last Buffer' })
|
|
||||||
vim.keymap.set('n', '<leader>wn', '<cmd>tabnew<cr>', { desc = 'Open a [N]ew [W]orkspace/Tab' })
|
|
||||||
vim.keymap.set('n', '<leader>wc', '<cmd>tabclose<cr>', { desc = '[C]lose a [W]orkspace/Tab' })
|
|
||||||
vim.keymap.set('n', '<leader>wk', '<cmd>tabnext<cr>', { desc = 'Next [W]orkspace/Tab' })
|
|
||||||
vim.keymap.set('n', '<leader>wj', '<cmd>tabprevious<cr>', { desc = 'Last [W]orkspace/Tab' })
|
|
||||||
vim.keymap.set('n', '<leader>n', '<cmd>enew<cr>', { desc = '[N]ew Buffer' })
|
|
||||||
|
|
||||||
vim.keymap.set('t', '<C-w>', vim.api.nvim_replace_termcodes('<C-\\><C-N>', true, true, true), { desc = 'Leave terminal mode' })
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- Editing
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- copy to system clipboard
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<leader>y', '"+y', { desc = '[Y]ank to system' })
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<leader>Y', '"+Y', { desc = '[Y]ank to system' })
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<leader>yy', '"+yy', { desc = '[Y]ank to system' })
|
|
||||||
|
|
||||||
-- paste from system clipboard
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<leader>p', '"+p', { desc = '[P]aste from system' })
|
|
||||||
vim.keymap.set({ 't', 'n', 'v' }, '<C-S-v>', '<C-w>"+pi', { desc = 'Paste the system clipboard' })
|
|
||||||
|
|
||||||
-- do not overwrite the register when pasting (kept defaults)
|
|
||||||
vim.keymap.set({ 'v' }, 'P', 'P', { desc = '[P]aste to selected' })
|
|
||||||
vim.keymap.set({ 'v' }, 'p', 'p', { desc = '[p]aste to selected and copy to register' })
|
|
||||||
|
|
||||||
-- add lines from normal and visual, without insert mode
|
|
||||||
vim.keymap.set({ 'n', 'v' }, 'OO', 'O<Esc>', { desc = 'Insert a line above' })
|
|
||||||
vim.keymap.set({ 'n', 'v' }, 'oo', 'o<Esc>', { desc = 'Insert a line below' })
|
|
||||||
|
|
||||||
-- add lines from normal and visual, with insert mode
|
|
||||||
vim.keymap.set({ 'n', 'v' }, 'O', 'O', { desc = 'Insert a line above and insert' })
|
|
||||||
vim.keymap.set({ 'n', 'v' }, 'o', 'o', { desc = 'Insert a line below and insert' })
|
|
||||||
vim.keymap.set({ 'n', 'v' }, 'Oi', 'O', { desc = 'Insert a line above and insert' })
|
|
||||||
vim.keymap.set({ 'n', 'v' }, 'oi', 'o', { desc = 'Insert a line below and insert' })
|
|
||||||
|
|
||||||
-- make current line a blank line
|
|
||||||
vim.keymap.set({ 'n', 'v' }, 'do', 'Vc<Esc>', { desc = '[D]o [O]ver / Rewrite line' })
|
|
||||||
|
|
||||||
-- substitute, normally on 's', but the leap plugin is more useful on 's'
|
|
||||||
vim.keymap.set({ 'n' }, '<leader>s', 's', { desc = '[S]ubstitute hovered text' })
|
|
||||||
|
|
||||||
-- do something useful with the arrow keys:
|
|
||||||
-- move lines up/down and change indentation
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<Up>', '<cmd> move-2<cr>', { desc = 'Move line up' })
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<Down>', '<cmd> move+1<cr>', { desc = 'Move line down' })
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<Left>', '<<', { desc = 'Less indentation' })
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<Right>', '>>', { desc = 'More indentation' })
|
|
||||||
|
|
||||||
-- format a long line into multiple with length 80
|
|
||||||
vim.keymap.set({ 'v' }, '<leader>fl', ':!fmt -w80<CR>', { desc = '[F]ormat long [L]ines into smaller ones' })
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- Formating
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- format the current buffer
|
|
||||||
vim.keymap.set('n', '<leader>ff', function()
|
|
||||||
require('conform').format()
|
|
||||||
end, { desc = '[F]ormat buffer' })
|
|
||||||
vim.keymap.set('n', '<leader>fF', function()
|
|
||||||
vim.lsp.buf.format()
|
|
||||||
end, { desc = '[F]ormat buffer (no plugin)' })
|
|
||||||
vim.keymap.set('n', '<leader>fw', function()
|
|
||||||
require('mini.trailspace').trim()
|
|
||||||
end, { desc = '[F]ormat remove [W]hitespace' })
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- Formating
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- discard F15
|
|
||||||
vim.keymap.set({ 'i', 't', 'x', 'n', 'v' }, '<F15>', '<Nop>')
|
|
||||||
vim.keymap.set({ 'i', 't', 'x', 'n', 'v' }, '<S-F15>', '<Nop>')
|
|
||||||
vim.keymap.set({ 'i', 't', 'x', 'n', 'v' }, '<A-F15>', '<Nop>')
|
|
||||||
vim.keymap.set({ 'i', 't', 'x', 'n', 'v' }, '<C-F15>', '<Nop>')
|
|
||||||
vim.keymap.set({ 'i', 't', 'x', 'n', 'v' }, '<C-S-F15>', '<Nop>')
|
|
||||||
vim.keymap.set({ 'i', 't', 'x', 'n', 'v' }, '<C-A-F15>', '<Nop>')
|
|
||||||
vim.keymap.set({ 'i', 't', 'x', 'n', 'v' }, '<A-S-F15>', '<Nop>')
|
|
||||||
vim.keymap.set({ 'i', 't', 'x', 'n', 'v' }, '<C-A-S-F15>', '<Nop>')
|
|
|
@ -1,260 +0,0 @@
|
||||||
-- Brief aside: **What is LSP?**
|
|
||||||
--
|
|
||||||
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
|
||||||
--
|
|
||||||
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
|
|
||||||
-- and language tooling communicate in a standardized fashion.
|
|
||||||
--
|
|
||||||
-- In general, you have a "server" which is some tool built to understand a particular
|
|
||||||
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
|
|
||||||
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
|
|
||||||
-- processes that communicate with some "client" - in this case, Neovim!
|
|
||||||
--
|
|
||||||
-- LSP provides Neovim with features like:
|
|
||||||
-- - Go to definition
|
|
||||||
-- - Find references
|
|
||||||
-- - Autocompletion
|
|
||||||
-- - Symbol Search
|
|
||||||
-- - and more!
|
|
||||||
--
|
|
||||||
-- Thus, Language Servers are external tools that must be installed separately from
|
|
||||||
-- Neovim. This is where `mason` and related plugins come into play.
|
|
||||||
--
|
|
||||||
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
|
|
||||||
-- and elegantly composed help section, `:help lsp-vs-treesitter`
|
|
||||||
|
|
||||||
-- This function gets run when an LSP attaches to a particular buffer.
|
|
||||||
-- That is to say, every time a new file is opened that is associated with
|
|
||||||
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
|
|
||||||
-- function will be executed to configure the current buffer
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
|
||||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
|
||||||
callback = function(event)
|
|
||||||
-- NOTE: Remember that Lua is a real programming language, and as such it is possible
|
|
||||||
-- to define small helper and utility functions so you don't have to repeat yourself.
|
|
||||||
--
|
|
||||||
-- In this case, we create a function that lets us more easily define mappings specific
|
|
||||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
|
||||||
local map = function(keys, func, desc)
|
|
||||||
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Jump to the definition of the word under your cursor.
|
|
||||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
|
||||||
-- To jump back, press <C-t>.
|
|
||||||
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
|
||||||
|
|
||||||
-- Find references for the word under your cursor.
|
|
||||||
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
|
||||||
|
|
||||||
-- Jump to the implementation of the word under your cursor.
|
|
||||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
|
||||||
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
|
||||||
|
|
||||||
-- Rename the variable under your cursor.
|
|
||||||
-- Most Language Servers support renaming across files, etc.
|
|
||||||
map('<leader>cr', vim.lsp.buf.rename, '[R]ename')
|
|
||||||
|
|
||||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
|
||||||
-- or a suggestion from your LSP for this to activate.
|
|
||||||
map('<leader>ca', vim.lsp.buf.code_action, '[A]ction')
|
|
||||||
|
|
||||||
-- Opens a popup that displays documentation about the word under your cursor
|
|
||||||
-- See `:help K` for why this keymap.
|
|
||||||
map('K', vim.lsp.buf.hover, 'Hover Documentation')
|
|
||||||
|
|
||||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
|
||||||
-- For example, in C this would take you to the header.
|
|
||||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
|
||||||
|
|
||||||
-- The following two autocommands are used to highlight references of the
|
|
||||||
-- word under your cursor when your cursor rests there for a little while.
|
|
||||||
-- See `:help CursorHold` for information about when this is executed
|
|
||||||
--
|
|
||||||
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
|
||||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
|
||||||
if client and client.server_capabilities.documentHighlightProvider then
|
|
||||||
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
|
||||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
|
||||||
buffer = event.buf,
|
|
||||||
group = highlight_augroup,
|
|
||||||
callback = vim.lsp.buf.document_highlight,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
|
||||||
buffer = event.buf,
|
|
||||||
group = highlight_augroup,
|
|
||||||
callback = vim.lsp.buf.clear_references,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('LspDetach', {
|
|
||||||
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
|
|
||||||
callback = function(event2)
|
|
||||||
vim.lsp.buf.clear_references()
|
|
||||||
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- The following autocommand is used to enable inlay hints in your
|
|
||||||
-- code, if the language server you are using supports them
|
|
||||||
--
|
|
||||||
-- This may be unwanted, since they displace some of your code
|
|
||||||
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
|
|
||||||
map('<leader>th', function()
|
|
||||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
|
|
||||||
end, '[T]oggle Inlay [H]ints')
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- LSP servers and clients are able to communicate to each other what features they support.
|
|
||||||
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
|
||||||
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
|
|
||||||
-- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
|
||||||
|
|
||||||
-- Enable the following language servers
|
|
||||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
|
||||||
--
|
|
||||||
-- Add any additional override configuration in the following tables. Available keys are:
|
|
||||||
-- - cmd (table): Override the default command used to start the server
|
|
||||||
-- - filetypes (table): Override the default list of associated filetypes for the server
|
|
||||||
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
|
|
||||||
-- - settings (table): Override the default settings passed when initializing the server.
|
|
||||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
|
||||||
local servers = {
|
|
||||||
-- clangd = {},
|
|
||||||
-- gopls = {},
|
|
||||||
-- pyright = {},
|
|
||||||
-- rust_analyzer = {},
|
|
||||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
|
||||||
--
|
|
||||||
-- Some languages (like typescript) have entire language plugins that can be useful:
|
|
||||||
-- https://github.com/pmizio/typescript-tools.nvim
|
|
||||||
--
|
|
||||||
-- But for many setups, the LSP (`tsserver`) will work just fine
|
|
||||||
-- tsserver = {},
|
|
||||||
--
|
|
||||||
|
|
||||||
tinymist = {},
|
|
||||||
html = {},
|
|
||||||
cssls = {},
|
|
||||||
clangd = {},
|
|
||||||
pyright = {},
|
|
||||||
bashls = {},
|
|
||||||
yamlls = {},
|
|
||||||
texlab = {},
|
|
||||||
rust_analyzer = {
|
|
||||||
settings = {
|
|
||||||
['rust-analyzer'] = {
|
|
||||||
check = {
|
|
||||||
command = 'clippy',
|
|
||||||
},
|
|
||||||
imports = {
|
|
||||||
granularity = {
|
|
||||||
group = 'module',
|
|
||||||
},
|
|
||||||
prefix = 'self',
|
|
||||||
},
|
|
||||||
cargo = {
|
|
||||||
features = 'all',
|
|
||||||
buildScripts = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
procMacro = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
ltex = {
|
|
||||||
use_spellfile = true,
|
|
||||||
autostart = false,
|
|
||||||
filetypes = { 'latex', 'tex', 'markdown', 'typst' },
|
|
||||||
settings = {
|
|
||||||
ltex = {
|
|
||||||
checkFrequency = 'save', -- shut up while i'm just editing, see <https://github.com/folke/noice.nvim/issues/166>
|
|
||||||
-- specific language (such as en-GB or de-DE is recommended, but I
|
|
||||||
-- want multilingual)
|
|
||||||
language = 'auto',
|
|
||||||
enabled = {
|
|
||||||
'bibtex',
|
|
||||||
'tex',
|
|
||||||
'typst',
|
|
||||||
'latex',
|
|
||||||
'gitcommit',
|
|
||||||
'markdown',
|
|
||||||
'org',
|
|
||||||
'restructuredtext',
|
|
||||||
'rsweave',
|
|
||||||
'quarto',
|
|
||||||
'rmd',
|
|
||||||
'context',
|
|
||||||
-- "html",
|
|
||||||
-- "xhtml",
|
|
||||||
},
|
|
||||||
additionalRules = {
|
|
||||||
enablePickyRules = true,
|
|
||||||
-- thats cool, but often adds diagnostics in
|
|
||||||
-- places where a german might confuse words that are similar
|
|
||||||
-- between english and german REGARDLESS of context. I seem to use the
|
|
||||||
-- english words only in the proper contexts, so leaving this on
|
|
||||||
-- just adds annoying hints like 'Hinweis: "list/NN.*" (English) bedeutet "Liste",
|
|
||||||
-- "Verzeichnis" (German). Meinten Sie vielleicht 'cunning', 'trick'?'
|
|
||||||
-- everytime I use the word "list". I liked that this makes the hints be
|
|
||||||
-- in german regardless of the language I'm working in through...
|
|
||||||
--motherTongue = "de",
|
|
||||||
},
|
|
||||||
-- load token and additional languagetool items later
|
|
||||||
},
|
|
||||||
},
|
|
||||||
languageToolOrg = {
|
|
||||||
apiKey = require 'custom.secret.languagetool',
|
|
||||||
username = 'accounts@cscherr.de',
|
|
||||||
languageToolHttpServerUrl = 'https://api.languagetoolplus.com/v2/',
|
|
||||||
},
|
|
||||||
languageToolHttpServerUrl = 'https://api.languagetoolplus.com/v2/',
|
|
||||||
},
|
|
||||||
lua_ls = {
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
completion = {
|
|
||||||
callSnippet = 'Replace',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Ensure the servers and tools above are installed
|
|
||||||
-- To check the current status of installed tools and/or manually install
|
|
||||||
-- other tools, you can run
|
|
||||||
-- :Mason
|
|
||||||
--
|
|
||||||
-- You can press `g?` for help in this menu.
|
|
||||||
require('mason').setup()
|
|
||||||
|
|
||||||
-- You can add other tools here that you want Mason to install
|
|
||||||
-- for you, so that they are available from within Neovim.
|
|
||||||
local ensure_installed = vim.tbl_keys(servers or {})
|
|
||||||
vim.list_extend(ensure_installed, {
|
|
||||||
'stylua',
|
|
||||||
'typstfmt',
|
|
||||||
})
|
|
||||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
|
||||||
|
|
||||||
require('mason-lspconfig').setup {
|
|
||||||
handlers = {
|
|
||||||
function(server_name)
|
|
||||||
local server = servers[server_name] or {}
|
|
||||||
-- This handles overriding only values explicitly passed
|
|
||||||
-- by the server configuration above. Useful when disabling
|
|
||||||
-- certain features of an LSP (for example, turning off formatting for tsserver)
|
|
||||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
|
||||||
require('lspconfig')[server_name].setup(server)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,95 +0,0 @@
|
||||||
return {
|
|
||||||
{
|
|
||||||
'numToStr/Comment.nvim',
|
|
||||||
keys = {
|
|
||||||
{ 'gcc', mode = 'n', desc = 'Comment toggle current line' },
|
|
||||||
{ 'gc', mode = { 'n', 'o' }, desc = 'Comment toggle linewise' },
|
|
||||||
{ 'gc', mode = 'x', desc = 'Comment toggle linewise (visual)' },
|
|
||||||
{ 'gbc', mode = 'n', desc = 'Comment toggle current block' },
|
|
||||||
{ 'gb', mode = { 'n', 'o' }, desc = 'Comment toggle blockwise' },
|
|
||||||
{ 'gb', mode = 'x', desc = 'Comment toggle blockwise (visual)' },
|
|
||||||
{
|
|
||||||
'<leader>v',
|
|
||||||
function()
|
|
||||||
require('Comment.api').toggle.linewise.current()
|
|
||||||
end,
|
|
||||||
mode = { 'n' },
|
|
||||||
desc = 'Comment toggle current line',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>v',
|
|
||||||
function()
|
|
||||||
local esc = vim.api.nvim_replace_termcodes('<ESC>', true, false, true)
|
|
||||||
vim.api.nvim_feedkeys(esc, 'nx', false)
|
|
||||||
require('Comment.api').toggle.linewise(vim.fn.visualmode())
|
|
||||||
end,
|
|
||||||
mode = { 'x' },
|
|
||||||
desc = 'Comment toggle selected lines',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config = function(_, opts)
|
|
||||||
vim.keymap.set('n', '<leader>c', function()
|
|
||||||
require('Comment.api').toggle.linewise.current()
|
|
||||||
end, { desc = '[T]oggle [C]omment' })
|
|
||||||
vim.keymap.set('v', '<leader>c', function()
|
|
||||||
require('Comment.api').toggle.linewise.current()
|
|
||||||
end, { desc = '[T]oggle [C]omment' })
|
|
||||||
|
|
||||||
require('Comment').setup(opts)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'uga-rosa/ccc.nvim',
|
|
||||||
lazy = false,
|
|
||||||
event = 'FileType',
|
|
||||||
keys = {
|
|
||||||
{ '<Leader>cp', '<cmd>CccPick<CR>', desc = 'Color-picker' },
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
highlighter = {
|
|
||||||
auto_enable = true,
|
|
||||||
lsp = true,
|
|
||||||
excludes = { 'lazy', 'mason', 'help', 'neo-tree' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'dhruvasagar/vim-table-mode',
|
|
||||||
lazy = false,
|
|
||||||
-- <Leader>tm is automatically set for toggle
|
|
||||||
-- see <Leader>t menu
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'ziontee113/icon-picker.nvim',
|
|
||||||
keys = {
|
|
||||||
{ '<localleader>fi', '<cmd>IconPickerNormal<CR>', desc = 'pick icon' },
|
|
||||||
},
|
|
||||||
cmd = { 'IconPickerInsert', 'IconPickerYank', 'IconPickerNormal' },
|
|
||||||
config = function()
|
|
||||||
require('icon-picker').setup { disable_legacy_commands = true }
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'windwp/nvim-autopairs',
|
|
||||||
event = 'InsertEnter',
|
|
||||||
-- Optional dependency
|
|
||||||
dependencies = { 'hrsh7th/nvim-cmp' },
|
|
||||||
config = function()
|
|
||||||
require('nvim-autopairs').setup {}
|
|
||||||
-- WARN: this is kind of anoying with rust, so I have disabeld it
|
|
||||||
-- -- If you want to automatically add `(` after selecting a function or method
|
|
||||||
-- local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
|
|
||||||
-- local cmp = require 'cmp'
|
|
||||||
-- cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'mbbill/undotree',
|
|
||||||
config = function()
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<leader>u', vim.cmd.UndotreeToggle, { desc = '[U]ndo menu' })
|
|
||||||
vim.g.undotree_WindowLayout = 3
|
|
||||||
vim.g.undotree_SplitWidth = 32
|
|
||||||
vim.g.undotree_DiffAutoOpen = false
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,92 +0,0 @@
|
||||||
return {
|
|
||||||
-- NOTE: Plugins can specify dependencies.
|
|
||||||
--
|
|
||||||
-- The dependencies are proper plugin specifications as well - anything
|
|
||||||
-- you do for a plugin at the top level, you can do for a dependency.
|
|
||||||
--
|
|
||||||
-- Use the `dependencies` key to specify the dependencies of a particular plugin
|
|
||||||
|
|
||||||
{ -- Autoformat
|
|
||||||
'stevearc/conform.nvim',
|
|
||||||
lazy = false,
|
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
'<leader>f',
|
|
||||||
function()
|
|
||||||
require('conform').format { async = true, lsp_fallback = true }
|
|
||||||
end,
|
|
||||||
mode = '',
|
|
||||||
desc = '[F]ormat buffer',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
notify_on_error = false,
|
|
||||||
format_on_save = function(bufnr)
|
|
||||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
|
||||||
-- have a well standardized coding style. You can add additional
|
|
||||||
-- languages here or re-enable it for the disabled ones.
|
|
||||||
local disable_filetypes = { c = false, cpp = false, json = true, bib = true }
|
|
||||||
return {
|
|
||||||
timeout_ms = 500,
|
|
||||||
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
formatters_by_ft = {
|
|
||||||
lua = { 'stylua' },
|
|
||||||
-- Conform can also run multiple formatters sequentially
|
|
||||||
-- python = { "isort", "black" },
|
|
||||||
--
|
|
||||||
-- You can use a sub-list to tell conform to run *until* a formatter
|
|
||||||
-- is found.
|
|
||||||
-- javascript = { { "prettierd", "prettier" } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'glacambre/firenvim',
|
|
||||||
enabled = vim.g.started_by_firenvim,
|
|
||||||
lazy = false,
|
|
||||||
build = function()
|
|
||||||
vim.fn['firenvim#install'](0)
|
|
||||||
end,
|
|
||||||
config = function()
|
|
||||||
vim.g.firenvim_config = {
|
|
||||||
localSettings = {
|
|
||||||
['.*'] = {
|
|
||||||
filename = '/tmp/{hostname}_{pathname%10}.{extension%5}',
|
|
||||||
cmdline = 'firenvim',
|
|
||||||
takeover = 'never', -- can't open it with never at all?
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-- enables UNIX specific stuff in vim,
|
|
||||||
-- specifically:
|
|
||||||
-- :SudoWrite
|
|
||||||
-- :SudoRead
|
|
||||||
-- :Chmod
|
|
||||||
-- and also some more, but those are easy done with shell
|
|
||||||
'tpope/vim-eunuch',
|
|
||||||
lazy = false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'mikesmithgh/kitty-scrollback.nvim',
|
|
||||||
enabled = true,
|
|
||||||
lazy = true,
|
|
||||||
cmd = { 'KittyScrollbackGenerateKittens', 'KittyScrollbackCheckHealth' },
|
|
||||||
event = { 'User KittyScrollbackLaunch' },
|
|
||||||
-- version = '*', -- latest stable version, may have breaking changes if major version changed
|
|
||||||
-- version = '^3.0.0', -- pin major version, include fixes and features that do not have breaking changes
|
|
||||||
config = function()
|
|
||||||
require('kitty-scrollback').setup {
|
|
||||||
myconfig = function()
|
|
||||||
return { keymaps_enabled = false }
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
{ import = 'custom.plugins' },
|
|
||||||
}
|
|
|
@ -1,328 +0,0 @@
|
||||||
return {
|
|
||||||
{
|
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
dependencies = {
|
|
||||||
-- Automatically install LSPs and related tools to stdpath for Neovim
|
|
||||||
{ 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants
|
|
||||||
'williamboman/mason-lspconfig.nvim',
|
|
||||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
|
||||||
|
|
||||||
-- Useful status updates for LSP.
|
|
||||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
|
||||||
{ 'j-hui/fidget.nvim', opts = {} },
|
|
||||||
|
|
||||||
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
|
||||||
-- used for completion, annotations and signatures of Neovim apis
|
|
||||||
{ 'folke/lazydev.nvim' },
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require 'custom.plugins.configs.lsp'
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
-- See `:help gitsigns` to understand what the configuration keys do
|
|
||||||
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
|
|
||||||
'lewis6991/gitsigns.nvim',
|
|
||||||
opts = {
|
|
||||||
signs = {
|
|
||||||
add = { text = '+' },
|
|
||||||
change = { text = '~' },
|
|
||||||
delete = { text = '_' },
|
|
||||||
topdelete = { text = '‾' },
|
|
||||||
changedelete = { text = '~' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'folke/trouble.nvim',
|
|
||||||
cmd = 'Trouble',
|
|
||||||
opts = { use_diagnostic_signs = true },
|
|
||||||
keys = {
|
|
||||||
{ '<leader>ctb', '<cmd>Trouble diagnostics toggle filter.buf=0<cr>', desc = 'Document Diagnostics (Trouble)' },
|
|
||||||
{ '<leader>ctr', '<cmd>Trouble diagnostics toggle<cr>', desc = 'Workspace Diagnostics (Trouble)' },
|
|
||||||
{ '<leader>ctq', '<cmd>Trouble qflist toggle<cr>', desc = 'Quickfix List (Trouble)' },
|
|
||||||
{ '<leader>ctl', '<cmd>Trouble loclist toggle<cr>', desc = 'Location List (Trouble)' },
|
|
||||||
{ '<leader>ctd', '<cmd>Trouble symbols<cr>', desc = 'LSP symbols (Trouble)' },
|
|
||||||
{ '<leader>ctt', '<cmd>Trouble todo<cr>', desc = 'Todos (Trouble)' },
|
|
||||||
{ '<leader>cts', '<cmd>Trouble lsp_document_symbols toggle win.position=right<cr>', desc = 'Document [S]ymbols side (Trouble)' },
|
|
||||||
{
|
|
||||||
'[q',
|
|
||||||
function()
|
|
||||||
if require('trouble').is_open() then
|
|
||||||
require('trouble').previous { skip_groups = true, jump = true }
|
|
||||||
else
|
|
||||||
vim.cmd.cprev()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
desc = 'Previous trouble/quickfix item',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
']q',
|
|
||||||
function()
|
|
||||||
if require('trouble').is_open() then
|
|
||||||
require('trouble').next { skip_groups = true, jump = true }
|
|
||||||
else
|
|
||||||
vim.cmd.cnext()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
desc = 'Next trouble/quickfix item',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ -- Autocompletion
|
|
||||||
'hrsh7th/nvim-cmp',
|
|
||||||
enabled = not vim.g.started_by_firenvim,
|
|
||||||
event = 'InsertEnter',
|
|
||||||
dependencies = {
|
|
||||||
-- Snippet Engine & its associated nvim-cmp source
|
|
||||||
{
|
|
||||||
'L3MON4D3/LuaSnip',
|
|
||||||
build = (function()
|
|
||||||
-- Build Step is needed for regex support in snippets.
|
|
||||||
-- This step is not supported in many windows environments.
|
|
||||||
-- Remove the below condition to re-enable on windows.
|
|
||||||
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
return 'make install_jsregexp'
|
|
||||||
end)(),
|
|
||||||
dependencies = {
|
|
||||||
-- `friendly-snippets` contains a variety of premade snippets.
|
|
||||||
-- See the README about individual language/framework/plugin snippets:
|
|
||||||
-- https://github.com/rafamadriz/friendly-snippets
|
|
||||||
-- {
|
|
||||||
-- 'rafamadriz/friendly-snippets',
|
|
||||||
-- config = function()
|
|
||||||
-- require('luasnip.loaders.from_vscode').lazy_load()
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'saadparwaiz1/cmp_luasnip',
|
|
||||||
|
|
||||||
-- Adds other completion capabilities.
|
|
||||||
-- nvim-cmp does not ship with all sources by default. They are split
|
|
||||||
-- into multiple repos for maintenance purposes.
|
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
|
||||||
'hrsh7th/cmp-path',
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
-- See `:help cmp`
|
|
||||||
local cmp = require 'cmp'
|
|
||||||
local luasnip = require 'luasnip'
|
|
||||||
luasnip.config.setup {}
|
|
||||||
|
|
||||||
cmp.setup {
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
luasnip.lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
completion = { completeopt = 'menu,menuone,noinsert' },
|
|
||||||
|
|
||||||
-- For an understanding of why these mappings were
|
|
||||||
-- chosen, you will need to read `:help ins-completion`
|
|
||||||
--
|
|
||||||
-- No, but seriously. Please read `:help ins-completion`, it is really good!
|
|
||||||
mapping = cmp.mapping.preset.insert {
|
|
||||||
-- Select the [n]ext item
|
|
||||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
|
||||||
-- Select the [p]revious item
|
|
||||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
|
||||||
|
|
||||||
-- Scroll the documentation window [b]ack / [f]orward
|
|
||||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
|
|
||||||
-- Accept ([y]es) the completion.
|
|
||||||
-- This will auto-import if your LSP supports it.
|
|
||||||
-- This will expand snippets if the LSP sent a snippet.
|
|
||||||
-- ['<C-y>'] = cmp.mapping.confirm { select = true },
|
|
||||||
|
|
||||||
-- If you prefer more traditional completion keymaps,
|
|
||||||
-- you can uncomment the following lines
|
|
||||||
['<CR>'] = cmp.mapping.confirm { select = true },
|
|
||||||
['<Tab>'] = cmp.mapping.select_next_item(),
|
|
||||||
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
|
||||||
|
|
||||||
-- Manually trigger a completion from nvim-cmp.
|
|
||||||
-- Generally you don't need this, because nvim-cmp will display
|
|
||||||
-- completions whenever it has completion options available.
|
|
||||||
['<C-Space>'] = cmp.mapping.complete {},
|
|
||||||
|
|
||||||
-- Think of <c-l> as moving to the right of your snippet expansion.
|
|
||||||
-- So if you have a snippet that's like:
|
|
||||||
-- function $name($args)
|
|
||||||
-- $body
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- <c-l> will move you to the right of each of the expansion locations.
|
|
||||||
-- <c-h> is similar, except moving you backwards.
|
|
||||||
--['<C-l>'] = cmp.mapping(function()
|
|
||||||
-- if luasnip.expand_or_locally_jumpable() then
|
|
||||||
-- luasnip.expand_or_jump()
|
|
||||||
-- end
|
|
||||||
--end, { 'i', 's' }),
|
|
||||||
--['<C-h>'] = cmp.mapping(function()
|
|
||||||
-- if luasnip.locally_jumpable(-1) then
|
|
||||||
-- luasnip.jump(-1)
|
|
||||||
-- end
|
|
||||||
--end, { 'i', 's' }),
|
|
||||||
|
|
||||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
|
||||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
|
||||||
},
|
|
||||||
sources = {
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
{ name = 'luasnip' },
|
|
||||||
{ name = 'path' },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{ -- Highlight, edit, and navigate code
|
|
||||||
'nvim-treesitter/nvim-treesitter',
|
|
||||||
build = ':TSUpdate',
|
|
||||||
opts = {
|
|
||||||
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
|
|
||||||
-- Autoinstall languages that are not installed
|
|
||||||
auto_install = true,
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
|
|
||||||
-- If you are experiencing weird indenting issues, add the language to
|
|
||||||
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
|
|
||||||
additional_vim_regex_highlighting = { 'ruby' },
|
|
||||||
},
|
|
||||||
indent = { enable = true, disable = { 'ruby' } },
|
|
||||||
},
|
|
||||||
config = function(_, opts)
|
|
||||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
|
||||||
|
|
||||||
-- Prefer git instead of curl in order to improve connectivity in some environments
|
|
||||||
require('nvim-treesitter.install').prefer_git = true
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
|
||||||
require('nvim-treesitter.configs').setup(opts)
|
|
||||||
|
|
||||||
-- There are additional nvim-treesitter modules that you can use to interact
|
|
||||||
-- with nvim-treesitter. You should go explore a few and see what interests you:
|
|
||||||
--
|
|
||||||
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
|
|
||||||
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
|
||||||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'kevinhwang91/nvim-bqf',
|
|
||||||
ft = 'qf',
|
|
||||||
cmd = 'BqfAutoToggle',
|
|
||||||
event = 'QuickFixCmdPost',
|
|
||||||
opts = {
|
|
||||||
auto_resize_height = false,
|
|
||||||
func_map = {
|
|
||||||
tab = 'st',
|
|
||||||
split = 'sv',
|
|
||||||
vsplit = 'sg',
|
|
||||||
|
|
||||||
stoggleup = 'K',
|
|
||||||
stoggledown = 'J',
|
|
||||||
stogglevm = '<Space>',
|
|
||||||
|
|
||||||
ptoggleitem = 'p',
|
|
||||||
ptoggleauto = 'P',
|
|
||||||
ptogglemode = 'zp',
|
|
||||||
|
|
||||||
pscrollup = '<C-b>',
|
|
||||||
pscrolldown = '<C-f>',
|
|
||||||
|
|
||||||
prevfile = 'gk',
|
|
||||||
nextfile = 'gj',
|
|
||||||
|
|
||||||
prevhist = '<S-Tab>',
|
|
||||||
nexthist = '<Tab>',
|
|
||||||
},
|
|
||||||
preview = {
|
|
||||||
auto_preview = true,
|
|
||||||
should_preview_cb = function(bufnr)
|
|
||||||
-- file size greater than 100kb can't be previewed automatically
|
|
||||||
local filename = vim.api.nvim_buf_get_name(bufnr)
|
|
||||||
local fsize = vim.fn.getfsize(filename)
|
|
||||||
if fsize > 100 * 1024 then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'rmagatti/goto-preview',
|
|
||||||
event = 'FileType',
|
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
'gpd',
|
|
||||||
function()
|
|
||||||
require('goto-preview').goto_preview_definition()
|
|
||||||
end,
|
|
||||||
desc = 'Go to definition preview',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'gpD',
|
|
||||||
function()
|
|
||||||
require('goto-preview').goto_preview_declaration()
|
|
||||||
end,
|
|
||||||
desc = 'Go to declaration preview',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'gpi',
|
|
||||||
function()
|
|
||||||
require('goto-preview').goto_preview_implementation()
|
|
||||||
end,
|
|
||||||
desc = 'Go to implementaion preview',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'gpt',
|
|
||||||
function()
|
|
||||||
require('goto-preview').goto_preview_type_definition()
|
|
||||||
end,
|
|
||||||
desc = 'Go to type preview',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'gpt',
|
|
||||||
function()
|
|
||||||
require('goto-preview').goto_preview_type_references()
|
|
||||||
end,
|
|
||||||
desc = 'Preview references',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'gpc',
|
|
||||||
function()
|
|
||||||
require('goto-preview').close_all_win()
|
|
||||||
end,
|
|
||||||
desc = 'Close all preview windows',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require('goto-preview').setup {}
|
|
||||||
end,
|
|
||||||
dependencies = 'nvim-telescope/telescope.nvim',
|
|
||||||
opts = {
|
|
||||||
width = 78,
|
|
||||||
height = 15,
|
|
||||||
default_mappings = false,
|
|
||||||
opacity = 10,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ 'kosayoda/nvim-lightbulb', event = { 'BufReadPre', 'BufNewFile' } },
|
|
||||||
{
|
|
||||||
'folke/lazydev.nvim',
|
|
||||||
ft = 'lua', -- only load on lua files
|
|
||||||
opts = {
|
|
||||||
library = {
|
|
||||||
-- See the configuration section for more details
|
|
||||||
-- Load luvit types when the `vim.uv` word is found
|
|
||||||
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ 'Bilal2453/luvit-meta', lazy = true }, -- optional `vim.uv` typings
|
|
||||||
}
|
|
|
@ -1,163 +0,0 @@
|
||||||
return {
|
|
||||||
{ -- Fuzzy Finder (files, lsp, etc)
|
|
||||||
'nvim-telescope/telescope.nvim',
|
|
||||||
cmd = 'Telescope',
|
|
||||||
dependencies = {
|
|
||||||
'nvim-lua/plenary.nvim',
|
|
||||||
'nvim-treesitter/nvim-treesitter',
|
|
||||||
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
|
||||||
'nvim-telescope/telescope-fzf-native.nvim',
|
|
||||||
|
|
||||||
-- `build` is used to run some command when the plugin is installed/updated.
|
|
||||||
-- This is only run then, not every time Neovim starts up.
|
|
||||||
build = 'make',
|
|
||||||
|
|
||||||
-- `cond` is a condition used to determine whether this plugin should be
|
|
||||||
-- installed and loaded.
|
|
||||||
cond = function()
|
|
||||||
return vim.fn.executable 'make' == 1
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
|
||||||
|
|
||||||
-- Useful for getting pretty icons, but requires a Nerd Font.
|
|
||||||
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
|
||||||
-- it can fuzzy find! It's more than just a "file finder", it can search
|
|
||||||
-- many different aspects of Neovim, your workspace, LSP, and more!
|
|
||||||
--
|
|
||||||
-- The easiest way to use Telescope, is to start by doing something like:
|
|
||||||
-- :Telescope help_tags
|
|
||||||
--
|
|
||||||
-- After running this command, a window will open up and you're able to
|
|
||||||
-- type in the prompt window. You'll see a list of `help_tags` options and
|
|
||||||
-- a corresponding preview of the help.
|
|
||||||
--
|
|
||||||
-- Two important keymaps to use while in Telescope are:
|
|
||||||
-- - Insert mode: <c-/>
|
|
||||||
-- - Normal mode: ?
|
|
||||||
--
|
|
||||||
-- This opens a window that shows you all of the keymaps for the current
|
|
||||||
-- Telescope picker. This is really useful to discover what Telescope can
|
|
||||||
-- do as well as how to actually do it!
|
|
||||||
|
|
||||||
-- [[ Configure Telescope ]]
|
|
||||||
-- See `:help telescope` and `:help telescope.setup()`
|
|
||||||
require('telescope').setup {
|
|
||||||
-- You can put your default mappings / updates / etc. in here
|
|
||||||
-- All the info you're looking for is in `:help telescope.setup()`
|
|
||||||
--
|
|
||||||
-- pickers = {}
|
|
||||||
extensions = {
|
|
||||||
['ui-select'] = {
|
|
||||||
require('telescope.themes').get_dropdown(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
defaults = {
|
|
||||||
mappings = {
|
|
||||||
i = { ['<c-enter>'] = 'to_fuzzy_refine' },
|
|
||||||
n = { ['q'] = require('telescope.actions').close },
|
|
||||||
},
|
|
||||||
vimgrep_arguments = {
|
|
||||||
'rg',
|
|
||||||
'-L',
|
|
||||||
'--color=never',
|
|
||||||
'--no-heading',
|
|
||||||
'--with-filename',
|
|
||||||
'--line-number',
|
|
||||||
'--column',
|
|
||||||
'--smart-case',
|
|
||||||
},
|
|
||||||
prompt_prefix = ' ',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Enable Telescope extensions if they are installed
|
|
||||||
pcall(require('telescope').load_extension, 'fzf')
|
|
||||||
pcall(require('telescope').load_extension, 'ui-select')
|
|
||||||
|
|
||||||
-- See `:help telescope.builtin`
|
|
||||||
local builtin = require 'telescope.builtin'
|
|
||||||
vim.keymap.set('n', '<localleader>fh', builtin.help_tags, { desc = '[H]elp' })
|
|
||||||
vim.keymap.set('n', '<localleader>fk', builtin.keymaps, { desc = '[K]eymaps' })
|
|
||||||
vim.keymap.set('n', '<localleader>ff', builtin.find_files, { desc = '[F]iles' })
|
|
||||||
vim.keymap.set('n', '<localleader>fe', builtin.builtin, { desc = 't[E]lescope' })
|
|
||||||
vim.keymap.set('n', '<localleader>fw', builtin.live_grep, { desc = 'a [W]ord interactively' })
|
|
||||||
vim.keymap.set('n', '<localleader>fcw', builtin.grep_string, { desc = '[C]urrent [W]ord' })
|
|
||||||
vim.keymap.set('n', '<localleader>fd', builtin.diagnostics, { desc = '[D]iagnostics' })
|
|
||||||
vim.keymap.set('n', '<localleader>fr', builtin.resume, { desc = '[R]esume' })
|
|
||||||
vim.keymap.set('n', '<localleader>fo', builtin.oldfiles, { desc = '[O]ld Files ("." for repeat)' })
|
|
||||||
vim.keymap.set('n', '<localleader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
|
||||||
vim.keymap.set('n', '<localleader>fb', builtin.buffers, { desc = 'existing [B]uffers' })
|
|
||||||
vim.keymap.set('n', '<localleader>fm', builtin.marks, { desc = 'book[M]arks' })
|
|
||||||
vim.keymap.set('n', '<localleader>fd', builtin.diagnostics, { desc = '[D]iagnostigs' })
|
|
||||||
vim.keymap.set('n', '<localleader>fs', builtin.lsp_dynamic_workspace_symbols, { desc = 'LSP [S]ymbols' })
|
|
||||||
|
|
||||||
-- spelling
|
|
||||||
vim.keymap.set('n', 'z<space>', builtin.spell_suggest, { desc = '[F]ind spelling' })
|
|
||||||
vim.keymap.set('n', 'z=', builtin.spell_suggest, { desc = '[F]ind spelling' })
|
|
||||||
|
|
||||||
-- Slightly advanced example of overriding default behavior and theme
|
|
||||||
vim.keymap.set('n', '<localleader>/', function()
|
|
||||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
|
||||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
|
||||||
winblend = 10,
|
|
||||||
previewer = false,
|
|
||||||
})
|
|
||||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
|
||||||
|
|
||||||
-- It's also possible to pass additional configuration options.
|
|
||||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
|
||||||
vim.keymap.set('n', '<localleader>f/', function()
|
|
||||||
builtin.live_grep {
|
|
||||||
grep_open_files = true,
|
|
||||||
prompt_title = 'Live Grep in Open Files',
|
|
||||||
}
|
|
||||||
end, { desc = '[F]ind [/] in Open Files' })
|
|
||||||
|
|
||||||
-- Shortcut for searching your Neovim configuration files
|
|
||||||
vim.keymap.set('n', '<localleader>fnf', function()
|
|
||||||
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
|
||||||
end, { desc = '[F]ind [N]eovim [F]iles' })
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'jvgrootveld/telescope-zoxide',
|
|
||||||
dependencies = 'nvim-telescope/telescope.nvim',
|
|
||||||
config = function()
|
|
||||||
vim.keymap.set('n', '<localleader>cd', '<cmd> Telescope zoxide list<cr>', { desc = '[C]hange [D]irectory' })
|
|
||||||
-- Useful for easily creating commands
|
|
||||||
local z_utils = require 'telescope._extensions.zoxide.utils'
|
|
||||||
|
|
||||||
require('telescope').setup {
|
|
||||||
-- (other Telescope configuration...)
|
|
||||||
extensions = {
|
|
||||||
zoxide = {
|
|
||||||
prompt_title = '[ Recently visited directories (zoxide) ]',
|
|
||||||
mappings = {
|
|
||||||
default = {
|
|
||||||
after_action = function(selection)
|
|
||||||
print('Update to (' .. selection.z_score .. ') ' .. selection.path)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
['<C-s>'] = {
|
|
||||||
before_action = function(selection)
|
|
||||||
print 'before C-s'
|
|
||||||
end,
|
|
||||||
action = function(selection)
|
|
||||||
vim.cmd.edit(selection.path)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
-- Opens the selected entry in a new split
|
|
||||||
['<C-q>'] = { action = z_utils.create_basic_command 'split' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
require('telescope').load_extension 'zoxide'
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{ 'nanotee/zoxide.vim', lazy = false, enabled = false },
|
|
||||||
}
|
|
|
@ -1,122 +0,0 @@
|
||||||
return {
|
|
||||||
{
|
|
||||||
'zaldih/themery.nvim',
|
|
||||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
|
||||||
cmd = 'Themery',
|
|
||||||
keys = {
|
|
||||||
{ ';ft', '<cmd> Themery <cr>', desc = '[F]ind [T]heme' },
|
|
||||||
},
|
|
||||||
init = function()
|
|
||||||
require 'settings.theme'
|
|
||||||
end,
|
|
||||||
config = function()
|
|
||||||
require('themery').setup {
|
|
||||||
themes = {
|
|
||||||
-- Dark Themes
|
|
||||||
{
|
|
||||||
name = '==========Dark Themes==========',
|
|
||||||
colorscheme = '', -- this actually keeps the selected theme, but it wont work with persistence
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'nvim default',
|
|
||||||
colorscheme = 'default',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'nvim lunaperche',
|
|
||||||
colorscheme = 'lunaperche',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'nvim quiet',
|
|
||||||
colorscheme = 'quiet',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'nvim retrobox',
|
|
||||||
colorscheme = 'retrobox',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'nvim slate',
|
|
||||||
colorscheme = 'slate',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'nvim vim',
|
|
||||||
colorscheme = 'vim',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'tokyonight',
|
|
||||||
colorscheme = 'tokyonight',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'tokyonight-moon',
|
|
||||||
colorscheme = 'tokyonight-moon',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'tokyonight-storm',
|
|
||||||
colorscheme = 'tokyonight-storm',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'kanagawa',
|
|
||||||
colorscheme = 'kanagawa',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'kanagawa-dragon',
|
|
||||||
colorscheme = 'kanagawa-dragon',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'kanagawa-wave',
|
|
||||||
colorscheme = 'kanagawa-wave',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'zenbones',
|
|
||||||
colorscheme = 'zenbones',
|
|
||||||
before = [[
|
|
||||||
-- It's a major hack from the themery guys that this is a string
|
|
||||||
vim.opt.background = "dark"
|
|
||||||
]],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'tokyobones',
|
|
||||||
colorscheme = 'tokyobones',
|
|
||||||
before = [[
|
|
||||||
-- It's a major hack from the themery guys that this is a string
|
|
||||||
vim.opt.background = "dark"
|
|
||||||
]],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'kanagawabones',
|
|
||||||
colorscheme = 'kanagawabones',
|
|
||||||
before = [[
|
|
||||||
-- It's a major hack from the themery guys that this is a string
|
|
||||||
vim.opt.background = "dark"
|
|
||||||
]],
|
|
||||||
},
|
|
||||||
-- Light themes
|
|
||||||
{
|
|
||||||
name = '==========Light Themes==========',
|
|
||||||
colorscheme = '', -- this actually keeps the selected theme, but it wont work with persistence
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'tokyonight-day',
|
|
||||||
colorscheme = 'tokyonight-day',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'kanagawa-lotus',
|
|
||||||
colorscheme = 'kanagawa-lotus',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = 'zenbones',
|
|
||||||
colorscheme = 'zenbones',
|
|
||||||
before = [[
|
|
||||||
-- It's a major hack from the themery guys that this is a string
|
|
||||||
vim.opt.background = "light"
|
|
||||||
]],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
themeConfigFile = '~/.config/nvim/lua/settings/theme.lua',
|
|
||||||
livePreview = true, -- Apply theme while browsing. Default to true.
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
'folke/tokyonight.nvim',
|
|
||||||
'rebelot/kanagawa.nvim',
|
|
||||||
{ 'zenbones-theme/zenbones.nvim', dependencies = { 'rktjmp/lush.nvim' } },
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
return {
|
|
||||||
{
|
|
||||||
'kdheepak/lazygit.nvim',
|
|
||||||
keys = {
|
|
||||||
{ '<leader>gg', '<cmd>LazyGit<cr>', desc = 'Open LazyGit' },
|
|
||||||
},
|
|
||||||
cmd = 'LazyGit',
|
|
||||||
-- optional for floating window border decoration
|
|
||||||
dependencies = {
|
|
||||||
'nvim-lua/plenary.nvim',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,706 +0,0 @@
|
||||||
local custom_headers = {
|
|
||||||
sharp = {
|
|
||||||
[[ ]],
|
|
||||||
[[ █ ████████ █████ ███████ ████ ]],
|
|
||||||
[[ ███ ██████ █████ █████████ ██████ ]],
|
|
||||||
[[ █████ ██████████████████████ ████ ███████████████ ]],
|
|
||||||
[[ ██ ██ █████ █████████████ ████ ████████████████ ]],
|
|
||||||
[[ ████ ███████████████ █████████ ████ █████ ██████ ████ ]],
|
|
||||||
[[ ██████ ██████ ███ █████████ ████ █████ █████ ████ ]],
|
|
||||||
[[ ████████ ███████████████████ ████ ████ █████ ████ ████ ]],
|
|
||||||
[[ ]],
|
|
||||||
[[ 🛠️ Sharp tools make good work 🖥️ ]],
|
|
||||||
[[ ]],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
{
|
|
||||||
'nvim-tree/nvim-tree.lua',
|
|
||||||
cmd = { 'NvimTreeToggle', 'NvimTreeFocus' },
|
|
||||||
|
|
||||||
opts = {
|
|
||||||
filters = {
|
|
||||||
dotfiles = false,
|
|
||||||
exclude = { vim.fn.stdpath 'config' .. '/lua/custom' },
|
|
||||||
},
|
|
||||||
disable_netrw = true,
|
|
||||||
hijack_netrw = true,
|
|
||||||
hijack_cursor = true,
|
|
||||||
hijack_unnamed_buffer_when_opening = false,
|
|
||||||
sync_root_with_cwd = true,
|
|
||||||
update_focused_file = {
|
|
||||||
enable = true,
|
|
||||||
update_root = false,
|
|
||||||
},
|
|
||||||
view = {
|
|
||||||
adaptive_size = false,
|
|
||||||
side = 'left',
|
|
||||||
width = 30,
|
|
||||||
preserve_window_proportions = true,
|
|
||||||
},
|
|
||||||
git = {
|
|
||||||
enable = false,
|
|
||||||
ignore = true,
|
|
||||||
},
|
|
||||||
filesystem_watchers = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
actions = {
|
|
||||||
open_file = {
|
|
||||||
resize_window = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
renderer = {
|
|
||||||
root_folder_label = false,
|
|
||||||
highlight_git = false,
|
|
||||||
highlight_opened_files = 'none',
|
|
||||||
|
|
||||||
indent_markers = {
|
|
||||||
enable = false,
|
|
||||||
},
|
|
||||||
|
|
||||||
icons = {
|
|
||||||
show = {
|
|
||||||
file = true,
|
|
||||||
folder = true,
|
|
||||||
folder_arrow = true,
|
|
||||||
git = false,
|
|
||||||
},
|
|
||||||
|
|
||||||
glyphs = {
|
|
||||||
default = '',
|
|
||||||
symlink = '',
|
|
||||||
folder = {
|
|
||||||
default = '',
|
|
||||||
empty = '',
|
|
||||||
empty_open = '',
|
|
||||||
open = '',
|
|
||||||
symlink = '',
|
|
||||||
symlink_open = '',
|
|
||||||
arrow_open = '',
|
|
||||||
arrow_closed = '',
|
|
||||||
},
|
|
||||||
git = {
|
|
||||||
unstaged = '✗',
|
|
||||||
staged = '✓',
|
|
||||||
unmerged = '',
|
|
||||||
renamed = '➜',
|
|
||||||
untracked = '★',
|
|
||||||
deleted = '',
|
|
||||||
ignored = '◌',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config = function(_, opts)
|
|
||||||
require('nvim-tree').setup(opts)
|
|
||||||
end,
|
|
||||||
keys = {
|
|
||||||
{ '<F5>', '<cmd> NvimTreeToggle <cr>', desc = '[T]oggle [F]ile explorer' },
|
|
||||||
{ '<leader>tf', '<cmd> NvimTreeToggle <cr>', desc = '[T]oggle [F]ile explorer' },
|
|
||||||
-- TODO: better map for cd
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'ggandor/leap.nvim',
|
|
||||||
lazy = false,
|
|
||||||
opts = {},
|
|
||||||
keys = {
|
|
||||||
{ 's', '<plug>(leap-forward)', desc = 'leap forward' },
|
|
||||||
{ 'S', '<plug>(leap-backward)', desc = 'leap backward' },
|
|
||||||
{ 'gs', '<plug>(leap-from-window)', desc = 'leap from window' },
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
-- idk why it doesn't work when I just define an opts table, but that is
|
|
||||||
-- so
|
|
||||||
|
|
||||||
local leap = require 'leap'
|
|
||||||
|
|
||||||
leap.opts.safe_labels = 'asfghjkliztrewb'
|
|
||||||
leap.opts.labels = 'sfnjklhodweimbuyvrgtaqpcxz'
|
|
||||||
leap.opts.special_keys = {
|
|
||||||
next_target = '<enter>',
|
|
||||||
prev_target = '<tab>',
|
|
||||||
next_group = '<space>',
|
|
||||||
prev_group = '<tab>',
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'ggandor/flit.nvim',
|
|
||||||
lazy = false,
|
|
||||||
config = function()
|
|
||||||
require('flit').setup {
|
|
||||||
keys = { f = 'f', F = 'F', t = 't', T = 'T' },
|
|
||||||
-- A string like "nv", "nvo", "o", etc.
|
|
||||||
labeled_modes = 'v',
|
|
||||||
multiline = true,
|
|
||||||
-- Like `leap`s similar argument (call-specific overrides).
|
|
||||||
-- E.g.: opts = { equivalence_classes = {} }
|
|
||||||
opts = {},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{ 'echasnovski/mini.trailspace', lazy = false, version = false, opts = { only_in_normal_buffers = true } },
|
|
||||||
{
|
|
||||||
'folke/which-key.nvim',
|
|
||||||
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
|
||||||
opts = {
|
|
||||||
triggers_nowait = {
|
|
||||||
-- marks
|
|
||||||
'`',
|
|
||||||
"'",
|
|
||||||
'g`',
|
|
||||||
"g'",
|
|
||||||
-- registers
|
|
||||||
'"',
|
|
||||||
'<c-r>',
|
|
||||||
-- spelling
|
|
||||||
'z=',
|
|
||||||
'o',
|
|
||||||
'O',
|
|
||||||
},
|
|
||||||
triggers_blacklist = {
|
|
||||||
-- list of mode / prefixes that should never be hooked by WhichKey
|
|
||||||
-- this is mostly relevant for keymaps that start with a native binding
|
|
||||||
i = { 'j', 'k' },
|
|
||||||
v = { 'j', 'k' },
|
|
||||||
n = { 'o', 'O' },
|
|
||||||
},
|
|
||||||
-- plugins = {
|
|
||||||
-- marks = true, -- shows a list of your marks on ' and `
|
|
||||||
-- registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
|
|
||||||
-- -- the presets plugin, adds help for a bunch of default keybindings in Neovim
|
|
||||||
-- -- No actual key bindings are created
|
|
||||||
-- spelling = {
|
|
||||||
-- enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
|
|
||||||
-- suggestions = 20, -- how many suggestions should be shown in the list?
|
|
||||||
-- },
|
|
||||||
-- presets = {
|
|
||||||
-- operators = true, -- adds help for operators like d, y, ...
|
|
||||||
-- motions = true, -- adds help for motions
|
|
||||||
-- text_objects = true, -- help for text objects triggered after entering an operator
|
|
||||||
-- windows = true, -- default bindings on <c-w>
|
|
||||||
-- nav = true, -- misc bindings to work with windows
|
|
||||||
-- z = true, -- bindings for folds, spelling and others prefixed with z
|
|
||||||
-- g = true, -- bindings for prefixed with g
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
icons = {
|
|
||||||
breadcrumb = '»', -- symbol used in the command line area that shows your active key combo
|
|
||||||
separator = '➜', -- symbol used between a key and it's label
|
|
||||||
group = '+', -- symbol prepended to a group
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config = function(opts)
|
|
||||||
local wk = require 'which-key'
|
|
||||||
local defaults = {
|
|
||||||
mode = { 'n', 'v' },
|
|
||||||
{ '<leader>c', group = '[C]ode/[C]olor' },
|
|
||||||
{ '<leader>ct', group = '[T]rouble' },
|
|
||||||
{ '<leader>d', group = '[D]ebug' },
|
|
||||||
{ '<leader>dc', group = '[C]hange' },
|
|
||||||
{ '<leader>dw', group = '[W]indow' },
|
|
||||||
{ '<leader>f', group = '[F]ormatting' },
|
|
||||||
{ '<leader>g', group = '[G]ood tools' },
|
|
||||||
{ '<leader>r', group = '[R]ename' },
|
|
||||||
{ '<leader>t', group = '[T]oggle' },
|
|
||||||
{ '<leader>w', group = '[W]orkspace' },
|
|
||||||
{ '<leader>wb', group = 'buffer' },
|
|
||||||
{ '<localleader>', group = 'select' },
|
|
||||||
{ '<localleader>f', group = '[F]ind' },
|
|
||||||
{ '[', group = 'prev' },
|
|
||||||
{ ']', group = 'next' },
|
|
||||||
{ 'g', group = 'goto' },
|
|
||||||
}
|
|
||||||
wk.add(defaults, opts)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'echasnovski/mini.trailspace',
|
|
||||||
lazy = false,
|
|
||||||
event = { 'BufReadPost', 'BufNewFile' },
|
|
||||||
opts = {
|
|
||||||
only_in_normal_buffers = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'itchyny/vim-cursorword',
|
|
||||||
event = 'FileType',
|
|
||||||
init = function()
|
|
||||||
vim.g.cursorword = 0
|
|
||||||
end,
|
|
||||||
config = function()
|
|
||||||
local augroup = vim.api.nvim_create_augroup('plex_cursorword', {})
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
|
||||||
group = augroup,
|
|
||||||
pattern = {
|
|
||||||
'conf',
|
|
||||||
'dosini',
|
|
||||||
'json',
|
|
||||||
'markdown',
|
|
||||||
'nginx',
|
|
||||||
'text',
|
|
||||||
'yaml',
|
|
||||||
},
|
|
||||||
callback = function()
|
|
||||||
if vim.wo.diff or vim.wo.previewwindow then
|
|
||||||
vim.b.cursorword = 0
|
|
||||||
else
|
|
||||||
vim.b.cursorword = 1
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
vim.api.nvim_create_autocmd('InsertEnter', {
|
|
||||||
group = augroup,
|
|
||||||
callback = function()
|
|
||||||
if vim.b['cursorword'] == 1 then
|
|
||||||
vim.b['cursorword'] = 0
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
vim.api.nvim_create_autocmd('InsertLeave', {
|
|
||||||
group = augroup,
|
|
||||||
callback = function()
|
|
||||||
if vim.b['cursorword'] == 0 then
|
|
||||||
vim.b['cursorword'] = 1
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'RRethy/vim-illuminate',
|
|
||||||
lazy = false,
|
|
||||||
event = { 'BufReadPost', 'BufNewFile' },
|
|
||||||
opts = {
|
|
||||||
-- providers: provider used to get references in the buffer, ordered by priority
|
|
||||||
providers = {
|
|
||||||
'lsp', -- useless for tex but still used
|
|
||||||
'treesitter',
|
|
||||||
'regex',
|
|
||||||
},
|
|
||||||
large_file_cutoff = 50000,
|
|
||||||
delay = 200,
|
|
||||||
under_cursor = true,
|
|
||||||
modes_allowlist = { 'n', 'no', 'nt' },
|
|
||||||
filetypes_denylist = {
|
|
||||||
'DiffviewFileHistory',
|
|
||||||
'DiffviewFiles',
|
|
||||||
'SidebarNvim',
|
|
||||||
'fugitive',
|
|
||||||
'git',
|
|
||||||
'minifiles',
|
|
||||||
'neo-tree',
|
|
||||||
'NvimTree_1',
|
|
||||||
'dashboard',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- looks weird but is useful: put your cursor on a word and other occurences
|
|
||||||
-- of the word in your buffer will be highlighted. You can then use
|
|
||||||
-- '[[' and ']]' to go to the next or previous occurence.
|
|
||||||
--
|
|
||||||
-- Try it:
|
|
||||||
--
|
|
||||||
-- word #### word ###########
|
|
||||||
-- ############## word ######
|
|
||||||
-- #### word #### word word #
|
|
||||||
--
|
|
||||||
-- (Does only work if the regex source is currently active, otherwise the
|
|
||||||
-- references are those your language server or treesitter gives out, so
|
|
||||||
-- syntax aware)
|
|
||||||
keys = {
|
|
||||||
{ ']]', desc = 'Next Reference' },
|
|
||||||
{ '[[', desc = 'Prev Reference' },
|
|
||||||
},
|
|
||||||
config = function(_, opts)
|
|
||||||
local illuminate = require 'illuminate'
|
|
||||||
illuminate.configure(opts)
|
|
||||||
vim.keymap.set('n', '[[', function()
|
|
||||||
illuminate.goto_prev_reference() -- try putting your cursor on `illuminate`
|
|
||||||
end, { desc = 'Goto last occurence of current word' })
|
|
||||||
vim.keymap.set('n', ']]', function()
|
|
||||||
illuminate.goto_next_reference()
|
|
||||||
end, { desc = 'Goto next occurence of current word' })
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'folke/todo-comments.nvim',
|
|
||||||
lazy = false,
|
|
||||||
dependencies = 'nvim-telescope/telescope.nvim',
|
|
||||||
-- stylua: ignore
|
|
||||||
keys = {
|
|
||||||
{ ']t', function() require('todo-comments').jump_next() end, desc = 'Next todo comment' },
|
|
||||||
{ '[t', function() require('todo-comments').jump_prev() end, desc = 'Previous todo comment' },
|
|
||||||
{ '<LocalLeader>fdt', '<cmd>TodoTelescope<CR>', desc = 'todo' },
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
signs = true,
|
|
||||||
keywords = {
|
|
||||||
FIX = {
|
|
||||||
icon = ' ', -- icon used for the sign, and in search results
|
|
||||||
color = 'error', -- can be a hex color, or a named color (see below)
|
|
||||||
alt = { 'FIXME', 'BUG', 'FIXIT', 'ISSUE' }, -- a set of other keywords that all map to this FIX keywords
|
|
||||||
},
|
|
||||||
TODO = { icon = ' ', color = 'todo' },
|
|
||||||
HACK = { icon = ' ', color = 'hack' },
|
|
||||||
SECURITY = { icon = ' ', color = 'security' },
|
|
||||||
WARN = { icon = ' ', color = 'warning', alt = { 'WARNING', 'XXX' } },
|
|
||||||
PERF = { icon = ' ', color = 'perf', alt = { 'OPTIM', 'PERFORMANCE', 'OPTIMIZE' } },
|
|
||||||
NOTE = { icon = ' ', color = 'hint', alt = { 'INFO', 'IDEA' } },
|
|
||||||
TEST = { icon = '⏲ ', color = 'test', alt = { 'TESTING', 'PASSED', 'FAILED' } },
|
|
||||||
},
|
|
||||||
colors = {
|
|
||||||
error = { 'DiagnosticError', 'ErrorMsg', '#DC2626' },
|
|
||||||
warning = { 'DiagnosticWarn', 'WarningMsg', '#FBBF24' },
|
|
||||||
todo = { 'DiagnosticTodo', '#80e64d' },
|
|
||||||
hint = { 'DiagnosticHint', '#10B981' },
|
|
||||||
hack = { 'DiagnosticHack', '#FF33FF' },
|
|
||||||
security = { 'DiagnosticSecurity', '#FF6600' },
|
|
||||||
default = { 'Identifier', '#7C3AED' },
|
|
||||||
test = { 'DiagnosticTest', '#E6E600' },
|
|
||||||
perf = { 'DiagnosticPerf', '#9999ff' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'akinsho/toggleterm.nvim',
|
|
||||||
keys = {
|
|
||||||
{ '<F12>', mode = { 't', 'n', 'v' }, '<cmd>exe v:count1 "ToggleTerm direction=float"<cr>', desc = 'Toggle a big floating terminal' },
|
|
||||||
{ '<A-i>', mode = { 't', 'n', 'v' }, '<cmd>exe v:count1 "ToggleTerm direction=float"<cr>', desc = 'Toggle a big floating terminal' },
|
|
||||||
{ '<A-t>', mode = { 't', 'n', 'v' }, '<cmd>exe v:count1 "ToggleTerm direction=tab"<cr>', desc = 'Toggle a terminal in a new tab' },
|
|
||||||
{ '<A-h>', mode = { 't', 'n', 'v' }, '<cmd>exe v:count1 "ToggleTerm direction=horizontal"<cr>', desc = 'Toggle a horizontal terminal' },
|
|
||||||
{ '<A-v>', mode = { 't', 'n', 'v' }, '<cmd>exe v:count1 "ToggleTerm direction=vertical"<cr>', desc = 'Toggle a vertical terminal' },
|
|
||||||
},
|
|
||||||
cmd = 'ToggleTerm',
|
|
||||||
opts = {
|
|
||||||
size = function(term)
|
|
||||||
if term.direction == 'horizontal' then
|
|
||||||
return vim.o.lines * 0.35
|
|
||||||
elseif term.direction == 'vertical' then
|
|
||||||
return vim.o.columns * 0.35
|
|
||||||
else
|
|
||||||
return 20
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
open_mapping = false,
|
|
||||||
float_opts = {
|
|
||||||
border = 'curved',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'folke/noice.nvim',
|
|
||||||
enabled = not vim.g.started_by_firenvim,
|
|
||||||
event = 'VeryLazy',
|
|
||||||
-- config.lsp.signature.enabled = false
|
|
||||||
dependencies = {
|
|
||||||
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
|
|
||||||
'MunifTanjim/nui.nvim',
|
|
||||||
-- OPTIONAL:
|
|
||||||
-- `nvim-notify` is only needed, if you want to use the notification view.
|
|
||||||
-- If not available, we use `mini` as the fallback
|
|
||||||
'rcarriga/nvim-notify',
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require('notify').setup {
|
|
||||||
top_down = false,
|
|
||||||
}
|
|
||||||
require('noice').setup {
|
|
||||||
lsp = {
|
|
||||||
override = {
|
|
||||||
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
|
|
||||||
['vim.lsp.util.stylize_markdown'] = true,
|
|
||||||
['cmp.entry.get_documentation'] = true,
|
|
||||||
},
|
|
||||||
-- IDK how to disable the nvchad builtins for this, which would
|
|
||||||
-- produce a conflict
|
|
||||||
signature = { enabled = false },
|
|
||||||
hover = { enabled = false },
|
|
||||||
progress = {
|
|
||||||
enabled = true,
|
|
||||||
-- Lsp Progress is formatted using the builtins for lsp_progress. See config.format.builtin
|
|
||||||
-- See the section on formatting for more details on how to customize.
|
|
||||||
--- @type NoiceFormat|string
|
|
||||||
format = 'lsp_progress',
|
|
||||||
--- @type NoiceFormat|string
|
|
||||||
format_done = 'lsp_progress_done',
|
|
||||||
throttle = 1000 / 30, -- frequency to update lsp progress message
|
|
||||||
view = 'mini', -- default: mini
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- you can enable a preset for easier configuration
|
|
||||||
presets = {
|
|
||||||
bottom_search = true, -- use a classic bottom cmdline for search
|
|
||||||
command_palette = true, -- position the cmdline and popupmenu together
|
|
||||||
long_message_to_split = true, -- long messages will be sent to a split
|
|
||||||
inc_rename = true, -- enables an input dialog for inc-rename.nvim
|
|
||||||
lsp_doc_border = true, -- add a border to hover docs and signature help
|
|
||||||
},
|
|
||||||
messages = {
|
|
||||||
enabled = true,
|
|
||||||
-- NOTE: we keep it with notify,
|
|
||||||
-- change this to something else if you want
|
|
||||||
view_error = 'notify',
|
|
||||||
},
|
|
||||||
popupmenu = {
|
|
||||||
enabled = true,
|
|
||||||
},
|
|
||||||
notify = {
|
|
||||||
enabled = true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'stevearc/dressing.nvim',
|
|
||||||
init = function()
|
|
||||||
---@diagnostic disable-next-line: duplicate-set-field
|
|
||||||
vim.ui.select = function(...)
|
|
||||||
require('lazy').load { plugins = { 'dressing.nvim' } }
|
|
||||||
return vim.ui.select(...)
|
|
||||||
end
|
|
||||||
---@diagnostic disable-next-line: duplicate-set-field
|
|
||||||
vim.ui.input = function(...)
|
|
||||||
require('lazy').load { plugins = { 'dressing.nvim' } }
|
|
||||||
return vim.ui.input(...)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'chentoast/marks.nvim',
|
|
||||||
lazy = false,
|
|
||||||
dependencies = 'lewis6991/gitsigns.nvim',
|
|
||||||
event = 'FileType',
|
|
||||||
opts = {
|
|
||||||
sign_priority = { lower = 10, upper = 15, builtin = 8, bookmark = 20 },
|
|
||||||
bookmark_1 = { sign = '' }, -- ⚐ ⚑
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'Bekaboo/deadcolumn.nvim',
|
|
||||||
event = { 'BufReadPre', 'BufNewFile' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'kevinhwang91/nvim-ufo',
|
|
||||||
event = { 'BufReadPost', 'BufNewFile' },
|
|
||||||
-- stylua: ignore
|
|
||||||
keys = {
|
|
||||||
{ 'zR', function() require('ufo').openAllFolds() end },
|
|
||||||
{ 'zM', function() require('ufo').closeAllFolds() end },
|
|
||||||
},
|
|
||||||
dependencies = {
|
|
||||||
'kevinhwang91/promise-async',
|
|
||||||
'nvim-treesitter/nvim-treesitter',
|
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
},
|
|
||||||
opts = function()
|
|
||||||
-- fancy display function for folds (stolen from nvim-ufo readme)
|
|
||||||
local handler = function(virtText, lnum, endLnum, width, truncate)
|
|
||||||
local newVirtText = {}
|
|
||||||
local suffix = (' %d '):format(endLnum - lnum)
|
|
||||||
local sufWidth = vim.fn.strdisplaywidth(suffix)
|
|
||||||
local targetWidth = width - sufWidth
|
|
||||||
local curWidth = 0
|
|
||||||
for _, chunk in ipairs(virtText) do
|
|
||||||
local chunkText = chunk[1]
|
|
||||||
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
|
||||||
if targetWidth > curWidth + chunkWidth then
|
|
||||||
table.insert(newVirtText, chunk)
|
|
||||||
else
|
|
||||||
chunkText = truncate(chunkText, targetWidth - curWidth)
|
|
||||||
local hlGroup = chunk[2]
|
|
||||||
table.insert(newVirtText, { chunkText, hlGroup })
|
|
||||||
chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
|
||||||
-- str width returned from truncate() may less than 2nd argument, need padding
|
|
||||||
if curWidth + chunkWidth < targetWidth then
|
|
||||||
suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth)
|
|
||||||
end
|
|
||||||
break
|
|
||||||
end
|
|
||||||
curWidth = curWidth + chunkWidth
|
|
||||||
end
|
|
||||||
table.insert(newVirtText, { suffix, 'MoreMsg' })
|
|
||||||
return newVirtText
|
|
||||||
end
|
|
||||||
require('ufo').setup {
|
|
||||||
-- use treesitter to get the folds
|
|
||||||
provider_selector = function(bufnr, filetype, buftype)
|
|
||||||
return { 'treesitter', 'indent' }
|
|
||||||
end,
|
|
||||||
-- apply out fancy fold display
|
|
||||||
fold_virt_text_handler = handler,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'b0o/incline.nvim',
|
|
||||||
event = 'FileType',
|
|
||||||
config = function()
|
|
||||||
local function get_diagnostic_label(props)
|
|
||||||
local icons = { error = '', warn = '', info = '', hint = '' }
|
|
||||||
local label = {}
|
|
||||||
|
|
||||||
for severity, icon in pairs(icons) do
|
|
||||||
local n = #vim.diagnostic.get(props.buf, { severity = vim.diagnostic.severity[string.upper(severity)] })
|
|
||||||
if n > 0 then
|
|
||||||
table.insert(label, { icon .. ' ' .. n .. ' ', group = 'DiagnosticSign' .. severity })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if #label > 0 then
|
|
||||||
table.insert(label, { '| ' })
|
|
||||||
end
|
|
||||||
return label
|
|
||||||
end
|
|
||||||
local function get_git_diff(props)
|
|
||||||
local icons = { removed = '', changed = '', added = '' }
|
|
||||||
local labels = {}
|
|
||||||
-- local signs = vim.api.nvim_buf_get_var(props.buf, "gitsigns_status_dict")
|
|
||||||
-- local signs = vim.b.gitsigns_status_dict
|
|
||||||
-- for name, icon in pairs(icons) do
|
|
||||||
-- if tonumber(signs[name]) and signs[name] > 0 then
|
|
||||||
-- table.insert(labels, { icon .. " " .. signs[name] .. " ", group = "Diff" .. name })
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
if #labels > 0 then
|
|
||||||
table.insert(labels, { '| ' })
|
|
||||||
end
|
|
||||||
return labels
|
|
||||||
end
|
|
||||||
|
|
||||||
require('incline').setup {
|
|
||||||
render = function(props)
|
|
||||||
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':t')
|
|
||||||
local ft_icon, ft_color = require('nvim-web-devicons').get_icon_color(filename)
|
|
||||||
local modified = vim.api.nvim_buf_get_option(props.buf, 'modified') and 'bold,italic' or 'bold'
|
|
||||||
|
|
||||||
local buffer = {
|
|
||||||
{ get_diagnostic_label(props) },
|
|
||||||
{ get_git_diff(props) },
|
|
||||||
{ ft_icon, guifg = ft_color },
|
|
||||||
{ ' ' },
|
|
||||||
{ filename, gui = modified },
|
|
||||||
}
|
|
||||||
return buffer
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'iamcco/markdown-preview.nvim',
|
|
||||||
cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview', 'MarkdownPreviewStop' },
|
|
||||||
ft = { 'markdown' },
|
|
||||||
build = function()
|
|
||||||
vim.fn['mkdp#util#install']()
|
|
||||||
end,
|
|
||||||
config = function()
|
|
||||||
-- Ugly fix for wsl not finding my browser
|
|
||||||
-- I HATE windows
|
|
||||||
vim.g.mkdp_echo_preview_url = 1
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'nvim-lualine/lualine.nvim',
|
|
||||||
lazy = false,
|
|
||||||
dependencies = {
|
|
||||||
'nvim-tree/nvim-web-devicons',
|
|
||||||
'yavorski/lualine-macro-recording.nvim',
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require('lualine').setup {
|
|
||||||
options = {
|
|
||||||
theme = 'horizon',
|
|
||||||
},
|
|
||||||
sections = {
|
|
||||||
lualine_a = { 'mode' },
|
|
||||||
lualine_b = { 'branch', 'diff', 'diagnostics' },
|
|
||||||
lualine_c = { { 'macro_recording', color = { fg = '#ff9e3b' } }, 'filename', 'locatoin' },
|
|
||||||
lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
|
||||||
lualine_y = { 'progress' },
|
|
||||||
lualine_z = { 'location' },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'akinsho/bufferline.nvim',
|
|
||||||
dependencies = {
|
|
||||||
'nvim-tree/nvim-web-devicons',
|
|
||||||
{
|
|
||||||
'tiagovla/scope.nvim',
|
|
||||||
config = function()
|
|
||||||
require('scope').setup {}
|
|
||||||
require('telescope').load_extension 'scope'
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
vim.opt.termguicolors = true
|
|
||||||
require('bufferline').setup {}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'MeanderingProgrammer/dashboard.nvim',
|
|
||||||
enable = true,
|
|
||||||
event = 'VimEnter',
|
|
||||||
dependencies = {
|
|
||||||
'MaximilianLloyd/ascii.nvim',
|
|
||||||
},
|
|
||||||
init = function()
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufWinEnter', 'VimEnter' }, {
|
|
||||||
pattern = { 'dashboard', 'text', 'help', '*' },
|
|
||||||
callback = function()
|
|
||||||
vim.b.minitrailspace_disable = true
|
|
||||||
vim.opt_local.list = false
|
|
||||||
vim.opt_local.colorcolumn = '0'
|
|
||||||
vim.opt_local.spell = false
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
config = function()
|
|
||||||
-- Do not show trailing space in unmodifiable types
|
|
||||||
require('dashboard').setup {
|
|
||||||
-- Dashboard header
|
|
||||||
header = custom_headers.sharp,
|
|
||||||
-- List of directory paths, or functions that return paths
|
|
||||||
directories = {
|
|
||||||
'~/.config/nvim',
|
|
||||||
'~/Documents/code',
|
|
||||||
'~/Documents/novel',
|
|
||||||
},
|
|
||||||
-- Format to display date in
|
|
||||||
date_format = '%Y-%m-%d %H:%M:%S',
|
|
||||||
-- Sections to add at bottom, these can be string references to
|
|
||||||
-- functions in sections.lua, custom strings, or custom functions
|
|
||||||
footer = {
|
|
||||||
[[ ]],
|
|
||||||
[[ Theme ;ft ]],
|
|
||||||
[[ Git ␣gg ]],
|
|
||||||
[[ Find File ;ff ]],
|
|
||||||
[[ Recent Files ;fo ]],
|
|
||||||
[[ Find Word ;fw ]],
|
|
||||||
[[ Bookmarks ;fm ]],
|
|
||||||
[[ ]],
|
|
||||||
[[ Change Directory ;cd ]],
|
|
||||||
[[ Files F5 ]],
|
|
||||||
[[ Terminal F12 ]],
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Gets called after directory is changed and is provided with the
|
|
||||||
-- directory path as an argument
|
|
||||||
on_load = function(path)
|
|
||||||
-- Do nothing
|
|
||||||
end,
|
|
||||||
-- Highlight groups to use for various components
|
|
||||||
highlight_groups = {
|
|
||||||
header = 'Constant',
|
|
||||||
icon = 'Type',
|
|
||||||
directory = 'Delimiter',
|
|
||||||
hotkey = 'Statement',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,84 +0,0 @@
|
||||||
local M = {}
|
|
||||||
--- this function will split a string into a table of tokens, like it would
|
|
||||||
--- be passed into the `argv` of a program that was executed from the commandline
|
|
||||||
---
|
|
||||||
--- @param raw string string of cli args that should be split
|
|
||||||
--- @return table tokens args as a table
|
|
||||||
M.tokenize_args = function(raw)
|
|
||||||
-- NOTE: string.gmatch is does not use regex, but a smaller pattern matcher!
|
|
||||||
-- A complete regex parser would be larger than lua itself. See
|
|
||||||
-- [Programming in Lua 20.2](https://www.lua.org/pil/20.2.html).
|
|
||||||
--
|
|
||||||
-- Notable differences:
|
|
||||||
-- '-' is ungreedy wildcard
|
|
||||||
-- '*?' does not work
|
|
||||||
-- '|' is not or
|
|
||||||
--
|
|
||||||
-- This means we're better of implementing the lexer with an algorithm.
|
|
||||||
local t = {}
|
|
||||||
local current = ""
|
|
||||||
local in_str = false
|
|
||||||
local str_seek
|
|
||||||
for c in string.gmatch(raw, ".") do -- iterate through all chars
|
|
||||||
if c == " " and not in_str then
|
|
||||||
if string.len(current) > 0 then
|
|
||||||
table.insert(t, current)
|
|
||||||
current = ""
|
|
||||||
end
|
|
||||||
elseif c == '"' and not in_str then
|
|
||||||
in_str = true
|
|
||||||
str_seek = '"'
|
|
||||||
elseif c == "'" and not in_str then
|
|
||||||
in_str = true
|
|
||||||
str_seek = "'"
|
|
||||||
elseif c == str_seek and in_str then
|
|
||||||
in_str = false
|
|
||||||
table.insert(t, current)
|
|
||||||
current = ""
|
|
||||||
else
|
|
||||||
current = current .. c
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if string.len(current) > 0 then
|
|
||||||
table.insert(t, current)
|
|
||||||
end
|
|
||||||
return t
|
|
||||||
end
|
|
||||||
|
|
||||||
--- dumps a variable into a string, so it can be printed. This is meant for
|
|
||||||
--- debug prints
|
|
||||||
--- @param t any variable
|
|
||||||
--- @return string t_dumped t dumped to string
|
|
||||||
M.dump = function(t)
|
|
||||||
if type(t) == "table" then
|
|
||||||
local s = "{ "
|
|
||||||
for k, v in pairs(t) do
|
|
||||||
if type(k) ~= "number" then
|
|
||||||
k = '"' .. k .. '"'
|
|
||||||
end
|
|
||||||
if k ~= 1 then
|
|
||||||
s = s .. ", "
|
|
||||||
end
|
|
||||||
s = s .. "[" .. k .. "] = '" .. M.dump(v) .. "'"
|
|
||||||
end
|
|
||||||
return s .. " }"
|
|
||||||
else
|
|
||||||
return tostring(t)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Try to require a module
|
|
||||||
--- @param module string module name
|
|
||||||
--- @return boolean available is the module available?
|
|
||||||
--- @return any loaded_module the loaded module if it is available
|
|
||||||
M.try_require = function(module)
|
|
||||||
local available, loaded_module = pcall(require, module)
|
|
||||||
if not available then
|
|
||||||
return available, nil
|
|
||||||
else
|
|
||||||
return available, loaded_module
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
--[[
|
|
||||||
--
|
|
||||||
-- This file is not required for your own configuration,
|
|
||||||
-- but helps people determine if their system is setup correctly.
|
|
||||||
--
|
|
||||||
--]]
|
|
||||||
|
|
||||||
local check_version = function()
|
|
||||||
local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch)
|
|
||||||
if not vim.version.cmp then
|
|
||||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then
|
|
||||||
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
|
|
||||||
else
|
|
||||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local check_external_reqs = function()
|
|
||||||
-- Basic utils: `git`, `make`, `unzip`
|
|
||||||
for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do
|
|
||||||
local is_executable = vim.fn.executable(exe) == 1
|
|
||||||
if is_executable then
|
|
||||||
vim.health.ok(string.format("Found executable: '%s'", exe))
|
|
||||||
else
|
|
||||||
vim.health.warn(string.format("Could not find executable: '%s'", exe))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
check = function()
|
|
||||||
vim.health.start 'kickstart.nvim'
|
|
||||||
|
|
||||||
vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth`
|
|
||||||
|
|
||||||
Fix only warnings for plugins and languages you intend to use.
|
|
||||||
Mason will give warnings for languages that are not installed.
|
|
||||||
You do not need to install, unless you want to use those languages!]]
|
|
||||||
|
|
||||||
local uv = vim.uv or vim.loop
|
|
||||||
vim.health.info('System Information: ' .. vim.inspect(uv.os_uname()))
|
|
||||||
|
|
||||||
check_version()
|
|
||||||
check_external_reqs()
|
|
||||||
end,
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
-- autopairs
|
|
||||||
-- https://github.com/windwp/nvim-autopairs
|
|
||||||
|
|
||||||
return {
|
|
||||||
'windwp/nvim-autopairs',
|
|
||||||
event = 'InsertEnter',
|
|
||||||
-- Optional dependency
|
|
||||||
dependencies = { 'hrsh7th/nvim-cmp' },
|
|
||||||
config = function()
|
|
||||||
require('nvim-autopairs').setup {}
|
|
||||||
-- If you want to automatically add `(` after selecting a function or method
|
|
||||||
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
|
|
||||||
local cmp = require 'cmp'
|
|
||||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
|
||||||
end,
|
|
||||||
}
|
|
|
@ -1,212 +0,0 @@
|
||||||
-- debug.lua
|
|
||||||
--
|
|
||||||
-- Shows how to use the DAP plugin to debug your code.
|
|
||||||
--
|
|
||||||
-- Primarily focused on configuring the debugger for Go, but can
|
|
||||||
-- be extended to other languages as well. That's why it's called
|
|
||||||
-- kickstart.nvim and not kitchen-sink.nvim ;)
|
|
||||||
|
|
||||||
return {
|
|
||||||
{
|
|
||||||
-- NOTE: Yes, you can install new plugins here!
|
|
||||||
'mfussenegger/nvim-dap',
|
|
||||||
-- NOTE: And you can specify dependencies as well
|
|
||||||
dependencies = {
|
|
||||||
-- Creates a beautiful debugger UI
|
|
||||||
|
|
||||||
-- Required dependency for nvim-dap-ui
|
|
||||||
'nvim-neotest/nvim-nio',
|
|
||||||
|
|
||||||
-- Installs the debug adapters for you
|
|
||||||
'williamboman/mason.nvim',
|
|
||||||
'jay-babu/mason-nvim-dap.nvim',
|
|
||||||
|
|
||||||
'theHamsta/nvim-dap-virtual-text',
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local dap = require 'dap'
|
|
||||||
local dapui = require 'dapui'
|
|
||||||
|
|
||||||
require('mason-nvim-dap').setup {
|
|
||||||
-- Makes a best effort to setup the various debuggers with
|
|
||||||
-- reasonable debug configurations
|
|
||||||
automatic_installation = true,
|
|
||||||
|
|
||||||
-- You can provide additional configuration to the handlers,
|
|
||||||
-- see mason-nvim-dap README for more information
|
|
||||||
handlers = {},
|
|
||||||
|
|
||||||
-- You'll need to check that you have the required things installed
|
|
||||||
-- online, please don't ask me how to install them :)
|
|
||||||
ensure_installed = {
|
|
||||||
-- Update this to ensure that you have the debuggers for the langs you want
|
|
||||||
'codelldb',
|
|
||||||
'debugpy',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Basic debugging keymaps, feel free to change to your liking!
|
|
||||||
vim.keymap.set('n', '<leader>dB', function() end, { desc = 'Debug: Set Breakpoint' })
|
|
||||||
|
|
||||||
-- Dap UI setup
|
|
||||||
-- For more information, see |:help nvim-dap-ui|
|
|
||||||
dapui.setup {
|
|
||||||
-- Set icons to characters that are more likely to work in every terminal.
|
|
||||||
-- Feel free to remove or use ones that you like more! :)
|
|
||||||
-- Don't feel like these are good choices.
|
|
||||||
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
|
||||||
controls = {
|
|
||||||
icons = {
|
|
||||||
pause = '⏸',
|
|
||||||
play = '▶',
|
|
||||||
step_into = '⏎',
|
|
||||||
step_over = '⏭',
|
|
||||||
step_out = '⏮',
|
|
||||||
step_back = 'b',
|
|
||||||
run_last = '▶▶',
|
|
||||||
terminate = '⏹',
|
|
||||||
disconnect = '⏏',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
|
||||||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
|
||||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'rcarriga/nvim-dap-ui',
|
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
'<leader>du',
|
|
||||||
function()
|
|
||||||
require('dapui').toggle()
|
|
||||||
end,
|
|
||||||
|
|
||||||
desc = 'Open [D]ebug [U]i',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>dso',
|
|
||||||
function()
|
|
||||||
require('dap').step_over()
|
|
||||||
end,
|
|
||||||
|
|
||||||
desc = 'Toggle [D]ebug [S]tep [O]ver',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>dsi',
|
|
||||||
function()
|
|
||||||
require('dap').step_into()
|
|
||||||
end,
|
|
||||||
|
|
||||||
desc = 'Toggle [D]ebug [S]tep [I]nto',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>dc',
|
|
||||||
function()
|
|
||||||
require('dap').continue()
|
|
||||||
end,
|
|
||||||
|
|
||||||
desc = 'Toggle [D]ebug [C]ontinue / Start',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>db',
|
|
||||||
function()
|
|
||||||
require('dap').toggle_breakpoint()
|
|
||||||
end,
|
|
||||||
|
|
||||||
desc = 'Toggle [D]ebug [B]reakpoint',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>dB',
|
|
||||||
function()
|
|
||||||
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
|
||||||
end,
|
|
||||||
|
|
||||||
desc = 'Toggle [D]ebug [B]reakpoint condition',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>dK',
|
|
||||||
function()
|
|
||||||
require('dap.ui.widgets').hover()
|
|
||||||
end,
|
|
||||||
|
|
||||||
desc = 'Open [D]ebug [K] hover',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>dws',
|
|
||||||
function()
|
|
||||||
local widgets = require 'dap.ui.widgets'
|
|
||||||
local my_sidebar = widgets.sidebar(widgets.scopes)
|
|
||||||
my_sidebar.open()
|
|
||||||
end,
|
|
||||||
desc = 'Open [D]ebug [W]indow [S]copes',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>dwr',
|
|
||||||
function()
|
|
||||||
require('dap').repl.toggle()
|
|
||||||
end,
|
|
||||||
|
|
||||||
desc = 'Open [D]ebug [W]indow [R]epl',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>dwf',
|
|
||||||
function()
|
|
||||||
local widgets = require 'dap.ui.widgets'
|
|
||||||
local my_sidebar = widgets.sidebar(widgets.frames)
|
|
||||||
my_sidebar.open()
|
|
||||||
end,
|
|
||||||
|
|
||||||
desc = 'Open [D]ebug [W]indow [F]rames',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>dwi',
|
|
||||||
function()
|
|
||||||
local widgets = require 'dap.ui.widgets'
|
|
||||||
local my_sidebar = widgets.sidebar(widgets.sessions)
|
|
||||||
my_sidebar.open()
|
|
||||||
end,
|
|
||||||
desc = 'Open [D]ebug [W]indow sess[I]ons',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>dwt',
|
|
||||||
function()
|
|
||||||
local widgets = require 'dap.ui.widgets'
|
|
||||||
local my_sidebar = widgets.sidebar(widgets.threads)
|
|
||||||
my_sidebar.open()
|
|
||||||
end,
|
|
||||||
desc = 'Open [D]ebug [W]indow [T]hreads',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>dwe',
|
|
||||||
function()
|
|
||||||
local widgets = require 'dap.ui.widgets'
|
|
||||||
local my_sidebar = widgets.sidebar(widgets.expression)
|
|
||||||
my_sidebar.open()
|
|
||||||
end,
|
|
||||||
|
|
||||||
desc = 'Open [D]ebug [W]indow [E]xpression',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
dependencies = {
|
|
||||||
'mfussenegger/nvim-dap',
|
|
||||||
'nvim-neotest/nvim-nio',
|
|
||||||
},
|
|
||||||
config = function(_, opts)
|
|
||||||
local dap = require 'dap'
|
|
||||||
local dapui = require 'dapui'
|
|
||||||
dapui.setup(opts)
|
|
||||||
dap.listeners.after.event_initialized['dapui_config'] = function()
|
|
||||||
dapui.open {}
|
|
||||||
end
|
|
||||||
dap.listeners.before.event_terminated['dapui_config'] = function()
|
|
||||||
-- dapui.close {}
|
|
||||||
end
|
|
||||||
dap.listeners.before.event_exited['dapui_config'] = function()
|
|
||||||
-- dapui.close {}
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
|
||||||
-- NOTE: gitsigns is already included in init.lua but contains only the base
|
|
||||||
-- config. This will add also the recommended keymaps.
|
|
||||||
|
|
||||||
return {
|
|
||||||
{
|
|
||||||
'lewis6991/gitsigns.nvim',
|
|
||||||
opts = {
|
|
||||||
on_attach = function(bufnr)
|
|
||||||
local gitsigns = require 'gitsigns'
|
|
||||||
|
|
||||||
local function map(mode, l, r, opts)
|
|
||||||
opts = opts or {}
|
|
||||||
opts.buffer = bufnr
|
|
||||||
vim.keymap.set(mode, l, r, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Navigation
|
|
||||||
map('n', ']c', function()
|
|
||||||
if vim.wo.diff then
|
|
||||||
vim.cmd.normal { ']c', bang = true }
|
|
||||||
else
|
|
||||||
gitsigns.nav_hunk 'next'
|
|
||||||
end
|
|
||||||
end, { desc = 'Jump to next git [c]hange' })
|
|
||||||
|
|
||||||
map('n', '[c', function()
|
|
||||||
if vim.wo.diff then
|
|
||||||
vim.cmd.normal { '[c', bang = true }
|
|
||||||
else
|
|
||||||
gitsigns.nav_hunk 'prev'
|
|
||||||
end
|
|
||||||
end, { desc = 'Jump to previous git [c]hange' })
|
|
||||||
|
|
||||||
-- Actions
|
|
||||||
-- visual mode
|
|
||||||
map('v', '<leader>hs', function()
|
|
||||||
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
|
||||||
end, { desc = 'stage git hunk' })
|
|
||||||
map('v', '<leader>hr', function()
|
|
||||||
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
|
||||||
end, { desc = 'reset git hunk' })
|
|
||||||
-- normal mode
|
|
||||||
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
|
||||||
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
|
||||||
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
|
|
||||||
map('n', '<leader>hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' })
|
|
||||||
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
|
|
||||||
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
|
||||||
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
|
|
||||||
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
|
||||||
map('n', '<leader>hD', function()
|
|
||||||
gitsigns.diffthis '@'
|
|
||||||
end, { desc = 'git [D]iff against last commit' })
|
|
||||||
-- Toggles
|
|
||||||
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
|
||||||
map('n', '<leader>tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' })
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
return {
|
|
||||||
{ -- Add indentation guides even on blank lines
|
|
||||||
'lukas-reineke/indent-blankline.nvim',
|
|
||||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
|
||||||
-- See `:help ibl`
|
|
||||||
main = 'ibl',
|
|
||||||
opts = {
|
|
||||||
indentLine_enabled = 1,
|
|
||||||
filetype_exclude = {
|
|
||||||
'help',
|
|
||||||
'terminal',
|
|
||||||
'lazy',
|
|
||||||
'lspinfo',
|
|
||||||
'TelescopePrompt',
|
|
||||||
'TelescopeResults',
|
|
||||||
'mason',
|
|
||||||
'dashboard',
|
|
||||||
'',
|
|
||||||
},
|
|
||||||
buftype_exclude = { 'terminal' },
|
|
||||||
show_trailing_blankline_indent = false,
|
|
||||||
show_first_indent_level = false,
|
|
||||||
show_current_context = true,
|
|
||||||
show_current_context_start = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
return {
|
|
||||||
|
|
||||||
{ -- Linting
|
|
||||||
'mfussenegger/nvim-lint',
|
|
||||||
event = { 'BufReadPre', 'BufNewFile' },
|
|
||||||
config = function()
|
|
||||||
local lint = require 'lint'
|
|
||||||
lint.linters_by_ft = {
|
|
||||||
markdown = { 'markdownlint' },
|
|
||||||
}
|
|
||||||
|
|
||||||
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
|
||||||
-- instead set linters_by_ft like this:
|
|
||||||
-- lint.linters_by_ft = lint.linters_by_ft or {}
|
|
||||||
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
|
|
||||||
--
|
|
||||||
-- However, note that this will enable a set of default linters,
|
|
||||||
-- which will cause errors unless these tools are available:
|
|
||||||
-- {
|
|
||||||
-- clojure = { "clj-kondo" },
|
|
||||||
-- dockerfile = { "hadolint" },
|
|
||||||
-- inko = { "inko" },
|
|
||||||
-- janet = { "janet" },
|
|
||||||
-- json = { "jsonlint" },
|
|
||||||
-- markdown = { "vale" },
|
|
||||||
-- rst = { "vale" },
|
|
||||||
-- ruby = { "ruby" },
|
|
||||||
-- terraform = { "tflint" },
|
|
||||||
-- text = { "vale" }
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- You can disable the default linters by setting their filetypes to nil:
|
|
||||||
-- lint.linters_by_ft['clojure'] = nil
|
|
||||||
-- lint.linters_by_ft['dockerfile'] = nil
|
|
||||||
-- lint.linters_by_ft['inko'] = nil
|
|
||||||
-- lint.linters_by_ft['janet'] = nil
|
|
||||||
-- lint.linters_by_ft['json'] = nil
|
|
||||||
-- lint.linters_by_ft['markdown'] = nil
|
|
||||||
-- lint.linters_by_ft['rst'] = nil
|
|
||||||
-- lint.linters_by_ft['ruby'] = nil
|
|
||||||
-- lint.linters_by_ft['terraform'] = nil
|
|
||||||
-- lint.linters_by_ft['text'] = nil
|
|
||||||
|
|
||||||
-- Create autocommand which carries out the actual linting
|
|
||||||
-- on the specified events.
|
|
||||||
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
|
||||||
group = lint_augroup,
|
|
||||||
callback = function()
|
|
||||||
require('lint').try_lint()
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
-- Neo-tree is a Neovim plugin to browse the file system
|
|
||||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
|
||||||
|
|
||||||
return {
|
|
||||||
'nvim-neo-tree/neo-tree.nvim',
|
|
||||||
version = '*',
|
|
||||||
dependencies = {
|
|
||||||
'nvim-lua/plenary.nvim',
|
|
||||||
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
|
||||||
'MunifTanjim/nui.nvim',
|
|
||||||
},
|
|
||||||
cmd = 'Neotree',
|
|
||||||
keys = {
|
|
||||||
{ '\\', ':Neotree reveal<CR>', { desc = 'NeoTree reveal' } },
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
filesystem = {
|
|
||||||
window = {
|
|
||||||
mappings = {
|
|
||||||
['\\'] = 'close_window',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
-- This file is automatically loaded by lazyvim.config.init.
|
||||||
|
|
||||||
|
local function augroup(name)
|
||||||
|
return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check if we need to reload the file when it changed
|
||||||
|
vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, {
|
||||||
|
group = augroup("checktime"),
|
||||||
|
command = "checktime",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Highlight on yank
|
||||||
|
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||||
|
group = augroup("highlight_yank"),
|
||||||
|
callback = function()
|
||||||
|
vim.highlight.on_yank()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- resize splits if window got resized
|
||||||
|
vim.api.nvim_create_autocmd({ "VimResized" }, {
|
||||||
|
group = augroup("resize_splits"),
|
||||||
|
callback = function()
|
||||||
|
local current_tab = vim.fn.tabpagenr()
|
||||||
|
vim.cmd("tabdo wincmd =")
|
||||||
|
vim.cmd("tabnext " .. current_tab)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- go to last loc when opening a buffer
|
||||||
|
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||||
|
group = augroup("last_loc"),
|
||||||
|
callback = function(event)
|
||||||
|
local exclude = { "gitcommit" }
|
||||||
|
local buf = event.buf
|
||||||
|
if vim.tbl_contains(exclude, vim.bo[buf].filetype) or vim.b[buf].lazyvim_last_loc then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
vim.b[buf].lazyvim_last_loc = true
|
||||||
|
local mark = vim.api.nvim_buf_get_mark(buf, '"')
|
||||||
|
local lcount = vim.api.nvim_buf_line_count(buf)
|
||||||
|
if mark[1] > 0 and mark[1] <= lcount then
|
||||||
|
pcall(vim.api.nvim_win_set_cursor, 0, mark)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- close some filetypes with <q>
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
group = augroup("close_with_q"),
|
||||||
|
pattern = {
|
||||||
|
"PlenaryTestPopup",
|
||||||
|
"help",
|
||||||
|
"lspinfo",
|
||||||
|
"man",
|
||||||
|
"notify",
|
||||||
|
"qf",
|
||||||
|
"query",
|
||||||
|
"spectre_panel",
|
||||||
|
"startuptime",
|
||||||
|
"tsplayground",
|
||||||
|
"neotest-output",
|
||||||
|
"checkhealth",
|
||||||
|
"neotest-summary",
|
||||||
|
"neotest-output-panel",
|
||||||
|
},
|
||||||
|
callback = function(event)
|
||||||
|
vim.bo[event.buf].buflisted = false
|
||||||
|
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- wrap and check for spell in text filetypes
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
group = augroup("wrap_spell"),
|
||||||
|
pattern = { "gitcommit", "markdown" },
|
||||||
|
callback = function()
|
||||||
|
vim.opt_local.wrap = true
|
||||||
|
vim.opt_local.spell = true
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Auto create dir when saving a file, in case some intermediate directory does not exist
|
||||||
|
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||||
|
group = augroup("auto_create_dir"),
|
||||||
|
callback = function(event)
|
||||||
|
if event.match:match("^%w%w+://") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local file = vim.loop.fs_realpath(event.match) or event.match
|
||||||
|
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
|
||||||
|
end,
|
||||||
|
})
|
|
@ -0,0 +1,283 @@
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
---@class LazyVimConfig: LazyVimOptions
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.version = "10.8.2" -- x-release-please-version
|
||||||
|
|
||||||
|
---@class LazyVimOptions
|
||||||
|
local defaults = {
|
||||||
|
-- colorscheme can be a string like `catppuccin` or a function that will load the colorscheme
|
||||||
|
---@type string|fun()
|
||||||
|
colorscheme = function()
|
||||||
|
require("tokyonight").load()
|
||||||
|
end,
|
||||||
|
-- load the default settings
|
||||||
|
defaults = {
|
||||||
|
autocmds = true, -- lazyvim.config.autocmds
|
||||||
|
keymaps = true, -- lazyvim.config.keymaps
|
||||||
|
-- lazyvim.config.options can't be configured here since that's loaded before lazyvim setup
|
||||||
|
-- if you want to disable loading options, add `package.loaded["lazyvim.config.options"] = true` to the top of your init.lua
|
||||||
|
},
|
||||||
|
news = {
|
||||||
|
-- When enabled, NEWS.md will be shown when changed.
|
||||||
|
-- This only contains big new features and breaking changes.
|
||||||
|
lazyvim = true,
|
||||||
|
-- Same but for Neovim's news.txt
|
||||||
|
neovim = false,
|
||||||
|
},
|
||||||
|
-- icons used by other plugins
|
||||||
|
-- stylua: ignore
|
||||||
|
icons = {
|
||||||
|
misc = {
|
||||||
|
dots = "",
|
||||||
|
},
|
||||||
|
dap = {
|
||||||
|
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
||||||
|
Breakpoint = " ",
|
||||||
|
BreakpointCondition = " ",
|
||||||
|
BreakpointRejected = { " ", "DiagnosticError" },
|
||||||
|
LogPoint = ".>",
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
Error = " ",
|
||||||
|
Warn = " ",
|
||||||
|
Hint = " ",
|
||||||
|
Info = " ",
|
||||||
|
},
|
||||||
|
git = {
|
||||||
|
added = " ",
|
||||||
|
modified = " ",
|
||||||
|
removed = " ",
|
||||||
|
},
|
||||||
|
kinds = {
|
||||||
|
Array = " ",
|
||||||
|
Boolean = " ",
|
||||||
|
Class = " ",
|
||||||
|
Codeium = " ",
|
||||||
|
Color = " ",
|
||||||
|
Control = " ",
|
||||||
|
Collapsed = " ",
|
||||||
|
Constant = " ",
|
||||||
|
Constructor = " ",
|
||||||
|
Copilot = " ",
|
||||||
|
Enum = " ",
|
||||||
|
EnumMember = " ",
|
||||||
|
Event = " ",
|
||||||
|
Field = " ",
|
||||||
|
File = " ",
|
||||||
|
Folder = " ",
|
||||||
|
Function = " ",
|
||||||
|
Interface = " ",
|
||||||
|
Key = " ",
|
||||||
|
Keyword = " ",
|
||||||
|
Method = " ",
|
||||||
|
Module = " ",
|
||||||
|
Namespace = " ",
|
||||||
|
Null = " ",
|
||||||
|
Number = " ",
|
||||||
|
Object = " ",
|
||||||
|
Operator = " ",
|
||||||
|
Package = " ",
|
||||||
|
Property = " ",
|
||||||
|
Reference = " ",
|
||||||
|
Snippet = " ",
|
||||||
|
String = " ",
|
||||||
|
Struct = " ",
|
||||||
|
TabNine = " ",
|
||||||
|
Text = " ",
|
||||||
|
TypeParameter = " ",
|
||||||
|
Unit = " ",
|
||||||
|
Value = " ",
|
||||||
|
Variable = " ",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
---@type table<string, string[]|boolean>?
|
||||||
|
kind_filter = {
|
||||||
|
default = {
|
||||||
|
"Class",
|
||||||
|
"Constructor",
|
||||||
|
"Enum",
|
||||||
|
"Field",
|
||||||
|
"Function",
|
||||||
|
"Interface",
|
||||||
|
"Method",
|
||||||
|
"Module",
|
||||||
|
"Namespace",
|
||||||
|
"Package",
|
||||||
|
"Property",
|
||||||
|
"Struct",
|
||||||
|
"Trait",
|
||||||
|
},
|
||||||
|
markdown = false,
|
||||||
|
help = false,
|
||||||
|
-- you can specify a different filter for each filetype
|
||||||
|
lua = {
|
||||||
|
"Class",
|
||||||
|
"Constructor",
|
||||||
|
"Enum",
|
||||||
|
"Field",
|
||||||
|
"Function",
|
||||||
|
"Interface",
|
||||||
|
"Method",
|
||||||
|
"Module",
|
||||||
|
"Namespace",
|
||||||
|
-- "Package", -- remove package since luals uses it for control flow structures
|
||||||
|
"Property",
|
||||||
|
"Struct",
|
||||||
|
"Trait",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
M.json = {
|
||||||
|
version = 2,
|
||||||
|
data = {
|
||||||
|
version = nil, ---@type string?
|
||||||
|
news = {}, ---@type table<string, string>
|
||||||
|
extras = {}, ---@type string[]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
function M.json.load()
|
||||||
|
local path = vim.fn.stdpath("config") .. "/lazyvim.json"
|
||||||
|
local f = io.open(path, "r")
|
||||||
|
if f then
|
||||||
|
local data = f:read("*a")
|
||||||
|
f:close()
|
||||||
|
local ok, json = pcall(vim.json.decode, data, { luanil = { object = true, array = true } })
|
||||||
|
if ok then
|
||||||
|
M.json.data = vim.tbl_deep_extend("force", M.json.data, json or {})
|
||||||
|
if M.json.data.version ~= M.json.version then
|
||||||
|
Util.json.migrate()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type LazyVimOptions
|
||||||
|
local options
|
||||||
|
|
||||||
|
---@param opts? LazyVimOptions
|
||||||
|
function M.setup(opts)
|
||||||
|
options = vim.tbl_deep_extend("force", defaults, opts or {}) or {}
|
||||||
|
|
||||||
|
-- autocmds can be loaded lazily when not opening a file
|
||||||
|
local lazy_autocmds = vim.fn.argc(-1) == 0
|
||||||
|
if not lazy_autocmds then
|
||||||
|
M.load("autocmds")
|
||||||
|
end
|
||||||
|
|
||||||
|
local group = vim.api.nvim_create_augroup("LazyVim", { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
group = group,
|
||||||
|
pattern = "VeryLazy",
|
||||||
|
callback = function()
|
||||||
|
if lazy_autocmds then
|
||||||
|
M.load("autocmds")
|
||||||
|
end
|
||||||
|
M.load("keymaps")
|
||||||
|
|
||||||
|
Util.format.setup()
|
||||||
|
Util.news.setup()
|
||||||
|
Util.root.setup()
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command("LazyExtras", function()
|
||||||
|
Util.extras.show()
|
||||||
|
end, { desc = "Manage LazyVim extras" })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
Util.track("colorscheme")
|
||||||
|
Util.try(function()
|
||||||
|
if type(M.colorscheme) == "function" then
|
||||||
|
M.colorscheme()
|
||||||
|
else
|
||||||
|
vim.cmd.colorscheme(M.colorscheme)
|
||||||
|
end
|
||||||
|
end, {
|
||||||
|
msg = "Could not load your colorscheme",
|
||||||
|
on_error = function(msg)
|
||||||
|
Util.error(msg)
|
||||||
|
vim.cmd.colorscheme("habamax")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
Util.track()
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param buf? number
|
||||||
|
---@return string[]?
|
||||||
|
function M.get_kind_filter(buf)
|
||||||
|
buf = (buf == nil or buf == 0) and vim.api.nvim_get_current_buf() or buf
|
||||||
|
local ft = vim.bo[buf].filetype
|
||||||
|
if M.kind_filter == false then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if M.kind_filter[ft] == false then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
---@diagnostic disable-next-line: return-type-mismatch
|
||||||
|
return type(M.kind_filter) == "table" and type(M.kind_filter.default) == "table" and M.kind_filter.default or nil
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param name "autocmds" | "options" | "keymaps"
|
||||||
|
function M.load(name)
|
||||||
|
local function _load(mod)
|
||||||
|
if require("lazy.core.cache").find(mod)[1] then
|
||||||
|
Util.try(function()
|
||||||
|
require(mod)
|
||||||
|
end, { msg = "Failed loading " .. mod })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- always load lazyvim, then user file
|
||||||
|
if M.defaults[name] or name == "options" then
|
||||||
|
_load("lazyvim.config." .. name)
|
||||||
|
end
|
||||||
|
_load("config." .. name)
|
||||||
|
if vim.bo.filetype == "lazy" then
|
||||||
|
-- HACK: LazyVim may have overwritten options of the Lazy ui, so reset this here
|
||||||
|
vim.cmd([[do VimResized]])
|
||||||
|
end
|
||||||
|
local pattern = "LazyVim" .. name:sub(1, 1):upper() .. name:sub(2)
|
||||||
|
vim.api.nvim_exec_autocmds("User", { pattern = pattern, modeline = false })
|
||||||
|
end
|
||||||
|
|
||||||
|
M.did_init = false
|
||||||
|
function M.init()
|
||||||
|
if M.did_init then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
M.did_init = true
|
||||||
|
local plugin = require("lazy.core.config").spec.plugins.LazyVim
|
||||||
|
if plugin then
|
||||||
|
vim.opt.rtp:append(plugin.dir)
|
||||||
|
end
|
||||||
|
|
||||||
|
package.preload["lazyvim.plugins.lsp.format"] = function()
|
||||||
|
Util.deprecate([[require("lazyvim.plugins.lsp.format")]], [[require("lazyvim.util").format]])
|
||||||
|
return Util.format
|
||||||
|
end
|
||||||
|
|
||||||
|
-- delay notifications till vim.notify was replaced or after 500ms
|
||||||
|
require("lazyvim.util").lazy_notify()
|
||||||
|
|
||||||
|
-- load options here, before lazy init while sourcing plugin modules
|
||||||
|
-- this is needed to make sure options will be correctly applied
|
||||||
|
-- after installing missing plugins
|
||||||
|
M.load("options")
|
||||||
|
|
||||||
|
Util.plugin.setup()
|
||||||
|
M.json.load()
|
||||||
|
end
|
||||||
|
|
||||||
|
setmetatable(M, {
|
||||||
|
__index = function(_, key)
|
||||||
|
if options == nil then
|
||||||
|
return vim.deepcopy(defaults)[key]
|
||||||
|
end
|
||||||
|
---@cast options LazyVimConfig
|
||||||
|
return options[key]
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
return M
|
|
@ -0,0 +1,170 @@
|
||||||
|
-- This file is automatically loaded by lazyvim.config.init
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
-- DO NOT USE THIS IN YOU OWN CONFIG!!
|
||||||
|
-- use `vim.keymap.set` instead
|
||||||
|
local map = Util.safe_keymap_set
|
||||||
|
|
||||||
|
-- better up/down
|
||||||
|
map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||||
|
map({ "n", "x" }, "<Down>", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||||
|
map({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||||
|
map({ "n", "x" }, "<Up>", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||||
|
|
||||||
|
-- Move to window using the <ctrl> hjkl keys
|
||||||
|
map("n", "<C-h>", "<C-w>h", { desc = "Go to left window", remap = true })
|
||||||
|
map("n", "<C-j>", "<C-w>j", { desc = "Go to lower window", remap = true })
|
||||||
|
map("n", "<C-k>", "<C-w>k", { desc = "Go to upper window", remap = true })
|
||||||
|
map("n", "<C-l>", "<C-w>l", { desc = "Go to right window", remap = true })
|
||||||
|
|
||||||
|
-- Resize window using <ctrl> arrow keys
|
||||||
|
map("n", "<C-Up>", "<cmd>resize +2<cr>", { desc = "Increase window height" })
|
||||||
|
map("n", "<C-Down>", "<cmd>resize -2<cr>", { desc = "Decrease window height" })
|
||||||
|
map("n", "<C-Left>", "<cmd>vertical resize -2<cr>", { desc = "Decrease window width" })
|
||||||
|
map("n", "<C-Right>", "<cmd>vertical resize +2<cr>", { desc = "Increase window width" })
|
||||||
|
|
||||||
|
-- Move Lines
|
||||||
|
map("n", "<A-j>", "<cmd>m .+1<cr>==", { desc = "Move down" })
|
||||||
|
map("n", "<A-k>", "<cmd>m .-2<cr>==", { desc = "Move up" })
|
||||||
|
map("i", "<A-j>", "<esc><cmd>m .+1<cr>==gi", { desc = "Move down" })
|
||||||
|
map("i", "<A-k>", "<esc><cmd>m .-2<cr>==gi", { desc = "Move up" })
|
||||||
|
map("v", "<A-j>", ":m '>+1<cr>gv=gv", { desc = "Move down" })
|
||||||
|
map("v", "<A-k>", ":m '<-2<cr>gv=gv", { desc = "Move up" })
|
||||||
|
|
||||||
|
-- buffers
|
||||||
|
map("n", "<S-h>", "<cmd>bprevious<cr>", { desc = "Prev buffer" })
|
||||||
|
map("n", "<S-l>", "<cmd>bnext<cr>", { desc = "Next buffer" })
|
||||||
|
map("n", "[b", "<cmd>bprevious<cr>", { desc = "Prev buffer" })
|
||||||
|
map("n", "]b", "<cmd>bnext<cr>", { desc = "Next buffer" })
|
||||||
|
map("n", "<leader>bb", "<cmd>e #<cr>", { desc = "Switch to Other Buffer" })
|
||||||
|
map("n", "<leader>`", "<cmd>e #<cr>", { desc = "Switch to Other Buffer" })
|
||||||
|
|
||||||
|
-- Clear search with <esc>
|
||||||
|
map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", { desc = "Escape and clear hlsearch" })
|
||||||
|
|
||||||
|
-- Clear search, diff update and redraw
|
||||||
|
-- taken from runtime/lua/_editor.lua
|
||||||
|
map(
|
||||||
|
"n",
|
||||||
|
"<leader>ur",
|
||||||
|
"<Cmd>nohlsearch<Bar>diffupdate<Bar>normal! <C-L><CR>",
|
||||||
|
{ desc = "Redraw / clear hlsearch / diff update" }
|
||||||
|
)
|
||||||
|
|
||||||
|
-- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n
|
||||||
|
map("n", "n", "'Nn'[v:searchforward].'zv'", { expr = true, desc = "Next search result" })
|
||||||
|
map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
|
||||||
|
map("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
|
||||||
|
map("n", "N", "'nN'[v:searchforward].'zv'", { expr = true, desc = "Prev search result" })
|
||||||
|
map("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" })
|
||||||
|
map("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" })
|
||||||
|
|
||||||
|
-- Add undo break-points
|
||||||
|
map("i", ",", ",<c-g>u")
|
||||||
|
map("i", ".", ".<c-g>u")
|
||||||
|
map("i", ";", ";<c-g>u")
|
||||||
|
|
||||||
|
-- save file
|
||||||
|
map({ "i", "x", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save file" })
|
||||||
|
|
||||||
|
--keywordprg
|
||||||
|
map("n", "<leader>K", "<cmd>norm! K<cr>", { desc = "Keywordprg" })
|
||||||
|
|
||||||
|
-- better indenting
|
||||||
|
map("v", "<", "<gv")
|
||||||
|
map("v", ">", ">gv")
|
||||||
|
|
||||||
|
-- lazy
|
||||||
|
map("n", "<leader>l", "<cmd>Lazy<cr>", { desc = "Lazy" })
|
||||||
|
|
||||||
|
-- new file
|
||||||
|
map("n", "<leader>fn", "<cmd>enew<cr>", { desc = "New File" })
|
||||||
|
|
||||||
|
map("n", "<leader>xl", "<cmd>lopen<cr>", { desc = "Location List" })
|
||||||
|
map("n", "<leader>xq", "<cmd>copen<cr>", { desc = "Quickfix List" })
|
||||||
|
|
||||||
|
map("n", "[q", vim.cmd.cprev, { desc = "Previous quickfix" })
|
||||||
|
map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" })
|
||||||
|
|
||||||
|
-- formatting
|
||||||
|
map({ "n", "v" }, "<leader>cf", function()
|
||||||
|
Util.format({ force = true })
|
||||||
|
end, { desc = "Format" })
|
||||||
|
|
||||||
|
-- diagnostic
|
||||||
|
local diagnostic_goto = function(next, severity)
|
||||||
|
local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev
|
||||||
|
severity = severity and vim.diagnostic.severity[severity] or nil
|
||||||
|
return function()
|
||||||
|
go({ severity = severity })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
map("n", "<leader>cd", vim.diagnostic.open_float, { desc = "Line Diagnostics" })
|
||||||
|
map("n", "]d", diagnostic_goto(true), { desc = "Next Diagnostic" })
|
||||||
|
map("n", "[d", diagnostic_goto(false), { desc = "Prev Diagnostic" })
|
||||||
|
map("n", "]e", diagnostic_goto(true, "ERROR"), { desc = "Next Error" })
|
||||||
|
map("n", "[e", diagnostic_goto(false, "ERROR"), { desc = "Prev Error" })
|
||||||
|
map("n", "]w", diagnostic_goto(true, "WARN"), { desc = "Next Warning" })
|
||||||
|
map("n", "[w", diagnostic_goto(false, "WARN"), { desc = "Prev Warning" })
|
||||||
|
|
||||||
|
-- stylua: ignore start
|
||||||
|
|
||||||
|
-- toggle options
|
||||||
|
map("n", "<leader>uf", function() Util.format.toggle() end, { desc = "Toggle auto format (global)" })
|
||||||
|
map("n", "<leader>uF", function() Util.format.toggle(true) end, { desc = "Toggle auto format (buffer)" })
|
||||||
|
map("n", "<leader>us", function() Util.toggle("spell") end, { desc = "Toggle Spelling" })
|
||||||
|
map("n", "<leader>uw", function() Util.toggle("wrap") end, { desc = "Toggle Word Wrap" })
|
||||||
|
map("n", "<leader>uL", function() Util.toggle("relativenumber") end, { desc = "Toggle Relative Line Numbers" })
|
||||||
|
map("n", "<leader>ul", function() Util.toggle.number() end, { desc = "Toggle Line Numbers" })
|
||||||
|
map("n", "<leader>ud", function() Util.toggle.diagnostics() end, { desc = "Toggle Diagnostics" })
|
||||||
|
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
|
||||||
|
map("n", "<leader>uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" })
|
||||||
|
if vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint then
|
||||||
|
map( "n", "<leader>uh", function() Util.toggle.inlay_hints() end, { desc = "Toggle Inlay Hints" })
|
||||||
|
end
|
||||||
|
map("n", "<leader>uT", function() if vim.b.ts_highlight then vim.treesitter.stop() else vim.treesitter.start() end end, { desc = "Toggle Treesitter Highlight" })
|
||||||
|
|
||||||
|
-- lazygit
|
||||||
|
map("n", "<leader>gg", function() Util.terminal({ "lazygit" }, { cwd = Util.root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" })
|
||||||
|
map("n", "<leader>gG", function() Util.terminal({ "lazygit" }, {esc_esc = false, ctrl_hjkl = false}) end, { desc = "Lazygit (cwd)" })
|
||||||
|
|
||||||
|
-- quit
|
||||||
|
map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit all" })
|
||||||
|
|
||||||
|
-- highlights under cursor
|
||||||
|
map("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" })
|
||||||
|
|
||||||
|
-- LazyVim Changelog
|
||||||
|
map("n", "<leader>L", function() Util.news.changelog() end, { desc = "LazyVim Changelog" })
|
||||||
|
|
||||||
|
-- floating terminal
|
||||||
|
local lazyterm = function() Util.terminal(nil, { cwd = Util.root() }) end
|
||||||
|
map("n", "<leader>ft", lazyterm, { desc = "Terminal (root dir)" })
|
||||||
|
map("n", "<leader>fT", function() Util.terminal() end, { desc = "Terminal (cwd)" })
|
||||||
|
map("n", "<c-/>", lazyterm, { desc = "Terminal (root dir)" })
|
||||||
|
map("n", "<c-_>", lazyterm, { desc = "which_key_ignore" })
|
||||||
|
|
||||||
|
-- Terminal Mappings
|
||||||
|
map("t", "<esc><esc>", "<c-\\><c-n>", { desc = "Enter Normal Mode" })
|
||||||
|
map("t", "<C-h>", "<cmd>wincmd h<cr>", { desc = "Go to left window" })
|
||||||
|
map("t", "<C-j>", "<cmd>wincmd j<cr>", { desc = "Go to lower window" })
|
||||||
|
map("t", "<C-k>", "<cmd>wincmd k<cr>", { desc = "Go to upper window" })
|
||||||
|
map("t", "<C-l>", "<cmd>wincmd l<cr>", { desc = "Go to right window" })
|
||||||
|
map("t", "<C-/>", "<cmd>close<cr>", { desc = "Hide Terminal" })
|
||||||
|
map("t", "<c-_>", "<cmd>close<cr>", { desc = "which_key_ignore" })
|
||||||
|
|
||||||
|
-- windows
|
||||||
|
map("n", "<leader>ww", "<C-W>p", { desc = "Other window", remap = true })
|
||||||
|
map("n", "<leader>wd", "<C-W>c", { desc = "Delete window", remap = true })
|
||||||
|
map("n", "<leader>w-", "<C-W>s", { desc = "Split window below", remap = true })
|
||||||
|
map("n", "<leader>w|", "<C-W>v", { desc = "Split window right", remap = true })
|
||||||
|
map("n", "<leader>-", "<C-W>s", { desc = "Split window below", remap = true })
|
||||||
|
map("n", "<leader>|", "<C-W>v", { desc = "Split window right", remap = true })
|
||||||
|
|
||||||
|
-- tabs
|
||||||
|
map("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" })
|
||||||
|
map("n", "<leader><tab>f", "<cmd>tabfirst<cr>", { desc = "First Tab" })
|
||||||
|
map("n", "<leader><tab><tab>", "<cmd>tabnew<cr>", { desc = "New Tab" })
|
||||||
|
map("n", "<leader><tab>]", "<cmd>tabnext<cr>", { desc = "Next Tab" })
|
||||||
|
map("n", "<leader><tab>d", "<cmd>tabclose<cr>", { desc = "Close Tab" })
|
||||||
|
map("n", "<leader><tab>[", "<cmd>tabprevious<cr>", { desc = "Previous Tab" })
|
|
@ -0,0 +1,93 @@
|
||||||
|
-- This file is automatically loaded by plugins.core
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.g.maplocalleader = "\\"
|
||||||
|
|
||||||
|
-- Enable LazyVim auto format
|
||||||
|
vim.g.autoformat = true
|
||||||
|
|
||||||
|
-- LazyVim root dir detection
|
||||||
|
-- Each entry can be:
|
||||||
|
-- * the name of a detector function like `lsp` or `cwd`
|
||||||
|
-- * a pattern or array of patterns like `.git` or `lua`.
|
||||||
|
-- * a function with signature `function(buf) -> string|string[]`
|
||||||
|
vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" }
|
||||||
|
|
||||||
|
local opt = vim.opt
|
||||||
|
|
||||||
|
opt.autowrite = true -- Enable auto write
|
||||||
|
opt.clipboard = "unnamedplus" -- Sync with system clipboard
|
||||||
|
opt.completeopt = "menu,menuone,noselect"
|
||||||
|
opt.conceallevel = 3 -- Hide * markup for bold and italic
|
||||||
|
opt.confirm = true -- Confirm to save changes before exiting modified buffer
|
||||||
|
opt.cursorline = true -- Enable highlighting of the current line
|
||||||
|
opt.expandtab = true -- Use spaces instead of tabs
|
||||||
|
opt.formatoptions = "jcroqlnt" -- tcqj
|
||||||
|
opt.grepformat = "%f:%l:%c:%m"
|
||||||
|
opt.grepprg = "rg --vimgrep"
|
||||||
|
opt.ignorecase = true -- Ignore case
|
||||||
|
opt.inccommand = "nosplit" -- preview incremental substitute
|
||||||
|
opt.laststatus = 3 -- global statusline
|
||||||
|
opt.list = true -- Show some invisible characters (tabs...
|
||||||
|
opt.mouse = "a" -- Enable mouse mode
|
||||||
|
opt.number = true -- Print line number
|
||||||
|
opt.pumblend = 10 -- Popup blend
|
||||||
|
opt.pumheight = 10 -- Maximum number of entries in a popup
|
||||||
|
opt.relativenumber = true -- Relative line numbers
|
||||||
|
opt.scrolloff = 4 -- Lines of context
|
||||||
|
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp", "folds" }
|
||||||
|
opt.shiftround = true -- Round indent
|
||||||
|
opt.shiftwidth = 2 -- Size of an indent
|
||||||
|
opt.shortmess:append({ W = true, I = true, c = true, C = true })
|
||||||
|
opt.showmode = false -- Dont show mode since we have a statusline
|
||||||
|
opt.sidescrolloff = 8 -- Columns of context
|
||||||
|
opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
|
||||||
|
opt.smartcase = true -- Don't ignore case with capitals
|
||||||
|
opt.smartindent = true -- Insert indents automatically
|
||||||
|
opt.spelllang = { "en" }
|
||||||
|
opt.splitbelow = true -- Put new windows below current
|
||||||
|
opt.splitkeep = "screen"
|
||||||
|
opt.splitright = true -- Put new windows right of current
|
||||||
|
opt.tabstop = 2 -- Number of spaces tabs count for
|
||||||
|
opt.termguicolors = true -- True color support
|
||||||
|
opt.timeoutlen = 300
|
||||||
|
opt.undofile = true
|
||||||
|
opt.undolevels = 10000
|
||||||
|
opt.updatetime = 200 -- Save swap file and trigger CursorHold
|
||||||
|
opt.virtualedit = "block" -- Allow cursor to move where there is no text in visual block mode
|
||||||
|
opt.wildmode = "longest:full,full" -- Command-line completion mode
|
||||||
|
opt.winminwidth = 5 -- Minimum window width
|
||||||
|
opt.wrap = false -- Disable line wrap
|
||||||
|
opt.fillchars = {
|
||||||
|
foldopen = "",
|
||||||
|
foldclose = "",
|
||||||
|
-- fold = "⸱",
|
||||||
|
fold = " ",
|
||||||
|
foldsep = " ",
|
||||||
|
diff = "╱",
|
||||||
|
eob = " ",
|
||||||
|
}
|
||||||
|
|
||||||
|
if vim.fn.has("nvim-0.10") == 1 then
|
||||||
|
opt.smoothscroll = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Folding
|
||||||
|
vim.opt.foldlevel = 99
|
||||||
|
vim.opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()"
|
||||||
|
|
||||||
|
if vim.fn.has("nvim-0.9.0") == 1 then
|
||||||
|
vim.opt.statuscolumn = [[%!v:lua.require'lazyvim.util'.ui.statuscolumn()]]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- HACK: causes freezes on <= 0.9, so only enable on >= 0.10 for now
|
||||||
|
if vim.fn.has("nvim-0.10") == 1 then
|
||||||
|
vim.opt.foldmethod = "expr"
|
||||||
|
vim.opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()"
|
||||||
|
else
|
||||||
|
vim.opt.foldmethod = "indent"
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.o.formatexpr = "v:lua.require'lazyvim.util'.format.formatexpr()"
|
||||||
|
|
||||||
|
-- Fix markdown indentation settings
|
||||||
|
vim.g.markdown_recommended_style = 0
|
|
@ -0,0 +1,38 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local start = vim.health.start or vim.health.report_start
|
||||||
|
local ok = vim.health.ok or vim.health.report_ok
|
||||||
|
local warn = vim.health.warn or vim.health.report_warn
|
||||||
|
local error = vim.health.error or vim.health.report_error
|
||||||
|
|
||||||
|
function M.check()
|
||||||
|
start("LazyVim")
|
||||||
|
|
||||||
|
if vim.fn.has("nvim-0.9.0") == 1 then
|
||||||
|
ok("Using Neovim >= 0.9.0")
|
||||||
|
else
|
||||||
|
error("Neovim >= 0.9.0 is required")
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, cmd in ipairs({ "git", "rg", { "fd", "fdfind" }, "lazygit" }) do
|
||||||
|
local name = type(cmd) == "string" and cmd or vim.inspect(cmd)
|
||||||
|
local commands = type(cmd) == "string" and { cmd } or cmd
|
||||||
|
---@cast commands string[]
|
||||||
|
local found = false
|
||||||
|
|
||||||
|
for _, c in ipairs(commands) do
|
||||||
|
if vim.fn.executable(c) == 1 then
|
||||||
|
name = c
|
||||||
|
found = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if found then
|
||||||
|
ok(("`%s` is installed"):format(name))
|
||||||
|
else
|
||||||
|
warn(("`%s` is not installed"):format(name))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
|
@ -0,0 +1,8 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@param opts? LazyVimConfig
|
||||||
|
function M.setup(opts)
|
||||||
|
require("lazyvim.config").setup(opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
|
@ -0,0 +1,256 @@
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- snippets
|
||||||
|
{
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
build = (not jit.os:find("Windows"))
|
||||||
|
and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp"
|
||||||
|
or nil,
|
||||||
|
dependencies = {
|
||||||
|
"rafamadriz/friendly-snippets",
|
||||||
|
config = function()
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
history = true,
|
||||||
|
delete_check_events = "TextChanged",
|
||||||
|
},
|
||||||
|
-- stylua: ignore
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<tab>",
|
||||||
|
function()
|
||||||
|
return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
|
||||||
|
end,
|
||||||
|
expr = true, silent = true, mode = "i",
|
||||||
|
},
|
||||||
|
{ "<tab>", function() require("luasnip").jump(1) end, mode = "s" },
|
||||||
|
{ "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- auto completion
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
version = false, -- last release is way too old
|
||||||
|
event = "InsertEnter",
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
},
|
||||||
|
opts = function()
|
||||||
|
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
|
||||||
|
local cmp = require("cmp")
|
||||||
|
local defaults = require("cmp.config.default")()
|
||||||
|
return {
|
||||||
|
completion = {
|
||||||
|
completeopt = "menu,menuone,noinsert",
|
||||||
|
},
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require("luasnip").lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||||
|
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||||
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
|
["<C-e>"] = cmp.mapping.abort(),
|
||||||
|
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
|
["<S-CR>"] = cmp.mapping.confirm({
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = true,
|
||||||
|
}), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
|
["<C-CR>"] = function(fallback)
|
||||||
|
cmp.abort()
|
||||||
|
fallback()
|
||||||
|
end,
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "luasnip" },
|
||||||
|
{ name = "path" },
|
||||||
|
}, {
|
||||||
|
{ name = "buffer" },
|
||||||
|
}),
|
||||||
|
formatting = {
|
||||||
|
format = function(_, item)
|
||||||
|
local icons = require("lazyvim.config").icons.kinds
|
||||||
|
if icons[item.kind] then
|
||||||
|
item.kind = icons[item.kind] .. item.kind
|
||||||
|
end
|
||||||
|
return item
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
experimental = {
|
||||||
|
ghost_text = {
|
||||||
|
hl_group = "CmpGhostText",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sorting = defaults.sorting,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
---@param opts cmp.ConfigSchema
|
||||||
|
config = function(_, opts)
|
||||||
|
for _, source in ipairs(opts.sources) do
|
||||||
|
source.group_index = source.group_index or 1
|
||||||
|
end
|
||||||
|
require("cmp").setup(opts)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- auto pairs
|
||||||
|
{
|
||||||
|
"echasnovski/mini.pairs",
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = {},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>up",
|
||||||
|
function()
|
||||||
|
local Util = require("lazy.core.util")
|
||||||
|
vim.g.minipairs_disable = not vim.g.minipairs_disable
|
||||||
|
if vim.g.minipairs_disable then
|
||||||
|
Util.warn("Disabled auto pairs", { title = "Option" })
|
||||||
|
else
|
||||||
|
Util.info("Enabled auto pairs", { title = "Option" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
desc = "Toggle auto pairs",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Fast and feature-rich surround actions. For text that includes
|
||||||
|
-- surrounding characters like brackets or quotes, this allows you
|
||||||
|
-- to select the text inside, change or modify the surrounding characters,
|
||||||
|
-- and more.
|
||||||
|
{
|
||||||
|
"echasnovski/mini.surround",
|
||||||
|
keys = function(_, keys)
|
||||||
|
-- Populate the keys based on the user's options
|
||||||
|
local plugin = require("lazy.core.config").spec.plugins["mini.surround"]
|
||||||
|
local opts = require("lazy.core.plugin").values(plugin, "opts", false)
|
||||||
|
local mappings = {
|
||||||
|
{ opts.mappings.add, desc = "Add surrounding", mode = { "n", "v" } },
|
||||||
|
{ opts.mappings.delete, desc = "Delete surrounding" },
|
||||||
|
{ opts.mappings.find, desc = "Find right surrounding" },
|
||||||
|
{ opts.mappings.find_left, desc = "Find left surrounding" },
|
||||||
|
{ opts.mappings.highlight, desc = "Highlight surrounding" },
|
||||||
|
{ opts.mappings.replace, desc = "Replace surrounding" },
|
||||||
|
{ opts.mappings.update_n_lines, desc = "Update `MiniSurround.config.n_lines`" },
|
||||||
|
}
|
||||||
|
mappings = vim.tbl_filter(function(m)
|
||||||
|
return m[1] and #m[1] > 0
|
||||||
|
end, mappings)
|
||||||
|
return vim.list_extend(mappings, keys)
|
||||||
|
end,
|
||||||
|
opts = {
|
||||||
|
mappings = {
|
||||||
|
add = "gsa", -- Add surrounding in Normal and Visual modes
|
||||||
|
delete = "gsd", -- Delete surrounding
|
||||||
|
find = "gsf", -- Find surrounding (to the right)
|
||||||
|
find_left = "gsF", -- Find surrounding (to the left)
|
||||||
|
highlight = "gsh", -- Highlight surrounding
|
||||||
|
replace = "gsr", -- Replace surrounding
|
||||||
|
update_n_lines = "gsn", -- Update `n_lines`
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- comments
|
||||||
|
{
|
||||||
|
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||||
|
lazy = true,
|
||||||
|
opts = {
|
||||||
|
enable_autocmd = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"echasnovski/mini.comment",
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = {
|
||||||
|
options = {
|
||||||
|
custom_commentstring = function()
|
||||||
|
return require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Better text-objects
|
||||||
|
{
|
||||||
|
"echasnovski/mini.ai",
|
||||||
|
-- keys = {
|
||||||
|
-- { "a", mode = { "x", "o" } },
|
||||||
|
-- { "i", mode = { "x", "o" } },
|
||||||
|
-- },
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = function()
|
||||||
|
local ai = require("mini.ai")
|
||||||
|
return {
|
||||||
|
n_lines = 500,
|
||||||
|
custom_textobjects = {
|
||||||
|
o = ai.gen_spec.treesitter({
|
||||||
|
a = { "@block.outer", "@conditional.outer", "@loop.outer" },
|
||||||
|
i = { "@block.inner", "@conditional.inner", "@loop.inner" },
|
||||||
|
}, {}),
|
||||||
|
f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}),
|
||||||
|
c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}),
|
||||||
|
t = { "<([%p%w]-)%f[^<%w][^<>]->.-</%1>", "^<.->().*()</[^/]->$" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
config = function(_, opts)
|
||||||
|
require("mini.ai").setup(opts)
|
||||||
|
-- register all text objects with which-key
|
||||||
|
require("lazyvim.util").on_load("which-key.nvim", function()
|
||||||
|
---@type table<string, string|table>
|
||||||
|
local i = {
|
||||||
|
[" "] = "Whitespace",
|
||||||
|
['"'] = 'Balanced "',
|
||||||
|
["'"] = "Balanced '",
|
||||||
|
["`"] = "Balanced `",
|
||||||
|
["("] = "Balanced (",
|
||||||
|
[")"] = "Balanced ) including white-space",
|
||||||
|
[">"] = "Balanced > including white-space",
|
||||||
|
["<lt>"] = "Balanced <",
|
||||||
|
["]"] = "Balanced ] including white-space",
|
||||||
|
["["] = "Balanced [",
|
||||||
|
["}"] = "Balanced } including white-space",
|
||||||
|
["{"] = "Balanced {",
|
||||||
|
["?"] = "User Prompt",
|
||||||
|
_ = "Underscore",
|
||||||
|
a = "Argument",
|
||||||
|
b = "Balanced ), ], }",
|
||||||
|
c = "Class",
|
||||||
|
f = "Function",
|
||||||
|
o = "Block, conditional, loop",
|
||||||
|
q = "Quote `, \", '",
|
||||||
|
t = "Tag",
|
||||||
|
}
|
||||||
|
local a = vim.deepcopy(i)
|
||||||
|
for k, v in pairs(a) do
|
||||||
|
a[k] = v:gsub(" including.*", "")
|
||||||
|
end
|
||||||
|
|
||||||
|
local ic = vim.deepcopy(i)
|
||||||
|
local ac = vim.deepcopy(a)
|
||||||
|
for key, name in pairs({ n = "Next", l = "Last" }) do
|
||||||
|
i[key] = vim.tbl_extend("force", { name = "Inside " .. name .. " textobject" }, ic)
|
||||||
|
a[key] = vim.tbl_extend("force", { name = "Around " .. name .. " textobject" }, ac)
|
||||||
|
end
|
||||||
|
require("which-key").register({
|
||||||
|
mode = { "o", "x" },
|
||||||
|
i = i,
|
||||||
|
a = a,
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- tokyonight
|
||||||
|
{
|
||||||
|
"folke/tokyonight.nvim",
|
||||||
|
lazy = true,
|
||||||
|
opts = { style = "moon" },
|
||||||
|
},
|
||||||
|
|
||||||
|
-- catppuccin
|
||||||
|
{
|
||||||
|
"catppuccin/nvim",
|
||||||
|
lazy = true,
|
||||||
|
name = "catppuccin",
|
||||||
|
opts = {
|
||||||
|
integrations = {
|
||||||
|
aerial = true,
|
||||||
|
alpha = true,
|
||||||
|
cmp = true,
|
||||||
|
dashboard = true,
|
||||||
|
flash = true,
|
||||||
|
gitsigns = true,
|
||||||
|
headlines = true,
|
||||||
|
illuminate = true,
|
||||||
|
indent_blankline = { enabled = true },
|
||||||
|
leap = true,
|
||||||
|
lsp_trouble = true,
|
||||||
|
mason = true,
|
||||||
|
markdown = true,
|
||||||
|
mini = true,
|
||||||
|
native_lsp = {
|
||||||
|
enabled = true,
|
||||||
|
underlines = {
|
||||||
|
errors = { "undercurl" },
|
||||||
|
hints = { "undercurl" },
|
||||||
|
warnings = { "undercurl" },
|
||||||
|
information = { "undercurl" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
navic = { enabled = true, custom_bg = "lualine" },
|
||||||
|
neotest = true,
|
||||||
|
neotree = true,
|
||||||
|
noice = true,
|
||||||
|
notify = true,
|
||||||
|
semantic_tokens = true,
|
||||||
|
telescope = true,
|
||||||
|
treesitter = true,
|
||||||
|
treesitter_context = true,
|
||||||
|
which_key = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,496 @@
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- file explorer
|
||||||
|
{
|
||||||
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
|
branch = "v3.x",
|
||||||
|
cmd = "Neotree",
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>fe",
|
||||||
|
function()
|
||||||
|
require("neo-tree.command").execute({ toggle = true, dir = Util.root() })
|
||||||
|
end,
|
||||||
|
desc = "Explorer NeoTree (root dir)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>fE",
|
||||||
|
function()
|
||||||
|
require("neo-tree.command").execute({ toggle = true, dir = vim.loop.cwd() })
|
||||||
|
end,
|
||||||
|
desc = "Explorer NeoTree (cwd)",
|
||||||
|
},
|
||||||
|
{ "<leader>e", "<leader>fe", desc = "Explorer NeoTree (root dir)", remap = true },
|
||||||
|
{ "<leader>E", "<leader>fE", desc = "Explorer NeoTree (cwd)", remap = true },
|
||||||
|
{
|
||||||
|
"<leader>ge",
|
||||||
|
function()
|
||||||
|
require("neo-tree.command").execute({ source = "git_status", toggle = true })
|
||||||
|
end,
|
||||||
|
desc = "Git explorer",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>be",
|
||||||
|
function()
|
||||||
|
require("neo-tree.command").execute({ source = "buffers", toggle = true })
|
||||||
|
end,
|
||||||
|
desc = "Buffer explorer",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
deactivate = function()
|
||||||
|
vim.cmd([[Neotree close]])
|
||||||
|
end,
|
||||||
|
init = function()
|
||||||
|
if vim.fn.argc(-1) == 1 then
|
||||||
|
local stat = vim.loop.fs_stat(vim.fn.argv(0))
|
||||||
|
if stat and stat.type == "directory" then
|
||||||
|
require("neo-tree")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
opts = {
|
||||||
|
sources = { "filesystem", "buffers", "git_status", "document_symbols" },
|
||||||
|
open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" },
|
||||||
|
filesystem = {
|
||||||
|
bind_to_cwd = false,
|
||||||
|
follow_current_file = { enabled = true },
|
||||||
|
use_libuv_file_watcher = true,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
mappings = {
|
||||||
|
["<space>"] = "none",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default_component_configs = {
|
||||||
|
indent = {
|
||||||
|
with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
|
||||||
|
expander_collapsed = "",
|
||||||
|
expander_expanded = "",
|
||||||
|
expander_highlight = "NeoTreeExpander",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
local function on_move(data)
|
||||||
|
Util.lsp.on_rename(data.source, data.destination)
|
||||||
|
end
|
||||||
|
|
||||||
|
local events = require("neo-tree.events")
|
||||||
|
opts.event_handlers = opts.event_handlers or {}
|
||||||
|
vim.list_extend(opts.event_handlers, {
|
||||||
|
{ event = events.FILE_MOVED, handler = on_move },
|
||||||
|
{ event = events.FILE_RENAMED, handler = on_move },
|
||||||
|
})
|
||||||
|
require("neo-tree").setup(opts)
|
||||||
|
vim.api.nvim_create_autocmd("TermClose", {
|
||||||
|
pattern = "*lazygit",
|
||||||
|
callback = function()
|
||||||
|
if package.loaded["neo-tree.sources.git_status"] then
|
||||||
|
require("neo-tree.sources.git_status").refresh()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- search/replace in multiple files
|
||||||
|
{
|
||||||
|
"nvim-pack/nvim-spectre",
|
||||||
|
build = false,
|
||||||
|
cmd = "Spectre",
|
||||||
|
opts = { open_cmd = "noswapfile vnew" },
|
||||||
|
-- stylua: ignore
|
||||||
|
keys = {
|
||||||
|
{ "<leader>sr", function() require("spectre").open() end, desc = "Replace in files (Spectre)" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Fuzzy finder.
|
||||||
|
-- The default key bindings to find files will use Telescope's
|
||||||
|
-- `find_files` or `git_files` depending on whether the
|
||||||
|
-- directory is a git repo.
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
cmd = "Telescope",
|
||||||
|
version = false, -- telescope did only one release, so use HEAD for now
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope-fzf-native.nvim",
|
||||||
|
build = "make",
|
||||||
|
enabled = vim.fn.executable("make") == 1,
|
||||||
|
config = function()
|
||||||
|
Util.on_load("telescope.nvim", function()
|
||||||
|
require("telescope").load_extension("fzf")
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>,",
|
||||||
|
"<cmd>Telescope buffers sort_mru=true sort_lastused=true<cr>",
|
||||||
|
desc = "Switch Buffer",
|
||||||
|
},
|
||||||
|
{ "<leader>/", Util.telescope("live_grep"), desc = "Grep (root dir)" },
|
||||||
|
{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
|
||||||
|
{ "<leader><space>", Util.telescope("files"), desc = "Find Files (root dir)" },
|
||||||
|
-- find
|
||||||
|
{ "<leader>fb", "<cmd>Telescope buffers sort_mru=true sort_lastused=true<cr>", desc = "Buffers" },
|
||||||
|
{ "<leader>fc", Util.telescope.config_files(), desc = "Find Config File" },
|
||||||
|
{ "<leader>ff", Util.telescope("files"), desc = "Find Files (root dir)" },
|
||||||
|
{ "<leader>fF", Util.telescope("files", { cwd = false }), desc = "Find Files (cwd)" },
|
||||||
|
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Recent" },
|
||||||
|
{ "<leader>fR", Util.telescope("oldfiles", { cwd = vim.loop.cwd() }), desc = "Recent (cwd)" },
|
||||||
|
-- git
|
||||||
|
{ "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "commits" },
|
||||||
|
{ "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "status" },
|
||||||
|
-- search
|
||||||
|
{ '<leader>s"', "<cmd>Telescope registers<cr>", desc = "Registers" },
|
||||||
|
{ "<leader>sa", "<cmd>Telescope autocommands<cr>", desc = "Auto Commands" },
|
||||||
|
{ "<leader>sb", "<cmd>Telescope current_buffer_fuzzy_find<cr>", desc = "Buffer" },
|
||||||
|
{ "<leader>sc", "<cmd>Telescope command_history<cr>", desc = "Command History" },
|
||||||
|
{ "<leader>sC", "<cmd>Telescope commands<cr>", desc = "Commands" },
|
||||||
|
{ "<leader>sd", "<cmd>Telescope diagnostics bufnr=0<cr>", desc = "Document diagnostics" },
|
||||||
|
{ "<leader>sD", "<cmd>Telescope diagnostics<cr>", desc = "Workspace diagnostics" },
|
||||||
|
{ "<leader>sg", Util.telescope("live_grep"), desc = "Grep (root dir)" },
|
||||||
|
{ "<leader>sG", Util.telescope("live_grep", { cwd = false }), desc = "Grep (cwd)" },
|
||||||
|
{ "<leader>sh", "<cmd>Telescope help_tags<cr>", desc = "Help Pages" },
|
||||||
|
{ "<leader>sH", "<cmd>Telescope highlights<cr>", desc = "Search Highlight Groups" },
|
||||||
|
{ "<leader>sk", "<cmd>Telescope keymaps<cr>", desc = "Key Maps" },
|
||||||
|
{ "<leader>sM", "<cmd>Telescope man_pages<cr>", desc = "Man Pages" },
|
||||||
|
{ "<leader>sm", "<cmd>Telescope marks<cr>", desc = "Jump to Mark" },
|
||||||
|
{ "<leader>so", "<cmd>Telescope vim_options<cr>", desc = "Options" },
|
||||||
|
{ "<leader>sR", "<cmd>Telescope resume<cr>", desc = "Resume" },
|
||||||
|
{ "<leader>sw", Util.telescope("grep_string", { word_match = "-w" }), desc = "Word (root dir)" },
|
||||||
|
{ "<leader>sW", Util.telescope("grep_string", { cwd = false, word_match = "-w" }), desc = "Word (cwd)" },
|
||||||
|
{ "<leader>sw", Util.telescope("grep_string"), mode = "v", desc = "Selection (root dir)" },
|
||||||
|
{ "<leader>sW", Util.telescope("grep_string", { cwd = false }), mode = "v", desc = "Selection (cwd)" },
|
||||||
|
{ "<leader>uC", Util.telescope("colorscheme", { enable_preview = true }), desc = "Colorscheme with preview" },
|
||||||
|
{
|
||||||
|
"<leader>ss",
|
||||||
|
function()
|
||||||
|
require("telescope.builtin").lsp_document_symbols({
|
||||||
|
symbols = require("lazyvim.config").get_kind_filter(),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
desc = "Goto Symbol",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>sS",
|
||||||
|
function()
|
||||||
|
require("telescope.builtin").lsp_dynamic_workspace_symbols({
|
||||||
|
symbols = require("lazyvim.config").get_kind_filter(),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
desc = "Goto Symbol (Workspace)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts = function()
|
||||||
|
local actions = require("telescope.actions")
|
||||||
|
|
||||||
|
local open_with_trouble = function(...)
|
||||||
|
return require("trouble.providers.telescope").open_with_trouble(...)
|
||||||
|
end
|
||||||
|
local open_selected_with_trouble = function(...)
|
||||||
|
return require("trouble.providers.telescope").open_selected_with_trouble(...)
|
||||||
|
end
|
||||||
|
local find_files_no_ignore = function()
|
||||||
|
local action_state = require("telescope.actions.state")
|
||||||
|
local line = action_state.get_current_line()
|
||||||
|
Util.telescope("find_files", { no_ignore = true, default_text = line })()
|
||||||
|
end
|
||||||
|
local find_files_with_hidden = function()
|
||||||
|
local action_state = require("telescope.actions.state")
|
||||||
|
local line = action_state.get_current_line()
|
||||||
|
Util.telescope("find_files", { hidden = true, default_text = line })()
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
defaults = {
|
||||||
|
prompt_prefix = " ",
|
||||||
|
selection_caret = " ",
|
||||||
|
-- open files in the first window that is an actual file.
|
||||||
|
-- use the current window if no other window is available.
|
||||||
|
get_selection_window = function()
|
||||||
|
local wins = vim.api.nvim_list_wins()
|
||||||
|
table.insert(wins, 1, vim.api.nvim_get_current_win())
|
||||||
|
for _, win in ipairs(wins) do
|
||||||
|
local buf = vim.api.nvim_win_get_buf(win)
|
||||||
|
if vim.bo[buf].buftype == "" then
|
||||||
|
return win
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end,
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
["<c-t>"] = open_with_trouble,
|
||||||
|
["<a-t>"] = open_selected_with_trouble,
|
||||||
|
["<a-i>"] = find_files_no_ignore,
|
||||||
|
["<a-h>"] = find_files_with_hidden,
|
||||||
|
["<C-Down>"] = actions.cycle_history_next,
|
||||||
|
["<C-Up>"] = actions.cycle_history_prev,
|
||||||
|
["<C-f>"] = actions.preview_scrolling_down,
|
||||||
|
["<C-b>"] = actions.preview_scrolling_up,
|
||||||
|
},
|
||||||
|
n = {
|
||||||
|
["q"] = actions.close,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Flash enhances the built-in search functionality by showing labels
|
||||||
|
-- at the end of each match, letting you quickly jump to a specific
|
||||||
|
-- location.
|
||||||
|
{
|
||||||
|
"folke/flash.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
vscode = true,
|
||||||
|
---@type Flash.Config
|
||||||
|
opts = {},
|
||||||
|
-- stylua: ignore
|
||||||
|
keys = {
|
||||||
|
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
|
||||||
|
{ "S", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
|
||||||
|
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
|
||||||
|
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
|
||||||
|
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Flash Telescope config
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
if not Util.has("flash.nvim") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local function flash(prompt_bufnr)
|
||||||
|
require("flash").jump({
|
||||||
|
pattern = "^",
|
||||||
|
label = { after = { 0, 0 } },
|
||||||
|
search = {
|
||||||
|
mode = "search",
|
||||||
|
exclude = {
|
||||||
|
function(win)
|
||||||
|
return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= "TelescopeResults"
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
action = function(match)
|
||||||
|
local picker = require("telescope.actions.state").get_current_picker(prompt_bufnr)
|
||||||
|
picker:set_selection(match.pos[1] - 1)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
opts.defaults = vim.tbl_deep_extend("force", opts.defaults or {}, {
|
||||||
|
mappings = { n = { s = flash }, i = { ["<c-s>"] = flash } },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- which-key helps you remember key bindings by showing a popup
|
||||||
|
-- with the active keybindings of the command you started typing.
|
||||||
|
{
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = {
|
||||||
|
plugins = { spelling = true },
|
||||||
|
defaults = {
|
||||||
|
mode = { "n", "v" },
|
||||||
|
["g"] = { name = "+goto" },
|
||||||
|
["gs"] = { name = "+surround" },
|
||||||
|
["]"] = { name = "+next" },
|
||||||
|
["["] = { name = "+prev" },
|
||||||
|
["<leader><tab>"] = { name = "+tabs" },
|
||||||
|
["<leader>b"] = { name = "+buffer" },
|
||||||
|
["<leader>c"] = { name = "+code" },
|
||||||
|
["<leader>f"] = { name = "+file/find" },
|
||||||
|
["<leader>g"] = { name = "+git" },
|
||||||
|
["<leader>gh"] = { name = "+hunks" },
|
||||||
|
["<leader>q"] = { name = "+quit/session" },
|
||||||
|
["<leader>s"] = { name = "+search" },
|
||||||
|
["<leader>u"] = { name = "+ui" },
|
||||||
|
["<leader>w"] = { name = "+windows" },
|
||||||
|
["<leader>x"] = { name = "+diagnostics/quickfix" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
local wk = require("which-key")
|
||||||
|
wk.setup(opts)
|
||||||
|
wk.register(opts.defaults)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- git signs highlights text that has changed since the list
|
||||||
|
-- git commit, and also lets you interactively stage & unstage
|
||||||
|
-- hunks in a commit.
|
||||||
|
{
|
||||||
|
"lewis6991/gitsigns.nvim",
|
||||||
|
event = "LazyFile",
|
||||||
|
opts = {
|
||||||
|
signs = {
|
||||||
|
add = { text = "▎" },
|
||||||
|
change = { text = "▎" },
|
||||||
|
delete = { text = "" },
|
||||||
|
topdelete = { text = "" },
|
||||||
|
changedelete = { text = "▎" },
|
||||||
|
untracked = { text = "▎" },
|
||||||
|
},
|
||||||
|
on_attach = function(buffer)
|
||||||
|
local gs = package.loaded.gitsigns
|
||||||
|
|
||||||
|
local function map(mode, l, r, desc)
|
||||||
|
vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- stylua: ignore start
|
||||||
|
map("n", "]h", gs.next_hunk, "Next Hunk")
|
||||||
|
map("n", "[h", gs.prev_hunk, "Prev Hunk")
|
||||||
|
map({ "n", "v" }, "<leader>ghs", ":Gitsigns stage_hunk<CR>", "Stage Hunk")
|
||||||
|
map({ "n", "v" }, "<leader>ghr", ":Gitsigns reset_hunk<CR>", "Reset Hunk")
|
||||||
|
map("n", "<leader>ghS", gs.stage_buffer, "Stage Buffer")
|
||||||
|
map("n", "<leader>ghu", gs.undo_stage_hunk, "Undo Stage Hunk")
|
||||||
|
map("n", "<leader>ghR", gs.reset_buffer, "Reset Buffer")
|
||||||
|
map("n", "<leader>ghp", gs.preview_hunk, "Preview Hunk")
|
||||||
|
map("n", "<leader>ghb", function() gs.blame_line({ full = true }) end, "Blame Line")
|
||||||
|
map("n", "<leader>ghd", gs.diffthis, "Diff This")
|
||||||
|
map("n", "<leader>ghD", function() gs.diffthis("~") end, "Diff This ~")
|
||||||
|
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "GitSigns Select Hunk")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Automatically highlights other instances of the word under your cursor.
|
||||||
|
-- This works with LSP, Treesitter, and regexp matching to find the other
|
||||||
|
-- instances.
|
||||||
|
{
|
||||||
|
"RRethy/vim-illuminate",
|
||||||
|
event = "LazyFile",
|
||||||
|
opts = {
|
||||||
|
delay = 200,
|
||||||
|
large_file_cutoff = 2000,
|
||||||
|
large_file_overrides = {
|
||||||
|
providers = { "lsp" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("illuminate").configure(opts)
|
||||||
|
|
||||||
|
local function map(key, dir, buffer)
|
||||||
|
vim.keymap.set("n", key, function()
|
||||||
|
require("illuminate")["goto_" .. dir .. "_reference"](false)
|
||||||
|
end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", buffer = buffer })
|
||||||
|
end
|
||||||
|
|
||||||
|
map("]]", "next")
|
||||||
|
map("[[", "prev")
|
||||||
|
|
||||||
|
-- also set it after loading ftplugins, since a lot overwrite [[ and ]]
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
callback = function()
|
||||||
|
local buffer = vim.api.nvim_get_current_buf()
|
||||||
|
map("]]", "next", buffer)
|
||||||
|
map("[[", "prev", buffer)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
keys = {
|
||||||
|
{ "]]", desc = "Next Reference" },
|
||||||
|
{ "[[", desc = "Prev Reference" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- buffer remove
|
||||||
|
{
|
||||||
|
"echasnovski/mini.bufremove",
|
||||||
|
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>bd",
|
||||||
|
function()
|
||||||
|
local bd = require("mini.bufremove").delete
|
||||||
|
if vim.bo.modified then
|
||||||
|
local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel")
|
||||||
|
if choice == 1 then -- Yes
|
||||||
|
vim.cmd.write()
|
||||||
|
bd(0)
|
||||||
|
elseif choice == 2 then -- No
|
||||||
|
bd(0, true)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
bd(0)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
desc = "Delete Buffer",
|
||||||
|
},
|
||||||
|
-- stylua: ignore
|
||||||
|
{ "<leader>bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- better diagnostics list and others
|
||||||
|
{
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
cmd = { "TroubleToggle", "Trouble" },
|
||||||
|
opts = { use_diagnostic_signs = true },
|
||||||
|
keys = {
|
||||||
|
{ "<leader>xx", "<cmd>TroubleToggle document_diagnostics<cr>", desc = "Document Diagnostics (Trouble)" },
|
||||||
|
{ "<leader>xX", "<cmd>TroubleToggle workspace_diagnostics<cr>", desc = "Workspace Diagnostics (Trouble)" },
|
||||||
|
{ "<leader>xL", "<cmd>TroubleToggle loclist<cr>", desc = "Location List (Trouble)" },
|
||||||
|
{ "<leader>xQ", "<cmd>TroubleToggle quickfix<cr>", desc = "Quickfix List (Trouble)" },
|
||||||
|
{
|
||||||
|
"[q",
|
||||||
|
function()
|
||||||
|
if require("trouble").is_open() then
|
||||||
|
require("trouble").previous({ skip_groups = true, jump = true })
|
||||||
|
else
|
||||||
|
local ok, err = pcall(vim.cmd.cprev)
|
||||||
|
if not ok then
|
||||||
|
vim.notify(err, vim.log.levels.ERROR)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
desc = "Previous trouble/quickfix item",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"]q",
|
||||||
|
function()
|
||||||
|
if require("trouble").is_open() then
|
||||||
|
require("trouble").next({ skip_groups = true, jump = true })
|
||||||
|
else
|
||||||
|
local ok, err = pcall(vim.cmd.cnext)
|
||||||
|
if not ok then
|
||||||
|
vim.notify(err, vim.log.levels.ERROR)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
desc = "Next trouble/quickfix item",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Finds and lists all of the TODO, HACK, BUG, etc comment
|
||||||
|
-- in your project and loads them into a browsable list.
|
||||||
|
{
|
||||||
|
"folke/todo-comments.nvim",
|
||||||
|
cmd = { "TodoTrouble", "TodoTelescope" },
|
||||||
|
event = "LazyFile",
|
||||||
|
config = true,
|
||||||
|
-- stylua: ignore
|
||||||
|
keys = {
|
||||||
|
{ "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" },
|
||||||
|
{ "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" },
|
||||||
|
{ "<leader>xt", "<cmd>TodoTrouble<cr>", desc = "Todo (Trouble)" },
|
||||||
|
{ "<leader>xT", "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme (Trouble)" },
|
||||||
|
{ "<leader>st", "<cmd>TodoTelescope<cr>", desc = "Todo" },
|
||||||
|
{ "<leader>sT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- codeium cmp source
|
||||||
|
{
|
||||||
|
"nvim-cmp",
|
||||||
|
dependencies = {
|
||||||
|
-- codeium
|
||||||
|
{
|
||||||
|
"Exafunction/codeium.nvim",
|
||||||
|
cmd = "Codeium",
|
||||||
|
build = ":Codeium Auth",
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
---@param opts cmp.ConfigSchema
|
||||||
|
opts = function(_, opts)
|
||||||
|
table.insert(opts.sources, 1, {
|
||||||
|
name = "codeium",
|
||||||
|
group_index = 1,
|
||||||
|
priority = 100,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
optional = true,
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = function(_, opts)
|
||||||
|
table.insert(opts.sections.lualine_x, 2, require("lazyvim.util").lualine.cmp_source("codeium"))
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- copilot
|
||||||
|
{
|
||||||
|
"zbirenbaum/copilot.lua",
|
||||||
|
cmd = "Copilot",
|
||||||
|
build = ":Copilot auth",
|
||||||
|
opts = {
|
||||||
|
suggestion = { enabled = false },
|
||||||
|
panel = { enabled = false },
|
||||||
|
filetypes = {
|
||||||
|
markdown = true,
|
||||||
|
help = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
optional = true,
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = function(_, opts)
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
local colors = {
|
||||||
|
[""] = Util.ui.fg("Special"),
|
||||||
|
["Normal"] = Util.ui.fg("Special"),
|
||||||
|
["Warning"] = Util.ui.fg("DiagnosticError"),
|
||||||
|
["InProgress"] = Util.ui.fg("DiagnosticWarn"),
|
||||||
|
}
|
||||||
|
table.insert(opts.sections.lualine_x, 2, {
|
||||||
|
function()
|
||||||
|
local icon = require("lazyvim.config").icons.kinds.Copilot
|
||||||
|
local status = require("copilot.api").status.data
|
||||||
|
return icon .. (status.message or "")
|
||||||
|
end,
|
||||||
|
cond = function()
|
||||||
|
if not package.loaded["copilot"] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local ok, clients = pcall(require("lazyvim.util").lsp.get_clients, { name = "copilot", bufnr = 0 })
|
||||||
|
if not ok then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return ok and #clients > 0
|
||||||
|
end,
|
||||||
|
color = function()
|
||||||
|
if not package.loaded["copilot"] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local status = require("copilot.api").status.data
|
||||||
|
return colors[status.status] or colors[""]
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- copilot cmp source
|
||||||
|
{
|
||||||
|
"nvim-cmp",
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"zbirenbaum/copilot-cmp",
|
||||||
|
dependencies = "copilot.lua",
|
||||||
|
opts = {},
|
||||||
|
config = function(_, opts)
|
||||||
|
local copilot_cmp = require("copilot_cmp")
|
||||||
|
copilot_cmp.setup(opts)
|
||||||
|
-- attach cmp source whenever copilot attaches
|
||||||
|
-- fixes lazy-loading issues with the copilot cmp source
|
||||||
|
require("lazyvim.util").lsp.on_attach(function(client)
|
||||||
|
if client.name == "copilot" then
|
||||||
|
copilot_cmp._on_insert_enter({})
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
---@param opts cmp.ConfigSchema
|
||||||
|
opts = function(_, opts)
|
||||||
|
table.insert(opts.sources, 1, {
|
||||||
|
name = "copilot",
|
||||||
|
group_index = 1,
|
||||||
|
priority = 100,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
return {
|
||||||
|
-- Tabnine cmp source
|
||||||
|
{
|
||||||
|
"nvim-cmp",
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"tzachar/cmp-tabnine",
|
||||||
|
build = {
|
||||||
|
Util.is_win() and "pwsh -noni .\\install.ps1" or "./install.sh",
|
||||||
|
":CmpTabnineHub",
|
||||||
|
},
|
||||||
|
dependencies = "hrsh7th/nvim-cmp",
|
||||||
|
opts = {
|
||||||
|
max_lines = 1000,
|
||||||
|
max_num_results = 3,
|
||||||
|
sort = true,
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("cmp_tabnine.config"):setup(opts)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
---@param opts cmp.ConfigSchema
|
||||||
|
opts = function(_, opts)
|
||||||
|
table.insert(opts.sources, 1, {
|
||||||
|
name = "cmp_tabnine",
|
||||||
|
group_index = 1,
|
||||||
|
priority = 100,
|
||||||
|
})
|
||||||
|
|
||||||
|
opts.formatting.format = Util.inject.args(opts.formatting.format, function(entry, item)
|
||||||
|
-- Hide percentage in the menu
|
||||||
|
if entry.source.name == "cmp_tabnine" then
|
||||||
|
item.menu = ""
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
-- Show TabNine status in lualine
|
||||||
|
{
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
optional = true,
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = function(_, opts)
|
||||||
|
local icon = require("lazyvim.config").icons.kinds.TabNine
|
||||||
|
table.insert(opts.sections.lualine_x, 2, require("lazyvim.util").lualine.cmp_source("cmp_tabnine", icon))
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
return {
|
||||||
|
-- better yank/paste
|
||||||
|
{
|
||||||
|
"gbprod/yanky.nvim",
|
||||||
|
dependencies = { { "kkharji/sqlite.lua", enabled = not jit.os:find("Windows") } },
|
||||||
|
opts = {
|
||||||
|
highlight = { timer = 250 },
|
||||||
|
ring = { storage = jit.os:find("Windows") and "shada" or "sqlite" },
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
-- stylua: ignore
|
||||||
|
{ "<leader>p", function() require("telescope").extensions.yank_history.yank_history({ }) end, desc = "Open Yank History" },
|
||||||
|
{ "y", "<Plug>(YankyYank)", mode = { "n", "x" }, desc = "Yank text" },
|
||||||
|
{ "p", "<Plug>(YankyPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after cursor" },
|
||||||
|
{ "P", "<Plug>(YankyPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before cursor" },
|
||||||
|
{ "gp", "<Plug>(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after selection" },
|
||||||
|
{ "gP", "<Plug>(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before selection" },
|
||||||
|
{ "[y", "<Plug>(YankyCycleForward)", desc = "Cycle forward through yank history" },
|
||||||
|
{ "]y", "<Plug>(YankyCycleBackward)", desc = "Cycle backward through yank history" },
|
||||||
|
{ "]p", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
|
||||||
|
{ "[p", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
|
||||||
|
{ "]P", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
|
||||||
|
{ "[P", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
|
||||||
|
{ ">p", "<Plug>(YankyPutIndentAfterShiftRight)", desc = "Put and indent right" },
|
||||||
|
{ "<p", "<Plug>(YankyPutIndentAfterShiftLeft)", desc = "Put and indent left" },
|
||||||
|
{ ">P", "<Plug>(YankyPutIndentBeforeShiftRight)", desc = "Put before and indent right" },
|
||||||
|
{ "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)", desc = "Put before and indent left" },
|
||||||
|
{ "=p", "<Plug>(YankyPutAfterFilter)", desc = "Put after applying a filter" },
|
||||||
|
{ "=P", "<Plug>(YankyPutBeforeFilter)", desc = "Put before applying a filter" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,118 @@
|
||||||
|
---@param config {args?:string[]|fun():string[]?}
|
||||||
|
local function get_args(config)
|
||||||
|
local args = type(config.args) == "function" and (config.args() or {}) or config.args or {}
|
||||||
|
config = vim.deepcopy(config)
|
||||||
|
---@cast args string[]
|
||||||
|
config.args = function()
|
||||||
|
local new_args = vim.fn.input("Run with args: ", table.concat(args, " ")) --[[@as string]]
|
||||||
|
return vim.split(vim.fn.expand(new_args) --[[@as string]], " ")
|
||||||
|
end
|
||||||
|
return config
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
|
||||||
|
dependencies = {
|
||||||
|
|
||||||
|
-- fancy UI for the debugger
|
||||||
|
{
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
|
-- stylua: ignore
|
||||||
|
keys = {
|
||||||
|
{ "<leader>du", function() require("dapui").toggle({ }) end, desc = "Dap UI" },
|
||||||
|
{ "<leader>de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} },
|
||||||
|
},
|
||||||
|
opts = {},
|
||||||
|
config = function(_, opts)
|
||||||
|
-- setup dap config by VsCode launch.json file
|
||||||
|
-- require("dap.ext.vscode").load_launchjs()
|
||||||
|
local dap = require("dap")
|
||||||
|
local dapui = require("dapui")
|
||||||
|
dapui.setup(opts)
|
||||||
|
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||||
|
dapui.open({})
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||||
|
dapui.close({})
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||||
|
dapui.close({})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- virtual text for the debugger
|
||||||
|
{
|
||||||
|
"theHamsta/nvim-dap-virtual-text",
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- which key integration
|
||||||
|
{
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
defaults = {
|
||||||
|
["<leader>d"] = { name = "+debug" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- mason.nvim integration
|
||||||
|
{
|
||||||
|
"jay-babu/mason-nvim-dap.nvim",
|
||||||
|
dependencies = "mason.nvim",
|
||||||
|
cmd = { "DapInstall", "DapUninstall" },
|
||||||
|
opts = {
|
||||||
|
-- Makes a best effort to setup the various debuggers with
|
||||||
|
-- reasonable debug configurations
|
||||||
|
automatic_installation = true,
|
||||||
|
|
||||||
|
-- You can provide additional configuration to the handlers,
|
||||||
|
-- see mason-nvim-dap README for more information
|
||||||
|
handlers = {},
|
||||||
|
|
||||||
|
-- You'll need to check that you have the required things installed
|
||||||
|
-- online, please don't ask me how to install them :)
|
||||||
|
ensure_installed = {
|
||||||
|
-- Update this to ensure that you have the debuggers for the langs you want
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- stylua: ignore
|
||||||
|
keys = {
|
||||||
|
{ "<leader>dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" },
|
||||||
|
{ "<leader>db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" },
|
||||||
|
{ "<leader>dc", function() require("dap").continue() end, desc = "Continue" },
|
||||||
|
{ "<leader>da", function() require("dap").continue({ before = get_args }) end, desc = "Run with Args" },
|
||||||
|
{ "<leader>dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" },
|
||||||
|
{ "<leader>dg", function() require("dap").goto_() end, desc = "Go to line (no execute)" },
|
||||||
|
{ "<leader>di", function() require("dap").step_into() end, desc = "Step Into" },
|
||||||
|
{ "<leader>dj", function() require("dap").down() end, desc = "Down" },
|
||||||
|
{ "<leader>dk", function() require("dap").up() end, desc = "Up" },
|
||||||
|
{ "<leader>dl", function() require("dap").run_last() end, desc = "Run Last" },
|
||||||
|
{ "<leader>do", function() require("dap").step_out() end, desc = "Step Out" },
|
||||||
|
{ "<leader>dO", function() require("dap").step_over() end, desc = "Step Over" },
|
||||||
|
{ "<leader>dp", function() require("dap").pause() end, desc = "Pause" },
|
||||||
|
{ "<leader>dr", function() require("dap").repl.toggle() end, desc = "Toggle REPL" },
|
||||||
|
{ "<leader>ds", function() require("dap").session() end, desc = "Session" },
|
||||||
|
{ "<leader>dt", function() require("dap").terminate() end, desc = "Terminate" },
|
||||||
|
{ "<leader>dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" },
|
||||||
|
},
|
||||||
|
|
||||||
|
config = function()
|
||||||
|
local Config = require("lazyvim.config")
|
||||||
|
vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" })
|
||||||
|
|
||||||
|
for name, sign in pairs(Config.icons.dap) do
|
||||||
|
sign = type(sign) == "table" and sign or { sign }
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"Dap" .. name,
|
||||||
|
{ text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
return {
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"jbyuki/one-small-step-for-vimkind",
|
||||||
|
-- stylua: ignore
|
||||||
|
config = function()
|
||||||
|
local dap = require("dap")
|
||||||
|
dap.adapters.nlua = function(callback, conf)
|
||||||
|
local adapter = {
|
||||||
|
type = "server",
|
||||||
|
host = conf.host or "127.0.0.1",
|
||||||
|
port = conf.port or 8086,
|
||||||
|
}
|
||||||
|
if conf.start_neovim then
|
||||||
|
local dap_run = dap.run
|
||||||
|
dap.run = function(c)
|
||||||
|
adapter.port = c.port
|
||||||
|
adapter.host = c.host
|
||||||
|
end
|
||||||
|
require("osv").run_this()
|
||||||
|
dap.run = dap_run
|
||||||
|
end
|
||||||
|
callback(adapter)
|
||||||
|
end
|
||||||
|
dap.configurations.lua = {
|
||||||
|
{
|
||||||
|
type = "nlua",
|
||||||
|
request = "attach",
|
||||||
|
name = "Run this file",
|
||||||
|
start_neovim = {},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "nlua",
|
||||||
|
request = "attach",
|
||||||
|
name = "Attach to running Neovim instance (port = 8086)",
|
||||||
|
port = 8086,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,123 @@
|
||||||
|
local Config = require("lazyvim.config")
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
return {
|
||||||
|
desc = "Aerial Symbol Browser",
|
||||||
|
{
|
||||||
|
"stevearc/aerial.nvim",
|
||||||
|
event = "LazyFile",
|
||||||
|
opts = function()
|
||||||
|
local icons = vim.deepcopy(Config.icons.kinds)
|
||||||
|
|
||||||
|
-- HACK: fix lua's weird choice for `Package` for control
|
||||||
|
-- structures like if/else/for/etc.
|
||||||
|
icons.lua = { Package = icons.Control }
|
||||||
|
|
||||||
|
---@type table<string, string[]>|false
|
||||||
|
local filter_kind = false
|
||||||
|
if Config.kind_filter then
|
||||||
|
filter_kind = assert(vim.deepcopy(Config.kind_filter))
|
||||||
|
filter_kind._ = filter_kind.default
|
||||||
|
filter_kind.default = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local opts = {
|
||||||
|
attach_mode = "global",
|
||||||
|
backends = { "lsp", "treesitter", "markdown", "man" },
|
||||||
|
show_guides = true,
|
||||||
|
layout = {
|
||||||
|
resize_to_content = false,
|
||||||
|
win_opts = {
|
||||||
|
winhl = "Normal:NormalFloat,FloatBorder:NormalFloat,SignColumn:SignColumnSB",
|
||||||
|
signcolumn = "yes",
|
||||||
|
statuscolumn = " ",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
icons = icons,
|
||||||
|
filter_kind = filter_kind,
|
||||||
|
-- stylua: ignore
|
||||||
|
guides = {
|
||||||
|
mid_item = "├╴",
|
||||||
|
last_item = "└╴",
|
||||||
|
nested_top = "│ ",
|
||||||
|
whitespace = " ",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return opts
|
||||||
|
end,
|
||||||
|
keys = {
|
||||||
|
{ "<leader>cs", "<cmd>AerialToggle<cr>", desc = "Aerial (Symbols)" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Telescope integration
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function()
|
||||||
|
Util.on_load("telescope.nvim", function()
|
||||||
|
require("telescope").load_extension("aerial")
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>ss",
|
||||||
|
"<cmd>Telescope aerial<cr>",
|
||||||
|
desc = "Goto Symbol (Aerial)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- edgy integration
|
||||||
|
{
|
||||||
|
"folke/edgy.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
local edgy_idx = Util.plugin.extra_idx("ui.edgy")
|
||||||
|
local aerial_idx = Util.plugin.extra_idx("editor.aerial")
|
||||||
|
|
||||||
|
if edgy_idx and edgy_idx > aerial_idx then
|
||||||
|
Util.warn("The `edgy.nvim` extra must be **imported** before the `aerial.nvim` extra to work properly.", {
|
||||||
|
title = "LazyVim",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
opts.right = opts.right or {}
|
||||||
|
table.insert(opts.right, {
|
||||||
|
title = "Aerial",
|
||||||
|
ft = "aerial",
|
||||||
|
pinned = true,
|
||||||
|
open = "AerialOpen",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- lualine integration
|
||||||
|
{
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
table.insert(opts.sections.lualine_c, {
|
||||||
|
"aerial",
|
||||||
|
sep = " ", -- separator between symbols
|
||||||
|
sep_icon = "", -- separator between icon and symbol
|
||||||
|
|
||||||
|
-- The number of symbols to render top-down. In order to render only 'N' last
|
||||||
|
-- symbols, negative numbers may be supplied. For instance, 'depth = -1' can
|
||||||
|
-- be used in order to render only current symbol.
|
||||||
|
depth = 5,
|
||||||
|
|
||||||
|
-- When 'dense' mode is on, icons are not rendered near their symbols. Only
|
||||||
|
-- a single icon that represents the kind of current symbol is rendered at
|
||||||
|
-- the beginning of status line.
|
||||||
|
dense = false,
|
||||||
|
|
||||||
|
-- The separator to be used to separate symbols in dense mode.
|
||||||
|
dense_sep = ".",
|
||||||
|
|
||||||
|
-- Color the symbol icons.
|
||||||
|
colored = true,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
return {
|
||||||
|
-- disable flash
|
||||||
|
{ "folke/flash.nvim", enabled = false, optional = true },
|
||||||
|
|
||||||
|
-- easily jump to any location and enhanced f/t motions for Leap
|
||||||
|
{
|
||||||
|
"ggandor/flit.nvim",
|
||||||
|
enabled = true,
|
||||||
|
keys = function()
|
||||||
|
---@type LazyKeys[]
|
||||||
|
local ret = {}
|
||||||
|
for _, key in ipairs({ "f", "F", "t", "T" }) do
|
||||||
|
ret[#ret + 1] = { key, mode = { "n", "x", "o" }, desc = key }
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end,
|
||||||
|
opts = { labeled_modes = "nx" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ggandor/leap.nvim",
|
||||||
|
enabled = true,
|
||||||
|
keys = {
|
||||||
|
{ "s", mode = { "n", "x", "o" }, desc = "Leap forward to" },
|
||||||
|
{ "S", mode = { "n", "x", "o" }, desc = "Leap backward to" },
|
||||||
|
{ "gs", mode = { "n", "x", "o" }, desc = "Leap from windows" },
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
local leap = require("leap")
|
||||||
|
for k, v in pairs(opts) do
|
||||||
|
leap.opts[k] = v
|
||||||
|
end
|
||||||
|
leap.add_default_mappings(true)
|
||||||
|
vim.keymap.del({ "x", "o" }, "x")
|
||||||
|
vim.keymap.del({ "x", "o" }, "X")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- rename surround mappings from gs to gz to prevent conflict with leap
|
||||||
|
{
|
||||||
|
"echasnovski/mini.surround",
|
||||||
|
opts = {
|
||||||
|
mappings = {
|
||||||
|
add = "gza", -- Add surrounding in Normal and Visual modes
|
||||||
|
delete = "gzd", -- Delete surrounding
|
||||||
|
find = "gzf", -- Find surrounding (to the right)
|
||||||
|
find_left = "gzF", -- Find surrounding (to the left)
|
||||||
|
highlight = "gzh", -- Highlight surrounding
|
||||||
|
replace = "gzr", -- Replace surrounding
|
||||||
|
update_n_lines = "gzn", -- Update `n_lines`
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- makes some plugins dot-repeatable like leap
|
||||||
|
{ "tpope/vim-repeat", event = "VeryLazy" },
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
return {
|
||||||
|
"echasnovski/mini.files",
|
||||||
|
opts = {
|
||||||
|
windows = {
|
||||||
|
preview = true,
|
||||||
|
width_focus = 30,
|
||||||
|
width_preview = 30,
|
||||||
|
},
|
||||||
|
options = {
|
||||||
|
-- Whether to use for editing directories
|
||||||
|
-- Disabled by default in LazyVim because neo-tree is used for that
|
||||||
|
use_as_default_explorer = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>fm",
|
||||||
|
function()
|
||||||
|
require("mini.files").open(vim.api.nvim_buf_get_name(0), true)
|
||||||
|
end,
|
||||||
|
desc = "Open mini.files (directory of current file)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>fM",
|
||||||
|
function()
|
||||||
|
require("mini.files").open(vim.loop.cwd(), true)
|
||||||
|
end,
|
||||||
|
desc = "Open mini.files (cwd)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("mini.files").setup(opts)
|
||||||
|
|
||||||
|
local show_dotfiles = true
|
||||||
|
local filter_show = function(fs_entry)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
local filter_hide = function(fs_entry)
|
||||||
|
return not vim.startswith(fs_entry.name, ".")
|
||||||
|
end
|
||||||
|
|
||||||
|
local toggle_dotfiles = function()
|
||||||
|
show_dotfiles = not show_dotfiles
|
||||||
|
local new_filter = show_dotfiles and filter_show or filter_hide
|
||||||
|
require("mini.files").refresh({ content = { filter = new_filter } })
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "MiniFilesBufferCreate",
|
||||||
|
callback = function(args)
|
||||||
|
local buf_id = args.data.buf_id
|
||||||
|
-- Tweak left-hand side of mapping to your liking
|
||||||
|
vim.keymap.set("n", "g.", toggle_dotfiles, { buffer = buf_id })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "MiniFilesActionRename",
|
||||||
|
callback = function(event)
|
||||||
|
require("lazyvim.util").lsp.on_rename(event.data.from, event.data.to)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
return {
|
||||||
|
-- lsp symbol navigation for lualine. This shows where
|
||||||
|
-- in the code structure you are - within functions, classes,
|
||||||
|
-- etc - in the statusline.
|
||||||
|
{
|
||||||
|
"SmiteshP/nvim-navic",
|
||||||
|
lazy = true,
|
||||||
|
init = function()
|
||||||
|
vim.g.navic_silence = true
|
||||||
|
require("lazyvim.util").lsp.on_attach(function(client, buffer)
|
||||||
|
if client.supports_method("textDocument/documentSymbol") then
|
||||||
|
require("nvim-navic").attach(client, buffer)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
opts = function()
|
||||||
|
return {
|
||||||
|
separator = " ",
|
||||||
|
highlight = true,
|
||||||
|
depth_limit = 5,
|
||||||
|
icons = require("lazyvim.config").icons.kinds,
|
||||||
|
lazy_update_context = true,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- lualine integration
|
||||||
|
{
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
table.insert(opts.sections.lualine_c, {
|
||||||
|
function()
|
||||||
|
return require("nvim-navic").get_location()
|
||||||
|
end,
|
||||||
|
cond = function()
|
||||||
|
return package.loaded["nvim-navic"] and require("nvim-navic").is_available()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"simrat39/symbols-outline.nvim",
|
||||||
|
keys = { { "<leader>cs", "<cmd>SymbolsOutline<cr>", desc = "Symbols Outline" } },
|
||||||
|
cmd = "SymbolsOutline",
|
||||||
|
opts = function()
|
||||||
|
local Config = require("lazyvim.config")
|
||||||
|
local defaults = require("symbols-outline.config").defaults
|
||||||
|
local opts = {
|
||||||
|
symbols = {},
|
||||||
|
symbol_blacklist = {},
|
||||||
|
}
|
||||||
|
local filter = Config.kind_filter
|
||||||
|
|
||||||
|
if type(filter) == "table" then
|
||||||
|
filter = filter.default
|
||||||
|
if type(filter) == "table" then
|
||||||
|
for kind, symbol in pairs(defaults.symbols) do
|
||||||
|
opts.symbols[kind] = {
|
||||||
|
icon = Config.icons.kinds[kind] or symbol.icon,
|
||||||
|
hl = symbol.hl,
|
||||||
|
}
|
||||||
|
if not vim.tbl_contains(filter, kind) then
|
||||||
|
table.insert(opts.symbol_blacklist, kind)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return opts
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- edgy integration
|
||||||
|
{
|
||||||
|
"folke/edgy.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
local edgy_idx = Util.plugin.extra_idx("ui.edgy")
|
||||||
|
local symbols_idx = Util.plugin.extra_idx("editor.symbols-outline")
|
||||||
|
|
||||||
|
if edgy_idx and edgy_idx > symbols_idx then
|
||||||
|
Util.warn(
|
||||||
|
"The `edgy.nvim` extra must be **imported** before the `symbols-outline.nvim` extra to work properly.",
|
||||||
|
{
|
||||||
|
title = "LazyVim",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
opts.right = opts.right or {}
|
||||||
|
table.insert(opts.right, {
|
||||||
|
title = "Symbols Outline",
|
||||||
|
ft = "Outline",
|
||||||
|
pinned = true,
|
||||||
|
open = "SymbolsOutline",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
table.insert(opts.ensure_installed, "black")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvimtools/none-ls.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
local nls = require("null-ls")
|
||||||
|
opts.sources = opts.sources or {}
|
||||||
|
table.insert(opts.sources, nls.builtins.formatting.black)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
["python"] = { "black" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
table.insert(opts.ensure_installed, "prettier")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvimtools/none-ls.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
local nls = require("null-ls")
|
||||||
|
opts.sources = opts.sources or {}
|
||||||
|
table.insert(opts.sources, nls.builtins.formatting.prettier)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
["javascript"] = { "prettier" },
|
||||||
|
["javascriptreact"] = { "prettier" },
|
||||||
|
["typescript"] = { "prettier" },
|
||||||
|
["typescriptreact"] = { "prettier" },
|
||||||
|
["vue"] = { "prettier" },
|
||||||
|
["css"] = { "prettier" },
|
||||||
|
["scss"] = { "prettier" },
|
||||||
|
["less"] = { "prettier" },
|
||||||
|
["html"] = { "prettier" },
|
||||||
|
["json"] = { "prettier" },
|
||||||
|
["jsonc"] = { "prettier" },
|
||||||
|
["yaml"] = { "prettier" },
|
||||||
|
["markdown"] = { "prettier" },
|
||||||
|
["markdown.mdx"] = { "prettier" },
|
||||||
|
["graphql"] = { "prettier" },
|
||||||
|
["handlebars"] = { "prettier" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,154 @@
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- Add C/C++ to treesitter
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "c", "cpp" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"p00f/clangd_extensions.nvim",
|
||||||
|
lazy = true,
|
||||||
|
config = function() end,
|
||||||
|
opts = {
|
||||||
|
inlay_hints = {
|
||||||
|
inline = false,
|
||||||
|
},
|
||||||
|
ast = {
|
||||||
|
--These require codicons (https://github.com/microsoft/vscode-codicons)
|
||||||
|
role_icons = {
|
||||||
|
type = "",
|
||||||
|
declaration = "",
|
||||||
|
expression = "",
|
||||||
|
specifier = "",
|
||||||
|
statement = "",
|
||||||
|
["template argument"] = "",
|
||||||
|
},
|
||||||
|
kind_icons = {
|
||||||
|
Compound = "",
|
||||||
|
Recovery = "",
|
||||||
|
TranslationUnit = "",
|
||||||
|
PackExpansion = "",
|
||||||
|
TemplateTypeParm = "",
|
||||||
|
TemplateTemplateParm = "",
|
||||||
|
TemplateParamObject = "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Correctly setup lspconfig for clangd 🚀
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
-- Ensure mason installs the server
|
||||||
|
clangd = {
|
||||||
|
keys = {
|
||||||
|
{ "<leader>cR", "<cmd>ClangdSwitchSourceHeader<cr>", desc = "Switch Source/Header (C/C++)" },
|
||||||
|
},
|
||||||
|
root_dir = function(fname)
|
||||||
|
return require("lspconfig.util").root_pattern(
|
||||||
|
"Makefile",
|
||||||
|
"configure.ac",
|
||||||
|
"configure.in",
|
||||||
|
"config.h.in",
|
||||||
|
"meson.build",
|
||||||
|
"meson_options.txt",
|
||||||
|
"build.ninja"
|
||||||
|
)(fname) or require("lspconfig.util").root_pattern("compile_commands.json", "compile_flags.txt")(
|
||||||
|
fname
|
||||||
|
) or require("lspconfig.util").find_git_ancestor(fname)
|
||||||
|
end,
|
||||||
|
capabilities = {
|
||||||
|
offsetEncoding = { "utf-16" },
|
||||||
|
},
|
||||||
|
cmd = {
|
||||||
|
"clangd",
|
||||||
|
"--background-index",
|
||||||
|
"--clang-tidy",
|
||||||
|
"--header-insertion=iwyu",
|
||||||
|
"--completion-style=detailed",
|
||||||
|
"--function-arg-placeholders",
|
||||||
|
"--fallback-style=llvm",
|
||||||
|
},
|
||||||
|
init_options = {
|
||||||
|
usePlaceholders = true,
|
||||||
|
completeUnimported = true,
|
||||||
|
clangdFileStatus = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup = {
|
||||||
|
clangd = function(_, opts)
|
||||||
|
local clangd_ext_opts = require("lazyvim.util").opts("clangd_extensions.nvim")
|
||||||
|
require("clangd_extensions").setup(vim.tbl_deep_extend("force", clangd_ext_opts or {}, { server = opts }))
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"nvim-cmp",
|
||||||
|
opts = function(_, opts)
|
||||||
|
table.insert(opts.sorting.comparators, 1, require("clangd_extensions.cmp_scores"))
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
-- Ensure C/C++ debugger is installed
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "codelldb" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
opts = function()
|
||||||
|
local dap = require("dap")
|
||||||
|
if not dap.adapters["codelldb"] then
|
||||||
|
require("dap").adapters["codelldb"] = {
|
||||||
|
type = "server",
|
||||||
|
host = "localhost",
|
||||||
|
port = "${port}",
|
||||||
|
executable = {
|
||||||
|
command = "codelldb",
|
||||||
|
args = {
|
||||||
|
"--port",
|
||||||
|
"${port}",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
for _, lang in ipairs({ "c", "cpp" }) do
|
||||||
|
dap.configurations[lang] = {
|
||||||
|
{
|
||||||
|
type = "codelldb",
|
||||||
|
request = "launch",
|
||||||
|
name = "Launch file",
|
||||||
|
program = function()
|
||||||
|
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||||
|
end,
|
||||||
|
cwd = "${workspaceFolder}",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "codelldb",
|
||||||
|
request = "attach",
|
||||||
|
name = "Attach to process",
|
||||||
|
processId = require("dap.utils").pick_process,
|
||||||
|
cwd = "${workspaceFolder}",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "cmake" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvimtools/none-ls.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
local nls = require("null-ls")
|
||||||
|
opts.sources = vim.list_extend(opts.sources or {}, {
|
||||||
|
nls.builtins.diagnostics.cmake_lint,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-lint",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
linters_by_ft = {
|
||||||
|
cmake = { "cmakelint" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
vim.list_extend(opts.ensure_installed, { "cmakelang", "cmakelint" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
neocmake = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Civitasv/cmake-tools.nvim",
|
||||||
|
opts = {},
|
||||||
|
event = "LazyFile",
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "dockerfile" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
vim.list_extend(opts.ensure_installed, { "hadolint" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvimtools/none-ls.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
local nls = require("null-ls")
|
||||||
|
opts.sources = vim.list_extend(opts.sources or {}, {
|
||||||
|
nls.builtins.diagnostics.hadolint,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-lint",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
linters_by_ft = {
|
||||||
|
dockerfile = { "hadolint" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
dockerls = {},
|
||||||
|
docker_compose_language_service = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
vim.list_extend(opts.ensure_installed, {
|
||||||
|
"elixir",
|
||||||
|
"heex",
|
||||||
|
"eex",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
vim.list_extend(opts.ensure_installed, {
|
||||||
|
"elixir-ls",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-neotest/neotest",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
"jfpedroza/neotest-elixir",
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
adapters = {
|
||||||
|
["neotest-elixir"] = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvimtools/none-ls.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
if vim.fn.executable("credo") == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local nls = require("null-ls")
|
||||||
|
opts.sources = vim.list_extend(opts.sources or {}, {
|
||||||
|
nls.builtins.diagnostics.credo,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-lint",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
if vim.fn.executable("credo") == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
opts.linters_by_ft = {
|
||||||
|
elixir = { "credo" },
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,155 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
vim.list_extend(opts.ensure_installed, {
|
||||||
|
"go",
|
||||||
|
"gomod",
|
||||||
|
"gowork",
|
||||||
|
"gosum",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
gopls = {
|
||||||
|
keys = {
|
||||||
|
-- Workaround for the lack of a DAP strategy in neotest-go: https://github.com/nvim-neotest/neotest-go/issues/12
|
||||||
|
{ "<leader>td", "<cmd>lua require('dap-go').debug_test()<CR>", desc = "Debug Nearest (Go)" },
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
gopls = {
|
||||||
|
gofumpt = true,
|
||||||
|
codelenses = {
|
||||||
|
gc_details = false,
|
||||||
|
generate = true,
|
||||||
|
regenerate_cgo = true,
|
||||||
|
run_govulncheck = true,
|
||||||
|
test = true,
|
||||||
|
tidy = true,
|
||||||
|
upgrade_dependency = true,
|
||||||
|
vendor = true,
|
||||||
|
},
|
||||||
|
hints = {
|
||||||
|
assignVariableTypes = true,
|
||||||
|
compositeLiteralFields = true,
|
||||||
|
compositeLiteralTypes = true,
|
||||||
|
constantValues = true,
|
||||||
|
functionTypeParameters = true,
|
||||||
|
parameterNames = true,
|
||||||
|
rangeVariableTypes = true,
|
||||||
|
},
|
||||||
|
analyses = {
|
||||||
|
fieldalignment = true,
|
||||||
|
nilness = true,
|
||||||
|
unusedparams = true,
|
||||||
|
unusedwrite = true,
|
||||||
|
useany = true,
|
||||||
|
},
|
||||||
|
usePlaceholders = true,
|
||||||
|
completeUnimported = true,
|
||||||
|
staticcheck = true,
|
||||||
|
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
|
||||||
|
semanticTokens = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup = {
|
||||||
|
gopls = function(_, opts)
|
||||||
|
-- workaround for gopls not supporting semanticTokensProvider
|
||||||
|
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242
|
||||||
|
require("lazyvim.util").lsp.on_attach(function(client, _)
|
||||||
|
if client.name == "gopls" then
|
||||||
|
if not client.server_capabilities.semanticTokensProvider then
|
||||||
|
local semantic = client.config.capabilities.textDocument.semanticTokens
|
||||||
|
client.server_capabilities.semanticTokensProvider = {
|
||||||
|
full = true,
|
||||||
|
legend = {
|
||||||
|
tokenTypes = semantic.tokenTypes,
|
||||||
|
tokenModifiers = semantic.tokenModifiers,
|
||||||
|
},
|
||||||
|
range = true,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
-- end workaround
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- Ensure Go tools are installed
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
vim.list_extend(opts.ensure_installed, { "goimports", "gofumpt" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvimtools/none-ls.nvim",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts = function(_, opts)
|
||||||
|
local nls = require("null-ls")
|
||||||
|
opts.sources = vim.list_extend(opts.sources or {}, {
|
||||||
|
nls.builtins.code_actions.gomodifytags,
|
||||||
|
nls.builtins.code_actions.impl,
|
||||||
|
nls.builtins.formatting.goimports,
|
||||||
|
nls.builtins.formatting.gofumpt,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
go = { "goimports", "gofumpt" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
vim.list_extend(opts.ensure_installed, { "delve" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"leoluz/nvim-dap-go",
|
||||||
|
config = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-neotest/neotest",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
"nvim-neotest/neotest-go",
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
adapters = {
|
||||||
|
["neotest-go"] = {
|
||||||
|
-- Here we can set options for neotest-go, e.g.
|
||||||
|
-- args = { "-tags=integration" }
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,227 @@
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
-- This is the same as in lspconfig.server_configurations.jdtls, but avoids
|
||||||
|
-- needing to require that when this module loads.
|
||||||
|
local java_filetypes = { "java" }
|
||||||
|
|
||||||
|
-- Utility function to extend or override a config table, similar to the way
|
||||||
|
-- that Plugin.opts works.
|
||||||
|
---@param config table
|
||||||
|
---@param custom function | table | nil
|
||||||
|
local function extend_or_override(config, custom, ...)
|
||||||
|
if type(custom) == "function" then
|
||||||
|
config = custom(config, ...) or config
|
||||||
|
elseif custom then
|
||||||
|
config = vim.tbl_deep_extend("force", config, custom) --[[@as table]]
|
||||||
|
end
|
||||||
|
return config
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
-- Add java to treesitter.
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
vim.list_extend(opts.ensure_installed, { "java" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Ensure java debugger and test packages are installed.
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
vim.list_extend(opts.ensure_installed, { "java-test", "java-debug-adapter" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Configure nvim-lspconfig to install the server automatically via mason, but
|
||||||
|
-- defer actually starting it to our configuration of nvim-jtdls below.
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
-- make sure mason installs the server
|
||||||
|
servers = {
|
||||||
|
jdtls = {},
|
||||||
|
},
|
||||||
|
setup = {
|
||||||
|
jdtls = function()
|
||||||
|
return true -- avoid duplicate servers
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Set up nvim-jdtls to attach to java files.
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-jdtls",
|
||||||
|
dependencies = { "folke/which-key.nvim" },
|
||||||
|
ft = java_filetypes,
|
||||||
|
opts = function()
|
||||||
|
return {
|
||||||
|
-- How to find the root dir for a given filename. The default comes from
|
||||||
|
-- lspconfig which provides a function specifically for java projects.
|
||||||
|
root_dir = require("lspconfig.server_configurations.jdtls").default_config.root_dir,
|
||||||
|
|
||||||
|
-- How to find the project name for a given root dir.
|
||||||
|
project_name = function(root_dir)
|
||||||
|
return root_dir and vim.fs.basename(root_dir)
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- Where are the config and workspace dirs for a project?
|
||||||
|
jdtls_config_dir = function(project_name)
|
||||||
|
return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/config"
|
||||||
|
end,
|
||||||
|
jdtls_workspace_dir = function(project_name)
|
||||||
|
return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/workspace"
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- How to run jdtls. This can be overridden to a full java command-line
|
||||||
|
-- if the Python wrapper script doesn't suffice.
|
||||||
|
cmd = { vim.fn.exepath("jdtls") },
|
||||||
|
full_cmd = function(opts)
|
||||||
|
local fname = vim.api.nvim_buf_get_name(0)
|
||||||
|
local root_dir = opts.root_dir(fname)
|
||||||
|
local project_name = opts.project_name(root_dir)
|
||||||
|
local cmd = vim.deepcopy(opts.cmd)
|
||||||
|
if project_name then
|
||||||
|
vim.list_extend(cmd, {
|
||||||
|
"-configuration",
|
||||||
|
opts.jdtls_config_dir(project_name),
|
||||||
|
"-data",
|
||||||
|
opts.jdtls_workspace_dir(project_name),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
return cmd
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- These depend on nvim-dap, but can additionally be disabled by setting false here.
|
||||||
|
dap = { hotcodereplace = "auto", config_overrides = {} },
|
||||||
|
test = true,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
config = function()
|
||||||
|
local opts = Util.opts("nvim-jdtls") or {}
|
||||||
|
|
||||||
|
-- Find the extra bundles that should be passed on the jdtls command-line
|
||||||
|
-- if nvim-dap is enabled with java debug/test.
|
||||||
|
local mason_registry = require("mason-registry")
|
||||||
|
local bundles = {} ---@type string[]
|
||||||
|
if opts.dap and Util.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then
|
||||||
|
local java_dbg_pkg = mason_registry.get_package("java-debug-adapter")
|
||||||
|
local java_dbg_path = java_dbg_pkg:get_install_path()
|
||||||
|
local jar_patterns = {
|
||||||
|
java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar",
|
||||||
|
}
|
||||||
|
-- java-test also depends on java-debug-adapter.
|
||||||
|
if opts.test and mason_registry.is_installed("java-test") then
|
||||||
|
local java_test_pkg = mason_registry.get_package("java-test")
|
||||||
|
local java_test_path = java_test_pkg:get_install_path()
|
||||||
|
vim.list_extend(jar_patterns, {
|
||||||
|
java_test_path .. "/extension/server/*.jar",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
for _, jar_pattern in ipairs(jar_patterns) do
|
||||||
|
for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), "\n")) do
|
||||||
|
table.insert(bundles, bundle)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function attach_jdtls()
|
||||||
|
local fname = vim.api.nvim_buf_get_name(0)
|
||||||
|
|
||||||
|
-- Configuration can be augmented and overridden by opts.jdtls
|
||||||
|
local config = extend_or_override({
|
||||||
|
cmd = opts.full_cmd(opts),
|
||||||
|
root_dir = opts.root_dir(fname),
|
||||||
|
init_options = {
|
||||||
|
bundles = bundles,
|
||||||
|
},
|
||||||
|
-- enable CMP capabilities
|
||||||
|
capabilities = require("cmp_nvim_lsp").default_capabilities(),
|
||||||
|
}, opts.jdtls)
|
||||||
|
|
||||||
|
-- Existing server will be reused if the root_dir matches.
|
||||||
|
require("jdtls").start_or_attach(config)
|
||||||
|
-- not need to require("jdtls.setup").add_commands(), start automatically adds commands
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Attach the jdtls for each java buffer. HOWEVER, this plugin loads
|
||||||
|
-- depending on filetype, so this autocmd doesn't run for the first file.
|
||||||
|
-- For that, we call directly below.
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = java_filetypes,
|
||||||
|
callback = attach_jdtls,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Setup keymap and dap after the lsp is fully attached.
|
||||||
|
-- https://github.com/mfussenegger/nvim-jdtls#nvim-dap-configuration
|
||||||
|
-- https://neovim.io/doc/user/lsp.html#LspAttach
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
callback = function(args)
|
||||||
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
|
if client and client.name == "jdtls" then
|
||||||
|
local wk = require("which-key")
|
||||||
|
wk.register({
|
||||||
|
["<leader>cx"] = { name = "+extract" },
|
||||||
|
["<leader>cxv"] = { require("jdtls").extract_variable_all, "Extract Variable" },
|
||||||
|
["<leader>cxc"] = { require("jdtls").extract_constant, "Extract Constant" },
|
||||||
|
["gs"] = { require("jdtls").super_implementation, "Goto Super" },
|
||||||
|
["gS"] = { require("jdtls.tests").goto_subjects, "Goto Subjects" },
|
||||||
|
["<leader>co"] = { require("jdtls").organize_imports, "Organize Imports" },
|
||||||
|
}, { mode = "n", buffer = args.buf })
|
||||||
|
wk.register({
|
||||||
|
["<leader>c"] = { name = "+code" },
|
||||||
|
["<leader>cx"] = { name = "+extract" },
|
||||||
|
["<leader>cxm"] = {
|
||||||
|
[[<ESC><CMD>lua require('jdtls').extract_method(true)<CR>]],
|
||||||
|
"Extract Method",
|
||||||
|
},
|
||||||
|
["<leader>cxv"] = {
|
||||||
|
[[<ESC><CMD>lua require('jdtls').extract_variable_all(true)<CR>]],
|
||||||
|
"Extract Variable",
|
||||||
|
},
|
||||||
|
["<leader>cxc"] = {
|
||||||
|
[[<ESC><CMD>lua require('jdtls').extract_constant(true)<CR>]],
|
||||||
|
"Extract Constant",
|
||||||
|
},
|
||||||
|
}, { mode = "v", buffer = args.buf })
|
||||||
|
|
||||||
|
if opts.dap and Util.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then
|
||||||
|
-- custom init for Java debugger
|
||||||
|
require("jdtls").setup_dap(opts.dap)
|
||||||
|
require("jdtls.dap").setup_dap_main_class_configs()
|
||||||
|
|
||||||
|
-- Java Test require Java debugger to work
|
||||||
|
if opts.test and mason_registry.is_installed("java-test") then
|
||||||
|
-- custom keymaps for Java test runner (not yet compatible with neotest)
|
||||||
|
wk.register({
|
||||||
|
["<leader>t"] = { name = "+test" },
|
||||||
|
["<leader>tt"] = { require("jdtls.dap").test_class, "Run All Test" },
|
||||||
|
["<leader>tr"] = { require("jdtls.dap").test_nearest_method, "Run Nearest Test" },
|
||||||
|
["<leader>tT"] = { require("jdtls.dap").pick_test, "Run Test" },
|
||||||
|
}, { mode = "n", buffer = args.buf })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- User can set additional keymaps in opts.on_attach
|
||||||
|
if opts.on_attach then
|
||||||
|
opts.on_attach(args)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Avoid race condition by calling attach the first time, since the autocmd won't fire.
|
||||||
|
attach_jdtls()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- add json to treesitter
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "json", "json5", "jsonc" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- yaml schema support
|
||||||
|
{
|
||||||
|
"b0o/SchemaStore.nvim",
|
||||||
|
lazy = true,
|
||||||
|
version = false, -- last release is way too old
|
||||||
|
},
|
||||||
|
|
||||||
|
-- correctly setup lspconfig
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
-- make sure mason installs the server
|
||||||
|
servers = {
|
||||||
|
jsonls = {
|
||||||
|
-- lazy-load schemastore when needed
|
||||||
|
on_new_config = function(new_config)
|
||||||
|
new_config.settings.json.schemas = new_config.settings.json.schemas or {}
|
||||||
|
vim.list_extend(new_config.settings.json.schemas, require("schemastore").json.schemas())
|
||||||
|
end,
|
||||||
|
settings = {
|
||||||
|
json = {
|
||||||
|
format = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
validate = { enable = true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
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" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvimtools/none-ls.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
local nls = require("null-ls")
|
||||||
|
opts.sources = vim.list_extend(opts.sources or {}, {
|
||||||
|
nls.builtins.diagnostics.markdownlint,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-lint",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
linters_by_ft = {
|
||||||
|
markdown = { "markdownlint" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
marksman = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Markdown preview
|
||||||
|
{
|
||||||
|
"iamcco/markdown-preview.nvim",
|
||||||
|
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
|
||||||
|
build = function()
|
||||||
|
vim.fn["mkdp#util#install"]()
|
||||||
|
end,
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>cp",
|
||||||
|
ft = "markdown",
|
||||||
|
"<cmd>MarkdownPreviewToggle<cr>",
|
||||||
|
desc = "Markdown Preview",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
vim.cmd([[do FileType]])
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"lukas-reineke/headlines.nvim",
|
||||||
|
opts = function()
|
||||||
|
local opts = {}
|
||||||
|
for _, ft in ipairs({ "markdown", "norg", "rmd", "org" }) do
|
||||||
|
opts[ft] = {
|
||||||
|
headline_highlights = {},
|
||||||
|
}
|
||||||
|
for i = 1, 6 do
|
||||||
|
local hl = "Headline" .. i
|
||||||
|
vim.api.nvim_set_hl(0, hl, { link = "Headline", default = true })
|
||||||
|
table.insert(opts[ft].headline_highlights, hl)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return opts
|
||||||
|
end,
|
||||||
|
ft = { "markdown", "norg", "rmd", "org" },
|
||||||
|
config = function(_, opts)
|
||||||
|
-- PERF: schedule to prevent headlines slowing down opening a file
|
||||||
|
vim.schedule(function()
|
||||||
|
require("headlines").setup(opts)
|
||||||
|
require("headlines").refresh()
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
return {
|
||||||
|
{ "Hoffs/omnisharp-extended-lsp.nvim", lazy = true },
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "c_sharp" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvimtools/none-ls.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
local nls = require("null-ls")
|
||||||
|
opts.sources = opts.sources or {}
|
||||||
|
table.insert(opts.sources, nls.builtins.formatting.csharpier)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
cs = { "csharpier" },
|
||||||
|
},
|
||||||
|
formatters = {
|
||||||
|
csharpier = {
|
||||||
|
command = "dotnet-csharpier",
|
||||||
|
args = { "--write-stdout" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
table.insert(opts.ensure_installed, "csharpier")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
omnisharp = {
|
||||||
|
handlers = {
|
||||||
|
["textDocument/definition"] = function(...)
|
||||||
|
return require("omnisharp_extended").handler(...)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"gd",
|
||||||
|
function()
|
||||||
|
require("omnisharp_extended").telescope_lsp_definitions()
|
||||||
|
end,
|
||||||
|
desc = "Goto Definition",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
enable_roslyn_analyzers = true,
|
||||||
|
organize_imports_on_format = true,
|
||||||
|
enable_import_completion = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
return {
|
||||||
|
-- "numiras/semshi",
|
||||||
|
"wookayin/semshi", -- use a maintained fork
|
||||||
|
ft = "python",
|
||||||
|
build = ":UpdateRemotePlugins",
|
||||||
|
init = function()
|
||||||
|
-- Disabled these features better provided by LSP or other more general plugins
|
||||||
|
vim.g["semshi#error_sign"] = false
|
||||||
|
vim.g["semshi#simplify_markup"] = false
|
||||||
|
vim.g["semshi#mark_selected_nodes"] = false
|
||||||
|
vim.g["semshi#update_delay_factor"] = 0.001
|
||||||
|
|
||||||
|
-- This autocmd must be defined in init to take effect
|
||||||
|
vim.api.nvim_create_autocmd({ "VimEnter", "ColorScheme" }, {
|
||||||
|
group = vim.api.nvim_create_augroup("SemanticHighlight", {}),
|
||||||
|
callback = function()
|
||||||
|
-- Only add style, inherit or link to the LSP's colors
|
||||||
|
vim.cmd([[
|
||||||
|
highlight! semshiGlobal gui=italic
|
||||||
|
highlight! link semshiImported @none
|
||||||
|
highlight! link semshiParameter @lsp.type.parameter
|
||||||
|
highlight! link semshiParameterUnused DiagnosticUnnecessary
|
||||||
|
highlight! link semshiBuiltin @function.builtin
|
||||||
|
highlight! link semshiAttribute @field
|
||||||
|
highlight! link semshiSelf @lsp.type.selfKeyword
|
||||||
|
highlight! link semshiUnresolved @lsp.type.unresolvedReference
|
||||||
|
highlight! link semshiFree @none
|
||||||
|
]])
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
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" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
pyright = {},
|
||||||
|
ruff_lsp = {
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>co",
|
||||||
|
function()
|
||||||
|
vim.lsp.buf.code_action({
|
||||||
|
apply = true,
|
||||||
|
context = {
|
||||||
|
only = { "source.organizeImports" },
|
||||||
|
diagnostics = {},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
desc = "Organize Imports",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup = {
|
||||||
|
ruff_lsp = function()
|
||||||
|
require("lazyvim.util").lsp.on_attach(function(client, _)
|
||||||
|
if client.name == "ruff_lsp" then
|
||||||
|
-- Disable hover in favor of Pyright
|
||||||
|
client.server_capabilities.hoverProvider = false
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-neotest/neotest",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
"nvim-neotest/neotest-python",
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
adapters = {
|
||||||
|
["neotest-python"] = {
|
||||||
|
-- Here you can specify the settings for the adapter, i.e.
|
||||||
|
-- runner = "pytest",
|
||||||
|
-- python = ".venv/bin/python",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
"mfussenegger/nvim-dap-python",
|
||||||
|
-- stylua: ignore
|
||||||
|
keys = {
|
||||||
|
{ "<leader>dPt", function() require('dap-python').test_method() end, desc = "Debug Method", ft = "python" },
|
||||||
|
{ "<leader>dPc", function() require('dap-python').test_class() end, desc = "Debug Class", ft = "python" },
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local path = require("mason-registry").get_package("debugpy"):get_install_path()
|
||||||
|
require("dap-python").setup(path .. "/venv/bin/python")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"linux-cultist/venv-selector.nvim",
|
||||||
|
cmd = "VenvSelect",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if require("lazyvim.util").has("nvim-dap-python") then
|
||||||
|
opts.dap_enabled = true
|
||||||
|
end
|
||||||
|
return vim.tbl_deep_extend("force", opts, {
|
||||||
|
name = {
|
||||||
|
"venv",
|
||||||
|
".venv",
|
||||||
|
"env",
|
||||||
|
".env",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv" } },
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
vim.list_extend(opts.ensure_installed, {
|
||||||
|
"ruby",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
vim.list_extend(opts.ensure_installed, {
|
||||||
|
"solargraph",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
solargraph = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
"suketa/nvim-dap-ruby",
|
||||||
|
config = function()
|
||||||
|
require("dap-ruby").setup()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-neotest/neotest",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
"olimorris/neotest-rspec",
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
adapters = {
|
||||||
|
["neotest-rspec"] = {
|
||||||
|
-- NOTE: By default neotest-rspec uses the system wide rspec gem instead of the one through bundler
|
||||||
|
-- rspec_cmd = function()
|
||||||
|
-- return vim.tbl_flatten({
|
||||||
|
-- "bundle",
|
||||||
|
-- "exec",
|
||||||
|
-- "rspec",
|
||||||
|
-- })
|
||||||
|
-- end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,162 @@
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- Extend auto completion
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"Saecki/crates.nvim",
|
||||||
|
event = { "BufRead Cargo.toml" },
|
||||||
|
opts = {
|
||||||
|
src = {
|
||||||
|
cmp = { enabled = true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
---@param opts cmp.ConfigSchema
|
||||||
|
opts = function(_, opts)
|
||||||
|
local cmp = require("cmp")
|
||||||
|
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, {
|
||||||
|
{ name = "crates" },
|
||||||
|
}))
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Add Rust & related to treesitter
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "ron", "rust", "toml" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Ensure Rust debugger is installed
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "codelldb" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"simrat39/rust-tools.nvim",
|
||||||
|
lazy = true,
|
||||||
|
opts = function()
|
||||||
|
local ok, mason_registry = pcall(require, "mason-registry")
|
||||||
|
local adapter ---@type any
|
||||||
|
if ok then
|
||||||
|
-- rust tools configuration for debugging support
|
||||||
|
local codelldb = mason_registry.get_package("codelldb")
|
||||||
|
local extension_path = codelldb:get_install_path() .. "/extension/"
|
||||||
|
local codelldb_path = extension_path .. "adapter/codelldb"
|
||||||
|
local liblldb_path = ""
|
||||||
|
if vim.loop.os_uname().sysname:find("Windows") then
|
||||||
|
liblldb_path = extension_path .. "lldb\\bin\\liblldb.dll"
|
||||||
|
elseif vim.fn.has("mac") == 1 then
|
||||||
|
liblldb_path = extension_path .. "lldb/lib/liblldb.dylib"
|
||||||
|
else
|
||||||
|
liblldb_path = extension_path .. "lldb/lib/liblldb.so"
|
||||||
|
end
|
||||||
|
adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path)
|
||||||
|
end
|
||||||
|
return {
|
||||||
|
dap = {
|
||||||
|
adapter = adapter,
|
||||||
|
},
|
||||||
|
tools = {
|
||||||
|
on_initialized = function()
|
||||||
|
vim.cmd([[
|
||||||
|
augroup RustLSP
|
||||||
|
autocmd CursorHold *.rs silent! lua vim.lsp.buf.document_highlight()
|
||||||
|
autocmd CursorMoved,InsertEnter *.rs silent! lua vim.lsp.buf.clear_references()
|
||||||
|
autocmd BufEnter,CursorHold,InsertLeave *.rs silent! lua vim.lsp.codelens.refresh()
|
||||||
|
augroup END
|
||||||
|
]])
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
config = function() end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Correctly setup lspconfig for Rust 🚀
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
-- Ensure mason installs the server
|
||||||
|
rust_analyzer = {
|
||||||
|
keys = {
|
||||||
|
{ "<leader>cK", "<cmd>RustHoverActions<cr>", desc = "Hover Actions (Rust)" },
|
||||||
|
{ "<leader>cR", "<cmd>RustCodeAction<cr>", desc = "Code Action (Rust)" },
|
||||||
|
{ "<leader>dr", "<cmd>RustDebuggables<cr>", desc = "Run Debuggables (Rust)" },
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
["rust-analyzer"] = {
|
||||||
|
cargo = {
|
||||||
|
allFeatures = true,
|
||||||
|
loadOutDirsFromCheck = true,
|
||||||
|
runBuildScripts = true,
|
||||||
|
},
|
||||||
|
-- Add clippy lints for Rust.
|
||||||
|
checkOnSave = {
|
||||||
|
allFeatures = true,
|
||||||
|
command = "clippy",
|
||||||
|
extraArgs = { "--no-deps" },
|
||||||
|
},
|
||||||
|
procMacro = {
|
||||||
|
enable = true,
|
||||||
|
ignored = {
|
||||||
|
["async-trait"] = { "async_trait" },
|
||||||
|
["napi-derive"] = { "napi" },
|
||||||
|
["async-recursion"] = { "async_recursion" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
taplo = {
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>cK",
|
||||||
|
function()
|
||||||
|
if vim.fn.expand("%:t") == "Cargo.toml" and require("crates").popup_available() then
|
||||||
|
require("crates").show_popup()
|
||||||
|
else
|
||||||
|
vim.lsp.buf.hover()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
desc = "Show Crate Documentation",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup = {
|
||||||
|
rust_analyzer = function(_, opts)
|
||||||
|
local rust_tools_opts = require("lazyvim.util").opts("rust-tools.nvim")
|
||||||
|
require("rust-tools").setup(vim.tbl_deep_extend("force", rust_tools_opts or {}, { server = opts }))
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"nvim-neotest/neotest",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
"rouge8/neotest-rust",
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
adapters = {
|
||||||
|
["neotest-rust"] = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
tailwindcss = {
|
||||||
|
-- exclude a filetype from the default_config
|
||||||
|
filetypes_exclude = { "markdown" },
|
||||||
|
-- add additional filetypes to the default_config
|
||||||
|
filetypes_include = {},
|
||||||
|
-- to fully override the default_config, change the below
|
||||||
|
-- filetypes = {}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup = {
|
||||||
|
tailwindcss = function(_, opts)
|
||||||
|
local tw = require("lspconfig.server_configurations.tailwindcss")
|
||||||
|
opts.filetypes = opts.filetypes or {}
|
||||||
|
|
||||||
|
-- Add default filetypes
|
||||||
|
vim.list_extend(opts.filetypes, tw.default_config.filetypes)
|
||||||
|
|
||||||
|
-- Remove excluded filetypes
|
||||||
|
--- @param ft string
|
||||||
|
opts.filetypes = vim.tbl_filter(function(ft)
|
||||||
|
return not vim.tbl_contains(opts.filetypes_exclude or {}, ft)
|
||||||
|
end, opts.filetypes)
|
||||||
|
|
||||||
|
-- Add additional filetypes
|
||||||
|
vim.list_extend(opts.filetypes, opts.filetypes_include or {})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
dependencies = {
|
||||||
|
{ "roobert/tailwindcss-colorizer-cmp.nvim", config = true },
|
||||||
|
},
|
||||||
|
opts = function(_, opts)
|
||||||
|
-- original LazyVim kind icon formatter
|
||||||
|
local format_kinds = opts.formatting.format
|
||||||
|
opts.formatting.format = function(entry, item)
|
||||||
|
format_kinds(entry, item) -- add icons
|
||||||
|
return require("tailwindcss-colorizer-cmp").formatter(entry, item)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = { "hcl", "terraform" },
|
||||||
|
desc = "terraform/hcl commentstring configuration",
|
||||||
|
command = "setlocal commentstring=#\\ %s",
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, {
|
||||||
|
"terraform",
|
||||||
|
"hcl",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
terraformls = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvimtools/none-ls.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
local null_ls = require("null-ls")
|
||||||
|
opts.sources = vim.list_extend(opts.sources or {}, {
|
||||||
|
null_ls.builtins.formatting.terraform_fmt,
|
||||||
|
null_ls.builtins.diagnostics.terraform_validate,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-lint",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
linters_by_ft = {
|
||||||
|
terraform = { "terraform_validate" },
|
||||||
|
tf = { "terraform_validate" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
terraform = { "terraform_fmt" },
|
||||||
|
tf = { "terraform_fmt" },
|
||||||
|
["terraform-vars"] = { "terraform_fmt" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
defaults = {
|
||||||
|
["<localLeader>l"] = { name = "+vimtex" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Add BibTeX/LaTeX to treesitter
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "bibtex", "latex" })
|
||||||
|
end
|
||||||
|
if type(opts.highlight.disable) == "table" then
|
||||||
|
vim.list_extend(opts.highlight.disable, { "latex" })
|
||||||
|
else
|
||||||
|
opts.highlight.disable = { "latex" }
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"lervag/vimtex",
|
||||||
|
lazy = false, -- lazy-loading will disable inverse search
|
||||||
|
config = function()
|
||||||
|
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||||
|
group = vim.api.nvim_create_augroup("lazyvim_vimtex_conceal", { clear = true }),
|
||||||
|
pattern = { "bib", "tex" },
|
||||||
|
callback = function()
|
||||||
|
vim.wo.conceallevel = 2
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.g.vimtex_mappings_disable = { ["n"] = { "K" } } -- disable `K` as it conflicts with LSP hover
|
||||||
|
vim.g.vimtex_quickfix_method = vim.fn.executable("pplatex") == 1 and "pplatex" or "latexlog"
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Correctly setup lspconfig for LaTeX 🚀
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
texlab = {
|
||||||
|
keys = {
|
||||||
|
{ "<Leader>K", "<plug>(vimtex-doc-package)", desc = "Vimtex Docs", silent = true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,124 @@
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- add typescript to treesitter
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
vim.list_extend(opts.ensure_installed, { "typescript", "tsx" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- correctly setup lspconfig
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
-- make sure mason installs the server
|
||||||
|
servers = {
|
||||||
|
---@type lspconfig.options.tsserver
|
||||||
|
tsserver = {
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>co",
|
||||||
|
function()
|
||||||
|
vim.lsp.buf.code_action({
|
||||||
|
apply = true,
|
||||||
|
context = {
|
||||||
|
only = { "source.organizeImports.ts" },
|
||||||
|
diagnostics = {},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
desc = "Organize Imports",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>cR",
|
||||||
|
function()
|
||||||
|
vim.lsp.buf.code_action({
|
||||||
|
apply = true,
|
||||||
|
context = {
|
||||||
|
only = { "source.removeUnused.ts" },
|
||||||
|
diagnostics = {},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
desc = "Remove Unused Imports",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
typescript = {
|
||||||
|
format = {
|
||||||
|
indentSize = vim.o.shiftwidth,
|
||||||
|
convertTabsToSpaces = vim.o.expandtab,
|
||||||
|
tabSize = vim.o.tabstop,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
javascript = {
|
||||||
|
format = {
|
||||||
|
indentSize = vim.o.shiftwidth,
|
||||||
|
convertTabsToSpaces = vim.o.expandtab,
|
||||||
|
tabSize = vim.o.tabstop,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
completions = {
|
||||||
|
completeFunctionCalls = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
optional = true,
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
table.insert(opts.ensure_installed, "js-debug-adapter")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts = function()
|
||||||
|
local dap = require("dap")
|
||||||
|
if not dap.adapters["pwa-node"] then
|
||||||
|
require("dap").adapters["pwa-node"] = {
|
||||||
|
type = "server",
|
||||||
|
host = "localhost",
|
||||||
|
port = "${port}",
|
||||||
|
executable = {
|
||||||
|
command = "node",
|
||||||
|
-- 💀 Make sure to update this path to point to your installation
|
||||||
|
args = {
|
||||||
|
require("mason-registry").get_package("js-debug-adapter"):get_install_path()
|
||||||
|
.. "/js-debug/src/dapDebugServer.js",
|
||||||
|
"${port}",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
for _, language in ipairs({ "typescript", "javascript", "typescriptreact", "javascriptreact" }) do
|
||||||
|
if not dap.configurations[language] then
|
||||||
|
dap.configurations[language] = {
|
||||||
|
{
|
||||||
|
type = "pwa-node",
|
||||||
|
request = "launch",
|
||||||
|
name = "Launch file",
|
||||||
|
program = "${file}",
|
||||||
|
cwd = "${workspaceFolder}",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "pwa-node",
|
||||||
|
request = "attach",
|
||||||
|
name = "Attach",
|
||||||
|
processId = require("dap.utils").pick_process,
|
||||||
|
cwd = "${workspaceFolder}",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- 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",
|
||||||
|
lazy = true,
|
||||||
|
version = false, -- last release is way too old
|
||||||
|
},
|
||||||
|
|
||||||
|
-- correctly setup lspconfig
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
-- make sure mason installs the server
|
||||||
|
servers = {
|
||||||
|
yamlls = {
|
||||||
|
-- Have to add this for yamlls to understand that we support line folding
|
||||||
|
capabilities = {
|
||||||
|
textDocument = {
|
||||||
|
foldingRange = {
|
||||||
|
dynamicRegistration = false,
|
||||||
|
lineFoldingOnly = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- lazy-load schemastore when needed
|
||||||
|
on_new_config = function(new_config)
|
||||||
|
new_config.settings.yaml.schemas = vim.tbl_deep_extend(
|
||||||
|
"force",
|
||||||
|
new_config.settings.yaml.schemas or {},
|
||||||
|
require("schemastore").yaml.schemas()
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
settings = {
|
||||||
|
redhat = { telemetry = { enabled = false } },
|
||||||
|
yaml = {
|
||||||
|
keyOrdering = false,
|
||||||
|
format = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
validate = true,
|
||||||
|
schemaStore = {
|
||||||
|
-- Must disable built-in schemaStore support to use
|
||||||
|
-- schemas from SchemaStore.nvim plugin
|
||||||
|
enable = false,
|
||||||
|
-- Avoid TypeError: Cannot read properties of undefined (reading 'length')
|
||||||
|
url = "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup = {
|
||||||
|
yamlls = function()
|
||||||
|
-- Neovim < 0.10 does not have dynamic registration for formatting
|
||||||
|
if vim.fn.has("nvim-0.10") == 0 then
|
||||||
|
require("lazyvim.util").lsp.on_attach(function(client, _)
|
||||||
|
if client.name == "yamlls" then
|
||||||
|
client.server_capabilities.documentFormattingProvider = true
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
-- other settings removed for brevity
|
||||||
|
opts = {
|
||||||
|
---@type lspconfig.options
|
||||||
|
servers = {
|
||||||
|
eslint = {
|
||||||
|
settings = {
|
||||||
|
-- helps eslint find the eslintrc when it's placed in a subfolder instead of the cwd root
|
||||||
|
workingDirectory = { mode = "auto" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup = {
|
||||||
|
eslint = function()
|
||||||
|
local function get_client(buf)
|
||||||
|
return require("lazyvim.util").lsp.get_clients({ name = "eslint", bufnr = buf })[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
local formatter = require("lazyvim.util").lsp.formatter({
|
||||||
|
name = "eslint: lsp",
|
||||||
|
primary = false,
|
||||||
|
priority = 200,
|
||||||
|
filter = "eslint",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use EslintFixAll on Neovim < 0.10.0
|
||||||
|
if not pcall(require, "vim.lsp._dynamic") then
|
||||||
|
formatter.name = "eslint: EslintFixAll"
|
||||||
|
formatter.sources = function(buf)
|
||||||
|
local client = get_client(buf)
|
||||||
|
return client and { "eslint" } or {}
|
||||||
|
end
|
||||||
|
formatter.format = function(buf)
|
||||||
|
local client = get_client(buf)
|
||||||
|
if client then
|
||||||
|
local diag = vim.diagnostic.get(buf, { namespace = vim.lsp.diagnostic.get_namespace(client.id) })
|
||||||
|
if #diag > 0 then
|
||||||
|
vim.cmd("EslintFixAll")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- register the formatter with LazyVim
|
||||||
|
require("lazyvim.util").format.register(formatter)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
return {
|
||||||
|
-- none-ls
|
||||||
|
{
|
||||||
|
"nvimtools/none-ls.nvim",
|
||||||
|
event = "LazyFile",
|
||||||
|
dependencies = { "mason.nvim" },
|
||||||
|
init = function()
|
||||||
|
Util.on_very_lazy(function()
|
||||||
|
-- register the formatter with LazyVim
|
||||||
|
require("lazyvim.util").format.register({
|
||||||
|
name = "none-ls.nvim",
|
||||||
|
priority = 200, -- set higher than conform, the builtin formatter
|
||||||
|
primary = true,
|
||||||
|
format = function(buf)
|
||||||
|
return Util.lsp.format({
|
||||||
|
bufnr = buf,
|
||||||
|
filter = function(client)
|
||||||
|
return client.name == "null-ls"
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
sources = function(buf)
|
||||||
|
local ret = require("null-ls.sources").get_available(vim.bo[buf].filetype, "NULL_LS_FORMATTING") or {}
|
||||||
|
return vim.tbl_map(function(source)
|
||||||
|
return source.name
|
||||||
|
end, ret)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
opts = function(_, opts)
|
||||||
|
local nls = require("null-ls")
|
||||||
|
opts.root_dir = opts.root_dir
|
||||||
|
or require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git")
|
||||||
|
opts.sources = vim.list_extend(opts.sources or {}, {
|
||||||
|
nls.builtins.formatting.fish_indent,
|
||||||
|
nls.builtins.diagnostics.fish,
|
||||||
|
nls.builtins.formatting.stylua,
|
||||||
|
nls.builtins.formatting.shfmt,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,127 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
defaults = {
|
||||||
|
["<leader>t"] = { name = "+test" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-neotest/neotest",
|
||||||
|
opts = {
|
||||||
|
-- Can be a list of adapters like what neotest expects,
|
||||||
|
-- or a list of adapter names,
|
||||||
|
-- or a table of adapter names, mapped to adapter configs.
|
||||||
|
-- The adapter will then be automatically loaded with the config.
|
||||||
|
adapters = {},
|
||||||
|
-- Example for loading neotest-go with a custom config
|
||||||
|
-- adapters = {
|
||||||
|
-- ["neotest-go"] = {
|
||||||
|
-- args = { "-tags=integration" },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
status = { virtual_text = true },
|
||||||
|
output = { open_on_run = true },
|
||||||
|
quickfix = {
|
||||||
|
open = function()
|
||||||
|
if require("lazyvim.util").has("trouble.nvim") then
|
||||||
|
require("trouble").open({ mode = "quickfix", focus = false })
|
||||||
|
else
|
||||||
|
vim.cmd("copen")
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
local neotest_ns = vim.api.nvim_create_namespace("neotest")
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_text = {
|
||||||
|
format = function(diagnostic)
|
||||||
|
-- Replace newline and tab characters with space for more compact diagnostics
|
||||||
|
local message = diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "")
|
||||||
|
return message
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}, neotest_ns)
|
||||||
|
|
||||||
|
if require("lazyvim.util").has("trouble.nvim") then
|
||||||
|
opts.consumers = opts.consumers or {}
|
||||||
|
-- Refresh and auto close trouble after running tests
|
||||||
|
---@type neotest.Consumer
|
||||||
|
opts.consumers.trouble = function(client)
|
||||||
|
client.listeners.results = function(adapter_id, results, partial)
|
||||||
|
if partial then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local tree = assert(client:get_position(nil, { adapter = adapter_id }))
|
||||||
|
|
||||||
|
local failed = 0
|
||||||
|
for pos_id, result in pairs(results) do
|
||||||
|
if result.status == "failed" and tree:get_key(pos_id) then
|
||||||
|
failed = failed + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.schedule(function()
|
||||||
|
local trouble = require("trouble")
|
||||||
|
if trouble.is_open() then
|
||||||
|
trouble.refresh()
|
||||||
|
if failed == 0 then
|
||||||
|
trouble.close()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if opts.adapters then
|
||||||
|
local adapters = {}
|
||||||
|
for name, config in pairs(opts.adapters or {}) do
|
||||||
|
if type(name) == "number" then
|
||||||
|
if type(config) == "string" then
|
||||||
|
config = require(config)
|
||||||
|
end
|
||||||
|
adapters[#adapters + 1] = config
|
||||||
|
elseif config ~= false then
|
||||||
|
local adapter = require(name)
|
||||||
|
if type(config) == "table" and not vim.tbl_isempty(config) then
|
||||||
|
local meta = getmetatable(adapter)
|
||||||
|
if adapter.setup then
|
||||||
|
adapter.setup(config)
|
||||||
|
elseif meta and meta.__call then
|
||||||
|
adapter(config)
|
||||||
|
else
|
||||||
|
error("Adapter " .. name .. " does not support setup")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
adapters[#adapters + 1] = adapter
|
||||||
|
end
|
||||||
|
end
|
||||||
|
opts.adapters = adapters
|
||||||
|
end
|
||||||
|
|
||||||
|
require("neotest").setup(opts)
|
||||||
|
end,
|
||||||
|
-- stylua: ignore
|
||||||
|
keys = {
|
||||||
|
{ "<leader>tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" },
|
||||||
|
{ "<leader>tT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" },
|
||||||
|
{ "<leader>tr", function() require("neotest").run.run() end, desc = "Run Nearest" },
|
||||||
|
{ "<leader>ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" },
|
||||||
|
{ "<leader>to", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" },
|
||||||
|
{ "<leader>tO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" },
|
||||||
|
{ "<leader>tS", function() require("neotest").run.stop() end, desc = "Stop" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
optional = true,
|
||||||
|
-- stylua: ignore
|
||||||
|
keys = {
|
||||||
|
{ "<leader>td", function() require("neotest").run.run({strategy = "dap"}) end, desc = "Debug Nearest" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
return {
|
||||||
|
|
||||||
|
{ "nvimdev/dashboard-nvim", enabled = false },
|
||||||
|
{ "echasnovski/mini.starter", enabled = false },
|
||||||
|
-- Dashboard. This runs when neovim starts, and is what displays
|
||||||
|
-- the "LAZYVIM" banner.
|
||||||
|
{
|
||||||
|
"goolord/alpha-nvim",
|
||||||
|
event = "VimEnter",
|
||||||
|
enabled = true,
|
||||||
|
init = false,
|
||||||
|
opts = function()
|
||||||
|
local dashboard = require("alpha.themes.dashboard")
|
||||||
|
local logo = [[
|
||||||
|
██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
|
||||||
|
██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
|
||||||
|
██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z
|
||||||
|
██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z
|
||||||
|
███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||||
|
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||||
|
]]
|
||||||
|
|
||||||
|
dashboard.section.header.val = vim.split(logo, "\n")
|
||||||
|
-- stylua: ignore
|
||||||
|
dashboard.section.buttons.val = {
|
||||||
|
dashboard.button("f", " " .. " Find file", "<cmd> Telescope find_files <cr>"),
|
||||||
|
dashboard.button("n", " " .. " New file", "<cmd> ene <BAR> startinsert <cr>"),
|
||||||
|
dashboard.button("r", " " .. " Recent files", "<cmd> Telescope oldfiles <cr>"),
|
||||||
|
dashboard.button("g", " " .. " Find text", "<cmd> Telescope live_grep <cr>"),
|
||||||
|
dashboard.button("c", " " .. " Config", "<cmd> lua require('lazyvim.util').telescope.config_files()() <cr>"),
|
||||||
|
dashboard.button("s", " " .. " Restore Session", [[<cmd> lua require("persistence").load() <cr>]]),
|
||||||
|
dashboard.button("x", " " .. " Lazy Extras", "<cmd> LazyExtras <cr>"),
|
||||||
|
dashboard.button("l", " " .. " Lazy", "<cmd> Lazy <cr>"),
|
||||||
|
dashboard.button("q", " " .. " Quit", "<cmd> qa <cr>"),
|
||||||
|
}
|
||||||
|
for _, button in ipairs(dashboard.section.buttons.val) do
|
||||||
|
button.opts.hl = "AlphaButtons"
|
||||||
|
button.opts.hl_shortcut = "AlphaShortcut"
|
||||||
|
end
|
||||||
|
dashboard.section.header.opts.hl = "AlphaHeader"
|
||||||
|
dashboard.section.buttons.opts.hl = "AlphaButtons"
|
||||||
|
dashboard.section.footer.opts.hl = "AlphaFooter"
|
||||||
|
dashboard.opts.layout[1].val = 8
|
||||||
|
return dashboard
|
||||||
|
end,
|
||||||
|
config = function(_, dashboard)
|
||||||
|
-- close Lazy and re-open when the dashboard is ready
|
||||||
|
if vim.o.filetype == "lazy" then
|
||||||
|
vim.cmd.close()
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
once = true,
|
||||||
|
pattern = "AlphaReady",
|
||||||
|
callback = function()
|
||||||
|
require("lazy").show()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
require("alpha").setup(dashboard.opts)
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
once = true,
|
||||||
|
pattern = "LazyVimStarted",
|
||||||
|
callback = function()
|
||||||
|
local stats = require("lazy").stats()
|
||||||
|
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
|
||||||
|
dashboard.section.footer.val = "⚡ Neovim loaded "
|
||||||
|
.. stats.loaded
|
||||||
|
.. "/"
|
||||||
|
.. stats.count
|
||||||
|
.. " plugins in "
|
||||||
|
.. ms
|
||||||
|
.. "ms"
|
||||||
|
pcall(vim.cmd.AlphaRedraw)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,174 @@
|
||||||
|
return {
|
||||||
|
-- edgy
|
||||||
|
{
|
||||||
|
"folke/edgy.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>ue",
|
||||||
|
function()
|
||||||
|
require("edgy").toggle()
|
||||||
|
end,
|
||||||
|
desc = "Edgy Toggle",
|
||||||
|
},
|
||||||
|
-- stylua: ignore
|
||||||
|
{ "<leader>uE", function() require("edgy").select() end, desc = "Edgy Select Window" },
|
||||||
|
},
|
||||||
|
opts = function()
|
||||||
|
local opts = {
|
||||||
|
bottom = {
|
||||||
|
{
|
||||||
|
ft = "toggleterm",
|
||||||
|
size = { height = 0.4 },
|
||||||
|
filter = function(buf, win)
|
||||||
|
return vim.api.nvim_win_get_config(win).relative == ""
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ft = "noice",
|
||||||
|
size = { height = 0.4 },
|
||||||
|
filter = function(buf, win)
|
||||||
|
return vim.api.nvim_win_get_config(win).relative == ""
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ft = "lazyterm",
|
||||||
|
title = "LazyTerm",
|
||||||
|
size = { height = 0.4 },
|
||||||
|
filter = function(buf)
|
||||||
|
return not vim.b[buf].lazyterm_cmd
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
"Trouble",
|
||||||
|
{
|
||||||
|
ft = "trouble",
|
||||||
|
filter = function(buf, win)
|
||||||
|
return vim.api.nvim_win_get_config(win).relative == ""
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{ ft = "qf", title = "QuickFix" },
|
||||||
|
{
|
||||||
|
ft = "help",
|
||||||
|
size = { height = 20 },
|
||||||
|
-- don't open help files in edgy that we're editing
|
||||||
|
filter = function(buf)
|
||||||
|
return vim.bo[buf].buftype == "help"
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{ title = "Spectre", ft = "spectre_panel", size = { height = 0.4 } },
|
||||||
|
{ title = "Neotest Output", ft = "neotest-output-panel", size = { height = 15 } },
|
||||||
|
},
|
||||||
|
left = {
|
||||||
|
{
|
||||||
|
title = "Neo-Tree",
|
||||||
|
ft = "neo-tree",
|
||||||
|
filter = function(buf)
|
||||||
|
return vim.b[buf].neo_tree_source == "filesystem"
|
||||||
|
end,
|
||||||
|
pinned = true,
|
||||||
|
open = function()
|
||||||
|
vim.api.nvim_input("<esc><space>e")
|
||||||
|
end,
|
||||||
|
size = { height = 0.5 },
|
||||||
|
},
|
||||||
|
{ title = "Neotest Summary", ft = "neotest-summary" },
|
||||||
|
{
|
||||||
|
title = "Neo-Tree Git",
|
||||||
|
ft = "neo-tree",
|
||||||
|
filter = function(buf)
|
||||||
|
return vim.b[buf].neo_tree_source == "git_status"
|
||||||
|
end,
|
||||||
|
pinned = true,
|
||||||
|
open = "Neotree position=right git_status",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title = "Neo-Tree Buffers",
|
||||||
|
ft = "neo-tree",
|
||||||
|
filter = function(buf)
|
||||||
|
return vim.b[buf].neo_tree_source == "buffers"
|
||||||
|
end,
|
||||||
|
pinned = true,
|
||||||
|
open = "Neotree position=top buffers",
|
||||||
|
},
|
||||||
|
"neo-tree",
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
-- increase width
|
||||||
|
["<c-Right>"] = function(win)
|
||||||
|
win:resize("width", 2)
|
||||||
|
end,
|
||||||
|
-- decrease width
|
||||||
|
["<c-Left>"] = function(win)
|
||||||
|
win:resize("width", -2)
|
||||||
|
end,
|
||||||
|
-- increase height
|
||||||
|
["<c-Up>"] = function(win)
|
||||||
|
win:resize("height", 2)
|
||||||
|
end,
|
||||||
|
-- decrease height
|
||||||
|
["<c-Down>"] = function(win)
|
||||||
|
win:resize("height", -2)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return opts
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- use edgy's selection window
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
defaults = {
|
||||||
|
get_selection_window = function()
|
||||||
|
require("edgy").goto_main()
|
||||||
|
return 0
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- prevent neo-tree from opening files in edgy windows
|
||||||
|
{
|
||||||
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.open_files_do_not_replace_types = opts.open_files_do_not_replace_types
|
||||||
|
or { "terminal", "Trouble", "qf", "Outline", "trouble" }
|
||||||
|
table.insert(opts.open_files_do_not_replace_types, "edgy")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Fix bufferline offsets when edgy is loaded
|
||||||
|
{
|
||||||
|
"akinsho/bufferline.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function()
|
||||||
|
local Offset = require("bufferline.offset")
|
||||||
|
if not Offset.edgy then
|
||||||
|
local get = Offset.get
|
||||||
|
Offset.get = function()
|
||||||
|
if package.loaded.edgy then
|
||||||
|
local layout = require("edgy.config").layout
|
||||||
|
local ret = { left = "", left_size = 0, right = "", right_size = 0 }
|
||||||
|
for _, pos in ipairs({ "left", "right" }) do
|
||||||
|
local sb = layout[pos]
|
||||||
|
if sb and #sb.wins > 0 then
|
||||||
|
local title = " Sidebar" .. string.rep(" ", sb.bounds.width - 8)
|
||||||
|
ret[pos] = "%#EdgyTitle#" .. title .. "%*" .. "%#WinSeparator#│%*"
|
||||||
|
ret[pos .. "_size"] = sb.bounds.width
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ret.total_size = ret.left_size + ret.right_size
|
||||||
|
if ret.total_size > 0 then
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return get()
|
||||||
|
end
|
||||||
|
Offset.edgy = true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
return {
|
||||||
|
-- animations
|
||||||
|
{
|
||||||
|
"echasnovski/mini.animate",
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = function()
|
||||||
|
-- don't use animate when scrolling with the mouse
|
||||||
|
local mouse_scrolled = false
|
||||||
|
for _, scroll in ipairs({ "Up", "Down" }) do
|
||||||
|
local key = "<ScrollWheel" .. scroll .. ">"
|
||||||
|
vim.keymap.set({ "", "i" }, key, function()
|
||||||
|
mouse_scrolled = true
|
||||||
|
return key
|
||||||
|
end, { expr = true })
|
||||||
|
end
|
||||||
|
|
||||||
|
local animate = require("mini.animate")
|
||||||
|
return {
|
||||||
|
resize = {
|
||||||
|
timing = animate.gen_timing.linear({ duration = 100, unit = "total" }),
|
||||||
|
},
|
||||||
|
scroll = {
|
||||||
|
timing = animate.gen_timing.linear({ duration = 150, unit = "total" }),
|
||||||
|
subscroll = animate.gen_subscroll.equal({
|
||||||
|
predicate = function(total_scroll)
|
||||||
|
if mouse_scrolled then
|
||||||
|
mouse_scrolled = false
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return total_scroll > 1
|
||||||
|
end,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
-- start screen
|
||||||
|
return {
|
||||||
|
-- disable alpha
|
||||||
|
{ "goolord/alpha-nvim", enabled = false },
|
||||||
|
{ "nvimdev/dashboard-nvim", enabled = false },
|
||||||
|
|
||||||
|
-- enable mini.starter
|
||||||
|
{
|
||||||
|
"echasnovski/mini.starter",
|
||||||
|
version = false, -- wait till new 0.7.0 release to put it back on semver
|
||||||
|
event = "VimEnter",
|
||||||
|
opts = function()
|
||||||
|
local logo = table.concat({
|
||||||
|
" ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z",
|
||||||
|
" ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z ",
|
||||||
|
" ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z ",
|
||||||
|
" ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z ",
|
||||||
|
" ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ ",
|
||||||
|
" ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ",
|
||||||
|
}, "\n")
|
||||||
|
local pad = string.rep(" ", 22)
|
||||||
|
local new_section = function(name, action, section)
|
||||||
|
return { name = name, action = action, section = pad .. section }
|
||||||
|
end
|
||||||
|
|
||||||
|
local starter = require("mini.starter")
|
||||||
|
--stylua: ignore
|
||||||
|
local config = {
|
||||||
|
evaluate_single = true,
|
||||||
|
header = logo,
|
||||||
|
items = {
|
||||||
|
new_section("Find file", "Telescope find_files", "Telescope"),
|
||||||
|
new_section("Recent files", "Telescope oldfiles", "Telescope"),
|
||||||
|
new_section("Grep text", "Telescope live_grep", "Telescope"),
|
||||||
|
new_section("Config", "lua require('lazyvim.util').telescope.config_files()()", "Config"),
|
||||||
|
new_section("Extras", "LazyExtras", "Config"),
|
||||||
|
new_section("Lazy", "Lazy", "Config"),
|
||||||
|
new_section("New file", "ene | startinsert", "Built-in"),
|
||||||
|
new_section("Quit", "qa", "Built-in"),
|
||||||
|
new_section("Session restore", [[lua require("persistence").load()]], "Session"),
|
||||||
|
},
|
||||||
|
content_hooks = {
|
||||||
|
starter.gen_hook.adding_bullet(pad .. "░ ", false),
|
||||||
|
starter.gen_hook.aligning("center", "center"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
end,
|
||||||
|
config = function(_, config)
|
||||||
|
-- close Lazy and re-open when starter is ready
|
||||||
|
if vim.o.filetype == "lazy" then
|
||||||
|
vim.cmd.close()
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "MiniStarterOpened",
|
||||||
|
callback = function()
|
||||||
|
require("lazy").show()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
local starter = require("mini.starter")
|
||||||
|
starter.setup(config)
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "LazyVimStarted",
|
||||||
|
callback = function()
|
||||||
|
local stats = require("lazy").stats()
|
||||||
|
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
|
||||||
|
local pad_footer = string.rep(" ", 8)
|
||||||
|
starter.config.footer = pad_footer .. "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms"
|
||||||
|
pcall(starter.refresh)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
---@type string
|
||||||
|
local xdg_config = vim.env.XDG_CONFIG_HOME or vim.env.HOME .. "/.config"
|
||||||
|
|
||||||
|
---@param path string
|
||||||
|
local function have(path)
|
||||||
|
return vim.loop.fs_stat(xdg_config .. "/" .. path) ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- Add Hyprland Parser
|
||||||
|
{
|
||||||
|
"luckasRanarison/tree-sitter-hypr",
|
||||||
|
enabled = function()
|
||||||
|
return have("hypr")
|
||||||
|
end,
|
||||||
|
event = "BufRead */hypr/*.conf",
|
||||||
|
build = ":TSUpdate hypr",
|
||||||
|
config = function()
|
||||||
|
-- Fix ft detection for hyprland
|
||||||
|
vim.filetype.add({
|
||||||
|
pattern = { [".*/hypr/.*%.conf"] = "hypr" },
|
||||||
|
})
|
||||||
|
require("nvim-treesitter.parsers").get_parser_configs().hypr = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://github.com/luckasRanarison/tree-sitter-hypr",
|
||||||
|
files = { "src/parser.c" },
|
||||||
|
branch = "master",
|
||||||
|
},
|
||||||
|
filetype = "hypr",
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- add some stuff to treesitter
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
local function add(lang)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
table.insert(opts.ensure_installed, lang)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.filetype.add({
|
||||||
|
extension = { rasi = "rasi" },
|
||||||
|
pattern = {
|
||||||
|
[".*/waybar/config"] = "jsonc",
|
||||||
|
[".*/mako/config"] = "dosini",
|
||||||
|
[".*/kitty/*.conf"] = "bash",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
add("git_config")
|
||||||
|
|
||||||
|
if have("fish") then
|
||||||
|
add("fish")
|
||||||
|
end
|
||||||
|
|
||||||
|
if have("rofi") or have("wofi") then
|
||||||
|
add("rasi")
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,387 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@type table<string,true>
|
||||||
|
M.hl = {}
|
||||||
|
|
||||||
|
M.plugin = {
|
||||||
|
"echasnovski/mini.hipatterns",
|
||||||
|
event = "LazyFile",
|
||||||
|
opts = function()
|
||||||
|
local hi = require("mini.hipatterns")
|
||||||
|
return {
|
||||||
|
-- custom LazyVim option to enable the tailwind integration
|
||||||
|
tailwind = {
|
||||||
|
enabled = true,
|
||||||
|
ft = { "typescriptreact", "javascriptreact", "css", "javascript", "typescript", "html" },
|
||||||
|
-- full: the whole css class will be highlighted
|
||||||
|
-- compact: only the color will be highlighted
|
||||||
|
style = "full",
|
||||||
|
},
|
||||||
|
highlighters = {
|
||||||
|
hex_color = hi.gen_highlighter.hex_color({ priority = 2000 }),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
config = function(_, opts)
|
||||||
|
-- backward compatibility
|
||||||
|
if opts.tailwind == true then
|
||||||
|
opts.tailwind = {
|
||||||
|
enabled = true,
|
||||||
|
ft = { "typescriptreact", "javascriptreact", "css", "javascript", "typescript", "html" },
|
||||||
|
style = "full",
|
||||||
|
}
|
||||||
|
end
|
||||||
|
if type(opts.tailwind) == "table" and opts.tailwind.enabled then
|
||||||
|
-- reset hl groups when colorscheme changes
|
||||||
|
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||||
|
callback = function()
|
||||||
|
M.hl = {}
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
opts.highlighters.tailwind = {
|
||||||
|
pattern = function()
|
||||||
|
if not vim.tbl_contains(opts.tailwind.ft, vim.bo.filetype) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if opts.tailwind.style == "full" then
|
||||||
|
return "%f[%w:-]()[%w:-]+%-[a-z%-]+%-%d+()%f[^%w:-]"
|
||||||
|
elseif opts.tailwind.style == "compact" then
|
||||||
|
return "%f[%w:-][%w:-]+%-()[a-z%-]+%-%d+()%f[^%w:-]"
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
group = function(_, _, m)
|
||||||
|
---@type string
|
||||||
|
local match = m.full_match
|
||||||
|
---@type string, number
|
||||||
|
local color, shade = match:match("[%w-]+%-([a-z%-]+)%-(%d+)")
|
||||||
|
shade = tonumber(shade)
|
||||||
|
local bg = vim.tbl_get(M.colors, color, shade)
|
||||||
|
if bg then
|
||||||
|
local hl = "MiniHipatternsTailwind" .. color .. shade
|
||||||
|
if not M.hl[hl] then
|
||||||
|
M.hl[hl] = true
|
||||||
|
local bg_shade = shade == 500 and 950 or shade < 500 and 900 or 100
|
||||||
|
local fg = vim.tbl_get(M.colors, color, bg_shade)
|
||||||
|
vim.api.nvim_set_hl(0, hl, { bg = "#" .. bg, fg = "#" .. fg })
|
||||||
|
end
|
||||||
|
return hl
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
extmark_opts = { priority = 2000 },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
require("mini.hipatterns").setup(opts)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
M.colors = {
|
||||||
|
slate = {
|
||||||
|
[50] = "f8fafc",
|
||||||
|
[100] = "f1f5f9",
|
||||||
|
[200] = "e2e8f0",
|
||||||
|
[300] = "cbd5e1",
|
||||||
|
[400] = "94a3b8",
|
||||||
|
[500] = "64748b",
|
||||||
|
[600] = "475569",
|
||||||
|
[700] = "334155",
|
||||||
|
[800] = "1e293b",
|
||||||
|
[900] = "0f172a",
|
||||||
|
[950] = "020617",
|
||||||
|
},
|
||||||
|
|
||||||
|
gray = {
|
||||||
|
[50] = "f9fafb",
|
||||||
|
[100] = "f3f4f6",
|
||||||
|
[200] = "e5e7eb",
|
||||||
|
[300] = "d1d5db",
|
||||||
|
[400] = "9ca3af",
|
||||||
|
[500] = "6b7280",
|
||||||
|
[600] = "4b5563",
|
||||||
|
[700] = "374151",
|
||||||
|
[800] = "1f2937",
|
||||||
|
[900] = "111827",
|
||||||
|
[950] = "030712",
|
||||||
|
},
|
||||||
|
|
||||||
|
zinc = {
|
||||||
|
[50] = "fafafa",
|
||||||
|
[100] = "f4f4f5",
|
||||||
|
[200] = "e4e4e7",
|
||||||
|
[300] = "d4d4d8",
|
||||||
|
[400] = "a1a1aa",
|
||||||
|
[500] = "71717a",
|
||||||
|
[600] = "52525b",
|
||||||
|
[700] = "3f3f46",
|
||||||
|
[800] = "27272a",
|
||||||
|
[900] = "18181b",
|
||||||
|
[950] = "09090B",
|
||||||
|
},
|
||||||
|
|
||||||
|
neutral = {
|
||||||
|
[50] = "fafafa",
|
||||||
|
[100] = "f5f5f5",
|
||||||
|
[200] = "e5e5e5",
|
||||||
|
[300] = "d4d4d4",
|
||||||
|
[400] = "a3a3a3",
|
||||||
|
[500] = "737373",
|
||||||
|
[600] = "525252",
|
||||||
|
[700] = "404040",
|
||||||
|
[800] = "262626",
|
||||||
|
[900] = "171717",
|
||||||
|
[950] = "0a0a0a",
|
||||||
|
},
|
||||||
|
|
||||||
|
stone = {
|
||||||
|
[50] = "fafaf9",
|
||||||
|
[100] = "f5f5f4",
|
||||||
|
[200] = "e7e5e4",
|
||||||
|
[300] = "d6d3d1",
|
||||||
|
[400] = "a8a29e",
|
||||||
|
[500] = "78716c",
|
||||||
|
[600] = "57534e",
|
||||||
|
[700] = "44403c",
|
||||||
|
[800] = "292524",
|
||||||
|
[900] = "1c1917",
|
||||||
|
[950] = "0a0a0a",
|
||||||
|
},
|
||||||
|
|
||||||
|
red = {
|
||||||
|
[50] = "fef2f2",
|
||||||
|
[100] = "fee2e2",
|
||||||
|
[200] = "fecaca",
|
||||||
|
[300] = "fca5a5",
|
||||||
|
[400] = "f87171",
|
||||||
|
[500] = "ef4444",
|
||||||
|
[600] = "dc2626",
|
||||||
|
[700] = "b91c1c",
|
||||||
|
[800] = "991b1b",
|
||||||
|
[900] = "7f1d1d",
|
||||||
|
[950] = "450a0a",
|
||||||
|
},
|
||||||
|
|
||||||
|
orange = {
|
||||||
|
[50] = "fff7ed",
|
||||||
|
[100] = "ffedd5",
|
||||||
|
[200] = "fed7aa",
|
||||||
|
[300] = "fdba74",
|
||||||
|
[400] = "fb923c",
|
||||||
|
[500] = "f97316",
|
||||||
|
[600] = "ea580c",
|
||||||
|
[700] = "c2410c",
|
||||||
|
[800] = "9a3412",
|
||||||
|
[900] = "7c2d12",
|
||||||
|
[950] = "431407",
|
||||||
|
},
|
||||||
|
|
||||||
|
amber = {
|
||||||
|
[50] = "fffbeb",
|
||||||
|
[100] = "fef3c7",
|
||||||
|
[200] = "fde68a",
|
||||||
|
[300] = "fcd34d",
|
||||||
|
[400] = "fbbf24",
|
||||||
|
[500] = "f59e0b",
|
||||||
|
[600] = "d97706",
|
||||||
|
[700] = "b45309",
|
||||||
|
[800] = "92400e",
|
||||||
|
[900] = "78350f",
|
||||||
|
[950] = "451a03",
|
||||||
|
},
|
||||||
|
|
||||||
|
yellow = {
|
||||||
|
[50] = "fefce8",
|
||||||
|
[100] = "fef9c3",
|
||||||
|
[200] = "fef08a",
|
||||||
|
[300] = "fde047",
|
||||||
|
[400] = "facc15",
|
||||||
|
[500] = "eab308",
|
||||||
|
[600] = "ca8a04",
|
||||||
|
[700] = "a16207",
|
||||||
|
[800] = "854d0e",
|
||||||
|
[900] = "713f12",
|
||||||
|
[950] = "422006",
|
||||||
|
},
|
||||||
|
|
||||||
|
lime = {
|
||||||
|
[50] = "f7fee7",
|
||||||
|
[100] = "ecfccb",
|
||||||
|
[200] = "d9f99d",
|
||||||
|
[300] = "bef264",
|
||||||
|
[400] = "a3e635",
|
||||||
|
[500] = "84cc16",
|
||||||
|
[600] = "65a30d",
|
||||||
|
[700] = "4d7c0f",
|
||||||
|
[800] = "3f6212",
|
||||||
|
[900] = "365314",
|
||||||
|
[950] = "1a2e05",
|
||||||
|
},
|
||||||
|
|
||||||
|
green = {
|
||||||
|
[50] = "f0fdf4",
|
||||||
|
[100] = "dcfce7",
|
||||||
|
[200] = "bbf7d0",
|
||||||
|
[300] = "86efac",
|
||||||
|
[400] = "4ade80",
|
||||||
|
[500] = "22c55e",
|
||||||
|
[600] = "16a34a",
|
||||||
|
[700] = "15803d",
|
||||||
|
[800] = "166534",
|
||||||
|
[900] = "14532d",
|
||||||
|
[950] = "052e16",
|
||||||
|
},
|
||||||
|
|
||||||
|
emerald = {
|
||||||
|
[50] = "ecfdf5",
|
||||||
|
[100] = "d1fae5",
|
||||||
|
[200] = "a7f3d0",
|
||||||
|
[300] = "6ee7b7",
|
||||||
|
[400] = "34d399",
|
||||||
|
[500] = "10b981",
|
||||||
|
[600] = "059669",
|
||||||
|
[700] = "047857",
|
||||||
|
[800] = "065f46",
|
||||||
|
[900] = "064e3b",
|
||||||
|
[950] = "022c22",
|
||||||
|
},
|
||||||
|
|
||||||
|
teal = {
|
||||||
|
[50] = "f0fdfa",
|
||||||
|
[100] = "ccfbf1",
|
||||||
|
[200] = "99f6e4",
|
||||||
|
[300] = "5eead4",
|
||||||
|
[400] = "2dd4bf",
|
||||||
|
[500] = "14b8a6",
|
||||||
|
[600] = "0d9488",
|
||||||
|
[700] = "0f766e",
|
||||||
|
[800] = "115e59",
|
||||||
|
[900] = "134e4a",
|
||||||
|
[950] = "042f2e",
|
||||||
|
},
|
||||||
|
|
||||||
|
cyan = {
|
||||||
|
[50] = "ecfeff",
|
||||||
|
[100] = "cffafe",
|
||||||
|
[200] = "a5f3fc",
|
||||||
|
[300] = "67e8f9",
|
||||||
|
[400] = "22d3ee",
|
||||||
|
[500] = "06b6d4",
|
||||||
|
[600] = "0891b2",
|
||||||
|
[700] = "0e7490",
|
||||||
|
[800] = "155e75",
|
||||||
|
[900] = "164e63",
|
||||||
|
[950] = "083344",
|
||||||
|
},
|
||||||
|
|
||||||
|
sky = {
|
||||||
|
[50] = "f0f9ff",
|
||||||
|
[100] = "e0f2fe",
|
||||||
|
[200] = "bae6fd",
|
||||||
|
[300] = "7dd3fc",
|
||||||
|
[400] = "38bdf8",
|
||||||
|
[500] = "0ea5e9",
|
||||||
|
[600] = "0284c7",
|
||||||
|
[700] = "0369a1",
|
||||||
|
[800] = "075985",
|
||||||
|
[900] = "0c4a6e",
|
||||||
|
[950] = "082f49",
|
||||||
|
},
|
||||||
|
|
||||||
|
blue = {
|
||||||
|
[50] = "eff6ff",
|
||||||
|
[100] = "dbeafe",
|
||||||
|
[200] = "bfdbfe",
|
||||||
|
[300] = "93c5fd",
|
||||||
|
[400] = "60a5fa",
|
||||||
|
[500] = "3b82f6",
|
||||||
|
[600] = "2563eb",
|
||||||
|
[700] = "1d4ed8",
|
||||||
|
[800] = "1e40af",
|
||||||
|
[900] = "1e3a8a",
|
||||||
|
[950] = "172554",
|
||||||
|
},
|
||||||
|
|
||||||
|
indigo = {
|
||||||
|
[50] = "eef2ff",
|
||||||
|
[100] = "e0e7ff",
|
||||||
|
[200] = "c7d2fe",
|
||||||
|
[300] = "a5b4fc",
|
||||||
|
[400] = "818cf8",
|
||||||
|
[500] = "6366f1",
|
||||||
|
[600] = "4f46e5",
|
||||||
|
[700] = "4338ca",
|
||||||
|
[800] = "3730a3",
|
||||||
|
[900] = "312e81",
|
||||||
|
[950] = "1e1b4b",
|
||||||
|
},
|
||||||
|
|
||||||
|
violet = {
|
||||||
|
[50] = "f5f3ff",
|
||||||
|
[100] = "ede9fe",
|
||||||
|
[200] = "ddd6fe",
|
||||||
|
[300] = "c4b5fd",
|
||||||
|
[400] = "a78bfa",
|
||||||
|
[500] = "8b5cf6",
|
||||||
|
[600] = "7c3aed",
|
||||||
|
[700] = "6d28d9",
|
||||||
|
[800] = "5b21b6",
|
||||||
|
[900] = "4c1d95",
|
||||||
|
[950] = "2e1065",
|
||||||
|
},
|
||||||
|
|
||||||
|
purple = {
|
||||||
|
[50] = "faf5ff",
|
||||||
|
[100] = "f3e8ff",
|
||||||
|
[200] = "e9d5ff",
|
||||||
|
[300] = "d8b4fe",
|
||||||
|
[400] = "c084fc",
|
||||||
|
[500] = "a855f7",
|
||||||
|
[600] = "9333ea",
|
||||||
|
[700] = "7e22ce",
|
||||||
|
[800] = "6b21a8",
|
||||||
|
[900] = "581c87",
|
||||||
|
[950] = "3b0764",
|
||||||
|
},
|
||||||
|
|
||||||
|
fuchsia = {
|
||||||
|
[50] = "fdf4ff",
|
||||||
|
[100] = "fae8ff",
|
||||||
|
[200] = "f5d0fe",
|
||||||
|
[300] = "f0abfc",
|
||||||
|
[400] = "e879f9",
|
||||||
|
[500] = "d946ef",
|
||||||
|
[600] = "c026d3",
|
||||||
|
[700] = "a21caf",
|
||||||
|
[800] = "86198f",
|
||||||
|
[900] = "701a75",
|
||||||
|
[950] = "4a044e",
|
||||||
|
},
|
||||||
|
|
||||||
|
pink = {
|
||||||
|
[50] = "fdf2f8",
|
||||||
|
[100] = "fce7f3",
|
||||||
|
[200] = "fbcfe8",
|
||||||
|
[300] = "f9a8d4",
|
||||||
|
[400] = "f472b6",
|
||||||
|
[500] = "ec4899",
|
||||||
|
[600] = "db2777",
|
||||||
|
[700] = "be185d",
|
||||||
|
[800] = "9d174d",
|
||||||
|
[900] = "831843",
|
||||||
|
[950] = "500724",
|
||||||
|
},
|
||||||
|
|
||||||
|
rose = {
|
||||||
|
[50] = "fff1f2",
|
||||||
|
[100] = "ffe4e6",
|
||||||
|
[200] = "fecdd3",
|
||||||
|
[300] = "fda4af",
|
||||||
|
[400] = "fb7185",
|
||||||
|
[500] = "f43f5e",
|
||||||
|
[600] = "e11d48",
|
||||||
|
[700] = "be123c",
|
||||||
|
[800] = "9f1239",
|
||||||
|
[900] = "881337",
|
||||||
|
[950] = "4c0519",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return M.plugin
|
|
@ -0,0 +1,66 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"telescope.nvim",
|
||||||
|
dependencies = {
|
||||||
|
-- project management
|
||||||
|
{
|
||||||
|
"ahmedkhalf/project.nvim",
|
||||||
|
opts = {
|
||||||
|
manual_mode = true,
|
||||||
|
},
|
||||||
|
event = "VeryLazy",
|
||||||
|
config = function(_, opts)
|
||||||
|
require("project_nvim").setup(opts)
|
||||||
|
require("lazyvim.util").on_load("telescope.nvim", function()
|
||||||
|
require("telescope").load_extension("projects")
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
keys = {
|
||||||
|
{ "<leader>fp", "<Cmd>Telescope projects<CR>", desc = "Projects" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"goolord/alpha-nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, dashboard)
|
||||||
|
local button = dashboard.button("p", " " .. " Projects", ":Telescope projects <CR>")
|
||||||
|
button.opts.hl = "AlphaButtons"
|
||||||
|
button.opts.hl_shortcut = "AlphaShortcut"
|
||||||
|
table.insert(dashboard.section.buttons.val, 4, button)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"echasnovski/mini.starter",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
local items = {
|
||||||
|
{
|
||||||
|
name = "Projects",
|
||||||
|
action = "Telescope projects",
|
||||||
|
section = string.rep(" ", 22) .. "Telescope",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
vim.list_extend(opts.items, items)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvimdev/dashboard-nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
local projects = {
|
||||||
|
action = "Telescope projects",
|
||||||
|
desc = " Projects",
|
||||||
|
icon = " ",
|
||||||
|
key = "p",
|
||||||
|
}
|
||||||
|
|
||||||
|
projects.desc = projects.desc .. string.rep(" ", 43 - #projects.desc)
|
||||||
|
projects.key_format = " %s"
|
||||||
|
|
||||||
|
table.insert(opts.config.center, 3, projects)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
if not vim.g.vscode then
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local enabled = {
|
||||||
|
"flit.nvim",
|
||||||
|
"lazy.nvim",
|
||||||
|
"leap.nvim",
|
||||||
|
"mini.ai",
|
||||||
|
"mini.comment",
|
||||||
|
"mini.pairs",
|
||||||
|
"mini.surround",
|
||||||
|
"nvim-treesitter",
|
||||||
|
"nvim-treesitter-textobjects",
|
||||||
|
"nvim-ts-context-commentstring",
|
||||||
|
"vim-repeat",
|
||||||
|
"LazyVim",
|
||||||
|
}
|
||||||
|
|
||||||
|
local Config = require("lazy.core.config")
|
||||||
|
Config.options.checker.enabled = false
|
||||||
|
Config.options.change_detection.enabled = false
|
||||||
|
Config.options.defaults.cond = function(plugin)
|
||||||
|
return vim.tbl_contains(enabled, plugin.name) or plugin.vscode
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add some vscode specific keymaps
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "LazyVimKeymaps",
|
||||||
|
callback = function()
|
||||||
|
vim.keymap.set("n", "<leader><space>", "<cmd>Find<cr>")
|
||||||
|
vim.keymap.set("n", "<leader>/", [[<cmd>call VSCodeNotify('workbench.action.findInFiles')<cr>]])
|
||||||
|
vim.keymap.set("n", "<leader>ss", [[<cmd>call VSCodeNotify('workbench.action.gotoSymbol')<cr>]])
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"LazyVim/LazyVim",
|
||||||
|
config = function(_, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
-- disable the colorscheme
|
||||||
|
opts.colorscheme = function() end
|
||||||
|
require("lazyvim").setup(opts)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = { highlight = { enable = false } },
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,116 @@
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@param opts ConformOpts
|
||||||
|
function M.setup(_, opts)
|
||||||
|
for name, formatter in pairs(opts.formatters or {}) do
|
||||||
|
if type(formatter) == "table" then
|
||||||
|
---@diagnostic disable-next-line: undefined-field
|
||||||
|
if formatter.extra_args then
|
||||||
|
---@diagnostic disable-next-line: undefined-field
|
||||||
|
formatter.prepend_args = formatter.extra_args
|
||||||
|
Util.deprecate(("opts.formatters.%s.extra_args"):format(name), ("opts.formatters.%s.prepend_args"):format(name))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, key in ipairs({ "format_on_save", "format_after_save" }) do
|
||||||
|
if opts[key] then
|
||||||
|
Util.warn(
|
||||||
|
("Don't set `opts.%s` for `conform.nvim`.\n**LazyVim** will use the conform formatter automatically"):format(
|
||||||
|
key
|
||||||
|
)
|
||||||
|
)
|
||||||
|
---@diagnostic disable-next-line: no-unknown
|
||||||
|
opts[key] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
require("conform").setup(opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
dependencies = { "mason.nvim" },
|
||||||
|
lazy = true,
|
||||||
|
cmd = "ConformInfo",
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>cF",
|
||||||
|
function()
|
||||||
|
require("conform").format({ formatters = { "injected" } })
|
||||||
|
end,
|
||||||
|
mode = { "n", "v" },
|
||||||
|
desc = "Format Injected Langs",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
init = function()
|
||||||
|
-- Install the conform formatter on VeryLazy
|
||||||
|
require("lazyvim.util").on_very_lazy(function()
|
||||||
|
require("lazyvim.util").format.register({
|
||||||
|
name = "conform.nvim",
|
||||||
|
priority = 100,
|
||||||
|
primary = true,
|
||||||
|
format = function(buf)
|
||||||
|
local plugin = require("lazy.core.config").plugins["conform.nvim"]
|
||||||
|
local Plugin = require("lazy.core.plugin")
|
||||||
|
local opts = Plugin.values(plugin, "opts", false)
|
||||||
|
require("conform").format(Util.merge(opts.format, { bufnr = buf }))
|
||||||
|
end,
|
||||||
|
sources = function(buf)
|
||||||
|
local ret = require("conform").list_formatters(buf)
|
||||||
|
---@param v conform.FormatterInfo
|
||||||
|
return vim.tbl_map(function(v)
|
||||||
|
return v.name
|
||||||
|
end, ret)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
opts = function()
|
||||||
|
local plugin = require("lazy.core.config").plugins["conform.nvim"]
|
||||||
|
if plugin.config ~= M.setup then
|
||||||
|
Util.error({
|
||||||
|
"Don't set `plugin.config` for `conform.nvim`.\n",
|
||||||
|
"This will break **LazyVim** formatting.\n",
|
||||||
|
"Please refer to the docs at https://www.lazyvim.org/plugins/formatting",
|
||||||
|
}, { title = "LazyVim" })
|
||||||
|
end
|
||||||
|
---@class ConformOpts
|
||||||
|
local opts = {
|
||||||
|
-- LazyVim will use these options when formatting with the conform.nvim formatter
|
||||||
|
format = {
|
||||||
|
timeout_ms = 3000,
|
||||||
|
async = false, -- not recommended to change
|
||||||
|
quiet = false, -- not recommended to change
|
||||||
|
},
|
||||||
|
---@type table<string, conform.FormatterUnit[]>
|
||||||
|
formatters_by_ft = {
|
||||||
|
lua = { "stylua" },
|
||||||
|
fish = { "fish_indent" },
|
||||||
|
sh = { "shfmt" },
|
||||||
|
},
|
||||||
|
-- The options you set here will be merged with the builtin formatters.
|
||||||
|
-- You can also define any custom formatters here.
|
||||||
|
---@type table<string, conform.FormatterConfigOverride|fun(bufnr: integer): nil|conform.FormatterConfigOverride>
|
||||||
|
formatters = {
|
||||||
|
injected = { options = { ignore_errors = true } },
|
||||||
|
-- # Example of using dprint only when a dprint.json file is present
|
||||||
|
-- dprint = {
|
||||||
|
-- condition = function(ctx)
|
||||||
|
-- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1]
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
|
--
|
||||||
|
-- # Example of using shfmt with extra args
|
||||||
|
-- shfmt = {
|
||||||
|
-- prepend_args = { "-i", "2", "-ci" },
|
||||||
|
-- },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return opts
|
||||||
|
end,
|
||||||
|
config = M.setup,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
if vim.fn.has("nvim-0.9.0") == 0 then
|
||||||
|
vim.api.nvim_echo({
|
||||||
|
{ "LazyVim requires Neovim >= 0.9.0\n", "ErrorMsg" },
|
||||||
|
{ "Press any key to exit", "MoreMsg" },
|
||||||
|
}, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
vim.cmd([[quit]])
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
|
||||||
|
require("lazyvim.config").init()
|
||||||
|
|
||||||
|
return {
|
||||||
|
{ "folke/lazy.nvim", version = "*" },
|
||||||
|
{ "LazyVim/LazyVim", priority = 10000, lazy = false, config = true, cond = true, version = "*" },
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-lint",
|
||||||
|
event = "LazyFile",
|
||||||
|
opts = {
|
||||||
|
-- Event to trigger linters
|
||||||
|
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
|
||||||
|
linters_by_ft = {
|
||||||
|
fish = { "fish" },
|
||||||
|
-- Use the "*" filetype to run linters on all filetypes.
|
||||||
|
-- ['*'] = { 'global linter' },
|
||||||
|
-- Use the "_" filetype to run linters on filetypes that don't have other linters configured.
|
||||||
|
-- ['_'] = { 'fallback linter' },
|
||||||
|
},
|
||||||
|
-- LazyVim extension to easily override linter options
|
||||||
|
-- or add custom linters.
|
||||||
|
---@type table<string,table>
|
||||||
|
linters = {
|
||||||
|
-- -- Example of using selene only when a selene.toml file is present
|
||||||
|
-- selene = {
|
||||||
|
-- -- `condition` is another LazyVim extension that allows you to
|
||||||
|
-- -- dynamically enable/disable linters based on the context.
|
||||||
|
-- condition = function(ctx)
|
||||||
|
-- return vim.fs.find({ "selene.toml" }, { path = ctx.filename, upward = true })[1]
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local lint = require("lint")
|
||||||
|
for name, linter in pairs(opts.linters) do
|
||||||
|
if type(linter) == "table" and type(lint.linters[name]) == "table" then
|
||||||
|
lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name], linter)
|
||||||
|
else
|
||||||
|
lint.linters[name] = linter
|
||||||
|
end
|
||||||
|
end
|
||||||
|
lint.linters_by_ft = opts.linters_by_ft
|
||||||
|
|
||||||
|
function M.debounce(ms, fn)
|
||||||
|
local timer = vim.loop.new_timer()
|
||||||
|
return function(...)
|
||||||
|
local argv = { ... }
|
||||||
|
timer:start(ms, 0, function()
|
||||||
|
timer:stop()
|
||||||
|
vim.schedule_wrap(fn)(unpack(argv))
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.lint()
|
||||||
|
-- Use nvim-lint's logic first:
|
||||||
|
-- * checks if linters exist for the full filetype first
|
||||||
|
-- * otherwise will split filetype by "." and add all those linters
|
||||||
|
-- * this differs from conform.nvim which only uses the first filetype that has a formatter
|
||||||
|
local names = lint._resolve_linter_by_ft(vim.bo.filetype)
|
||||||
|
|
||||||
|
-- Add fallback linters.
|
||||||
|
if #names == 0 then
|
||||||
|
vim.list_extend(names, lint.linters_by_ft["_"] or {})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add global linters.
|
||||||
|
vim.list_extend(names, lint.linters_by_ft["*"] or {})
|
||||||
|
|
||||||
|
-- Filter out linters that don't exist or don't match the condition.
|
||||||
|
local ctx = { filename = vim.api.nvim_buf_get_name(0) }
|
||||||
|
ctx.dirname = vim.fn.fnamemodify(ctx.filename, ":h")
|
||||||
|
names = vim.tbl_filter(function(name)
|
||||||
|
local linter = lint.linters[name]
|
||||||
|
if not linter then
|
||||||
|
Util.warn("Linter not found: " .. name, { title = "nvim-lint" })
|
||||||
|
end
|
||||||
|
return linter and not (type(linter) == "table" and linter.condition and not linter.condition(ctx))
|
||||||
|
end, names)
|
||||||
|
|
||||||
|
-- Run linters.
|
||||||
|
if #names > 0 then
|
||||||
|
lint.try_lint(names)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd(opts.events, {
|
||||||
|
group = vim.api.nvim_create_augroup("nvim-lint", { clear = true }),
|
||||||
|
callback = M.debounce(100, M.lint),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,243 @@
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
return {
|
||||||
|
-- lspconfig
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
event = "LazyFile",
|
||||||
|
dependencies = {
|
||||||
|
{ "folke/neoconf.nvim", cmd = "Neoconf", config = false, dependencies = { "nvim-lspconfig" } },
|
||||||
|
{ "folke/neodev.nvim", opts = {} },
|
||||||
|
"mason.nvim",
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
},
|
||||||
|
---@class PluginLspOpts
|
||||||
|
opts = {
|
||||||
|
-- options for vim.diagnostic.config()
|
||||||
|
diagnostics = {
|
||||||
|
underline = true,
|
||||||
|
update_in_insert = false,
|
||||||
|
virtual_text = {
|
||||||
|
spacing = 4,
|
||||||
|
source = "if_many",
|
||||||
|
prefix = "●",
|
||||||
|
-- this will set set the prefix to a function that returns the diagnostics icon based on the severity
|
||||||
|
-- this only works on a recent 0.10.0 build. Will be set to "●" when not supported
|
||||||
|
-- prefix = "icons",
|
||||||
|
},
|
||||||
|
severity_sort = true,
|
||||||
|
},
|
||||||
|
-- Enable this to enable the builtin LSP inlay hints on Neovim >= 0.10.0
|
||||||
|
-- Be aware that you also will need to properly configure your LSP server to
|
||||||
|
-- provide the inlay hints.
|
||||||
|
inlay_hints = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
-- add any global capabilities here
|
||||||
|
capabilities = {},
|
||||||
|
-- options for vim.lsp.buf.format
|
||||||
|
-- `bufnr` and `filter` is handled by the LazyVim formatter,
|
||||||
|
-- but can be also overridden when specified
|
||||||
|
format = {
|
||||||
|
formatting_options = nil,
|
||||||
|
timeout_ms = nil,
|
||||||
|
},
|
||||||
|
-- LSP Server Settings
|
||||||
|
---@type lspconfig.options
|
||||||
|
servers = {
|
||||||
|
lua_ls = {
|
||||||
|
-- mason = false, -- set to false if you don't want this server to be installed with mason
|
||||||
|
-- Use this to add any additional keymaps
|
||||||
|
-- for specific lsp servers
|
||||||
|
---@type LazyKeysSpec[]
|
||||||
|
-- keys = {},
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
workspace = {
|
||||||
|
checkThirdParty = false,
|
||||||
|
},
|
||||||
|
completion = {
|
||||||
|
callSnippet = "Replace",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- you can do any additional lsp server setup here
|
||||||
|
-- return true if you don't want this server to be setup with lspconfig
|
||||||
|
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
||||||
|
setup = {
|
||||||
|
-- example to setup with typescript.nvim
|
||||||
|
-- tsserver = function(_, opts)
|
||||||
|
-- require("typescript").setup({ server = opts })
|
||||||
|
-- return true
|
||||||
|
-- end,
|
||||||
|
-- Specify * to use this function as a fallback for any server
|
||||||
|
-- ["*"] = function(server, opts) end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
---@param opts PluginLspOpts
|
||||||
|
config = function(_, opts)
|
||||||
|
if Util.has("neoconf.nvim") then
|
||||||
|
local plugin = require("lazy.core.config").spec.plugins["neoconf.nvim"]
|
||||||
|
require("neoconf").setup(require("lazy.core.plugin").values(plugin, "opts", false))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- setup autoformat
|
||||||
|
Util.format.register(Util.lsp.formatter())
|
||||||
|
|
||||||
|
-- deprectaed options
|
||||||
|
if opts.autoformat ~= nil then
|
||||||
|
vim.g.autoformat = opts.autoformat
|
||||||
|
Util.deprecate("nvim-lspconfig.opts.autoformat", "vim.g.autoformat")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- setup keymaps
|
||||||
|
Util.lsp.on_attach(function(client, buffer)
|
||||||
|
require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer)
|
||||||
|
end)
|
||||||
|
|
||||||
|
local register_capability = vim.lsp.handlers["client/registerCapability"]
|
||||||
|
|
||||||
|
vim.lsp.handlers["client/registerCapability"] = function(err, res, ctx)
|
||||||
|
local ret = register_capability(err, res, ctx)
|
||||||
|
local client_id = ctx.client_id
|
||||||
|
---@type lsp.Client
|
||||||
|
local client = vim.lsp.get_client_by_id(client_id)
|
||||||
|
local buffer = vim.api.nvim_get_current_buf()
|
||||||
|
require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer)
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
-- diagnostics
|
||||||
|
for name, icon in pairs(require("lazyvim.config").icons.diagnostics) do
|
||||||
|
name = "DiagnosticSign" .. name
|
||||||
|
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
|
||||||
|
end
|
||||||
|
|
||||||
|
if opts.inlay_hints.enabled then
|
||||||
|
Util.lsp.on_attach(function(client, buffer)
|
||||||
|
if client.supports_method("textDocument/inlayHint") then
|
||||||
|
Util.toggle.inlay_hints(buffer, true)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then
|
||||||
|
opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and "●"
|
||||||
|
or function(diagnostic)
|
||||||
|
local icons = require("lazyvim.config").icons.diagnostics
|
||||||
|
for d, icon in pairs(icons) do
|
||||||
|
if diagnostic.severity == vim.diagnostic.severity[d:upper()] then
|
||||||
|
return icon
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.diagnostic.config(vim.deepcopy(opts.diagnostics))
|
||||||
|
|
||||||
|
local servers = opts.servers
|
||||||
|
local has_cmp, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||||
|
local capabilities = vim.tbl_deep_extend(
|
||||||
|
"force",
|
||||||
|
{},
|
||||||
|
vim.lsp.protocol.make_client_capabilities(),
|
||||||
|
has_cmp and cmp_nvim_lsp.default_capabilities() or {},
|
||||||
|
opts.capabilities or {}
|
||||||
|
)
|
||||||
|
|
||||||
|
local function setup(server)
|
||||||
|
local server_opts = vim.tbl_deep_extend("force", {
|
||||||
|
capabilities = vim.deepcopy(capabilities),
|
||||||
|
}, servers[server] or {})
|
||||||
|
|
||||||
|
if opts.setup[server] then
|
||||||
|
if opts.setup[server](server, server_opts) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
elseif opts.setup["*"] then
|
||||||
|
if opts.setup["*"](server, server_opts) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
require("lspconfig")[server].setup(server_opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- get all the servers that are available through mason-lspconfig
|
||||||
|
local have_mason, mlsp = pcall(require, "mason-lspconfig")
|
||||||
|
local all_mslp_servers = {}
|
||||||
|
if have_mason then
|
||||||
|
all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings.server").lspconfig_to_package)
|
||||||
|
end
|
||||||
|
|
||||||
|
local ensure_installed = {} ---@type string[]
|
||||||
|
for server, server_opts in pairs(servers) do
|
||||||
|
if server_opts then
|
||||||
|
server_opts = server_opts == true and {} or server_opts
|
||||||
|
-- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig
|
||||||
|
if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then
|
||||||
|
setup(server)
|
||||||
|
else
|
||||||
|
ensure_installed[#ensure_installed + 1] = server
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if have_mason then
|
||||||
|
mlsp.setup({ ensure_installed = ensure_installed, handlers = { setup } })
|
||||||
|
end
|
||||||
|
|
||||||
|
if Util.lsp.get_config("denols") and Util.lsp.get_config("tsserver") then
|
||||||
|
local is_deno = require("lspconfig.util").root_pattern("deno.json", "deno.jsonc")
|
||||||
|
Util.lsp.disable("tsserver", is_deno)
|
||||||
|
Util.lsp.disable("denols", function(root_dir)
|
||||||
|
return not is_deno(root_dir)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- cmdline tools and lsp servers
|
||||||
|
{
|
||||||
|
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
cmd = "Mason",
|
||||||
|
keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
|
||||||
|
build = ":MasonUpdate",
|
||||||
|
opts = {
|
||||||
|
ensure_installed = {
|
||||||
|
"stylua",
|
||||||
|
"shfmt",
|
||||||
|
-- "flake8",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
---@param opts MasonSettings | {ensure_installed: string[]}
|
||||||
|
config = function(_, opts)
|
||||||
|
require("mason").setup(opts)
|
||||||
|
local mr = require("mason-registry")
|
||||||
|
mr:on("package:install:success", function()
|
||||||
|
vim.defer_fn(function()
|
||||||
|
-- trigger FileType event to possibly load this newly installed LSP server
|
||||||
|
require("lazy.core.handler.event").trigger({
|
||||||
|
event = "FileType",
|
||||||
|
buf = vim.api.nvim_get_current_buf(),
|
||||||
|
})
|
||||||
|
end, 100)
|
||||||
|
end)
|
||||||
|
local function ensure_installed()
|
||||||
|
for _, tool in ipairs(opts.ensure_installed) do
|
||||||
|
local p = mr.get_package(tool)
|
||||||
|
if not p:is_installed() then
|
||||||
|
p:install()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if mr.refresh then
|
||||||
|
mr.refresh(ensure_installed)
|
||||||
|
else
|
||||||
|
ensure_installed()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,102 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@type LazyKeysLspSpec[]|nil
|
||||||
|
M._keys = nil
|
||||||
|
|
||||||
|
---@alias LazyKeysLspSpec LazyKeysSpec|{has?:string}
|
||||||
|
---@alias LazyKeysLsp LazyKeys|{has?:string}
|
||||||
|
|
||||||
|
---@return LazyKeysLspSpec[]
|
||||||
|
function M.get()
|
||||||
|
if M._keys then
|
||||||
|
return M._keys
|
||||||
|
end
|
||||||
|
-- stylua: ignore
|
||||||
|
M._keys = {
|
||||||
|
{ "<leader>cl", "<cmd>LspInfo<cr>", desc = "Lsp Info" },
|
||||||
|
{ "gd", function() require("telescope.builtin").lsp_definitions({ reuse_win = true }) end, desc = "Goto Definition", has = "definition" },
|
||||||
|
{ "gr", "<cmd>Telescope lsp_references<cr>", desc = "References" },
|
||||||
|
{ "gD", vim.lsp.buf.declaration, desc = "Goto Declaration" },
|
||||||
|
{ "gI", function() require("telescope.builtin").lsp_implementations({ reuse_win = true }) end, desc = "Goto Implementation" },
|
||||||
|
{ "gy", function() require("telescope.builtin").lsp_type_definitions({ reuse_win = true }) end, desc = "Goto T[y]pe Definition" },
|
||||||
|
{ "<leader>cK", vim.lsp.buf.hover, desc = "Hover" },
|
||||||
|
{ "gK", vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" },
|
||||||
|
{ "<c-k>", vim.lsp.buf.signature_help, mode = "i", desc = "Signature Help", has = "signatureHelp" },
|
||||||
|
{ "<leader>ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" },
|
||||||
|
{
|
||||||
|
"<leader>cA",
|
||||||
|
function()
|
||||||
|
vim.lsp.buf.code_action({
|
||||||
|
context = {
|
||||||
|
only = {
|
||||||
|
"source",
|
||||||
|
},
|
||||||
|
diagnostics = {},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
desc = "Source Action",
|
||||||
|
has = "codeAction",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if require("lazyvim.util").has("inc-rename.nvim") then
|
||||||
|
M._keys[#M._keys + 1] = {
|
||||||
|
"<leader>cr",
|
||||||
|
function()
|
||||||
|
local inc_rename = require("inc_rename")
|
||||||
|
return ":" .. inc_rename.config.cmd_name .. " " .. vim.fn.expand("<cword>")
|
||||||
|
end,
|
||||||
|
expr = true,
|
||||||
|
desc = "Rename",
|
||||||
|
has = "rename",
|
||||||
|
}
|
||||||
|
else
|
||||||
|
M._keys[#M._keys + 1] = { "<leader>cr", vim.lsp.buf.rename, desc = "Rename", has = "rename" }
|
||||||
|
end
|
||||||
|
return M._keys
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param method string
|
||||||
|
function M.has(buffer, method)
|
||||||
|
method = method:find("/") and method or "textDocument/" .. method
|
||||||
|
local clients = require("lazyvim.util").lsp.get_clients({ bufnr = buffer })
|
||||||
|
for _, client in ipairs(clients) do
|
||||||
|
if client.supports_method(method) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
---@return (LazyKeys|{has?:string})[]
|
||||||
|
function M.resolve(buffer)
|
||||||
|
local Keys = require("lazy.core.handler.keys")
|
||||||
|
if not Keys.resolve then
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
local spec = M.get()
|
||||||
|
local opts = require("lazyvim.util").opts("nvim-lspconfig")
|
||||||
|
local clients = require("lazyvim.util").lsp.get_clients({ bufnr = buffer })
|
||||||
|
for _, client in ipairs(clients) do
|
||||||
|
local maps = opts.servers[client.name] and opts.servers[client.name].keys or {}
|
||||||
|
vim.list_extend(spec, maps)
|
||||||
|
end
|
||||||
|
return Keys.resolve(spec)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.on_attach(_, buffer)
|
||||||
|
local Keys = require("lazy.core.handler.keys")
|
||||||
|
local keymaps = M.resolve(buffer)
|
||||||
|
|
||||||
|
for _, keys in pairs(keymaps) do
|
||||||
|
if not keys.has or M.has(buffer, keys.has) then
|
||||||
|
local opts = Keys.opts(keys)
|
||||||
|
opts.has = nil
|
||||||
|
opts.silent = opts.silent ~= false
|
||||||
|
opts.buffer = buffer
|
||||||
|
vim.keymap.set(keys.mode or "n", keys.lhs, keys.rhs, opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
|
@ -0,0 +1,146 @@
|
||||||
|
return {
|
||||||
|
-- Treesitter is a new parser generator tool that we can
|
||||||
|
-- use in Neovim to power faster and more accurate
|
||||||
|
-- syntax highlighting.
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
version = false, -- last release is way too old and doesn't work on Windows
|
||||||
|
build = ":TSUpdate",
|
||||||
|
event = { "LazyFile", "VeryLazy" },
|
||||||
|
init = function(plugin)
|
||||||
|
-- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early
|
||||||
|
-- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which
|
||||||
|
-- no longer trigger the **nvim-treeitter** module to be loaded in time.
|
||||||
|
-- Luckily, the only thins that those plugins need are the custom queries, which we make available
|
||||||
|
-- during startup.
|
||||||
|
require("lazy.core.loader").add_to_rtp(plugin)
|
||||||
|
require("nvim-treesitter.query_predicates")
|
||||||
|
end,
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||||
|
config = function()
|
||||||
|
-- When in diff mode, we want to use the default
|
||||||
|
-- vim text objects c & C instead of the treesitter ones.
|
||||||
|
local move = require("nvim-treesitter.textobjects.move") ---@type table<string,fun(...)>
|
||||||
|
local configs = require("nvim-treesitter.configs")
|
||||||
|
for name, fn in pairs(move) do
|
||||||
|
if name:find("goto") == 1 then
|
||||||
|
move[name] = function(q, ...)
|
||||||
|
if vim.wo.diff then
|
||||||
|
local config = configs.get_module("textobjects.move")[name] ---@type table<string,string>
|
||||||
|
for key, query in pairs(config or {}) do
|
||||||
|
if q == query and key:find("[%]%[][cC]") then
|
||||||
|
vim.cmd("normal! " .. key)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return fn(q, ...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" },
|
||||||
|
keys = {
|
||||||
|
{ "<c-space>", desc = "Increment selection" },
|
||||||
|
{ "<bs>", desc = "Decrement selection", mode = "x" },
|
||||||
|
},
|
||||||
|
---@type TSConfig
|
||||||
|
---@diagnostic disable-next-line: missing-fields
|
||||||
|
opts = {
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true },
|
||||||
|
ensure_installed = {
|
||||||
|
"bash",
|
||||||
|
"c",
|
||||||
|
"diff",
|
||||||
|
"html",
|
||||||
|
"javascript",
|
||||||
|
"jsdoc",
|
||||||
|
"json",
|
||||||
|
"jsonc",
|
||||||
|
"lua",
|
||||||
|
"luadoc",
|
||||||
|
"luap",
|
||||||
|
"markdown",
|
||||||
|
"markdown_inline",
|
||||||
|
"python",
|
||||||
|
"query",
|
||||||
|
"regex",
|
||||||
|
"toml",
|
||||||
|
"tsx",
|
||||||
|
"typescript",
|
||||||
|
"vim",
|
||||||
|
"vimdoc",
|
||||||
|
"yaml",
|
||||||
|
},
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = "<C-space>",
|
||||||
|
node_incremental = "<C-space>",
|
||||||
|
scope_incremental = false,
|
||||||
|
node_decremental = "<bs>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
textobjects = {
|
||||||
|
move = {
|
||||||
|
enable = true,
|
||||||
|
goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer" },
|
||||||
|
goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer" },
|
||||||
|
goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer" },
|
||||||
|
goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
---@param opts TSConfig
|
||||||
|
config = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
---@type table<string, boolean>
|
||||||
|
local added = {}
|
||||||
|
opts.ensure_installed = vim.tbl_filter(function(lang)
|
||||||
|
if added[lang] then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
added[lang] = true
|
||||||
|
return true
|
||||||
|
end, opts.ensure_installed)
|
||||||
|
end
|
||||||
|
require("nvim-treesitter.configs").setup(opts)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Show context of the current function
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter-context",
|
||||||
|
event = "LazyFile",
|
||||||
|
enabled = true,
|
||||||
|
opts = { mode = "cursor", max_lines = 3 },
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>ut",
|
||||||
|
function()
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
local tsc = require("treesitter-context")
|
||||||
|
tsc.toggle()
|
||||||
|
if Util.inject.get_upvalue(tsc.toggle, "enabled") then
|
||||||
|
Util.info("Enabled Treesitter Context", { title = "Option" })
|
||||||
|
else
|
||||||
|
Util.warn("Disabled Treesitter Context", { title = "Option" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
desc = "Toggle Treesitter Context",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Automatically add closing tags for HTML and JSX
|
||||||
|
{
|
||||||
|
"windwp/nvim-ts-autotag",
|
||||||
|
event = "LazyFile",
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,413 @@
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
return {
|
||||||
|
-- Better `vim.notify()`
|
||||||
|
{
|
||||||
|
"rcarriga/nvim-notify",
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>un",
|
||||||
|
function()
|
||||||
|
require("notify").dismiss({ silent = true, pending = true })
|
||||||
|
end,
|
||||||
|
desc = "Dismiss all Notifications",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
timeout = 3000,
|
||||||
|
max_height = function()
|
||||||
|
return math.floor(vim.o.lines * 0.75)
|
||||||
|
end,
|
||||||
|
max_width = function()
|
||||||
|
return math.floor(vim.o.columns * 0.75)
|
||||||
|
end,
|
||||||
|
on_open = function(win)
|
||||||
|
vim.api.nvim_win_set_config(win, { zindex = 100 })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
init = function()
|
||||||
|
-- when noice is not enabled, install notify on VeryLazy
|
||||||
|
if not Util.has("noice.nvim") then
|
||||||
|
Util.on_very_lazy(function()
|
||||||
|
vim.notify = require("notify")
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- better vim.ui
|
||||||
|
{
|
||||||
|
"stevearc/dressing.nvim",
|
||||||
|
lazy = true,
|
||||||
|
init = function()
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
|
vim.ui.select = function(...)
|
||||||
|
require("lazy").load({ plugins = { "dressing.nvim" } })
|
||||||
|
return vim.ui.select(...)
|
||||||
|
end
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
|
vim.ui.input = function(...)
|
||||||
|
require("lazy").load({ plugins = { "dressing.nvim" } })
|
||||||
|
return vim.ui.input(...)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- This is what powers LazyVim's fancy-looking
|
||||||
|
-- tabs, which include filetype icons and close buttons.
|
||||||
|
{
|
||||||
|
"akinsho/bufferline.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
keys = {
|
||||||
|
{ "<leader>bp", "<Cmd>BufferLineTogglePin<CR>", desc = "Toggle pin" },
|
||||||
|
{ "<leader>bP", "<Cmd>BufferLineGroupClose ungrouped<CR>", desc = "Delete non-pinned buffers" },
|
||||||
|
{ "<leader>bo", "<Cmd>BufferLineCloseOthers<CR>", desc = "Delete other buffers" },
|
||||||
|
{ "<leader>br", "<Cmd>BufferLineCloseRight<CR>", desc = "Delete buffers to the right" },
|
||||||
|
{ "<leader>bl", "<Cmd>BufferLineCloseLeft<CR>", desc = "Delete buffers to the left" },
|
||||||
|
{ "<S-h>", "<cmd>BufferLineCyclePrev<cr>", desc = "Prev buffer" },
|
||||||
|
{ "<S-l>", "<cmd>BufferLineCycleNext<cr>", desc = "Next buffer" },
|
||||||
|
{ "[b", "<cmd>BufferLineCyclePrev<cr>", desc = "Prev buffer" },
|
||||||
|
{ "]b", "<cmd>BufferLineCycleNext<cr>", desc = "Next buffer" },
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
options = {
|
||||||
|
-- stylua: ignore
|
||||||
|
close_command = function(n) require("mini.bufremove").delete(n, false) end,
|
||||||
|
-- stylua: ignore
|
||||||
|
right_mouse_command = function(n) require("mini.bufremove").delete(n, false) end,
|
||||||
|
diagnostics = "nvim_lsp",
|
||||||
|
always_show_bufferline = false,
|
||||||
|
diagnostics_indicator = function(_, _, diag)
|
||||||
|
local icons = require("lazyvim.config").icons.diagnostics
|
||||||
|
local ret = (diag.error and icons.Error .. diag.error .. " " or "")
|
||||||
|
.. (diag.warning and icons.Warn .. diag.warning or "")
|
||||||
|
return vim.trim(ret)
|
||||||
|
end,
|
||||||
|
offsets = {
|
||||||
|
{
|
||||||
|
filetype = "neo-tree",
|
||||||
|
text = "Neo-tree",
|
||||||
|
highlight = "Directory",
|
||||||
|
text_align = "left",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("bufferline").setup(opts)
|
||||||
|
-- Fix bufferline when restoring a session
|
||||||
|
vim.api.nvim_create_autocmd("BufAdd", {
|
||||||
|
callback = function()
|
||||||
|
vim.schedule(function()
|
||||||
|
pcall(nvim_bufferline)
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- statusline
|
||||||
|
{
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
init = function()
|
||||||
|
vim.g.lualine_laststatus = vim.o.laststatus
|
||||||
|
if vim.fn.argc(-1) > 0 then
|
||||||
|
-- set an empty statusline till lualine loads
|
||||||
|
vim.o.statusline = " "
|
||||||
|
else
|
||||||
|
-- hide the statusline on the starter page
|
||||||
|
vim.o.laststatus = 0
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
opts = function()
|
||||||
|
-- PERF: we don't need this lualine require madness 🤷
|
||||||
|
local lualine_require = require("lualine_require")
|
||||||
|
lualine_require.require = require
|
||||||
|
|
||||||
|
local icons = require("lazyvim.config").icons
|
||||||
|
|
||||||
|
vim.o.laststatus = vim.g.lualine_laststatus
|
||||||
|
|
||||||
|
return {
|
||||||
|
options = {
|
||||||
|
theme = "auto",
|
||||||
|
globalstatus = true,
|
||||||
|
disabled_filetypes = { statusline = { "dashboard", "alpha", "starter" } },
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_a = { "mode" },
|
||||||
|
lualine_b = { "branch" },
|
||||||
|
|
||||||
|
lualine_c = {
|
||||||
|
Util.lualine.root_dir(),
|
||||||
|
{
|
||||||
|
"diagnostics",
|
||||||
|
symbols = {
|
||||||
|
error = icons.diagnostics.Error,
|
||||||
|
warn = icons.diagnostics.Warn,
|
||||||
|
info = icons.diagnostics.Info,
|
||||||
|
hint = icons.diagnostics.Hint,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
|
||||||
|
{ Util.lualine.pretty_path() },
|
||||||
|
},
|
||||||
|
lualine_x = {
|
||||||
|
-- stylua: ignore
|
||||||
|
{
|
||||||
|
function() return require("noice").api.status.command.get() end,
|
||||||
|
cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end,
|
||||||
|
color = Util.ui.fg("Statement"),
|
||||||
|
},
|
||||||
|
-- stylua: ignore
|
||||||
|
{
|
||||||
|
function() return require("noice").api.status.mode.get() end,
|
||||||
|
cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end,
|
||||||
|
color = Util.ui.fg("Constant"),
|
||||||
|
},
|
||||||
|
-- stylua: ignore
|
||||||
|
{
|
||||||
|
function() return " " .. require("dap").status() end,
|
||||||
|
cond = function () return package.loaded["dap"] and require("dap").status() ~= "" end,
|
||||||
|
color = Util.ui.fg("Debug"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
require("lazy.status").updates,
|
||||||
|
cond = require("lazy.status").has_updates,
|
||||||
|
color = Util.ui.fg("Special"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"diff",
|
||||||
|
symbols = {
|
||||||
|
added = icons.git.added,
|
||||||
|
modified = icons.git.modified,
|
||||||
|
removed = icons.git.removed,
|
||||||
|
},
|
||||||
|
source = function()
|
||||||
|
local gitsigns = vim.b.gitsigns_status_dict
|
||||||
|
if gitsigns then
|
||||||
|
return {
|
||||||
|
added = gitsigns.added,
|
||||||
|
modified = gitsigns.changed,
|
||||||
|
removed = gitsigns.removed,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lualine_y = {
|
||||||
|
{ "progress", separator = " ", padding = { left = 1, right = 0 } },
|
||||||
|
{ "location", padding = { left = 0, right = 1 } },
|
||||||
|
},
|
||||||
|
lualine_z = {
|
||||||
|
function()
|
||||||
|
return " " .. os.date("%R")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
extensions = { "neo-tree", "lazy" },
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- indent guides for Neovim
|
||||||
|
{
|
||||||
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
event = "LazyFile",
|
||||||
|
opts = {
|
||||||
|
indent = {
|
||||||
|
char = "│",
|
||||||
|
tab_char = "│",
|
||||||
|
},
|
||||||
|
scope = { enabled = false },
|
||||||
|
exclude = {
|
||||||
|
filetypes = {
|
||||||
|
"help",
|
||||||
|
"alpha",
|
||||||
|
"dashboard",
|
||||||
|
"neo-tree",
|
||||||
|
"Trouble",
|
||||||
|
"trouble",
|
||||||
|
"lazy",
|
||||||
|
"mason",
|
||||||
|
"notify",
|
||||||
|
"toggleterm",
|
||||||
|
"lazyterm",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
main = "ibl",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Active indent guide and indent text objects. When you're browsing
|
||||||
|
-- code, this highlights the current level of indentation, and animates
|
||||||
|
-- the highlighting.
|
||||||
|
{
|
||||||
|
"echasnovski/mini.indentscope",
|
||||||
|
version = false, -- wait till new 0.7.0 release to put it back on semver
|
||||||
|
event = "LazyFile",
|
||||||
|
opts = {
|
||||||
|
-- symbol = "▏",
|
||||||
|
symbol = "│",
|
||||||
|
options = { try_as_border = true },
|
||||||
|
},
|
||||||
|
init = function()
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = {
|
||||||
|
"help",
|
||||||
|
"alpha",
|
||||||
|
"dashboard",
|
||||||
|
"neo-tree",
|
||||||
|
"Trouble",
|
||||||
|
"trouble",
|
||||||
|
"lazy",
|
||||||
|
"mason",
|
||||||
|
"notify",
|
||||||
|
"toggleterm",
|
||||||
|
"lazyterm",
|
||||||
|
},
|
||||||
|
callback = function()
|
||||||
|
vim.b.miniindentscope_disable = true
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Displays a popup with possible key bindings of the command you started typing
|
||||||
|
{
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if require("lazyvim.util").has("noice.nvim") then
|
||||||
|
opts.defaults["<leader>sn"] = { name = "+noice" }
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu.
|
||||||
|
{
|
||||||
|
"folke/noice.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = {
|
||||||
|
lsp = {
|
||||||
|
override = {
|
||||||
|
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||||
|
["vim.lsp.util.stylize_markdown"] = true,
|
||||||
|
["cmp.entry.get_documentation"] = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
routes = {
|
||||||
|
{
|
||||||
|
filter = {
|
||||||
|
event = "msg_show",
|
||||||
|
any = {
|
||||||
|
{ find = "%d+L, %d+B" },
|
||||||
|
{ find = "; after #%d+" },
|
||||||
|
{ find = "; before #%d+" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
view = "mini",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
presets = {
|
||||||
|
bottom_search = true,
|
||||||
|
command_palette = true,
|
||||||
|
long_message_to_split = true,
|
||||||
|
inc_rename = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- stylua: ignore
|
||||||
|
keys = {
|
||||||
|
{ "<S-Enter>", function() require("noice").redirect(vim.fn.getcmdline()) end, mode = "c", desc = "Redirect Cmdline" },
|
||||||
|
{ "<leader>snl", function() require("noice").cmd("last") end, desc = "Noice Last Message" },
|
||||||
|
{ "<leader>snh", function() require("noice").cmd("history") end, desc = "Noice History" },
|
||||||
|
{ "<leader>sna", function() require("noice").cmd("all") end, desc = "Noice All" },
|
||||||
|
{ "<leader>snd", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" },
|
||||||
|
{ "<c-f>", function() if not require("noice.lsp").scroll(4) then return "<c-f>" end end, silent = true, expr = true, desc = "Scroll forward", mode = {"i", "n", "s"} },
|
||||||
|
{ "<c-b>", function() if not require("noice.lsp").scroll(-4) then return "<c-b>" end end, silent = true, expr = true, desc = "Scroll backward", mode = {"i", "n", "s"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- icons
|
||||||
|
{ "nvim-tree/nvim-web-devicons", lazy = true },
|
||||||
|
|
||||||
|
-- ui components
|
||||||
|
{ "MunifTanjim/nui.nvim", lazy = true },
|
||||||
|
|
||||||
|
{
|
||||||
|
"goolord/alpha-nvim",
|
||||||
|
optional = true,
|
||||||
|
enabled = function()
|
||||||
|
require("lazyvim.util").warn({
|
||||||
|
"`dashboard.nvim` is now the default LazyVim starter plugin.",
|
||||||
|
"",
|
||||||
|
"To keep using `alpha.nvim`, please enable the `lazyvim.plugins.extras.ui.alpha` extra.",
|
||||||
|
"Or to hide this message, remove the alpha spec from your config.",
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvimdev/dashboard-nvim",
|
||||||
|
event = "VimEnter",
|
||||||
|
opts = function()
|
||||||
|
local logo = [[
|
||||||
|
██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
|
||||||
|
██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
|
||||||
|
██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z
|
||||||
|
██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z
|
||||||
|
███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||||
|
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||||
|
]]
|
||||||
|
|
||||||
|
logo = string.rep("\n", 8) .. logo .. "\n\n"
|
||||||
|
|
||||||
|
local opts = {
|
||||||
|
theme = "doom",
|
||||||
|
hide = {
|
||||||
|
-- this is taken care of by lualine
|
||||||
|
-- enabling this messes up the actual laststatus setting after loading a file
|
||||||
|
statusline = false,
|
||||||
|
},
|
||||||
|
config = {
|
||||||
|
header = vim.split(logo, "\n"),
|
||||||
|
-- stylua: ignore
|
||||||
|
center = {
|
||||||
|
{ action = "Telescope find_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 require("lazyvim.util").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 = "qa", desc = " Quit", icon = " ", key = "q" },
|
||||||
|
},
|
||||||
|
footer = function()
|
||||||
|
local stats = require("lazy").stats()
|
||||||
|
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
|
||||||
|
return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" }
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, button in ipairs(opts.config.center) do
|
||||||
|
button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
|
||||||
|
button.key_format = " %s"
|
||||||
|
end
|
||||||
|
|
||||||
|
-- close Lazy and re-open when the dashboard is ready
|
||||||
|
if vim.o.filetype == "lazy" then
|
||||||
|
vim.cmd.close()
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "DashboardLoaded",
|
||||||
|
callback = function()
|
||||||
|
require("lazy").show()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return opts
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- measure startuptime
|
||||||
|
{
|
||||||
|
"dstein64/vim-startuptime",
|
||||||
|
cmd = "StartupTime",
|
||||||
|
config = function()
|
||||||
|
vim.g.startuptime_tries = 10
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Session management. This saves your session in the background,
|
||||||
|
-- keeping track of open buffers, window arrangement, and more.
|
||||||
|
-- You can restore sessions when returning through the dashboard.
|
||||||
|
{
|
||||||
|
"folke/persistence.nvim",
|
||||||
|
event = "BufReadPre",
|
||||||
|
opts = { options = vim.opt.sessionoptions:get() },
|
||||||
|
-- stylua: ignore
|
||||||
|
keys = {
|
||||||
|
{ "<leader>qs", function() require("persistence").load() end, desc = "Restore Session" },
|
||||||
|
{ "<leader>ql", function() require("persistence").load({ last = true }) end, desc = "Restore Last Session" },
|
||||||
|
{ "<leader>qd", function() require("persistence").stop() end, desc = "Don't Save Current Session" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- library used by other plugins
|
||||||
|
{ "nvim-lua/plenary.nvim", lazy = true },
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
local Config = require("lazyvim.config")
|
||||||
|
|
||||||
|
-- Some extras need to be loaded before others
|
||||||
|
local prios = {
|
||||||
|
["lazyvim.plugins.extras.editor.aerial"] = 100,
|
||||||
|
["lazyvim.plugins.extras.editor.symbols-outline"] = 100,
|
||||||
|
["lazyvim.plugins.extras.test.core"] = 1,
|
||||||
|
["lazyvim.plugins.extras.dap.core"] = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
table.sort(Config.json.data.extras, function(a, b)
|
||||||
|
local pa = prios[a] or 10
|
||||||
|
local pb = prios[b] or 10
|
||||||
|
if pa == pb then
|
||||||
|
return a < b
|
||||||
|
end
|
||||||
|
return pa < pb
|
||||||
|
end)
|
||||||
|
|
||||||
|
---@param extra string
|
||||||
|
return vim.tbl_map(function(extra)
|
||||||
|
return { import = extra }
|
||||||
|
end, Config.json.data.extras)
|
|
@ -0,0 +1,243 @@
|
||||||
|
local Config = require("lazyvim.config")
|
||||||
|
local Float = require("lazy.view.float")
|
||||||
|
local LazyConfig = require("lazy.core.config")
|
||||||
|
local Plugin = require("lazy.core.plugin")
|
||||||
|
local Text = require("lazy.view.text")
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
---@class LazyExtraSource
|
||||||
|
---@field name string
|
||||||
|
---@field desc? string
|
||||||
|
---@field module string
|
||||||
|
|
||||||
|
---@class LazyExtra
|
||||||
|
---@field name string
|
||||||
|
---@field source LazyExtraSource
|
||||||
|
---@field module string
|
||||||
|
---@field desc? string
|
||||||
|
---@field enabled boolean
|
||||||
|
---@field managed boolean
|
||||||
|
---@field row? number
|
||||||
|
---@field plugins string[]
|
||||||
|
---@field optional string[]
|
||||||
|
|
||||||
|
---@class lazyvim.util.extras
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@type LazyExtraSource[]
|
||||||
|
M.sources = {
|
||||||
|
{ name = "LazyVim", desc = "LazyVim extras", module = "lazyvim.plugins.extras" },
|
||||||
|
{ name = "User", desc = "User extras", module = "plugins.extras" },
|
||||||
|
}
|
||||||
|
|
||||||
|
M.ns = vim.api.nvim_create_namespace("lazyvim.extras")
|
||||||
|
---@type string[]
|
||||||
|
M.state = nil
|
||||||
|
|
||||||
|
---@return LazyExtra[]
|
||||||
|
function M.get()
|
||||||
|
M.state = M.state or LazyConfig.spec.modules
|
||||||
|
local extras = {} ---@type LazyExtra[]
|
||||||
|
for _, source in ipairs(M.sources) do
|
||||||
|
local root = Util.find_root(source.module)
|
||||||
|
if root then
|
||||||
|
Util.walk(root, function(path, name, type)
|
||||||
|
if type == "file" and name:match("%.lua$") then
|
||||||
|
name = path:sub(#root + 2, -5):gsub("/", ".")
|
||||||
|
local ok, extra = pcall(M.get_extra, source, source.module .. "." .. name)
|
||||||
|
if ok then
|
||||||
|
extras[#extras + 1] = extra
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(extras, function(a, b)
|
||||||
|
return a.name < b.name
|
||||||
|
end)
|
||||||
|
return extras
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param modname string
|
||||||
|
---@param source LazyExtraSource
|
||||||
|
function M.get_extra(source, modname)
|
||||||
|
local enabled = vim.tbl_contains(M.state, modname)
|
||||||
|
local spec = Plugin.Spec.new({ import = modname }, { optional = true })
|
||||||
|
local plugins = {} ---@type string[]
|
||||||
|
local optional = {} ---@type string[]
|
||||||
|
for _, p in pairs(spec.plugins) do
|
||||||
|
if p.optional then
|
||||||
|
optional[#optional + 1] = p.name
|
||||||
|
else
|
||||||
|
plugins[#plugins + 1] = p.name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(plugins)
|
||||||
|
table.sort(optional)
|
||||||
|
|
||||||
|
---@type LazyExtra
|
||||||
|
return {
|
||||||
|
source = source,
|
||||||
|
name = modname:sub(#source.module + 2),
|
||||||
|
module = modname,
|
||||||
|
enabled = enabled,
|
||||||
|
desc = require(modname).desc,
|
||||||
|
managed = vim.tbl_contains(Config.json.data.extras, modname) or not enabled,
|
||||||
|
plugins = plugins,
|
||||||
|
optional = optional,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
---@class LazyExtraView
|
||||||
|
---@field float LazyFloat
|
||||||
|
---@field text Text
|
||||||
|
---@field extras LazyExtra[]
|
||||||
|
---@field diag LazyDiagnostic[]
|
||||||
|
local X = {}
|
||||||
|
|
||||||
|
---@return LazyExtraView
|
||||||
|
function X.new()
|
||||||
|
local self = setmetatable({}, { __index = X })
|
||||||
|
self.float = Float.new({ title = "LazyVim Extras" })
|
||||||
|
self.float:on_key("x", function()
|
||||||
|
self:toggle()
|
||||||
|
end, "Toggle extra")
|
||||||
|
self.diag = {}
|
||||||
|
self:update()
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param diag LazyDiagnostic
|
||||||
|
function X:diagnostic(diag)
|
||||||
|
diag.row = diag.row or self.text:row()
|
||||||
|
diag.severity = diag.severity or vim.diagnostic.severity.INFO
|
||||||
|
table.insert(self.diag, diag)
|
||||||
|
end
|
||||||
|
|
||||||
|
function X:toggle()
|
||||||
|
local pos = vim.api.nvim_win_get_cursor(self.float.win)
|
||||||
|
for _, extra in ipairs(self.extras) do
|
||||||
|
if extra.row == pos[1] then
|
||||||
|
if not extra.managed then
|
||||||
|
Util.error(
|
||||||
|
"Not managed by LazyExtras. Remove from your config to enable/disable here.",
|
||||||
|
{ title = "LazyExtras" }
|
||||||
|
)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
extra.enabled = not extra.enabled
|
||||||
|
Config.json.data.extras = vim.tbl_filter(function(name)
|
||||||
|
return name ~= extra.module
|
||||||
|
end, Config.json.data.extras)
|
||||||
|
M.state = vim.tbl_filter(function(name)
|
||||||
|
return name ~= extra.module
|
||||||
|
end, M.state)
|
||||||
|
if extra.enabled then
|
||||||
|
table.insert(Config.json.data.extras, extra.module)
|
||||||
|
M.state[#M.state + 1] = extra.module
|
||||||
|
end
|
||||||
|
table.sort(Config.json.data.extras)
|
||||||
|
Util.json.save()
|
||||||
|
Util.info(
|
||||||
|
"`"
|
||||||
|
.. extra.name
|
||||||
|
.. "`"
|
||||||
|
.. " "
|
||||||
|
.. (extra.enabled and "**enabled**" or "**disabled**")
|
||||||
|
.. "\nPlease restart LazyVim to apply the changes.",
|
||||||
|
{ title = "LazyExtras" }
|
||||||
|
)
|
||||||
|
self:update()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function X:update()
|
||||||
|
self.diag = {}
|
||||||
|
self.extras = M.get()
|
||||||
|
self.text = Text.new()
|
||||||
|
self.text.padding = 2
|
||||||
|
self:render()
|
||||||
|
self.text:trim()
|
||||||
|
vim.bo[self.float.buf].modifiable = true
|
||||||
|
self.text:render(self.float.buf)
|
||||||
|
vim.bo[self.float.buf].modifiable = false
|
||||||
|
vim.diagnostic.set(
|
||||||
|
M.ns,
|
||||||
|
self.float.buf,
|
||||||
|
---@param diag LazyDiagnostic
|
||||||
|
vim.tbl_map(function(diag)
|
||||||
|
diag.col = 0
|
||||||
|
diag.lnum = diag.row - 1
|
||||||
|
return diag
|
||||||
|
end, self.diag),
|
||||||
|
{ signs = false, virtual_text = true }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
function X:render()
|
||||||
|
self.text:nl():nl():append("LazyVim Extras", "LazyH1"):nl():nl()
|
||||||
|
self.text
|
||||||
|
:append("This is a list of all enabled/disabled LazyVim extras.", "LazyComment")
|
||||||
|
:nl()
|
||||||
|
:append("Each extra shows the required and optional plugins it may install.", "LazyComment")
|
||||||
|
:nl()
|
||||||
|
:append("Enable/disable extras with the ", "LazyComment")
|
||||||
|
:append("<x>", "LazySpecial")
|
||||||
|
:append(" key", "LazyComment")
|
||||||
|
:nl()
|
||||||
|
self:section({ enabled = true, title = "Enabled" })
|
||||||
|
self:section({ enabled = false, title = "Disabled" })
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param extra LazyExtra
|
||||||
|
function X:extra(extra)
|
||||||
|
if not extra.managed then
|
||||||
|
self:diagnostic({
|
||||||
|
message = "Not managed by LazyExtras (config)",
|
||||||
|
severity = vim.diagnostic.severity.WARN,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
extra.row = self.text:row()
|
||||||
|
local hl = extra.managed and "LazySpecial" or "LazyLocal"
|
||||||
|
if extra.enabled then
|
||||||
|
self.text:append(" " .. LazyConfig.options.ui.icons.loaded .. " ", hl)
|
||||||
|
else
|
||||||
|
self.text:append(" " .. LazyConfig.options.ui.icons.not_loaded .. " ", hl)
|
||||||
|
end
|
||||||
|
self.text:append(extra.name)
|
||||||
|
if extra.source.name ~= "LazyVim" then
|
||||||
|
self.text:append(" "):append(LazyConfig.options.ui.icons.event .. " " .. extra.source.name, "LazyReasonEvent")
|
||||||
|
end
|
||||||
|
for _, plugin in ipairs(extra.plugins) do
|
||||||
|
self.text:append(" "):append(LazyConfig.options.ui.icons.plugin .. "" .. plugin, "LazyReasonPlugin")
|
||||||
|
end
|
||||||
|
for _, plugin in ipairs(extra.optional) do
|
||||||
|
self.text:append(" "):append(LazyConfig.options.ui.icons.plugin .. "" .. plugin, "LazyReasonRequire")
|
||||||
|
end
|
||||||
|
if extra.desc then
|
||||||
|
self.text:nl():append(" " .. extra.desc, "LazyComment")
|
||||||
|
end
|
||||||
|
self.text:nl()
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param opts {enabled?:boolean, title?:string}
|
||||||
|
function X:section(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
---@type LazyExtra[]
|
||||||
|
local extras = vim.tbl_filter(function(extra)
|
||||||
|
return opts.enabled == nil or extra.enabled == opts.enabled
|
||||||
|
end, self.extras)
|
||||||
|
|
||||||
|
self.text:nl():append(opts.title .. ":", "LazyH2"):append(" (" .. #extras .. ")", "LazyComment"):nl()
|
||||||
|
for _, extra in ipairs(extras) do
|
||||||
|
self:extra(extra)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.show()
|
||||||
|
return X.new()
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
|
@ -0,0 +1,173 @@
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
---@class lazyvim.util.format
|
||||||
|
---@overload fun(opts?: {force?:boolean})
|
||||||
|
local M = setmetatable({}, {
|
||||||
|
__call = function(m, ...)
|
||||||
|
return m.format(...)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
---@class LazyFormatter
|
||||||
|
---@field name string
|
||||||
|
---@field primary? boolean
|
||||||
|
---@field format fun(bufnr:number)
|
||||||
|
---@field sources fun(bufnr:number):string[]
|
||||||
|
---@field priority number
|
||||||
|
|
||||||
|
M.formatters = {} ---@type LazyFormatter[]
|
||||||
|
|
||||||
|
---@param formatter LazyFormatter
|
||||||
|
function M.register(formatter)
|
||||||
|
M.formatters[#M.formatters + 1] = formatter
|
||||||
|
table.sort(M.formatters, function(a, b)
|
||||||
|
return a.priority > b.priority
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.formatexpr()
|
||||||
|
if Util.has("conform.nvim") then
|
||||||
|
return require("conform").formatexpr()
|
||||||
|
end
|
||||||
|
return vim.lsp.formatexpr({ timeout_ms = 3000 })
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param buf? number
|
||||||
|
---@return (LazyFormatter|{active:boolean,resolved:string[]})[]
|
||||||
|
function M.resolve(buf)
|
||||||
|
buf = buf or vim.api.nvim_get_current_buf()
|
||||||
|
local have_primary = false
|
||||||
|
---@param formatter LazyFormatter
|
||||||
|
return vim.tbl_map(function(formatter)
|
||||||
|
local sources = formatter.sources(buf)
|
||||||
|
local active = #sources > 0 and (not formatter.primary or not have_primary)
|
||||||
|
have_primary = have_primary or (active and formatter.primary) or false
|
||||||
|
return setmetatable({
|
||||||
|
active = active,
|
||||||
|
resolved = sources,
|
||||||
|
}, { __index = formatter })
|
||||||
|
end, M.formatters)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param buf? number
|
||||||
|
function M.info(buf)
|
||||||
|
buf = buf or vim.api.nvim_get_current_buf()
|
||||||
|
local gaf = vim.g.autoformat == nil or vim.g.autoformat
|
||||||
|
local baf = vim.b[buf].autoformat
|
||||||
|
local enabled = M.enabled(buf)
|
||||||
|
local lines = {
|
||||||
|
"# Status",
|
||||||
|
("- [%s] global **%s**"):format(gaf and "x" or " ", gaf and "enabled" or "disabled"),
|
||||||
|
("- [%s] buffer **%s**"):format(
|
||||||
|
enabled and "x" or " ",
|
||||||
|
baf == nil and "inherit" or baf and "enabled" or "disabled"
|
||||||
|
),
|
||||||
|
}
|
||||||
|
local have = false
|
||||||
|
for _, formatter in ipairs(M.resolve(buf)) do
|
||||||
|
if #formatter.resolved > 0 then
|
||||||
|
have = true
|
||||||
|
lines[#lines + 1] = "\n# " .. formatter.name .. (formatter.active and " ***(active)***" or "")
|
||||||
|
for _, line in ipairs(formatter.resolved) do
|
||||||
|
lines[#lines + 1] = ("- [%s] **%s**"):format(formatter.active and "x" or " ", line)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not have then
|
||||||
|
lines[#lines + 1] = "\n***No formatters available for this buffer.***"
|
||||||
|
end
|
||||||
|
Util[enabled and "info" or "warn"](
|
||||||
|
table.concat(lines, "\n"),
|
||||||
|
{ title = "LazyFormat (" .. (enabled and "enabled" or "disabled") .. ")" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param buf? number
|
||||||
|
function M.enabled(buf)
|
||||||
|
buf = (buf == nil or buf == 0) and vim.api.nvim_get_current_buf() or buf
|
||||||
|
local gaf = vim.g.autoformat
|
||||||
|
local baf = vim.b[buf].autoformat
|
||||||
|
|
||||||
|
-- If the buffer has a local value, use that
|
||||||
|
if baf ~= nil then
|
||||||
|
return baf
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Otherwise use the global value if set, or true by default
|
||||||
|
return gaf == nil or gaf
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param buf? boolean
|
||||||
|
function M.toggle(buf)
|
||||||
|
if buf then
|
||||||
|
vim.b.autoformat = not M.enabled()
|
||||||
|
else
|
||||||
|
vim.g.autoformat = not M.enabled()
|
||||||
|
vim.b.autoformat = nil
|
||||||
|
end
|
||||||
|
M.info()
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param opts? {force?:boolean, buf?:number}
|
||||||
|
function M.format(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
local buf = opts.buf or vim.api.nvim_get_current_buf()
|
||||||
|
if not ((opts and opts.force) or M.enabled(buf)) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local done = false
|
||||||
|
for _, formatter in ipairs(M.resolve(buf)) do
|
||||||
|
if formatter.active then
|
||||||
|
done = true
|
||||||
|
Util.try(function()
|
||||||
|
return formatter.format(buf)
|
||||||
|
end, { msg = "Formatter `" .. formatter.name .. "` failed" })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not done and opts and opts.force then
|
||||||
|
Util.warn("No formatter available", { title = "LazyVim" })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.health()
|
||||||
|
local Config = require("lazy.core.config")
|
||||||
|
local has_plugin = Config.spec.plugins["none-ls.nvim"]
|
||||||
|
local has_extra = vim.tbl_contains(Config.spec.modules, "lazyvim.plugins.extras.lsp.none-ls")
|
||||||
|
if has_plugin and not has_extra then
|
||||||
|
Util.warn({
|
||||||
|
"`conform.nvim` and `nvim-lint` are now the default formatters and linters in LazyVim.",
|
||||||
|
"",
|
||||||
|
"You can use those plugins together with `none-ls.nvim`,",
|
||||||
|
"but you need to enable the `lazyvim.plugins.extras.lsp.none-ls` extra,",
|
||||||
|
"for formatting to work correctly.",
|
||||||
|
"",
|
||||||
|
"In case you no longer want to use `none-ls.nvim`, just remove the spec from your config.",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
M.health()
|
||||||
|
|
||||||
|
-- Autoformat autocmd
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
group = vim.api.nvim_create_augroup("LazyFormat", {}),
|
||||||
|
callback = function(event)
|
||||||
|
M.format({ buf = event.buf })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Manual format
|
||||||
|
vim.api.nvim_create_user_command("LazyFormat", function()
|
||||||
|
M.format({ force = true })
|
||||||
|
end, { desc = "Format selection or buffer" })
|
||||||
|
|
||||||
|
-- Format info
|
||||||
|
vim.api.nvim_create_user_command("LazyFormatInfo", function()
|
||||||
|
M.info()
|
||||||
|
end, { desc = "Show info about the formatters for the current buffer" })
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
|
@ -0,0 +1,171 @@
|
||||||
|
local LazyUtil = require("lazy.core.util")
|
||||||
|
|
||||||
|
---@class lazyvim.util: LazyUtilCore
|
||||||
|
---@field ui lazyvim.util.ui
|
||||||
|
---@field lsp lazyvim.util.lsp
|
||||||
|
---@field root lazyvim.util.root
|
||||||
|
---@field telescope lazyvim.util.telescope
|
||||||
|
---@field terminal lazyvim.util.terminal
|
||||||
|
---@field toggle lazyvim.util.toggle
|
||||||
|
---@field format lazyvim.util.format
|
||||||
|
---@field plugin lazyvim.util.plugin
|
||||||
|
---@field extras lazyvim.util.extras
|
||||||
|
---@field inject lazyvim.util.inject
|
||||||
|
---@field news lazyvim.util.news
|
||||||
|
---@field json lazyvim.util.json
|
||||||
|
---@field lualine lazyvim.util.lualine
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@type table<string, string|string[]>
|
||||||
|
local deprecated = {
|
||||||
|
get_clients = "lsp",
|
||||||
|
on_attach = "lsp",
|
||||||
|
on_rename = "lsp",
|
||||||
|
root_patterns = { "root", "patterns" },
|
||||||
|
get_root = { "root", "get" },
|
||||||
|
float_term = { "terminal", "open" },
|
||||||
|
toggle_diagnostics = { "toggle", "diagnostics" },
|
||||||
|
toggle_number = { "toggle", "number" },
|
||||||
|
fg = "ui",
|
||||||
|
}
|
||||||
|
|
||||||
|
setmetatable(M, {
|
||||||
|
__index = function(t, k)
|
||||||
|
if LazyUtil[k] then
|
||||||
|
return LazyUtil[k]
|
||||||
|
end
|
||||||
|
local dep = deprecated[k]
|
||||||
|
if dep then
|
||||||
|
local mod = type(dep) == "table" and dep[1] or dep
|
||||||
|
local key = type(dep) == "table" and dep[2] or k
|
||||||
|
M.deprecate([[require("lazyvim.util").]] .. k, [[require("lazyvim.util").]] .. mod .. "." .. key)
|
||||||
|
---@diagnostic disable-next-line: no-unknown
|
||||||
|
t[mod] = require("lazyvim.util." .. mod) -- load here to prevent loops
|
||||||
|
return t[mod][key]
|
||||||
|
end
|
||||||
|
---@diagnostic disable-next-line: no-unknown
|
||||||
|
t[k] = require("lazyvim.util." .. k)
|
||||||
|
return t[k]
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
function M.is_win()
|
||||||
|
return vim.loop.os_uname().sysname:find("Windows") ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param plugin string
|
||||||
|
function M.has(plugin)
|
||||||
|
return require("lazy.core.config").spec.plugins[plugin] ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param fn fun()
|
||||||
|
function M.on_very_lazy(fn)
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "VeryLazy",
|
||||||
|
callback = function()
|
||||||
|
fn()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param name string
|
||||||
|
function M.opts(name)
|
||||||
|
local plugin = require("lazy.core.config").plugins[name]
|
||||||
|
if not plugin then
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
local Plugin = require("lazy.core.plugin")
|
||||||
|
return Plugin.values(plugin, "opts", false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.deprecate(old, new)
|
||||||
|
M.warn(("`%s` is deprecated. Please use `%s` instead"):format(old, new), {
|
||||||
|
title = "LazyVim",
|
||||||
|
once = true,
|
||||||
|
stacktrace = true,
|
||||||
|
stacklevel = 6,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- delay notifications till vim.notify was replaced or after 500ms
|
||||||
|
function M.lazy_notify()
|
||||||
|
local notifs = {}
|
||||||
|
local function temp(...)
|
||||||
|
table.insert(notifs, vim.F.pack_len(...))
|
||||||
|
end
|
||||||
|
|
||||||
|
local orig = vim.notify
|
||||||
|
vim.notify = temp
|
||||||
|
|
||||||
|
local timer = vim.loop.new_timer()
|
||||||
|
local check = assert(vim.loop.new_check())
|
||||||
|
|
||||||
|
local replay = function()
|
||||||
|
timer:stop()
|
||||||
|
check:stop()
|
||||||
|
if vim.notify == temp then
|
||||||
|
vim.notify = orig -- put back the original notify if needed
|
||||||
|
end
|
||||||
|
vim.schedule(function()
|
||||||
|
---@diagnostic disable-next-line: no-unknown
|
||||||
|
for _, notif in ipairs(notifs) do
|
||||||
|
vim.notify(vim.F.unpack_len(notif))
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- wait till vim.notify has been replaced
|
||||||
|
check:start(function()
|
||||||
|
if vim.notify ~= temp then
|
||||||
|
replay()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
-- or if it took more than 500ms, then something went wrong
|
||||||
|
timer:start(500, 0, replay)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param name string
|
||||||
|
---@param fn fun(name:string)
|
||||||
|
function M.on_load(name, fn)
|
||||||
|
local Config = require("lazy.core.config")
|
||||||
|
if Config.plugins[name] and Config.plugins[name]._.loaded then
|
||||||
|
fn(name)
|
||||||
|
else
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "LazyLoad",
|
||||||
|
callback = function(event)
|
||||||
|
if event.data == name then
|
||||||
|
fn(name)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Wrapper around vim.keymap.set that will
|
||||||
|
-- not create a keymap if a lazy key handler exists.
|
||||||
|
-- It will also set `silent` to true by default.
|
||||||
|
function M.safe_keymap_set(mode, lhs, rhs, opts)
|
||||||
|
local keys = require("lazy.core.handler").handlers.keys
|
||||||
|
---@cast keys LazyKeysHandler
|
||||||
|
local modes = type(mode) == "string" and { mode } or mode
|
||||||
|
|
||||||
|
---@param m string
|
||||||
|
modes = vim.tbl_filter(function(m)
|
||||||
|
return not (keys.have and keys:have(lhs, m))
|
||||||
|
end, modes)
|
||||||
|
|
||||||
|
-- do not create the keymap if a lazy keys handler exists
|
||||||
|
if #modes > 0 then
|
||||||
|
opts = opts or {}
|
||||||
|
opts.silent = opts.silent ~= false
|
||||||
|
if opts.remap and not vim.g.vscode then
|
||||||
|
---@diagnostic disable-next-line: no-unknown
|
||||||
|
opts.remap = nil
|
||||||
|
end
|
||||||
|
vim.keymap.set(modes, lhs, rhs, opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
|
@ -0,0 +1,34 @@
|
||||||
|
---@class lazyvim.util.inject
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@generic A: any
|
||||||
|
---@generic B: any
|
||||||
|
---@generic C: any
|
||||||
|
---@generic F: function
|
||||||
|
---@param fn F|fun(a:A, b:B, c:C)
|
||||||
|
---@param wrapper fun(a:A, b:B, c:C): boolean?
|
||||||
|
---@return F
|
||||||
|
function M.args(fn, wrapper)
|
||||||
|
return function(...)
|
||||||
|
if wrapper(...) == false then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
return fn(...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.get_upvalue(func, name)
|
||||||
|
local i = 1
|
||||||
|
while true do
|
||||||
|
local n, v = debug.getupvalue(func, i)
|
||||||
|
if not n then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if n == name then
|
||||||
|
return v
|
||||||
|
end
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
|
@ -0,0 +1,82 @@
|
||||||
|
local Config = require("lazyvim.config")
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
---@class lazyvim.util.json
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@param value any
|
||||||
|
---@param indent string
|
||||||
|
local function encode(value, indent)
|
||||||
|
local t = type(value)
|
||||||
|
|
||||||
|
if t == "string" then
|
||||||
|
return string.format("%q", value)
|
||||||
|
elseif t == "number" or t == "boolean" then
|
||||||
|
return tostring(value)
|
||||||
|
elseif t == "table" then
|
||||||
|
local is_list = Util.is_list(value)
|
||||||
|
local parts = {}
|
||||||
|
local next_indent = indent .. " "
|
||||||
|
|
||||||
|
if is_list then
|
||||||
|
---@diagnostic disable-next-line: no-unknown
|
||||||
|
for _, v in ipairs(value) do
|
||||||
|
local e = encode(v, next_indent)
|
||||||
|
if e then
|
||||||
|
table.insert(parts, next_indent .. e)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return "[\n" .. table.concat(parts, ",\n") .. "\n" .. indent .. "]"
|
||||||
|
else
|
||||||
|
local keys = vim.tbl_keys(value)
|
||||||
|
table.sort(keys)
|
||||||
|
---@diagnostic disable-next-line: no-unknown
|
||||||
|
for _, k in ipairs(keys) do
|
||||||
|
local e = encode(value[k], next_indent)
|
||||||
|
if e then
|
||||||
|
table.insert(parts, next_indent .. string.format("%q", k) .. ": " .. e)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return "{\n" .. table.concat(parts, ",\n") .. "\n" .. indent .. "}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.encode(value)
|
||||||
|
return encode(value, "")
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.save()
|
||||||
|
Config.json.data.version = Config.json.version
|
||||||
|
local path = vim.fn.stdpath("config") .. "/lazyvim.json"
|
||||||
|
local f = io.open(path, "w")
|
||||||
|
if f then
|
||||||
|
f:write(Util.json.encode(Config.json.data))
|
||||||
|
f:close()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.migrate()
|
||||||
|
Util.info("Migrating `lazyvim.json` to version `" .. Config.json.version .. "`")
|
||||||
|
local json = Config.json
|
||||||
|
|
||||||
|
-- v0
|
||||||
|
if not json.data.version then
|
||||||
|
if json.data.hashes then
|
||||||
|
---@diagnostic disable-next-line: no-unknown
|
||||||
|
json.data.hashes = nil
|
||||||
|
end
|
||||||
|
json.data.extras = vim.tbl_map(function(extra)
|
||||||
|
return "lazyvim.plugins.extras." .. extra
|
||||||
|
end, json.data.extras or {})
|
||||||
|
elseif json.data.version == 1 then
|
||||||
|
json.data.extras = vim.tbl_map(function(extra)
|
||||||
|
-- replace double extras module name
|
||||||
|
return extra:gsub("^lazyvim%.plugins%.extras%.lazyvim%.plugins%.extras%.", "lazyvim.plugins.extras.")
|
||||||
|
end, json.data.extras or {})
|
||||||
|
end
|
||||||
|
|
||||||
|
M.save()
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
|
@ -0,0 +1,125 @@
|
||||||
|
local Util = require("lazyvim.util")
|
||||||
|
|
||||||
|
---@class lazyvim.util.lsp
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@alias lsp.Client.filter {id?: number, bufnr?: number, name?: string, method?: string, filter?:fun(client: lsp.Client):boolean}
|
||||||
|
|
||||||
|
---@param opts? lsp.Client.filter
|
||||||
|
function M.get_clients(opts)
|
||||||
|
local ret = {} ---@type lsp.Client[]
|
||||||
|
if vim.lsp.get_clients then
|
||||||
|
ret = vim.lsp.get_clients(opts)
|
||||||
|
else
|
||||||
|
---@diagnostic disable-next-line: deprecated
|
||||||
|
ret = vim.lsp.get_active_clients(opts)
|
||||||
|
if opts and opts.method then
|
||||||
|
---@param client lsp.Client
|
||||||
|
ret = vim.tbl_filter(function(client)
|
||||||
|
return client.supports_method(opts.method, { bufnr = opts.bufnr })
|
||||||
|
end, ret)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return opts and opts.filter and vim.tbl_filter(opts.filter, ret) or ret
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param on_attach fun(client, buffer)
|
||||||
|
function M.on_attach(on_attach)
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
callback = function(args)
|
||||||
|
local buffer = args.buf ---@type number
|
||||||
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
|
on_attach(client, buffer)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param from string
|
||||||
|
---@param to string
|
||||||
|
function M.on_rename(from, to)
|
||||||
|
local clients = M.get_clients()
|
||||||
|
for _, client in ipairs(clients) do
|
||||||
|
if client.supports_method("workspace/willRenameFiles") then
|
||||||
|
---@diagnostic disable-next-line: invisible
|
||||||
|
local resp = client.request_sync("workspace/willRenameFiles", {
|
||||||
|
files = {
|
||||||
|
{
|
||||||
|
oldUri = vim.uri_from_fname(from),
|
||||||
|
newUri = vim.uri_from_fname(to),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, 1000, 0)
|
||||||
|
if resp and resp.result ~= nil then
|
||||||
|
vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---@return _.lspconfig.options
|
||||||
|
function M.get_config(server)
|
||||||
|
local configs = require("lspconfig.configs")
|
||||||
|
return rawget(configs, server)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param server string
|
||||||
|
---@param cond fun( root_dir, config): boolean
|
||||||
|
function M.disable(server, cond)
|
||||||
|
local util = require("lspconfig.util")
|
||||||
|
local def = M.get_config(server)
|
||||||
|
---@diagnostic disable-next-line: undefined-field
|
||||||
|
def.document_config.on_new_config = util.add_hook_before(def.document_config.on_new_config, function(config, root_dir)
|
||||||
|
if cond(root_dir, config) then
|
||||||
|
config.enabled = false
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param opts? LazyFormatter| {filter?: (string|lsp.Client.filter)}
|
||||||
|
function M.formatter(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
local filter = opts.filter or {}
|
||||||
|
filter = type(filter) == "string" and { name = filter } or filter
|
||||||
|
---@cast filter lsp.Client.filter
|
||||||
|
---@type LazyFormatter
|
||||||
|
local ret = {
|
||||||
|
name = "LSP",
|
||||||
|
primary = true,
|
||||||
|
priority = 1,
|
||||||
|
format = function(buf)
|
||||||
|
M.format(Util.merge(filter, { bufnr = buf }))
|
||||||
|
end,
|
||||||
|
sources = function(buf)
|
||||||
|
local clients = M.get_clients(Util.merge(filter, { bufnr = buf }))
|
||||||
|
---@param client lsp.Client
|
||||||
|
local ret = vim.tbl_filter(function(client)
|
||||||
|
return client.supports_method("textDocument/formatting")
|
||||||
|
or client.supports_method("textDocument/rangeFormatting")
|
||||||
|
end, clients)
|
||||||
|
---@param client lsp.Client
|
||||||
|
return vim.tbl_map(function(client)
|
||||||
|
return client.name
|
||||||
|
end, ret)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
return Util.merge(ret, opts) --[[@as LazyFormatter]]
|
||||||
|
end
|
||||||
|
|
||||||
|
---@alias lsp.Client.format {timeout_ms?: number, format_options?: table} | lsp.Client.filter
|
||||||
|
|
||||||
|
---@param opts? lsp.Client.format
|
||||||
|
function M.format(opts)
|
||||||
|
opts = vim.tbl_deep_extend("force", {}, opts or {}, require("lazyvim.util").opts("nvim-lspconfig").format or {})
|
||||||
|
local ok, conform = pcall(require, "conform")
|
||||||
|
-- use conform for formatting with LSP when available,
|
||||||
|
-- since it has better format diffing
|
||||||
|
if ok then
|
||||||
|
opts.formatters = {}
|
||||||
|
opts.lsp_fallback = true
|
||||||
|
conform.format(opts)
|
||||||
|
else
|
||||||
|
vim.lsp.buf.format(opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue