|
|
|
@ -154,6 +154,8 @@ vim.opt.cursorline = true
|
|
|
|
|
-- Minimal number of screen lines to keep above and below the cursor.
|
|
|
|
|
vim.opt.scrolloff = 10
|
|
|
|
|
|
|
|
|
|
vim.opt.smartindent = true
|
|
|
|
|
|
|
|
|
|
-- [[ Basic Keymaps ]]
|
|
|
|
|
-- See `:help vim.keymap.set()`
|
|
|
|
|
|
|
|
|
@ -162,9 +164,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
|
|
|
|
@ -190,7 +189,10 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
|
|
|
|
|
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
|
|
|
|
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
|
|
|
|
|
|
|
|
|
-- [[ Basic Autocommands ]]
|
|
|
|
|
-- vim.o.winbar = '%=%m %f'
|
|
|
|
|
vim.o.winbar = '%f'
|
|
|
|
|
|
|
|
|
|
-- [[ Basic Autocommands ]]:
|
|
|
|
|
-- See `:help lua-guide-autocommands`
|
|
|
|
|
|
|
|
|
|
-- Highlight when yanking (copying) text
|
|
|
|
@ -207,9 +209,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)
|
|
|
|
|
|
|
|
|
@ -234,11 +239,6 @@ require('lazy').setup({
|
|
|
|
|
--
|
|
|
|
|
-- 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:
|
|
|
|
@ -255,6 +255,7 @@ require('lazy').setup({
|
|
|
|
|
topdelete = { text = '‾' },
|
|
|
|
|
changedelete = { text = '~' },
|
|
|
|
|
},
|
|
|
|
|
current_line_blame = true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -280,19 +281,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,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -353,11 +350,14 @@ require('lazy').setup({
|
|
|
|
|
-- You can put your default mappings / updates / etc. in here
|
|
|
|
|
-- All the info you're looking for is in `:help telescope.setup()`
|
|
|
|
|
--
|
|
|
|
|
-- defaults = {
|
|
|
|
|
-- mappings = {
|
|
|
|
|
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
|
|
|
|
|
-- },
|
|
|
|
|
-- },
|
|
|
|
|
defaults = {
|
|
|
|
|
mappings = {
|
|
|
|
|
i = { ['<c-enter>'] = 'to_fuzzy_refine' },
|
|
|
|
|
},
|
|
|
|
|
file_ignore_patterns = {
|
|
|
|
|
'build/*',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
-- pickers = {}
|
|
|
|
|
extensions = {
|
|
|
|
|
['ui-select'] = {
|
|
|
|
@ -420,9 +420,19 @@ require('lazy').setup({
|
|
|
|
|
-- 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?**
|
|
|
|
@ -466,6 +476,12 @@ require('lazy').setup({
|
|
|
|
|
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Define the map function with support for arguments
|
|
|
|
|
local map_with_args = function(keys, func, desc, args)
|
|
|
|
|
vim.keymap.set('n', keys, function()
|
|
|
|
|
func(args)
|
|
|
|
|
end, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
|
|
|
|
end
|
|
|
|
|
-- Jump to the definition of the word under your cursor.
|
|
|
|
|
-- This is where a variable was first declared, or where a function is defined, etc.
|
|
|
|
|
-- To jump back, press <C-t>.
|
|
|
|
@ -485,7 +501,7 @@ require('lazy').setup({
|
|
|
|
|
|
|
|
|
|
-- Fuzzy find all the symbols in your current document.
|
|
|
|
|
-- Symbols are things like variables, functions, types, etc.
|
|
|
|
|
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
|
|
|
|
map_with_args('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols', { fname_width = 0.5, symbol_width = 0.75 })
|
|
|
|
|
|
|
|
|
|
-- Fuzzy find all the symbols in your current workspace.
|
|
|
|
|
-- Similar to document symbols, except searches over your entire project.
|
|
|
|
@ -499,10 +515,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 +525,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,14 +548,17 @@ 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')
|
|
|
|
|
|
|
|
|
|
-- enable inlay on by default.
|
|
|
|
|
vim.lsp.inlay_hint.enable()
|
|
|
|
|
end
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
@ -627,7 +642,8 @@ require('lazy').setup({
|
|
|
|
|
|
|
|
|
|
{ -- Autoformat
|
|
|
|
|
'stevearc/conform.nvim',
|
|
|
|
|
lazy = false,
|
|
|
|
|
event = { 'BufWritePre' },
|
|
|
|
|
cmd = { 'ConformInfo' },
|
|
|
|
|
keys = {
|
|
|
|
|
{
|
|
|
|
|
'<leader>f',
|
|
|
|
@ -765,6 +781,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' },
|
|
|
|
@ -778,13 +799,15 @@ require('lazy').setup({
|
|
|
|
|
-- 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`.
|
|
|
|
|
'folke/tokyonight.nvim',
|
|
|
|
|
'catppuccin/nvim',
|
|
|
|
|
name = 'catppuccin',
|
|
|
|
|
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'
|
|
|
|
|
-- colorscheme catppuccin " catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha
|
|
|
|
|
vim.cmd.colorscheme 'catppuccin-mocha'
|
|
|
|
|
|
|
|
|
|
-- You can configure highlights by doing something like:
|
|
|
|
|
vim.cmd.hi 'Comment gui=none'
|
|
|
|
@ -801,7 +824,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 +858,7 @@ require('lazy').setup({
|
|
|
|
|
'nvim-treesitter/nvim-treesitter',
|
|
|
|
|
build = ':TSUpdate',
|
|
|
|
|
opts = {
|
|
|
|
|
ensure_installed = { 'python', 'cmake', 'bash', 'cpp', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
|
|
|
|
|
ensure_installed = { 'python', 'cmake', 'bash', 'cpp', 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
|
|
|
|
|
-- Autoinstall languages that are not installed
|
|
|
|
|
auto_install = true,
|
|
|
|
|
highlight = {
|
|
|
|
@ -876,7 +899,7 @@ require('lazy').setup({
|
|
|
|
|
-- require 'kickstart.plugins.debug',
|
|
|
|
|
require 'kickstart.plugins.indent_line',
|
|
|
|
|
-- require 'kickstart.plugins.lint',
|
|
|
|
|
-- require 'kickstart.plugins.autopairs',
|
|
|
|
|
require 'kickstart.plugins.autopairs',
|
|
|
|
|
require 'kickstart.plugins.neo-tree',
|
|
|
|
|
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
|
|
|
|
|
|
|
|
|