Merge branch 'nvim-lua:master' into master
This commit is contained in:
commit
d09601caed
|
@ -8,19 +8,21 @@ 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:
|
||||
## 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):**
|
||||
## Desktop
|
||||
<!-- please complete the following information. -->
|
||||
- OS:
|
||||
- Terminal:
|
||||
|
||||
** Neovim Version **
|
||||
- Output of running `:version` from inside of neovim:
|
||||
## Neovim Version
|
||||
<!-- Output of running `:version` from inside of neovim. -->
|
||||
|
||||
```
|
||||
```
|
||||
|
|
|
@ -2,4 +2,4 @@ tags
|
|||
test.sh
|
||||
.luarc.json
|
||||
nvim
|
||||
plugin/packer_compiled.lua
|
||||
lazy-lock.json
|
||||
|
|
34
Dockerfile
34
Dockerfile
|
@ -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
|
137
README.md
137
README.md
|
@ -1,64 +1,108 @@
|
|||
# kickstart.nvim
|
||||
|
||||
### Introduction
|
||||
|
||||
A starting point for Neovim that is:
|
||||
|
||||
* Small (<500 lines)
|
||||
* Single-file
|
||||
* Small
|
||||
* Single-file (with examples of moving to multi-file)
|
||||
* Documented
|
||||
* Modular
|
||||
|
||||
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.
|
||||
|
||||
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. Please refrain from leaving comments about enabling / disabling particular languages out of the box.
|
||||
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` (Linux) or `~/AppData/Local/nvim/init.lua` (Windows)
|
||||
* 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)
|
||||
|
||||
### 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-data\` (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.
|
||||
|
||||
If there are languages that you don't want to use, remove their configuration and notes from your `init.lua` after copy and pasting (for example, in the mason configuration).
|
||||
### GIT Clone Installation
|
||||
* From a terminal cd/dir to:
|
||||
`~/.config/nvim` (Linux)
|
||||
`~/.config/nvim` (MacOS)
|
||||
`%userprofile%\AppData\Local\nvim-data\` (Windows)
|
||||
|
||||
### Windows Installation
|
||||
* 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 the kickstart process to download files and set up the basics.
|
||||
* Once the setup is complete restart Neovim.
|
||||
* **You're ready to go!**
|
||||
|
||||
Installation may require installing build tools, and updating the run command for `telescope-fzf-native`
|
||||
* (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-data\` (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
|
||||
|
||||
See `telescope-fzf-native` documention for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)
|
||||
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 as well [Windows Installation](#Windows-Installation)
|
||||
|
||||
This requires:
|
||||
### Configuration And Extension
|
||||
|
||||
- Install CMake, and the Microsoft C++ Build Tools on Windows
|
||||
* Inside of your fork, feel free to modify any file you like! It's your fork!
|
||||
* Then there are two primary configuration options available:
|
||||
* 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`
|
||||
|
||||
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
|
||||
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' }
|
||||
```
|
||||
-- File: lua/custom/plugins/autopairs.lua
|
||||
|
||||
### Configuration
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
#### Example `plugins.lua`
|
||||
|
||||
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.
|
||||
|
||||
```lua
|
||||
return function(use)
|
||||
use({
|
||||
"folke/which-key.nvim",
|
||||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
config = function()
|
||||
require("which-key").setup({})
|
||||
end
|
||||
})
|
||||
end
|
||||
require("nvim-autopairs").setup {}
|
||||
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 `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
|
||||
-- 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,
|
||||
}
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
#### Example: Adding a file to change default options
|
||||
|
||||
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
|
||||
|
@ -72,7 +116,6 @@ Pull-requests are welcome. The goal of this repo is not to create a Neovim confi
|
|||
|
||||
* 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.
|
||||
|
||||
|
@ -80,5 +123,25 @@ Each PR, especially those which increase the line count, should have a descripti
|
|||
|
||||
* 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/`
|
||||
* 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' }
|
||||
```
|
||||
|
||||
|
|
|
@ -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:
|
|
@ -0,0 +1,3 @@
|
|||
kickstart-is kickstart.txt /*kickstart-is*
|
||||
kickstart-is-not kickstart.txt /*kickstart-is-not*
|
||||
kickstart.nvim kickstart.txt /*kickstart.nvim*
|
|
@ -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 {}
|
|
@ -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,
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
-- 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)
|
||||
vim.keymap.set('n', '<F1>', dap.step_into)
|
||||
vim.keymap.set('n', '<F2>', dap.step_over)
|
||||
vim.keymap.set('n', '<F3>', dap.step_out)
|
||||
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint)
|
||||
vim.keymap.set('n', '<leader>B', function()
|
||||
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
||||
end)
|
||||
|
||||
-- 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)
|
||||
|
||||
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,
|
||||
}
|
Loading…
Reference in New Issue