Add initial nvchad config

This commit is contained in:
Alessandro
2024-09-02 11:47:52 +02:00
parent 715df24f56
commit 72c72fbd10
22 changed files with 431 additions and 0 deletions

View File

@@ -8,6 +8,8 @@
~/.config/lvim/config.lua:
path: lvim/config.lua
create: true
~/.config/nvim:
path: nvim
~/.zshrc:
~/.oh-my-zsh:
path: ohmyzsh

6
nvim/.stylua.toml Normal file
View File

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

24
nvim/LICENSE Normal file
View File

@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org>

9
nvim/README.md Normal file
View File

@@ -0,0 +1,9 @@
**This repo is supposed to used as config by NvChad users!**
- The main nvchad repo (NvChad/NvChad) is used as a plugin by this repo.
- So you just import its modules , like `require "nvchad.options" , require "nvchad.mappings"`
- So you can delete the .git from this repo ( when you clone it locally ) or fork it :)
# Credits
1) Lazyvim starter https://github.com/LazyVim/starter as nvchad's starter was inspired by Lazyvim's . It made a lot of things easier!

37
nvim/init.lua Normal file
View File

@@ -0,0 +1,37 @@
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.uv.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",
},
{ import = "plugins" },
}, lazy_config)
-- load theme
dofile(vim.g.base46_cache .. "defaults")
dofile(vim.g.base46_cache .. "statusline")
require "options"
require "nvchad.autocmds"
vim.schedule(function()
require "mappings"
end)

35
nvim/lazy-lock.json Normal file
View File

@@ -0,0 +1,35 @@
{
"LuaSnip": { "branch": "master", "commit": "45db5addf8d0a201e1cf247cae4cdce605ad3768" },
"NvChad": { "branch": "v2.5", "commit": "b7a163e232524f1024a59a0a5c6ddf123530085c" },
"auto-save.nvim": { "branch": "main", "commit": "979b6c82f60cfa80f4cf437d77446d0ded0addf0" },
"base46": { "branch": "v2.5", "commit": "94957a0edf563d63e2ab28f5f21190d0f24e431a" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "0ebe875d9c306f5fc829db38492ffff2a70d8e9d" },
"crates.nvim": { "branch": "main", "commit": "1c924d5a9ea3496c4e1a02d0d51388ba809f8468" },
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
"gitsigns.nvim": { "branch": "main", "commit": "899e993850084ea33d001ec229d237bc020c19ae" },
"indent-blankline.nvim": { "branch": "master", "commit": "db926997af951da38e5004ec7b9fbdc480b48f5d" },
"lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"nvim-autopairs": { "branch": "master", "commit": "fd2badc24e675f947162a16c124d395bde80dbd6" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-colorizer.lua": { "branch": "master", "commit": "194ec600488f7c7229668d0e80bd197f3a2b84ff" },
"nvim-lsp-endhints": { "branch": "main", "commit": "4af226bd3fb235e623d4ffcc14372a3d9b75e40b" },
"nvim-lspconfig": { "branch": "master", "commit": "3ad562700d0615818bf358268ac8914f6ce2b079" },
"nvim-tree.lua": { "branch": "master", "commit": "ea55ef12036897fdc4476b115a395d2a34965c82" },
"nvim-treesitter": { "branch": "master", "commit": "a1573a9135c608e68cb383f752623527be84bdce" },
"nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" },
"onedark.nvim": { "branch": "master", "commit": "fae34f7c635797f4bf62fb00e7d0516efa8abe37" },
"plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" },
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "8f47c3d70286a85940cafe990a64b0eac1033671" },
"rustaceanvim": { "branch": "master", "commit": "d3a8b145f0b3db4de9a08fcbc604659f52ee4fbc" },
"telescope.nvim": { "branch": "master", "commit": "5972437de807c3bc101565175da66a1aa4f8707a" },
"ui": { "branch": "v2.5", "commit": "cd474496cdc41c833f6376eaf20e7c357b7a2e35" },
"which-key.nvim": { "branch": "main", "commit": "bfec3d6bc0a9b0b2cb11644642f78c2c3915eef0" }
}

39
nvim/lua/chadrc.lua Normal file
View File

@@ -0,0 +1,39 @@
-- This file needs to have same structure as nvconfig.lua
-- https://github.com/NvChad/ui/blob/v2.5/lua/nvconfig.lua
---@type ChadrcConfig
local M = {}
M.base46 = {
theme = "onedark",
-- hl_override = {
-- Comment = { italic = true },
-- ["@comment"] = { italic = true },
-- },
}
M.ui = {
statusline = {
theme = "vscode_colored",
},
nvdash = {
load_on_startup = true,
header = {
" ▄▄ ▄ ▄▄▄▄▄▄▄ ",
"▄▀███▄ ▄██ █████▀ ",
"██▄▀███▄ ███ ",
"███ ▀███▄ ███ ",
"███ ▀██ ███ ",
"███ ▀ ███ ",
"▀██ █████▄▀█▀▄██████▄ ",
" ▀ ▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀ ",
}
}
}
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,
-- },
}
return options

View File

@@ -0,0 +1,24 @@
return {
ensure_installed = {
"lua-language-server",
"luacheck",
"misspell",
"shellcheck",
"shfmt",
"bash-language-server",
"rust-analyzer",
"taplo",
"jdtls",
"clangd",
"pyright",
"ruff",
"dockerfile-language-server",
},
}

View File

@@ -0,0 +1,14 @@
return {
auto_install = true,
ensure_installed = {
"lua",
"rust",
"java",
"c",
"cpp",
"markdown",
"markdown_inline",
"comment",
"toml",
},
}

47
nvim/lua/configs/lazy.lua Normal file
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 = { "html", "cssls" }
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.tsserver.setup {
-- on_attach = nvlsp.on_attach,
-- on_init = nvlsp.on_init,
-- capabilities = nvlsp.capabilities,
-- }

View File

@@ -0,0 +1,9 @@
return {
renderer = {
icons = {
show = {
git = false,
},
},
},
}

21
nvim/lua/mappings.lua Normal file
View File

@@ -0,0 +1,21 @@
require "nvchad.mappings"
-- add yours here
local map = vim.keymap.set
map("n", ";", ":", { desc = "CMD enter command mode" })
map("i", "jk", "<ESC>")
-- Group names
map("n", "<leader>d", "", { desc = "test" })
-- General
map("n", "<leader>q", "<Cmd>confirm q<CR>", { desc = "test" })
-- Lsp
map(
"n",
"<leader>lf",
"<CMD> lua require('conform').format { lsp_fallback = true }<CR>",
{ desc = "General Format file" }
)

8
nvim/lua/options.lua Normal file
View File

@@ -0,0 +1,8 @@
require "nvchad.options"
-- add yours here!
-- local o = vim.o
-- o.cursorlineopt ='both' -- to enable cursorline!
vim.lsp.inlay_hint.enable(true)

View File

@@ -0,0 +1,22 @@
return {
"saecki/crates.nvim",
tag = "stable",
event = { "BufRead Cargo.toml" },
config = function()
require("crates").setup{
lsp = {
enabled = true,
actions = true,
completion = true,
hover = true,
},
completion = {
crates = {
enabled = true,
max_results = 10,
min_chars = 3,
},
}
}
end,
}

View File

@@ -0,0 +1,7 @@
return {
"chrisgrieser/nvim-lsp-endhints",
event = "LspAttach",
opts = {icons = {
type = "󱈤 ",
},},}

36
nvim/lua/plugins/init.lua Normal file
View File

@@ -0,0 +1,36 @@
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,
},
{
"Pocco81/auto-save.nvim",
config = function()
require("auto-save").setup()
end,
lazy = false,
},
{
"nvim-treesitter/nvim-treesitter",
opts = require "configs.default-ts",
},
{
"hiphish/rainbow-delimiters.nvim",
lazy = false,
},
{
"nvim-tree/nvim-tree.lua",
opts = require "configs.nvim-tree",
},
}

View File

@@ -0,0 +1,7 @@
return {
"WhoIsSethDaniel/mason-tool-installer.nvim",
lazy = false,
config = function()
require("mason-tool-installer").setup(require "configs.default-lsp")
end,
}

View File

@@ -0,0 +1,19 @@
return {
"navarasu/onedark.nvim",
lazy = false,
config = function()
require("onedark").setup {
style = "darker", -- Default theme style. Choose between 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer' and 'light'
toggle_style_key = "<leader>ss",
transparent = false, -- Show/hide background
code_style = {
comments = "italic",
keywords = "italic,",
functions = "bold",
strings = "none",
variables = "none",
},
}
end,
}

View File

@@ -0,0 +1,12 @@
return {
"ahmedkhalf/project.nvim",
lazy = false,
config = function()
require("telescope").load_extension "projects"
require("project_nvim").setup {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
end,
}

View File

@@ -0,0 +1,14 @@
return {
"mrcjkb/rustaceanvim",
version = "^5", -- Recommended
lazy = false, -- This plugin is already lazy
config = function()
vim.g.rustaceanvim = {
tools = {
float_win_config = {
border = "rounded",
},
},
}
end,
}