Compare commits
21 Commits
master
...
lazy-refre
Author | SHA1 | Date | |
---|---|---|---|
|
d8784b62db | ||
|
33469ef03d | ||
|
bdbe2f3ae2 | ||
|
e5c03b4206 | ||
|
775ff6ac89 | ||
|
ba5786cde4 | ||
|
a7400529d7 | ||
|
eea0adb4fe | ||
|
c33d911e60 | ||
|
e40d7048d4 | ||
|
5ba0db5522 | ||
|
0d7e4dadab | ||
|
1a2a96be4c | ||
|
36e99fbe35 | ||
|
d6ad146301 | ||
|
4d218e3b8a | ||
|
69d7d4a081 | ||
|
1afbeca63f | ||
|
68a0332ac2 | ||
|
4f112819b1 | ||
|
c6629b47ff |
16
.github/ISSUE_TEMPLATE/bug_report.md
vendored
16
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -8,21 +8,19 @@ 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 -->
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
## Describe the bug
|
**To Reproduce**
|
||||||
<!-- A clear and concise description of what the bug is. -->
|
Steps to reproduce the behavior:
|
||||||
|
|
||||||
## To Reproduce
|
|
||||||
<!-- Steps to reproduce the behavior. -->
|
|
||||||
1. ...
|
1. ...
|
||||||
|
|
||||||
## 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:
|
||||||
|
|
||||||
```
|
```
|
||||||
```
|
```
|
||||||
|
21
.github/workflows/stylua.yml
vendored
21
.github/workflows/stylua.yml
vendored
@ -1,21 +0,0 @@
|
|||||||
# Check Lua Formatting
|
|
||||||
name: Check Lua Formatting
|
|
||||||
on: pull_request_target
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
stylua-check:
|
|
||||||
if: github.repository == 'nvim-lua/kickstart.nvim'
|
|
||||||
name: Stylua Check
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout Code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
|
||||||
- name: Stylua Check
|
|
||||||
uses: JohnnyMorganz/stylua-action@v3
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
version: latest
|
|
||||||
args: --check .
|
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,6 +2,4 @@ tags
|
|||||||
test.sh
|
test.sh
|
||||||
.luarc.json
|
.luarc.json
|
||||||
nvim
|
nvim
|
||||||
|
|
||||||
spell/
|
|
||||||
lazy-lock.json
|
lazy-lock.json
|
||||||
|
@ -3,4 +3,4 @@ line_endings = "Unix"
|
|||||||
indent_type = "Spaces"
|
indent_type = "Spaces"
|
||||||
indent_width = 2
|
indent_width = 2
|
||||||
quote_style = "AutoPreferSingle"
|
quote_style = "AutoPreferSingle"
|
||||||
call_parentheses = "None"
|
no_call_parentheses = true
|
||||||
|
273
README.md
273
README.md
@ -1,119 +1,47 @@
|
|||||||
# kickstart.nvim
|
# kickstart.nvim
|
||||||
|
|
||||||
## Introduction
|
### Introduction
|
||||||
|
|
||||||
A starting point for Neovim that is:
|
A starting point for Neovim that is:
|
||||||
|
|
||||||
* Small
|
* Small
|
||||||
* Single-file
|
* Single-file (with examples of moving to multi-file)
|
||||||
* Completely Documented
|
* Documented
|
||||||
|
* Modular
|
||||||
|
|
||||||
**NOT** a Neovim distribution, but instead a starting point for your configuration.
|
This repo is meant to be used as by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss.
|
||||||
|
|
||||||
## Installation
|
Distribution Alternatives:
|
||||||
|
- [LazyVim](https://www.lazyvim.org/): A delightful distribution maintained by @folke (the author of lazy.nvim, the package manager used here)
|
||||||
|
|
||||||
### Install Neovim
|
### Installation
|
||||||
|
|
||||||
Kickstart.nvim targets *only* the latest
|
Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions.
|
||||||
['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest
|
|
||||||
['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim.
|
|
||||||
If you are experiencing issues, please make sure you have the latest versions.
|
|
||||||
|
|
||||||
### Install External Dependencies
|
* Backup your previous configuration
|
||||||
|
* (Recommended) Fork this repo (so that you have your own copy that you can modify).
|
||||||
|
* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `~/AppData/Local/nvim/` (Windows)
|
||||||
|
* If you don't want to include it as a git repo, you can just clone it and then move the files to this location
|
||||||
|
* Start Neovim (`nvim`) and allow `lazy.nvim` to complete installation.
|
||||||
|
* Restart Neovim
|
||||||
|
* **You're ready to go!**
|
||||||
|
|
||||||
> **NOTE**
|
Additional system requirements:
|
||||||
> [Backup](#FAQ) your previous configuration (if any exists)
|
- Make sure to review the readmes of the plugins if you are experiencing errors. In particular:
|
||||||
|
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers.
|
||||||
|
- See as well [Windows Installation](#Windows-Installation)
|
||||||
|
|
||||||
External Requirements:
|
### Configuration And Extension
|
||||||
- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`)
|
|
||||||
- [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:
|
|
||||||
- If want to write Typescript, you need `npm`
|
|
||||||
- If want to write Golang, you will need `go`
|
|
||||||
- etc.
|
|
||||||
|
|
||||||
> **NOTE**
|
* Inside of your fork, feel free to modify any file you like! It's your fork!
|
||||||
> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes
|
* Then there are two primary configuration options available:
|
||||||
> and quick install snippets
|
* Include the `lua/kickstart/plugins/*` files in your configuration.
|
||||||
|
* Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim`
|
||||||
|
* NOTE: To enable this, you need to uncomment `{ import = 'custom.plugins' }` in your `init.lua`
|
||||||
|
|
||||||
Neovim's configurations are located under the following paths, depending on your OS:
|
You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration
|
||||||
|
|
||||||
| OS | PATH |
|
#### Example: Adding an autopairs plugin
|
||||||
| :- | :--- |
|
|
||||||
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
|
|
||||||
| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` |
|
|
||||||
| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` |
|
|
||||||
|
|
||||||
### Install Kickstart
|
|
||||||
|
|
||||||
#### Recommended Step
|
|
||||||
|
|
||||||
[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo
|
|
||||||
so that you have your own copy that you can modify, then install by cloning the
|
|
||||||
fork to your machine using one of the commands below, depending on your OS.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
> **NOTE**
|
|
||||||
> Your fork's url will be something like this:
|
|
||||||
> `https://github.com/<your_github_username>/kickstart.nvim.git`
|
|
||||||
|
|
||||||
#### Clone kickstart.nvim
|
|
||||||
> **NOTE**
|
|
||||||
> If following the recommended step above (i.e., forking the repo), replace
|
|
||||||
> `nvim-lua` with `<your_github_username>` in the commands below
|
|
||||||
|
|
||||||
<details><summary> Linux and Mac </summary>
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details><summary> Windows </summary>
|
|
||||||
|
|
||||||
If you're using `cmd.exe`:
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\
|
|
||||||
```
|
|
||||||
|
|
||||||
If you're using `powershell.exe`
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### Post Installation
|
|
||||||
|
|
||||||
Start Neovim
|
|
||||||
|
|
||||||
```sh
|
|
||||||
nvim
|
|
||||||
```
|
|
||||||
|
|
||||||
That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
|
|
||||||
current plugin status.
|
|
||||||
|
|
||||||
Read through the `init.lua` file in your configuration folder for more
|
|
||||||
information about extending and exploring Neovim.
|
|
||||||
|
|
||||||
|
|
||||||
#### 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:
|
In the file: `lua/custom/plugins/autopairs.lua`, add:
|
||||||
|
|
||||||
@ -122,34 +50,20 @@ In the file: `lua/custom/plugins/autopairs.lua`, add:
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
"windwp/nvim-autopairs",
|
"windwp/nvim-autopairs",
|
||||||
-- Optional dependency
|
|
||||||
dependencies = { 'hrsh7th/nvim-cmp' },
|
|
||||||
config = function()
|
config = function()
|
||||||
require("nvim-autopairs").setup {}
|
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,
|
end,
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
|
||||||
<details>
|
|
||||||
<summary>Adding a file tree plugin</summary>
|
|
||||||
|
|
||||||
This will install the tree plugin and add the command `:Neotree` for you.
|
This will automatically install `nvim-autopairs` and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim).
|
||||||
For more information, see the documentation at
|
|
||||||
[neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim).
|
#### Example: Adding a file tree plugin
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"nvim-neo-tree/neo-tree.nvim",
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
version = "*",
|
version = "*",
|
||||||
@ -159,119 +73,58 @@ return {
|
|||||||
"MunifTanjim/nui.nvim",
|
"MunifTanjim/nui.nvim",
|
||||||
},
|
},
|
||||||
config = function ()
|
config = function ()
|
||||||
|
-- Unless you are still migrating, remove the deprecated commands from v1.x
|
||||||
|
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||||
|
|
||||||
require('neo-tree').setup {}
|
require('neo-tree').setup {}
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
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.
|
||||||
|
|
||||||
### Getting Started
|
#### Example: Adding a file to change default options
|
||||||
|
|
||||||
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
|
To change default options, you can add a file in the `/after/plugin/` folder (see `:help load-plugins`) to include your own options, keymaps, autogroups, and more. The following is an example `defaults.lua` file (located at `$HOME/.config/nvim/after/plugin/defaults.lua`).
|
||||||
|
|
||||||
|
```lua
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
|
||||||
|
```
|
||||||
|
|
||||||
|
### Contribution
|
||||||
|
|
||||||
|
Pull-requests are welcome. The goal of this repo is not to create a Neovim configuration framework, but to offer a starting template that shows, by example, available features in Neovim. Some things that will not be included:
|
||||||
|
|
||||||
|
* Custom language server configuration (null-ls templates)
|
||||||
|
* Theming beyond a default colorscheme necessary for LSP highlight groups
|
||||||
|
|
||||||
|
Each PR, especially those which increase the line count, should have a description as to why the PR is necessary.
|
||||||
|
|
||||||
### 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/`
|
* You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide)
|
||||||
* Can I keep my existing configuration in parallel to kickstart?
|
|
||||||
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME`
|
|
||||||
to maintain multiple configurations. For example, you can install the kickstart
|
|
||||||
configuration in `~/.config/nvim-kickstart` and create an alias:
|
|
||||||
```
|
|
||||||
alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim'
|
|
||||||
```
|
|
||||||
When you run Neovim using `nvim-kickstart` alias it will use the alternative
|
|
||||||
config directory and the matching local directory
|
|
||||||
`~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim
|
|
||||||
distribution that you would like to try out.
|
|
||||||
* What if I want to "uninstall" this configuration:
|
* 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?
|
* Are there any cool videos about this plugin?
|
||||||
* The main purpose of kickstart is to serve as a teaching tool and a reference
|
* Current iteration of kickstart (coming soon)
|
||||||
configuration that someone can easily use to `git clone` as a basis for their own.
|
* Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s).
|
||||||
As you progress in learning Neovim and Lua, you might consider splitting `init.lua`
|
|
||||||
into smaller parts. A fork of kickstart that does this while maintaining the
|
|
||||||
same functionality is available here:
|
|
||||||
* [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim)
|
|
||||||
* Discussions on this topic can be found here:
|
|
||||||
* [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218)
|
|
||||||
* [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473)
|
|
||||||
|
|
||||||
### Install Recipes
|
### 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.
|
See `telescope-fzf-native` documention for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)
|
||||||
|
|
||||||
#### Windows Installation
|
|
||||||
|
|
||||||
<details><summary>Windows with Microsoft C++ Build Tools and CMake</summary>
|
|
||||||
Installation may require installing build tools and updating the run command for `telescope-fzf-native`
|
|
||||||
|
|
||||||
See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)
|
|
||||||
|
|
||||||
This requires:
|
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' }
|
use {'nvim-telescope/telescope-fzf-native.nvim', run = '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>
|
|
||||||
|
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
--[[
|
|
||||||
--
|
|
||||||
-- This file is not required for your own configuration,
|
|
||||||
-- but helps people determine if their system is setup correctly.
|
|
||||||
--
|
|
||||||
--]]
|
|
||||||
|
|
||||||
local check_version = function()
|
|
||||||
local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch)
|
|
||||||
if not vim.version.cmp then
|
|
||||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then
|
|
||||||
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
|
|
||||||
else
|
|
||||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local check_external_reqs = function()
|
|
||||||
-- Basic utils: `git`, `make`, `unzip`
|
|
||||||
for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do
|
|
||||||
local is_executable = vim.fn.executable(exe) == 1
|
|
||||||
if is_executable then
|
|
||||||
vim.health.ok(string.format("Found executable: '%s'", exe))
|
|
||||||
else
|
|
||||||
vim.health.warn(string.format("Could not find executable: '%s'", exe))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
check = function()
|
|
||||||
vim.health.start 'kickstart.nvim'
|
|
||||||
|
|
||||||
vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth`
|
|
||||||
|
|
||||||
Fix only warnings for plugins and languages you intend to use.
|
|
||||||
Mason will give warnings for languages that are not installed.
|
|
||||||
You do not need to install, unless you want to use those languages!]]
|
|
||||||
|
|
||||||
local uv = vim.uv or vim.loop
|
|
||||||
vim.health.info('System Information: ' .. vim.inspect(uv.os_uname()))
|
|
||||||
|
|
||||||
check_version()
|
|
||||||
check_external_reqs()
|
|
||||||
end,
|
|
||||||
}
|
|
74
lua/kickstart/plugins/autoformat.lua
Normal file
74
lua/kickstart/plugins/autoformat.lua
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
-- autoformat.lua
|
||||||
|
--
|
||||||
|
-- Use your language server to automatically format your code on save.
|
||||||
|
-- Adds additional commands as well to manage the behavior
|
||||||
|
|
||||||
|
return {
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
config = function()
|
||||||
|
-- Switch for controlling whether you want autoformatting.
|
||||||
|
-- Use :KickstartFormatToggle to toggle autoformatting on or off
|
||||||
|
local format_is_enabled = true
|
||||||
|
vim.api.nvim_create_user_command('KickstartFormatToggle', function()
|
||||||
|
format_is_enabled = not format_is_enabled
|
||||||
|
print('Setting autoformatting to: ' .. tostring(format_is_enabled))
|
||||||
|
end, {})
|
||||||
|
|
||||||
|
-- Create an augroup that is used for managing our formatting autocmds.
|
||||||
|
-- We need one augroup per client to make sure that multiple clients
|
||||||
|
-- can attach to the same buffer without interfering with each other.
|
||||||
|
local _augroups = {}
|
||||||
|
local get_augroup = function(client)
|
||||||
|
if not _augroups[client.id] then
|
||||||
|
local group_name = 'kickstart-lsp-format-' .. client.name
|
||||||
|
local id = vim.api.nvim_create_augroup(group_name, { clear = true })
|
||||||
|
_augroups[client.id] = id
|
||||||
|
end
|
||||||
|
|
||||||
|
return _augroups[client.id]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Whenever an LSP attaches to a buffer, we will run this function.
|
||||||
|
--
|
||||||
|
-- See `:help LspAttach` for more information about this autocmd event.
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }),
|
||||||
|
-- This is where we attach the autoformatting for reasonable clients
|
||||||
|
callback = function(args)
|
||||||
|
local client_id = args.data.client_id
|
||||||
|
local client = vim.lsp.get_client_by_id(client_id)
|
||||||
|
local bufnr = args.buf
|
||||||
|
|
||||||
|
-- Only attach to clients that support document formatting
|
||||||
|
if not client.server_capabilities.documentFormattingProvider then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Tsserver usually works poorly. Sorry you work with bad languages
|
||||||
|
-- You can remove this line if you know what you're doing :)
|
||||||
|
if client.name == 'tsserver' then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Create an autocmd that will run *before* we save the buffer.
|
||||||
|
-- Run the formatting command for the LSP that has just attached.
|
||||||
|
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||||
|
group = get_augroup(client),
|
||||||
|
buffer = bufnr,
|
||||||
|
callback = function()
|
||||||
|
if not format_is_enabled then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.lsp.buf.format {
|
||||||
|
async = false,
|
||||||
|
filter = function(c)
|
||||||
|
return c.id == client.id
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
@ -9,14 +9,12 @@
|
|||||||
return {
|
return {
|
||||||
-- NOTE: Yes, you can install new plugins here!
|
-- NOTE: Yes, you can install new plugins here!
|
||||||
'mfussenegger/nvim-dap',
|
'mfussenegger/nvim-dap',
|
||||||
|
|
||||||
-- NOTE: And you can specify dependencies as well
|
-- NOTE: And you can specify dependencies as well
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- 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',
|
||||||
@ -24,6 +22,7 @@ return {
|
|||||||
-- Add your own debuggers here
|
-- Add your own debuggers here
|
||||||
'leoluz/nvim-dap-go',
|
'leoluz/nvim-dap-go',
|
||||||
},
|
},
|
||||||
|
|
||||||
config = function()
|
config = function()
|
||||||
local dap = require 'dap'
|
local dap = require 'dap'
|
||||||
local dapui = require 'dapui'
|
local dapui = require 'dapui'
|
||||||
@ -33,10 +32,6 @@ return {
|
|||||||
-- reasonable debug configurations
|
-- reasonable debug configurations
|
||||||
automatic_setup = true,
|
automatic_setup = true,
|
||||||
|
|
||||||
-- You can provide additional configuration to the handlers,
|
|
||||||
-- see mason-nvim-dap README for more information
|
|
||||||
handlers = {},
|
|
||||||
|
|
||||||
-- You'll need to check that you have the required things installed
|
-- You'll need to check that you have the required things installed
|
||||||
-- online, please don't ask me how to install them :)
|
-- online, please don't ask me how to install them :)
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
@ -45,15 +40,19 @@ return {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- You can provide additional configuration to the handlers,
|
||||||
|
-- see mason-nvim-dap README for more information
|
||||||
|
require('mason-nvim-dap').setup_handlers()
|
||||||
|
|
||||||
-- Basic debugging keymaps, feel free to change to your liking!
|
-- 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', '<F5>', dap.continue)
|
||||||
vim.keymap.set('n', '<F1>', dap.step_into, { desc = 'Debug: Step Into' })
|
vim.keymap.set('n', '<F1>', dap.step_into)
|
||||||
vim.keymap.set('n', '<F2>', dap.step_over, { desc = 'Debug: Step Over' })
|
vim.keymap.set('n', '<F2>', dap.step_over)
|
||||||
vim.keymap.set('n', '<F3>', dap.step_out, { desc = 'Debug: Step Out' })
|
vim.keymap.set('n', '<F3>', dap.step_out)
|
||||||
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' })
|
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint)
|
||||||
vim.keymap.set('n', '<leader>B', function()
|
vim.keymap.set('n', '<leader>B', function()
|
||||||
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
||||||
end, { desc = 'Debug: Set Breakpoint' })
|
end)
|
||||||
|
|
||||||
-- Dap UI setup
|
-- Dap UI setup
|
||||||
-- For more information, see |:help nvim-dap-ui|
|
-- For more information, see |:help nvim-dap-ui|
|
||||||
@ -72,14 +71,10 @@ return {
|
|||||||
step_back = 'b',
|
step_back = 'b',
|
||||||
run_last = '▶▶',
|
run_last = '▶▶',
|
||||||
terminate = '⏹',
|
terminate = '⏹',
|
||||||
disconnect = '⏏',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
|
||||||
vim.keymap.set('n', '<F7>', dapui.toggle, { desc = 'Debug: See last session result.' })
|
|
||||||
|
|
||||||
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
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
return {
|
|
||||||
{ -- Add indentation guides even on blank lines
|
|
||||||
'lukas-reineke/indent-blankline.nvim',
|
|
||||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
|
||||||
-- See `:help ibl`
|
|
||||||
main = 'ibl',
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
}
|
|
@ -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