Compare commits
22 Commits
master
...
teej-fixup
Author | SHA1 | Date | |
---|---|---|---|
|
8ff0f35da1 | ||
|
30a1ccc89b | ||
|
5775433158 | ||
|
1e3ba58a40 | ||
|
51842d8064 | ||
|
0f8eb177da | ||
|
9837e7ed38 | ||
|
48c88b73be | ||
|
dacbbf59c2 | ||
|
bad5a2d0b8 | ||
|
65cbba91ab | ||
|
532dbef6b4 | ||
|
95d8863806 | ||
|
1b9467751a | ||
|
ceadebd22d | ||
|
2022a26e28 | ||
|
f1d3a3c32f | ||
|
e9f8139fcf | ||
|
2d9bfa0bb7 | ||
|
e419aa5ef6 | ||
|
c0ccf101ad | ||
|
1bc4bfc2fe |
141
README.md
141
README.md
@ -27,16 +27,13 @@ If you are experiencing issues, please make sure you have the latest versions.
|
|||||||
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)
|
||||||
- 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 want to write Typescript, you need `npm`
|
||||||
- If 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 [Windows Installation](#Windows-Installation) to double check any additional Windows notes
|
||||||
> and quick install snippets
|
|
||||||
|
|
||||||
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:
|
||||||
|
|
||||||
@ -46,24 +43,7 @@ Neovim's configurations are located under the following paths, depending on your
|
|||||||
| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` |
|
| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` |
|
||||||
| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` |
|
| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` |
|
||||||
|
|
||||||
### Install Kickstart
|
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`
|
|
||||||
|
|
||||||
#### 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>
|
||||||
|
|
||||||
@ -103,17 +83,27 @@ current plugin status.
|
|||||||
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.
|
||||||
|
|
||||||
|
### Getting Started
|
||||||
|
|
||||||
|
See [Effective Neovim: Instant IDE](https://youtu.be/stqUbv-5u2s), covering the
|
||||||
|
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
|
#### 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>
|
<details>
|
||||||
<summary>Adding autopairs</summary>
|
<summary>Adding autopairs</summary>
|
||||||
|
|
||||||
This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs)
|
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).
|
||||||
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:
|
In the file: `lua/custom/plugins/autopairs.lua`, add:
|
||||||
|
|
||||||
@ -141,14 +131,13 @@ return {
|
|||||||
<details>
|
<details>
|
||||||
<summary>Adding a file tree plugin</summary>
|
<summary>Adding a file tree plugin</summary>
|
||||||
|
|
||||||
This will install the tree plugin and add the command `:Neotree` for you.
|
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.
|
||||||
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:
|
In the file: `lua/custom/plugins/filetree.lua`, add:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- File: lua/custom/plugins/filetree.lua
|
-- Unless you are still migrating, remove the deprecated commands from v1.x
|
||||||
|
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"nvim-neo-tree/neo-tree.nvim",
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
@ -166,112 +155,40 @@ return {
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
### Getting Started
|
|
||||||
|
|
||||||
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
|
|
||||||
|
|
||||||
### 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, then delete all files associated with it.
|
||||||
* 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` to maintain multiple configurations. For example you can install the kickstart configuration in `~/.config/nvim-kickstart` and create an alias:
|
||||||
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
|
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.
|
||||||
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://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 `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
|
into smaller parts. A fork of kickstart that does this while maintaining the exact
|
||||||
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)
|
||||||
|
|
||||||
### Install Recipes
|
### Windows Installation
|
||||||
|
|
||||||
Below you can find OS specific install instructions for Neovim and dependencies.
|
Installation may require installing build tools, and updating the run command for `telescope-fzf-native`
|
||||||
|
|
||||||
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 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 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 neovim
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
<details><summary>Debian Install Steps</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install make gcc ripgrep unzip git
|
|
||||||
echo "deb https://deb.debian.org/debian unstable main" | sudo tee -a /etc/apt/sources.list
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -t unstable neovim
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
<details><summary>Fedora Install Steps</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo dnf install -y gcc make git ripgrep fd-find neovim
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
|
|
||||||
|
279
init.lua
279
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 the Neovim basics, you can skip this step.)
|
(If you already know how 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 exactly sure of what you're looking for.
|
which is very useful when you're not sure exactly 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 you understand what is happening.
|
Throughout the file. These are for you, the reader, to help 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 Neovim config.
|
for when you are first encountering a few different constructs in your nvim 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,9 +90,6 @@ 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
|
|
||||||
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!
|
||||||
@ -100,14 +97,14 @@ vim.g.have_nerd_font = false
|
|||||||
|
|
||||||
-- Make line numbers default
|
-- Make line numbers default
|
||||||
vim.opt.number = true
|
vim.opt.number = true
|
||||||
-- You can also add relative line numbers, to help with jumping.
|
-- You can also add relative line numbers, for 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 the status line
|
-- Don't show the mode, since it's already in status line
|
||||||
vim.opt.showmode = false
|
vim.opt.showmode = false
|
||||||
|
|
||||||
-- Sync clipboard between OS and Neovim.
|
-- Sync clipboard between OS and Neovim.
|
||||||
@ -121,7 +118,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 one or more capital letters in the search term
|
-- Case-insensitive searching UNLESS \C or capital in search
|
||||||
vim.opt.ignorecase = true
|
vim.opt.ignorecase = true
|
||||||
vim.opt.smartcase = true
|
vim.opt.smartcase = true
|
||||||
|
|
||||||
@ -130,18 +127,15 @@ vim.opt.signcolumn = 'yes'
|
|||||||
|
|
||||||
-- Decrease update time
|
-- Decrease update time
|
||||||
vim.opt.updatetime = 250
|
vim.opt.updatetime = 250
|
||||||
|
|
||||||
-- Decrease mapped sequence wait time
|
|
||||||
-- Displays which-key popup sooner
|
|
||||||
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 characters in the editor.
|
-- Sets how neovim will display certain whitespace 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 = '␣' }
|
||||||
|
|
||||||
@ -190,14 +184,10 @@ 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' })
|
||||||
|
|
||||||
-- [[ Basic 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.highlight.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',
|
|
||||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.highlight.on_yank()
|
vim.highlight.on_yank()
|
||||||
@ -220,11 +210,12 @@ 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
|
||||||
|
|
||||||
@ -241,7 +232,7 @@ require('lazy').setup({
|
|||||||
{ 'numToStr/Comment.nvim', opts = {} },
|
{ '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
|
||||||
@ -258,16 +249,16 @@ 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 = 'VimEnter'
|
-- event = 'VeryLazy'
|
||||||
--
|
--
|
||||||
-- which loads which-key before all the UI elements are loaded. Events can be
|
-- which loads which-key after all the UI elements are loaded. Events can be
|
||||||
-- normal autocommands events (`:help autocmd-events`).
|
-- normal autocommands events (:help autocomd-events).
|
||||||
--
|
--
|
||||||
-- Then, because we use the `config` key, the configuration only runs
|
-- Then, because we use the `config` key, the configuration only runs
|
||||||
-- after the plugin has been loaded:
|
-- after the plugin has been loaded:
|
||||||
@ -275,7 +266,7 @@ require('lazy').setup({
|
|||||||
|
|
||||||
{ -- Useful plugin to show you pending keybinds.
|
{ -- Useful plugin to show you pending keybinds.
|
||||||
'folke/which-key.nvim',
|
'folke/which-key.nvim',
|
||||||
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
event = 'VeryLazy', -- Sets the loading event to 'VeryLazy'
|
||||||
config = function() -- This is the function that runs, AFTER loading
|
config = function() -- This is the function that runs, AFTER loading
|
||||||
require('which-key').setup()
|
require('which-key').setup()
|
||||||
|
|
||||||
@ -299,11 +290,11 @@ require('lazy').setup({
|
|||||||
|
|
||||||
{ -- Fuzzy Finder (files, lsp, etc)
|
{ -- Fuzzy Finder (files, lsp, etc)
|
||||||
'nvim-telescope/telescope.nvim',
|
'nvim-telescope/telescope.nvim',
|
||||||
event = 'VimEnter',
|
event = 'VeryLazy',
|
||||||
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 installation instructions
|
{ -- If encountering errors, see telescope-fzf-native README for install 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.
|
||||||
@ -318,27 +309,29 @@ require('lazy').setup({
|
|||||||
},
|
},
|
||||||
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
||||||
|
|
||||||
-- Useful for getting pretty icons, but requires a Nerd Font.
|
-- Useful for getting pretty icons, but requires special font.
|
||||||
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
-- If you already have a Nerd Font, or terminal set up with fallback fonts
|
||||||
|
-- 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 ]]
|
||||||
@ -360,7 +353,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')
|
||||||
|
|
||||||
@ -379,14 +372,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 the theme, layout, etc.
|
-- You can pass additional configuration to telescope to change 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' })
|
||||||
|
|
||||||
-- It's also possible to pass additional configuration options.
|
-- 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 {
|
||||||
@ -395,7 +388,7 @@ 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' })
|
||||||
@ -405,7 +398,7 @@ require('lazy').setup({
|
|||||||
{ -- LSP Configuration & Plugins
|
{ -- LSP Configuration & Plugins
|
||||||
'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',
|
'williamboman/mason.nvim',
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/mason-lspconfig.nvim',
|
||||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||||
@ -413,21 +406,17 @@ require('lazy').setup({
|
|||||||
-- Useful status updates for LSP.
|
-- Useful status updates for LSP.
|
||||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
-- 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?**
|
||||||
--
|
--
|
||||||
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
-- LSP is an acronym 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!
|
||||||
--
|
--
|
||||||
@ -442,7 +431,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
|
||||||
@ -451,8 +440,9 @@ 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.
|
||||||
@ -462,7 +452,7 @@ require('lazy').setup({
|
|||||||
|
|
||||||
-- 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.
|
||||||
@ -481,11 +471,11 @@ 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 entire project.
|
-- Similar to document symbols, except searches over your whole 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')
|
||||||
|
|
||||||
@ -494,11 +484,11 @@ require('lazy').setup({
|
|||||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||||
|
|
||||||
-- Opens a popup that displays documentation about the word under your cursor
|
-- Opens a popup that displays documentation about the word under your cursor
|
||||||
-- See `:help K` for why this keymap.
|
-- See `:help K` for why this keymap
|
||||||
map('K', vim.lsp.buf.hover, 'Hover Documentation')
|
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
|
||||||
@ -522,7 +512,7 @@ require('lazy').setup({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- 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()
|
||||||
@ -553,12 +543,21 @@ require('lazy').setup({
|
|||||||
|
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
-- cmd = {...},
|
-- cmd = {...},
|
||||||
-- filetypes = { ...},
|
-- filetypes { ...},
|
||||||
-- capabilities = {},
|
-- capabilities = {},
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
completion = {
|
runtime = { version = 'LuaJIT' },
|
||||||
callSnippet = 'Replace',
|
workspace = {
|
||||||
|
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' } },
|
||||||
@ -572,14 +571,14 @@ require('lazy').setup({
|
|||||||
-- 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()
|
require('mason').setup()
|
||||||
|
|
||||||
-- 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 }
|
||||||
|
|
||||||
@ -587,11 +586,15 @@ require('lazy').setup({
|
|||||||
handlers = {
|
handlers = {
|
||||||
function(server_name)
|
function(server_name)
|
||||||
local server = servers[server_name] or {}
|
local server = servers[server_name] or {}
|
||||||
-- This handles overriding only values explicitly passed
|
require('lspconfig')[server_name].setup {
|
||||||
-- by the server configuration above. Useful when disabling
|
cmd = server.cmd,
|
||||||
-- certain features of an LSP (for example, turning off formatting for tsserver)
|
settings = server.settings,
|
||||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
filetypes = server.filetypes,
|
||||||
require('lspconfig')[server_name].setup(server)
|
-- 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)
|
||||||
|
capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}),
|
||||||
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -602,16 +605,10 @@ require('lazy').setup({
|
|||||||
'stevearc/conform.nvim',
|
'stevearc/conform.nvim',
|
||||||
opts = {
|
opts = {
|
||||||
notify_on_error = false,
|
notify_on_error = false,
|
||||||
format_on_save = function(bufnr)
|
format_on_save = {
|
||||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
timeout_ms = 500,
|
||||||
-- have a well standardized coding style. You can add additional
|
lsp_fallback = true,
|
||||||
-- languages here or re-enable it for the disabled ones.
|
},
|
||||||
local disable_filetypes = { c = true, cpp = true }
|
|
||||||
return {
|
|
||||||
timeout_ms = 500,
|
|
||||||
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
|
||||||
}
|
|
||||||
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
|
||||||
@ -632,25 +629,14 @@ 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',
|
||||||
|
|
||||||
@ -659,6 +645,12 @@ 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`
|
||||||
@ -684,10 +676,6 @@ 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.
|
||||||
@ -716,9 +704,6 @@ 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 = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
@ -731,24 +716,23 @@ 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',
|
||||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
||||||
init = function()
|
priority = 1000, -- make sure to load this before all the other start plugins
|
||||||
-- Load the colorscheme here.
|
config = function()
|
||||||
-- Like many other themes, this one has different styles, and you could load
|
-- Load the colorscheme here
|
||||||
-- 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', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
|
{ 'folke/todo-comments.nvim', 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',
|
||||||
@ -756,7 +740,7 @@ require('lazy').setup({
|
|||||||
-- Better Around/Inside textobjects
|
-- Better Around/Inside textobjects
|
||||||
--
|
--
|
||||||
-- Examples:
|
-- Examples:
|
||||||
-- - va) - [V]isually select [A]round [)]paren
|
-- - va) - [V]isually select [A]round [)]parenthen
|
||||||
-- - yinq - [Y]ank [I]nside [N]ext [']quote
|
-- - 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 }
|
||||||
@ -771,48 +755,32 @@ 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
|
||||||
local statusline = require 'mini.statusline'
|
require('mini.statusline').setup()
|
||||||
-- 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',
|
||||||
opts = {
|
config = function()
|
||||||
ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' },
|
|
||||||
-- Autoinstall languages that are not installed
|
|
||||||
auto_install = true,
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
|
|
||||||
-- If you are experiencing weird indenting issues, add the language to
|
|
||||||
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
|
|
||||||
additional_vim_regex_highlighting = { 'ruby' },
|
|
||||||
},
|
|
||||||
indent = { enable = true, disable = { 'ruby' } },
|
|
||||||
},
|
|
||||||
config = function(_, opts)
|
|
||||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
require('nvim-treesitter.configs').setup(opts)
|
require('nvim-treesitter.configs').setup {
|
||||||
|
ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' },
|
||||||
|
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||||
|
auto_install = true,
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true },
|
||||||
|
}
|
||||||
|
|
||||||
-- There are additional nvim-treesitter modules that you can use to interact
|
-- 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:
|
-- with nvim-treesitter. You should go explore a few and see what interests you:
|
||||||
--
|
--
|
||||||
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
|
-- - Incremental selection: Included, see :help nvim-treesitter-incremental-selection-mod
|
||||||
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
||||||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||||
end,
|
end,
|
||||||
@ -820,44 +788,23 @@ require('lazy').setup({
|
|||||||
|
|
||||||
-- The following two 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.
|
-- put them in the right spots if you want.
|
||||||
|
|
||||||
-- 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',
|
|
||||||
|
|
||||||
-- 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`
|
-- For additional information see: :help lazy.nvim-lazy.nvim-structuring-your-plugins
|
||||||
-- { import = 'custom.plugins' },
|
-- { import = 'custom.plugins' },
|
||||||
}, {
|
}, {})
|
||||||
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,16 +6,15 @@
|
|||||||
--]]
|
--]]
|
||||||
|
|
||||||
local check_version = function()
|
local check_version = function()
|
||||||
local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch)
|
|
||||||
if not vim.version.cmp then
|
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", tostring(vim.version())))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 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'", tostring(vim.version())))
|
||||||
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", tostring(vim.version())))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -14,9 +14,6 @@ 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',
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
return {
|
|
||||||
|
|
||||||
{ -- Linting
|
|
||||||
'mfussenegger/nvim-lint',
|
|
||||||
event = { 'BufReadPre', 'BufNewFile' },
|
|
||||||
config = function()
|
|
||||||
local lint = require 'lint'
|
|
||||||
lint.linters_by_ft = {
|
|
||||||
markdown = { 'markdownlint' },
|
|
||||||
}
|
|
||||||
|
|
||||||
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
|
||||||
-- instead set linters_by_ft like this:
|
|
||||||
-- lint.linters_by_ft = lint.linters_by_ft or {}
|
|
||||||
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
|
|
||||||
--
|
|
||||||
-- However, note that this will enable a set of default linters,
|
|
||||||
-- which will cause errors unless these tools are available:
|
|
||||||
-- {
|
|
||||||
-- clojure = { "clj-kondo" },
|
|
||||||
-- dockerfile = { "hadolint" },
|
|
||||||
-- inko = { "inko" },
|
|
||||||
-- janet = { "janet" },
|
|
||||||
-- json = { "jsonlint" },
|
|
||||||
-- markdown = { "vale" },
|
|
||||||
-- rst = { "vale" },
|
|
||||||
-- ruby = { "ruby" },
|
|
||||||
-- terraform = { "tflint" },
|
|
||||||
-- text = { "vale" }
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- You can disable the default linters by setting their filetypes to nil:
|
|
||||||
-- lint.linters_by_ft['clojure'] = nil
|
|
||||||
-- lint.linters_by_ft['dockerfile'] = nil
|
|
||||||
-- lint.linters_by_ft['inko'] = nil
|
|
||||||
-- lint.linters_by_ft['janet'] = nil
|
|
||||||
-- lint.linters_by_ft['json'] = nil
|
|
||||||
-- lint.linters_by_ft['markdown'] = nil
|
|
||||||
-- lint.linters_by_ft['rst'] = nil
|
|
||||||
-- lint.linters_by_ft['ruby'] = nil
|
|
||||||
-- lint.linters_by_ft['terraform'] = nil
|
|
||||||
-- lint.linters_by_ft['text'] = nil
|
|
||||||
|
|
||||||
-- Create autocommand which carries out the actual linting
|
|
||||||
-- on the specified events.
|
|
||||||
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
|
||||||
group = lint_augroup,
|
|
||||||
callback = function()
|
|
||||||
require('lint').try_lint()
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user