From 3cce002220cdf2cb890681fd8713933ecfcdc7e3 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Sun, 3 Mar 2024 20:51:27 +0545 Subject: [PATCH] ux(nvim): changed lualine path and some other modules --- config/nvim/.github/README.md | 1 + config/nvim/lazy-lock.json | 18 +-- .../lua/plugins/extras/lang/web/html-css.lua | 1 + .../extras/ui/colorschemes/synthweave.lua | 6 + config/nvim/lua/plugins/lualine.lua | 109 ++++++++++++++++-- 5 files changed, 117 insertions(+), 18 deletions(-) create mode 100644 config/nvim/lua/plugins/extras/ui/colorschemes/synthweave.lua diff --git a/config/nvim/.github/README.md b/config/nvim/.github/README.md index 5e1ff85a..47184461 100644 --- a/config/nvim/.github/README.md +++ b/config/nvim/.github/README.md @@ -59,6 +59,7 @@ 🎨 Colorscheme - [rockerBOO/boo-colorscheme-nvim](https://dotfyle.com/plugins/rockerBOO/boo-colorscheme-nvim) +- [samharju/synthweave.nvim](https://dotfyle.com/plugins/samharju/synthweave.nvim) - [HoNamDuong/hybrid.nvim](https://dotfyle.com/plugins/HoNamDuong/hybrid.nvim) - [craftzdog/solarized-osaka.nvim](https://dotfyle.com/plugins/craftzdog/solarized-osaka.nvim) - [shaunsingh/moonlight.nvim](https://dotfyle.com/plugins/shaunsingh/moonlight.nvim) diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json index 6b4a95e7..c999880d 100644 --- a/config/nvim/lazy-lock.json +++ b/config/nvim/lazy-lock.json @@ -1,6 +1,6 @@ { "LazyVim": { "branch": "main", "commit": "fe72424e77cb9c953084bbcaaa0eb7fe8056dc70" }, - "LuaSnip": { "branch": "master", "commit": "f3b3d3446bcbfa62d638b1903ff00a78b2b730a1" }, + "LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" }, "SchemaStore.nvim": { "branch": "main", "commit": "ebe6fe2e78c19a0cf6e82752ab6f3ac55c35ef99" }, "actions-preview.nvim": { "branch": "master", "commit": "5c240e6356156b72cfbf7c05feefadae61d7a06f" }, "autolist.nvim": { "branch": "main", "commit": "5f70a5f99e96c8fe3069de042abd2a8ed2deb855" }, @@ -15,7 +15,7 @@ "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "codeium.vim": { "branch": "main", "commit": "f2d90dedb45e35f7563d2ce3a31c6928f79de678" }, "compiler.nvim": { "branch": "main", "commit": "fa69804f6eb4911eb62d8423a87323762d610448" }, - "conform.nvim": { "branch": "master", "commit": "f882877f03ebd46067c6a5493d259c4b9a9280f0" }, + "conform.nvim": { "branch": "master", "commit": "34b81e70da83e26c048290204de44268eb59814e" }, "dashboard-nvim": { "branch": "master", "commit": "413442b12d85315fc626c44a0ce4929b213ef604" }, "dial.nvim": { "branch": "master", "commit": "27eb570085db2ef44bff4f620d3806039184651c" }, "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" }, @@ -39,7 +39,7 @@ "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "3614a39aae98ccd34124b072939d6283853b3dd2" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "67210c0e775adec55de9826b038e8b62de554afc" }, "mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" }, "mini.ai": { "branch": "main", "commit": "ee9446a17c160aba6a04ff22097389c41872c878" }, "mini.bufremove": { "branch": "main", "commit": "931a3bb514147d9e812767275c4beba6b779b1d3" }, @@ -49,7 +49,7 @@ "mini.surround": { "branch": "main", "commit": "a1b590cc3b676512de507328d6bbab5e43794720" }, "multicursors.nvim": { "branch": "main", "commit": "8b3e14682eed06a532b155c7eae33e174846b3fd" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "f3941c57ec85d7bdb44fa53fd858fd80f159018f" }, - "neoconf.nvim": { "branch": "main", "commit": "2feab3abaa2c00dc21f490619f5c0f4ccf0ba495" }, + "neoconf.nvim": { "branch": "main", "commit": "8d7150e9d6113f01421c34c5aeb0f586afa232e0" }, "neodev.nvim": { "branch": "main", "commit": "84e0290f5600e8b89c0dfcafc864f45496a53400" }, "neogen": { "branch": "main", "commit": "70127baaff25611deaf1a29d801fc054ad9d2dc1" }, "noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" }, @@ -61,12 +61,12 @@ "nvim-devdocs": { "branch": "master", "commit": "521d24661ffe6d1ba025debea2675c765a9c1ee1" }, "nvim-lint": { "branch": "master", "commit": "e824adb9bc01647f71e55457353a68f0f37f9931" }, "nvim-lsp-file-operations": { "branch": "master", "commit": "223aca86b737dc66e9c51ebcda8788a8d9cc6cf2" }, - "nvim-lspconfig": { "branch": "master", "commit": "9553725789be682ecd945a527ec552e489ea8534" }, + "nvim-lspconfig": { "branch": "master", "commit": "c932a56bf25167b1e88d2a1ebe35bb774b41019a" }, "nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" }, - "nvim-puppeteer": { "branch": "main", "commit": "00d526d6d24a1316a6b14cf2df4b738009f70d2e" }, + "nvim-puppeteer": { "branch": "main", "commit": "d72c7045683c0960e9ae6ae9628d0907b2cab9f3" }, "nvim-recorder": { "branch": "main", "commit": "bf9efe10bff3ae8461568eee7f0d6c8750b01569" }, "nvim-spectre": { "branch": "master", "commit": "3712ff0cdf4f9f877d9ca708d835a877d9a0abaf" }, - "nvim-treesitter": { "branch": "master", "commit": "a47540fd737eb5c03ee21ee69eb8134ce5568fb6" }, + "nvim-treesitter": { "branch": "master", "commit": "8a9bef9327bc06c9c4158d4873d87bb1bf3ed112" }, "nvim-treesitter-context": { "branch": "master", "commit": "b8d1ffe58a88e0356da56b167373e89c4579ce15" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "60e8c288e011403f248b5f6478dde12bed8a6c55" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "95933e762e28f9d38b572d65e7e4da9d2f4d90cb" }, @@ -75,7 +75,7 @@ "nvim-various-textobjs": { "branch": "main", "commit": "3782eb41a964f45788843e34f325a470f0dc6757" }, "nvim-web-devicons": { "branch": "master", "commit": "4adea17610d140a99c313e3f79a9dc01825d59ae" }, "nvim_context_vt": { "branch": "master", "commit": "8f7b6b46292e0819290b0d368abc3366b8a163fc" }, - "obsidian.nvim": { "branch": "main", "commit": "6eb67075a25795c9098badb21ba69ea220942e1e" }, + "obsidian.nvim": { "branch": "main", "commit": "ab6877f194d16c05e9c1621ea4aee86b5ab0c255" }, "outline.nvim": { "branch": "main", "commit": "a8d40aecb799196303ff3521c0e31c87bba57198" }, "overseer.nvim": { "branch": "master", "commit": "4855aefcf335bbac71eea9c6a888958fb1ed1e1a" }, "package-info.nvim": { "branch": "master", "commit": "45acce5b12ce824332d8000cc2c91805b6710446" }, @@ -86,7 +86,7 @@ "refactoring.nvim": { "branch": "master", "commit": "94444558fc651b7e36f39d86c518e44b4de15123" }, "search-replace.nvim": { "branch": "main", "commit": "d92290a02d97f4e9b8cd60d28b56b403432158d5" }, "semshi": { "branch": "master", "commit": "0182447e2ff4dfa04cd2dfe5f189e012c581ca45" }, - "smart-splits.nvim": { "branch": "master", "commit": "0cf7149b3be7da8d5a501344630240638afdd440" }, + "smart-splits.nvim": { "branch": "master", "commit": "07fa44c36c2fb4e82b3a96b7ed5472e034f2a2d4" }, "sqlite.lua": { "branch": "master", "commit": "40701b6151f8883980c1548647116de39b763540" }, "suda.vim": { "branch": "master", "commit": "8b0fc3711760195aba104e2d190cff9af8267052" }, "telescope-floaterm.nvim": { "branch": "main", "commit": "ccd3f40ae30dce5de0e5d0f5069e08e7d9ad6d23" }, diff --git a/config/nvim/lua/plugins/extras/lang/web/html-css.lua b/config/nvim/lua/plugins/extras/lang/web/html-css.lua index cee8ac18..873d84d0 100644 --- a/config/nvim/lua/plugins/extras/lang/web/html-css.lua +++ b/config/nvim/lua/plugins/extras/lang/web/html-css.lua @@ -16,6 +16,7 @@ return { emmet_language_server = {}, html = {}, cssmodules_ls = {}, + css_variables = {}, cssls = { lint = { compatibleVendorPrefixes = "ignore", diff --git a/config/nvim/lua/plugins/extras/ui/colorschemes/synthweave.lua b/config/nvim/lua/plugins/extras/ui/colorschemes/synthweave.lua new file mode 100644 index 00000000..6c06ffe5 --- /dev/null +++ b/config/nvim/lua/plugins/extras/ui/colorschemes/synthweave.lua @@ -0,0 +1,6 @@ +return { + "samharju/synthweave.nvim", + name = "synthweave", + lazy = false, + opts = {}, +} diff --git a/config/nvim/lua/plugins/lualine.lua b/config/nvim/lua/plugins/lualine.lua index 5db552d5..e88cc940 100644 --- a/config/nvim/lua/plugins/lualine.lua +++ b/config/nvim/lua/plugins/lualine.lua @@ -1,28 +1,109 @@ +local util = require("lazyvim.util") + +-- Format and pretty_path extracted from https://github.com/LazyVim/LazyVim/discussions/2605 +local function format(component, text, hl_group) + if not hl_group then + return text + end + + ---@type table + component.hl_cache = component.hl_cache or {} + local lualine_hl_group = component.hl_cache[hl_group] + if not lualine_hl_group then + local utils = require("lualine.utils.utils") + local mygui = function() + local mybold = utils.extract_highlight_colors(hl_group, "bold") and "bold" + local myitalic = utils.extract_highlight_colors(hl_group, "italic") and "italic" + if mybold and myitalic then + return mybold .. "," .. myitalic + elseif mybold then + return mybold + elseif myitalic then + return myitalic + else + return "" + end + end + + lualine_hl_group = component:create_hl({ + fg = utils.extract_highlight_colors(hl_group, "fg"), + gui = mygui(), + }, "LV_" .. hl_group) + component.hl_cache[hl_group] = lualine_hl_group + end + return component:format_hl(lualine_hl_group) .. text .. component:get_default_hl() +end + +local function pretty_path(opts) + opts = vim.tbl_extend("force", { + relative = "cwd", + modified_hl = "NeogitGraphBoldYellow", + filename_hl = "NeogitGraphBoldWhite", + dirpath_hl = "Conceal", + }, opts or {}) + + return function(self) + local path = vim.fn.expand("%:p") --[[@as string]] + if path == "" then + return "" + end + + local root = util.root.get({ normalize = true }) + local cwd = util.root.cwd() + + if opts.relative == "cwd" and path:find(cwd, 1, true) == 1 then + path = path:sub(#cwd + 2) + else + path = path:sub(#root + 2) + end + + local sep = package.config:sub(1, 1) + local parts = vim.split(path, "[\\/]") + + if #parts > 3 then + parts = { parts[1], "…", parts[#parts - 1], parts[#parts] } + end + + if opts.modified_hl and vim.bo.modified then + parts[#parts] = format(self, parts[#parts], opts.modified_hl) + else + parts[#parts] = format(self, parts[#parts], opts.filename_hl) + end + + local dirpath = "" + if #parts > 1 then + dirpath = table.concat({ unpack(parts, 1, #parts - 1) }, sep) + dirpath = format(self, dirpath .. sep, opts.dirpath_hl) + end + return dirpath .. parts[#parts] + end +end + local lsp = function() local buf_clients = vim.lsp.get_clients({ bufnr = 0 }) if #buf_clients == 0 then return "" - else - return " " end + + return " " end local formatter = function() local formatters = require("conform").list_formatters(0) if #formatters == 0 then return "" - else - return "󰛖 " end + + return "󰛖 " end local linter = function() local linters = require("lint").linters_by_ft[vim.bo.filetype] if #linters == 0 then return "" - else - return "󱉶 " end + + return "󱉶 " end return { @@ -31,12 +112,22 @@ return { opts.options.component_separators = { left = "", right = "" } opts.options.section_separators = { left = "", right = "" } + opts.sections.lualine_a = { { "mode", icon = "" } } + opts.sections.lualine_c[4] = { pretty_path({ filename_hl = "Bold", modified_hl = "MatchParen" }) } + table.insert(opts.sections.lualine_x, 2, lsp) table.insert(opts.sections.lualine_x, 2, formatter) table.insert(opts.sections.lualine_x, 2, linter) - opts.sections.lualine_a = { { "mode", icon = "" } } - opts.sections.lualine_y = { { "progress", icon = "", separator = " ", padding = { left = 1, right = 1 } } } - opts.sections.lualine_z = { { "location", icon = "", padding = { left = 1, right = 1 } } } + opts.sections.lualine_y = { "progress" } + opts.sections.lualine_z = { + { "location", separator = "" }, + { + function() + return "" + end, + padding = { left = 0, right = 1 }, + }, + } opts.extensions = { "lazy", "man",