From 726248c2f337f3b9edb700f6c6d984c59f190da6 Mon Sep 17 00:00:00 2001 From: siduck Date: Mon, 18 Mar 2024 06:34:01 +0530 Subject: [PATCH] add nvchad_types & .stylua.toml --- .stylua.toml | 6 ++++++ lua/chadrc.lua | 8 +++++++- lua/configs/conform.lua | 10 ++++++++-- lua/configs/lspconfig.lua | 23 +++++++++++++++++++++++ lua/options.lua | 3 +++ lua/plugins/init.lua | 34 ++++++++++++++++++++++++++++------ 6 files changed, 75 insertions(+), 9 deletions(-) create mode 100644 .stylua.toml create mode 100644 lua/configs/lspconfig.lua 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/lua/chadrc.lua b/lua/chadrc.lua index 1009e74..4fd7cfa 100644 --- a/lua/chadrc.lua +++ b/lua/chadrc.lua @@ -1,7 +1,13 @@ +---@type ChadrcConfig local M = {} M.ui = { - theme = "onedark", + theme = "onedark", + + -- hl_override = { + -- Comment = { italic = true }, + -- ["@comment"] = { italic = true }, + -- }, } return M diff --git a/lua/configs/conform.lua b/lua/configs/conform.lua index 8660a60..a000447 100644 --- a/lua/configs/conform.lua +++ b/lua/configs/conform.lua @@ -1,9 +1,15 @@ local options = { - lsp_fallback = true, - 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) diff --git a/lua/configs/lspconfig.lua b/lua/configs/lspconfig.lua new file mode 100644 index 0000000..a73657a --- /dev/null +++ b/lua/configs/lspconfig.lua @@ -0,0 +1,23 @@ +-- EXAMPLE +local on_attach = require("nvchad.configs.lspconfig").on_attach +local on_init = require("nvchad.configs.lspconfig").on_init +local capabilities = require("nvchad.configs.lspconfig").capabilities + +local lspconfig = require "lspconfig" +local servers = { "html", "cssls" } + +-- lsps with default config +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + on_attach = on_attach, + on_init = on_init, + capabilities = capabilities, + } +end + +-- typescript +lspconfig.tsserver.setup { + on_attach = on_attach, + on_init = on_init, + capabilities = capabilities, +} diff --git a/lua/options.lua b/lua/options.lua index 566eb80..738f20b 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -1,3 +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 index 8efbcdf..d3c9688 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,15 +1,37 @@ return { { "stevearc/conform.nvim", + -- event = 'BufWritePre' -- uncomment for format on save config = function() require "configs.conform" end, }, - { - "nvim-tree/nvim-tree.lua", - opts = { - git = { enable = true }, - }, - }, + -- { + -- "neovim/nvim-lspconfig", + -- config = function() + -- require("nvchad.configs.lspconfig").defaults() + -- require "configs.lspconfig" + -- end, + -- }, + + -- { + -- "williamboman/mason.nvim", + -- opts = { + -- ensure_installed = { + -- "lua-language-server", "stylua", + -- "html-lsp", "css-lsp" , "prettier" + -- }, + -- }, + -- }, + -- + -- { + -- "nvim-treesitter/nvim-treesitter", + -- opts = { + -- ensure_installed = { + -- "vim", "lua", "vimdoc + -- "html", "css" + -- }, + -- }, + -- }, }