mirror of
https://github.com/nvim-lua/kickstart.nvim.git
synced 2026-04-14 14:11:17 -07:00
Compare commits
2 Commits
feature/ts
...
cpatti_add
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f52334ffa | ||
|
|
9ddac5a2f1 |
7
.github/ISSUE_TEMPLATE/bug_report.md
vendored
7
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -9,13 +9,6 @@ assignees: ''
|
|||||||
|
|
||||||
<!-- Any bug report not following this template will be immediately closed. Thanks -->
|
<!-- Any bug report not following this template will be immediately closed. Thanks -->
|
||||||
|
|
||||||
## Before Reporting an Issue
|
|
||||||
- I have read the kickstart.nvim README.md.
|
|
||||||
- I have read the appropriate plugin's documentation.
|
|
||||||
- I have searched that this issue has not been reported before.
|
|
||||||
|
|
||||||
- [ ] **By checking this, I confirm that the above steps are completed. I understand leaving this unchecked will result in this report being closed immediately.**
|
|
||||||
|
|
||||||
## Describe the bug
|
## Describe the bug
|
||||||
<!-- A clear and concise description of what the bug is. -->
|
<!-- A clear and concise description of what the bug is. -->
|
||||||
|
|
||||||
|
|||||||
5
.github/workflows/stylua.yml
vendored
5
.github/workflows/stylua.yml
vendored
@@ -9,12 +9,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
- name: Stylua Check
|
- name: Stylua Check
|
||||||
uses: JohnnyMorganz/stylua-action@v4
|
uses: JohnnyMorganz/stylua-action@v3
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
version: latest
|
version: latest
|
||||||
args: --check .
|
args: --check .
|
||||||
|
|
||||||
|
|||||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -4,11 +4,4 @@ test.sh
|
|||||||
nvim
|
nvim
|
||||||
|
|
||||||
spell/
|
spell/
|
||||||
|
|
||||||
# In your personal fork, you likely want to comment this, since it's recommended to track
|
|
||||||
# lazy-lock.json in version control - see https://lazy.folke.io/usage/lockfile
|
|
||||||
# For the official `nvim-lua/kickstart.nvim` git repository, we leave it ignored to avoid unneeded
|
|
||||||
# merge conflicts.
|
|
||||||
lazy-lock.json
|
lazy-lock.json
|
||||||
|
|
||||||
.DS_Store
|
|
||||||
|
|||||||
@@ -4,4 +4,3 @@ indent_type = "Spaces"
|
|||||||
indent_width = 2
|
indent_width = 2
|
||||||
quote_style = "AutoPreferSingle"
|
quote_style = "AutoPreferSingle"
|
||||||
call_parentheses = "None"
|
call_parentheses = "None"
|
||||||
collapse_simple_statement = "Always"
|
|
||||||
|
|||||||
221
README.md
221
README.md
@@ -17,38 +17,27 @@ A starting point for Neovim that is:
|
|||||||
Kickstart.nvim targets *only* the latest
|
Kickstart.nvim targets *only* the latest
|
||||||
['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest
|
['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest
|
||||||
['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim.
|
['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim.
|
||||||
If you are experiencing issues, please make sure you have at least the latest
|
If you are experiencing issues, please make sure you have the latest versions.
|
||||||
stable version. Most likely, you want to install neovim via a [package
|
|
||||||
manager](https://github.com/neovim/neovim/blob/master/INSTALL.md#install-from-package).
|
|
||||||
To check your neovim version, run `nvim --version` and make sure it is not
|
|
||||||
below the latest
|
|
||||||
['stable'](https://github.com/neovim/neovim/releases/tag/stable) version. If
|
|
||||||
your chosen install method only gives you an outdated version of neovim, find
|
|
||||||
alternative [installation methods below](#alternative-neovim-installation-methods).
|
|
||||||
|
|
||||||
### Install External Dependencies
|
### Install External Dependencies
|
||||||
|
|
||||||
External Requirements:
|
External Requirements:
|
||||||
- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`)
|
- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`)
|
||||||
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation),
|
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation)
|
||||||
[fd-find](https://github.com/sharkdp/fd#installation)
|
|
||||||
- [tree-sitter CLI](https://github.com/tree-sitter/tree-sitter/blob/master/crates/cli/README.md#installation)
|
|
||||||
- Clipboard tool (xclip/xsel/win32yank or other depending on the platform)
|
|
||||||
- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
|
- 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
|
- if you have it set `vim.g.have_nerd_font` in `init.lua` to true
|
||||||
- Emoji fonts (Ubuntu only, and only if you want emoji!) `sudo apt install fonts-noto-color-emoji`
|
|
||||||
- Language Setup:
|
- Language Setup:
|
||||||
- If you want to write Typescript, you need `npm`
|
- If want to write Typescript, you need `npm`
|
||||||
- If you want to write Golang, you will need `go`
|
- If want to write Golang, you will need `go`
|
||||||
- etc.
|
- etc.
|
||||||
|
|
||||||
> [!NOTE]
|
> **NOTE**
|
||||||
> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes
|
> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes
|
||||||
> and quick install snippets
|
> and quick install snippets
|
||||||
|
|
||||||
### Install Kickstart
|
### Install Kickstart
|
||||||
|
|
||||||
> [!NOTE]
|
> **NOTE**
|
||||||
> [Backup](#FAQ) your previous configuration (if any exists)
|
> [Backup](#FAQ) your previous configuration (if any exists)
|
||||||
|
|
||||||
Neovim's configurations are located under the following paths, depending on your OS:
|
Neovim's configurations are located under the following paths, depending on your OS:
|
||||||
@@ -56,8 +45,8 @@ Neovim's configurations are located under the following paths, depending on your
|
|||||||
| OS | PATH |
|
| OS | PATH |
|
||||||
| :- | :--- |
|
| :- | :--- |
|
||||||
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
|
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
|
||||||
| Windows (cmd)| `%localappdata%\nvim\` |
|
| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` |
|
||||||
| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` |
|
| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` |
|
||||||
|
|
||||||
#### Recommended Step
|
#### Recommended Step
|
||||||
|
|
||||||
@@ -65,17 +54,12 @@ Neovim's configurations are located under the following paths, depending on your
|
|||||||
so that you have your own copy that you can modify, then install by cloning the
|
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.
|
fork to your machine using one of the commands below, depending on your OS.
|
||||||
|
|
||||||
> [!NOTE]
|
> **NOTE**
|
||||||
> Your fork's URL will be something like this:
|
> Your fork's url will be something like this:
|
||||||
> `https://github.com/<your_github_username>/kickstart.nvim.git`
|
> `https://github.com/<your_github_username>/kickstart.nvim.git`
|
||||||
|
|
||||||
You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file
|
|
||||||
too - it's ignored in the kickstart repo to make maintenance easier, but it's
|
|
||||||
[recommended to track it in version control](https://lazy.folke.io/usage/lockfile).
|
|
||||||
|
|
||||||
#### Clone kickstart.nvim
|
#### Clone kickstart.nvim
|
||||||
|
> **NOTE**
|
||||||
> [!NOTE]
|
|
||||||
> If following the recommended step above (i.e., forking the repo), replace
|
> If following the recommended step above (i.e., forking the repo), replace
|
||||||
> `nvim-lua` with `<your_github_username>` in the commands below
|
> `nvim-lua` with `<your_github_username>` in the commands below
|
||||||
|
|
||||||
@@ -92,13 +76,13 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HO
|
|||||||
If you're using `cmd.exe`:
|
If you're using `cmd.exe`:
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git "%localappdata%\nvim"
|
git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\
|
||||||
```
|
```
|
||||||
|
|
||||||
If you're using `powershell.exe`
|
If you're using `powershell.exe`
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim"
|
git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
@@ -112,17 +96,73 @@ nvim
|
|||||||
```
|
```
|
||||||
|
|
||||||
That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
|
That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
|
||||||
the current plugin status. Hit `q` to close the window.
|
current plugin status. Hit `q` to close the window.
|
||||||
|
|
||||||
#### Read The Friendly Documentation
|
|
||||||
|
|
||||||
Read through the `init.lua` file in your configuration folder for more
|
Read through the `init.lua` file in your configuration folder for more
|
||||||
information about extending and exploring Neovim. That also includes
|
information about extending and exploring Neovim.
|
||||||
examples of adding popularly requested plugins.
|
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> For more information about a particular plugin check its repository's documentation.
|
|
||||||
|
|
||||||
|
#### Examples of adding popularly requested plugins
|
||||||
|
|
||||||
|
NOTE: You'll need to uncomment the line in the init.lua that turns on loading custom plugins.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Adding autopairs</summary>
|
||||||
|
|
||||||
|
This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs)
|
||||||
|
and enable it on startup. For more information, see documentation for
|
||||||
|
[lazy.nvim](https://github.com/folke/lazy.nvim).
|
||||||
|
|
||||||
|
In the file: `lua/custom/plugins/autopairs.lua`, add:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
-- File: lua/custom/plugins/autopairs.lua
|
||||||
|
|
||||||
|
return {
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
-- 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,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>Adding a file tree plugin</summary>
|
||||||
|
|
||||||
|
This will install the tree plugin and add the command `:Neotree` for you.
|
||||||
|
For more information, see the documentation at
|
||||||
|
[neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim).
|
||||||
|
|
||||||
|
In the file: `lua/custom/plugins/filetree.lua`, add:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
-- File: lua/custom/plugins/filetree.lua
|
||||||
|
|
||||||
|
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",
|
||||||
|
},
|
||||||
|
config = function ()
|
||||||
|
require('neo-tree').setup {}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
### Getting Started
|
### Getting Started
|
||||||
|
|
||||||
@@ -130,9 +170,9 @@ examples of adding popularly requested plugins.
|
|||||||
|
|
||||||
### FAQ
|
### FAQ
|
||||||
|
|
||||||
* What should I do if I already have a pre-existing Neovim configuration?
|
* What should I do if I already have a pre-existing neovim configuration?
|
||||||
* You should back it up and then delete all associated files.
|
* You should back it up and then delete all associated files.
|
||||||
* This includes your existing init.lua and the Neovim files in `~/.local`
|
* This includes your existing init.lua and the neovim files in `~/.local`
|
||||||
which can be deleted with `rm -rf ~/.local/share/nvim/`
|
which can be deleted with `rm -rf ~/.local/share/nvim/`
|
||||||
* Can I keep my existing configuration in parallel to kickstart?
|
* 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`
|
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME`
|
||||||
@@ -146,7 +186,7 @@ examples of adding popularly requested plugins.
|
|||||||
`~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim
|
`~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim
|
||||||
distribution that you would like to try out.
|
distribution that you would like to try out.
|
||||||
* What if I want to "uninstall" this configuration:
|
* What if I want to "uninstall" this configuration:
|
||||||
* See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information
|
* 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?
|
* 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
|
* 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.
|
configuration that someone can easily use to `git clone` as a basis for their own.
|
||||||
@@ -162,7 +202,7 @@ examples of adding popularly requested plugins.
|
|||||||
|
|
||||||
Below you can find OS specific install instructions for Neovim and dependencies.
|
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.
|
After installing all the dependencies continue with the [Install Kickstart](#Install-Kickstart) step.
|
||||||
|
|
||||||
#### Windows Installation
|
#### Windows Installation
|
||||||
|
|
||||||
@@ -190,10 +230,10 @@ run in cmd as **admin**:
|
|||||||
winget install --accept-source-agreements chocolatey.chocolatey
|
winget install --accept-source-agreements chocolatey.chocolatey
|
||||||
```
|
```
|
||||||
|
|
||||||
2. install all requirements using choco, exit the previous cmd and
|
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**:
|
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 tree-sitter
|
choco install -y neovim git ripgrep wget fd unzip gzip mingw make
|
||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
<details><summary>WSL (Windows Subsystem for Linux)</summary>
|
<details><summary>WSL (Windows Subsystem for Linux)</summary>
|
||||||
@@ -203,7 +243,7 @@ wsl --install
|
|||||||
wsl
|
wsl
|
||||||
sudo add-apt-repository ppa:neovim-ppa/unstable -y
|
sudo add-apt-repository ppa:neovim-ppa/unstable -y
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install make gcc ripgrep fd-find tree-sitter-cli unzip git xclip neovim
|
sudo apt install make gcc ripgrep unzip neovim
|
||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
@@ -213,111 +253,30 @@ sudo apt install make gcc ripgrep fd-find tree-sitter-cli unzip git xclip neovim
|
|||||||
```
|
```
|
||||||
sudo add-apt-repository ppa:neovim-ppa/unstable -y
|
sudo add-apt-repository ppa:neovim-ppa/unstable -y
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install make gcc ripgrep fd-find tree-sitter-cli unzip git xclip neovim
|
sudo apt install make gcc ripgrep unzip git neovim
|
||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
<details><summary>Debian Install Steps</summary>
|
<details><summary>Debian Install Steps</summary>
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install make gcc ripgrep fd-find tree-sitter-cli unzip git xclip curl
|
sudo apt install make gcc ripgrep unzip git
|
||||||
|
echo "deb https://deb.debian.org/debian unstable main" | sudo tee -a /etc/apt/sources.list
|
||||||
# Now we install nvim
|
sudo apt update
|
||||||
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz
|
sudo apt install -t unstable neovim
|
||||||
sudo rm -rf /opt/nvim-linux-x86_64
|
|
||||||
sudo mkdir -p /opt/nvim-linux-x86_64
|
|
||||||
sudo chmod a+rX /opt/nvim-linux-x86_64
|
|
||||||
sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz
|
|
||||||
|
|
||||||
# make it available in /usr/local/bin, distro installs to /usr/bin
|
|
||||||
sudo ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/
|
|
||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
<details><summary>Fedora Install Steps</summary>
|
<details><summary>Fedora Install Steps</summary>
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo dnf install -y gcc make git ripgrep fd-find tree-sitter-cli unzip neovim
|
sudo dnf install -y gcc make git ripgrep fd-find unzip neovim
|
||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details><summary>Arch Install Steps</summary>
|
<details><summary>Arch Install Steps</summary>
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo pacman -S --noconfirm --needed gcc make git ripgrep fd tree-sitter-cli unzip neovim
|
sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim
|
||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
### Alternative neovim installation methods
|
|
||||||
|
|
||||||
For some systems it is not unexpected that the [package manager installation
|
|
||||||
method](https://github.com/neovim/neovim/blob/master/INSTALL.md#install-from-package)
|
|
||||||
recommended by neovim is significantly behind. If that is the case for you,
|
|
||||||
pick one of the following methods that are known to deliver fresh neovim versions very quickly.
|
|
||||||
They have been picked for their popularity and because they make installing and updating
|
|
||||||
neovim to the latest versions easy. You can also find more detail about the
|
|
||||||
available methods being discussed
|
|
||||||
[here](https://github.com/nvim-lua/kickstart.nvim/issues/1583).
|
|
||||||
|
|
||||||
|
|
||||||
<details><summary>Bob</summary>
|
|
||||||
|
|
||||||
[Bob](https://github.com/MordechaiHadad/bob) is a Neovim version manager for
|
|
||||||
all platforms. Simply install
|
|
||||||
[rustup](https://rust-lang.github.io/rustup/installation/other.html),
|
|
||||||
and run the following commands:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
rustup default stable
|
|
||||||
rustup update stable
|
|
||||||
cargo install bob-nvim
|
|
||||||
bob use stable
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details><summary>Homebrew</summary>
|
|
||||||
|
|
||||||
[Homebrew](https://brew.sh) is a package manager popular on Mac and Linux.
|
|
||||||
Simply install using [`brew install`](https://formulae.brew.sh/formula/neovim).
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details><summary>Flatpak</summary>
|
|
||||||
|
|
||||||
Flatpak is a package manager for applications that allows developers to package their applications
|
|
||||||
just once to make it available on all Linux systems. Simply [install flatpak](https://flatpak.org/setup/)
|
|
||||||
and setup [flathub](https://flathub.org/setup) to [install neovim](https://flathub.org/apps/io.neovim.nvim).
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details><summary>asdf and mise-en-place</summary>
|
|
||||||
|
|
||||||
[asdf](https://asdf-vm.com/) and [mise](https://mise.jdx.dev/) are tool version managers,
|
|
||||||
mostly aimed towards project-specific tool versioning. However both support managing tools
|
|
||||||
globally in the user-space as well:
|
|
||||||
|
|
||||||
<details><summary>mise</summary>
|
|
||||||
|
|
||||||
[Install mise](https://mise.jdx.dev/getting-started.html), then run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mise plugins install neovim
|
|
||||||
mise use neovim@stable
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details><summary>asdf</summary>
|
|
||||||
|
|
||||||
[Install asdf](https://asdf-vm.com/guide/getting-started.html), then run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
asdf plugin add neovim
|
|
||||||
asdf install neovim stable
|
|
||||||
asdf set neovim stable --home
|
|
||||||
asdf reshim neovim
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|||||||
674
init.lua
674
init.lua
@@ -94,99 +94,77 @@ vim.g.maplocalleader = ' '
|
|||||||
vim.g.have_nerd_font = false
|
vim.g.have_nerd_font = false
|
||||||
|
|
||||||
-- [[ Setting options ]]
|
-- [[ Setting options ]]
|
||||||
-- See `:help vim.o`
|
-- See `:help vim.opt`
|
||||||
-- NOTE: You can change these options as you wish!
|
-- NOTE: You can change these options as you wish!
|
||||||
-- For more options, you can see `:help option-list`
|
-- For more options, you can see `:help option-list`
|
||||||
|
|
||||||
-- Make line numbers default
|
-- Make line numbers default
|
||||||
vim.o.number = true
|
vim.opt.number = true
|
||||||
-- You can also add relative line numbers, to help with jumping.
|
-- You can also add relative line numbers, to help with jumping.
|
||||||
-- Experiment for yourself to see if you like it!
|
-- Experiment for yourself to see if you like it!
|
||||||
-- vim.o.relativenumber = true
|
-- vim.opt.relativenumber = true
|
||||||
|
|
||||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||||
vim.o.mouse = 'a'
|
vim.opt.mouse = 'a'
|
||||||
|
|
||||||
-- Don't show the mode, since it's already in the status line
|
-- Don't show the mode, since it's already in the status line
|
||||||
vim.o.showmode = false
|
vim.opt.showmode = false
|
||||||
|
|
||||||
-- Sync clipboard between OS and Neovim.
|
-- Sync clipboard between OS and Neovim.
|
||||||
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
|
||||||
-- Remove this option if you want your OS clipboard to remain independent.
|
-- Remove this option if you want your OS clipboard to remain independent.
|
||||||
-- See `:help 'clipboard'`
|
-- See `:help 'clipboard'`
|
||||||
vim.schedule(function() vim.o.clipboard = 'unnamedplus' end)
|
vim.opt.clipboard = 'unnamedplus'
|
||||||
|
|
||||||
-- Enable break indent
|
-- Enable break indent
|
||||||
vim.o.breakindent = true
|
vim.opt.breakindent = true
|
||||||
|
|
||||||
-- Enable undo/redo changes even after closing and reopening a file
|
-- Save undo history
|
||||||
vim.o.undofile = true
|
vim.opt.undofile = true
|
||||||
|
|
||||||
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||||
vim.o.ignorecase = true
|
vim.opt.ignorecase = true
|
||||||
vim.o.smartcase = true
|
vim.opt.smartcase = true
|
||||||
|
|
||||||
-- Keep signcolumn on by default
|
-- Keep signcolumn on by default
|
||||||
vim.o.signcolumn = 'yes'
|
vim.opt.signcolumn = 'yes'
|
||||||
|
|
||||||
-- Decrease update time
|
-- Decrease update time
|
||||||
vim.o.updatetime = 250
|
vim.opt.updatetime = 250
|
||||||
|
|
||||||
-- Decrease mapped sequence wait time
|
-- Decrease mapped sequence wait time
|
||||||
vim.o.timeoutlen = 300
|
-- Displays which-key popup sooner
|
||||||
|
vim.opt.timeoutlen = 300
|
||||||
|
|
||||||
-- Configure how new splits should be opened
|
-- Configure how new splits should be opened
|
||||||
vim.o.splitright = true
|
vim.opt.splitright = true
|
||||||
vim.o.splitbelow = true
|
vim.opt.splitbelow = true
|
||||||
|
|
||||||
-- Sets how neovim will display certain whitespace characters in the editor.
|
-- Sets how neovim will display certain whitespace characters in the editor.
|
||||||
-- See `:help 'list'`
|
-- See `:help 'list'`
|
||||||
-- and `:help 'listchars'`
|
-- and `:help 'listchars'`
|
||||||
--
|
vim.opt.list = true
|
||||||
-- Notice listchars is set using `vim.opt` instead of `vim.o`.
|
|
||||||
-- It is very similar to `vim.o` but offers an interface for conveniently interacting with tables.
|
|
||||||
-- See `:help lua-options`
|
|
||||||
-- and `:help lua-guide-options`
|
|
||||||
vim.o.list = true
|
|
||||||
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
||||||
|
|
||||||
-- Preview substitutions live, as you type!
|
-- Preview substitutions live, as you type!
|
||||||
vim.o.inccommand = 'split'
|
vim.opt.inccommand = 'split'
|
||||||
|
|
||||||
-- Show which line your cursor is on
|
-- Show which line your cursor is on
|
||||||
vim.o.cursorline = true
|
vim.opt.cursorline = true
|
||||||
|
|
||||||
-- Minimal number of screen lines to keep above and below the cursor.
|
-- Minimal number of screen lines to keep above and below the cursor.
|
||||||
vim.o.scrolloff = 10
|
vim.opt.scrolloff = 10
|
||||||
|
|
||||||
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
|
|
||||||
-- instead raise a dialog asking if you wish to save the current file(s)
|
|
||||||
-- See `:help 'confirm'`
|
|
||||||
vim.o.confirm = true
|
|
||||||
|
|
||||||
-- [[ Basic Keymaps ]]
|
-- [[ Basic Keymaps ]]
|
||||||
-- See `:help vim.keymap.set()`
|
-- See `:help vim.keymap.set()`
|
||||||
|
|
||||||
-- Clear highlights on search when pressing <Esc> in normal mode
|
-- Set highlight on search, but clear on pressing <Esc> in normal mode
|
||||||
-- See `:help hlsearch`
|
vim.opt.hlsearch = true
|
||||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||||
|
|
||||||
-- Diagnostic Config & Keymaps
|
-- Diagnostic keymaps
|
||||||
-- See :help vim.diagnostic.Opts
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
|
||||||
vim.diagnostic.config {
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
|
||||||
update_in_insert = false,
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
|
||||||
severity_sort = true,
|
|
||||||
float = { border = 'rounded', source = 'if_many' },
|
|
||||||
underline = { severity = { min = vim.diagnostic.severity.WARN } },
|
|
||||||
|
|
||||||
-- Can switch between these as you prefer
|
|
||||||
virtual_text = true, -- Text shows up at the end of the line
|
|
||||||
virtual_lines = false, -- Text shows up underneath the line, with virtual lines
|
|
||||||
|
|
||||||
-- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d`
|
|
||||||
jump = { float = true },
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||||
|
|
||||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||||
@@ -212,36 +190,28 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
|
|||||||
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower 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' })
|
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||||
|
|
||||||
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
|
|
||||||
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
|
|
||||||
-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
|
|
||||||
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
|
|
||||||
-- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })
|
|
||||||
|
|
||||||
-- [[ Basic Autocommands ]]
|
-- [[ Basic Autocommands ]]
|
||||||
-- See `:help lua-guide-autocommands`
|
-- See `:help lua-guide-autocommands`
|
||||||
|
|
||||||
-- Highlight when yanking (copying) text
|
-- Highlight when yanking (copying) text
|
||||||
-- Try it with `yap` in normal mode
|
-- Try it with `yap` in normal mode
|
||||||
-- See `:help vim.hl.on_yank()`
|
-- See `:help vim.highlight.on_yank()`
|
||||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
desc = 'Highlight when yanking (copying) text',
|
desc = 'Highlight when yanking (copying) text',
|
||||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||||
callback = function() vim.hl.on_yank() end,
|
callback = function()
|
||||||
|
vim.highlight.on_yank()
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- [[ Install `lazy.nvim` plugin manager ]]
|
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||||
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
||||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||||
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
||||||
if vim.v.shell_error ~= 0 then error('Error cloning lazy.nvim:\n' .. out) end
|
end ---@diagnostic disable-next-line: undefined-field
|
||||||
end
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
---@type vim.Option
|
|
||||||
local rtp = vim.opt.rtp
|
|
||||||
rtp:prepend(lazypath)
|
|
||||||
|
|
||||||
-- [[ Configure and install plugins ]]
|
-- [[ Configure and install plugins ]]
|
||||||
--
|
--
|
||||||
@@ -255,36 +225,35 @@ rtp:prepend(lazypath)
|
|||||||
--
|
--
|
||||||
-- NOTE: Here is where you install your plugins.
|
-- NOTE: Here is where you install your plugins.
|
||||||
require('lazy').setup({
|
require('lazy').setup({
|
||||||
-- NOTE: Plugins can be added via a link or github org/name. To run setup automatically, use `opts = {}`
|
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
||||||
{ 'NMAC427/guess-indent.nvim', opts = {} },
|
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
||||||
|
|
||||||
-- Alternatively, use `config = function() ... end` for full control over the configuration.
|
-- NOTE: Plugins can also be added by using a table,
|
||||||
-- If you prefer to call `setup` explicitly, use:
|
-- with the first argument being the link and the following
|
||||||
-- {
|
-- keys can be used to configure plugin behavior/loading/etc.
|
||||||
-- 'lewis6991/gitsigns.nvim',
|
|
||||||
-- config = function()
|
|
||||||
-- require('gitsigns').setup({
|
|
||||||
-- -- Your gitsigns configuration here
|
|
||||||
-- })
|
|
||||||
-- end,
|
|
||||||
-- }
|
|
||||||
--
|
--
|
||||||
|
-- Use `opts = {}` to force a plugin to be loaded.
|
||||||
|
--
|
||||||
|
-- This is equivalent to:
|
||||||
|
-- require('Comment').setup({})
|
||||||
|
|
||||||
|
-- "gc" to comment visual regions/lines
|
||||||
|
{ 'numToStr/Comment.nvim', opts = {} },
|
||||||
|
|
||||||
-- Here is a more advanced example where we pass configuration
|
-- Here is a more advanced example where we pass configuration
|
||||||
-- options to `gitsigns.nvim`.
|
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
|
||||||
|
-- require('gitsigns').setup({ ... })
|
||||||
--
|
--
|
||||||
-- See `:help gitsigns` to understand what the configuration keys do
|
-- See `:help gitsigns` to understand what the configuration keys do
|
||||||
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
|
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||||
'lewis6991/gitsigns.nvim',
|
'lewis6991/gitsigns.nvim',
|
||||||
---@module 'gitsigns'
|
|
||||||
---@type Gitsigns.Config
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
|
||||||
opts = {
|
opts = {
|
||||||
signs = {
|
signs = {
|
||||||
add = { text = '+' }, ---@diagnostic disable-line: missing-fields
|
add = { text = '+' },
|
||||||
change = { text = '~' }, ---@diagnostic disable-line: missing-fields
|
change = { text = '~' },
|
||||||
delete = { text = '_' }, ---@diagnostic disable-line: missing-fields
|
delete = { text = '_' },
|
||||||
topdelete = { text = '‾' }, ---@diagnostic disable-line: missing-fields
|
topdelete = { text = '‾' },
|
||||||
changedelete = { text = '~' }, ---@diagnostic disable-line: missing-fields
|
changedelete = { text = '~' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -300,28 +269,25 @@ require('lazy').setup({
|
|||||||
-- which loads which-key before all the UI elements are loaded. Events can be
|
-- which loads which-key before all the UI elements are loaded. Events can be
|
||||||
-- normal autocommands events (`:help autocmd-events`).
|
-- normal autocommands events (`:help autocmd-events`).
|
||||||
--
|
--
|
||||||
-- Then, because we use the `opts` key (recommended), the configuration runs
|
-- Then, because we use the `config` key, the configuration only runs
|
||||||
-- after the plugin has been loaded as `require(MODULE).setup(opts)`.
|
-- after the plugin has been loaded:
|
||||||
|
-- config = function() ... end
|
||||||
|
|
||||||
{ -- Useful plugin to show you pending keybinds.
|
{ -- Useful plugin to show you pending keybinds.
|
||||||
'folke/which-key.nvim',
|
'folke/which-key.nvim',
|
||||||
event = 'VimEnter',
|
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
||||||
---@module 'which-key'
|
config = function() -- This is the function that runs, AFTER loading
|
||||||
---@type wk.Opts
|
require('which-key').setup()
|
||||||
---@diagnostic disable-next-line: missing-fields
|
|
||||||
opts = {
|
|
||||||
-- delay between pressing a key and opening which-key (milliseconds)
|
|
||||||
delay = 0,
|
|
||||||
icons = { mappings = vim.g.have_nerd_font },
|
|
||||||
|
|
||||||
-- Document existing key chains
|
-- Document existing key chains
|
||||||
spec = {
|
require('which-key').register {
|
||||||
{ '<leader>s', group = '[S]earch', mode = { 'n', 'v' } },
|
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
|
||||||
{ '<leader>t', group = '[T]oggle' },
|
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
|
||||||
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } }, -- Enable gitsigns recommended keymaps first
|
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
||||||
{ 'gr', group = 'LSP Actions', mode = { 'n' } },
|
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
||||||
},
|
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
||||||
},
|
}
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- NOTE: Plugins can specify dependencies.
|
-- NOTE: Plugins can specify dependencies.
|
||||||
@@ -333,17 +299,8 @@ require('lazy').setup({
|
|||||||
|
|
||||||
{ -- Fuzzy Finder (files, lsp, etc)
|
{ -- Fuzzy Finder (files, lsp, etc)
|
||||||
'nvim-telescope/telescope.nvim',
|
'nvim-telescope/telescope.nvim',
|
||||||
-- By default, Telescope is included and acts as your picker for everything.
|
|
||||||
|
|
||||||
-- If you would like to switch to a different picker (like snacks, or fzf-lua)
|
|
||||||
-- you can disable the Telescope plugin by setting enabled to false and enable
|
|
||||||
-- your replacement picker by requiring it explicitly (e.g. 'custom.plugins.snacks')
|
|
||||||
|
|
||||||
-- Note: If you customize your config for yourself,
|
|
||||||
-- it’s best to remove the Telescope plugin config entirely
|
|
||||||
-- instead of just disabling it here, to keep your config clean.
|
|
||||||
enabled = true,
|
|
||||||
event = 'VimEnter',
|
event = 'VimEnter',
|
||||||
|
branch = '0.1.x',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
||||||
@@ -355,7 +312,9 @@ require('lazy').setup({
|
|||||||
|
|
||||||
-- `cond` is a condition used to determine whether this plugin should be
|
-- `cond` is a condition used to determine whether this plugin should be
|
||||||
-- installed and loaded.
|
-- installed and loaded.
|
||||||
cond = function() return vim.fn.executable 'make' == 1 end,
|
cond = function()
|
||||||
|
return vim.fn.executable 'make' == 1
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
||||||
|
|
||||||
@@ -395,7 +354,9 @@ require('lazy').setup({
|
|||||||
-- },
|
-- },
|
||||||
-- pickers = {}
|
-- pickers = {}
|
||||||
extensions = {
|
extensions = {
|
||||||
['ui-select'] = { require('telescope.themes').get_dropdown() },
|
['ui-select'] = {
|
||||||
|
require('telescope.themes').get_dropdown(),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,49 +370,14 @@ require('lazy').setup({
|
|||||||
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||||
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||||
vim.keymap.set({ 'n', 'v' }, '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
||||||
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||||
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||||
vim.keymap.set('n', '<leader>sc', builtin.commands, { desc = '[S]earch [C]ommands' })
|
|
||||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||||
|
|
||||||
-- This runs on LSP attach per buffer (see main LSP attach function in 'neovim/nvim-lspconfig' config for more info,
|
-- Slightly advanced example of overriding default behavior and theme
|
||||||
-- it is better explained there). This allows easily switching between pickers if you prefer using something else!
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
|
||||||
group = vim.api.nvim_create_augroup('telescope-lsp-attach', { clear = true }),
|
|
||||||
callback = function(event)
|
|
||||||
local buf = event.buf
|
|
||||||
|
|
||||||
-- Find references for the word under your cursor.
|
|
||||||
vim.keymap.set('n', 'grr', builtin.lsp_references, { buffer = buf, desc = '[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.
|
|
||||||
vim.keymap.set('n', 'gri', builtin.lsp_implementations, { buffer = buf, desc = '[G]oto [I]mplementation' })
|
|
||||||
|
|
||||||
-- 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>.
|
|
||||||
vim.keymap.set('n', 'grd', builtin.lsp_definitions, { buffer = buf, desc = '[G]oto [D]efinition' })
|
|
||||||
|
|
||||||
-- Fuzzy find all the symbols in your current document.
|
|
||||||
-- Symbols are things like variables, functions, types, etc.
|
|
||||||
vim.keymap.set('n', 'gO', builtin.lsp_document_symbols, { buffer = buf, desc = 'Open Document Symbols' })
|
|
||||||
|
|
||||||
-- Fuzzy find all the symbols in your current workspace.
|
|
||||||
-- Similar to document symbols, except searches over your entire project.
|
|
||||||
vim.keymap.set('n', 'gW', builtin.lsp_dynamic_workspace_symbols, { buffer = buf, desc = 'Open Workspace Symbols' })
|
|
||||||
|
|
||||||
-- Jump to the type of the word under your cursor.
|
|
||||||
-- Useful when you're not sure what type a variable is and you want to see
|
|
||||||
-- the definition of its *type*, not where it was *defined*.
|
|
||||||
vim.keymap.set('n', 'grt', builtin.lsp_type_definitions, { buffer = buf, desc = '[G]oto [T]ype Definition' })
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Override default behavior and theme when searching
|
|
||||||
vim.keymap.set('n', '<leader>/', function()
|
vim.keymap.set('n', '<leader>/', function()
|
||||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||||
@@ -462,44 +388,35 @@ require('lazy').setup({
|
|||||||
|
|
||||||
-- It's also possible to pass additional configuration options.
|
-- It's also possible to pass additional configuration options.
|
||||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||||
vim.keymap.set(
|
vim.keymap.set('n', '<leader>s/', function()
|
||||||
'n',
|
|
||||||
'<leader>s/',
|
|
||||||
function()
|
|
||||||
builtin.live_grep {
|
builtin.live_grep {
|
||||||
grep_open_files = true,
|
grep_open_files = true,
|
||||||
prompt_title = 'Live Grep in Open Files',
|
prompt_title = 'Live Grep in Open Files',
|
||||||
}
|
}
|
||||||
end,
|
end, { desc = '[S]earch [/] in Open Files' })
|
||||||
{ desc = '[S]earch [/] in Open Files' }
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Shortcut for searching your Neovim configuration files
|
-- Shortcut for searching your Neovim configuration files
|
||||||
vim.keymap.set('n', '<leader>sn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[S]earch [N]eovim files' })
|
vim.keymap.set('n', '<leader>sn', function()
|
||||||
|
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
||||||
|
end, { desc = '[S]earch [N]eovim files' })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- LSP Plugins
|
{ -- LSP Configuration & Plugins
|
||||||
{
|
|
||||||
-- Main LSP Configuration
|
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Automatically install LSPs and related tools to stdpath for Neovim
|
-- Automatically install LSPs and related tools to stdpath for Neovim
|
||||||
-- Mason must be loaded before its dependents so we need to set it up here.
|
'williamboman/mason.nvim',
|
||||||
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
|
'williamboman/mason-lspconfig.nvim',
|
||||||
{
|
|
||||||
'mason-org/mason.nvim',
|
|
||||||
---@module 'mason.settings'
|
|
||||||
---@type MasonSettings
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
-- Maps LSP server names between nvim-lspconfig and Mason package names.
|
|
||||||
'mason-org/mason-lspconfig.nvim',
|
|
||||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||||
|
|
||||||
-- Useful status updates for LSP.
|
-- Useful status updates for LSP.
|
||||||
|
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||||
{ 'j-hui/fidget.nvim', opts = {} },
|
{ 'j-hui/fidget.nvim', opts = {} },
|
||||||
|
|
||||||
|
-- `neodev` configures Lua LSP for your Neovim config, runtime and plugins
|
||||||
|
-- used for completion, annotations and signatures of Neovim apis
|
||||||
|
{ 'folke/neodev.nvim', opts = {} },
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- Brief aside: **What is LSP?**
|
-- Brief aside: **What is LSP?**
|
||||||
@@ -539,22 +456,50 @@ require('lazy').setup({
|
|||||||
--
|
--
|
||||||
-- In this case, we create a function that lets us more easily define mappings specific
|
-- 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.
|
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
||||||
local map = function(keys, func, desc, mode)
|
local map = function(keys, func, desc)
|
||||||
mode = mode or 'n'
|
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
||||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
|
||||||
end
|
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')
|
||||||
|
|
||||||
|
-- Jump to the type of the word under your cursor.
|
||||||
|
-- Useful when you're not sure what type a variable is and you want to see
|
||||||
|
-- the definition of its *type*, not where it was *defined*.
|
||||||
|
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
||||||
|
|
||||||
|
-- Fuzzy find all the symbols in your current document.
|
||||||
|
-- Symbols are things like variables, functions, types, etc.
|
||||||
|
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||||
|
|
||||||
|
-- Fuzzy find all the symbols in your current workspace.
|
||||||
|
-- Similar to document symbols, except searches over your entire project.
|
||||||
|
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||||
|
|
||||||
-- Rename the variable under your cursor.
|
-- Rename the variable under your cursor.
|
||||||
-- Most Language Servers support renaming across files, etc.
|
-- Most Language Servers support renaming across files, etc.
|
||||||
map('grn', vim.lsp.buf.rename, '[R]e[n]ame')
|
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||||
|
|
||||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
-- 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.
|
-- or a suggestion from your LSP for this to activate.
|
||||||
map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
|
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [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.
|
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||||
-- For example, in C this would take you to the header.
|
-- For example, in C this would take you to the header.
|
||||||
map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||||
|
|
||||||
-- The following two autocommands are used to highlight references of the
|
-- The following two autocommands are used to highlight references of the
|
||||||
-- word under your cursor when your cursor rests there for a little while.
|
-- word under your cursor when your cursor rests there for a little while.
|
||||||
@@ -562,122 +507,110 @@ require('lazy').setup({
|
|||||||
--
|
--
|
||||||
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
-- 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)
|
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||||
if client and client:supports_method('textDocument/documentHighlight', event.buf) then
|
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' }, {
|
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||||
buffer = event.buf,
|
buffer = event.buf,
|
||||||
group = highlight_augroup,
|
|
||||||
callback = vim.lsp.buf.document_highlight,
|
callback = vim.lsp.buf.document_highlight,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
||||||
buffer = event.buf,
|
buffer = event.buf,
|
||||||
group = highlight_augroup,
|
|
||||||
callback = vim.lsp.buf.clear_references,
|
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 code creates a keymap to toggle 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:supports_method('textDocument/inlayHint', event.buf) then
|
|
||||||
map('<leader>th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints')
|
|
||||||
end
|
end
|
||||||
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
|
-- Enable the following language servers
|
||||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||||
-- See `:help lsp-config` for information about keys and how to configure
|
--
|
||||||
---@type table<string, vim.lsp.Config>
|
-- 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 = {
|
local servers = {
|
||||||
-- clangd = {},
|
-- clangd = {},
|
||||||
-- gopls = {},
|
-- gopls = {},
|
||||||
-- pyright = {},
|
-- pyright = {},
|
||||||
-- rust_analyzer = {},
|
-- 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:
|
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||||
-- https://github.com/pmizio/typescript-tools.nvim
|
-- https://github.com/pmizio/typescript-tools.nvim
|
||||||
--
|
--
|
||||||
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
-- But for many setups, the LSP (`tsserver`) will work just fine
|
||||||
-- ts_ls = {},
|
-- tsserver = {},
|
||||||
|
--
|
||||||
|
|
||||||
stylua = {}, -- Used to format Lua code
|
|
||||||
|
|
||||||
-- Special Lua Config, as recommended by neovim help docs
|
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
on_init = function(client)
|
-- cmd = {...},
|
||||||
if client.workspace_folders then
|
-- filetypes = { ...},
|
||||||
local path = client.workspace_folders[1].name
|
-- capabilities = {},
|
||||||
if path ~= vim.fn.stdpath 'config' and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc')) then return end
|
|
||||||
end
|
|
||||||
|
|
||||||
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
|
||||||
runtime = {
|
|
||||||
version = 'LuaJIT',
|
|
||||||
path = { 'lua/?.lua', 'lua/?/init.lua' },
|
|
||||||
},
|
|
||||||
workspace = {
|
|
||||||
checkThirdParty = false,
|
|
||||||
-- NOTE: this is a lot slower and will cause issues when working on your own configuration.
|
|
||||||
-- See https://github.com/neovim/nvim-lspconfig/issues/3189
|
|
||||||
library = vim.tbl_extend('force', vim.api.nvim_get_runtime_file('', true), {
|
|
||||||
'${3rd}/luv/library',
|
|
||||||
'${3rd}/busted/library',
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {},
|
Lua = {
|
||||||
|
completion = {
|
||||||
|
callSnippet = 'Replace',
|
||||||
|
},
|
||||||
|
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||||
|
-- diagnostics = { disable = { 'missing-fields' } },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Ensure the servers and tools above are installed
|
-- Ensure the servers and tools above are installed
|
||||||
--
|
|
||||||
-- To check the current status of installed tools and/or manually install
|
-- To check the current status of installed tools and/or manually install
|
||||||
-- other tools, you can run
|
-- other tools, you can run
|
||||||
-- :Mason
|
-- :Mason
|
||||||
--
|
--
|
||||||
-- You can press `g?` for help in this menu.
|
-- 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 {})
|
local ensure_installed = vim.tbl_keys(servers or {})
|
||||||
vim.list_extend(ensure_installed, {
|
vim.list_extend(ensure_installed, {
|
||||||
-- You can add other tools here that you want Mason to install
|
'stylua', -- Used to format Lua code
|
||||||
})
|
})
|
||||||
|
|
||||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||||
|
|
||||||
for name, server in pairs(servers) do
|
require('mason-lspconfig').setup {
|
||||||
vim.lsp.config(name, server)
|
handlers = {
|
||||||
vim.lsp.enable(name)
|
function(server_name)
|
||||||
end
|
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,
|
||||||
|
},
|
||||||
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Autoformat
|
{ -- Autoformat
|
||||||
'stevearc/conform.nvim',
|
'stevearc/conform.nvim',
|
||||||
event = { 'BufWritePre' },
|
lazy = false,
|
||||||
cmd = { 'ConformInfo' },
|
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
'<leader>f',
|
'<leader>f',
|
||||||
function() require('conform').format { async = true, lsp_format = 'fallback' } end,
|
function()
|
||||||
|
require('conform').format { async = true, lsp_fallback = true }
|
||||||
|
end,
|
||||||
mode = '',
|
mode = '',
|
||||||
desc = '[F]ormat buffer',
|
desc = '[F]ormat buffer',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
---@module 'conform'
|
|
||||||
---@type conform.setupOpts
|
|
||||||
opts = {
|
opts = {
|
||||||
notify_on_error = false,
|
notify_on_error = false,
|
||||||
format_on_save = function(bufnr)
|
format_on_save = function(bufnr)
|
||||||
@@ -685,40 +618,37 @@ require('lazy').setup({
|
|||||||
-- have a well standardized coding style. You can add additional
|
-- have a well standardized coding style. You can add additional
|
||||||
-- languages here or re-enable it for the disabled ones.
|
-- languages here or re-enable it for the disabled ones.
|
||||||
local disable_filetypes = { c = true, cpp = true }
|
local disable_filetypes = { c = true, cpp = true }
|
||||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
|
||||||
return nil
|
|
||||||
else
|
|
||||||
return {
|
return {
|
||||||
timeout_ms = 500,
|
timeout_ms = 500,
|
||||||
lsp_format = 'fallback',
|
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
||||||
}
|
}
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { 'stylua' },
|
lua = { 'stylua' },
|
||||||
-- Conform can also run multiple formatters sequentially
|
-- Conform can also run multiple formatters sequentially
|
||||||
-- python = { "isort", "black" },
|
-- python = { "isort", "black" },
|
||||||
--
|
--
|
||||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
-- You can use a sub-list to tell conform to run *until* a formatter
|
||||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
-- is found.
|
||||||
|
-- javascript = { { "prettierd", "prettier" } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Autocompletion
|
{ -- Autocompletion
|
||||||
'saghen/blink.cmp',
|
'hrsh7th/nvim-cmp',
|
||||||
event = 'VimEnter',
|
event = 'InsertEnter',
|
||||||
version = '1.*',
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Snippet Engine
|
-- Snippet Engine & its associated nvim-cmp source
|
||||||
{
|
{
|
||||||
'L3MON4D3/LuaSnip',
|
'L3MON4D3/LuaSnip',
|
||||||
version = '2.*',
|
|
||||||
build = (function()
|
build = (function()
|
||||||
-- Build Step is needed for regex support in snippets.
|
-- Build Step is needed for regex support in snippets.
|
||||||
-- This step is not supported in many windows environments.
|
-- This step is not supported in many windows environments.
|
||||||
-- Remove the below condition to re-enable on windows.
|
-- Remove the below condition to re-enable on windows.
|
||||||
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then return end
|
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
return 'make install_jsregexp'
|
return 'make install_jsregexp'
|
||||||
end)(),
|
end)(),
|
||||||
dependencies = {
|
dependencies = {
|
||||||
@@ -732,70 +662,82 @@ require('lazy').setup({
|
|||||||
-- end,
|
-- end,
|
||||||
-- },
|
-- },
|
||||||
},
|
},
|
||||||
opts = {},
|
|
||||||
},
|
},
|
||||||
|
'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',
|
||||||
},
|
},
|
||||||
---@module 'blink.cmp'
|
config = function()
|
||||||
---@type blink.cmp.Config
|
-- See `:help cmp`
|
||||||
opts = {
|
local cmp = require 'cmp'
|
||||||
keymap = {
|
local luasnip = require 'luasnip'
|
||||||
-- 'default' (recommended) for mappings similar to built-in completions
|
luasnip.config.setup {}
|
||||||
-- <c-y> to accept ([y]es) the completion.
|
|
||||||
-- This will auto-import if your LSP supports it.
|
cmp.setup {
|
||||||
-- This will expand snippets if the LSP sent a snippet.
|
snippet = {
|
||||||
-- 'super-tab' for tab to accept
|
expand = function(args)
|
||||||
-- 'enter' for enter to accept
|
luasnip.lsp_expand(args.body)
|
||||||
-- 'none' for no mappings
|
end,
|
||||||
--
|
},
|
||||||
-- For an understanding of why the 'default' preset is recommended,
|
completion = { completeopt = 'menu,menuone,noinsert' },
|
||||||
-- you will need to read `:help ins-completion`
|
|
||||||
|
-- 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!
|
-- 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 },
|
||||||
|
|
||||||
|
-- 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
|
||||||
--
|
--
|
||||||
-- All presets have the following mappings:
|
-- <c-l> will move you to the right of each of the expansion locations.
|
||||||
-- <tab>/<s-tab>: move to right/left of your snippet expansion
|
-- <c-h> is similar, except moving you backwards.
|
||||||
-- <c-space>: Open menu or open docs if already open
|
['<C-l>'] = cmp.mapping(function()
|
||||||
-- <c-n>/<c-p> or <up>/<down>: Select next/previous item
|
if luasnip.expand_or_locally_jumpable() then
|
||||||
-- <c-e>: Hide menu
|
luasnip.expand_or_jump()
|
||||||
-- <c-k>: Toggle signature help
|
end
|
||||||
--
|
end, { 'i', 's' }),
|
||||||
-- See :h blink-cmp-config-keymap for defining your own keymap
|
['<C-h>'] = cmp.mapping(function()
|
||||||
preset = 'default',
|
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:
|
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||||
},
|
},
|
||||||
|
|
||||||
appearance = {
|
|
||||||
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
|
||||||
-- Adjusts spacing to ensure icons are aligned
|
|
||||||
nerd_font_variant = 'mono',
|
|
||||||
},
|
|
||||||
|
|
||||||
completion = {
|
|
||||||
-- By default, you may press `<c-space>` to show the documentation.
|
|
||||||
-- Optionally, set `auto_show = true` to show the documentation after a delay.
|
|
||||||
documentation = { auto_show = false, auto_show_delay_ms = 500 },
|
|
||||||
},
|
|
||||||
|
|
||||||
sources = {
|
sources = {
|
||||||
default = { 'lsp', 'path', 'snippets' },
|
{ name = 'nvim_lsp' },
|
||||||
},
|
{ name = 'luasnip' },
|
||||||
|
{ name = 'path' },
|
||||||
snippets = { preset = 'luasnip' },
|
|
||||||
|
|
||||||
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
|
|
||||||
-- which automatically downloads a prebuilt binary when enabled.
|
|
||||||
--
|
|
||||||
-- By default, we use the Lua implementation instead, but you may enable
|
|
||||||
-- the rust implementation via `'prefer_rust_with_warning'`
|
|
||||||
--
|
|
||||||
-- See :h blink-cmp-config-fuzzy for more information
|
|
||||||
fuzzy = { implementation = 'lua' },
|
|
||||||
|
|
||||||
-- Shows a signature help window while you type arguments for a function
|
|
||||||
signature = { enabled = true },
|
|
||||||
},
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- You can easily change to a different colorscheme.
|
{ -- You can easily change to a different colorscheme.
|
||||||
@@ -805,40 +747,28 @@ require('lazy').setup({
|
|||||||
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
||||||
'folke/tokyonight.nvim',
|
'folke/tokyonight.nvim',
|
||||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||||
config = function()
|
init = function()
|
||||||
---@diagnostic disable-next-line: missing-fields
|
|
||||||
require('tokyonight').setup {
|
|
||||||
styles = {
|
|
||||||
comments = { italic = false }, -- Disable italics in comments
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Load the colorscheme here.
|
-- Load the colorscheme here.
|
||||||
-- Like many other themes, this one has different styles, and you could load
|
-- Like many other themes, this one has different styles, and you could load
|
||||||
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||||
vim.cmd.colorscheme 'tokyonight-night'
|
vim.cmd.colorscheme 'tokyonight-night'
|
||||||
|
|
||||||
|
-- You can configure highlights by doing something like:
|
||||||
|
vim.cmd.hi 'Comment gui=none'
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Highlight todo, notes, etc in comments
|
-- Highlight todo, notes, etc in comments
|
||||||
{
|
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
|
||||||
'folke/todo-comments.nvim',
|
|
||||||
event = 'VimEnter',
|
|
||||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
|
||||||
---@module 'todo-comments'
|
|
||||||
---@type TodoOptions
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
|
||||||
opts = { signs = false },
|
|
||||||
},
|
|
||||||
|
|
||||||
{ -- Collection of various small independent plugins/modules
|
{ -- Collection of various small independent plugins/modules
|
||||||
'nvim-mini/mini.nvim',
|
'echasnovski/mini.nvim',
|
||||||
config = function()
|
config = function()
|
||||||
-- Better Around/Inside textobjects
|
-- Better Around/Inside textobjects
|
||||||
--
|
--
|
||||||
-- Examples:
|
-- Examples:
|
||||||
-- - va) - [V]isually select [A]round [)]paren
|
-- - va) - [V]isually select [A]round [)]paren
|
||||||
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
|
-- - yinq - [Y]ank [I]nside [N]ext [']quote
|
||||||
-- - ci' - [C]hange [I]nside [']quote
|
-- - ci' - [C]hange [I]nside [']quote
|
||||||
require('mini.ai').setup { n_lines = 500 }
|
require('mini.ai').setup { n_lines = 500 }
|
||||||
|
|
||||||
@@ -860,67 +790,48 @@ require('lazy').setup({
|
|||||||
-- default behavior. For example, here we set the section for
|
-- default behavior. For example, here we set the section for
|
||||||
-- cursor location to LINE:COLUMN
|
-- cursor location to LINE:COLUMN
|
||||||
---@diagnostic disable-next-line: duplicate-set-field
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
statusline.section_location = function() return '%2l:%-2v' end
|
statusline.section_location = function()
|
||||||
|
return '%2l:%-2v'
|
||||||
|
end
|
||||||
|
|
||||||
-- ... and there is more!
|
-- ... and there is more!
|
||||||
-- Check out: https://github.com/nvim-mini/mini.nvim
|
-- Check out: https://github.com/echasnovski/mini.nvim
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Highlight, edit, and navigate code
|
{ -- Highlight, edit, and navigate code
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
lazy = false,
|
|
||||||
build = ':TSUpdate',
|
build = ':TSUpdate',
|
||||||
branch = 'main',
|
opts = {
|
||||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
|
ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
|
||||||
config = function()
|
-- Autoinstall languages that are not installed
|
||||||
-- ensure basic parser are installed
|
auto_install = true,
|
||||||
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
|
highlight = {
|
||||||
require('nvim-treesitter').install(parsers)
|
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`
|
||||||
|
|
||||||
---@param buf integer
|
-- Prefer git instead of curl in order to improve connectivity in some environments
|
||||||
---@param language string
|
require('nvim-treesitter.install').prefer_git = true
|
||||||
local function treesitter_try_attach(buf, language)
|
---@diagnostic disable-next-line: missing-fields
|
||||||
-- check if parser exists and load it
|
require('nvim-treesitter.configs').setup(opts)
|
||||||
if not vim.treesitter.language.add(language) then return end
|
|
||||||
-- enables syntax highlighting and other treesitter features
|
|
||||||
vim.treesitter.start(buf, language)
|
|
||||||
|
|
||||||
-- enables treesitter based folds
|
-- There are additional nvim-treesitter modules that you can use to interact
|
||||||
-- for more info on folds see `:help folds`
|
-- with nvim-treesitter. You should go explore a few and see what interests you:
|
||||||
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
--
|
||||||
-- vim.wo.foldmethod = 'expr'
|
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
|
||||||
|
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
||||||
-- enables treesitter based indentation
|
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
|
||||||
end
|
|
||||||
|
|
||||||
local available_parsers = require('nvim-treesitter').get_available()
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
|
||||||
callback = function(args)
|
|
||||||
local buf, filetype = args.buf, args.match
|
|
||||||
|
|
||||||
local language = vim.treesitter.language.get_lang(filetype)
|
|
||||||
if not language then return end
|
|
||||||
|
|
||||||
local installed_parsers = require('nvim-treesitter').get_installed 'parsers'
|
|
||||||
|
|
||||||
if vim.tbl_contains(installed_parsers, language) then
|
|
||||||
-- enable the parser if it is installed
|
|
||||||
treesitter_try_attach(buf, language)
|
|
||||||
elseif vim.tbl_contains(available_parsers, language) then
|
|
||||||
-- if a parser is available in `nvim-treesitter` auto install it, and enable it after the installation is done
|
|
||||||
require('nvim-treesitter').install(language):await(function() treesitter_try_attach(buf, language) end)
|
|
||||||
else
|
|
||||||
-- try to enable treesitter features in case the parser exists but is not available from `nvim-treesitter`
|
|
||||||
treesitter_try_attach(buf, language)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
-- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
||||||
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
||||||
-- place them in the correct locations.
|
-- place them in the correct locations.
|
||||||
|
|
||||||
@@ -932,21 +843,14 @@ require('lazy').setup({
|
|||||||
-- require 'kickstart.plugins.debug',
|
-- require 'kickstart.plugins.debug',
|
||||||
-- require 'kickstart.plugins.indent_line',
|
-- require 'kickstart.plugins.indent_line',
|
||||||
-- require 'kickstart.plugins.lint',
|
-- require 'kickstart.plugins.lint',
|
||||||
-- require 'kickstart.plugins.autopairs',
|
|
||||||
-- require 'kickstart.plugins.neo-tree',
|
|
||||||
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommended keymaps
|
|
||||||
|
|
||||||
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||||
-- This is the easiest way to modularize your config.
|
-- This is the easiest way to modularize your config.
|
||||||
--
|
--
|
||||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||||
|
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
|
||||||
-- { import = 'custom.plugins' },
|
-- { import = 'custom.plugins' },
|
||||||
--
|
}, {
|
||||||
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
|
|
||||||
-- Or use telescope!
|
|
||||||
-- In normal mode type `<space>sh` then write `lazy.nvim-plugin`
|
|
||||||
-- you can continue same window with `<space>sr` which resumes last telescope search
|
|
||||||
}, { ---@diagnostic disable-line: missing-fields
|
|
||||||
ui = {
|
ui = {
|
||||||
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
-- 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
|
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
|
||||||
|
|||||||
@@ -2,7 +2,4 @@
|
|||||||
-- I promise not to create any merge conflicts in this directory :)
|
-- I promise not to create any merge conflicts in this directory :)
|
||||||
--
|
--
|
||||||
-- See the kickstart.nvim README for more information
|
-- See the kickstart.nvim README for more information
|
||||||
|
|
||||||
---@module 'lazy'
|
|
||||||
---@type LazySpec
|
|
||||||
return {}
|
return {}
|
||||||
|
|||||||
@@ -6,13 +6,13 @@
|
|||||||
--]]
|
--]]
|
||||||
|
|
||||||
local check_version = function()
|
local check_version = function()
|
||||||
local verstr = tostring(vim.version())
|
local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch)
|
||||||
if not vim.version.ge then
|
if not vim.version.cmp then
|
||||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if vim.version.ge(vim.version(), '0.11') then
|
if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then
|
||||||
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
|
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
|
||||||
else
|
else
|
||||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
-- autopairs
|
|
||||||
-- https://github.com/windwp/nvim-autopairs
|
|
||||||
|
|
||||||
---@module 'lazy'
|
|
||||||
---@type LazySpec
|
|
||||||
return {
|
|
||||||
'windwp/nvim-autopairs',
|
|
||||||
event = 'InsertEnter',
|
|
||||||
opts = {},
|
|
||||||
}
|
|
||||||
@@ -6,8 +6,6 @@
|
|||||||
-- be extended to other languages as well. That's why it's called
|
-- be extended to other languages as well. That's why it's called
|
||||||
-- kickstart.nvim and not kitchen-sink.nvim ;)
|
-- kickstart.nvim and not kitchen-sink.nvim ;)
|
||||||
|
|
||||||
---@module 'lazy'
|
|
||||||
---@type LazySpec
|
|
||||||
return {
|
return {
|
||||||
-- NOTE: Yes, you can install new plugins here!
|
-- NOTE: Yes, you can install new plugins here!
|
||||||
'mfussenegger/nvim-dap',
|
'mfussenegger/nvim-dap',
|
||||||
@@ -20,23 +18,12 @@ return {
|
|||||||
'nvim-neotest/nvim-nio',
|
'nvim-neotest/nvim-nio',
|
||||||
|
|
||||||
-- Installs the debug adapters for you
|
-- Installs the debug adapters for you
|
||||||
'mason-org/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
'jay-babu/mason-nvim-dap.nvim',
|
'jay-babu/mason-nvim-dap.nvim',
|
||||||
|
|
||||||
-- Add your own debuggers here
|
-- Add your own debuggers here
|
||||||
'leoluz/nvim-dap-go',
|
'leoluz/nvim-dap-go',
|
||||||
},
|
},
|
||||||
keys = {
|
|
||||||
-- Basic debugging keymaps, feel free to change to your liking!
|
|
||||||
{ '<F5>', function() require('dap').continue() end, desc = 'Debug: Start/Continue' },
|
|
||||||
{ '<F1>', function() require('dap').step_into() end, desc = 'Debug: Step Into' },
|
|
||||||
{ '<F2>', function() require('dap').step_over() end, desc = 'Debug: Step Over' },
|
|
||||||
{ '<F3>', function() require('dap').step_out() end, desc = 'Debug: Step Out' },
|
|
||||||
{ '<leader>b', function() require('dap').toggle_breakpoint() end, desc = 'Debug: Toggle Breakpoint' },
|
|
||||||
{ '<leader>B', function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, desc = 'Debug: Set Breakpoint' },
|
|
||||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
|
||||||
{ '<F7>', function() require('dapui').toggle() end, desc = 'Debug: See last session result.' },
|
|
||||||
},
|
|
||||||
config = function()
|
config = function()
|
||||||
local dap = require 'dap'
|
local dap = require 'dap'
|
||||||
local dapui = require 'dapui'
|
local dapui = require 'dapui'
|
||||||
@@ -44,7 +31,7 @@ return {
|
|||||||
require('mason-nvim-dap').setup {
|
require('mason-nvim-dap').setup {
|
||||||
-- Makes a best effort to setup the various debuggers with
|
-- Makes a best effort to setup the various debuggers with
|
||||||
-- reasonable debug configurations
|
-- reasonable debug configurations
|
||||||
automatic_installation = true,
|
automatic_setup = true,
|
||||||
|
|
||||||
-- You can provide additional configuration to the handlers,
|
-- You can provide additional configuration to the handlers,
|
||||||
-- see mason-nvim-dap README for more information
|
-- see mason-nvim-dap README for more information
|
||||||
@@ -58,15 +45,23 @@ return {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Basic debugging keymaps, feel free to change to your liking!
|
||||||
|
vim.keymap.set('n', '<F5>', dap.continue, { desc = 'Debug: Start/Continue' })
|
||||||
|
vim.keymap.set('n', '<F1>', dap.step_into, { desc = 'Debug: Step Into' })
|
||||||
|
vim.keymap.set('n', '<F2>', dap.step_over, { desc = 'Debug: Step Over' })
|
||||||
|
vim.keymap.set('n', '<F3>', dap.step_out, { desc = 'Debug: Step Out' })
|
||||||
|
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' })
|
||||||
|
vim.keymap.set('n', '<leader>B', function()
|
||||||
|
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
||||||
|
end, { desc = 'Debug: Set Breakpoint' })
|
||||||
|
|
||||||
-- Dap UI setup
|
-- Dap UI setup
|
||||||
-- For more information, see |:help nvim-dap-ui|
|
-- For more information, see |:help nvim-dap-ui|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
|
||||||
dapui.setup {
|
dapui.setup {
|
||||||
-- Set icons to characters that are more likely to work in every terminal.
|
-- Set icons to characters that are more likely to work in every terminal.
|
||||||
-- Feel free to remove or use ones that you like more! :)
|
-- Feel free to remove or use ones that you like more! :)
|
||||||
-- Don't feel like these are good choices.
|
-- Don't feel like these are good choices.
|
||||||
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
||||||
---@diagnostic disable-next-line: missing-fields
|
|
||||||
controls = {
|
controls = {
|
||||||
icons = {
|
icons = {
|
||||||
pause = '⏸',
|
pause = '⏸',
|
||||||
@@ -82,29 +77,14 @@ return {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Change breakpoint icons
|
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||||
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
|
vim.keymap.set('n', '<F7>', dapui.toggle, { desc = 'Debug: See last session result.' })
|
||||||
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
|
|
||||||
-- local breakpoint_icons = vim.g.have_nerd_font
|
|
||||||
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
|
|
||||||
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
|
|
||||||
-- for type, icon in pairs(breakpoint_icons) do
|
|
||||||
-- local tp = 'Dap' .. type
|
|
||||||
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
|
|
||||||
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
|
|
||||||
-- end
|
|
||||||
|
|
||||||
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
||||||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||||
|
|
||||||
-- Install golang specific config
|
-- Install golang specific config
|
||||||
require('dap-go').setup {
|
require('dap-go').setup()
|
||||||
delve = {
|
|
||||||
-- On Windows delve must be run attached or it crashes.
|
|
||||||
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
|
|
||||||
detached = vim.fn.has 'win32' == 0,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,58 +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.
|
|
||||||
|
|
||||||
---@module 'lazy'
|
|
||||||
---@type LazySpec
|
|
||||||
return {
|
|
||||||
'lewis6991/gitsigns.nvim',
|
|
||||||
---@module 'gitsigns'
|
|
||||||
---@type Gitsigns.Config
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
|
||||||
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 = 'git [s]tage hunk' })
|
|
||||||
map('v', '<leader>hr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset 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.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.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,9 @@
|
|||||||
-- Add indentation guides even on blank lines
|
|
||||||
|
|
||||||
---@module 'lazy'
|
|
||||||
---@type LazySpec
|
|
||||||
return {
|
return {
|
||||||
|
{ -- Add indentation guides even on blank lines
|
||||||
'lukas-reineke/indent-blankline.nvim',
|
'lukas-reineke/indent-blankline.nvim',
|
||||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||||
-- See `:help ibl`
|
-- See `:help ibl`
|
||||||
main = 'ibl',
|
main = 'ibl',
|
||||||
---@module 'ibl'
|
|
||||||
---@type ibl.config
|
|
||||||
opts = {},
|
opts = {},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
-- Linting
|
|
||||||
|
|
||||||
---@module 'lazy'
|
|
||||||
---@type LazySpec
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
|
{ -- Linting
|
||||||
'mfussenegger/nvim-lint',
|
'mfussenegger/nvim-lint',
|
||||||
event = { 'BufReadPre', 'BufNewFile' },
|
event = { 'BufReadPre', 'BufNewFile' },
|
||||||
config = function()
|
config = function()
|
||||||
@@ -49,11 +47,9 @@ return {
|
|||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
||||||
group = lint_augroup,
|
group = lint_augroup,
|
||||||
callback = function()
|
callback = function()
|
||||||
-- Only run the linter in buffers that you can modify in order to
|
require('lint').try_lint()
|
||||||
-- avoid superfluous noise, notably within the handy LSP pop-ups that
|
|
||||||
-- describe the hovered symbol using Markdown.
|
|
||||||
if vim.bo.modifiable then lint.try_lint() end
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
-- Neo-tree is a Neovim plugin to browse the file system
|
|
||||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
|
||||||
|
|
||||||
---@module 'lazy'
|
|
||||||
---@type LazySpec
|
|
||||||
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',
|
|
||||||
},
|
|
||||||
lazy = false,
|
|
||||||
keys = {
|
|
||||||
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
|
||||||
},
|
|
||||||
---@module 'neo-tree'
|
|
||||||
---@type neotree.Config
|
|
||||||
opts = {
|
|
||||||
filesystem = {
|
|
||||||
window = {
|
|
||||||
mappings = {
|
|
||||||
['\\'] = 'close_window',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user