Compare commits

..

108 Commits

Author SHA1 Message Date
Chris Patti 01a1ebed38
Merge pull request #402 from ErikKarlgren/fix-readme-typo
Fix typo in README.md
2023-08-19 14:02:33 -04:00
Erik 555dd8ed27
Fix typo in README.md 2023-08-19 13:38:31 +02:00
Chris Patti 98ad2ee32a
Merge pull request #395 from smiggiddy/smiggiddy-patch-1
Add a link to the external lua-guide now that :help lua-guide is gone.
2023-08-10 15:04:13 -04:00
Smig d0b47ce958
Update init.lua
added a URL to the lua-guide
may help others who miss the :help lua-guide
2023-08-10 15:00:15 -04:00
Chris Patti f6d67b69c3
Merge pull request #387 from daanrongen/master 2023-08-06 14:04:28 -04:00
daan a4ec83a433
fix: missing comma 2023-08-06 16:27:05 +01:00
Chris Patti 5a59fb894c
Merge pull request #384 from pbnj/fix/telescope-fzf-native-as-dependency 2023-08-06 09:51:44 -04:00
Peter Benjamin 8ee4d24b36
fix: fix brackets 2023-08-05 17:31:01 -07:00
Peter Benjamin b06980a8da
fix(init): turn telescope-fzf-native into a dependecy 2023-08-05 17:28:18 -07:00
Chris Patti 9dcf923f60
Merge pull request #380 from eltociear/patch-1 2023-07-30 15:52:11 -04:00
Ikko Eltociear Ashimine c2fb482ec1
Fix typo in init.lua
releated -> related
2023-07-31 02:46:27 +09:00
Chris Patti 3dc1c1c4c2
Merge pull request #376 from Numkil/patch-bug
Fix bug when server not explicitely defined in configuration but installed
2023-07-25 12:32:09 -04:00
Merel Jossart 734cc4e94a Fix bug when server not explicitely defined in configuration but installed 2023-07-25 18:30:47 +02:00
Chris Patti ea028fe0b5
Merge pull request #373 from Numkil/patch-1
Allow easier overriding of default filetypes for LSP
2023-07-24 16:01:36 -04:00
Numkil 29aa5bf42d setup more language servers i use + allow customizing filetypes 2023-07-24 21:57:36 +02:00
Chris Patti 7da1058748
Merge pull request #369 from Dennis-Rall/patch-2 2023-07-21 21:49:13 -04:00
Dennis-Rall c151235551
Remove fixed line number and describe line 2023-07-20 16:42:46 +02:00
Dennis-Rall 78ab7ee094
Add hint to uncomment line to autodetect plugins 2023-07-20 10:56:15 +02:00
Chris Patti 680e085761
Merge pull request #367 from sevensidedmarble/remove-timeout
Remove timout default
2023-07-17 10:24:54 -04:00
Andrew Stewart 31f867a699
Remove timeout 2023-07-17 10:21:44 -04:00
Chris Patti 7a953188db
Merge pull request #357 from kdheepak/patch-1
Update README.md with a GitHub friendly video example
2023-07-07 14:08:35 -04:00
Chris Patti 55aa0ea3cf
Merge pull request #358 from kdheepak/patch-2
Make init.lua copy-paste friendly
2023-07-07 10:01:37 -04:00
Chris Patti b5d19fd188
Merge pull request #362 from andres-lowrie/patch-1
fix: correct typo
2023-07-07 10:00:27 -04:00
Andres Lowrie 93ef2e8078
correct typo
Hey y'all 👋 

I think there may have been a typo?
2023-07-07 08:37:12 -05:00
Dheepak Krishnamurthy a73b2e5f57 docs: Update README.md 📚 2023-07-01 19:07:37 -04:00
Dheepak Krishnamurthy 957655ddb8 Make init.lua copy-paste friendly 2023-07-01 12:40:08 -04:00
Chris Patti 6967424521
Merge pull request #344 from MariaSolOs/deprecated-stylua
Use call_parentheses = "None"
2023-06-22 15:34:47 -04:00
Chris Patti e68ed2c446
Merge pull request #346 from juangiordana/debug
Add descriptions for debugging keybindings.
2023-06-22 15:32:36 -04:00
Chris Patti 80d8d6947a
Merge pull request #347 from ilian/patch-1
Fix typo in ignorecase comment
2023-06-22 15:32:02 -04:00
ilian d8b3b774bb Fix typo in ignorecase comment
In order to perform a case-sensitive search with ignorecase, the pattern
should contain `\C` instead of `/C`.
2023-06-18 16:25:55 +02:00
Juan Giordana c45b17ebab Add descriptions for debugging keybindings.
Add descriptions for debugging key bindings.

Improve formatting by changing double quotes to single quotes in order
to keep compatibility with the rest of the kickstart.nvim project.
2023-06-18 00:21:28 -03:00
Maria José Solano be90f025de
Use call_parentheses 2023-06-16 21:12:11 -07:00
Chris Patti 8064bb63c5
Merge pull request #342 from gfaster/master 2023-06-14 22:22:30 -04:00
Gavin ac07c5c59c Add legacy tag to fidget to avoid deprecation warning 2023-06-14 17:21:26 -04:00
Chris Patti 5125fd927a
Merge pull request #337 from nvim-lua/enable_python_indent 2023-06-07 21:46:49 -04:00
Chris Patti e6cb90b2b3 Fixes #336 - Enabale treesitter indent for Python
Tested in my local configuratoin. Indenting works great.
2023-06-07 20:41:30 -04:00
Chris Patti 5e4d24cb2f Revert "Refactor theme and status line into their own file"
This reverts commit cdaa750c86.
2023-06-04 16:10:59 +00:00
Chris Patti cdaa750c86 Refactor theme and status line into their own file 2023-06-03 10:11:58 -04:00
Chris Patti e15e7f4bda
Merge pull request #323 from luizcalliari/master
FIX: Conflict with vimdiff keybinding
2023-06-02 15:21:05 -04:00
Chris Patti 853b7c9d9e
Merge pull request #327 from kaminskypavel/patch-1 2023-05-30 06:44:05 -04:00
Pavel 'PK' Kaminsky 1d52d1e68b
Update README.md
fix(docs): whoops missed another instance of `nvim-data`
2023-05-30 11:04:01 +03:00
Chris Patti 2f60b0086f
Merge pull request #326 from kaminskypavel/patch-1 2023-05-29 17:25:23 -04:00
Pavel 'PK' Kaminsky f2b09aaac7
fix(docs): update windows path to a correct folder 2023-05-29 23:35:45 +03:00
Luiz Antonio Calliari Filho 83b65a1c7d FIX: Conflict with vimdiff keybinding 2023-05-25 22:09:34 -03:00
Chris Patti f031fa4509
Merge pull request #319 from mech-a/readme
Remove "after/" reference in README and other clean-up items
2023-05-22 16:25:22 -04:00
Gaurav Bhatnagar 8d97b11dd8 refact: remove after/ reference in readme, other clean-up items 2023-05-22 11:30:25 -07:00
Chris Patti 468c25588e
Merge pull request #318 from mech-a/is311
Add cmp comments
2023-05-22 11:28:40 -04:00
Gaurav Bhatnagar 8e8ba26a96 refact: add cmp comments, other 2023-05-21 23:46:09 -07:00
Chris Patti 8a647f4384
Update README.md
Fix for #314 - there's no -data at the end of the nvim dir.
2023-05-21 22:13:02 -04:00
Chris Patti 4d7e4b8a1d
Merge pull request #310 from mech-a/master 2023-05-16 15:45:01 -04:00
Gaurav Bhatnagar 455691bd8d refact: stylua 2023-05-16 12:38:56 -07:00
Chris Patti a694c380d0
Merge pull request #296 from SamPosh/patch-3 2023-05-16 15:26:14 -04:00
Chris Patti ded185411f
Merge pull request #203 from luizcalliari/master
Features to move to diffs and show the preview values.
2023-05-15 12:25:01 -04:00
Chris Patti ce2981db4b
Merge pull request #302 from mech-a/mech-a-patch-1
change luasnip tab jumping to locally jumpable
2023-05-15 12:12:55 -04:00
Chris Patti 9469575bdc
Merge pull request #303 from declan-whiting/get_query_is_deprecated
Telescope to use latest release branch
2023-05-15 12:11:00 -04:00
dec fa4bf9c378 Udated tree sitter to use latest release branch 2023-05-08 11:02:37 +01:00
Gaurav Bhatnagar 2844f61d96
add local jumping to shift tab 2023-05-07 16:38:44 -07:00
Gaurav Bhatnagar 1c02cec98b
change luasnip tab jumping to locally jumpable 2023-05-07 16:28:13 -07:00
SamPosh 55c52ce45b
Added friendly snippet support 2023-05-02 16:01:46 +05:30
Chris Patti 0470d07c8c
Merge pull request #289 from victorwallsten/master
Add <C-n>, <C-p> mappings to nvim-cmp setup
2023-04-27 16:20:27 -04:00
Victor Wallsten efdfd6ed82
Add <C-n>, <C-p> mappings to nvim-cmp setup 2023-04-27 09:33:10 +02:00
Chris Patti 3041115415
Merge pull request #288 from sumanth-lingappa/master
corrected git clone command
2023-04-26 14:24:42 -04:00
Sumanth Lingappa 7e39ab77c6
corrected git clone command 2023-04-26 23:49:32 +05:30
Chris Patti 5b74a016b3
Update README.md
Tiny wording changes I requested from https://github.com/nvim-lua/kickstart.nvim/pull/283
2023-04-26 12:24:52 -04:00
Chris Patti ac31b67aee
Merge pull request #283 from nPHYN1T3/master
A bit of clarification
2023-04-26 12:22:56 -04:00
Chris Patti 7e0a1675d2
Merge pull request #287 from keiwanjamaly/master
Added disconnect emoji for nvim-dap-ui
2023-04-26 11:42:12 -04:00
Keiwan Jamaly e78ad01dd2
Added disconnect emoji for nvim-dap-ui 2023-04-26 17:37:48 +02:00
Chris Patti bc3a3d3558
Merge pull request #282 from liepieshov/master
setup a standard binding for searching git files using telescope
2023-04-26 11:24:27 -04:00
nPHYN1T3 df10841feb
ARG!
My browser should not be caching yet github seems to fight some changes. I'm also still unable to see why the formatting (line height) differs between the Archive Install section and the Git Clone Install section.

Hopefully this will at least save the correct changes to the Win stuff.
2023-04-25 13:21:31 -06:00
nPHYN1T3 821ad95565
Update README.md 2023-04-25 13:15:10 -06:00
nPHYN1T3 604e92ef74
Hmmm
Tested on a win10VM for location and such because I remembered %appdata% should be a thing but it's the wrong location and the win MSI creates nvim-data rather than just nvim. Then I noticed my previous changes weren't all saved...so here I go again heh.
2023-04-25 13:14:17 -06:00
nPHYN1T3 545577b9a1
Fixed Windows style path for home 2023-04-25 10:43:15 -06:00
nPHYN1T3 ad6351a650
Should fix the win paths
I fear adding bits like "Your paths may differ, these are just for reference." but the core behind the kickstart is getting "noobs" past big hurdles fast. This however means things need to be super spoon fed or basic things like not understanding relative paths and such might end up right where things started...ambiguous to some user instructions because they don't understand they need to know certain things because this is supposed to help them bypass knowing that for now...and the snake eats its tail. :)
2023-04-25 10:21:31 -06:00
nPHYN1T3 f3ad4bb518
Update README.md 2023-04-24 15:29:58 -06:00
nPHYN1T3 b5c0b25398
Update README.md 2023-04-24 15:28:27 -06:00
nPHYN1T3 2eff982e1e
Update README.md 2023-04-24 15:21:53 -06:00
Chris Patti 36842aa368
Merge pull request #281 from SamPosh/dapui_toggle
Dapui.toggle keymap is added
2023-04-24 15:50:39 -04:00
liepieshov 0dfc159286 setup a standard binding for searching git files using telescope 2023-04-24 17:57:47 +01:00
SamPosh 9004013a8d
Dapui.toggle is added 2023-04-24 16:40:07 +05:30
Tsanko Tsanev 9924f7e0a0
Fix typo "documention" into "documentation" (#209) 2023-04-13 09:34:27 -04:00
KudoLayton 8d8fbd15bf
fix: move the Mason setup time forward from before (#210)
This commit fix the Mason [#1045](https://github.com/williamboman/mason.nvim/issues/1045) issue. Quickly set up Mason to avoid DAP-related startup error messages.
2023-04-13 09:34:06 -04:00
Jon Earnshaw 06192307f3
Correct command for neo-tree (#216) 2023-04-13 09:28:44 -04:00
Antoine Stevan 0278862ea1
minor modifications on the issue template (#244)
* use real markdown headers for section titles

* add a newline after the initial comment for readability

* make hint indications comments
2023-04-13 09:22:59 -04:00
Kai Windle c19fe7af24
mason nvim dap 2.0 removed setup_handlers() (#258) 2023-04-12 13:43:08 -04:00
Sebastian Lyng Johansen 9451e1db71
fix: use :TSInstall on build with nvim-treesitter (#261) 2023-04-12 13:42:40 -04:00
Luiz Antonio Calliari Filho e15e50edaf
Merge branch 'nvim-lua:master' into master 2023-04-10 11:36:21 -03:00
Chris Patti 7cecf4fcb1
help treesitter module has been renamed to vimdoc in master (#248) 2023-04-07 13:11:33 -04:00
Luiz Antonio Calliari Filho 986aa82cd6 FIX: Updating command description. 2023-03-12 20:45:26 -03:00
Luiz Antonio Calliari Filho c975e0346a
Merge branch 'nvim-lua:master' into master 2023-03-07 22:36:27 -03:00
Luiz Antonio Calliari Filho 66dc5b896d Feat: Simplifying code 2023-03-06 23:26:20 -03:00
Philipp Szechenyi 4a37a0a9b1
added descriptions to Diagnostic keymaps (#191)
* Update init.lua

* Update init.lua
2023-02-27 16:37:28 -05:00
Lucian Boaca 933ddee7d9
Update instructions for neo-tree set up (#200)
For me, setting this variable in the config function didn't work. Putting it outside the return block did the trick.
2023-02-27 16:36:59 -05:00
Luiz Antonio Calliari Filho 187bebcbf9 Adding [+c and ]+c to move to diffs and leader+ph to show a pop up with the preview diff value. 2023-02-26 23:03:34 -03:00
Folke Lemaitre 72364ad9ac
docs: change telescope fzf native to lazy syntax (#185) 2023-02-19 15:32:15 -05:00
Tudor 9f384d76f4
feat: Add clipboard sync by default (#166) 2023-02-17 16:37:36 -05:00
TJ DeVries 3526fbeec9
feat: move to lazy.nvim package manager and add first plugins (#178)
Closes #175
Closes #177
Closes #173
Closes #169
Closes #161
Closes #144
Closes #138
Fixes #136
Closes #137
Closes #131
Closes #117
Closes #130
Closes #115
Closes #86
Closes #105
Closes #70
Fixes #176
Fixes #174
Fixes #160
Fixes #158
2023-02-17 16:31:57 -05:00
Sean 32744c3f66
Add windows init lua location (#121)
* feat: add init.lua location fir Windows

* feat: more specific number of lines
2023-01-11 16:49:00 -05:00
willsmanic 4916072854
added vim to tree-sitter's ensured installed list (#110)
please refer to https://github.com/nvim-treesitter/nvim-treesitter/issues/3092
2023-01-01 21:18:13 -05:00
amalgame21 c4d7212de3
Prevent multiple language servers from being spawned after every file save of init.lua (#96)
* Prevent multiple language servers from being spawned

Prevent multiple language servers from being spawned after every save of init.lua, which eventually leads to high RAM usage and system freeze.

* Supress error messages

add `silent!` in case of error message when nvim-lspconfig is not installed
2022-12-28 01:33:44 -05:00
kazenix 39a941c385
Adding cmake documentation to README.md (#85) 2022-12-22 07:45:20 -05:00
TJ DeVries 521940693e
move server config to easy to extend style (#71)
Move servers to new configuration style.

I will probably cover this in a new shorter video, or maybe in combination with something else.
This should hopefully remove  getting so many people making issues about LSPs that they don't want to.

I can update documentation if what is happening is not clear.
2022-12-20 22:12:39 -05:00
TJ DeVries aa660e64ce remove python indent: closes #78 2022-12-20 16:03:05 -05:00
Matthias Debernardini bec7410127
Update intstructions for existing nvim setups (#65)
* Update intstructions for existing nvim setups

If you already had a nvim setup, then this makes it so that the kickstarter can work without a problem. Having that file exist and loaded with plugins gives the script many issues.

Also better to have it be a shell command rather than have the script delete a bunch of files on your computer.
2022-12-20 13:27:01 -05:00
TJ DeVries 6dccf03fd2
Update issue templates (#72) 2022-12-19 21:29:52 -05:00
Nicolas Gryman d37a3a9462
fix: don't check third party for Lua LSP (#57)
* fix: don't check third party for Lua LSP

Co-authored-by: Sean <44933921+seantwie03@users.noreply.github.com>
Co-authored-by: TJ DeVries <devries.timothyj@gmail.com>
Co-authored-by: Sean <44933921+seantwie03@users.noreply.github.com>
2022-12-19 18:01:33 -05:00
Debashis Biswas 99df0d8f66
Fix error on Windows when space in install path (#64) 2022-12-19 17:57:28 -05:00
TJ DeVries f218bcd6fe note: tell people to remove languages they arent going to use 2022-12-19 17:56:21 -05:00
TJ DeVries c73aefcb21
Closes #46 2022-12-17 21:40:20 -05:00
11 changed files with 606 additions and 235 deletions

28
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,28 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
<!-- 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. -->
## To Reproduce
<!-- Steps to reproduce the behavior. -->
1. ...
## Desktop
<!-- please complete the following information. -->
- OS:
- Terminal:
## Neovim Version
<!-- Output of running `:version` from inside of neovim. -->
```
```

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ tags
test.sh
.luarc.json
nvim
lazy-lock.json

View File

@ -3,4 +3,4 @@ line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
no_call_parentheses = true
call_parentheses = "None"

View File

@ -1,34 +0,0 @@
# Build neovim separately in the first stage
FROM alpine:latest AS base
RUN apk --no-cache add \
autoconf \
automake \
build-base \
cmake \
ninja \
coreutils \
curl \
gettext-tiny-dev \
git \
libtool \
pkgconf \
unzip
# Build neovim (and use it as an example codebase
RUN git clone https://github.com/neovim/neovim.git
ARG VERSION=master
RUN cd neovim && git checkout ${VERSION} && make CMAKE_BUILD_TYPE=RelWithDebInfo install
# To support kickstart.nvim
RUN apk --no-cache add \
fd \
ctags \
ripgrep \
git
# Copy the kickstart.nvim init.lua
COPY ./init.lua /root/.config/nvim/init.lua
WORKDIR /neovim

139
README.md
View File

@ -1,60 +1,149 @@
# kickstart.nvim
https://github.com/kdheepak/kickstart.nvim/assets/1813121/f3ff9a2b-c31f-44df-a4fa-8a0d7b17cf7b
### Introduction
A starting point for Neovim that is:
* Small (~370 lines)
* Single-file
* Small
* Single-file (with examples of moving to multi-file)
* Documented
* Modular
This repo is meant to be used by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss.
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.
This repo is meant to be used as a starting point for a user's own configuration; remove the things you don't use and add what you miss. This configuration serves as the reference configuration for the [lspconfig wiki](https://github.com/neovim/nvim-lspconfig/wiki).
Distribution Alternatives:
- [LazyVim](https://www.lazyvim.org/): A delightful distribution maintained by @folke (the author of lazy.nvim, the package manager used here)
### Installation
* Backup your previous configuration
* Copy and paste the kickstart.nvim `init.lua` into `$HOME/.config/nvim/init.lua`
* Start Neovim (`nvim`) and run `:PackerInstall` - ignore any error message about missing plugins, `:PackerInstall` will fix that shortly
* Restart Neovim
* Backup your previous configuration (if any exists)
### Configuration
### Archive Installation
* On the home/landing page for the project find the blue "<> CODE" button click it and select Local > Download ZIP.
* Extract the archive to:
`~/.config/nvim` (Linux)
`~/.config/nvim` (MacOS)
`%userprofile%\AppData\Local\nvim\` (Windows)
* Ensure your extraction method did not extract with a parent folder. For example in ~/.config/nvim you should have init.lua not another folder called kickstart.nvim.
You could directly modify the `init.lua` file with your personal customizations. This option is the most straightforward, but if you update your config from this repo, you may need to reapply your changes.
### Git Clone Installation
* From a terminal cd/dir to:
`~/.config/nvim` (Linux)
`~/.config/nvim` (MacOS)
`%userprofile%\AppData\Local\nvim\` (Windows)
An alternative approach is to create a separate `custom.plugins` module to register your own plugins. In addition, you can handle further customizations in the `/after/plugin/` directory (see `:help load-plugins`). See the following examples for more information. Leveraging this technique should make upgrading to a newer version of this repo easier.
* Run: `git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim` OR: `gh repo clone nvim-lua/kickstart.nvim`
* Run Neovim (from terminal or shortcut) and allow lazy.nvim to download files and set up the basics.
* Once the setup is complete, restart Neovim.
* **You're ready to go!**
#### Example `plugins.lua`
* (Recommended/Optional) 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 `%userprofile%\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
The following is an example of a `plugins.lua` module (located at `$HOME/.config/nvim/lua/custom/plugins.lua`) where you can register your own plugins.
Additional system requirements:
- 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 [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native`
### Configuration And Extension
* Inside of your copy, feel free to modify any file you like! It's your copy!
* Feel free to change any of the default options in `init.lua` to better suit your needs.
* For adding plugins, there are 3 primary options:
* Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` (uncomment the line importing the `custom/plugins` directory in the `init.lua` file to enable this)
* Modify `init.lua` with additional plugins.
* Include the `lua/kickstart/plugins/*` files in your configuration.
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.
#### Example: Adding an autopairs plugin
In the file: `lua/custom/plugins/autopairs.lua`, add:
```lua
return function(use)
use({
"folke/which-key.nvim",
config = function()
require("which-key").setup({})
end
})
end
-- 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,
}
```
#### Example `defaults.lua`
For further customizations, 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`).
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).
#### Example: Adding a file tree plugin
In the file: `lua/custom/plugins/filetree.lua`, add:
```lua
vim.opt.relativenumber = true
-- Unless you are still migrating, remove the deprecated commands from v1.x
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
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,
}
```
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.
### 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
* Lazy-loading. Kickstart.nvim should start within 40 ms on modern hardware. Please profile and contribute to upstream plugins to optimize startup time instead.
Each PR, especially those which increase the line count, should have a description as to why the PR is necessary.
### FAQ
* What should I do if I already have a pre-existing neovim configuration?
* You should back it up, then delete all files associated with it.
* This includes your existing init.lua and the neovim files in `~/.local` 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)
* What if I want to "uninstall" this configuration:
* See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information
* Are there any cool videos about this plugin?
* Current iteration of kickstart (coming soon)
* Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). Note the install via init.lua no longer works as specified. Please follow the install instructions in this file instead as they're up to date.
### Windows Installation
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:
- Install CMake, and the Microsoft C++ Build Tools on Windows
```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' }
```

24
doc/kickstart.txt Normal file
View File

@ -0,0 +1,24 @@
================================================================================
INTRODUCTION *kickstart.nvim*
Kickstart.nvim is a project to help you get started on your neovim journey.
*kickstart-is-not*
It is not:
- Complete framework for every plugin under the sun
- Place to add every plugin that could ever be useful
*kickstart-is*
It is:
- Somewhere that has a good start for the most common "IDE" type features:
- autocompletion
- goto-definition
- find references
- fuzzy finding
- and hinting at what more can be done :)
- A place to _kickstart_ your journey.
- You should fork this project and use/modify it so that it matches your
style and preferences. If you don't want to do that, there are probably
other projects that would fit much better for you (and that's great!)!
vim:tw=78:ts=8:ft=help:norl:

3
doc/tags Normal file
View File

@ -0,0 +1,3 @@
kickstart-is kickstart.txt /*kickstart-is*
kickstart-is-not kickstart.txt /*kickstart-is-not*
kickstart.nvim kickstart.txt /*kickstart.nvim*

444
init.lua
View File

@ -1,96 +1,221 @@
-- Install packer
local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim'
local is_bootstrap = false
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
is_bootstrap = true
vim.fn.execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path)
vim.cmd [[packadd packer.nvim]]
--[[
=====================================================================
==================== READ THIS BEFORE CONTINUING ====================
=====================================================================
Kickstart.nvim is *not* a distribution.
Kickstart.nvim is a template 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 should start exploring, configuring and tinkering to
explore Neovim!
If you don't know anything about Lua, I recommend taking some time to read through
a guide. One possible example:
- https://learnxinyminutes.com/docs/lua/
And then you can explore or search through `:help lua-guide`
- https://neovim.io/doc/user/lua-guide.html
Kickstart Guide:
I have left several `:help X` comments throughout the init.lua
You should run that command and read that help section for more information.
In addition, I have some `NOTE:` items throughout the file.
These are for you, the reader to help understand what is happening. Feel free to delete
them once you know what you're doing, but they should serve as a guide for when you
are first encountering a few different constructs in your nvim config.
I hope you enjoy your Neovim journey,
- TJ
P.S. You can delete this when you're done too. It's your config now :)
--]]
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Install package manager
-- https://github.com/folke/lazy.nvim
-- `:help lazy.nvim.txt` for more info
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system {
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable', -- latest stable release
lazypath,
}
end
vim.opt.rtp:prepend(lazypath)
require('packer').startup(function(use)
-- Package manager
use 'wbthomason/packer.nvim'
-- NOTE: Here is where you install your plugins.
-- You can configure plugins using the `config` key.
--
-- You can also configure plugins after the setup call,
-- as they will be available in your neovim runtime.
require('lazy').setup({
-- NOTE: First, some plugins that don't require any configuration
use { -- LSP Configuration & Plugins
-- Git related plugins
'tpope/vim-fugitive',
'tpope/vim-rhubarb',
-- Detect tabstop and shiftwidth automatically
'tpope/vim-sleuth',
-- NOTE: This is where your plugins related to LSP can be installed.
-- The configuration is done below. Search for lspconfig to find it below.
{
-- LSP Configuration & Plugins
'neovim/nvim-lspconfig',
requires = {
dependencies = {
-- Automatically install LSPs to stdpath for neovim
'williamboman/mason.nvim',
{ 'williamboman/mason.nvim', config = true },
'williamboman/mason-lspconfig.nvim',
-- Useful status updates for LSP
'j-hui/fidget.nvim',
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
-- Additional lua configuration, makes nvim stuff amazing!
'folke/neodev.nvim',
},
}
},
use { -- Autocompletion
{
-- Autocompletion
'hrsh7th/nvim-cmp',
requires = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' },
}
dependencies = {
-- Snippet Engine & its associated nvim-cmp source
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
use { -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
run = function()
pcall(require('nvim-treesitter.install').update { with_sync = true })
-- Adds LSP completion capabilities
'hrsh7th/cmp-nvim-lsp',
-- Adds a number of user-friendly snippets
'rafamadriz/friendly-snippets',
},
},
-- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} },
{
-- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
-- See `:help gitsigns.txt`
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
on_attach = function(bufnr)
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
end,
},
},
{
-- Theme inspired by Atom
'navarasu/onedark.nvim',
priority = 1000,
config = function()
vim.cmd.colorscheme 'onedark'
end,
}
},
use { -- Additional text objects via treesitter
'nvim-treesitter/nvim-treesitter-textobjects',
after = 'nvim-treesitter',
}
{
-- Set lualine as statusline
'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt`
opts = {
options = {
icons_enabled = false,
theme = 'onedark',
component_separators = '|',
section_separators = '',
},
},
},
-- Git related plugins
use 'tpope/vim-fugitive'
use 'tpope/vim-rhubarb'
use 'lewis6991/gitsigns.nvim'
{
-- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt`
opts = {
char = '',
show_trailing_blankline_indent = false,
},
},
use 'navarasu/onedark.nvim' -- Theme inspired by Atom
use 'nvim-lualine/lualine.nvim' -- Fancier statusline
use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines
use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines
use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically
-- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} },
-- Fuzzy Finder (files, lsp, etc)
use { 'nvim-telescope/telescope.nvim', branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } }
{
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available. Make sure you have the system
-- requirements installed.
{
'nvim-telescope/telescope-fzf-native.nvim',
-- NOTE: If you are having trouble with this installation,
-- refer to the README for telescope-fzf-native for more instructions.
build = 'make',
cond = function()
return vim.fn.executable 'make' == 1
end,
},
},
},
-- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 }
{
-- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
},
build = ':TSUpdate',
},
-- Add custom plugins to packer from ~/.config/nvim/lua/custom/plugins.lua
local has_plugins, plugins = pcall(require, 'custom.plugins')
if has_plugins then
plugins(use)
end
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
-- These are some example plugins that I've included in the kickstart repository.
-- Uncomment any of the lines below to enable them.
-- require 'kickstart.plugins.autoformat',
-- require 'kickstart.plugins.debug',
if is_bootstrap then
require('packer').sync()
end
end)
-- When we are bootstrapping a configuration, it doesn't
-- make sense to execute the rest of the init.lua.
--
-- You'll need to restart nvim, and then it will work.
if is_bootstrap then
print '=================================='
print ' Plugins are being installed'
print ' Wait until Packer completes,'
print ' then restart nvim'
print '=================================='
return
end
-- Automatically source and re-compile packer whenever you save this init.lua
local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true })
vim.api.nvim_create_autocmd('BufWritePost', {
command = 'source <afile> | PackerCompile',
group = packer_group,
pattern = vim.fn.expand '$MYVIMRC',
})
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
-- up-to-date with whatever is in the kickstart repo.
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
--
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
-- { import = 'custom.plugins' },
}, {})
-- [[ Setting options ]]
-- See `:help vim.o`
-- NOTE: You can change these options as you wish!
-- Set highlight on search
vim.o.hlsearch = false
@ -101,33 +226,35 @@ vim.wo.number = true
-- Enable mouse mode
vim.o.mouse = 'a'
-- Sync clipboard between OS and Neovim.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.o.clipboard = 'unnamedplus'
-- Enable break indent
vim.o.breakindent = true
-- Save undo history
vim.o.undofile = true
-- Case insensitive searching UNLESS /C or capital in search
-- Case-insensitive searching UNLESS \C or capital in search
vim.o.ignorecase = true
vim.o.smartcase = true
-- Decrease update time
vim.o.updatetime = 250
-- Keep signcolumn on by default
vim.wo.signcolumn = 'yes'
-- Set colorscheme
vim.o.termguicolors = true
vim.cmd [[colorscheme onedark]]
-- Decrease update time
vim.o.updatetime = 250
vim.o.timeoutlen = 300
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
-- NOTE: You should make sure your terminal supports this
vim.o.termguicolors = true
-- [[ Basic Keymaps ]]
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Keymaps for better default experience
-- See `:help vim.keymap.set()`
@ -148,39 +275,6 @@ vim.api.nvim_create_autocmd('TextYankPost', {
pattern = '*',
})
-- Set lualine as statusline
-- See `:help lualine.txt`
require('lualine').setup {
options = {
icons_enabled = false,
theme = 'onedark',
component_separators = '|',
section_separators = '',
},
}
-- Enable Comment.nvim
require('Comment').setup()
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt`
require('indent_blankline').setup {
char = '',
show_trailing_blankline_indent = false,
}
-- Gitsigns
-- See `:help gitsigns.txt`
require('gitsigns').setup {
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
}
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup {
@ -206,8 +300,9 @@ vim.keymap.set('n', '<leader>/', function()
winblend = 10,
previewer = false,
})
end, { desc = '[/] Fuzzily search in current buffer]' })
end, { desc = '[/] Fuzzily search in current buffer' })
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
@ -218,7 +313,10 @@ vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { de
-- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup {
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help' },
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' },
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
auto_install = false,
highlight = { enable = true },
indent = { enable = true },
@ -228,7 +326,7 @@ require('nvim-treesitter.configs').setup {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<c-backspace>',
node_decremental = '<M-space>',
},
},
textobjects = {
@ -278,12 +376,12 @@ require('nvim-treesitter.configs').setup {
}
-- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
-- LSP settings.
-- [[ Configure LSP ]]
-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr)
-- NOTE: Remember that lua is a real programming language, and as such it is possible
@ -324,71 +422,65 @@ local on_attach = function(_, bufnr)
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
if vim.lsp.buf.format then
vim.lsp.buf.format()
elseif vim.lsp.buf.formatting then
vim.lsp.buf.formatting()
end
vim.lsp.buf.format()
end, { desc = 'Format current buffer with LSP' })
end
-- Setup mason so it can manage external tooling
require('mason').setup()
-- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed
local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'gopls' }
-- Ensure the servers above are installed
require('mason-lspconfig').setup {
ensure_installed = servers,
}
-- nvim-cmp supports additional completion capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
for _, lsp in ipairs(servers) do
require('lspconfig')[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
}
end
-- Turn on lsp status information
require('fidget').setup()
-- Example custom configuration for lua
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
--
-- Make runtime files discoverable to the server
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, 'lua/?.lua')
table.insert(runtime_path, 'lua/?/init.lua')
-- Add any additional override configuration in the following tables. They will be passed to
-- the `settings` field of the server config. You must look up that documentation yourself.
--
-- If you want to override the default filetypes that your language server will attach to you can
-- define the property 'filetypes' to the map in question.
local servers = {
-- clangd = {},
-- gopls = {},
-- pyright = {},
-- rust_analyzer = {},
-- tsserver = {},
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
require('lspconfig').sumneko_lua.setup {
on_attach = on_attach,
capabilities = capabilities,
settings = {
lua_ls = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT)
version = 'LuaJIT',
-- Setup your lua path
path = runtime_path,
},
diagnostics = {
globals = { 'vim' },
},
workspace = { library = vim.api.nvim_get_runtime_file('', true) },
-- Do not send telemetry data containing a randomized but unique identifier
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
},
}
-- nvim-cmp setup
-- Setup neovim lua configuration
require('neodev').setup()
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
-- Ensure the servers above are installed
local mason_lspconfig = require 'mason-lspconfig'
mason_lspconfig.setup {
ensure_installed = vim.tbl_keys(servers),
}
mason_lspconfig.setup_handlers {
function(server_name)
require('lspconfig')[server_name].setup {
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
filetypes = (servers[server_name] or {}).filetypes,
}
end
}
-- [[ Configure nvim-cmp ]]
-- See `:help cmp`
local cmp = require 'cmp'
local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {}
cmp.setup {
snippet = {
@ -397,9 +489,11 @@ cmp.setup {
end,
},
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-Space>'] = cmp.mapping.complete {},
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
@ -407,7 +501,7 @@ cmp.setup {
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
@ -416,7 +510,7 @@ cmp.setup {
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()

View File

@ -0,0 +1,5 @@
-- You can add your own plugins here or in other files in this directory!
-- I promise not to create any merge conflicts in this directory :)
--
-- See the kickstart.nvim README for more information
return {}

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

View File

@ -0,0 +1,87 @@
-- debug.lua
--
-- Shows how to use the DAP plugin to debug your code.
--
-- Primarily focused on configuring the debugger for Go, but can
-- be extended to other languages as well. That's why it's called
-- kickstart.nvim and not kitchen-sink.nvim ;)
return {
-- NOTE: Yes, you can install new plugins here!
'mfussenegger/nvim-dap',
-- NOTE: And you can specify dependencies as well
dependencies = {
-- Creates a beautiful debugger UI
'rcarriga/nvim-dap-ui',
-- Installs the debug adapters for you
'williamboman/mason.nvim',
'jay-babu/mason-nvim-dap.nvim',
-- Add your own debuggers here
'leoluz/nvim-dap-go',
},
config = function()
local dap = require 'dap'
local dapui = require 'dapui'
require('mason-nvim-dap').setup {
-- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations
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
-- online, please don't ask me how to install them :)
ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want
'delve',
},
}
-- 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
-- For more information, see |:help nvim-dap-ui|
dapui.setup {
-- Set icons to characters that are more likely to work in every terminal.
-- Feel free to remove or use ones that you like more! :)
-- Don't feel like these are good choices.
icons = { expanded = '', collapsed = '', current_frame = '*' },
controls = {
icons = {
pause = '',
play = '',
step_into = '',
step_over = '',
step_out = '',
step_back = 'b',
run_last = '▶▶',
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.before.event_terminated['dapui_config'] = dapui.close
dap.listeners.before.event_exited['dapui_config'] = dapui.close
-- Install golang specific config
require('dap-go').setup()
end,
}