118 lines
3.3 KiB
Lua
118 lines
3.3 KiB
Lua
--[[
|
|
|
|
=====================================================================
|
|
==================== 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 lazy plugin manager
|
|
require('lazy-bootstrap')
|
|
|
|
-- Setup lazy plugin manager - configure plugins
|
|
require('lazy-plugins')
|
|
|
|
-- Set options
|
|
require('options')
|
|
|
|
-- Configure keymaps
|
|
require('keymaps')
|
|
|
|
-- Configure Telescope (fuzzy finder)
|
|
require('telescope-setup')
|
|
|
|
-- Configure Treesitter (syntax parser for highlighting)
|
|
require('treesitter-setup')
|
|
|
|
-- Configure LSP (Language Server Protocol)
|
|
require('lsp-setup')
|
|
|
|
-- [[ 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 = {
|
|
expand = function(args)
|
|
luasnip.lsp_expand(args.body)
|
|
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 {},
|
|
['<CR>'] = cmp.mapping.confirm {
|
|
behavior = cmp.ConfirmBehavior.Replace,
|
|
select = true,
|
|
},
|
|
['<Tab>'] = cmp.mapping(function(fallback)
|
|
if cmp.visible() then
|
|
cmp.select_next_item()
|
|
elseif luasnip.expand_or_locally_jumpable() then
|
|
luasnip.expand_or_jump()
|
|
else
|
|
fallback()
|
|
end
|
|
end, { 'i', 's' }),
|
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
|
if cmp.visible() then
|
|
cmp.select_prev_item()
|
|
elseif luasnip.locally_jumpable(-1) then
|
|
luasnip.jump(-1)
|
|
else
|
|
fallback()
|
|
end
|
|
end, { 'i', 's' }),
|
|
},
|
|
sources = {
|
|
{ name = 'nvim_lsp' },
|
|
{ name = 'luasnip' },
|
|
},
|
|
}
|
|
|
|
-- The line beneath this is called `modeline`. See `:help modeline`
|
|
-- vim: ts=2 sts=2 sw=2 et
|