|
|
|
@ -29,7 +29,7 @@ What is Kickstart?
|
|
|
|
|
what your configuration is doing, and modify it to suit your needs.
|
|
|
|
|
|
|
|
|
|
Once you've done that, you can start exploring, configuring and tinkering to
|
|
|
|
|
make Neovim your own! That might mean leaving kickstart just the way it is for a while
|
|
|
|
|
make Neovim your own! That might mean leaving Kickstart just the way it is for a while
|
|
|
|
|
or immediately breaking it into modular pieces. It's up to you!
|
|
|
|
|
|
|
|
|
|
If you don't know anything about Lua, I recommend taking some time to read through
|
|
|
|
@ -51,32 +51,32 @@ Kickstart Guide:
|
|
|
|
|
- Tutor
|
|
|
|
|
- <enter key>
|
|
|
|
|
|
|
|
|
|
(If you already know how the Neovim basics, you can skip this step)
|
|
|
|
|
(If you already know the Neovim basics, you can skip this step.)
|
|
|
|
|
|
|
|
|
|
Once you've completed that, you can continue working through **AND READING** the rest
|
|
|
|
|
of the kickstart init.lua
|
|
|
|
|
of the kickstart init.lua.
|
|
|
|
|
|
|
|
|
|
Next, run AND READ `:help`.
|
|
|
|
|
This will open up a help window with some basic information
|
|
|
|
|
about reading, navigating and searching the builtin help documentation.
|
|
|
|
|
|
|
|
|
|
This should be the first place you go to look when you're stuck or confused
|
|
|
|
|
with something. It's one of my favorite neovim features.
|
|
|
|
|
with something. It's one of my favorite Neovim features.
|
|
|
|
|
|
|
|
|
|
MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation,
|
|
|
|
|
which is very useful when you're not sure exactly what you're looking for.
|
|
|
|
|
which is very useful when you're not exactly sure of what you're looking for.
|
|
|
|
|
|
|
|
|
|
I have left several `:help X` comments throughout the init.lua
|
|
|
|
|
These are hints about where to find more information about the relevant settings,
|
|
|
|
|
plugins or neovim features used in kickstart.
|
|
|
|
|
plugins or Neovim features used in Kickstart.
|
|
|
|
|
|
|
|
|
|
NOTE: Look for lines like this
|
|
|
|
|
|
|
|
|
|
Throughout the file. These are for you, the reader, to help understand what is happening.
|
|
|
|
|
Throughout the file. These are for you, the reader, to help you 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.
|
|
|
|
|
for when you are first encountering a few different constructs in your Neovim config.
|
|
|
|
|
|
|
|
|
|
If you experience any errors while trying to install kickstart, run `:checkhealth` for more info
|
|
|
|
|
If you experience any errors while trying to install kickstart, run `:checkhealth` for more info.
|
|
|
|
|
|
|
|
|
|
I hope you enjoy your Neovim journey,
|
|
|
|
|
- TJ
|
|
|
|
@ -100,14 +100,14 @@ vim.g.have_nerd_font = false
|
|
|
|
|
|
|
|
|
|
-- Make line numbers default
|
|
|
|
|
vim.opt.number = true
|
|
|
|
|
-- You can also add relative line numbers, for help with jumping.
|
|
|
|
|
-- You can also add relative line numbers, to help with jumping.
|
|
|
|
|
-- Experiment for yourself to see if you like it!
|
|
|
|
|
-- vim.opt.relativenumber = true
|
|
|
|
|
|
|
|
|
|
-- Enable mouse mode, can be useful for resizing splits for example!
|
|
|
|
|
vim.opt.mouse = 'a'
|
|
|
|
|
|
|
|
|
|
-- Don't show the mode, since it's already in status line
|
|
|
|
|
-- Don't show the mode, since it's already in the status line
|
|
|
|
|
vim.opt.showmode = false
|
|
|
|
|
|
|
|
|
|
-- Sync clipboard between OS and Neovim.
|
|
|
|
@ -121,7 +121,7 @@ vim.opt.breakindent = true
|
|
|
|
|
-- Save undo history
|
|
|
|
|
vim.opt.undofile = true
|
|
|
|
|
|
|
|
|
|
-- Case-insensitive searching UNLESS \C or capital in search
|
|
|
|
|
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
|
|
|
|
vim.opt.ignorecase = true
|
|
|
|
|
vim.opt.smartcase = true
|
|
|
|
|
|
|
|
|
@ -139,7 +139,7 @@ vim.opt.timeoutlen = 300
|
|
|
|
|
vim.opt.splitright = true
|
|
|
|
|
vim.opt.splitbelow = true
|
|
|
|
|
|
|
|
|
|
-- Sets how neovim will display certain whitespace in the editor.
|
|
|
|
|
-- Sets how neovim will display certain whitespace characters in the editor.
|
|
|
|
|
-- See `:help 'list'`
|
|
|
|
|
-- and `:help 'listchars'`
|
|
|
|
|
vim.opt.list = true
|
|
|
|
@ -220,7 +220,7 @@ vim.opt.rtp:prepend(lazypath)
|
|
|
|
|
--
|
|
|
|
|
-- You can press `?` in this menu for help. Use `:q` to close the window
|
|
|
|
|
--
|
|
|
|
|
-- To update plugins, you can run
|
|
|
|
|
-- To update plugins you can run
|
|
|
|
|
-- :Lazy update
|
|
|
|
|
--
|
|
|
|
|
-- NOTE: Here is where you install your plugins.
|
|
|
|
@ -241,7 +241,7 @@ require('lazy').setup({
|
|
|
|
|
{ 'numToStr/Comment.nvim', opts = {} },
|
|
|
|
|
|
|
|
|
|
-- 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:
|
|
|
|
|
-- require('gitsigns').setup({ ... })
|
|
|
|
|
--
|
|
|
|
|
-- See `:help gitsigns` to understand what the configuration keys do
|
|
|
|
@ -258,7 +258,7 @@ require('lazy').setup({
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- NOTE: Plugins can also be configured to run lua code when they are loaded.
|
|
|
|
|
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
|
|
|
|
|
--
|
|
|
|
|
-- This is often very useful to both group configuration, as well as handle
|
|
|
|
|
-- lazy loading plugins that don't need to be loaded immediately at startup.
|
|
|
|
@ -303,7 +303,7 @@ require('lazy').setup({
|
|
|
|
|
branch = '0.1.x',
|
|
|
|
|
dependencies = {
|
|
|
|
|
'nvim-lua/plenary.nvim',
|
|
|
|
|
{ -- If encountering errors, see telescope-fzf-native README for install instructions
|
|
|
|
|
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
|
|
|
|
'nvim-telescope/telescope-fzf-native.nvim',
|
|
|
|
|
|
|
|
|
|
-- `build` is used to run some command when the plugin is installed/updated.
|
|
|
|
@ -326,19 +326,19 @@ require('lazy').setup({
|
|
|
|
|
-- it can fuzzy find! It's more than just a "file finder", it can search
|
|
|
|
|
-- many different aspects of Neovim, your workspace, LSP, and more!
|
|
|
|
|
--
|
|
|
|
|
-- The easiest way to use telescope, is to start by doing something like:
|
|
|
|
|
-- The easiest way to use Telescope, is to start by doing something like:
|
|
|
|
|
-- :Telescope help_tags
|
|
|
|
|
--
|
|
|
|
|
-- After running this command, a window will open up and you're able to
|
|
|
|
|
-- type in the prompt window. You'll see a list of help_tags options and
|
|
|
|
|
-- type in the prompt window. You'll see a list of `help_tags` options and
|
|
|
|
|
-- a corresponding preview of the help.
|
|
|
|
|
--
|
|
|
|
|
-- Two important keymaps to use while in telescope are:
|
|
|
|
|
-- Two important keymaps to use while in Telescope are:
|
|
|
|
|
-- - Insert mode: <c-/>
|
|
|
|
|
-- - Normal mode: ?
|
|
|
|
|
--
|
|
|
|
|
-- This opens a window that shows you all of the keymaps for the current
|
|
|
|
|
-- telescope picker. This is really useful to discover what Telescope can
|
|
|
|
|
-- Telescope picker. This is really useful to discover what Telescope can
|
|
|
|
|
-- do as well as how to actually do it!
|
|
|
|
|
|
|
|
|
|
-- [[ Configure Telescope ]]
|
|
|
|
@ -360,7 +360,7 @@ require('lazy').setup({
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- Enable telescope extensions, if they are installed
|
|
|
|
|
-- Enable Telescope extensions if they are installed
|
|
|
|
|
pcall(require('telescope').load_extension, 'fzf')
|
|
|
|
|
pcall(require('telescope').load_extension, 'ui-select')
|
|
|
|
|
|
|
|
|
@ -379,14 +379,14 @@ require('lazy').setup({
|
|
|
|
|
|
|
|
|
|
-- Slightly advanced example of overriding default behavior and theme
|
|
|
|
|
vim.keymap.set('n', '<leader>/', function()
|
|
|
|
|
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
|
|
|
|
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
|
|
|
|
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
|
|
|
|
winblend = 10,
|
|
|
|
|
previewer = false,
|
|
|
|
|
})
|
|
|
|
|
end, { desc = '[/] Fuzzily search in current buffer' })
|
|
|
|
|
|
|
|
|
|
-- Also possible to pass additional configuration options.
|
|
|
|
|
-- It's also possible to pass additional configuration options.
|
|
|
|
|
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
|
|
|
|
vim.keymap.set('n', '<leader>s/', function()
|
|
|
|
|
builtin.live_grep {
|
|
|
|
@ -395,7 +395,7 @@ require('lazy').setup({
|
|
|
|
|
}
|
|
|
|
|
end, { desc = '[S]earch [/] in Open Files' })
|
|
|
|
|
|
|
|
|
|
-- Shortcut for searching your neovim configuration files
|
|
|
|
|
-- Shortcut for searching your Neovim configuration files
|
|
|
|
|
vim.keymap.set('n', '<leader>sn', function()
|
|
|
|
|
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
|
|
|
|
end, { desc = '[S]earch [N]eovim files' })
|
|
|
|
@ -405,7 +405,7 @@ require('lazy').setup({
|
|
|
|
|
{ -- LSP Configuration & Plugins
|
|
|
|
|
'neovim/nvim-lspconfig',
|
|
|
|
|
dependencies = {
|
|
|
|
|
-- Automatically install LSPs and related tools to stdpath for neovim
|
|
|
|
|
-- Automatically install LSPs and related tools to stdpath for Neovim
|
|
|
|
|
'williamboman/mason.nvim',
|
|
|
|
|
'williamboman/mason-lspconfig.nvim',
|
|
|
|
|
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
|
|
|
@ -419,15 +419,15 @@ require('lazy').setup({
|
|
|
|
|
{ 'folke/neodev.nvim', opts = {} },
|
|
|
|
|
},
|
|
|
|
|
config = function()
|
|
|
|
|
-- Brief Aside: **What is LSP?**
|
|
|
|
|
-- Brief aside: **What is LSP?**
|
|
|
|
|
--
|
|
|
|
|
-- LSP is an acronym you've probably heard, but might not understand what it is.
|
|
|
|
|
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
|
|
|
|
--
|
|
|
|
|
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
|
|
|
|
|
-- and language tooling communicate in a standardized fashion.
|
|
|
|
|
--
|
|
|
|
|
-- In general, you have a "server" which is some tool built to understand a particular
|
|
|
|
|
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc). These Language Servers
|
|
|
|
|
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
|
|
|
|
|
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
|
|
|
|
|
-- processes that communicate with some "client" - in this case, Neovim!
|
|
|
|
|
--
|
|
|
|
@ -451,9 +451,8 @@ require('lazy').setup({
|
|
|
|
|
vim.api.nvim_create_autocmd('LspAttach', {
|
|
|
|
|
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
|
|
|
|
callback = function(event)
|
|
|
|
|
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
|
|
|
|
-- to define small helper and utility functions so you don't have to repeat yourself
|
|
|
|
|
-- many times.
|
|
|
|
|
-- NOTE: Remember that Lua is a real programming language, and as such it is possible
|
|
|
|
|
-- to define small helper and utility functions so you don't have to repeat yourself.
|
|
|
|
|
--
|
|
|
|
|
-- In this case, we create a function that lets us more easily define mappings specific
|
|
|
|
|
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
|
|
|
@ -482,11 +481,11 @@ require('lazy').setup({
|
|
|
|
|
-- Symbols are things like variables, functions, types, etc.
|
|
|
|
|
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
|
|
|
|
|
|
|
|
|
-- Fuzzy find all the symbols in your current workspace
|
|
|
|
|
-- Similar to document symbols, except searches over your whole project.
|
|
|
|
|
-- Fuzzy find all the symbols in your current workspace.
|
|
|
|
|
-- Similar to document symbols, except searches over your entire project.
|
|
|
|
|
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
|
|
|
|
|
|
|
|
|
-- Rename the variable under your cursor
|
|
|
|
|
-- Rename the variable under your cursor.
|
|
|
|
|
-- Most Language Servers support renaming across files, etc.
|
|
|
|
|
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
|
|
|
|
|
|
|
|
@ -495,11 +494,11 @@ require('lazy').setup({
|
|
|
|
|
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
|
|
|
|
|
-- 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.
|
|
|
|
|
-- 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')
|
|
|
|
|
|
|
|
|
|
-- The following two autocommands are used to highlight references of the
|
|
|
|
@ -523,7 +522,7 @@ require('lazy').setup({
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- LSP servers and clients are able to communicate to each other what features they support.
|
|
|
|
|
-- By default, Neovim doesn't support everything that is in the LSP Specification.
|
|
|
|
|
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
|
|
|
|
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
|
|
|
|
|
-- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
|
|
|
|
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
|
|
@ -573,14 +572,14 @@ require('lazy').setup({
|
|
|
|
|
-- other tools, you can run
|
|
|
|
|
-- :Mason
|
|
|
|
|
--
|
|
|
|
|
-- You can press `g?` for help in this menu
|
|
|
|
|
-- You can press `g?` for help in this menu.
|
|
|
|
|
require('mason').setup()
|
|
|
|
|
|
|
|
|
|
-- You can add other tools here that you want Mason to install
|
|
|
|
|
-- for you, so that they are available from within Neovim.
|
|
|
|
|
local ensure_installed = vim.tbl_keys(servers or {})
|
|
|
|
|
vim.list_extend(ensure_installed, {
|
|
|
|
|
'stylua', -- Used to format lua code
|
|
|
|
|
'stylua', -- Used to format Lua code
|
|
|
|
|
})
|
|
|
|
|
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
|
|
|
|
|
|
|
|
@ -633,9 +632,9 @@ require('lazy').setup({
|
|
|
|
|
{
|
|
|
|
|
'L3MON4D3/LuaSnip',
|
|
|
|
|
build = (function()
|
|
|
|
|
-- Build Step is needed for regex support in snippets
|
|
|
|
|
-- This step is not supported in many windows environments
|
|
|
|
|
-- Remove the below condition to re-enable on windows
|
|
|
|
|
-- Build Step is needed for regex support in snippets.
|
|
|
|
|
-- This step is not supported in many windows environments.
|
|
|
|
|
-- Remove the below condition to re-enable on windows.
|
|
|
|
|
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
@ -685,7 +684,7 @@ require('lazy').setup({
|
|
|
|
|
-- Select the [p]revious item
|
|
|
|
|
['<C-p>'] = cmp.mapping.select_prev_item(),
|
|
|
|
|
|
|
|
|
|
-- scroll the documentation window [b]ack / [f]orward
|
|
|
|
|
-- Scroll the documentation window [b]ack / [f]orward
|
|
|
|
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
|
|
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
|
|
|
|
|
|
|
@ -718,7 +717,7 @@ require('lazy').setup({
|
|
|
|
|
end
|
|
|
|
|
end, { 'i', 's' }),
|
|
|
|
|
|
|
|
|
|
-- For more advanced luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
|
|
|
|
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
|
|
|
|
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
|
|
|
|
},
|
|
|
|
|
sources = {
|
|
|
|
@ -732,18 +731,18 @@ require('lazy').setup({
|
|
|
|
|
|
|
|
|
|
{ -- You can easily change to a different colorscheme.
|
|
|
|
|
-- Change the name of the colorscheme plugin below, and then
|
|
|
|
|
-- change the command in the config to whatever the name of that colorscheme is
|
|
|
|
|
-- change the command in the config to whatever the name of that colorscheme is.
|
|
|
|
|
--
|
|
|
|
|
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`
|
|
|
|
|
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
|
|
|
|
'folke/tokyonight.nvim',
|
|
|
|
|
priority = 1000, -- make sure to load this before all the other start plugins
|
|
|
|
|
priority = 1000, -- Make sure to load this before all the other start plugins.
|
|
|
|
|
init = function()
|
|
|
|
|
-- Load the colorscheme here.
|
|
|
|
|
-- Like many other themes, this one has different styles, and you could load
|
|
|
|
|
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
|
|
|
|
vim.cmd.colorscheme 'tokyonight-night'
|
|
|
|
|
|
|
|
|
|
-- You can configure highlights by doing something like
|
|
|
|
|
-- You can configure highlights by doing something like:
|
|
|
|
|
vim.cmd.hi 'Comment gui=none'
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
@ -788,7 +787,6 @@ require('lazy').setup({
|
|
|
|
|
-- Check out: https://github.com/echasnovski/mini.nvim
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ -- Highlight, edit, and navigate code
|
|
|
|
|
'nvim-treesitter/nvim-treesitter',
|
|
|
|
|
build = ':TSUpdate',
|
|
|
|
@ -822,11 +820,11 @@ require('lazy').setup({
|
|
|
|
|
|
|
|
|
|
-- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
|
|
|
|
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
|
|
|
|
-- put them in the right spots if you want.
|
|
|
|
|
-- place them in the correct locations.
|
|
|
|
|
|
|
|
|
|
-- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for kickstart
|
|
|
|
|
-- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart
|
|
|
|
|
--
|
|
|
|
|
-- Here are some example plugins that I've included in the kickstart repository.
|
|
|
|
|
-- Here are some example plugins that I've included in the Kickstart repository.
|
|
|
|
|
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
|
|
|
|
|
--
|
|
|
|
|
-- require 'kickstart.plugins.debug',
|
|
|
|
@ -841,8 +839,8 @@ require('lazy').setup({
|
|
|
|
|
-- { import = 'custom.plugins' },
|
|
|
|
|
}, {
|
|
|
|
|
ui = {
|
|
|
|
|
-- If you have a Nerd Font, set icons to an empty table which will use the
|
|
|
|
|
-- default lazy.nvim defined Nerd Font icons otherwise define a unicode icons table
|
|
|
|
|
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
|
|
|
|
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
|
|
|
|
|
icons = vim.g.have_nerd_font and {} or {
|
|
|
|
|
cmd = '⌘',
|
|
|
|
|
config = '🛠',
|
|
|
|
|