Merge remote-tracking branch 'upstream/master' into update
This commit is contained in:
commit
3d4ae70d50
|
@ -2,4 +2,3 @@ tags
|
||||||
test.sh
|
test.sh
|
||||||
.luarc.json
|
.luarc.json
|
||||||
nvim
|
nvim
|
||||||
lazy-lock.json
|
|
||||||
|
|
68
README.md
68
README.md
|
@ -1,5 +1,7 @@
|
||||||
# kickstart.nvim
|
# kickstart.nvim
|
||||||
|
|
||||||
|
https://github.com/kdheepak/kickstart.nvim/assets/1813121/f3ff9a2b-c31f-44df-a4fa-8a0d7b17cf7b
|
||||||
|
|
||||||
### Introduction
|
### Introduction
|
||||||
|
|
||||||
A starting point for Neovim that is:
|
A starting point for Neovim that is:
|
||||||
|
@ -9,7 +11,7 @@ A starting point for Neovim that is:
|
||||||
* Documented
|
* Documented
|
||||||
* Modular
|
* 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.
|
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.
|
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.
|
||||||
|
|
||||||
|
@ -18,42 +20,56 @@ Distribution Alternatives:
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
* Backup your previous configuration (if any exists)
|
> **NOTE**
|
||||||
|
> [Backup](#FAQ) your previous configuration (if any exists)
|
||||||
|
|
||||||
### Archive Installation
|
Requirements:
|
||||||
* On the home/landing page for the project find the blue "<> CODE" button click it and select Local > Download ZIP.
|
* Make sure to review the readmes of the plugins if you are experiencing errors. In particular:
|
||||||
* Extract the archive to:
|
* [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers.
|
||||||
`~/.config/nvim` (Linux)
|
* See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native`
|
||||||
`~/.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.
|
|
||||||
|
|
||||||
### Git Clone Installation
|
Neovim's configurations are located under the following paths, depending on your OS:
|
||||||
* From a terminal cd/dir to:
|
|
||||||
`~/.config/nvim` (Linux)
|
|
||||||
`~/.config/nvim` (MacOS)
|
|
||||||
`%userprofile%\AppData\Local\nvim\` (Windows)
|
|
||||||
|
|
||||||
* run: `git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim` OR: `gh repo clone nvim-lua/kickstart.nvim`
|
| OS | PATH |
|
||||||
* 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.
|
| Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
|
||||||
* **You're ready to go!**
|
| MacOS | `$XDG_CONFIG_HOME/nvim`, '~/.config/nvim` |
|
||||||
|
| Windows | `%userprofile%\AppData\Local\nvim\` |
|
||||||
|
|
||||||
* (Recommended/Optional) Fork this repo (so that you have your own copy that you can modify).
|
Clone kickstart.nvim:
|
||||||
* 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
|
|
||||||
|
|
||||||
Additional system requirements:
|
```sh
|
||||||
- Make sure to review the readmes of the plugins if you are experiencing errors. In particular:
|
# on Linux and Mac
|
||||||
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers.
|
git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
|
||||||
- See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native`
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
# on Windows
|
||||||
|
git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\
|
||||||
|
```
|
||||||
|
|
||||||
|
### Post Installation
|
||||||
|
|
||||||
|
Run the following command and then **you are ready to go**!
|
||||||
|
|
||||||
|
```sh
|
||||||
|
nvim --headless "+Lazy! sync" +qa
|
||||||
|
```
|
||||||
|
|
||||||
|
### Recommended Steps
|
||||||
|
|
||||||
|
[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo (so that you have your own copy that you can modify) and then installing you can install to your machine using the methods above.
|
||||||
|
|
||||||
|
> **NOTE**
|
||||||
|
> Your fork's url will be something like this: `https://github.com/<your_github_username>/kickstart.nvim.git`
|
||||||
|
|
||||||
### Configuration And Extension
|
### Configuration And Extension
|
||||||
|
|
||||||
* Inside of your copy, feel free to modify any file you like! It's your copy!
|
* 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.
|
* 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:
|
* For adding plugins, there are 3 primary options:
|
||||||
* Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim`
|
* 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.
|
* Modify `init.lua` with additional plugins.
|
||||||
* Include the `lua/kickstart/plugins/*` files in your configuration.
|
* Include the `lua/kickstart/plugins/*` files in your configuration.
|
||||||
|
|
||||||
|
|
85
init.lua
85
init.lua
|
@ -17,7 +17,9 @@ Kickstart.nvim is a template for your own configuration.
|
||||||
a guide. One possible example:
|
a guide. One possible example:
|
||||||
- https://learnxinyminutes.com/docs/lua/
|
- https://learnxinyminutes.com/docs/lua/
|
||||||
|
|
||||||
|
|
||||||
And then you can explore or search through `:help lua-guide`
|
And then you can explore or search through `:help lua-guide`
|
||||||
|
- https://neovim.io/doc/user/lua-guide.html
|
||||||
|
|
||||||
|
|
||||||
Kickstart Guide:
|
Kickstart Guide:
|
||||||
|
@ -111,7 +113,7 @@ require('lazy').setup({
|
||||||
{ 'folke/which-key.nvim', opts = {} },
|
{ 'folke/which-key.nvim', opts = {} },
|
||||||
|
|
||||||
{
|
{
|
||||||
-- Adds git releated signs to the gutter, as well as utilities for managing changes
|
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||||
'lewis6991/gitsigns.nvim',
|
'lewis6991/gitsigns.nvim',
|
||||||
opts = {
|
opts = {
|
||||||
-- See `:help gitsigns.txt`
|
-- See `:help gitsigns.txt`
|
||||||
|
@ -123,10 +125,20 @@ require('lazy').setup({
|
||||||
changedelete = { text = '~' },
|
changedelete = { text = '~' },
|
||||||
},
|
},
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk,
|
vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git 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' })
|
-- don't override the built-in and fugitive keymaps
|
||||||
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
|
local gs = package.loaded.gitsigns
|
||||||
|
vim.keymap.set({'n', 'v'}, ']c', function()
|
||||||
|
if vim.wo.diff then return ']c' end
|
||||||
|
vim.schedule(function() gs.next_hunk() end)
|
||||||
|
return '<Ignore>'
|
||||||
|
end, {expr=true, buffer = bufnr, desc = "Jump to next hunk"})
|
||||||
|
vim.keymap.set({'n', 'v'}, '[c', function()
|
||||||
|
if vim.wo.diff then return '[c' end
|
||||||
|
vim.schedule(function() gs.prev_hunk() end)
|
||||||
|
return '<Ignore>'
|
||||||
|
end, {expr=true, buffer = bufnr, desc = "Jump to previous hunk"})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -160,10 +172,7 @@ require('lazy').setup({
|
||||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||||
-- See `:help indent_blankline.txt`
|
-- See `:help indent_blankline.txt`
|
||||||
main = "ibl",
|
main = "ibl",
|
||||||
opts = {
|
opts = {},
|
||||||
-- char = '┊',
|
|
||||||
-- show_trailing_blankline_indent = false,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
-- "gc" to comment visual regions/lines
|
-- "gc" to comment visual regions/lines
|
||||||
|
@ -171,8 +180,11 @@ require('lazy').setup({
|
||||||
|
|
||||||
|
|
||||||
-- Fuzzy Finder (files, lsp, etc)
|
-- Fuzzy Finder (files, lsp, etc)
|
||||||
{ 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { '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.
|
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
||||||
-- Only load if `make` is available. Make sure you have the system
|
-- Only load if `make` is available. Make sure you have the system
|
||||||
-- requirements installed.
|
-- requirements installed.
|
||||||
|
@ -185,6 +197,8 @@ require('lazy').setup({
|
||||||
return vim.fn.executable 'make' == 1
|
return vim.fn.executable 'make' == 1
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
-- Highlight, edit, and navigate code
|
-- Highlight, edit, and navigate code
|
||||||
|
@ -201,9 +215,10 @@ require('lazy').setup({
|
||||||
require 'kickstart.plugins.autoformat',
|
require 'kickstart.plugins.autoformat',
|
||||||
-- require 'kickstart.plugins.debug',
|
-- require 'kickstart.plugins.debug',
|
||||||
|
|
||||||
-- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||||
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
|
-- 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.
|
-- 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
|
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
||||||
{ import = 'custom.plugins' },
|
{ import = 'custom.plugins' },
|
||||||
|
@ -246,7 +261,6 @@ vim.wo.signcolumn = 'yes'
|
||||||
|
|
||||||
-- Decrease update time
|
-- Decrease update time
|
||||||
vim.o.updatetime = 250
|
vim.o.updatetime = 250
|
||||||
vim.o.timeout = true
|
|
||||||
vim.o.timeoutlen = 300
|
vim.o.timeoutlen = 300
|
||||||
|
|
||||||
-- Set completeopt to have a better completion experience
|
-- Set completeopt to have a better completion experience
|
||||||
|
@ -312,15 +326,18 @@ vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc
|
||||||
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
||||||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
||||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||||
|
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
|
||||||
|
|
||||||
-- [[ Configure Treesitter ]]
|
-- [[ Configure Treesitter ]]
|
||||||
-- See `:help nvim-treesitter`
|
-- See `:help nvim-treesitter`
|
||||||
require('nvim-treesitter.configs').setup {
|
-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
|
||||||
|
vim.defer_fn(function()
|
||||||
|
require('nvim-treesitter.configs').setup {
|
||||||
-- Add languages to be installed here that you want installed for treesitter
|
-- Add languages to be installed here that you want installed for treesitter
|
||||||
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' },
|
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' },
|
||||||
|
|
||||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||||
auto_install = true,
|
auto_install = false,
|
||||||
|
|
||||||
highlight = { enable = true },
|
highlight = { enable = true },
|
||||||
indent = { enable = true },
|
indent = { enable = true },
|
||||||
|
@ -377,7 +394,8 @@ require('nvim-treesitter.configs').setup {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
end, 0)
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
-- Diagnostic keymaps
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
||||||
|
@ -407,7 +425,7 @@ local on_attach = function(_, bufnr)
|
||||||
|
|
||||||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
||||||
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||||
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||||
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
||||||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||||
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||||
|
@ -430,21 +448,33 @@ local on_attach = function(_, bufnr)
|
||||||
end, { desc = 'Format current buffer with LSP' })
|
end, { desc = 'Format current buffer with LSP' })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- document existing key chains
|
||||||
|
require('which-key').register({
|
||||||
|
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
|
||||||
|
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
|
||||||
|
['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
|
||||||
|
['<leader>h'] = { name = 'More git', _ = 'which_key_ignore' },
|
||||||
|
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
||||||
|
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
||||||
|
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
||||||
|
})
|
||||||
|
|
||||||
-- Enable the following language servers
|
-- Enable the following language servers
|
||||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||||
--
|
--
|
||||||
-- Add any additional override configuration in the following tables. They will be passed to
|
-- 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.
|
-- the `settings` field of the server config. You must look up that documentation yourself.
|
||||||
--
|
--
|
||||||
-- https://github.com/williamboman/mason-lspconfig.nvim/blob/main/doc/server-mapping.md
|
-- 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 = {
|
local servers = {
|
||||||
clangd = {},
|
-- clangd = {},
|
||||||
cssls = {},
|
-- gopls = {},
|
||||||
gopls = {},
|
-- pyright = {},
|
||||||
html = {},
|
-- rust_analyzer = {},
|
||||||
pyright = {},
|
-- tsserver = {},
|
||||||
rust_analyzer = {},
|
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
|
||||||
tsserver = {},
|
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
Lua = {
|
Lua = {
|
||||||
workspace = { checkThirdParty = false },
|
workspace = { checkThirdParty = false },
|
||||||
|
@ -473,8 +503,9 @@ mason_lspconfig.setup_handlers {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
settings = servers[server_name],
|
settings = servers[server_name],
|
||||||
|
filetypes = (servers[server_name] or {}).filetypes,
|
||||||
}
|
}
|
||||||
end,
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
-- [[ Configure nvim-cmp ]]
|
-- [[ Configure nvim-cmp ]]
|
||||||
|
|
Loading…
Reference in New Issue