|
|
|
@ -1,51 +1,18 @@
|
|
|
|
|
--[[
|
|
|
|
|
-- DISABLED FOR NOW
|
|
|
|
|
-- @diagnostic disable: missing-fields -- disables annoying warnings
|
|
|
|
|
-- Lua guides:
|
|
|
|
|
-- - https://learnxinyminutes.com/docs/lua/
|
|
|
|
|
-- - `:help lua-guide`
|
|
|
|
|
-- - https://neovim.io/doc/user/lua-guide.html
|
|
|
|
|
|
|
|
|
|
=====================================================================
|
|
|
|
|
==================== 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 package manager
|
|
|
|
|
-- https://github.com/folke/lazy.nvim
|
|
|
|
|
-- `:help lazy.nvim.txt` for more info
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vim.g.have_nerd_font = true
|
|
|
|
|
|
|
|
|
|
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
|
|
|
|
if not vim.loop.fs_stat(lazypath) then
|
|
|
|
|
vim.fn.system {
|
|
|
|
@ -56,8 +23,8 @@ if not vim.loop.fs_stat(lazypath) then
|
|
|
|
|
'--branch=stable', -- latest stable release
|
|
|
|
|
lazypath,
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
vim.opt.rtp:prepend(lazypath)
|
|
|
|
|
end -- ---@diagnostic disable-next-line: undefined-field
|
|
|
|
|
vim.opt.runtimepath:prepend(lazypath)
|
|
|
|
|
|
|
|
|
|
-- NOTE: Here is where you install your plugins.
|
|
|
|
|
-- You can configure plugins using the `config` key.
|
|
|
|
@ -65,8 +32,6 @@ vim.opt.rtp:prepend(lazypath)
|
|
|
|
|
-- You can also configure plugins after the setup call,
|
|
|
|
|
-- as they will be available in your neovim runtime.
|
|
|
|
|
require('lazy').setup({
|
|
|
|
|
-- NOTE: First, some plugins that don't require any configuration
|
|
|
|
|
|
|
|
|
|
-- Git related plugins
|
|
|
|
|
'tpope/vim-fugitive',
|
|
|
|
|
'tpope/vim-rhubarb',
|
|
|
|
@ -74,8 +39,6 @@ require('lazy').setup({
|
|
|
|
|
-- Detect tabstop and shiftwidth automatically
|
|
|
|
|
'tpope/vim-sleuth',
|
|
|
|
|
|
|
|
|
|
-- NOTE: This is where your plugins related to LSP can be installed.
|
|
|
|
|
-- The configuration is done below. Search for lspconfig to find it below.
|
|
|
|
|
{
|
|
|
|
|
-- LSP Configuration & Plugins
|
|
|
|
|
'neovim/nvim-lspconfig',
|
|
|
|
@ -86,7 +49,7 @@ require('lazy').setup({
|
|
|
|
|
|
|
|
|
|
-- Useful status updates for LSP
|
|
|
|
|
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
|
|
|
|
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
|
|
|
|
|
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
|
|
|
|
|
|
|
|
|
|
-- Additional lua configuration, makes nvim stuff amazing!
|
|
|
|
|
'folke/neodev.nvim',
|
|
|
|
@ -110,7 +73,7 @@ require('lazy').setup({
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- Useful plugin to show you pending keybinds.
|
|
|
|
|
{ 'folke/which-key.nvim', opts = {} },
|
|
|
|
|
{ 'folke/which-key.nvim', opts = {} },
|
|
|
|
|
{
|
|
|
|
|
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
|
|
|
|
'lewis6991/gitsigns.nvim',
|
|
|
|
@ -124,33 +87,25 @@ require('lazy').setup({
|
|
|
|
|
changedelete = { text = '~' },
|
|
|
|
|
},
|
|
|
|
|
on_attach = function(bufnr)
|
|
|
|
|
vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' })
|
|
|
|
|
vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk,
|
|
|
|
|
{ buffer = bufnr, desc = 'Preview git hunk' })
|
|
|
|
|
|
|
|
|
|
-- don't override the built-in and fugitive keymaps
|
|
|
|
|
local gs = package.loaded.gitsigns
|
|
|
|
|
vim.keymap.set({'n', 'v'}, ']c', function()
|
|
|
|
|
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()
|
|
|
|
|
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, { expr = true, buffer = bufnr, desc = "Jump to previous hunk" })
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
-- Theme inspired by Atom
|
|
|
|
|
'navarasu/onedark.nvim',
|
|
|
|
|
priority = 1000,
|
|
|
|
|
config = function()
|
|
|
|
|
vim.cmd.colorscheme 'onedark'
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
-- Set lualine as statusline
|
|
|
|
|
'nvim-lualine/lualine.nvim',
|
|
|
|
@ -158,7 +113,7 @@ require('lazy').setup({
|
|
|
|
|
opts = {
|
|
|
|
|
options = {
|
|
|
|
|
icons_enabled = false,
|
|
|
|
|
theme = 'onedark',
|
|
|
|
|
theme = 'catppuccin',
|
|
|
|
|
component_separators = '|',
|
|
|
|
|
section_separators = '',
|
|
|
|
|
},
|
|
|
|
@ -212,7 +167,7 @@ require('lazy').setup({
|
|
|
|
|
-- 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.autoformat',
|
|
|
|
|
-- require 'kickstart.plugins.debug',
|
|
|
|
|
|
|
|
|
|
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
|
|
|
@ -221,22 +176,30 @@ require('lazy').setup({
|
|
|
|
|
-- 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
|
|
|
|
|
-- { import = 'custom.plugins' },
|
|
|
|
|
{ import = 'custom.plugins' },
|
|
|
|
|
}, {})
|
|
|
|
|
|
|
|
|
|
-- [[ Setting options ]]
|
|
|
|
|
-- See `:help vim.o`
|
|
|
|
|
-- NOTE: You can change these options as you wish!
|
|
|
|
|
-- See :help option-list
|
|
|
|
|
|
|
|
|
|
-- Set highlight on search
|
|
|
|
|
vim.o.hlsearch = false
|
|
|
|
|
|
|
|
|
|
vim.g.have_nerd_font = true
|
|
|
|
|
|
|
|
|
|
-- colorcolumn
|
|
|
|
|
vim.o.colorcolumn = "80"
|
|
|
|
|
|
|
|
|
|
-- Make line numbers default
|
|
|
|
|
vim.wo.number = true
|
|
|
|
|
vim.wo.relativenumber = true
|
|
|
|
|
|
|
|
|
|
-- Enable mouse mode
|
|
|
|
|
vim.o.mouse = 'a'
|
|
|
|
|
|
|
|
|
|
vim.opt.showmode = false
|
|
|
|
|
-- Sync clipboard between OS and Neovim.
|
|
|
|
|
-- Remove this option if you want your OS clipboard to remain independent.
|
|
|
|
|
-- See `:help 'clipboard'`
|
|
|
|
@ -274,6 +237,15 @@ 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 })
|
|
|
|
|
vim.keymap.set('n', 'gk', "v:count == 0 ? 'k' : 'k'", { expr = true, silent = true })
|
|
|
|
|
vim.keymap.set('n', 'gj', "v:count == 0 ? 'j' : 'j'", { expr = true, silent = true })
|
|
|
|
|
|
|
|
|
|
-- wrap between words
|
|
|
|
|
vim.o.linebreak = true
|
|
|
|
|
vim.o.expandtab = true
|
|
|
|
|
vim.o.shiftwidth = 4
|
|
|
|
|
vim.o.tabstop = 8
|
|
|
|
|
vim.o.softtabstop = 4
|
|
|
|
|
|
|
|
|
|
-- [[ Highlight on yank ]]
|
|
|
|
|
-- See `:help vim.highlight.on_yank()`
|
|
|
|
@ -314,18 +286,34 @@ vim.keymap.set('n', '<leader>/', function()
|
|
|
|
|
end, { desc = '[/] Fuzzily search in current buffer' })
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
|
|
|
|
|
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
|
|
|
|
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
|
|
|
|
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>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' })
|
|
|
|
|
vim.keymap.set('n', '<leader>tf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
|
|
|
|
vim.keymap.set('n', '<leader>th', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
|
|
|
|
vim.keymap.set('n', '<leader>tw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
|
|
|
|
vim.keymap.set('n', '<leader>tg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
|
|
|
|
vim.keymap.set('n', '<leader>td', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
|
|
|
|
vim.keymap.set('n', '<leader>tr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
|
|
|
|
|
|
|
|
|
|
-- [[ Configure Treesitter ]]
|
|
|
|
|
-- See `:help nvim-treesitter`
|
|
|
|
|
require('nvim-treesitter.configs').setup {
|
|
|
|
|
-- Add languages to be installed here that you want installed for treesitter
|
|
|
|
|
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' },
|
|
|
|
|
ensure_installed = {
|
|
|
|
|
'c',
|
|
|
|
|
'cpp',
|
|
|
|
|
'go',
|
|
|
|
|
'lua',
|
|
|
|
|
'python',
|
|
|
|
|
'rust',
|
|
|
|
|
'tsx',
|
|
|
|
|
'javascript',
|
|
|
|
|
'typescript',
|
|
|
|
|
'vimdoc',
|
|
|
|
|
'vim',
|
|
|
|
|
'latex',
|
|
|
|
|
'haskell',
|
|
|
|
|
'norg',
|
|
|
|
|
'markdown'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
|
|
|
|
auto_install = false,
|
|
|
|
@ -351,8 +339,9 @@ require('nvim-treesitter.configs').setup {
|
|
|
|
|
['ia'] = '@parameter.inner',
|
|
|
|
|
['af'] = '@function.outer',
|
|
|
|
|
['if'] = '@function.inner',
|
|
|
|
|
['ac'] = '@class.outer',
|
|
|
|
|
['ic'] = '@class.inner',
|
|
|
|
|
-- FUCKS UP VIMTEX COMMANDS!
|
|
|
|
|
-- ['ac'] = '@class.outer',
|
|
|
|
|
-- ['ic'] = '@class.inner',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
move = {
|
|
|
|
@ -460,6 +449,11 @@ local servers = {
|
|
|
|
|
telemetry = { enable = false },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
-- ltex = {
|
|
|
|
|
-- ["dictionary"] = {
|
|
|
|
|
-- ["en-US"] = { "Surlykke" }
|
|
|
|
|
-- }
|
|
|
|
|
-- }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- Setup neovim lua configuration
|
|
|
|
@ -491,8 +485,17 @@ mason_lspconfig.setup_handlers {
|
|
|
|
|
-- See `:help cmp`
|
|
|
|
|
local cmp = require 'cmp'
|
|
|
|
|
local luasnip = require 'luasnip'
|
|
|
|
|
require('luasnip.loaders.from_vscode').lazy_load()
|
|
|
|
|
luasnip.config.setup {}
|
|
|
|
|
require('luasnip.loaders.from_vscode').lazy_load({
|
|
|
|
|
exclude = { "tex" }
|
|
|
|
|
})
|
|
|
|
|
require('luasnip.loaders.from_snipmate').lazy_load({
|
|
|
|
|
exclude = { "tex" }
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
luasnip.config.setup {
|
|
|
|
|
enable_autosnippets = true,
|
|
|
|
|
store_selection_keys = "<Tab>",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cmp.setup {
|
|
|
|
|
snippet = {
|
|
|
|
@ -503,16 +506,20 @@ cmp.setup {
|
|
|
|
|
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-u>'] = cmp.mapping.scroll_docs(-4),
|
|
|
|
|
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
|
|
|
|
['<C-Space>'] = cmp.mapping.complete {},
|
|
|
|
|
['<CR>'] = cmp.mapping.confirm {
|
|
|
|
|
behavior = cmp.ConfirmBehavior.Replace,
|
|
|
|
|
select = true,
|
|
|
|
|
},
|
|
|
|
|
-- ['<CR>'] = cmp.mapping.confirm {
|
|
|
|
|
-- behavior = cmp.ConfirmBehavior.Replace,
|
|
|
|
|
-- select = true,
|
|
|
|
|
-- },
|
|
|
|
|
['<Tab>'] = cmp.mapping(function(fallback)
|
|
|
|
|
if cmp.visible() then
|
|
|
|
|
cmp.select_next_item()
|
|
|
|
|
cmp.confirm {
|
|
|
|
|
behavior = cmp.ConfirmBehavior.Replace,
|
|
|
|
|
select = true,
|
|
|
|
|
}
|
|
|
|
|
-- cmp.select_next_item()
|
|
|
|
|
elseif luasnip.expand_or_locally_jumpable() then
|
|
|
|
|
luasnip.expand_or_jump()
|
|
|
|
|
else
|
|
|
|
@ -520,9 +527,9 @@ cmp.setup {
|
|
|
|
|
end
|
|
|
|
|
end, { 'i', 's' }),
|
|
|
|
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
|
|
|
|
if cmp.visible() then
|
|
|
|
|
cmp.select_prev_item()
|
|
|
|
|
elseif luasnip.locally_jumpable(-1) then
|
|
|
|
|
-- if cmp.visible() then
|
|
|
|
|
-- cmp.select_prev_item()
|
|
|
|
|
if luasnip.locally_jumpable(-1) then
|
|
|
|
|
luasnip.jump(-1)
|
|
|
|
|
else
|
|
|
|
|
fallback()
|
|
|
|
@ -532,6 +539,7 @@ cmp.setup {
|
|
|
|
|
sources = {
|
|
|
|
|
{ name = 'nvim_lsp' },
|
|
|
|
|
{ name = 'luasnip' },
|
|
|
|
|
{ name = "neorg" }
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|