From 8e8ace010942de0c4f4d76871e0e486db6301eb5 Mon Sep 17 00:00:00 2001 From: Adam Cooper Date: Mon, 15 Jan 2024 10:23:20 -0500 Subject: [PATCH] [neovim] Mostly plugin improvements --- neovim/init.lua | 115 ++++++++++++++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 47 deletions(-) diff --git a/neovim/init.lua b/neovim/init.lua index 65ece48..adb8435 100644 --- a/neovim/init.lua +++ b/neovim/init.lua @@ -31,6 +31,10 @@ vim.opt.termguicolors = true -- Minimal number of lines kept above and below the cursor vim.opt.scrolloff = 5 +-- Temporary file locations +vim.opt.backupdir = ".backup/," .. HOME .. "/.backup/,/tmp//" +vim.opt.directory = ".swp/," .. HOME .. "/.swp/,/tmp//" + -- netrw -- This is the workspace file explorer vim.g.netrw_winsize = 25 -- width of the file explorer @@ -51,17 +55,6 @@ vim.keymap.set("t", "", "k", { noremap = true, desc = 'Go t vim.keymap.set("t", "", "h", { noremap = true, desc = 'Go to window to the left' }) -- vim.keymap.set("t", "", "l", { noremap = true, desc = 'Go to window to the right' }) ---[[ -vim.keymap.set( - {"i", "n", "t", "v"}, - "", - function () - vim.cmd("nohlsearch") - end, - { desc = ":nohlsearch" } -) ---]] - vim.keymap.set( {"n", "t"}, "z", @@ -101,6 +94,10 @@ require("lazy").setup({ vim.cmd.colorscheme("dracula") end, }, + "nvim-lualine/lualine.nvim", + "nvim-tree/nvim-web-devicons", + { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" }, + "neovim/nvim-lspconfig", { "kylechui/nvim-surround", version = "*", -- Use for stability; omit to use `main` branch for the latest features @@ -131,9 +128,14 @@ require("lazy").setup({ opts = {}, config = function(_, opts) require'lsp_signature'.setup(opts) end }, - { "rcarriga/nvim-dap-ui", requires = "mfussenegger/nvim-dap" }, + { + "rcarriga/nvim-dap-ui", + event = "VeryLazy", + requires = "mfussenegger/nvim-dap" + }, { "mfussenegger/nvim-dap", + event = "VeryLazy", config = function() local dap = require("dap") @@ -142,11 +144,11 @@ require("lazy").setup({ --[[ for name, sign in pairs(Config.icons.dap) do - sign = type(sign) == "table" and sign or { sign } - vim.fn.sign_define( - "Dap" .. name, - { text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] } - ) + sign = type(sign) == "table" and sign or { sign } + vim.fn.sign_define( + "Dap" .. name, + { text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] } + ) end --]] @@ -284,27 +286,38 @@ require("lazy").setup({ }, }, }, - "leoluz/nvim-dap-go", - "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", - "nvimdev/lspsaga.nvim", - "nvim-lualine/lualine.nvim", - "nvim-tree/nvim-web-devicons", - "nvim-lua/plenary.nvim", - { "nvim-telescope/telescope.nvim", branch = "0.1.x" }, - { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" }, - "neovim/nvim-lspconfig", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - "hrsh7th/nvim-cmp", - "hrsh7th/cmp-vsnip", - "hrsh7th/vim-vsnip", - "hrsh7th/cmp-nvim-lsp-signature-help", - "tpope/vim-fugitive", - "lewis6991/gitsigns.nvim", - "famiu/bufdelete.nvim", + { "leoluz/nvim-dap-go", event = "VeryLazy" }, + { "williamboman/mason.nvim", event = "VeryLazy" }, + { "williamboman/mason-lspconfig.nvim", event = "VeryLazy" }, + { "nvimdev/lspsaga.nvim", event = "VeryLazy" }, + { + "nvim-telescope/telescope.nvim", + event = "VeryLazy", + branch = "0.1.x", + dependencies = { + "nvim-lua/plenary.nvim", + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build", + }, + }, + }, + { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "hrsh7th/cmp-vsnip", + "hrsh7th/vim-vsnip", + "hrsh7th/cmp-nvim-lsp-signature-help", + }, + }, + { "tpope/vim-fugitive", event = "VeryLazy" }, + { "lewis6991/gitsigns.nvim", event = "VeryLazy" }, + { "famiu/bufdelete.nvim", event = "VeryLazy" }, }) --[[ mason @@ -642,24 +655,32 @@ vim.cmd("highlight NonText gui=bold guifg=#999999") --[[ Resolve conflict between fugitive and LSPSaga, wherein the latter's breadcrumbs cause a mismatch between the buffer and fugitive's :Git blame -window. To kill the winbar (the top line where the breadcrumbs and this -blame title live), enter `:set winbar&`. +window and :Gvdiffsplit window(s). To kill the winbar (the top line where +the breadcrumbs and this blame title live), enter `:set winbar&`. --]] -local group = vim.api.nvim_create_augroup("fugitiveSagaConflict", { clear = true }) +local blamegroup = vim.api.nvim_create_augroup("fugitiveSagaBlameConflict", { clear = true }) vim.api.nvim_create_autocmd( 'FileType', { - group = group, + group = blamegroup, pattern = 'fugitiveblame', callback = function() - vim.api.nvim_set_option_value('winbar', 'fugitive: :Git blame', { scope = 'local' }) + vim.api.nvim_set_option_value('winbar', 'fugitive', { scope = 'local' }) + end, + } +) + +local diffgroup = vim.api.nvim_create_augroup("fugitiveSagaDiffConflict", { clear = true }) +vim.api.nvim_create_autocmd( + 'BufAdd', + { + group = diffgroup, + pattern = "fugitive://*", -- TODO: This doesn't seem to work + callback = function() + vim.api.nvim_set_option_value('winbar', 'fugitive', { scope = 'local' }) end, } ) -- Switch syntax highlighting on vim.cmd("syntax enable") - --- Temporary file locations -vim.opt.backupdir = ".backup/," .. HOME .. "/.backup/,/tmp//" -vim.opt.directory = ".swp/," .. HOME .. "/.swp/,/tmp//"