Merge branch 'master' of github.com:nvim-lua/kickstart.nvim into new-main
This commit is contained in:
commit
b54b0a6b68
|
@ -46,8 +46,8 @@ Neovim's configurations are located under the following paths, depending on your
|
||||||
| OS | PATH |
|
| OS | PATH |
|
||||||
| :- | :--- |
|
| :- | :--- |
|
||||||
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
|
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
|
||||||
| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` |
|
| Windows (cmd)| `%localappdata%\nvim\` |
|
||||||
| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` |
|
| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` |
|
||||||
|
|
||||||
#### Recommended Step
|
#### Recommended Step
|
||||||
|
|
||||||
|
@ -77,13 +77,13 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HO
|
||||||
If you're using `cmd.exe`:
|
If you're using `cmd.exe`:
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\
|
git clone https://github.com/nvim-lua/kickstart.nvim.git %localappdata%\nvim\
|
||||||
```
|
```
|
||||||
|
|
||||||
If you're using `powershell.exe`
|
If you're using `powershell.exe`
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\
|
git clone https://github.com/nvim-lua/kickstart.nvim.git $env:LOCALAPPDATA\nvim\
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
70
init.lua
70
init.lua
|
@ -111,9 +111,12 @@ vim.opt.mouse = 'a'
|
||||||
vim.opt.showmode = false
|
vim.opt.showmode = false
|
||||||
|
|
||||||
-- Sync clipboard between OS and Neovim.
|
-- Sync clipboard between OS and Neovim.
|
||||||
|
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
||||||
-- Remove this option if you want your OS clipboard to remain independent.
|
-- Remove this option if you want your OS clipboard to remain independent.
|
||||||
-- See `:help 'clipboard'`
|
-- See `:help 'clipboard'`
|
||||||
-- vim.opt.clipboard = 'unnamedplus'
|
vim.schedule(function()
|
||||||
|
vim.opt.clipboard = 'unnamedplus'
|
||||||
|
end)
|
||||||
|
|
||||||
-- Enable break indent
|
-- Enable break indent
|
||||||
vim.opt.breakindent = true
|
vim.opt.breakindent = true
|
||||||
|
@ -157,14 +160,11 @@ vim.opt.scrolloff = 10
|
||||||
-- [[ Basic Keymaps ]]
|
-- [[ Basic Keymaps ]]
|
||||||
-- See `:help vim.keymap.set()`
|
-- See `:help vim.keymap.set()`
|
||||||
|
|
||||||
-- Set highlight on search, but clear on pressing <Esc> in normal mode
|
-- Clear highlights on search when pressing <Esc> in normal mode
|
||||||
vim.opt.hlsearch = true
|
-- See `:help hlsearch`
|
||||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
-- Diagnostic keymaps
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
|
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
|
|
||||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
|
|
||||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||||
|
|
||||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||||
|
@ -207,7 +207,7 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
-- [[ Install `lazy.nvim` plugin manager ]]
|
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||||
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
||||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
if not vim.uv.fs_stat(lazypath) then
|
||||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||||
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
||||||
if vim.v.shell_error ~= 0 then
|
if vim.v.shell_error ~= 0 then
|
||||||
|
@ -237,11 +237,6 @@ require('lazy').setup({
|
||||||
--
|
--
|
||||||
-- Use `opts = {}` to force a plugin to be loaded.
|
-- Use `opts = {}` to force a plugin to be loaded.
|
||||||
--
|
--
|
||||||
-- This is equivalent to:
|
|
||||||
-- require('Comment').setup({})
|
|
||||||
|
|
||||||
-- "gc" to comment visual regions/lines
|
|
||||||
{ 'numToStr/Comment.nvim', opts = {} },
|
|
||||||
|
|
||||||
-- Here is a more advanced example where we pass configuration
|
-- Here is a more advanced example where we pass configuration
|
||||||
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
|
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
|
||||||
|
@ -476,7 +471,22 @@ require('lazy').setup({
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- LSP Configuration & Plugins
|
-- LSP Plugins
|
||||||
|
{
|
||||||
|
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
||||||
|
-- used for completion, annotations and signatures of Neovim apis
|
||||||
|
'folke/lazydev.nvim',
|
||||||
|
ft = 'lua',
|
||||||
|
opts = {
|
||||||
|
library = {
|
||||||
|
-- Load luvit types when the `vim.uv` word is found
|
||||||
|
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ 'Bilal2453/luvit-meta', lazy = true },
|
||||||
|
{
|
||||||
|
-- Main LSP Configuration
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Automatically install LSPs and related tools to stdpath for Neovim
|
-- Automatically install LSPs and related tools to stdpath for Neovim
|
||||||
|
@ -488,9 +498,8 @@ require('lazy').setup({
|
||||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||||
{ 'j-hui/fidget.nvim', opts = {} },
|
{ 'j-hui/fidget.nvim', opts = {} },
|
||||||
|
|
||||||
-- `neodev` configures Lua LSP for your Neovim config, runtime and plugins
|
-- Allows extra capabilities provided by nvim-cmp
|
||||||
-- used for completion, annotations and signatures of Neovim apis
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
{ 'folke/neodev.nvim', opts = {} },
|
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- Brief aside: **What is LSP?**
|
-- Brief aside: **What is LSP?**
|
||||||
|
@ -567,10 +576,6 @@ require('lazy').setup({
|
||||||
-- or a suggestion from your LSP for this to activate.
|
-- or a suggestion from your LSP for this to activate.
|
||||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||||
|
|
||||||
-- Opens a popup that displays documentation about the word under your cursor
|
|
||||||
-- See `:help K` for why this keymap.
|
|
||||||
map('K', vim.lsp.buf.hover, 'Hover Documentation')
|
|
||||||
|
|
||||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||||
-- For example, in C this would take you to the header.
|
-- For example, in C this would take you to the header.
|
||||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||||
|
@ -581,7 +586,7 @@ require('lazy').setup({
|
||||||
--
|
--
|
||||||
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
||||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||||
if client and client.server_capabilities.documentHighlightProvider then
|
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
|
||||||
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
||||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||||
buffer = event.buf,
|
buffer = event.buf,
|
||||||
|
@ -604,13 +609,13 @@ require('lazy').setup({
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- The following autocommand is used to enable inlay hints in your
|
-- The following code creates a keymap to toggle inlay hints in your
|
||||||
-- code, if the language server you are using supports them
|
-- code, if the language server you are using supports them
|
||||||
--
|
--
|
||||||
-- This may be unwanted, since they displace some of your code
|
-- This may be unwanted, since they displace some of your code
|
||||||
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
|
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
||||||
map('<leader>th', function()
|
map('<leader>th', function()
|
||||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
|
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
||||||
end, '[T]oggle Inlay [H]ints')
|
end, '[T]oggle Inlay [H]ints')
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -695,7 +700,8 @@ require('lazy').setup({
|
||||||
|
|
||||||
{ -- Autoformat
|
{ -- Autoformat
|
||||||
'stevearc/conform.nvim',
|
'stevearc/conform.nvim',
|
||||||
lazy = false,
|
event = { 'BufWritePre' },
|
||||||
|
cmd = { 'ConformInfo' },
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
'<leader>f',
|
'<leader>f',
|
||||||
|
@ -723,9 +729,8 @@ require('lazy').setup({
|
||||||
-- Conform can also run multiple formatters sequentially
|
-- Conform can also run multiple formatters sequentially
|
||||||
-- python = { "isort", "black" },
|
-- python = { "isort", "black" },
|
||||||
--
|
--
|
||||||
-- You can use a sub-list to tell conform to run *until* a formatter
|
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||||
-- is found.
|
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||||
-- javascript = { { "prettierd", "prettier" } },
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -833,6 +838,11 @@ require('lazy').setup({
|
||||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||||
},
|
},
|
||||||
sources = {
|
sources = {
|
||||||
|
{
|
||||||
|
name = 'lazydev',
|
||||||
|
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
||||||
|
group_index = 0,
|
||||||
|
},
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
{ name = 'luasnip' },
|
{ name = 'luasnip' },
|
||||||
{ name = 'path' },
|
{ name = 'path' },
|
||||||
|
@ -869,7 +879,7 @@ require('lazy').setup({
|
||||||
--
|
--
|
||||||
-- Examples:
|
-- Examples:
|
||||||
-- - va) - [V]isually select [A]round [)]paren
|
-- - va) - [V]isually select [A]round [)]paren
|
||||||
-- - yinq - [Y]ank [I]nside [N]ext [']quote
|
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
|
||||||
-- - ci' - [C]hange [I]nside [']quote
|
-- - ci' - [C]hange [I]nside [']quote
|
||||||
require('mini.ai').setup { n_lines = 500 }
|
require('mini.ai').setup { n_lines = 500 }
|
||||||
|
|
||||||
|
@ -941,8 +951,6 @@ require('lazy').setup({
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||||
|
|
||||||
-- Prefer git instead of curl in order to improve connectivity in some environments
|
|
||||||
require('nvim-treesitter.install').prefer_git = true
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
require('nvim-treesitter.configs').setup(opts)
|
require('nvim-treesitter.configs').setup(opts)
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
local check_version = function()
|
local check_version = function()
|
||||||
local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch)
|
local verstr = tostring(vim.version())
|
||||||
if not vim.version.cmp then
|
if not vim.version.ge then
|
||||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then
|
if vim.version.ge(vim.version(), '0.10-dev') then
|
||||||
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
|
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
|
||||||
else
|
else
|
||||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||||
|
|
|
@ -24,6 +24,28 @@ return {
|
||||||
-- Add your own debuggers here
|
-- Add your own debuggers here
|
||||||
'leoluz/nvim-dap-go',
|
'leoluz/nvim-dap-go',
|
||||||
},
|
},
|
||||||
|
keys = function(_, keys)
|
||||||
|
local dap = require 'dap'
|
||||||
|
local dapui = require 'dapui'
|
||||||
|
return {
|
||||||
|
-- Basic debugging keymaps, feel free to change to your liking!
|
||||||
|
{ '<F5>', dap.continue, desc = 'Debug: Start/Continue' },
|
||||||
|
{ '<F1>', dap.step_into, desc = 'Debug: Step Into' },
|
||||||
|
{ '<F2>', dap.step_over, desc = 'Debug: Step Over' },
|
||||||
|
{ '<F3>', dap.step_out, desc = 'Debug: Step Out' },
|
||||||
|
{ '<leader>b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' },
|
||||||
|
{
|
||||||
|
'<leader>B',
|
||||||
|
function()
|
||||||
|
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Set Breakpoint',
|
||||||
|
},
|
||||||
|
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||||
|
{ '<F7>', dapui.toggle, desc = 'Debug: See last session result.' },
|
||||||
|
unpack(keys),
|
||||||
|
}
|
||||||
|
end,
|
||||||
config = function()
|
config = function()
|
||||||
local dap = require 'dap'
|
local dap = require 'dap'
|
||||||
local dapui = require 'dapui'
|
local dapui = require 'dapui'
|
||||||
|
@ -45,16 +67,6 @@ return {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Basic debugging keymaps, feel free to change to your liking!
|
|
||||||
vim.keymap.set('n', '<F5>', dap.continue, { desc = 'Debug: Start/Continue' })
|
|
||||||
vim.keymap.set('n', '<F1>', dap.step_into, { desc = 'Debug: Step Into' })
|
|
||||||
vim.keymap.set('n', '<F2>', dap.step_over, { desc = 'Debug: Step Over' })
|
|
||||||
vim.keymap.set('n', '<F3>', dap.step_out, { desc = 'Debug: Step Out' })
|
|
||||||
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' })
|
|
||||||
vim.keymap.set('n', '<leader>B', function()
|
|
||||||
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
|
||||||
end, { desc = 'Debug: Set Breakpoint' })
|
|
||||||
|
|
||||||
-- Dap UI setup
|
-- Dap UI setup
|
||||||
-- For more information, see |:help nvim-dap-ui|
|
-- For more information, see |:help nvim-dap-ui|
|
||||||
dapui.setup {
|
dapui.setup {
|
||||||
|
@ -77,9 +89,6 @@ return {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- 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
|
||||||
|
|
|
@ -47,7 +47,7 @@ return {
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
||||||
group = lint_augroup,
|
group = lint_augroup,
|
||||||
callback = function()
|
callback = function()
|
||||||
require('lint').try_lint()
|
lint.try_lint()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -11,7 +11,7 @@ return {
|
||||||
},
|
},
|
||||||
cmd = 'Neotree',
|
cmd = 'Neotree',
|
||||||
keys = {
|
keys = {
|
||||||
{ '\\', ':Neotree reveal<CR>', { desc = 'NeoTree reveal' } },
|
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal' },
|
||||||
},
|
},
|
||||||
opts = {
|
opts = {
|
||||||
filesystem = {
|
filesystem = {
|
||||||
|
|
Loading…
Reference in New Issue