From 2623f954f23d38e8060aea551afa1eab67d4cf60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20T?= Date: Wed, 8 Apr 2026 14:03:03 -0600 Subject: [PATCH] feat: initial neovim config (NvChad + custom markdown journaling) --- .gitignore | 10 +++++ .stylua.toml | 6 +++ LICENSE | 24 +++++++++++ README.md | 9 ++++ init.lua | 74 ++++++++++++++++++++++++++++++++ lazy-lock.json | 30 +++++++++++++ lua/autocmds.lua | 1 + lua/chadrc.lua | 25 +++++++++++ lua/configs/conform.lua | 15 +++++++ lua/configs/lazy.lua | 47 ++++++++++++++++++++ lua/configs/lspconfig.lua | 6 +++ lua/custom/configs/lspconfig.lua | 14 ++++++ lua/custom/init.lua | 7 +++ lua/custom/mappings.lua | 9 ++++ lua/custom/plugins.lua | 24 +++++++++++ lua/custom/snippets/tex.lua | 11 +++++ lua/mappings.lua | 10 +++++ lua/options.lua | 6 +++ lua/plugins/init.lua | 28 ++++++++++++ 19 files changed, 356 insertions(+) create mode 100644 .gitignore create mode 100644 .stylua.toml create mode 100644 LICENSE create mode 100644 README.md create mode 100644 init.lua create mode 100644 lazy-lock.json create mode 100644 lua/autocmds.lua create mode 100644 lua/chadrc.lua create mode 100644 lua/configs/conform.lua create mode 100644 lua/configs/lazy.lua create mode 100644 lua/configs/lspconfig.lua create mode 100644 lua/custom/configs/lspconfig.lua create mode 100644 lua/custom/init.lua create mode 100644 lua/custom/mappings.lua create mode 100644 lua/custom/plugins.lua create mode 100644 lua/custom/snippets/tex.lua create mode 100644 lua/mappings.lua create mode 100644 lua/options.lua create mode 100644 lua/plugins/init.lua diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f9eb94 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# Temporary / swap files +*.swp +*~ +# Neovim caches (these live outside anyway, but just in case) +.cache/ +# Lazy.nvim runtime (never commit the downloaded plugins) +.lazy/ +# OS-specific +.DS_Store +Thumbs.db diff --git a/.stylua.toml b/.stylua.toml new file mode 100644 index 0000000..ecb6dca --- /dev/null +++ b/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fdddb29 --- /dev/null +++ b/LICENSE @@ -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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..769fbdf --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +**This repo is supposed to be 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! diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..cde35e6 --- /dev/null +++ b/init.lua @@ -0,0 +1,74 @@ +vim.g.base46_cache = vim.fn.stdpath "data" .. "/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" + +-- Clean Markdown folding with Treesitter (headings + fenced code blocks only) +local markdown_folds = vim.api.nvim_create_augroup("MarkdownFolds", { clear = true }) + +vim.api.nvim_create_autocmd("FileType", { + pattern = "markdown", + group = markdown_folds, + callback = function() + vim.wo.foldmethod = "expr" + vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()" -- This is the magic line + vim.wo.foldlevel = 2 -- tweak if you want deeper levels open by default + vim.wo.foldcolumn = "1" + vim.wo.spell = true + vim.bo.spelllang = "en_us" + end, +}) + +-- load plugins +require("lazy").setup({ + { + "NvChad/NvChad", + lazy = false, + branch = "v2.5", + import = "nvchad.plugins", + }, + -- Beautiful in-editor Markdown rendering (bold, headings, --- lines, etc.) + { + "MeanderingProgrammer/render-markdown.nvim", + dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" }, + lazy = false, + config = function() + require("render-markdown").setup({ + -- Nice defaults for journaling + heading = { enabled = true }, + code = { enabled = true }, + bullet = { enabled = true }, + dash = { enabled = true }, -- renders --- as nice line + quote = { enabled = true }, + link = { enabled = true }, + sign = { enabled = false }, -- keeps it clean + }) + end, + }, + + { import = "plugins" }, +}, lazy_config) + +-- load stuff for LaTeX +require("luasnip.loaders.from_lua").lazy_load({paths = "~/.config/nvim/lua/custom/snippets/"}) + +-- load theme +dofile(vim.g.base46_cache .. "defaults") +dofile(vim.g.base46_cache .. "statusline") + +require "options" +require "autocmds" + +vim.schedule(function() + require "mappings" +end) diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..ad1f508 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,30 @@ +{ + "LuaSnip": { "branch": "master", "commit": "a62e1083a3cfe8b6b206e7d3d33a51091df25357" }, + "NvChad": { "branch": "v2.5", "commit": "f437558f23c8f50c36cd09748121ab2c822e8ec9" }, + "base46": { "branch": "v3.0", "commit": "884b990dcdbe07520a0892da6ba3e8d202b46337" }, + "cmp-async-path": { "branch": "main", "commit": "f8af3f726e07f2e9d37672eaa9102581aefce149" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, + "cmp-nvim-lua": { "branch": "main", "commit": "e3a22cb071eb9d6508a156306b102c45cd2d573d" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "conform.nvim": { "branch": "master", "commit": "086a40dc7ed8242c03be9f47fbcee68699cc2395" }, + "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, + "gitsigns.nvim": { "branch": "main", "commit": "0d797daee85366bc242580e352a4f62d67557b84" }, + "indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "mason.nvim": { "branch": "main", "commit": "b03fb0f20bc1d43daf558cda981a2be22e73ac42" }, + "menu": { "branch": "main", "commit": "7a0a4a2896b715c066cfbe320bdc048091874cc6" }, + "minty": { "branch": "main", "commit": "aafc9e8e0afe6bf57580858a2849578d8d8db9e0" }, + "nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" }, + "nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" }, + "nvim-lspconfig": { "branch": "master", "commit": "a776085e04f7b15d0b59fae2244df07d98360ab4" }, + "nvim-tree.lua": { "branch": "master", "commit": "31503ad5d869fca61461d82a9126f62480ecb0ab" }, + "nvim-treesitter": { "branch": "master", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" }, + "nvim-web-devicons": { "branch": "master", "commit": "40e9d5a6cc3db11b309e39593fc7ac03bb844e38" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "render-markdown.nvim": { "branch": "main", "commit": "687de727de91a63b0bff9cff4e71d73f9d40fa77" }, + "telescope.nvim": { "branch": "master", "commit": "cfb85dcf7f822b79224e9e6aef9e8c794211b20b" }, + "ui": { "branch": "v3.0", "commit": "cb75908a86720172594b30de147272c1b3a7f452" }, + "volt": { "branch": "main", "commit": "620de1321f275ec9d80028c68d1b88b409c0c8b1" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } +} diff --git a/lua/autocmds.lua b/lua/autocmds.lua new file mode 100644 index 0000000..d2db0bb --- /dev/null +++ b/lua/autocmds.lua @@ -0,0 +1 @@ +require "nvchad.autocmds" diff --git a/lua/chadrc.lua b/lua/chadrc.lua new file mode 100644 index 0000000..fef6367 --- /dev/null +++ b/lua/chadrc.lua @@ -0,0 +1,25 @@ +-- This file needs to have same structure as nvconfig.lua +-- https://github.com/NvChad/ui/blob/v2.5/lua/nvconfig.lua +-- Please read that file to know all available options :( + +---@type ChadrcConfig +local M = {} + +M.base46 = { + theme = "onedark", + transparency = true, -- Enable transparent background here + -- hl_override = { + -- Comment = { italic = true }, + -- ["@comment"] = { italic = true }, + -- }, +} + +M.ui = { + -- tabufline = { + -- lazyload = false + -- } +} + +-- M.nvdash = { load_on_startup = true } + +return M diff --git a/lua/configs/conform.lua b/lua/configs/conform.lua new file mode 100644 index 0000000..35ba6cf --- /dev/null +++ b/lua/configs/conform.lua @@ -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 diff --git a/lua/configs/lazy.lua b/lua/configs/lazy.lua new file mode 100644 index 0000000..cd170bd --- /dev/null +++ b/lua/configs/lazy.lua @@ -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", + }, + }, + }, +} diff --git a/lua/configs/lspconfig.lua b/lua/configs/lspconfig.lua new file mode 100644 index 0000000..20a0cce --- /dev/null +++ b/lua/configs/lspconfig.lua @@ -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 diff --git a/lua/custom/configs/lspconfig.lua b/lua/custom/configs/lspconfig.lua new file mode 100644 index 0000000..1dbe915 --- /dev/null +++ b/lua/custom/configs/lspconfig.lua @@ -0,0 +1,14 @@ +local on_attach = require("plugins.configs.lspconfig").on_attach +local capabilities = require("plugins.configs.lspconfig").capabilities + +local lspconfig = require "lspconfig" +lspconfig.texlab.setup { + on_attach = on_attach, + capabilities = capabilities, + settings = { + texlab = { + build = { executable = "latexmk", args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" } }, + forwardSearch = { executable = "zathura", args = { "--synctex-forward", "%l:1:%f", "%p" } }, + }, + }, +} diff --git a/lua/custom/init.lua b/lua/custom/init.lua new file mode 100644 index 0000000..78a5bee --- /dev/null +++ b/lua/custom/init.lua @@ -0,0 +1,7 @@ +vim.api.nvim_create_autocmd("VimEnter", { + callback = function() + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalNC", { bg = "none" }) + end, +}) diff --git a/lua/custom/mappings.lua b/lua/custom/mappings.lua new file mode 100644 index 0000000..59aeeb1 --- /dev/null +++ b/lua/custom/mappings.lua @@ -0,0 +1,9 @@ +local M = {} +M.vimtex = { + n = { + ["cc"] = { "VimtexCompile", "Compile LaTeX" }, + ["cv"] = { "VimtexView", "View PDF" }, + ["cq"] = { "VimtexStop", "Stop Compiler" }, + }, +} +return M diff --git a/lua/custom/plugins.lua b/lua/custom/plugins.lua new file mode 100644 index 0000000..e782b1f --- /dev/null +++ b/lua/custom/plugins.lua @@ -0,0 +1,24 @@ +return { + { + "lervag/vimtex", + lazy = false, -- Disable lazy loading to enable inverse search + ft = "tex", -- Load on .tex files + init = function() + vim.g.vimtex_view_method = "zathura" -- Or "okular", "sioyek", etc. + vim.g.vimtex_quickfix_mode = 0 -- Disable quickfix for cleaner output + vim.g.vimtex_compiler_method = "latexmk" -- Default; alternatives: "latexrun", "tectonic" + vim.g.tex_flavor = "latex" -- Ensure LaTeX mode + vim.g.vimtex_mappings_enabled = 1 -- Enable default mappings (e.g., \ll for compile) + vim.g.vimtex_indent_enabled = 0 -- Optional: Disable auto-indent if conflicting + vim.g.vimtex_context_pdf_viewer = "zathura" + end, + }, + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + -- Extend default ensure_installed list + vim.list_extend(opts.ensure_installed, { "latex" }) + return opts + end, + }, +} diff --git a/lua/custom/snippets/tex.lua b/lua/custom/snippets/tex.lua new file mode 100644 index 0000000..2f8c57d --- /dev/null +++ b/lua/custom/snippets/tex.lua @@ -0,0 +1,11 @@ +local ls = require "luasnip" +local s = ls.snippet +local i = ls.insert_node +local fmta = require("luasnip.extras.fmt").fmta +local in_math = function() return vim.fn['vimtex#syntax#in_mathzone']() == 1 end + +return { + s({trig = "{{", snippetType="autosnippet"}, fmta("\\left\\{ <>\\right\\} ", { i(1) }), {condition = in_math}), + s({trig = "((", snippetType="autosnippet"}, fmta("\\left( <>\\right) ", { i(1) }), {condition = in_math}), + -- Add more for environments, etc. +} diff --git a/lua/mappings.lua b/lua/mappings.lua new file mode 100644 index 0000000..783b78f --- /dev/null +++ b/lua/mappings.lua @@ -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", "") + +-- map({ "n", "i", "v" }, "", " w ") diff --git a/lua/options.lua b/lua/options.lua new file mode 100644 index 0000000..738f20b --- /dev/null +++ b/lua/options.lua @@ -0,0 +1,6 @@ +require "nvchad.options" + +-- add yours here! + +-- local o = vim.o +-- o.cursorlineopt ='both' -- to enable cursorline! diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua new file mode 100644 index 0000000..d028655 --- /dev/null +++ b/lua/plugins/init.lua @@ -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" + -- }, + -- }, + -- }, +}