This commit is contained in:
Hendra 2025-05-11 09:09:48 +07:00
commit 20a1009e95
11 changed files with 723 additions and 346 deletions

View File

@ -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. -->
@ -18,8 +25,8 @@ assignees: ''
## Desktop ## Desktop
<!-- please complete the following information. --> <!-- please complete the following information. -->
- OS: - OS:
- Terminal: - Terminal:
## Neovim Version ## Neovim Version
<!-- Output of running `:version` from inside of neovim. --> <!-- Output of running `:version` from inside of neovim. -->

8
.github/pull_request_template.md vendored Normal file
View 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.
**************************************************************************

210
README.md
View File

@ -21,33 +21,54 @@ 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 - A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
- if you have it set `vim.g.have_nerd_font` in `init.lua` to true - if you have it set `vim.g.have_nerd_font` in `init.lua` to true
- Emoji fonts (Ubuntu only, and only if you want emoji!) `sudo apt install fonts-noto-color-emoji`
- Language Setup: - Language Setup:
- If 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\` |
### Install Kickstart #### Recommended Step
Clone kickstart.nvim: [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>
@ -62,13 +83,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>
@ -82,109 +103,61 @@ 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
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o) [The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
### 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 install. You
can install it on 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
NOTE: You'll need to uncomment the line in the init.lua that turns on loading custom plugins.
<details>
<summary>Adding autopairs</summary>
This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs) and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim).
In the file: `lua/custom/plugins/autopairs.lua`, add:
```lua
-- File: lua/custom/plugins/autopairs.lua
return {
"windwp/nvim-autopairs",
-- Optional dependency
dependencies = { 'hrsh7th/nvim-cmp' },
config = function()
require("nvim-autopairs").setup {}
-- If you want to automatically add `(` after selecting a function or method
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
end,
}
```
</details>
<details>
<summary>Adding a file tree plugin</summary>
This will install the tree plugin and add the command `:Neotree` for you. For more information, see the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim).
In the file: `lua/custom/plugins/filetree.lua`, add:
```lua
-- 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 and then delete all associated files. * You should back it up and then delete all associated files.
* This includes your existing init.lua and the neovim files in `~/.local` 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 use to `git clone` as a basis for their own. configuration that someone can easily use to `git clone` as a basis for their own.
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
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
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` 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)
@ -196,7 +169,8 @@ This requires:
```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, Alternatively, one can install gcc and make which don't require changing the config,
the easiest way is to use choco: the easiest way is to use choco:
@ -207,10 +181,60 @@ run in cmd as **admin**:
winget install --accept-source-agreements chocolatey.chocolatey winget install --accept-source-agreements chocolatey.chocolatey
``` ```
2. install all requirements using choco, exit previous cmd and 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**: 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 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-linux-x86_64.tar.gz
sudo rm -rf /opt/nvim-linux-x86_64
sudo mkdir -p /opt/nvim-linux-x86_64
sudo chmod a+rX /opt/nvim-linux-x86_64
sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz
# make it available in /usr/local/bin, distro installs to /usr/bin
sudo ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/
```
</details>
<details><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>
Then, continue with the [Install Kickstart](#Install-Kickstart) step.

585
init.lua
View File

@ -1,5 +1,37 @@
--[[ --[[
=======
=====================================================================
==================== READ THIS BEFORE CONTINUING ====================
=====================================================================
======== .-----. ========
======== .----------------------. | === | ========
======== |.-""""""""""""""""""-.| |-----| ========
======== || || | === | ========
======== || KICKSTART.NVIM || |-----| ========
======== || || | === | ========
======== || || |-----| ========
======== ||:Tutor || |:::::| ========
======== |'-..................-'| |____o| ========
======== `"")----------------(""` ___________ ========
======== /::::::::::| |::::::::::\ \ no mouse \ ========
======== /:::========| |==hjkl==:::\ \ required \ ========
======== '""""""""""""' '""""""""""""' '""""""""""' ========
======== ========
=====================================================================
=====================================================================
What is Kickstart?
Kickstart.nvim is *not* a distribution.
Kickstart.nvim is a starting point for your own configuration.
The goal is that you can read every line of code, top-to-bottom, understand
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
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!
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
a guide. One possible example which will only take 10-15 minutes: a guide. One possible example which will only take 10-15 minutes:
@ -20,32 +52,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
@ -59,7 +91,7 @@ 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 -- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = true vim.g.have_nerd_font = true
-- [[ Setting options ]] -- [[ Setting options ]]
@ -70,7 +102,7 @@ vim.g.have_nerd_font = true
-- 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
@ -80,13 +112,16 @@ vim.opt.wrap = false
-- 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
@ -94,7 +129,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
@ -103,13 +138,15 @@ 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
@ -124,11 +161,16 @@ vim.opt.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor. -- Minimal number of screen lines to keep above and below the cursor.
vim.opt.scrolloff = 10 vim.opt.scrolloff = 10
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
-- instead raise a dialog asking if you wish to save the current file(s)
-- See `:help 'confirm'`
vim.opt.confirm = true
-- [[ 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>')
vim.keymap.set('i', 'jj', '<esc>') vim.keymap.set('i', 'jj', '<esc>')
@ -138,9 +180,6 @@ vim.keymap.set('n', '<leader>l', '<cmd>bnext<cr>')
vim.keymap.set('n', '<leader>sv', '<cmd>write<cr>', { desc = 'Sa[v]e File' }) vim.keymap.set('n', '<leader>sv', '<cmd>write<cr>', { desc = 'Sa[v]e File' })
-- 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' })
vim.keymap.set('n', '<leader>yp', function() vim.keymap.set('n', '<leader>yp', function()
@ -170,6 +209,12 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }) vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
-- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })
-- [[ Basic Autocommands ]] -- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands` -- See `:help lua-guide-autocommands`
@ -187,9 +232,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)
@ -200,7 +248,7 @@ 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.
@ -212,17 +260,22 @@ require('lazy').setup({
-- with the first argument being the link and the following -- with the first argument being the link and the following
-- keys can be used to configure plugin behavior/loading/etc. -- keys can be used to configure plugin behavior/loading/etc.
-- --
-- Use `opts = {}` to force a plugin to be loaded. -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
-- --
-- This is equivalent to:
-- require('Comment').setup({})
-- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} },
-- Alternatively, use `config = function() ... end` for full control over the configuration.
-- If you prefer to call `setup` explicitly, use:
-- {
-- 'lewis6991/gitsigns.nvim',
-- config = function()
-- require('gitsigns').setup({
-- -- Your gitsigns configuration here
-- })
-- end,
-- }
--
-- 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`.
-- require('gitsigns').setup({ ... })
-- --
-- See `:help gitsigns` to understand what the configuration keys do -- See `:help gitsigns` to understand what the configuration keys do
{ -- Adds git related signs to the gutter, as well as utilities for managing changes { -- Adds git related signs to the gutter, as well as utilities for managing changes
@ -238,7 +291,7 @@ 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.
@ -249,19 +302,21 @@ require('lazy').setup({
-- which loads which-key before all the UI elements are loaded. Events can be -- which loads which-key before all the UI elements are loaded. Events can be
-- normal autocommands events (`:help autocmd-events`). -- normal autocommands events (`:help autocmd-events`).
-- --
-- Then, because we use the `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 = 'VimEnter', -- Sets the loading event to 'VimEnter' event = 'VimEnter', -- Sets the loading event to 'VimEnter'
opts = { opts = {
-- delay between pressing a key and opening which-key (milliseconds)
-- this setting is independent of vim.opt.timeoutlen
delay = 0,
icons = { icons = {
-- set icon mappings to true if you have a Nerd Font -- set icon mappings to true if you have a Nerd Font
mappings = vim.g.have_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 -- If you are using a Nerd Font: set icons.keys to an empty table which will use the
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table -- default which-key.nvim defined Nerd Font icons, otherwise define a string table
keys = vim.g.have_nerd_font and {} or { keys = vim.g.have_nerd_font and {} or {
Up = '<Up> ', Up = '<Up> ',
Down = '<Down> ', Down = '<Down> ',
@ -296,11 +351,7 @@ require('lazy').setup({
-- Document existing key chains -- Document existing key chains
spec = { spec = {
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
{ '<leader>d', group = '[D]ocument' },
{ '<leader>r', group = '[R]ename' },
{ '<leader>s', group = '[S]earch' }, { '<leader>s', group = '[S]earch' },
{ '<leader>w', group = '[W]orkspace' },
{ '<leader>t', group = '[T]oggle' }, { '<leader>t', group = '[T]oggle' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } }, { '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
}, },
@ -314,30 +365,46 @@ require('lazy').setup({
-- --
-- Use the `dependencies` key to specify the dependencies of a particular plugin -- Use the `dependencies` key to specify the dependencies of a particular plugin
{ -- 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.
'williamboman/mason-lspconfig.nvim', -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
{ 'mason-org/mason.nvim', opts = {} },
'mason-org/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim',
-- Useful status updates for LSP. -- Useful status updates for LSP.
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` -- 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 -- Allows extra capabilities provided by blink.cmp
'hrsh7th/cmp-nvim-lsp', 'saghen/blink.cmp',
}, },
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!
-- --
@ -361,14 +428,14 @@ 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.
@ -383,10 +450,22 @@ require('lazy').setup({
-- Useful when your language has ways of declaring types without an actual implementation. -- Useful when your language has ways of declaring types without an actual implementation.
map('gI', require('fzf-lua').lsp_implementations, '[G]oto [I]mplementation') map('gI', require('fzf-lua').lsp_implementations, '[G]oto [I]mplementation')
-- Rename the variable under your cursor
-- Most Language Servers support renaming across files, etc.
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
-- or a suggestion from your LSP for this to activate.
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
-- WARN: This is not Goto Definition, this is Goto Declaration.
-- For example, in C this would take you to the header
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
-- Jump to the type of the word under your cursor. -- Jump to the type of the word under your cursor.
-- Useful when you're not sure what type a variable is and you want to see -- Useful when you're not sure what type a variable is and you want to see
-- the definition of its *type*, not where it was *defined*. -- the definition of its *type*, not where it was *defined*.
map('<leader>D', require('fzf-lua').lsp_typedefs, 'Type [D]efinition') map('<leader>gD', require('fzf-lua').lsp_typedefs, 'Type [D]efinition')
-- Fuzzy find all the symbols in your current document. -- Fuzzy find all the symbols in your current document.
-- Symbols are things like variables, functions, types, etc. -- Symbols are things like variables, functions, types, etc.
@ -396,21 +475,22 @@ require('lazy').setup({
-- Similar to document symbols, except searches over your whole project. -- Similar to document symbols, except searches over your whole project.
map('<leader>ws', require('fzf-lua').lsp_workspace_symbols, '[W]orkspace [S]ymbols') map('<leader>ws', require('fzf-lua').lsp_workspace_symbols, '[W]orkspace [S]ymbols')
-- Rename the variable under your cursor
-- Most Language Servers support renaming across files, etc.
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
-- or a suggestion from your LSP for this to activate.
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. -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
-- For example, in C this would take you to the header ---@param client vim.lsp.Client
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') ---@param method vim.lsp.protocol.Method
---@param bufnr? integer some lsp support methods only in specific files
---@return boolean
local function client_supports_method(client, method, bufnr)
if vim.fn.has 'nvim-0.11' == 1 then
return client:supports_method(method, bufnr)
else
return client.supports_method(method, { bufnr = bufnr })
end
end
-- The following two autocommands are used to highlight references of the -- The following two autocommands are used to highlight references of the
-- word under your cursor when your cursor rests there for a little while. -- word under your cursor when your cursor rests there for a little while.
@ -419,7 +499,7 @@ require('lazy').setup({
-- When you move your cursor, the highlights will be cleared (the second autocommand). -- When you move your cursor, the highlights will be cleared (the second autocommand).
-- --
local client = vim.lsp.get_client_by_id(event.data.client_id) local client = vim.lsp.get_client_by_id(event.data.client_id)
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) 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,
@ -441,15 +521,53 @@ require('lazy').setup({
end, end,
}) })
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(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
map('<leader>th', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
end, '[T]oggle Inlay [H]ints')
end
end, end,
}) })
-- Diagnostic Config
-- See :help vim.diagnostic.Opts
vim.diagnostic.config {
severity_sort = true,
float = { border = 'rounded', source = 'if_many' },
underline = { severity = vim.diagnostic.severity.ERROR },
signs = vim.g.have_nerd_font and {
text = {
[vim.diagnostic.severity.ERROR] = '󰅚 ',
[vim.diagnostic.severity.WARN] = '󰀪 ',
[vim.diagnostic.severity.INFO] = '󰋽 ',
[vim.diagnostic.severity.HINT] = '󰌶 ',
},
} or {},
virtual_text = {
source = 'if_many',
spacing = 2,
format = function(diagnostic)
local diagnostic_message = {
[vim.diagnostic.severity.ERROR] = diagnostic.message,
[vim.diagnostic.severity.WARN] = diagnostic.message,
[vim.diagnostic.severity.INFO] = diagnostic.message,
[vim.diagnostic.severity.HINT] = diagnostic.message,
}
return diagnostic_message[diagnostic.severity]
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 blink.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 blink.cmp, and then broadcast that to the servers.
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = require('blink.cmp').get_lsp_capabilities()
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
-- Enable the following language servers -- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed. -- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
@ -471,6 +589,10 @@ 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 (`ts_ls`) will work just fine
-- ts_ls = {},
--
ts_ls = {}, ts_ls = {},
svelte = {}, svelte = {},
ruby_lsp = { ruby_lsp = {
@ -482,25 +604,12 @@ require('lazy').setup({
vim.fn.expand '~/test/misw', vim.fn.expand '~/test/misw',
}, },
}, },
lua_ls = { lua_ls = {
-- cmd = {...}, -- cmd = { ... },
-- filetypes { ...}, -- filetypes = { ... },
-- capabilities = {}, -- capabilities = {},
settings = { settings = {
Lua = { Lua = {
runtime = { version = 'LuaJIT' },
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 },
},
completion = { completion = {
callSnippet = 'Replace', callSnippet = 'Replace',
}, },
@ -512,28 +621,33 @@ 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 }
require('mason-lspconfig').setup { require('mason-lspconfig').setup {
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
automatic_installation = false,
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 -- This handles overriding only values explicitly passed
-- by the server configuration above. Useful when disabling -- by the server configuration above. Useful when disabling
-- certain features of an LSP (for example, turning off formatting for tsserver) -- certain features of an LSP (for example, turning off formatting for ts_ls)
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
require('lspconfig')[server_name].setup(server) require('lspconfig')[server_name].setup(server)
end, end,
@ -563,16 +677,14 @@ require('lazy').setup({
-- have a well standardized coding style. You can add additional -- have a well standardized coding style. You can add additional
-- languages here or re-enable it for the disabled ones. -- languages here or re-enable it for the disabled ones.
local disable_filetypes = { c = true, cpp = true } local disable_filetypes = { c = true, cpp = true }
local lsp_format_opt
if disable_filetypes[vim.bo[bufnr].filetype] then if disable_filetypes[vim.bo[bufnr].filetype] then
lsp_format_opt = 'never' return nil
else else
lsp_format_opt = 'fallback' return {
timeout_ms = 500,
lsp_format = 'fallback',
}
end end
return {
timeout_ms = 500,
lsp_format = lsp_format_opt,
}
end, end,
formatters_by_ft = { formatters_by_ft = {
lua = { 'stylua' }, lua = { 'stylua' },
@ -586,118 +698,123 @@ require('lazy').setup({
}, },
{ -- Autocompletion { -- Autocompletion
'hrsh7th/nvim-cmp', 'saghen/blink.cmp',
event = 'InsertEnter', event = 'VimEnter',
version = '1.*',
dependencies = { dependencies = {
-- Snippet Engine & its associated nvim-cmp source -- Snippet Engine
{ {
'L3MON4D3/LuaSnip', 'L3MON4D3/LuaSnip',
version = '2.*',
build = (function() build = (function()
-- Build Step is needed for regex support in snippets -- Build Step is needed for regex support in snippets.
-- This step is not supported in many windows environments -- This step is not supported in many windows environments.
-- Remove the below condition to re-enable on windows -- Remove the below condition to re-enable on windows.
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then 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 = {
'saadparwaiz1/cmp_luasnip', -- `friendly-snippets` contains a variety of premade snippets.
-- See the README about individual language/framework/plugin snippets:
-- Adds other completion capabilities. -- https://github.com/rafamadriz/friendly-snippets
-- nvim-cmp does not ship with all sources by default. They are split -- {
-- into multiple repos for maintenance purposes. -- 'rafamadriz/friendly-snippets',
'hrsh7th/cmp-nvim-lsp', -- config = function()
'hrsh7th/cmp-path', -- require('luasnip.loaders.from_vscode').lazy_load()
-- end,
-- 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()
-- See `:help cmp`
local cmp = require 'cmp'
local luasnip = require 'luasnip'
luasnip.config.setup {}
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
}, },
completion = { completeopt = 'menu,menuone,noinsert' }, opts = {},
},
-- For an understanding of why these mappings were 'folke/lazydev.nvim',
-- chosen, you will need to read `:help ins-completion` },
--- @module 'blink.cmp'
--- @type blink.cmp.Config
opts = {
keymap = {
-- 'default' (recommended) for mappings similar to built-in completions
-- <c-y> to accept ([y]es) the completion.
-- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet.
-- 'super-tab' for tab to accept
-- 'enter' for enter to accept
-- 'none' for no mappings
--
-- For an understanding of why the 'default' preset is recommended,
-- you will need to read `:help ins-completion`
-- --
-- No, but seriously. Please read `:help ins-completion`, it is really good! -- No, but seriously. Please read `:help ins-completion`, it is really good!
mapping = cmp.mapping.preset.insert { --
-- Select the [n]ext item -- All presets have the following mappings:
['<C-n>'] = cmp.mapping.select_next_item(), -- <tab>/<s-tab>: move to right/left of your snippet expansion
-- Select the [p]revious item -- <c-space>: Open menu or open docs if already open
['<C-p>'] = cmp.mapping.select_prev_item(), -- <c-n>/<c-p> or <up>/<down>: Select next/previous item
-- <c-e>: Hide menu
-- <c-k>: Toggle signature help
--
-- See :h blink-cmp-config-keymap for defining your own keymap
preset = 'default',
-- Scroll the documentation window [b]ack / [f]orward -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
['<C-b>'] = cmp.mapping.scroll_docs(-4), -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
['<C-f>'] = cmp.mapping.scroll_docs(4), },
-- Accept ([y]es) the completion. appearance = {
-- This will auto-import if your LSP supports it. -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- This will expand snippets if the LSP sent a snippet. -- Adjusts spacing to ensure icons are aligned
['<C-y>'] = cmp.mapping.confirm { select = true }, nerd_font_variant = 'mono',
},
-- Manually trigger a completion from nvim-cmp. completion = {
-- Generally you don't need this, because nvim-cmp will display -- By default, you may press `<c-space>` to show the documentation.
-- completions whenever it has completion options available. -- Optionally, set `auto_show = true` to show the documentation after a delay.
['<C-Space>'] = cmp.mapping.complete {}, documentation = { auto_show = false, auto_show_delay_ms = 500 },
},
-- Think of <c-l> as moving to the right of your snippet expansion. sources = {
-- So if you have a snippet that's like: default = { 'lsp', 'path', 'snippets', 'lazydev' },
-- function $name($args) providers = {
-- $body lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
-- end
--
-- <c-l> will move you to the right of each of the expansion locations.
-- <c-h> is similar, except moving you backwards.
['<C-l>'] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
end
end, { 'i', 's' }),
['<C-h>'] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
end
end, { 'i', 's' }),
}, },
sources = { },
{ name = 'nvim_lsp' },
{ name = 'luasnip' }, snippets = { preset = 'luasnip' },
{ name = 'path' },
}, -- Blink.cmp includes an optional, recommended rust fuzzy matcher,
} -- which automatically downloads a prebuilt binary when enabled.
end, --
-- By default, we use the Lua implementation instead, but you may enable
-- the rust implementation via `'prefer_rust_with_warning'`
--
-- See :h blink-cmp-config-fuzzy for more information
fuzzy = { implementation = 'lua' },
-- Shows a signature help window while you type arguments for a function
signature = { enabled = true },
},
}, },
{ -- 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
config = function() config = function()
---@diagnostic disable-next-line: missing-fields
require('tokyonight').setup {
styles = {
comments = { italic = false }, -- Disable italics in comments
},
}
-- Load the colorscheme here. -- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load -- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
vim.cmd.colorscheme 'tokyonight-night' vim.cmd.colorscheme 'tokyonight-night'
-- You can configure highlights by doing something like
vim.cmd.hi 'Comment gui=none'
end, end,
}, },
@ -711,7 +828,7 @@ require('lazy').setup({
-- --
-- Examples: -- Examples:
-- - va) - [V]isually select [A]round [)]paren -- - 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 }
@ -743,51 +860,50 @@ require('lazy').setup({
-- 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',
main = 'nvim-treesitter.configs', -- Sets main module to use for opts main = 'nvim-treesitter.configs', -- Sets main module to use for opts
config = function() -- [[ Configure Treesitter ]] See `:help nvim-treesitter`
-- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = {
ensure_installed = {
'bash',
'c',
'javascript',
'python',
'svelte',
'elixir',
'go',
'diff',
'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', 'elixir' } },
},
---@diagnostic disable-next-line: missing-fields -- vim.api.nvim_set_option_value('foldenable', false, {})
require('nvim-treesitter.configs').setup { -- vim.api.nvim_set_option_value('foldmethod', 'expr', {})
ensure_installed = { -- vim.api.nvim_set_option_value('foldexpr', 'nvim_treesitter#foldexpr()', {})
'bash', --
'c', -- -- There are additional nvim-treesitter modules that you can use to interact
'javascript', -- -- with nvim-treesitter. You should go explore a few and see what interests you:
'python', -- --
'svelte', -- -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
'elixir', -- -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
'go', -- -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
'diff', -- end,
'html',
'lua',
'markdown',
'vim',
'vimdoc',
},
-- Autoinstall languages that are not installed
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = { 'ruby' },
},
indent = { enable = true, disable = { 'ruby', 'elixir' } },
}
vim.api.nvim_set_option_value('foldenable', false, {})
vim.api.nvim_set_option_value('foldmethod', 'expr', {})
vim.api.nvim_set_option_value('foldexpr', 'nvim_treesitter#foldexpr()', {})
-- There are additional nvim-treesitter modules that you can use to interact
-- with nvim-treesitter. You should go explore a few and see what interests you:
--
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
end,
}, },
{ {
@ -859,15 +975,19 @@ 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
-- 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.
@ -875,10 +995,15 @@ require('lazy').setup({
-- 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' },
--
-- 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 = { ui = {
-- If you have a Nerd Font, set icons to an empty table which will use the -- If you are using a Nerd Font: set icons to an empty table which will use the
-- default lazy.nvim defined Nerd Font icons otherwise define a unicode icons table -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
icons = vim.g.have_nerd_font and {} or { icons = vim.g.have_nerd_font and {} or {
cmd = '', cmd = '',
config = '🛠', config = '🛠',

View File

@ -1,10 +1,7 @@
{ {
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" }, "LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" },
"avante.nvim": { "branch": "main", "commit": "57311bf8cd2f48729565d2351bcbf383b6a56907" }, "avante.nvim": { "branch": "main", "commit": "57311bf8cd2f48729565d2351bcbf383b6a56907" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "blink.cmp": { "branch": "main", "commit": "4f38ce99a472932d5776337f08f7a8180f1f571a" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"codecompanion.nvim": { "branch": "main", "commit": "7ffbc5a8f7ba349cea0c3f20bac6c404d4130a4a" }, "codecompanion.nvim": { "branch": "main", "commit": "7ffbc5a8f7ba349cea0c3f20bac6c404d4130a4a" },
"conform.nvim": { "branch": "master", "commit": "1a99fdc1d3aa9ccdf3021e67982a679a8c5c740c" }, "conform.nvim": { "branch": "master", "commit": "1a99fdc1d3aa9ccdf3021e67982a679a8c5c740c" },
"copilot.lua": { "branch": "master", "commit": "1a237cf50372830a61d92b0adf00d3b23882e0e1" }, "copilot.lua": { "branch": "master", "commit": "1a237cf50372830a61d92b0adf00d3b23882e0e1" },
@ -16,6 +13,7 @@
"grug-far.nvim": { "branch": "main", "commit": "9a2f78219390b47d67795ab09390d7f092e23976" }, "grug-far.nvim": { "branch": "main", "commit": "9a2f78219390b47d67795ab09390d7f092e23976" },
"img-clip.nvim": { "branch": "main", "commit": "5ff183655ad98b5fc50c55c66540375bbd62438c" }, "img-clip.nvim": { "branch": "main", "commit": "5ff183655ad98b5fc50c55c66540375bbd62438c" },
"lazy.nvim": { "branch": "main", "commit": "460e1cd8f24e364d54543a4b0e83f6f4ec1f65fb" }, "lazy.nvim": { "branch": "main", "commit": "460e1cd8f24e364d54543a4b0e83f6f4ec1f65fb" },
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },

View File

@ -6,13 +6,13 @@
--]] --]]
local check_version = function() local check_version = function()
local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch) local verstr = tostring(vim.version())
if not vim.version.cmp then if not vim.version.ge then
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
return return
end end
if vim.version.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'", verstr)) vim.health.ok(string.format("Neovim version is: '%s'", verstr))
else else
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))

View File

@ -0,0 +1,8 @@
-- autopairs
-- https://github.com/windwp/nvim-autopairs
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
opts = {},
}

View File

@ -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,
} }

View 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.stage_hunk, { desc = 'git [u]ndo stage hunk' })
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
map('n', '<leader>hD', function()
gitsigns.diffthis '@'
end, { desc = 'git [D]iff against last commit' })
-- Toggles
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })
end,
},
},
}

View 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,
},
}

View 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',
},
},
},
},
}