|
|
|
@ -81,12 +81,53 @@ If you experience any errors while trying to install kickstart, run `:checkhealt
|
|
|
|
|
I hope you enjoy your Neovim journey,
|
|
|
|
|
- TJ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Set <space> as the leader key
|
|
|
|
|
-- See `:help mapleader`
|
|
|
|
|
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
|
|
|
|
|
|
|
|
|
-- Set <space> as the leader key
|
|
|
|
|
-- See `:help mapleader`
|
|
|
|
|
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
|
|
|
|
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 loaded (otherwise wrong leader will be used)
|
|
|
|
|
|
|
|
|
|
vim.o.autoread = true
|
|
|
|
|
vim.api.nvim_create_autocmd('BufEnter', {
|
|
|
|
|
group = vim.api.nvim_create_augroup('lazyvim_auto_reload', { clear = true }),
|
|
|
|
|
pattern = '*',
|
|
|
|
|
command = 'checktime',
|
|
|
|
|
})
|
|
|
|
|
-- Ensure Neovim recognizes .tf and .tfvars files as terraform
|
|
|
|
|
-- vim.filetype.add {
|
|
|
|
|
-- extension = {
|
|
|
|
|
-- tf = 'terraform',
|
|
|
|
|
-- tfvars = 'terraform', -- Include .tfvars files
|
|
|
|
|
-- },
|
|
|
|
|
-- }
|
|
|
|
|
-- Refresh Neovim
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<leader>rr', ':lua os.exit(1)<CR>', { noremap = true, silent = true })
|
|
|
|
|
-- Add custom key bindings
|
|
|
|
|
vim.api.nvim_set_keymap('i', '<C-j>', '<Right>', { noremap = true })
|
|
|
|
|
vim.api.nvim_set_keymap('i', '<C-g>', '<Left>', { noremap = true })
|
|
|
|
|
vim.api.nvim_set_keymap('i', '<C-]>', '<C-o>$', { noremap = true })
|
|
|
|
|
vim.api.nvim_set_keymap('i', '<C-f>', '<ESC>^', { noremap = true })
|
|
|
|
|
vim.api.nvim_set_keymap('i', '<C-M-p>', '<ESC>opi', { noremap = true })
|
|
|
|
|
vim.api.nvim_set_keymap('i', '<C-M-P>', '<ESC>oPi', { noremap = true })
|
|
|
|
|
-- Block cursor
|
|
|
|
|
vim.opt.guicursor =
|
|
|
|
|
'n-v-c:block,i-ci-ve:block,r-cr:hor20,o:hor50,i-ci-ve:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175'
|
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
if vim.fn.has 'termguicolors' == 1 then
|
|
|
|
|
vim.opt.termguicolors = true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
vim.g.mapleader = ' '
|
|
|
|
|
vim.g.maplocalleader = ' '
|
|
|
|
|
|
|
|
|
@ -162,9 +203,6 @@ vim.opt.hlsearch = true
|
|
|
|
|
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
|
|
|
|
|
|
|
|
|
-- 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' })
|
|
|
|
|
|
|
|
|
|
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
|
|
|
@ -207,9 +245,12 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
|
|
|
|
-- [[ Install `lazy.nvim` plugin manager ]]
|
|
|
|
|
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
|
|
|
|
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'
|
|
|
|
|
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
|
|
|
|
|
error('Error cloning lazy.nvim:\n' .. out)
|
|
|
|
|
end
|
|
|
|
|
end ---@diagnostic disable-next-line: undefined-field
|
|
|
|
|
vim.opt.rtp:prepend(lazypath)
|
|
|
|
|
|
|
|
|
@ -233,13 +274,6 @@ require('lazy').setup({
|
|
|
|
|
-- keys can be used to configure plugin behavior/loading/etc.
|
|
|
|
|
--
|
|
|
|
|
-- 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
|
|
|
|
|
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
|
|
|
|
|
-- require('gitsigns').setup({ ... })
|
|
|
|
@ -280,19 +314,15 @@ require('lazy').setup({
|
|
|
|
|
require('which-key').setup()
|
|
|
|
|
|
|
|
|
|
-- Document existing key chains
|
|
|
|
|
require('which-key').register {
|
|
|
|
|
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
|
|
|
|
|
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
|
|
|
|
|
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
|
|
|
|
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
|
|
|
|
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
|
|
|
|
['<leader>t'] = { name = '[T]oggle', _ = 'which_key_ignore' },
|
|
|
|
|
['<leader>h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' },
|
|
|
|
|
require('which-key').add {
|
|
|
|
|
{ '<leader>c', group = '[C]ode' },
|
|
|
|
|
{ '<leader>d', group = '[D]ocument' },
|
|
|
|
|
{ '<leader>r', group = '[R]ename' },
|
|
|
|
|
{ '<leader>s', group = '[S]earch' },
|
|
|
|
|
{ '<leader>w', group = '[W]orkspace' },
|
|
|
|
|
{ '<leader>t', group = '[T]oggle' },
|
|
|
|
|
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
|
|
|
|
}
|
|
|
|
|
-- visual mode
|
|
|
|
|
require('which-key').register({
|
|
|
|
|
['<leader>h'] = { 'Git [H]unk' },
|
|
|
|
|
}, { mode = 'v' })
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -413,20 +443,44 @@ require('lazy').setup({
|
|
|
|
|
dependencies = {
|
|
|
|
|
-- Automatically install LSPs and related tools to stdpath for Neovim
|
|
|
|
|
{ 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants
|
|
|
|
|
'williamboman/mason-lspconfig.nvim',
|
|
|
|
|
{ 'williamboman/mason-lspconfig.nvim' },
|
|
|
|
|
|
|
|
|
|
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
|
|
|
|
|
|
|
|
|
-- Useful status updates for LSP.
|
|
|
|
|
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
|
|
|
|
{ 'j-hui/fidget.nvim', opts = {} },
|
|
|
|
|
|
|
|
|
|
-- `neodev` configures Lua LSP for your Neovim config, runtime and plugins
|
|
|
|
|
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
|
|
|
|
-- used for completion, annotations and signatures of Neovim apis
|
|
|
|
|
{ 'folke/neodev.nvim', opts = {} },
|
|
|
|
|
{
|
|
|
|
|
'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 },
|
|
|
|
|
},
|
|
|
|
|
config = function()
|
|
|
|
|
-- Brief aside: **What is LSP?**
|
|
|
|
|
--
|
|
|
|
|
local lspconfig = require 'lspconfig'
|
|
|
|
|
local util = require 'lspconfig/util'
|
|
|
|
|
|
|
|
|
|
-- Mason setup to ensure terraform-ls is installed
|
|
|
|
|
require('mason-lspconfig').setup {
|
|
|
|
|
ensure_installed = { 'terraformls', 'tflint' },
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
require('lspconfig').terraformls.setup {}
|
|
|
|
|
vim.api.nvim_create_autocmd({ 'BufWritePre' }, {
|
|
|
|
|
pattern = { '*.tf', '*.tfvars' },
|
|
|
|
|
callback = function()
|
|
|
|
|
vim.lsp.buf.format()
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
-- 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
|
|
|
|
@ -499,10 +553,6 @@ require('lazy').setup({
|
|
|
|
|
-- or a suggestion from your LSP for this to activate.
|
|
|
|
|
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.
|
|
|
|
|
-- For example, in C this would take you to the header.
|
|
|
|
|
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
|
|
|
@ -513,7 +563,7 @@ require('lazy').setup({
|
|
|
|
|
--
|
|
|
|
|
-- 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)
|
|
|
|
|
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 })
|
|
|
|
|
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
|
|
|
|
buffer = event.buf,
|
|
|
|
@ -536,13 +586,13 @@ require('lazy').setup({
|
|
|
|
|
})
|
|
|
|
|
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
|
|
|
|
|
--
|
|
|
|
|
-- 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()
|
|
|
|
|
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
|
|
|
|
|
end,
|
|
|
|
@ -565,17 +615,18 @@ require('lazy').setup({
|
|
|
|
|
-- - settings (table): Override the default settings passed when initializing the server.
|
|
|
|
|
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
|
|
|
|
local servers = {
|
|
|
|
|
-- terraformls = {},
|
|
|
|
|
-- clangd = {},
|
|
|
|
|
-- gopls = {},
|
|
|
|
|
gopls = {},
|
|
|
|
|
-- pyright = {},
|
|
|
|
|
-- rust_analyzer = {},
|
|
|
|
|
rust_analyzer = {},
|
|
|
|
|
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
|
|
|
|
--
|
|
|
|
|
-- Some languages (like typescript) have entire language plugins that can be useful:
|
|
|
|
|
-- https://github.com/pmizio/typescript-tools.nvim
|
|
|
|
|
--
|
|
|
|
|
-- But for many setups, the LSP (`tsserver`) will work just fine
|
|
|
|
|
-- tsserver = {},
|
|
|
|
|
tsserver = {},
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
lua_ls = {
|
|
|
|
@ -627,7 +678,8 @@ require('lazy').setup({
|
|
|
|
|
|
|
|
|
|
{ -- Autoformat
|
|
|
|
|
'stevearc/conform.nvim',
|
|
|
|
|
lazy = false,
|
|
|
|
|
event = { 'BufWritePre' },
|
|
|
|
|
cmd = { 'ConformInfo' },
|
|
|
|
|
keys = {
|
|
|
|
|
{
|
|
|
|
|
'<leader>f',
|
|
|
|
@ -657,7 +709,7 @@ require('lazy').setup({
|
|
|
|
|
--
|
|
|
|
|
-- You can use a sub-list to tell conform to run *until* a formatter
|
|
|
|
|
-- is found.
|
|
|
|
|
-- javascript = { { "prettierd", "prettier" } },
|
|
|
|
|
javascript = { { 'prettierd', 'prettier' } },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -765,6 +817,11 @@ require('lazy').setup({
|
|
|
|
|
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
|
|
|
|
},
|
|
|
|
|
sources = {
|
|
|
|
|
{
|
|
|
|
|
name = 'lazydev',
|
|
|
|
|
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
|
|
|
|
group_index = 0,
|
|
|
|
|
},
|
|
|
|
|
{ name = 'nvim_lsp' },
|
|
|
|
|
{ name = 'luasnip' },
|
|
|
|
|
{ name = 'path' },
|
|
|
|
@ -801,7 +858,7 @@ require('lazy').setup({
|
|
|
|
|
--
|
|
|
|
|
-- Examples:
|
|
|
|
|
-- - 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
|
|
|
|
|
require('mini.ai').setup { n_lines = 500 }
|
|
|
|
|
|
|
|
|
@ -835,7 +892,7 @@ require('lazy').setup({
|
|
|
|
|
'nvim-treesitter/nvim-treesitter',
|
|
|
|
|
build = ':TSUpdate',
|
|
|
|
|
opts = {
|
|
|
|
|
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
|
|
|
|
|
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
|
|
|
|
|
-- Autoinstall languages that are not installed
|
|
|
|
|
auto_install = true,
|
|
|
|
|
highlight = {
|
|
|
|
@ -873,19 +930,19 @@ require('lazy').setup({
|
|
|
|
|
-- 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',
|
|
|
|
|
-- require 'kickstart.plugins.indent_line',
|
|
|
|
|
-- require 'kickstart.plugins.lint',
|
|
|
|
|
-- require 'kickstart.plugins.autopairs',
|
|
|
|
|
require 'kickstart.plugins.debug',
|
|
|
|
|
require 'kickstart.plugins.indent_line',
|
|
|
|
|
require 'kickstart.plugins.lint',
|
|
|
|
|
require 'kickstart.plugins.autopairs',
|
|
|
|
|
-- require 'kickstart.plugins.neo-tree',
|
|
|
|
|
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
|
|
|
|
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
|
|
|
|
|
|
|
|
|
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
|
|
|
|
-- This is the easiest way to modularize your config.
|
|
|
|
|
--
|
|
|
|
|
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
|
|
|
|
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
|
|
|
|
|
-- { import = 'custom.plugins' },
|
|
|
|
|
{ import = 'custom.plugins' },
|
|
|
|
|
}, {
|
|
|
|
|
ui = {
|
|
|
|
|
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
|
|
|
|