Switch to LazyVim.

This commit is contained in:
Bartek Stalewski 2025-01-28 17:20:49 +01:00
parent 9eeb3ed88e
commit 5acb10f0aa
No known key found for this signature in database
24 changed files with 626 additions and 91 deletions

View file

@ -1,30 +0,0 @@
-- This file needs to have same structure as nvconfig.lua
-- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvconfig.lua
local M = {}
M.base46 = {
hl_override = {
ColorColumn = { bg = "#770000" },
Comment = { italic = true },
DiffChange = { bg = "NONE", fg = "#e7c547" },
DiffText = { bg = "NONE", fg = "#ff8700" },
SpellBad = { bg = "#770000", fg = "#ffffff" },
Visual = { bg = "#0094d8", fg = "#ffffff" },
},
theme = "monekai",
transparency = true,
}
M.ui = {
statusline = {
theme = "vscode_colored",
},
}
M.mason = {
cmd = true,
pkgs = { "lua-language-server", "terraform-ls", "tflint" },
}
return M

View file

@ -0,0 +1,25 @@
-- Autocmds are automatically loaded on the VeryLazy event
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
--
-- Add any additional autocmds here
-- with `vim.api.nvim_create_autocmd`
--
-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults)
-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
pattern = { "*.gotmpl" },
callback = function()
vim.cmd("set filetype=yaml")
end,
})
vim.api.nvim_create_autocmd({ "BufReadPre" }, {
callback = function()
vim.api.nvim_set_hl(0, "ColorColumn", { bg = "#770000" })
vim.api.nvim_set_hl(0, "DiffChange", { bg = "NONE", fg = "#e7c547" })
vim.api.nvim_set_hl(0, "DiffText", { bg = "NONE", fg = "#ff8700" })
vim.api.nvim_set_hl(0, "SpellBad", { bg = "#770000", fg = "#ffffff" })
vim.api.nvim_set_hl(0, "Visual", { bg = "#0094d8", fg = "#ffffff" })
end,
})

View file

@ -0,0 +1,76 @@
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
local map = vim.keymap.set
local nomap = vim.keymap.del
map("i", "<C-a>", "<esc>I")
map("i", "<C-e>", "<esc>A")
map("n", "<esc><cr>", "<esc><cmd>wq!<cr>", { desc = "save and exit", remap = true })
map("n", "<tab>", "<C-w>w", { desc = "switch pane", remap = true })
map("n", "<leader>-", "<C-W>s", { desc = "split horizontally", remap = true })
map("n", "<leader>|", "<C-W>v", { desc = "split vertically", remap = true })
map("n", "<leader>/", "gcc", { desc = "toggle comments", remap = true })
map("n", "<leader>ff", LazyVim.pick("files", { root = false }), { desc = "find files (cwd", remap = true })
map("n", "<leader>fF", LazyVim.pick("files"), { desc = "find files (root)", remap = true })
map("n", "<leader>h", "<cmd>set hlsearch!<cr>", { desc = "toggle hlsearch", remap = true })
map(
"n",
"<leader>m",
'<cmd>execute "set colorcolumn=" . (&colorcolumn == "" ? "80,120" : "")<cr>',
{ desc = "toggle column", remap = true }
)
map(
"n",
"<leader>n",
'<cmd>set number!<cr><cmd>execute "set signcolumn=" . (&signcolumn == "yes" ? "no" : "yes")<cr>',
{ desc = "toggle decorations", remap = true }
)
map("v", "<leader>/", "gc", { desc = "toggle comments", remap = true })
nomap("n", "<leader><space>")
nomap("n", "<leader>,")
nomap("n", "<leader>.")
nomap("n", "<leader>:")
nomap("n", "<leader>?")
nomap("n", "<leader>K")
nomap("n", "<leader>l")
nomap("n", "<leader>L")
nomap("n", "<leader>S")
nomap("n", "<leader>`")
nomap("n", "<leader>bD")
nomap("n", "<leader>bP")
nomap("n", "<leader>bb")
nomap("n", "<leader>bd")
nomap("n", "<leader>be")
nomap("n", "<leader>bl")
nomap("n", "<leader>bo")
nomap("n", "<leader>bp")
nomap("n", "<leader>br")
nomap("n", "<leader>fb")
nomap("n", "<leader>fc")
nomap("n", "<leader>fe")
nomap("n", "<leader>fE")
nomap("n", "<leader>fg")
nomap("n", "<leader>fn")
nomap("n", "<leader>fr")
nomap("n", "<leader>fR")
nomap("n", "<leader>ft")
nomap("n", "<leader>fT")
nomap("n", "<leader>gb")
nomap("n", "<leader>gB")
nomap("n", "<leader>gc")
nomap("n", "<leader>ge")
nomap("n", "<leader>gs")
nomap("n", "<leader>gY")
nomap("n", "<leader>qq")
nomap("n", "<leader>xl")
nomap("n", "<leader>xq")

View file

@ -0,0 +1,52 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- import/override with your plugins
{ import = "plugins" },
},
defaults = {
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
lazy = false,
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
-- have outdated releases, which may break your Neovim install.
version = false, -- always use the latest git commit
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
checker = {
enabled = true, -- check for plugin updates periodically
notify = false, -- notify on update
}, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = {
"gzip",
-- "matchit",
-- "matchparen",
-- "netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View file

@ -0,0 +1,16 @@
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
local o = vim.o
o.gdefault = true
o.hlsearch = false
o.inccommand = "split"
o.relativenumber = false
o.shiftround = true
o.termguicolors = true
o.wrap = true
o.writebackup = false
o.clipboard = ""
o.foldcolumn = "0"
o.mouse = ""
o.whichwrap = ""
o.statuscolumn = ""

View file

@ -1,15 +0,0 @@
local options = {
formatters_by_ft = {
lua = { "stylua" },
-- css = { "prettier" },
-- html = { "prettier" },
},
-- format_on_save = {
-- -- These options will be passed to conform.format()
-- timeout_ms = 500,
-- lsp_fallback = true,
-- },
}
require("conform").setup(options)

View file

@ -1,47 +0,0 @@
return {
defaults = { lazy = true },
install = { colorscheme = { "nvchad" } },
ui = {
icons = {
ft = "",
lazy = "󰂠 ",
loaded = "",
not_loaded = "",
},
},
performance = {
rtp = {
disabled_plugins = {
"2html_plugin",
"tohtml",
"getscript",
"getscriptPlugin",
"gzip",
"logipat",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"matchit",
"tar",
"tarPlugin",
"rrhelper",
"spellfile_plugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
"tutor",
"rplugin",
"syntax",
"synmenu",
"optwin",
"compiler",
"bugreport",
"ftplugin",
},
},
},
}

View file

@ -1,24 +0,0 @@
-- load defaults i.e lua_lsp
require("nvchad.configs.lspconfig").defaults()
local lspconfig = require "lspconfig"
-- EXAMPLE
local servers = { "terraformls" }
local nvlsp = require "nvchad.configs.lspconfig"
-- lsps with default config
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = nvlsp.on_attach,
on_init = nvlsp.on_init,
capabilities = nvlsp.capabilities,
}
end
-- configuring single server, example: typescript
-- lspconfig.ts_ls.setup {
-- on_attach = nvlsp.on_attach,
-- on_init = nvlsp.on_init,
-- capabilities = nvlsp.capabilities,
-- }

View file

@ -1,3 +0,0 @@
vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46_cache/"
dofile(vim.g.base46_cache .. "defaults")
dofile(vim.g.base46_cache .. "statusline")

View file

@ -1,57 +0,0 @@
require "nvchad.mappings"
-- add yours here
local map = vim.keymap.set
local nomap = vim.keymap.del
nomap("n", "<leader>b")
nomap("n", "<leader>ch")
nomap("n", "<leader>cm")
nomap("n", "<leader>ds")
nomap("n", "<leader>fh")
nomap("n", "<leader>fm")
nomap("n", "<leader>gt")
nomap("n", "<leader>ma")
nomap("n", "<leader>pt")
nomap("n", "<leader>rn")
nomap("n", "<leader>th")
nomap("n", "<leader>v")
nomap("n", "<leader>wK")
nomap("n", "<leader>wk")
nomap("n", "<leader>x")
nomap("n", "<leader>fo")
nomap("n", "<leader>fz")
map("i", "<C-a>", "<esc>I")
map("i", "<C-e>", "<esc>A")
map("n", "<esc><CR>", "<esc><cmd>wq!<CR>", { desc = "save and exit" })
map("n", "<leader>b", "", { desc = "buffer operations" })
map("n", "<leader>bn", "<cmd>enew<CR>", { desc = "new" })
map("n", "<leader>bj", "<cmd>bprevious<CR>", { desc = "previous" })
map("n", "<leader>bk", "<cmd>bnext<CR>", { desc = "next" })
map("n", "<leader>bx", "<cmd>bd<CR>", { desc = "close" })
map("n", "<leader>e", "<cmd>NvimTreeFocus<CR>", { desc = "file tree" })
map("n", "<leader>f", "", { desc = "find operations" })
map("n", "<leader>fa", "<cmd>Telescope find_files follow=true no_ignore=true hidden=true<CR>", { desc = "all files" })
map("n", "<leader>fb", "<cmd>Telescope buffers<CR>", { desc = "buffers" })
map("n", "<leader>ff", "<cmd>Telescope find_files<CR>", { desc = "files" })
map("n", "<leader>fw", "<cmd>Telescope live_grep<CR>", { desc = "grep" })
map("n", "<leader>h", "<cmd>set hlsearch!<CR>", { desc = "Toggle hlsearch" })
map(
"n",
"<leader>m",
'<cmd>execute "set colorcolumn=" . (&colorcolumn == "" ? "80,120" : "")<CR>',
{ desc = "Toggle Column" }
)
map(
"n",
"<leader>n",
'<cmd>set number!<CR><cmd>IBLToggle<CR><cmd>execute "set signcolumn=" . (&signcolumn == "yes" ? "no" : "yes")<CR>',
{ desc = "Toggle Decorations" }
)
map("n", "<leader>t", function()
require("nvchad.themes").open()
end, { desc = "Change Theme" })
map("n", "<tab>", "<C-w>w", { desc = "switch pane" })

View file

@ -1,29 +0,0 @@
require "nvchad.options"
-- add yours here!
local o = vim.o
-- o.cursorlineopt ='both' -- to enable cursorline!
o.gdefault = true
o.hlsearch = false
o.inccommand = "split"
o.relativenumber = false
o.shiftround = true
o.termguicolors = true
o.wrap = true
o.writebackup = false
o.clipboard = ""
o.foldcolumn = "0"
o.mouse = ""
o.whichwrap = ''
local autocmd = vim.api.nvim_create_autocmd
autocmd("BufRead", {
pattern = "*.gotmpl",
command = "set filetype=yaml",
})
autocmd("BufNewFile", {
pattern = "*.gotmpl",
command = "set filetype=yaml",
})

View file

@ -1,71 +1,124 @@
return {
{ "MagickDuck/grug-far.nvim", enabled = false },
{ "catppuccin/nvim", enabled = false },
{ "folke/persistence.nvim", enabled = false },
{ "folke/todo-comments.nvim", enabled = false },
{ "folke/tokyonight.nvim", enabled = false },
{ "folke/trouble.nvim", enabled = false },
{ "windwp/nvim-ts-autotag", enabled = false },
{
"nvim-lua/plenary.nvim",
{
"nvchad/ui",
config = function()
require "nvchad"
end
"folke/snacks.nvim",
opts = {
dashboard = { enabled = false },
},
{
"nvchad/base46",
lazy = true,
build = function()
require("base46").load_all_highlights()
end,
},
"nvchad/volt",
},
{
"stevearc/conform.nvim",
-- event = 'BufWritePre', -- uncomment for format on save
config = function()
require "configs.conform"
end,
"loctvl842/monokai-pro.nvim",
opts = {
filter = "classic",
},
},
{
"LazyVim/LazyVim",
opts = {
colorscheme = "monokai-pro",
},
},
{
"nvim-lualine/lualine.nvim",
opts = {
options = {
theme = "powerline",
section_separators = "",
component_separators = "",
},
sections = {
lualine_c = {
{
"diagnostics",
symbols = {
error = LazyVim.config.icons.diagnostics.Error,
warn = LazyVim.config.icons.diagnostics.Warn,
info = LazyVim.config.icons.diagnostics.Info,
hint = LazyVim.config.icons.diagnostics.Hint,
},
},
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
{ "filename", file_status = true, path = 1 },
},
lualine_x = {
{
"diff",
symbols = {
added = LazyVim.config.icons.git.added,
modified = LazyVim.config.icons.git.modified,
removed = LazyVim.config.icons.git.removed,
},
},
},
lualine_z = {},
},
},
},
{
"nvim-neo-tree/neo-tree.nvim",
keys = {
{
"<leader>e",
function()
require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() })
end,
desc = "explorer (cwd)",
remap = true,
},
{
"<leader>E",
function()
require("neo-tree.command").execute({ toggle = true, dir = LazyVim.root() })
end,
desc = "explorer (root)",
remap = true,
},
},
opts = {
filesystem = {
filtered_items = {
visible = true,
},
},
},
},
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
opts = function(_, opts)
opts.ensure_installed = {
"bash",
"diff",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"terraform",
"vim",
}
end,
},
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"lua-language-server",
"terraform-ls",
"tflint",
},
},
},
{
"neovim/nvim-lspconfig",
config = function()
require "configs.lspconfig"
end,
},
}
-- These are some examples, uncomment them if you want to see them work!
-- Install a plugin
-- {
-- "max397574/better-escape.nvim",
-- event = "InsertEnter",
-- config = function()
-- require("better_escape").setup()
-- end
-- },
-- To make a plugin not be loaded
-- {
-- "NvChad/nvim-colorizer.lua",
-- enabled = false
-- },
-- All NvChad plugins are lazy-loaded by default
-- For a plugin to be loaded, you will need to set either `ft`, `cmd`, `keys`, `event`, or set `lazy = false`
-- If you want a plugin to load on startup, add `lazy = false` to a plugin spec, for example
-- {
-- "mg979/vim-visual-multi",
-- lazy = false,
-- }