NvChad setup

This commit is contained in:
2026-06-28 19:22:42 +02:00
parent bc8f47d7de
commit 10dc91c5ed
97 changed files with 210 additions and 7542 deletions

View File

@@ -0,0 +1 @@
require "nvchad.autocmds"

View File

@@ -0,0 +1,24 @@
-- This file needs to have same structure as nvconfig.lua
-- https://github.com/NvChad/ui/blob/v3.0/lua/nvconfig.lua
-- Please read that file to know all available options :(
---@type ChadrcConfig
local M = {}
M.base46 = {
theme = "onedark",
-- hl_override = {
-- Comment = { italic = true },
-- ["@comment"] = { italic = true },
-- },
}
-- M.nvdash = { load_on_startup = true }
-- M.ui = {
-- tabufline = {
-- lazyload = false
-- }
-- }
return M

View File

@@ -1,64 +0,0 @@
-- KEYBINDS
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>cd", vim.cmd.Ex)
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") -- Alt Up/Down in vscode
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set("n", "J", "mzJ`z") -- Remap joining lines
vim.keymap.set("n", "<C-d>", "<C-d>zz") -- Keep cursor in place while moving up/down page
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzzzv") -- center screen when looping search results
vim.keymap.set("n", "N", "Nzzzv")
-- paste and don't replace clipboard over deleted text
vim.keymap.set("x", "<leader>p", [["_dP]])
vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]])
-- sometimes in insert mode, control-c doesn't exactly work like escape
vim.keymap.set("i", "<C-c>", "<Esc>")
-- add binds for Control J/K to scroll thru quickfix list
vim.keymap.set("n", "<C-j>", "<cmd>cnext<CR>zz")
vim.keymap.set("n", "<C-k>", "<cmd>cprev<CR>zz")
-- What the heck is Ex mode?
vim.keymap.set("n", "Q", "<nop>")
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
-- lint / format php files for LC
vim.keymap.set("n", "<leader>cc", "<cmd>!php-cs-fixer fix % --using-cache=no<cr>")
-- Replace all instances of whatever is under cursor (on line)
vim.keymap.set("n", "<leader>s", [[:s/\<<C-r><C-w>\>//gI<Left><Left><Left>]])
-- make file executable
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
-- yank into clipboard even if on ssh
vim.keymap.set('n', '<leader>y', '<Plug>OSCYankOperator')
vim.keymap.set('v', '<leader>y', '<Plug>OSCYankVisual')
-- reload without exiting vim
vim.keymap.set("n", "<leader>rl", "<cmd>source ~/.config/nvim/init.lua<cr>")
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
-- Quickfix list stuff
vim.keymap.set("n", "<leader>cl", ":cclose<CR>", { silent = true })
vim.keymap.set("n", "<leader>co", ":copen<CR>", { silent = true })
vim.keymap.set("n", "<leader>cn", ":cnext<CR>zz")
vim.keymap.set("n", "<leader>cp", ":cprev<CR>zz")
vim.keymap.set("n", "<leader>li", ":checkhealth vim.lsp<CR>", { desc = "LSP Info" })
-- run make in current working directory
vim.keymap.set("n", "<leader>mm", "<cmd>make<CR>")
-- source file
vim.keymap.set("n", "<leader><leader>", function()
vim.cmd("so")
end)

View File

@@ -1,55 +0,0 @@
-- OPTIONS
local set = vim.opt
--line nums
set.relativenumber = true
set.number = true
-- indentation and tabs
set.tabstop = 4
set.shiftwidth = 4
set.autoindent = true
set.expandtab = true
-- search settings
set.ignorecase = true
set.smartcase = true
-- appearance
set.termguicolors = true
set.background = "dark"
set.signcolumn = "yes"
-- cursor line
set.cursorline = true
-- 80th column
set.colorcolumn = "80"
-- clipboard
set.clipboard:append("unnamedplus")
-- backspace
set.backspace = "indent,eol,start"
-- split windows
set.splitbelow = true
set.splitright = true
-- dw/diw/ciw works on full-word
set.iskeyword:append("-")
-- keep cursor at least 8 rows from top/bot
set.scrolloff = 8
-- undo dir settings
set.swapfile = false
set.backup = false
set.undodir = os.getenv("HOME") .. "/.vim/undodir"
set.undofile = true
-- incremental search
set.incsearch = true
-- faster cursor hold
set.updatetime = 50

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,
-- },
}
return 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,6 @@
require("nvchad.configs.lspconfig").defaults()
local servers = { "html", "cssls" }
vim.lsp.enable(servers)
-- read :h vim.lsp.config for changing options of lsp servers

View File

@@ -1,36 +0,0 @@
local M = {}
local plug_dir = vim.fn.stdpath("data") .. "/plugins"
local function ensure(spec)
local repo = type(spec) == "string" and spec or spec[1]
local name = repo:match(".+/(.+)$")
local path = plug_dir .. "/" .. name
if not vim.uv.fs_stat(path) then
vim.fn.mkdir(plug_dir, "p")
local cmd = { "git", "clone", "--depth=1" }
if spec.branch then
table.insert(cmd, "-b")
table.insert(cmd, spec.branch)
end
table.insert(cmd, "https://github.com/" .. repo)
table.insert(cmd, path)
print("Installing " .. name .. "...")
vim.fn.system(cmd)
end
vim.opt.rtp:prepend(path)
vim.opt.rtp:append(path .. "/after")
local lua_path = path .. "/lua"
if vim.uv.fs_stat(lua_path) then
package.path = package.path .. ";" .. lua_path .. "/?.lua;" .. lua_path .. "/?/init.lua"
end
end
function M.setup()
for _, spec in ipairs(require("plugin-list")) do
ensure(spec)
end
end
return M

View File

@@ -0,0 +1,10 @@
require "nvchad.mappings"
-- add yours here
local map = vim.keymap.set
map("n", ";", ":", { desc = "CMD enter command mode" })
map("i", "jk", "<ESC>")
-- map({ "n", "i", "v" }, "<C-s>", "<cmd> w <cr>")

View File

@@ -0,0 +1,6 @@
require "nvchad.options"
-- add yours here!
-- local o = vim.o
-- o.cursorlineopt ='both' -- to enable cursorline!

View File

@@ -1,17 +0,0 @@
return {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"hrsh7th/nvim-cmp",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
"nvim-telescope/telescope.nvim",
{ "ThePrimeagen/harpoon", branch = "harpoon2" },
"folke/tokyonight.nvim",
"nvim-lualine/lualine.nvim",
"brenoprata10/nvim-highlight-colors",
"tpope/vim-fugitive",
"mbbill/undotree",
"ojroques/vim-oscyank",
"captbaritone/better-indent-support-for-php-with-html",
}

View File

@@ -0,0 +1,28 @@
return {
{
"stevearc/conform.nvim",
-- event = 'BufWritePre', -- uncomment for format on save
opts = require "configs.conform",
},
-- These are some examples, uncomment them if you want to see them work!
{
"neovim/nvim-lspconfig",
config = function()
require "configs.lspconfig"
end,
},
-- test new blink
-- { import = "nvchad.blink.lazyspec" },
-- {
-- "nvim-treesitter/nvim-treesitter",
-- opts = {
-- ensure_installed = {
-- "vim", "lua", "vimdoc",
-- "html", "css"
-- },
-- },
-- },
}