|
|
|
@ -1,44 +1,3 @@
|
|
|
|
|
--[[
|
|
|
|
|
|
|
|
|
|
=====================================================================
|
|
|
|
|
==================== 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, and understand
|
|
|
|
|
what your configuration is doing.
|
|
|
|
|
|
|
|
|
|
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`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 = ' '
|
|
|
|
|
|
|
|
|
@ -66,10 +25,6 @@ vim.opt.rtp:prepend(lazypath)
|
|
|
|
|
require('lazy').setup({
|
|
|
|
|
-- NOTE: First, some plugins that don't require any configuration
|
|
|
|
|
|
|
|
|
|
-- Git related plugins
|
|
|
|
|
'tpope/vim-fugitive',
|
|
|
|
|
'tpope/vim-rhubarb',
|
|
|
|
|
|
|
|
|
|
-- Detect tabstop and shiftwidth automatically
|
|
|
|
|
'tpope/vim-sleuth',
|
|
|
|
|
|
|
|
|
@ -172,20 +127,6 @@ require('lazy').setup({
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
|
|
|
|
-- These are some example plugins that I've included in the kickstart repository.
|
|
|
|
|
-- Uncomment any of the lines below to enable them.
|
|
|
|
|
-- require 'kickstart.plugins.autoformat',
|
|
|
|
|
-- require 'kickstart.plugins.debug',
|
|
|
|
|
|
|
|
|
|
-- NOTE: The import below automatically adds 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
|
|
|
|
|
-- up-to-date with whatever is in the kickstart repo.
|
|
|
|
|
--
|
|
|
|
|
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
|
|
|
|
--
|
|
|
|
|
-- An additional note is that if you only copied in the `init.lua`, you can just comment this line
|
|
|
|
|
-- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`.
|
|
|
|
|
{ import = 'custom.plugins' },
|
|
|
|
|
}, {})
|
|
|
|
|
|
|
|
|
@ -236,21 +177,6 @@ vim.o.termguicolors = true
|
|
|
|
|
-- See `:help vim.keymap.set()`
|
|
|
|
|
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
|
|
|
|
|
|
|
|
|
-- Remap for dealing with word wrap
|
|
|
|
|
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
|
|
|
|
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
|
|
|
|
|
|
|
|
|
-- [[ Highlight on yank ]]
|
|
|
|
|
-- See `:help vim.highlight.on_yank()`
|
|
|
|
|
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
|
|
|
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
|
|
|
|
callback = function()
|
|
|
|
|
vim.highlight.on_yank()
|
|
|
|
|
end,
|
|
|
|
|
group = highlight_group,
|
|
|
|
|
pattern = '*',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- [[ Configure Telescope ]]
|
|
|
|
|
-- See `:help telescope` and `:help telescope.setup()`
|
|
|
|
|
require('telescope').setup {
|
|
|
|
@ -259,6 +185,8 @@ require('telescope').setup {
|
|
|
|
|
i = {
|
|
|
|
|
['<C-u>'] = false,
|
|
|
|
|
['<C-d>'] = false,
|
|
|
|
|
['<C-j>'] = require('telescope.actions').move_selection_next,
|
|
|
|
|
['<C-k>'] = require('telescope.actions').move_selection_previous,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -294,7 +222,7 @@ require('nvim-treesitter.configs').setup {
|
|
|
|
|
auto_install = false,
|
|
|
|
|
|
|
|
|
|
highlight = { enable = true },
|
|
|
|
|
indent = { enable = true, disable = { 'python' } },
|
|
|
|
|
indent = { enable = true, disable = {} },
|
|
|
|
|
incremental_selection = {
|
|
|
|
|
enable = true,
|
|
|
|
|
keymaps = {
|
|
|
|
@ -304,50 +232,6 @@ require('nvim-treesitter.configs').setup {
|
|
|
|
|
node_decremental = '<M-space>',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
textobjects = {
|
|
|
|
|
select = {
|
|
|
|
|
enable = true,
|
|
|
|
|
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
|
|
|
|
keymaps = {
|
|
|
|
|
-- You can use the capture groups defined in textobjects.scm
|
|
|
|
|
['aa'] = '@parameter.outer',
|
|
|
|
|
['ia'] = '@parameter.inner',
|
|
|
|
|
['af'] = '@function.outer',
|
|
|
|
|
['if'] = '@function.inner',
|
|
|
|
|
['ac'] = '@class.outer',
|
|
|
|
|
['ic'] = '@class.inner',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
move = {
|
|
|
|
|
enable = true,
|
|
|
|
|
set_jumps = true, -- whether to set jumps in the jumplist
|
|
|
|
|
goto_next_start = {
|
|
|
|
|
[']m'] = '@function.outer',
|
|
|
|
|
[']]'] = '@class.outer',
|
|
|
|
|
},
|
|
|
|
|
goto_next_end = {
|
|
|
|
|
[']M'] = '@function.outer',
|
|
|
|
|
[']['] = '@class.outer',
|
|
|
|
|
},
|
|
|
|
|
goto_previous_start = {
|
|
|
|
|
['[m'] = '@function.outer',
|
|
|
|
|
['[['] = '@class.outer',
|
|
|
|
|
},
|
|
|
|
|
goto_previous_end = {
|
|
|
|
|
['[M'] = '@function.outer',
|
|
|
|
|
['[]'] = '@class.outer',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
swap = {
|
|
|
|
|
enable = true,
|
|
|
|
|
swap_next = {
|
|
|
|
|
['<leader>a'] = '@parameter.inner',
|
|
|
|
|
},
|
|
|
|
|
swap_previous = {
|
|
|
|
|
['<leader>A'] = '@parameter.inner',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- Diagnostic keymaps
|
|
|
|
@ -359,12 +243,6 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagn
|
|
|
|
|
-- LSP settings.
|
|
|
|
|
-- This function gets run when an LSP connects to a particular buffer.
|
|
|
|
|
local on_attach = function(_, bufnr)
|
|
|
|
|
-- 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.
|
|
|
|
|
--
|
|
|
|
|
-- 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.
|
|
|
|
|
local nmap = function(keys, func, desc)
|
|
|
|
|
if desc then
|
|
|
|
|
desc = 'LSP: ' .. desc
|
|
|
|
@ -402,15 +280,14 @@ local on_attach = function(_, bufnr)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Enable the following language servers
|
|
|
|
|
-- 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
|
|
|
|
|
-- the `settings` field of the server config. You must look up that documentation yourself.
|
|
|
|
|
local servers = {
|
|
|
|
|
-- clangd = {},
|
|
|
|
|
clangd = {},
|
|
|
|
|
-- gopls = {},
|
|
|
|
|
-- pyright = {},
|
|
|
|
|
-- rust_analyzer = {},
|
|
|
|
|
rust_analyzer = {},
|
|
|
|
|
-- tsserver = {},
|
|
|
|
|
|
|
|
|
|
lua_ls = {
|
|
|
|
|