|
|
|
@ -1,5 +1,4 @@
|
|
|
|
|
--[[
|
|
|
|
|
|
|
|
|
|
=====================================================================
|
|
|
|
|
==================== READ THIS BEFORE CONTINUING ====================
|
|
|
|
|
=====================================================================
|
|
|
|
@ -35,7 +34,6 @@ I hope you enjoy your Neovim journey,
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
@ -75,11 +73,12 @@ require('lazy').setup({
|
|
|
|
|
|
|
|
|
|
-- 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
|
|
|
|
|
{
|
|
|
|
|
-- LSP Configuration & Plugins
|
|
|
|
|
'neovim/nvim-lspconfig',
|
|
|
|
|
dependencies = {
|
|
|
|
|
-- Automatically install LSPs to stdpath for neovim
|
|
|
|
|
{ 'williamboman/mason.nvim', config = true },
|
|
|
|
|
'williamboman/mason.nvim',
|
|
|
|
|
'williamboman/mason-lspconfig.nvim',
|
|
|
|
|
|
|
|
|
|
-- Useful status updates for LSP
|
|
|
|
@ -91,14 +90,16 @@ require('lazy').setup({
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ -- Autocompletion
|
|
|
|
|
{
|
|
|
|
|
-- Autocompletion
|
|
|
|
|
'hrsh7th/nvim-cmp',
|
|
|
|
|
dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' },
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- Useful plugin to show you pending keybinds.
|
|
|
|
|
{ 'folke/which-key.nvim', opts = {} },
|
|
|
|
|
{ -- Adds git releated signs to the gutter, as well as utilities for managing changes
|
|
|
|
|
{ 'folke/which-key.nvim', opts = {} },
|
|
|
|
|
{
|
|
|
|
|
-- Adds git releated signs to the gutter, as well as utilities for managing changes
|
|
|
|
|
'lewis6991/gitsigns.nvim',
|
|
|
|
|
opts = {
|
|
|
|
|
-- See `:help gitsigns.txt`
|
|
|
|
@ -111,40 +112,63 @@ require('lazy').setup({
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ -- Theme inspired by Atom
|
|
|
|
|
'navarasu/onedark.nvim',
|
|
|
|
|
-- {
|
|
|
|
|
-- 'rebelot/kanagawa.nvim',
|
|
|
|
|
-- priority = 1000,
|
|
|
|
|
-- config = function()
|
|
|
|
|
-- vim.cmd.colorscheme 'kanagawa'
|
|
|
|
|
-- end,
|
|
|
|
|
-- },
|
|
|
|
|
-- {
|
|
|
|
|
-- 'ellisonleao/gruvbox.nvim',
|
|
|
|
|
-- priority = 1000,
|
|
|
|
|
-- config = function()
|
|
|
|
|
-- vim.cmd.colorscheme 'gruvbox'
|
|
|
|
|
-- end,
|
|
|
|
|
-- },
|
|
|
|
|
-- {
|
|
|
|
|
-- -- Theme inspired by Atom
|
|
|
|
|
-- 'navarasu/onedark.nvim',
|
|
|
|
|
-- priority = 1000,
|
|
|
|
|
-- config = function()
|
|
|
|
|
-- vim.cmd.colorscheme 'onedark'
|
|
|
|
|
-- end,
|
|
|
|
|
-- },
|
|
|
|
|
{
|
|
|
|
|
'rose-pine/neovim',
|
|
|
|
|
priority = 1000,
|
|
|
|
|
config = function()
|
|
|
|
|
vim.cmd.colorscheme 'onedark'
|
|
|
|
|
vim.cmd.colorscheme 'rose-pine-main'
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ -- Set lualine as statusline
|
|
|
|
|
{
|
|
|
|
|
-- Set lualine as statusline
|
|
|
|
|
'nvim-lualine/lualine.nvim',
|
|
|
|
|
-- See `:help lualine.txt`
|
|
|
|
|
opts = {
|
|
|
|
|
options = {
|
|
|
|
|
icons_enabled = false,
|
|
|
|
|
theme = 'onedark',
|
|
|
|
|
theme = 'rose-pine',
|
|
|
|
|
component_separators = '|',
|
|
|
|
|
section_separators = '',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ -- Add indentation guides even on blank lines
|
|
|
|
|
{
|
|
|
|
|
-- Add indentation guides even on blank lines
|
|
|
|
|
'lukas-reineke/indent-blankline.nvim',
|
|
|
|
|
-- Enable `lukas-reineke/indent-blankline.nvim`
|
|
|
|
|
-- See `:help indent_blankline.txt`
|
|
|
|
|
opts = {
|
|
|
|
|
char = '┊',
|
|
|
|
|
char = '│',
|
|
|
|
|
show_trailing_blankline_indent = false,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- "gc" to comment visual regions/lines
|
|
|
|
|
{ 'numToStr/Comment.nvim', opts = {} },
|
|
|
|
|
{ 'numToStr/Comment.nvim', opts = {} },
|
|
|
|
|
|
|
|
|
|
-- Fuzzy Finder (files, lsp, etc)
|
|
|
|
|
{ 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } },
|
|
|
|
@ -162,18 +186,21 @@ require('lazy').setup({
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ -- Highlight, edit, and navigate code
|
|
|
|
|
{
|
|
|
|
|
-- Highlight, edit, and navigate code
|
|
|
|
|
'nvim-treesitter/nvim-treesitter',
|
|
|
|
|
dependencies = {
|
|
|
|
|
'nvim-treesitter/nvim-treesitter-textobjects',
|
|
|
|
|
},
|
|
|
|
|
build = ":TSUpdate",
|
|
|
|
|
config = function()
|
|
|
|
|
pcall(require('nvim-treesitter.install').update { with_sync = true })
|
|
|
|
|
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.autoformat',
|
|
|
|
|
-- require 'kickstart.plugins.debug',
|
|
|
|
|
|
|
|
|
|
-- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
|
|
|
@ -193,9 +220,38 @@ require('lazy').setup({
|
|
|
|
|
-- Set highlight on search
|
|
|
|
|
vim.o.hlsearch = false
|
|
|
|
|
|
|
|
|
|
vim.opt.incsearch = true;
|
|
|
|
|
-- Make line numbers default
|
|
|
|
|
vim.wo.number = true
|
|
|
|
|
|
|
|
|
|
-- Set relative numbers
|
|
|
|
|
vim.wo.relativenumber = true
|
|
|
|
|
|
|
|
|
|
-- Move highlited line with alt
|
|
|
|
|
vim.keymap.set("v", "<A-j>", ":m '>+1<CR>gv=gv")
|
|
|
|
|
vim.keymap.set("v", "<A-k>", ":m '<-2<CR>gv=gv")
|
|
|
|
|
vim.keymap.set("n", "<A-j>", ":m .+1<CR>==")
|
|
|
|
|
vim.keymap.set("n", "<A-k>", ":m .-2<CR>==")
|
|
|
|
|
|
|
|
|
|
-- Greatest remap ever
|
|
|
|
|
vim.keymap.set("x", "<A-p>", "\"_dP")
|
|
|
|
|
|
|
|
|
|
-- /hen searching keep cursor in the middle
|
|
|
|
|
vim.keymap.set("n", "n", "nzzzv")
|
|
|
|
|
vim.keymap.set("n", "N", "Nzzzv")
|
|
|
|
|
|
|
|
|
|
-- About quick fixes
|
|
|
|
|
-- vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
|
|
|
|
|
-- vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
|
|
|
|
|
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
|
|
|
|
|
-- set tab configuration
|
|
|
|
|
local set = vim.opt -- set options
|
|
|
|
|
set.tabstop = 4
|
|
|
|
|
set.softtabstop = 4
|
|
|
|
|
set.shiftwidth = 4
|
|
|
|
|
|
|
|
|
|
set.wrap = false;
|
|
|
|
|
set.scrolloff = 8
|
|
|
|
|
-- Enable mouse mode
|
|
|
|
|
vim.o.mouse = 'a'
|
|
|
|
|
|
|
|
|
@ -230,6 +286,8 @@ vim.o.termguicolors = true
|
|
|
|
|
|
|
|
|
|
-- [[ Basic Keymaps ]]
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<C-s>', ':w<CR>', { silent = true })
|
|
|
|
|
vim.keymap.set('n', '<C-b>', ':Neotree toggle<CR>', { desc = 'Toggle Tree', silent = true })
|
|
|
|
|
-- Keymaps for better default experience
|
|
|
|
|
-- See `:help vim.keymap.set()`
|
|
|
|
|
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
|
|
|
@ -255,8 +313,8 @@ require('telescope').setup {
|
|
|
|
|
defaults = {
|
|
|
|
|
mappings = {
|
|
|
|
|
i = {
|
|
|
|
|
['<C-u>'] = false,
|
|
|
|
|
['<C-d>'] = false,
|
|
|
|
|
['<C-u>'] = false,
|
|
|
|
|
['<C-d>'] = false,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -286,10 +344,10 @@ vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { de
|
|
|
|
|
-- 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', 'typescript', 'vimdoc', 'vim' },
|
|
|
|
|
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'help', 'vim' },
|
|
|
|
|
|
|
|
|
|
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
|
|
|
|
auto_install = false,
|
|
|
|
|
auto_install = true,
|
|
|
|
|
|
|
|
|
|
highlight = { enable = true },
|
|
|
|
|
indent = { enable = true, disable = { 'python' } },
|
|
|
|
@ -308,41 +366,41 @@ require('nvim-treesitter.configs').setup {
|
|
|
|
|
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',
|
|
|
|
|
['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',
|
|
|
|
|
[']m'] = '@function.outer',
|
|
|
|
|
[']]'] = '@class.outer',
|
|
|
|
|
},
|
|
|
|
|
goto_next_end = {
|
|
|
|
|
[']M'] = '@function.outer',
|
|
|
|
|
[']['] = '@class.outer',
|
|
|
|
|
[']M'] = '@function.outer',
|
|
|
|
|
[']['] = '@class.outer',
|
|
|
|
|
},
|
|
|
|
|
goto_previous_start = {
|
|
|
|
|
['[m'] = '@function.outer',
|
|
|
|
|
['[['] = '@class.outer',
|
|
|
|
|
['[m'] = '@function.outer',
|
|
|
|
|
['[['] = '@class.outer',
|
|
|
|
|
},
|
|
|
|
|
goto_previous_end = {
|
|
|
|
|
['[M'] = '@function.outer',
|
|
|
|
|
['[]'] = '@class.outer',
|
|
|
|
|
['[M'] = '@function.outer',
|
|
|
|
|
['[]'] = '@class.outer',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
swap = {
|
|
|
|
|
enable = true,
|
|
|
|
|
swap_next = {
|
|
|
|
|
['<leader>a'] = '@parameter.inner',
|
|
|
|
|
['<leader>a'] = '@parameter.inner',
|
|
|
|
|
},
|
|
|
|
|
swap_previous = {
|
|
|
|
|
['<leader>A'] = '@parameter.inner',
|
|
|
|
|
['<leader>A'] = '@parameter.inner',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -372,7 +430,8 @@ local on_attach = function(_, bufnr)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
|
|
|
|
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
|
|
|
|
nmap('<leader>ca', ':CodeActionMenu<CR>', '[C]ode [A]ction')
|
|
|
|
|
-- nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
|
|
|
|
|
|
|
|
|
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
|
|
|
|
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
|
|
|
@ -410,7 +469,7 @@ local servers = {
|
|
|
|
|
-- pyright = {},
|
|
|
|
|
-- rust_analyzer = {},
|
|
|
|
|
-- tsserver = {},
|
|
|
|
|
|
|
|
|
|
-- eslint = {},
|
|
|
|
|
lua_ls = {
|
|
|
|
|
Lua = {
|
|
|
|
|
workspace = { checkThirdParty = false },
|
|
|
|
@ -426,6 +485,9 @@ require('neodev').setup()
|
|
|
|
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
|
|
|
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
|
|
|
|
|
|
|
|
|
-- Setup mason so it can manage external tooling
|
|
|
|
|
require('mason').setup()
|
|
|
|
|
|
|
|
|
|
-- Ensure the servers above are installed
|
|
|
|
|
local mason_lspconfig = require 'mason-lspconfig'
|
|
|
|
|
|
|
|
|
@ -456,14 +518,14 @@ cmp.setup {
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
mapping = cmp.mapping.preset.insert {
|
|
|
|
|
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
|
|
|
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
|
|
|
['<C-Space>'] = cmp.mapping.complete {},
|
|
|
|
|
['<CR>'] = cmp.mapping.confirm {
|
|
|
|
|
['<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)
|
|
|
|
|
['<Tab>'] = cmp.mapping(function(fallback)
|
|
|
|
|
if cmp.visible() then
|
|
|
|
|
cmp.select_next_item()
|
|
|
|
|
elseif luasnip.expand_or_jumpable() then
|
|
|
|
@ -472,7 +534,7 @@ cmp.setup {
|
|
|
|
|
fallback()
|
|
|
|
|
end
|
|
|
|
|
end, { 'i', 's' }),
|
|
|
|
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
|
|
|
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
|
|
|
|
if cmp.visible() then
|
|
|
|
|
cmp.select_prev_item()
|
|
|
|
|
elseif luasnip.jumpable(-1) then
|
|
|
|
|