diff --git a/lazy-lock.json b/lazy-lock.json index fdc2ca2..e483742 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,8 +1,8 @@ { - "CopilotChat.nvim": { "branch": "main", "commit": "1b375c24602680b5fe28c3c223a822111857dc37" }, + "CopilotChat.nvim": { "branch": "main", "commit": "834ba1bc71e1a146831be0ebfeb456ad252c3c56" }, "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, "NvChad": { "branch": "v2.5", "commit": "6f25b2739684389ca69ea8229386c098c566c408" }, - "auto-session": { "branch": "main", "commit": "41ac59e5f400b3f4f9b11e478ccf6e077de5f6c7" }, + "auto-session": { "branch": "main", "commit": "82630e2f70be140f8dcc75a12e2ee2839e8488c2" }, "base46": { "branch": "v2.5", "commit": "fde7a2cd54599e148d376f82980407c2d24b0fa2" }, "bufresize.nvim": { "branch": "master", "commit": "3b19527ab936d6910484dcc20fb59bdb12322d8b" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, @@ -15,34 +15,34 @@ "conform.nvim": { "branch": "master", "commit": "363243c03102a531a8203311d4f2ae704c620d9b" }, "copilot.lua": { "branch": "master", "commit": "886ee73b6d464b2b3e3e6a7ff55ce87feac423a9" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "fidget.nvim": { "branch": "main", "commit": "a0abbf18084b77d28bc70e24752e4f4fd54aea17" }, + "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, "focus.nvim": { "branch": "master", "commit": "d76338e58e49f844e8f6a7aff16a74a2a55a80ef" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "fzf-lua": { "branch": "main", "commit": "aaf7604bca38890cb487b29738f8cb02586bc818" }, - "gitsigns.nvim": { "branch": "main", "commit": "9b36d497495436c135659902054ee637e0ba6021" }, + "fzf-lua": { "branch": "main", "commit": "394ddb2b80c58731c09b5775ca5d05d578b1de3d" }, + "gitsigns.nvim": { "branch": "main", "commit": "8974fd397e854bfa13a5130dc32ee357dbade276" }, "indent-blankline.nvim": { "branch": "master", "commit": "e10626f7fcd51ccd56d7ffc00883ba7e0aa28f78" }, - "lazy.nvim": { "branch": "main", "commit": "7527af40ddd4a93a02911be570b32609b9d4ea53" }, + "lazy.nvim": { "branch": "main", "commit": "f15a93907ddad3d9139aea465ae18336d87f5ce6" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "f75e877f5266e87523eb5a18fcde2081820d087b" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "menu": { "branch": "main", "commit": "7769b17c2a131108c02b10e9f844e504aa605cc2" }, - "mini.pick": { "branch": "main", "commit": "100f283e65b44cca47763bf38f1d0f90b4116646" }, + "mini.pick": { "branch": "main", "commit": "93a9975d94b39b287183f95191431db13ae82c44" }, "minty": { "branch": "main", "commit": "6dce9f097667862537823d515a0250ce58faab05" }, "neogit": { "branch": "master", "commit": "63124cf520ff24d09deb3b850e053908ab0fc66a" }, "nvim-autopairs": { "branch": "master", "commit": "3d02855468f94bf435db41b661b58ec4f48a06b7" }, "nvim-bufdel": { "branch": "main", "commit": "523d58e94e7212fff3e05c247b962dc8f93bcfde" }, "nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" }, - "nvim-dap": { "branch": "master", "commit": "b4f27d451c187de912fa8d3229025a952917eb9e" }, - "nvim-lspconfig": { "branch": "master", "commit": "ead2fbc4893fdd062e1dd0842679a48bfb7bac5c" }, - "nvim-tree.lua": { "branch": "master", "commit": "d05881f65f0a653db8d830ccc4d2e07d6a720628" }, - "nvim-treesitter": { "branch": "master", "commit": "7e3942ceca9e0c28760f77ac33bc16399146d879" }, - "nvim-web-devicons": { "branch": "master", "commit": "1c9136332840edee0c593f2f4f89598c8ed97f5f" }, + "nvim-dap": { "branch": "master", "commit": "52302f02fea3a490e55475de52fa4deb8af2eb11" }, + "nvim-lspconfig": { "branch": "master", "commit": "00dae9f5f4ad215d4561f2fd2f26478c48b0ca7f" }, + "nvim-tree.lua": { "branch": "master", "commit": "70825f23db61ecd900c4cfea169bffe931926a9d" }, + "nvim-treesitter": { "branch": "master", "commit": "824bf8455fd670186986fb3eb46fcaa4c5460949" }, + "nvim-web-devicons": { "branch": "master", "commit": "402377242b04be3f4f0f3720bd952df86e946c30" }, "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "cf0da2516b0684596b09c51dbc93c609cdc2f455" }, "telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" }, - "ui": { "branch": "v3.0", "commit": "e196e36b088e12b7082e2665a58be15f7d709460" }, + "ui": { "branch": "v3.0", "commit": "7f70aac4ad4741c48a2d2f5abac84c06de226c5f" }, "undotree": { "branch": "master", "commit": "2556c6800b210b2096b55b66e74b4cc1d9ebbe4f" }, - "vim-fugitive": { "branch": "master", "commit": "d74a7cff4cfcf84f83cc7eccfa365488f3bbabc2" }, + "vim-fugitive": { "branch": "master", "commit": "b068eaf1e6cbe35d1ac100d435cd7f7b74a5c87d" }, "vim-suda": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" }, "volt": { "branch": "main", "commit": "3bedb1576db574af160643eea7df3b09dbe5ee9c" }, "which-key.nvim": { "branch": "main", "commit": "0e76a87ac51772569aec678dc74baa8e2a86100c" } diff --git a/lua/configs/lspconfig.lua b/lua/configs/lspconfig.lua index 8e72635..0dba563 100644 --- a/lua/configs/lspconfig.lua +++ b/lua/configs/lspconfig.lua @@ -1,10 +1,10 @@ local cmp = require("cmp") local cmp_lsp = require("cmp_nvim_lsp") local capabilities = vim.tbl_deep_extend( - "force", - {}, - vim.lsp.protocol.make_client_capabilities(), - cmp_lsp.default_capabilities() + "force", + {}, + vim.lsp.protocol.make_client_capabilities(), + cmp_lsp.default_capabilities() ) @@ -12,78 +12,78 @@ require("nvchad.configs.lspconfig").defaults() require("fidget").setup({}) require("mason").setup() require("mason-lspconfig").setup({ - ensure_installed = { - "lua_ls", - "rust_analyzer", - "gopls", - }, - handlers = { - function(server_name) -- default handler (optional) - require("lspconfig")[server_name].setup { - capabilities = capabilities - } - end, - - zls = function() - local lspconfig = require("lspconfig") - lspconfig.zls.setup({ - root_dir = lspconfig.util.root_pattern(".git", "build.zig", "zls.json"), - settings = { - zls = { - enable_inlay_hints = true, - enable_snippets = true, - warn_style = true, - }, - }, - }) - vim.g.zig_fmt_parse_errors = 0 - vim.g.zig_fmt_autosave = 0 - - end, - ["lua_ls"] = function() - local lspconfig = require("lspconfig") - lspconfig.lua_ls.setup { - capabilities = capabilities, - settings = { - Lua = { - runtime = { version = "Lua 5.1" }, - diagnostics = { - globals = { "bit", "vim", "it", "describe", "before_each", "after_each" }, + ensure_installed = { + "lua_ls", + "rust_analyzer", + "gopls", + }, + handlers = { + function(server_name) -- default handler (optional) + require("lspconfig")[server_name].setup { + capabilities = capabilities } - } - } - } - end, - } + end, + + zls = function() + local lspconfig = require("lspconfig") + lspconfig.zls.setup({ + root_dir = lspconfig.util.root_pattern(".git", "build.zig", "zls.json"), + settings = { + zls = { + enable_inlay_hints = true, + enable_snippets = true, + warn_style = true, + }, + }, + }) + vim.g.zig_fmt_parse_errors = 0 + vim.g.zig_fmt_autosave = 0 + + end, + ["lua_ls"] = function() + local lspconfig = require("lspconfig") + lspconfig.lua_ls.setup { + capabilities = capabilities, + settings = { + Lua = { + runtime = { version = "Lua 5.1" }, + diagnostics = { + globals = { "bit", "vim", "it", "describe", "before_each", "after_each" }, + } + } + } + } + end, + } }) local cmp_select = { behaivior = cmp.SelectBehavior.Select } cmp.setup({ - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) -- For `luasnip` users. - end, - }, - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'luasnip' }, -- For luasnip users. - }, - { - { name = 'buffer' }, - }) + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + end, + }, + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, -- For luasnip users. + }, + { + { name = 'buffer' }, + }) }) vim.diagnostic.config({ - -- update_in_insert = true, - float = { - focusable = false, - style = "minimal", - border = "rounded", - source = "always", - header = "", - prefix = "", - }, + -- update_in_insert = true, + float = { + focusable = false, + style = "minimal", + border = "rounded", + source = "always", + header = "", + prefix = "", + }, }) local lspconfig = require "lspconfig" @@ -91,26 +91,48 @@ local nvlsp = require "nvchad.configs.lspconfig" -- EXAMPLE local servers = { - "html", - "cssls", - "bashls", - "texlab", - "hyprls", - "pyright", - "ts_ls", - "java_language_server", - "sourcekit", + "html", + "cssls", + "bashls", + "texlab", + "pyright", + "ts_ls", + "jdtls", + "sourcekit", + "zls", +} + +lspconfig.hyprls.setup { + on_attach = nvlsp.on_attach, + root_dir = function( fname ) + local root_files = { + 'hyprland.conf', + 'hypridle.conf', + 'hyprlock.conf', + 'hyprpaper.conf', + 'hyprshade.conf', + } + local util = require 'lspconfig/util' + local root = util.root_pattern(unpack(root_files))(fname) or util.path.dirname(fname) + if root and string.match( root, '~/.config/hypr/' ) then + return root + else + return nil + end + end, + filetypes = { 'conf' }, } -- 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, - } + lspconfig[lsp].setup { + on_attach = nvlsp.on_attach, + on_init = nvlsp.on_init, + capabilities = nvlsp.capabilities, + } end + -- configuring single server, example: typescript -- lspconfig.ts_ls.setup { -- on_attach = nvlsp.on_attach, diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index a92e92e..48c5e76 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -58,6 +58,7 @@ return { -- { -- "mfussenegger/nvim-jdtls", + -- lazy = true, -- dependencies = { -- "mfussenegger/nvim-dap", -- },