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

@ -0,0 +1,6 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferDouble"
call_parentheses = "None"

View file

@ -0,0 +1,39 @@
vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
vim.g.mapleader = " "
-- bootstrap lazy and all plugins
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
local repo = "https://github.com/folke/lazy.nvim.git"
vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath }
end
vim.opt.rtp:prepend(lazypath)
local lazy_config = require "configs.lazy"
-- load plugins
require("lazy").setup({
{
"NvChad/NvChad",
lazy = false,
branch = "v2.5",
import = "nvchad.plugins",
config = function()
require "options"
end,
},
{ import = "plugins" },
}, lazy_config)
-- load theme
dofile(vim.g.base46_cache .. "defaults")
dofile(vim.g.base46_cache .. "statusline")
require "nvchad.autocmds"
vim.schedule(function()
require "mappings"
end)

View file

@ -0,0 +1,30 @@
-- 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,15 @@
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

@ -0,0 +1,47 @@
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

@ -0,0 +1,24 @@
-- 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

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

View file

@ -0,0 +1,57 @@
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

@ -0,0 +1,29 @@
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

@ -0,0 +1,71 @@
return {
{
"nvim-lua/plenary.nvim",
{
"nvchad/ui",
config = function()
require "nvchad"
end
},
{
"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,
},
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"bash",
"lua",
"markdown",
"markdown_inline",
"python",
"terraform",
"vim",
},
},
},
{
"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,
-- }