refactor(init): fine tuned lazy.nvim setup and loading of options

This commit is contained in:
Sven Vogel 2024-11-01 16:48:32 +01:00
parent ec10265eb7
commit d8a6a44f70
4 changed files with 83 additions and 3 deletions

View File

@ -1,3 +1,16 @@
require("config.opts")
--
-- Initialize Neovim configuration
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 01.11.2024
-- Edited: 01.11.2024
--
-- ==============================================
-- Load plugin manager
-- and plugins, additonally setup global options
require("config.lazy") require("config.lazy")
-- install custom keymaps
require("config.keys") require("config.keys")

View File

@ -1,4 +1,14 @@
--
-- Global custom plugin agnostic keymaps
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 01.11.2024
-- Edited: 01.11.2024
--
-- ==============================================
local keymaps = { local keymaps = {
-- --
-- Write buffer to disk -- Write buffer to disk
@ -116,8 +126,22 @@ local keymaps = {
end end
end, end,
desc = "Close buffer" desc = "Close buffer"
},
--
-- Tab (barbar) controls
-- ..............................................
{
mode = { 'n', 'i' },
keys = '<C-tab>',
cmd = vim.cmd('BufferNext'),
desc = "Switch to the next buffer"
},
{
mode = { 'n', 'i' },
keys = '<C-S-tab>',
cmd = vim.cmd('BufferPrevious'),
desc = "Switch to the previous buffer"
} }
} }
for _, keymap in pairs(keymaps) do for _, keymap in pairs(keymaps) do

View File

@ -1,3 +1,19 @@
--
-- Bootstrap and start Lazy.nvim plugins
-- manager.
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 01.11.2024
-- Edited: 01.11.2024
--
-- ==============================================
--
-- Bootstrap Lazy.nvim package manager
-- ..............................................
-- Bootstrap lazy.nvim -- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then if not (vim.uv or vim.loop).fs_stat(lazypath) then
@ -15,12 +31,23 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
--
-- Early setup of Neovim and VIM options
-- ..............................................
-- Make sure to setup `mapleader` and `maplocalleader` before -- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct. -- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt) -- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " " vim.g.mapleader = " "
vim.g.maplocalleader = "\\" vim.g.maplocalleader = "\\"
-- load options
require("config.opts")
--
-- Start Lazy.nvim
-- ..............................................
-- Setup lazy.nvim -- Setup lazy.nvim
require("lazy").setup({ require("lazy").setup({
spec = { spec = {
@ -32,4 +59,17 @@ require("lazy").setup({
install = { colorscheme = { "habamax" } }, install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates -- automatically check for plugin updates
checker = { enabled = false }, checker = { enabled = false },
rtp = {
disabled_plugins = {
"gzip",
"matchit",
"matchparen",
"netrw",
"netrwplugin",
"tarplugin",
"tohtml",
"tutor",
"zipplugin",
}
},
}) })

View File

@ -37,4 +37,7 @@ opt.smartindent = true
-- VIM global options -- VIM global options
-- .............................................. -- ..............................................
vim.g.loaded_netrwPlugin = 0 -- disable netrw, VIM's builtin file explorer -- disable netrw
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1