From 90b457b768b0f32234fe9cea5ea54d03573a99c8 Mon Sep 17 00:00:00 2001 From: bivashy Date: Sat, 31 May 2025 20:02:10 +0500 Subject: [PATCH] Format project, setup conform format on save, remove redundant commented pieces --- README.md | 5 ++--- lua/chadrc.lua | 21 ++++++++------------- lua/configs/conform.lua | 11 ++++------- lua/configs/lspconfig.lua | 2 -- lua/configs/treesitter.lua | 10 ++++++++++ lua/mappings.lua | 4 ---- lua/options.lua | 8 ++++---- lua/plugins/init.lua | 25 +++++++++---------------- 8 files changed, 37 insertions(+), 49 deletions(-) create mode 100644 lua/configs/treesitter.lua diff --git a/README.md b/README.md index dc0deaa..f2e54c7 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ -**This repo is supposed to used as config by NvChad users!** +**NvChad modified!** - 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 :) +- Modification for personal use # Credits diff --git a/lua/chadrc.lua b/lua/chadrc.lua index 29b83c6..a505152 100644 --- a/lua/chadrc.lua +++ b/lua/chadrc.lua @@ -1,24 +1,19 @@ --- This file needs to have same structure as nvconfig.lua +-- 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 :( +-- Please read that file to know all available options :( ---@type ChadrcConfig local M = {} M.base46 = { - theme = "onedark", + theme = "onedark", - -- hl_override = { - -- Comment = { italic = true }, - -- ["@comment"] = { italic = true }, - -- }, + hl_override = { + Comment = { italic = true }, + ["@comment"] = { italic = true }, + }, } --- M.nvdash = { load_on_startup = 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 index 35ba6cf..e6591c4 100644 --- a/lua/configs/conform.lua +++ b/lua/configs/conform.lua @@ -1,15 +1,12 @@ 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, - -- }, + format_on_save = { + timeout_ms = 500, + lsp_fallback = true, + }, } return options diff --git a/lua/configs/lspconfig.lua b/lua/configs/lspconfig.lua index 20a0cce..12fb517 100644 --- a/lua/configs/lspconfig.lua +++ b/lua/configs/lspconfig.lua @@ -2,5 +2,3 @@ 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/configs/treesitter.lua b/lua/configs/treesitter.lua new file mode 100644 index 0000000..4ebef77 --- /dev/null +++ b/lua/configs/treesitter.lua @@ -0,0 +1,10 @@ +return { + ensure_installed = { "lua", "luadoc", "printf", "vim", "vimdoc" }, + + highlight = { + enable = true, + use_languagetree = true, + }, + + indent = { enable = true }, +} diff --git a/lua/mappings.lua b/lua/mappings.lua index 2e3ecd9..c870117 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -1,11 +1,7 @@ require "nvchad.mappings" --- add yours here - local map = vim.keymap.set map("n", ";", ":", { desc = "CMD enter command mode" }) map("i", "jk", "") map("n", "cd", ":cd ..", { desc = "Go to parent directory" }) - --- map({ "n", "i", "v" }, "", " w ") diff --git a/lua/options.lua b/lua/options.lua index 738f20b..2e4790e 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -1,6 +1,6 @@ require "nvchad.options" --- add yours here! - --- local o = vim.o --- o.cursorlineopt ='both' -- to enable cursorline! +local o = vim.o +o.shiftwidth = 4 +o.tabstop = 4 +o.softtabstop = 4 diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 5b500e8..176b5f2 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,11 +1,10 @@ return { { "stevearc/conform.nvim", - -- event = 'BufWritePre', -- uncomment for format on save + event = "BufWritePre", opts = require "configs.conform", }, - -- These are some examples, uncomment them if you want to see them work! { "neovim/nvim-lspconfig", config = function() @@ -18,7 +17,7 @@ return { "natecraddock/workspaces.nvim", config = function() require("workspaces").setup() - end + end, }, { @@ -27,18 +26,12 @@ return { local conf = require "nvchad.configs.nvimtree" conf.renderer.group_empty = true return conf - end + end, + }, + { + "nvim-treesitter/nvim-treesitter", + opts = { + require "configs.treesitter", + }, }, - -- test new blink - -- { import = "nvchad.blink.lazyspec" }, - - -- { - -- "nvim-treesitter/nvim-treesitter", - -- opts = { - -- ensure_installed = { - -- "vim", "lua", "vimdoc", - -- "html", "css" - -- }, - -- }, - -- }, }