Compare commits
113 Commits
cpatti_don
...
master
Author | SHA1 | Date | |
---|---|---|---|
edd4fb2c28 | |||
|
5bdde24dfb | ||
|
ff89769e45 | ||
|
f6abf682ff | ||
|
db4867acb9 | ||
|
a8f539562a | ||
|
7ddaab3ffd | ||
|
e84e187f3c | ||
|
de44f49101 | ||
|
bcdb4cd252 | ||
|
a2df3ea9eb | ||
|
7bc9d19a4d | ||
|
8d1ef972bc | ||
|
9dfb1b230f | ||
|
e5dc5f6d1c | ||
|
2ba39c6973 | ||
|
be678aa341 | ||
|
d09d9bc6dc | ||
|
fb7f6a1c13 | ||
|
5ed1bc38dc | ||
|
4120893b8a | ||
|
7201dc4801 | ||
|
a22976111e | ||
|
24d368f9ff | ||
|
c76c323a7c | ||
|
e4a5300bdb | ||
|
f49cc6c935 | ||
|
d452633b35 | ||
|
ac78e7d9e7 | ||
|
ce0c7340ff | ||
|
554a054bf9 | ||
|
c1ae9092cb | ||
|
1860184830 | ||
|
bb9f84ca8f | ||
|
84cc12354d | ||
|
fd66454c4a | ||
|
1cef2325e0 | ||
|
f00b2866de | ||
|
56b9114bf2 | ||
|
6f3fe35de3 | ||
|
620732789b | ||
|
7513ec8a7d | ||
|
07a9f446a3 | ||
|
b36d84ddf0 | ||
|
c405d3fd4f | ||
|
4bbca64157 | ||
|
1cdf6fb377 | ||
|
202910d3fa | ||
|
2df5137e59 | ||
|
3e55ff1a83 | ||
|
f5c919558b | ||
|
5aeddfdd5d | ||
|
b9bd02d55b | ||
|
f86f18f27a | ||
|
6f6f38a6b5 | ||
|
b7d5cc8f42 | ||
|
8df3deb6fe | ||
|
942b26184c | ||
|
81f270a704 | ||
|
f92fb11d68 | ||
|
2e68a2c253 | ||
|
9f5176fc2a | ||
|
931ec5c226 | ||
|
b07176aef6 | ||
|
f5c9fe8e15 | ||
|
5e258d276f | ||
|
5540527fab | ||
|
6d6b3f38c1 | ||
|
fabeb86d8b | ||
|
e2bfa0c66f | ||
|
23773900d9 | ||
|
c4363e4ad8 | ||
|
19afab1641 | ||
|
d605b840a2 | ||
|
1175f6d25a | ||
|
93fde0556e | ||
|
2877a60e00 | ||
|
dbba54cfd8 | ||
|
4c02e29e49 | ||
|
773e482d4b | ||
|
65a5ac404b | ||
|
8e24ca32e3 | ||
|
b81115d002 | ||
|
a222805c61 | ||
|
ea4335f5af | ||
|
da1271db4d | ||
|
7892c0c354 | ||
|
5ac4b58f85 | ||
|
2f494e59ca | ||
|
452e3a73cf | ||
|
7715b7c2ee | ||
|
b529bc3359 | ||
|
d8a1dbc4b4 | ||
|
000a5c42b0 | ||
|
cb1f16b8ca | ||
|
c0d6f98924 | ||
|
8de494fff2 | ||
|
3cfccc01be | ||
|
8fae6798b9 | ||
|
66e2a5a425 | ||
|
f764b7bacd | ||
|
b83b2b061c | ||
|
a02abdb161 | ||
|
c3127f1226 | ||
|
c9122e89e3 | ||
|
e6710a461a | ||
|
23fc4e59dc | ||
|
b99af2d6a3 | ||
|
94a93643ab | ||
|
38828dcaf7 | ||
|
b58666dd15 | ||
|
465d6f25c2 | ||
|
18b919c61e |
7
.github/ISSUE_TEMPLATE/bug_report.md
vendored
7
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -9,6 +9,13 @@ 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. -->
|
||||||
|
|
||||||
|
8
.github/pull_request_template.md
vendored
Normal file
8
.github/pull_request_template.md
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
***************************************************************************
|
||||||
|
**NOTE**
|
||||||
|
Please verify that the `base repository` above has the intended destination!
|
||||||
|
Github by default opens Pull Requests against the parent of a forked repository.
|
||||||
|
If this is your personal fork and you didn't intend to open a PR for contribution
|
||||||
|
to the original project then adjust the `base repository` accordingly.
|
||||||
|
**************************************************************************
|
||||||
|
|
232
README.md
232
README.md
@ -21,34 +21,57 @@ If you are experiencing issues, please make sure you have the latest versions.
|
|||||||
|
|
||||||
### Install External Dependencies
|
### Install External Dependencies
|
||||||
|
|
||||||
> **NOTE**
|
|
||||||
> [Backup](#FAQ) your previous configuration (if any exists)
|
|
||||||
|
|
||||||
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)
|
||||||
|
- Clipboard tool (xclip/xsel/win32yank or other depending on the platform)
|
||||||
|
- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
|
||||||
|
- if you have it set `vim.g.have_nerd_font` in `init.lua` to true
|
||||||
- Language Setup:
|
- Language Setup:
|
||||||
- If want to write Typescript, you need `npm`
|
- If you want to write Typescript, you need `npm`
|
||||||
- If want to write Golang, you will need `go`
|
- If you want to write Golang, you will need `go`
|
||||||
- etc.
|
- etc.
|
||||||
|
|
||||||
> **NOTE**
|
> **NOTE**
|
||||||
> See [Windows Installation](#Windows-Installation) to double check any additional Windows notes
|
> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes
|
||||||
|
> and quick install snippets
|
||||||
|
|
||||||
|
### Install Kickstart
|
||||||
|
|
||||||
|
> **NOTE**
|
||||||
|
> [Backup](#FAQ) your previous configuration (if any exists)
|
||||||
|
|
||||||
Neovim's configurations are located under the following paths, depending on your OS:
|
Neovim's configurations are located under the following paths, depending on your OS:
|
||||||
|
|
||||||
| OS | PATH |
|
| OS | PATH |
|
||||||
| :- | :--- |
|
| :- | :--- |
|
||||||
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
|
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
|
||||||
| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` |
|
| Windows (cmd)| `%localappdata%\nvim\` |
|
||||||
| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` |
|
| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` |
|
||||||
|
|
||||||
Clone kickstart.nvim:
|
#### Recommended Step
|
||||||
|
|
||||||
|
[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo
|
||||||
|
so that you have your own copy that you can modify, then install by cloning the
|
||||||
|
fork to your machine using one of the commands below, depending on your OS.
|
||||||
|
|
||||||
|
> **NOTE**
|
||||||
|
> Your fork's URL will be something like this:
|
||||||
|
> `https://github.com/<your_github_username>/kickstart.nvim.git`
|
||||||
|
|
||||||
|
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
|
||||||
|
> **NOTE**
|
||||||
|
> If following the recommended step above (i.e., forking the repo), replace
|
||||||
|
> `nvim-lua` with `<your_github_username>` in the commands below
|
||||||
|
|
||||||
<details><summary> Linux and Mac </summary>
|
<details><summary> Linux and Mac </summary>
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
|
git clone git@code.draft13.com:robert/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
@ -58,13 +81,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 %userprofile%\AppData\Local\nvim\
|
git clone https://github.com/nvim-lua/kickstart.nvim.git "%localappdata%\nvim"
|
||||||
```
|
```
|
||||||
|
|
||||||
If you're using `powershell.exe`
|
If you're using `powershell.exe`
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\
|
git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim"
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
@ -78,117 +101,138 @@ 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
|
||||||
current plugin status.
|
the 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.
|
information about extending and exploring Neovim. That also includes
|
||||||
|
examples of adding popularly requested plugins.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> For more information about a particular plugin check its repository's documentation.
|
||||||
|
|
||||||
|
|
||||||
### Getting Started
|
### Getting Started
|
||||||
|
|
||||||
See [Effective Neovim: Instant IDE](https://youtu.be/stqUbv-5u2s), covering the
|
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
|
||||||
previous version. Note: The install via init.lua is outdated, please follow the
|
|
||||||
install instructions in this file instead. An updated video is coming soon.
|
|
||||||
|
|
||||||
### Recommended Steps
|
|
||||||
|
|
||||||
[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo
|
|
||||||
(so that you have your own copy that you can modify) and then installing you
|
|
||||||
can install to your machine using the methods above.
|
|
||||||
|
|
||||||
> **NOTE**
|
|
||||||
> Your fork's url will be something like this: `https://github.com/<your_github_username>/kickstart.nvim.git`
|
|
||||||
|
|
||||||
#### Examples of adding popularly requested 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. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information.
|
|
||||||
|
|
||||||
In the file: `lua/custom/plugins/filetree.lua`, add:
|
|
||||||
|
|
||||||
```lua
|
|
||||||
-- Unless you are still migrating, remove the deprecated commands from v1.x
|
|
||||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
|
||||||
|
|
||||||
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>
|
|
||||||
|
|
||||||
### 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, then delete all files associated with it.
|
* You should back it up and then delete all associated files.
|
||||||
* This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/`
|
* This includes your existing init.lua and the Neovim files in `~/.local`
|
||||||
|
which can be deleted with `rm -rf ~/.local/share/nvim/`
|
||||||
* Can I keep my existing configuration in parallel to kickstart?
|
* Can I keep my existing configuration in parallel to kickstart?
|
||||||
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example you can install the kickstart configuration in `~/.config/nvim-kickstart` and create an alias:
|
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME`
|
||||||
|
to maintain multiple configurations. For example, you can install the kickstart
|
||||||
|
configuration in `~/.config/nvim-kickstart` and create an alias:
|
||||||
```
|
```
|
||||||
alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim'
|
alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim'
|
||||||
```
|
```
|
||||||
When you run Neovim using `nvim-kickstart` alias it will use the alternative config directory and the matching local directory `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim distribution that you would like to try out.
|
When you run Neovim using `nvim-kickstart` alias it will use the alternative
|
||||||
|
config directory and the matching local directory
|
||||||
|
`~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim
|
||||||
|
distribution that you would like to try out.
|
||||||
* What if I want to "uninstall" this configuration:
|
* What if I want to "uninstall" this configuration:
|
||||||
* See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information
|
* See [lazy.nvim uninstall](https://lazy.folke.io/usage#-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 `git clone` as a basis for their own.
|
configuration that someone can easily use to `git clone` as a basis for their own.
|
||||||
As you progress in learning Neovim and Lua, you might consider splitting `init.lua`
|
As you progress in learning Neovim and Lua, you might consider splitting `init.lua`
|
||||||
into smaller parts. A fork of kickstart that does this while maintaining the exact
|
into smaller parts. A fork of kickstart that does this while maintaining the
|
||||||
same functionality is available here:
|
same functionality is available here:
|
||||||
* [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim)
|
* [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim)
|
||||||
* Discussions on this topic can be found here:
|
* Discussions on this topic can be found here:
|
||||||
* [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218)
|
* [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218)
|
||||||
* [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473)
|
* [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473)
|
||||||
|
|
||||||
### Windows Installation
|
### Install Recipes
|
||||||
|
|
||||||
Installation may require installing build tools, and updating the run command for `telescope-fzf-native`
|
Below you can find OS specific install instructions for Neovim and dependencies.
|
||||||
|
|
||||||
|
After installing all the dependencies continue with the [Install Kickstart](#Install-Kickstart) step.
|
||||||
|
|
||||||
|
#### Windows Installation
|
||||||
|
|
||||||
|
<details><summary>Windows with Microsoft C++ Build Tools and CMake</summary>
|
||||||
|
Installation may require installing build tools and updating the run command for `telescope-fzf-native`
|
||||||
|
|
||||||
See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)
|
See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)
|
||||||
|
|
||||||
This requires:
|
This requires:
|
||||||
|
|
||||||
- Install CMake, and the Microsoft C++ Build Tools on Windows
|
- Install CMake and the Microsoft C++ Build Tools on Windows
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
|
{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
|
||||||
```
|
```
|
||||||
|
</details>
|
||||||
|
<details><summary>Windows with gcc/make using chocolatey</summary>
|
||||||
|
Alternatively, one can install gcc and make which don't require changing the config,
|
||||||
|
the easiest way is to use choco:
|
||||||
|
|
||||||
|
1. install [chocolatey](https://chocolatey.org/install)
|
||||||
|
either follow the instructions on the page or use winget,
|
||||||
|
run in cmd as **admin**:
|
||||||
|
```
|
||||||
|
winget install --accept-source-agreements chocolatey.chocolatey
|
||||||
|
```
|
||||||
|
|
||||||
|
2. install all requirements using choco, exit the previous cmd and
|
||||||
|
open a new one so that choco path is set, and run in cmd as **admin**:
|
||||||
|
```
|
||||||
|
choco install -y neovim git ripgrep wget fd unzip gzip mingw make
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
<details><summary>WSL (Windows Subsystem for Linux)</summary>
|
||||||
|
|
||||||
|
```
|
||||||
|
wsl --install
|
||||||
|
wsl
|
||||||
|
sudo add-apt-repository ppa:neovim-ppa/unstable -y
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install make gcc ripgrep unzip git xclip neovim
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
#### Linux Install
|
||||||
|
<details><summary>Ubuntu Install Steps</summary>
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo add-apt-repository ppa:neovim-ppa/unstable -y
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install make gcc ripgrep unzip git xclip neovim
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
<details><summary>Debian Install Steps</summary>
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install make gcc ripgrep unzip git xclip curl
|
||||||
|
|
||||||
|
# Now we install nvim
|
||||||
|
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
|
||||||
|
sudo rm -rf /opt/nvim-linux64
|
||||||
|
sudo mkdir -p /opt/nvim-linux64
|
||||||
|
sudo chmod a+rX /opt/nvim-linux64
|
||||||
|
sudo tar -C /opt -xzf nvim-linux64.tar.gz
|
||||||
|
|
||||||
|
# make it available in /usr/local/bin, distro installs to /usr/bin
|
||||||
|
sudo ln -sf /opt/nvim-linux64/bin/nvim /usr/local/bin/
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
<details><summary>Fedora Install Steps</summary>
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo dnf install -y gcc make git ripgrep fd-find unzip neovim
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details><summary>Arch Install Steps</summary>
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
504
init.lua
504
init.lua
@ -29,7 +29,7 @@ What is Kickstart?
|
|||||||
what your configuration is doing, and modify it to suit your needs.
|
what your configuration is doing, and modify it to suit your needs.
|
||||||
|
|
||||||
Once you've done that, you can start exploring, configuring and tinkering to
|
Once you've done that, you can start exploring, configuring and tinkering to
|
||||||
make Neovim your own! That might mean leaving kickstart just the way it is for a while
|
make Neovim your own! That might mean leaving Kickstart just the way it is for a while
|
||||||
or immediately breaking it into modular pieces. It's up to you!
|
or immediately breaking it into modular pieces. It's up to you!
|
||||||
|
|
||||||
If you don't know anything about Lua, I recommend taking some time to read through
|
If you don't know anything about Lua, I recommend taking some time to read through
|
||||||
@ -51,32 +51,32 @@ Kickstart Guide:
|
|||||||
- Tutor
|
- Tutor
|
||||||
- <enter key>
|
- <enter key>
|
||||||
|
|
||||||
(If you already know how the Neovim basics, you can skip this step)
|
(If you already know the Neovim basics, you can skip this step.)
|
||||||
|
|
||||||
Once you've completed that, you can continue working through **AND READING** the rest
|
Once you've completed that, you can continue working through **AND READING** the rest
|
||||||
of the kickstart init.lua
|
of the kickstart init.lua.
|
||||||
|
|
||||||
Next, run AND READ `:help`.
|
Next, run AND READ `:help`.
|
||||||
This will open up a help window with some basic information
|
This will open up a help window with some basic information
|
||||||
about reading, navigating and searching the builtin help documentation.
|
about reading, navigating and searching the builtin help documentation.
|
||||||
|
|
||||||
This should be the first place you go to look when you're stuck or confused
|
This should be the first place you go to look when you're stuck or confused
|
||||||
with something. It's one of my favorite neovim features.
|
with something. It's one of my favorite Neovim features.
|
||||||
|
|
||||||
MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation,
|
MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation,
|
||||||
which is very useful when you're not sure exactly what you're looking for.
|
which is very useful when you're not exactly sure of what you're looking for.
|
||||||
|
|
||||||
I have left several `:help X` comments throughout the init.lua
|
I have left several `:help X` comments throughout the init.lua
|
||||||
These are hints about where to find more information about the relevant settings,
|
These are hints about where to find more information about the relevant settings,
|
||||||
plugins or neovim features used in kickstart.
|
plugins or Neovim features used in Kickstart.
|
||||||
|
|
||||||
NOTE: Look for lines like this
|
NOTE: Look for lines like this
|
||||||
|
|
||||||
Throughout the file. These are for you, the reader, to help understand what is happening.
|
Throughout the file. These are for you, the reader, to help you understand what is happening.
|
||||||
Feel free to delete them once you know what you're doing, but they should serve as a guide
|
Feel free to delete them once you know what you're doing, but they should serve as a guide
|
||||||
for when you are first encountering a few different constructs in your nvim config.
|
for when you are first encountering a few different constructs in your Neovim config.
|
||||||
|
|
||||||
If you experience any errors while trying to install kickstart, run `:checkhealth` for more info
|
If you experience any errors while trying to install kickstart, run `:checkhealth` for more info.
|
||||||
|
|
||||||
I hope you enjoy your Neovim journey,
|
I hope you enjoy your Neovim journey,
|
||||||
- TJ
|
- TJ
|
||||||
@ -90,6 +90,9 @@ P.S. You can delete this when you're done too. It's your config now! :)
|
|||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
|
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||||
|
vim.g.have_nerd_font = false
|
||||||
|
|
||||||
-- [[ Setting options ]]
|
-- [[ Setting options ]]
|
||||||
-- See `:help vim.opt`
|
-- See `:help vim.opt`
|
||||||
-- NOTE: You can change these options as you wish!
|
-- NOTE: You can change these options as you wish!
|
||||||
@ -97,20 +100,23 @@ vim.g.maplocalleader = ' '
|
|||||||
|
|
||||||
-- Make line numbers default
|
-- Make line numbers default
|
||||||
vim.opt.number = true
|
vim.opt.number = true
|
||||||
-- You can also add relative line numbers, for 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.opt.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.opt.mouse = 'a'
|
vim.opt.mouse = 'a'
|
||||||
|
|
||||||
-- Don't show the mode, since it's already in status line
|
-- Don't show the mode, since it's already in the status line
|
||||||
vim.opt.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.opt.clipboard = 'unnamedplus'
|
vim.schedule(function()
|
||||||
|
vim.opt.clipboard = 'unnamedplus'
|
||||||
|
end)
|
||||||
|
|
||||||
-- Enable break indent
|
-- Enable break indent
|
||||||
vim.opt.breakindent = true
|
vim.opt.breakindent = true
|
||||||
@ -118,7 +124,7 @@ vim.opt.breakindent = true
|
|||||||
-- Save undo history
|
-- Save undo history
|
||||||
vim.opt.undofile = true
|
vim.opt.undofile = true
|
||||||
|
|
||||||
-- Case-insensitive searching UNLESS \C or capital in search
|
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||||
vim.opt.ignorecase = true
|
vim.opt.ignorecase = true
|
||||||
vim.opt.smartcase = true
|
vim.opt.smartcase = true
|
||||||
|
|
||||||
@ -127,15 +133,17 @@ vim.opt.signcolumn = 'yes'
|
|||||||
|
|
||||||
-- Decrease update time
|
-- Decrease update time
|
||||||
vim.opt.updatetime = 250
|
vim.opt.updatetime = 250
|
||||||
|
|
||||||
|
-- Decrease mapped sequence wait time
|
||||||
vim.opt.timeoutlen = 300
|
vim.opt.timeoutlen = 300
|
||||||
|
|
||||||
-- Configure how new splits should be opened
|
-- Configure how new splits should be opened
|
||||||
vim.opt.splitright = true
|
vim.opt.splitright = true
|
||||||
vim.opt.splitbelow = true
|
vim.opt.splitbelow = true
|
||||||
|
|
||||||
-- Sets how neovim will display certain whitespace 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
|
vim.opt.list = true
|
||||||
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
||||||
|
|
||||||
@ -151,14 +159,11 @@ vim.opt.scrolloff = 10
|
|||||||
-- [[ Basic Keymaps ]]
|
-- [[ Basic Keymaps ]]
|
||||||
-- See `:help vim.keymap.set()`
|
-- See `:help vim.keymap.set()`
|
||||||
|
|
||||||
-- Set highlight on search, but clear on pressing <Esc> in normal mode
|
-- Clear highlights on search when pressing <Esc> in normal mode
|
||||||
vim.opt.hlsearch = true
|
-- See `:help hlsearch`
|
||||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
-- Diagnostic keymaps
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
|
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
|
|
||||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
|
|
||||||
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
|
||||||
@ -185,7 +190,7 @@ vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower win
|
|||||||
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' })
|
||||||
|
|
||||||
-- [[ 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
|
||||||
@ -201,9 +206,12 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
|||||||
-- [[ 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.loop.fs_stat(lazypath) then
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||||
vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
local out = 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 ---@diagnostic disable-next-line: undefined-field
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
@ -214,12 +222,11 @@ vim.opt.rtp:prepend(lazypath)
|
|||||||
--
|
--
|
||||||
-- You can press `?` in this menu for help. Use `:q` to close the window
|
-- You can press `?` in this menu for help. Use `:q` to close the window
|
||||||
--
|
--
|
||||||
-- To update plugins, you can run
|
-- To update plugins you can run
|
||||||
-- :Lazy update
|
-- :Lazy update
|
||||||
--
|
--
|
||||||
-- 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 with a link (or for a github repo: 'owner/repo' link).
|
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
||||||
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
||||||
|
|
||||||
@ -229,14 +236,9 @@ require('lazy').setup({
|
|||||||
--
|
--
|
||||||
-- Use `opts = {}` to force a plugin to be loaded.
|
-- 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`. This is equivalent to the following lua:
|
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
|
||||||
-- require('gitsigns').setup({ ... })
|
-- require('gitsigns').setup({ ... })
|
||||||
--
|
--
|
||||||
-- See `:help gitsigns` to understand what the configuration keys do
|
-- See `:help gitsigns` to understand what the configuration keys do
|
||||||
@ -253,36 +255,75 @@ require('lazy').setup({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- NOTE: Plugins can also be configured to run lua code when they are loaded.
|
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
|
||||||
--
|
--
|
||||||
-- This is often very useful to both group configuration, as well as handle
|
-- This is often very useful to both group configuration, as well as handle
|
||||||
-- lazy loading plugins that don't need to be loaded immediately at startup.
|
-- lazy loading plugins that don't need to be loaded immediately at startup.
|
||||||
--
|
--
|
||||||
-- For example, in the following configuration, we use:
|
-- For example, in the following configuration, we use:
|
||||||
-- event = 'VeryLazy'
|
-- event = 'VimEnter'
|
||||||
--
|
--
|
||||||
-- which loads which-key after 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 autocomd-events).
|
-- normal autocommands events (`:help autocmd-events`).
|
||||||
--
|
--
|
||||||
-- Then, because we use the `config` key, the configuration only runs
|
-- Then, because we use the `opts` key (recommended), the configuration runs
|
||||||
-- after the plugin has been loaded:
|
-- after the plugin has been loaded as `require(MODULE).setup(opts)`.
|
||||||
-- 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 = 'VeryLazy', -- Sets the loading event to 'VeryLazy'
|
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
||||||
config = function() -- This is the function that runs, AFTER loading
|
opts = {
|
||||||
require('which-key').setup()
|
-- delay between pressing a key and opening which-key (milliseconds)
|
||||||
|
-- this setting is independent of vim.opt.timeoutlen
|
||||||
|
delay = 0,
|
||||||
|
icons = {
|
||||||
|
-- set icon mappings to true if you have a Nerd Font
|
||||||
|
mappings = vim.g.have_nerd_font,
|
||||||
|
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
|
||||||
|
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table
|
||||||
|
keys = vim.g.have_nerd_font and {} or {
|
||||||
|
Up = '<Up> ',
|
||||||
|
Down = '<Down> ',
|
||||||
|
Left = '<Left> ',
|
||||||
|
Right = '<Right> ',
|
||||||
|
C = '<C-…> ',
|
||||||
|
M = '<M-…> ',
|
||||||
|
D = '<D-…> ',
|
||||||
|
S = '<S-…> ',
|
||||||
|
CR = '<CR> ',
|
||||||
|
Esc = '<Esc> ',
|
||||||
|
ScrollWheelDown = '<ScrollWheelDown> ',
|
||||||
|
ScrollWheelUp = '<ScrollWheelUp> ',
|
||||||
|
NL = '<NL> ',
|
||||||
|
BS = '<BS> ',
|
||||||
|
Space = '<Space> ',
|
||||||
|
Tab = '<Tab> ',
|
||||||
|
F1 = '<F1>',
|
||||||
|
F2 = '<F2>',
|
||||||
|
F3 = '<F3>',
|
||||||
|
F4 = '<F4>',
|
||||||
|
F5 = '<F5>',
|
||||||
|
F6 = '<F6>',
|
||||||
|
F7 = '<F7>',
|
||||||
|
F8 = '<F8>',
|
||||||
|
F9 = '<F9>',
|
||||||
|
F10 = '<F10>',
|
||||||
|
F11 = '<F11>',
|
||||||
|
F12 = '<F12>',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
-- Document existing key chains
|
-- Document existing key chains
|
||||||
require('which-key').register {
|
spec = {
|
||||||
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
|
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
|
||||||
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
|
{ '<leader>d', group = '[D]ocument' },
|
||||||
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
{ '<leader>r', group = '[R]ename' },
|
||||||
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
{ '<leader>s', group = '[S]earch' },
|
||||||
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
{ '<leader>w', group = '[W]orkspace' },
|
||||||
}
|
{ '<leader>t', group = '[T]oggle' },
|
||||||
end,
|
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- NOTE: Plugins can specify dependencies.
|
-- NOTE: Plugins can specify dependencies.
|
||||||
@ -294,11 +335,11 @@ require('lazy').setup({
|
|||||||
|
|
||||||
{ -- Fuzzy Finder (files, lsp, etc)
|
{ -- Fuzzy Finder (files, lsp, etc)
|
||||||
'nvim-telescope/telescope.nvim',
|
'nvim-telescope/telescope.nvim',
|
||||||
event = 'VeryLazy',
|
event = 'VimEnter',
|
||||||
branch = '0.1.x',
|
branch = '0.1.x',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
{ -- If encountering errors, see telescope-fzf-native README for install instructions
|
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
||||||
'nvim-telescope/telescope-fzf-native.nvim',
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
|
|
||||||
-- `build` is used to run some command when the plugin is installed/updated.
|
-- `build` is used to run some command when the plugin is installed/updated.
|
||||||
@ -313,29 +354,27 @@ require('lazy').setup({
|
|||||||
},
|
},
|
||||||
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
||||||
|
|
||||||
-- Useful for getting pretty icons, but requires special font.
|
-- Useful for getting pretty icons, but requires a Nerd Font.
|
||||||
-- If you already have a Nerd Font, or terminal set up with fallback fonts
|
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
||||||
-- you can enable this
|
|
||||||
-- { 'nvim-tree/nvim-web-devicons' }
|
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
||||||
-- it can fuzzy find! It's more than just a "file finder", it can search
|
-- it can fuzzy find! It's more than just a "file finder", it can search
|
||||||
-- many different aspects of Neovim, your workspace, LSP, and more!
|
-- many different aspects of Neovim, your workspace, LSP, and more!
|
||||||
--
|
--
|
||||||
-- The easiest way to use telescope, is to start by doing something like:
|
-- The easiest way to use Telescope, is to start by doing something like:
|
||||||
-- :Telescope help_tags
|
-- :Telescope help_tags
|
||||||
--
|
--
|
||||||
-- After running this command, a window will open up and you're able to
|
-- After running this command, a window will open up and you're able to
|
||||||
-- type in the prompt window. You'll see a list of help_tags options and
|
-- type in the prompt window. You'll see a list of `help_tags` options and
|
||||||
-- a corresponding preview of the help.
|
-- a corresponding preview of the help.
|
||||||
--
|
--
|
||||||
-- Two important keymaps to use while in telescope are:
|
-- Two important keymaps to use while in Telescope are:
|
||||||
-- - Insert mode: <c-/>
|
-- - Insert mode: <c-/>
|
||||||
-- - Normal mode: ?
|
-- - Normal mode: ?
|
||||||
--
|
--
|
||||||
-- This opens a window that shows you all of the keymaps for the current
|
-- This opens a window that shows you all of the keymaps for the current
|
||||||
-- telescope picker. This is really useful to discover what Telescope can
|
-- Telescope picker. This is really useful to discover what Telescope can
|
||||||
-- do as well as how to actually do it!
|
-- do as well as how to actually do it!
|
||||||
|
|
||||||
-- [[ Configure Telescope ]]
|
-- [[ Configure Telescope ]]
|
||||||
@ -357,7 +396,7 @@ require('lazy').setup({
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Enable telescope extensions, if they are installed
|
-- Enable Telescope extensions if they are installed
|
||||||
pcall(require('telescope').load_extension, 'fzf')
|
pcall(require('telescope').load_extension, 'fzf')
|
||||||
pcall(require('telescope').load_extension, 'ui-select')
|
pcall(require('telescope').load_extension, 'ui-select')
|
||||||
|
|
||||||
@ -376,14 +415,14 @@ require('lazy').setup({
|
|||||||
|
|
||||||
-- Slightly advanced example of overriding default behavior and theme
|
-- Slightly advanced example of overriding default behavior and theme
|
||||||
vim.keymap.set('n', '<leader>/', function()
|
vim.keymap.set('n', '<leader>/', function()
|
||||||
-- You can pass additional configuration to telescope to change 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 {
|
||||||
winblend = 10,
|
winblend = 10,
|
||||||
previewer = false,
|
previewer = false,
|
||||||
})
|
})
|
||||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||||
|
|
||||||
-- 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('n', '<leader>s/', function()
|
vim.keymap.set('n', '<leader>s/', function()
|
||||||
builtin.live_grep {
|
builtin.live_grep {
|
||||||
@ -392,35 +431,53 @@ require('lazy').setup({
|
|||||||
}
|
}
|
||||||
end, { desc = '[S]earch [/] in Open Files' })
|
end, { 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()
|
vim.keymap.set('n', '<leader>sn', function()
|
||||||
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
||||||
end, { desc = '[S]earch [N]eovim files' })
|
end, { desc = '[S]earch [N]eovim files' })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- LSP Configuration & Plugins
|
-- LSP Plugins
|
||||||
|
{
|
||||||
|
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
||||||
|
-- used for completion, annotations and signatures of Neovim apis
|
||||||
|
'folke/lazydev.nvim',
|
||||||
|
ft = 'lua',
|
||||||
|
opts = {
|
||||||
|
library = {
|
||||||
|
-- Load luvit types when the `vim.uv` word is found
|
||||||
|
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
-- 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
|
||||||
'williamboman/mason.nvim',
|
-- Mason must be loaded before its dependents so we need to set it up here.
|
||||||
|
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
|
||||||
|
{ 'williamboman/mason.nvim', opts = {} },
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/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 = {} },
|
||||||
|
|
||||||
|
-- Allows extra capabilities provided by nvim-cmp
|
||||||
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- Brief Aside: **What is LSP?**
|
-- Brief aside: **What is LSP?**
|
||||||
--
|
--
|
||||||
-- LSP is an acronym you've probably heard, but might not understand what it is.
|
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
||||||
--
|
--
|
||||||
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
|
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
|
||||||
-- and language tooling communicate in a standardized fashion.
|
-- and language tooling communicate in a standardized fashion.
|
||||||
--
|
--
|
||||||
-- In general, you have a "server" which is some tool built to understand a particular
|
-- In general, you have a "server" which is some tool built to understand a particular
|
||||||
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc). These Language Servers
|
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
|
||||||
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
|
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
|
||||||
-- processes that communicate with some "client" - in this case, Neovim!
|
-- processes that communicate with some "client" - in this case, Neovim!
|
||||||
--
|
--
|
||||||
@ -435,7 +492,7 @@ require('lazy').setup({
|
|||||||
-- Neovim. This is where `mason` and related plugins come into play.
|
-- Neovim. This is where `mason` and related plugins come into play.
|
||||||
--
|
--
|
||||||
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
|
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
|
||||||
-- and elegantly composed help section, :help lsp-vs-treesitter
|
-- and elegantly composed help section, `:help lsp-vs-treesitter`
|
||||||
|
|
||||||
-- This function gets run when an LSP attaches to a particular buffer.
|
-- This function gets run when an LSP attaches to a particular buffer.
|
||||||
-- That is to say, every time a new file is opened that is associated with
|
-- That is to say, every time a new file is opened that is associated with
|
||||||
@ -444,19 +501,19 @@ require('lazy').setup({
|
|||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
||||||
callback = function(event)
|
callback = function(event)
|
||||||
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
-- NOTE: Remember that Lua is a real programming language, and as such it is possible
|
||||||
-- to define small helper and utility functions so you don't have to repeat yourself
|
-- to define small helper and utility functions so you don't have to repeat yourself.
|
||||||
-- many times.
|
|
||||||
--
|
--
|
||||||
-- 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)
|
local map = function(keys, func, desc, mode)
|
||||||
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
mode = mode or 'n'
|
||||||
|
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Jump to the definition of the word under your cursor.
|
-- 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.
|
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||||
-- To jump back, press <C-T>.
|
-- To jump back, press <C-t>.
|
||||||
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||||
|
|
||||||
-- Find references for the word under your cursor.
|
-- Find references for the word under your cursor.
|
||||||
@ -475,24 +532,20 @@ require('lazy').setup({
|
|||||||
-- Symbols are things like variables, functions, types, etc.
|
-- Symbols are things like variables, functions, types, etc.
|
||||||
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||||
|
|
||||||
-- Fuzzy find all the symbols in your current workspace
|
-- Fuzzy find all the symbols in your current workspace.
|
||||||
-- Similar to document symbols, except searches over your whole project.
|
-- Similar to document symbols, except searches over your entire project.
|
||||||
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
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('<leader>rn', 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('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
|
||||||
|
|
||||||
-- 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('gD', 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
|
||||||
@ -501,22 +554,53 @@ 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.server_capabilities.documentHighlightProvider then
|
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) 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(vim.lsp.protocol.Methods.textDocument_inlayHint) 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,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Change diagnostic symbols in the sign column (gutter)
|
||||||
|
-- if vim.g.have_nerd_font then
|
||||||
|
-- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
|
||||||
|
-- local diagnostic_signs = {}
|
||||||
|
-- for type, icon in pairs(signs) do
|
||||||
|
-- diagnostic_signs[vim.diagnostic.severity[type]] = icon
|
||||||
|
-- end
|
||||||
|
-- vim.diagnostic.config { signs = { text = diagnostic_signs } }
|
||||||
|
-- end
|
||||||
|
|
||||||
-- LSP servers and clients are able to communicate to each other what features they support.
|
-- 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.
|
-- 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.
|
-- 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.
|
-- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
@ -541,27 +625,18 @@ require('lazy').setup({
|
|||||||
-- 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 (`tsserver`) will work just fine
|
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
||||||
-- tsserver = {},
|
-- ts_ls = {},
|
||||||
--
|
--
|
||||||
|
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
-- cmd = {...},
|
-- cmd = { ... },
|
||||||
-- filetypes { ...},
|
-- filetypes = { ... },
|
||||||
-- capabilities = {},
|
-- capabilities = {},
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = { version = 'LuaJIT' },
|
completion = {
|
||||||
workspace = {
|
callSnippet = 'Replace',
|
||||||
checkThirdParty = false,
|
|
||||||
-- Tells lua_ls where to find all the Lua files that you have loaded
|
|
||||||
-- for your neovim configuration.
|
|
||||||
library = {
|
|
||||||
'${3rd}/luv/library',
|
|
||||||
unpack(vim.api.nvim_get_runtime_file('', true)),
|
|
||||||
},
|
|
||||||
-- If lua_ls is really slow on your computer, you can try this instead:
|
|
||||||
-- library = { vim.env.VIMRUNTIME },
|
|
||||||
},
|
},
|
||||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||||
-- diagnostics = { disable = { 'missing-fields' } },
|
-- diagnostics = { disable = { 'missing-fields' } },
|
||||||
@ -571,18 +646,21 @@ require('lazy').setup({
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- 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
|
--
|
||||||
-- other tools, you can run
|
-- To check the current status of installed tools and/or manually install
|
||||||
|
-- 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()
|
--
|
||||||
|
-- `mason` had to be setup earlier: to configure its options see the
|
||||||
|
-- `dependencies` table for `nvim-lspconfig` above.
|
||||||
|
--
|
||||||
-- You can add other tools here that you want Mason to install
|
-- You can add other tools here that you want Mason to install
|
||||||
-- for you, so that they are available from within Neovim.
|
-- 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, {
|
||||||
'stylua', -- Used to format lua code
|
'stylua', -- Used to format Lua code
|
||||||
})
|
})
|
||||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||||
|
|
||||||
@ -590,15 +668,11 @@ require('lazy').setup({
|
|||||||
handlers = {
|
handlers = {
|
||||||
function(server_name)
|
function(server_name)
|
||||||
local server = servers[server_name] or {}
|
local server = servers[server_name] or {}
|
||||||
require('lspconfig')[server_name].setup {
|
-- This handles overriding only values explicitly passed
|
||||||
cmd = server.cmd,
|
-- by the server configuration above. Useful when disabling
|
||||||
settings = server.settings,
|
-- certain features of an LSP (for example, turning off formatting for ts_ls)
|
||||||
filetypes = server.filetypes,
|
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
||||||
-- This handles overriding only values explicitly passed
|
require('lspconfig')[server_name].setup(server)
|
||||||
-- by the server configuration above. Useful when disabling
|
|
||||||
-- certain features of an LSP (for example, turning off formatting for tsserver)
|
|
||||||
capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}),
|
|
||||||
}
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -607,20 +681,43 @@ require('lazy').setup({
|
|||||||
|
|
||||||
{ -- Autoformat
|
{ -- Autoformat
|
||||||
'stevearc/conform.nvim',
|
'stevearc/conform.nvim',
|
||||||
|
event = { 'BufWritePre' },
|
||||||
|
cmd = { 'ConformInfo' },
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<leader>f',
|
||||||
|
function()
|
||||||
|
require('conform').format { async = true, lsp_format = 'fallback' }
|
||||||
|
end,
|
||||||
|
mode = '',
|
||||||
|
desc = '[F]ormat buffer',
|
||||||
|
},
|
||||||
|
},
|
||||||
opts = {
|
opts = {
|
||||||
notify_on_error = false,
|
notify_on_error = false,
|
||||||
format_on_save = {
|
format_on_save = function(bufnr)
|
||||||
timeout_ms = 500,
|
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||||
lsp_fallback = true,
|
-- have a well standardized coding style. You can add additional
|
||||||
},
|
-- languages here or re-enable it for the disabled ones.
|
||||||
|
local disable_filetypes = { c = true, cpp = true }
|
||||||
|
local lsp_format_opt
|
||||||
|
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||||
|
lsp_format_opt = 'never'
|
||||||
|
else
|
||||||
|
lsp_format_opt = 'fallback'
|
||||||
|
end
|
||||||
|
return {
|
||||||
|
timeout_ms = 500,
|
||||||
|
lsp_format = lsp_format_opt,
|
||||||
|
}
|
||||||
|
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 a sub-list to tell conform to run *until* a formatter
|
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||||
-- is found.
|
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||||
-- javascript = { { "prettierd", "prettier" } },
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -633,14 +730,25 @@ require('lazy').setup({
|
|||||||
{
|
{
|
||||||
'L3MON4D3/LuaSnip',
|
'L3MON4D3/LuaSnip',
|
||||||
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
|
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
return 'make install_jsregexp'
|
return 'make install_jsregexp'
|
||||||
end)(),
|
end)(),
|
||||||
|
dependencies = {
|
||||||
|
-- `friendly-snippets` contains a variety of premade snippets.
|
||||||
|
-- See the README about individual language/framework/plugin snippets:
|
||||||
|
-- https://github.com/rafamadriz/friendly-snippets
|
||||||
|
-- {
|
||||||
|
-- 'rafamadriz/friendly-snippets',
|
||||||
|
-- config = function()
|
||||||
|
-- require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'saadparwaiz1/cmp_luasnip',
|
'saadparwaiz1/cmp_luasnip',
|
||||||
|
|
||||||
@ -649,12 +757,6 @@ require('lazy').setup({
|
|||||||
-- into multiple repos for maintenance purposes.
|
-- into multiple repos for maintenance purposes.
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
'hrsh7th/cmp-path',
|
'hrsh7th/cmp-path',
|
||||||
|
|
||||||
-- If you want to add a bunch of pre-configured snippets,
|
|
||||||
-- you can use this plugin to help you. It even has snippets
|
|
||||||
-- for various frameworks/libraries/etc. but you will have to
|
|
||||||
-- set up the ones that are useful for you.
|
|
||||||
-- 'rafamadriz/friendly-snippets',
|
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- See `:help cmp`
|
-- See `:help cmp`
|
||||||
@ -680,11 +782,21 @@ require('lazy').setup({
|
|||||||
-- Select the [p]revious item
|
-- Select the [p]revious item
|
||||||
['<C-p>'] = cmp.mapping.select_prev_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.
|
-- Accept ([y]es) the completion.
|
||||||
-- This will auto-import if your LSP supports it.
|
-- This will auto-import if your LSP supports it.
|
||||||
-- This will expand snippets if the LSP sent a snippet.
|
-- This will expand snippets if the LSP sent a snippet.
|
||||||
['<C-y>'] = cmp.mapping.confirm { select = true },
|
['<C-y>'] = cmp.mapping.confirm { select = true },
|
||||||
|
|
||||||
|
-- If you prefer more traditional completion keymaps,
|
||||||
|
-- you can uncomment the following lines
|
||||||
|
--['<CR>'] = cmp.mapping.confirm { select = true },
|
||||||
|
--['<Tab>'] = cmp.mapping.select_next_item(),
|
||||||
|
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||||
|
|
||||||
-- Manually trigger a completion from nvim-cmp.
|
-- Manually trigger a completion from nvim-cmp.
|
||||||
-- Generally you don't need this, because nvim-cmp will display
|
-- Generally you don't need this, because nvim-cmp will display
|
||||||
-- completions whenever it has completion options available.
|
-- completions whenever it has completion options available.
|
||||||
@ -708,8 +820,16 @@ require('lazy').setup({
|
|||||||
luasnip.jump(-1)
|
luasnip.jump(-1)
|
||||||
end
|
end
|
||||||
end, { 'i', 's' }),
|
end, { 'i', 's' }),
|
||||||
|
|
||||||
|
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||||
|
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||||
},
|
},
|
||||||
sources = {
|
sources = {
|
||||||
|
{
|
||||||
|
name = 'lazydev',
|
||||||
|
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
||||||
|
group_index = 0,
|
||||||
|
},
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
{ name = 'luasnip' },
|
{ name = 'luasnip' },
|
||||||
{ name = 'path' },
|
{ name = 'path' },
|
||||||
@ -720,23 +840,24 @@ require('lazy').setup({
|
|||||||
|
|
||||||
{ -- You can easily change to a different colorscheme.
|
{ -- You can easily change to a different colorscheme.
|
||||||
-- Change the name of the colorscheme plugin below, and then
|
-- Change the name of the colorscheme plugin below, and then
|
||||||
-- change the command in the config to whatever the name of that colorscheme is
|
-- change the command in the config to whatever the name of that colorscheme is.
|
||||||
--
|
--
|
||||||
-- 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',
|
||||||
lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
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
|
init = function()
|
||||||
config = function()
|
-- Load the colorscheme here.
|
||||||
-- Load the colorscheme here
|
-- Like many other themes, this one has different styles, and you could load
|
||||||
|
-- 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
|
-- You can configure highlights by doing something like:
|
||||||
vim.cmd.hi 'Comment gui=none'
|
vim.cmd.hi 'Comment gui=none'
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Highlight todo, notes, etc in comments
|
-- Highlight todo, notes, etc in comments
|
||||||
{ 'folke/todo-comments.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
|
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
|
||||||
|
|
||||||
{ -- Collection of various small independent plugins/modules
|
{ -- Collection of various small independent plugins/modules
|
||||||
'echasnovski/mini.nvim',
|
'echasnovski/mini.nvim',
|
||||||
@ -744,8 +865,8 @@ require('lazy').setup({
|
|||||||
-- Better Around/Inside textobjects
|
-- Better Around/Inside textobjects
|
||||||
--
|
--
|
||||||
-- Examples:
|
-- Examples:
|
||||||
-- - va) - [V]isually select [A]round [)]parenthen
|
-- - va) - [V]isually select [A]round [)]paren
|
||||||
-- - yinq - [Y]ank [I]nside [N]ext [']quote
|
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
|
||||||
-- - 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 }
|
||||||
|
|
||||||
@ -759,56 +880,95 @@ require('lazy').setup({
|
|||||||
-- Simple and easy statusline.
|
-- Simple and easy statusline.
|
||||||
-- You could remove this setup call if you don't like it,
|
-- You could remove this setup call if you don't like it,
|
||||||
-- and try some other statusline plugin
|
-- and try some other statusline plugin
|
||||||
require('mini.statusline').setup()
|
local statusline = require 'mini.statusline'
|
||||||
|
-- set use_icons to true if you have a Nerd Font
|
||||||
|
statusline.setup { use_icons = vim.g.have_nerd_font }
|
||||||
|
|
||||||
|
-- You can configure sections in the statusline by overriding their
|
||||||
|
-- default behavior. For example, here we set the section for
|
||||||
|
-- cursor location to LINE:COLUMN
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
|
statusline.section_location = function()
|
||||||
|
return '%2l:%-2v'
|
||||||
|
end
|
||||||
|
|
||||||
-- ... and there is more!
|
-- ... and there is more!
|
||||||
-- Check out: https://github.com/echasnovski/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',
|
||||||
build = ':TSUpdate',
|
build = ':TSUpdate',
|
||||||
config = function()
|
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
||||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||||
|
opts = {
|
||||||
---@diagnostic disable-next-line: missing-fields
|
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
|
||||||
require('nvim-treesitter.configs').setup {
|
-- Autoinstall languages that are not installed
|
||||||
ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' },
|
auto_install = true,
|
||||||
-- Autoinstall languages that are not installed
|
highlight = {
|
||||||
auto_install = true,
|
enable = true,
|
||||||
highlight = { enable = true },
|
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
|
||||||
indent = { enable = true },
|
-- 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' },
|
||||||
-- There are additional nvim-treesitter modules that you can use to interact
|
},
|
||||||
-- with nvim-treesitter. You should go explore a few and see what interests you:
|
indent = { enable = true, disable = { 'ruby' } },
|
||||||
--
|
},
|
||||||
-- - Incremental selection: Included, see :help nvim-treesitter-incremental-selection-mod
|
-- There are additional nvim-treesitter modules that you can use to interact
|
||||||
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
-- with nvim-treesitter. You should go explore a few and see what interests you:
|
||||||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
--
|
||||||
end,
|
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
|
||||||
|
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
||||||
|
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||||
},
|
},
|
||||||
|
|
||||||
-- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
-- The following 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
|
||||||
-- put them in the right spots if you want.
|
-- place them in the correct locations.
|
||||||
|
|
||||||
-- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for kickstart
|
-- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart
|
||||||
--
|
--
|
||||||
-- Here are some example plugins that I've included in the kickstart repository.
|
-- Here are some example plugins that I've included in the Kickstart repository.
|
||||||
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
|
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
|
||||||
--
|
--
|
||||||
-- 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.autopairs',
|
||||||
|
-- require 'kickstart.plugins.neo-tree',
|
||||||
|
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend 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
|
||||||
|
}, {
|
||||||
|
ui = {
|
||||||
|
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
||||||
|
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
|
||||||
|
icons = vim.g.have_nerd_font and {} or {
|
||||||
|
cmd = '⌘',
|
||||||
|
config = '🛠',
|
||||||
|
event = '📅',
|
||||||
|
ft = '📂',
|
||||||
|
init = '⚙',
|
||||||
|
keys = '🗝',
|
||||||
|
plugin = '🔌',
|
||||||
|
runtime = '💻',
|
||||||
|
require = '🌙',
|
||||||
|
source = '📄',
|
||||||
|
start = '🚀',
|
||||||
|
task = '📌',
|
||||||
|
lazy = '💤 ',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
-- vim: ts=2 sts=2 sw=2 et
|
||||||
|
@ -6,15 +6,16 @@
|
|||||||
--]]
|
--]]
|
||||||
|
|
||||||
local check_version = function()
|
local check_version = function()
|
||||||
if not vim.version.cmp then
|
local verstr = tostring(vim.version())
|
||||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", tostring(vim.version())))
|
if not vim.version.ge then
|
||||||
|
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then
|
if vim.version.ge(vim.version(), '0.10-dev') then
|
||||||
vim.health.ok(string.format("Neovim version is: '%s'", tostring(vim.version())))
|
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", tostring(vim.version())))
|
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
16
lua/kickstart/plugins/autopairs.lua
Normal file
16
lua/kickstart/plugins/autopairs.lua
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
-- autopairs
|
||||||
|
-- https://github.com/windwp/nvim-autopairs
|
||||||
|
|
||||||
|
return {
|
||||||
|
'windwp/nvim-autopairs',
|
||||||
|
event = 'InsertEnter',
|
||||||
|
-- Optional dependency
|
||||||
|
dependencies = { 'hrsh7th/nvim-cmp' },
|
||||||
|
config = function()
|
||||||
|
require('nvim-autopairs').setup {}
|
||||||
|
-- If you want to automatically add `(` after selecting a function or method
|
||||||
|
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
|
||||||
|
local cmp = require 'cmp'
|
||||||
|
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
||||||
|
end,
|
||||||
|
}
|
@ -14,6 +14,9 @@ return {
|
|||||||
-- Creates a beautiful debugger UI
|
-- Creates a beautiful debugger UI
|
||||||
'rcarriga/nvim-dap-ui',
|
'rcarriga/nvim-dap-ui',
|
||||||
|
|
||||||
|
-- Required dependency for nvim-dap-ui
|
||||||
|
'nvim-neotest/nvim-nio',
|
||||||
|
|
||||||
-- Installs the debug adapters for you
|
-- Installs the debug adapters for you
|
||||||
'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
'jay-babu/mason-nvim-dap.nvim',
|
'jay-babu/mason-nvim-dap.nvim',
|
||||||
@ -21,6 +24,59 @@ return {
|
|||||||
-- 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'
|
||||||
@ -28,7 +84,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_setup = true,
|
automatic_installation = 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
|
||||||
@ -42,16 +98,6 @@ 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|
|
||||||
dapui.setup {
|
dapui.setup {
|
||||||
@ -74,14 +120,29 @@ return {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
-- Change breakpoint icons
|
||||||
vim.keymap.set('n', '<F7>', dapui.toggle, { desc = 'Debug: See last session result.' })
|
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
|
||||||
|
-- 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,
|
||||||
}
|
}
|
||||||
|
61
lua/kickstart/plugins/gitsigns.lua
Normal file
61
lua/kickstart/plugins/gitsigns.lua
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||||
|
-- NOTE: gitsigns is already included in init.lua but contains only the base
|
||||||
|
-- config. This will add also the recommended keymaps.
|
||||||
|
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'lewis6991/gitsigns.nvim',
|
||||||
|
opts = {
|
||||||
|
on_attach = function(bufnr)
|
||||||
|
local gitsigns = require 'gitsigns'
|
||||||
|
|
||||||
|
local function map(mode, l, r, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.buffer = bufnr
|
||||||
|
vim.keymap.set(mode, l, r, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Navigation
|
||||||
|
map('n', ']c', function()
|
||||||
|
if vim.wo.diff then
|
||||||
|
vim.cmd.normal { ']c', bang = true }
|
||||||
|
else
|
||||||
|
gitsigns.nav_hunk 'next'
|
||||||
|
end
|
||||||
|
end, { desc = 'Jump to next git [c]hange' })
|
||||||
|
|
||||||
|
map('n', '[c', function()
|
||||||
|
if vim.wo.diff then
|
||||||
|
vim.cmd.normal { '[c', bang = true }
|
||||||
|
else
|
||||||
|
gitsigns.nav_hunk 'prev'
|
||||||
|
end
|
||||||
|
end, { desc = 'Jump to previous git [c]hange' })
|
||||||
|
|
||||||
|
-- Actions
|
||||||
|
-- visual mode
|
||||||
|
map('v', '<leader>hs', function()
|
||||||
|
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||||
|
end, { desc = '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.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' })
|
||||||
|
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
|
||||||
|
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
||||||
|
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
|
||||||
|
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
||||||
|
map('n', '<leader>hD', function()
|
||||||
|
gitsigns.diffthis '@'
|
||||||
|
end, { desc = 'git [D]iff against last commit' })
|
||||||
|
-- Toggles
|
||||||
|
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
||||||
|
map('n', '<leader>tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
60
lua/kickstart/plugins/lint.lua
Normal file
60
lua/kickstart/plugins/lint.lua
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
return {
|
||||||
|
|
||||||
|
{ -- Linting
|
||||||
|
'mfussenegger/nvim-lint',
|
||||||
|
event = { 'BufReadPre', 'BufNewFile' },
|
||||||
|
config = function()
|
||||||
|
local lint = require 'lint'
|
||||||
|
lint.linters_by_ft = {
|
||||||
|
markdown = { 'markdownlint' },
|
||||||
|
}
|
||||||
|
|
||||||
|
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
||||||
|
-- instead set linters_by_ft like this:
|
||||||
|
-- lint.linters_by_ft = lint.linters_by_ft or {}
|
||||||
|
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
|
||||||
|
--
|
||||||
|
-- However, note that this will enable a set of default linters,
|
||||||
|
-- which will cause errors unless these tools are available:
|
||||||
|
-- {
|
||||||
|
-- clojure = { "clj-kondo" },
|
||||||
|
-- dockerfile = { "hadolint" },
|
||||||
|
-- inko = { "inko" },
|
||||||
|
-- janet = { "janet" },
|
||||||
|
-- json = { "jsonlint" },
|
||||||
|
-- markdown = { "vale" },
|
||||||
|
-- rst = { "vale" },
|
||||||
|
-- ruby = { "ruby" },
|
||||||
|
-- terraform = { "tflint" },
|
||||||
|
-- text = { "vale" }
|
||||||
|
-- }
|
||||||
|
--
|
||||||
|
-- You can disable the default linters by setting their filetypes to nil:
|
||||||
|
-- lint.linters_by_ft['clojure'] = nil
|
||||||
|
-- lint.linters_by_ft['dockerfile'] = nil
|
||||||
|
-- lint.linters_by_ft['inko'] = nil
|
||||||
|
-- lint.linters_by_ft['janet'] = nil
|
||||||
|
-- lint.linters_by_ft['json'] = nil
|
||||||
|
-- lint.linters_by_ft['markdown'] = nil
|
||||||
|
-- lint.linters_by_ft['rst'] = nil
|
||||||
|
-- lint.linters_by_ft['ruby'] = nil
|
||||||
|
-- lint.linters_by_ft['terraform'] = nil
|
||||||
|
-- lint.linters_by_ft['text'] = nil
|
||||||
|
|
||||||
|
-- Create autocommand which carries out the actual linting
|
||||||
|
-- on the specified events.
|
||||||
|
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
||||||
|
group = lint_augroup,
|
||||||
|
callback = function()
|
||||||
|
-- Only run the linter in buffers that you can modify in order to
|
||||||
|
-- avoid superfluous noise, notably within the handy LSP pop-ups that
|
||||||
|
-- describe the hovered symbol using Markdown.
|
||||||
|
if vim.opt_local.modifiable:get() then
|
||||||
|
lint.try_lint()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
25
lua/kickstart/plugins/neo-tree.lua
Normal file
25
lua/kickstart/plugins/neo-tree.lua
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
-- Neo-tree is a Neovim plugin to browse the file system
|
||||||
|
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||||
|
|
||||||
|
return {
|
||||||
|
'nvim-neo-tree/neo-tree.nvim',
|
||||||
|
version = '*',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||||
|
'MunifTanjim/nui.nvim',
|
||||||
|
},
|
||||||
|
cmd = 'Neotree',
|
||||||
|
keys = {
|
||||||
|
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
filesystem = {
|
||||||
|
window = {
|
||||||
|
mappings = {
|
||||||
|
['\\'] = 'close_window',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user