|
|
|
@ -1,5 +1,4 @@
|
|
|
|
|
--[[
|
|
|
|
|
|
|
|
|
|
=====================================================================
|
|
|
|
|
==================== READ THIS BEFORE CONTINUING ====================
|
|
|
|
|
=====================================================================
|
|
|
|
@ -84,13 +83,18 @@ require('lazy').setup({
|
|
|
|
|
|
|
|
|
|
-- Useful status updates for LSP
|
|
|
|
|
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
|
|
|
|
{ 'j-hui/fidget.nvim', opts = {} },
|
|
|
|
|
-- tag to legacy to avoid message startup
|
|
|
|
|
{ 'j-hui/fidget.nvim', opts = {}, tag = 'legacy' },
|
|
|
|
|
|
|
|
|
|
-- Additional lua configuration, makes nvim stuff amazing!
|
|
|
|
|
'folke/neodev.nvim',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
'simrat39/rust-tools.nvim',
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
-- Autocompletion
|
|
|
|
|
'hrsh7th/nvim-cmp',
|
|
|
|
@ -122,21 +126,22 @@ require('lazy').setup({
|
|
|
|
|
changedelete = { text = '~' },
|
|
|
|
|
},
|
|
|
|
|
on_attach = function(bufnr)
|
|
|
|
|
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
|
|
|
|
|
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk,
|
|
|
|
|
{ buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
|
|
|
|
|
vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
|
|
|
|
|
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
-- Theme inspired by Atom
|
|
|
|
|
'navarasu/onedark.nvim',
|
|
|
|
|
priority = 1000,
|
|
|
|
|
config = function()
|
|
|
|
|
vim.cmd.colorscheme 'onedark'
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
-- {
|
|
|
|
|
-- -- Theme inspired by Atom
|
|
|
|
|
-- 'navarasu/onedark.nvim',
|
|
|
|
|
-- priority = 1000,
|
|
|
|
|
-- config = function()
|
|
|
|
|
-- vim.cmd.colorscheme 'onedark'
|
|
|
|
|
-- end,
|
|
|
|
|
-- },
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
-- Set lualine as statusline
|
|
|
|
@ -145,7 +150,7 @@ require('lazy').setup({
|
|
|
|
|
opts = {
|
|
|
|
|
options = {
|
|
|
|
|
icons_enabled = false,
|
|
|
|
|
theme = 'onedark',
|
|
|
|
|
theme = 'auto',
|
|
|
|
|
component_separators = '|',
|
|
|
|
|
section_separators = '',
|
|
|
|
|
},
|
|
|
|
@ -158,7 +163,7 @@ require('lazy').setup({
|
|
|
|
|
-- Enable `lukas-reineke/indent-blankline.nvim`
|
|
|
|
|
-- See `:help indent_blankline.txt`
|
|
|
|
|
opts = {
|
|
|
|
|
char = '┊',
|
|
|
|
|
char = '│',
|
|
|
|
|
show_trailing_blankline_indent = false,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -189,13 +194,15 @@ require('lazy').setup({
|
|
|
|
|
'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.debug',
|
|
|
|
|
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
|
|
|
|
@ -212,9 +219,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 = true;
|
|
|
|
|
set.scrolloff = 8
|
|
|
|
|
-- Enable mouse mode
|
|
|
|
|
vim.o.mouse = 'a'
|
|
|
|
|
|
|
|
|
@ -248,7 +284,9 @@ vim.o.completeopt = 'menuone,noselect'
|
|
|
|
|
vim.o.termguicolors = true
|
|
|
|
|
|
|
|
|
|
-- [[ Basic Keymaps ]]
|
|
|
|
|
|
|
|
|
|
-- Save with Control + s
|
|
|
|
|
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 })
|
|
|
|
@ -306,7 +344,7 @@ 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 = { 'lua', 'python', 'rust', 'html', 'css', 'javascript', 'help', 'vim' },
|
|
|
|
|
|
|
|
|
|
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
|
|
|
|
auto_install = false,
|
|
|
|
@ -392,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')
|
|
|
|
@ -430,7 +469,6 @@ local servers = {
|
|
|
|
|
-- pyright = {},
|
|
|
|
|
-- rust_analyzer = {},
|
|
|
|
|
-- tsserver = {},
|
|
|
|
|
|
|
|
|
|
lua_ls = {
|
|
|
|
|
Lua = {
|
|
|
|
|
workspace = { checkThirdParty = false },
|
|
|
|
@ -446,6 +484,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'
|
|
|
|
|
|
|
|
|
@ -511,5 +552,80 @@ cmp.setup {
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- If the colorscheme is Habamax, fix parenthesis colors
|
|
|
|
|
-- vim.cmd('colorscheme habamax')
|
|
|
|
|
-- Fix the matching parenthesis color
|
|
|
|
|
-- vim.api.nvim_command('hi MatchParen ctermbg=gray guibg=lightblue')
|
|
|
|
|
|
|
|
|
|
-- The line beneath this is called `modeline`. See `:help modeline`
|
|
|
|
|
-- vim: ts=2 sts=2 sw=2 et
|
|
|
|
|
|
|
|
|
|
local extension_path = vim.env.HOME .. '/.local/share/nvim/mason/packages/codelldb/extension/'
|
|
|
|
|
local codelldb_path = extension_path .. 'adapter/codelldb'
|
|
|
|
|
local liblldb_path = extension_path .. 'lldb/lib/liblldb'
|
|
|
|
|
|
|
|
|
|
-- The liblldb extension is .so for linux and .dylib for macOS
|
|
|
|
|
liblldb_path = liblldb_path .. ".so"
|
|
|
|
|
|
|
|
|
|
local rt = require("rust-tools")
|
|
|
|
|
|
|
|
|
|
rt.setup({
|
|
|
|
|
dap = {
|
|
|
|
|
adapter = require('rust-tools.dap').get_codelldb_adapter(
|
|
|
|
|
codelldb_path, liblldb_path)
|
|
|
|
|
},
|
|
|
|
|
server = {
|
|
|
|
|
on_attach = function(_, bufnr)
|
|
|
|
|
local nmap = function(keys, func, desc)
|
|
|
|
|
if desc then
|
|
|
|
|
desc = 'LSP: ' .. desc
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
|
|
|
|
|
|
|
|
|
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
|
|
|
|
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
|
|
|
|
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
|
|
|
|
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
|
|
|
|
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
|
|
|
|
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
|
|
|
|
|
|
|
|
|
-- See `:help K` for why this keymap
|
|
|
|
|
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
|
|
|
|
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
|
|
|
|
|
|
|
|
|
-- Lesser used LSP functionality
|
|
|
|
|
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
|
|
|
|
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
|
|
|
|
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
|
|
|
|
nmap('<leader>wl', function()
|
|
|
|
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
|
|
|
end, '[W]orkspace [L]ist Folders')
|
|
|
|
|
-- Hover actions
|
|
|
|
|
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
|
|
|
|
|
-- Code action groups
|
|
|
|
|
vim.keymap.set("n", "<Leader>ca", rt.code_action_group.code_action_group,
|
|
|
|
|
{ desc = '[C]ode [A]ctions', buffer = bufnr })
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
tools = {
|
|
|
|
|
hover_actions = {
|
|
|
|
|
auto_focus = true,
|
|
|
|
|
},
|
|
|
|
|
inlay_hints = {
|
|
|
|
|
-- automatically set inlay hints (type hints)
|
|
|
|
|
-- default: true
|
|
|
|
|
auto = true,
|
|
|
|
|
|
|
|
|
|
-- Only show inlay hints for the current line
|
|
|
|
|
only_current_line = true,
|
|
|
|
|
|
|
|
|
|
-- whether to show parameter hints with the inlay hints or not
|
|
|
|
|
-- default: true
|
|
|
|
|
show_parameter_hints = false,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|