From 9981dee65a037f762edee79d8e6c39efee6206e4 Mon Sep 17 00:00:00 2001 From: Miguel Palhas Date: Sat, 5 Oct 2024 10:23:18 +0100 Subject: [PATCH] final config --- lazy-lock.json | 2 +- lua/chadrc.lua | 2 +- lua/configs/lspconfig.lua | 9 --------- lua/configs/typescript-tools.lua | 24 ++++++++++++++++++++++-- lua/options.lua | 1 - lua/plugins/lsp.lua | 21 +++++++++++++-------- lua/plugins/telescope.lua | 12 ++---------- lua/plugins/ui.lua | 2 +- 8 files changed, 40 insertions(+), 33 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 627a204..ab6c871 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -15,7 +15,7 @@ "hardtime.nvim": { "branch": "main", "commit": "6513bf42cd9261669d1ee41ff8b4065dfdc53a09" }, "hop.nvim": { "branch": "master", "commit": "8f51ef02700bb3cdcce94e92eff16170a6343c4f" }, "indent-blankline.nvim": { "branch": "master", "commit": "3af6493bf69e4a857a8b1fab36f333629d413a18" }, - "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, + "lazy.nvim": { "branch": "main", "commit": "1159bdccd8910a0fd0914b24d6c3d186689023d9" }, "local-highlight.nvim": { "branch": "master", "commit": "ae3ada3a332128b1036c84c8587b9069891c63da" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "menu": { "branch": "main", "commit": "e8a2ae036b71e4808a7c73cf12dbeaa3f7e4dd5c" }, diff --git a/lua/chadrc.lua b/lua/chadrc.lua index da4779c..a64ca96 100644 --- a/lua/chadrc.lua +++ b/lua/chadrc.lua @@ -6,7 +6,7 @@ local M = {} M.base46 = { - theme = "onedark", + theme = "catppuccin", -- hl_override = { -- Comment = { italic = true }, diff --git a/lua/configs/lspconfig.lua b/lua/configs/lspconfig.lua index 82351cd..a7178f7 100644 --- a/lua/configs/lspconfig.lua +++ b/lua/configs/lspconfig.lua @@ -3,11 +3,9 @@ require("nvchad.configs.lspconfig").defaults() local lspconfig = require "lspconfig" --- EXAMPLE local servers = { "html", "cssls", "lua_ls", "biome" } local nvlsp = require "nvchad.configs.lspconfig" --- lsps with default config for _, lsp in ipairs(servers) do lspconfig[lsp].setup { on_attach = nvlsp.on_attach, @@ -15,10 +13,3 @@ for _, lsp in ipairs(servers) do capabilities = nvlsp.capabilities, } end - --- configuring single server, example: typescript --- lspconfig.ts_ls.setup { --- on_attach = nvlsp.on_attach, --- on_init = nvlsp.on_init, --- capabilities = nvlsp.capabilities, --- } diff --git a/lua/configs/typescript-tools.lua b/lua/configs/typescript-tools.lua index cdbf5ee..0c84099 100644 --- a/lua/configs/typescript-tools.lua +++ b/lua/configs/typescript-tools.lua @@ -1,2 +1,22 @@ -require("typescript-tools").setup({ -}) +local nvlsp = require "nvchad.configs.lspconfig" + +local options = { + code_lens = "on", + expose_as_code_action = { + "fix_all", + "add_missing_imports", + -- "remove_unused", + -- "remove_unused_imports", + "organize_imports", + }, + server = { + on_attach = function(client, buffer) + client.server_capabilities.documentFormattingProvider = false + nvlsp.on_attach(client, buffer) + end, + on_init = nvlsp.on_init, + capabilities = nvlsp.capabilities, + }, +} + +require("typescript-tools").setup(options) diff --git a/lua/options.lua b/lua/options.lua index 23e1517..9327470 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -4,7 +4,6 @@ local o = vim.o -- o.cursorlineopt ='both' -- to enable cursorline! o.cursorlineopt = "both" -print "set number" -- line numbering o.number = true o.relativenumber = true diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 27f34cc..986aa6c 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -6,13 +6,18 @@ return { end, }, - { - "mrcjkb/rustaceanvim", - version = "^5", -- Recommended - lazy = false, -- This plugin is already lazy - }, + { + "mrcjkb/rustaceanvim", + version = "^5", + lazy = false, + }, - {"pmizio/typescript-tools.nvim",dependencies={"nvim-lua/plenary.nvim", "neovim/nvim-lspconfig"}, config=function() - require "configs.typescript-tools" - end} + { + "pmizio/typescript-tools.nvim", + ft = { "typescript", "typescriptreact" }, + dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" }, + config = function() + require "configs.typescript-tools" + end, + }, } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 026db9e..e0eabdd 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -6,16 +6,8 @@ return { end, keys = { { "", require("telescope.builtin").find_files, desc = "Find Files (root dir)" }, - { "", require("telescope.builtin").grep_string, desc = "Fast string grep" }, - { - "", - function() - local selection = vim.fn.getregion(vim.fn.getpos ".", vim.fn.getpos "v", { mode = vim.fn.mode() }) - require("telescope.builtin").live_grep { default_text = table.concat(selection) } - end, - desc = "fuzzy find selection", - mode = "v", - }, + { "", require("telescope.builtin").live_grep, desc = "Fast live grep" }, + { "", require("telescope.builtin").grep_string, desc = "Fast string grep" }, }, }, } diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index b13ba3b..807414b 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -1,6 +1,7 @@ return { { "levouh/tint.nvim", + event = "VeryLazy", config = function() require("tint").setup { tint = -10, @@ -22,7 +23,6 @@ return { require("statuscol").setup { relculright = true, segments = { - { text = { builtin.foldfunc }, click = "v:lua.ScFa" }, { text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" }, { sign = { name = { ".*" }, maxwidth = 1, colwidth = 1 }, click = "v:lua.ScSa" }, },