summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/core/lualine
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-01-13 19:12:32 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-01-13 19:12:32 +0100
commit73a60f5ee71bb60265ec0c97be7531a5e7605d8c (patch)
treed46283a3d04285c5a5ead92d5bbb3b1fe424b736 /.config/nvim/lua/core/lualine
parent19c1942757f07387b95db3ddbc39d9b561d5b51d (diff)
Remove bloat nvim config
Diffstat (limited to '.config/nvim/lua/core/lualine')
-rw-r--r--.config/nvim/lua/core/lualine/colors.lua19
-rw-r--r--.config/nvim/lua/core/lualine/components.lua179
-rw-r--r--.config/nvim/lua/core/lualine/conditions.lua17
-rw-r--r--.config/nvim/lua/core/lualine/init.lua47
-rw-r--r--.config/nvim/lua/core/lualine/styles.lua185
-rw-r--r--.config/nvim/lua/core/lualine/utils.lua27
6 files changed, 0 insertions, 474 deletions
diff --git a/.config/nvim/lua/core/lualine/colors.lua b/.config/nvim/lua/core/lualine/colors.lua
deleted file mode 100644
index f922d3f..0000000
--- a/.config/nvim/lua/core/lualine/colors.lua
+++ /dev/null
@@ -1,19 +0,0 @@
-local colors = {
- bg = "#171717",
- fg = "#D0D0D0",
- grey = "#D0D0D0",
- blue = "#569CD6",
- green = "#608B4E",
- yellow = "#DCDCAA",
- orange = "#FF8800",
- purple = "#C586C0",
- magenta = "#D16D9E",
- cyan = "#4EC9B0",
- red = "#D16969",
- error_red = "#F44747",
- warning_orange = "#FF8800",
- info_yellow = "#FFCC66",
- hint_blue = "#9CDCFE",
-}
-
-return colors
diff --git a/.config/nvim/lua/core/lualine/components.lua b/.config/nvim/lua/core/lualine/components.lua
deleted file mode 100644
index 42ec112..0000000
--- a/.config/nvim/lua/core/lualine/components.lua
+++ /dev/null
@@ -1,179 +0,0 @@
-local conditions = require "core.lualine.conditions"
-local colors = require "core.lualine.colors"
-
-local function diff_source()
- local gitsigns = vim.b.gitsigns_status_dict
- if gitsigns then
- return {
- added = gitsigns.added,
- modified = gitsigns.changed,
- removed = gitsigns.removed,
- }
- end
-end
-
-return {
- mode = {
- function()
- local alias = {
- n = "NORMAL",
- i = "INSERT",
- c = "COMMAND",
- V = "VISUAL",
- [""] = "VISUAL",
- v = "VISUAL",
- R = "REPLACE",
- }
- local alias_mode = alias[vim.fn.mode()]
- if alias_mode == nil then
- alias_mode = vim.fn.mode()
- end
- return alias_mode .. " "
- -- return " "
- end,
- padding = { left = 0, right = 0 },
- cond = nil,
- color = { fg = colors.fg, bg = colors.bg },
- },
- branch = {
- "b:gitsigns_head",
- icon = " ",
- color = { gui = "bold", fg = colors.fg, bg = colors.bg },
- cond = conditions.hide_in_width,
- },
- filename = {
- "filename",
- color = { fg = colors.fg, bg = colors.bg },
- cond = nil,
- },
- diff = {
- "diff",
- source = diff_source,
- symbols = { added = "  ", modified = "柳", removed = " " },
- diff_color = {
- added = { fg = colors.green },
- modified = { fg = colors.yellow },
- removed = { fg = colors.red },
- },
- color = {},
- cond = nil,
- },
- python_env = {
- function()
- local utils = require "core.lualine.utils"
- if vim.bo.filetype == "python" then
- local venv = os.getenv "CONDA_DEFAULT_ENV"
- if venv then
- return string.format("  (%s)", utils.env_cleanup(venv))
- end
- venv = os.getenv "VIRTUAL_ENV"
- if venv then
- return string.format("  (%s)", utils.env_cleanup(venv))
- end
- return ""
- end
- return ""
- end,
- color = { fg = colors.green },
- cond = conditions.hide_in_width,
- },
- diagnostics = {
- "diagnostics",
- sources = { "nvim_lsp" },
- symbols = { error = " ", warn = " ", info = " ", hint = " " },
- color = {},
- cond = conditions.hide_in_width,
- },
- treesitter = {
- function()
- local b = vim.api.nvim_get_current_buf()
- if next(vim.treesitter.highlighter.active[b]) then
- return "  "
- end
- return ""
- end,
- color = { fg = colors.green },
- cond = conditions.hide_in_width,
- },
- lsp = {
- function(msg)
- msg = msg or "LS Inactive"
- local buf_clients = vim.lsp.buf_get_clients()
- if next(buf_clients) == nil then
- if type(msg) == "boolean" or #msg == 0 then
- return "LS Inactive"
- end
- return msg
- end
- local buf_ft = vim.bo.filetype
- local buf_client_names = {}
-
- -- add client
- for _, client in pairs(buf_clients) do
- if client.name ~= "null-ls" then
- table.insert(buf_client_names, client.name)
- end
- end
-
- -- add formatter
- local formatters = require "lsp.null-ls.formatters"
- local supported_formatters = formatters.list_registered_providers(buf_ft)
- vim.list_extend(buf_client_names, supported_formatters)
-
- -- add linter
- local linters = require "lsp.null-ls.linters"
- local supported_linters = linters.list_registered_providers(buf_ft)
- vim.list_extend(buf_client_names, supported_linters)
-
- return "[" .. table.concat(buf_client_names, ", ") .. "]"
- end,
- color = { fg = colors.fg, bg = colors.bg },
- cond = conditions.hide_in_width,
- },
- location = { "location", cond = conditions.hide_in_width, color = {} },
- progress = { "progress", cond = conditions.hide_in_width, color = {} },
- spaces = {
- function()
- if not vim.api.nvim_buf_get_option(0, "expandtab") then
- return "Tab size: " .. vim.api.nvim_buf_get_option(0, "tabstop") .. " "
- end
- local size = vim.api.nvim_buf_get_option(0, "shiftwidth")
- if size == 0 then
- size = vim.api.nvim_buf_get_option(0, "tabstop")
- end
- return "Spaces: " .. size .. " "
- end,
- color = {},
- cond = conditions.hide_in_width,
- },
- encoding = {
- "o:encoding",
- fmt = string.upper,
- color = { fg = colors.fg, bg = colors.bg },
- cond = conditions.hide_in_width,
- },
- filetype = { "filetype", cond = conditions.hide_in_width, color = {} },
- scrollbar = {
- function()
- local current_line = vim.fn.line "."
- local total_lines = vim.fn.line "$"
- local chars = {
- "__",
- "▁▁",
- "▂▂",
- "▃▃",
- "▄▄",
- "▅▅",
- "▆▆",
- "▇▇",
- "██",
- }
- local line_ratio = current_line / total_lines
- local index = math.ceil(line_ratio * #chars)
- return chars[index]
- end,
- padding = { left = 0, right = 0 },
- cond = nil,
- color = { fg = colors.yellow, bg = colors.bg },
- },
-}
diff --git a/.config/nvim/lua/core/lualine/conditions.lua b/.config/nvim/lua/core/lualine/conditions.lua
deleted file mode 100644
index 6e120b2..0000000
--- a/.config/nvim/lua/core/lualine/conditions.lua
+++ /dev/null
@@ -1,17 +0,0 @@
-local window_width_limit = 70
-
-local conditions = {
- buffer_not_empty = function()
- return vim.fn.empty(vim.fn.expand "%:t") ~= 1
- end,
- hide_in_width = function()
- return vim.fn.winwidth(0) > window_width_limit
- end,
- -- check_git_workspace = function()
- -- local filepath = vim.fn.expand "%:p:h"
- -- local gitdir = vim.fn.finddir(".git", filepath .. ";")
- -- return gitdir and #gitdir > 0 and #gitdir < #filepath
- -- end,
-}
-
-return conditions
diff --git a/.config/nvim/lua/core/lualine/init.lua b/.config/nvim/lua/core/lualine/init.lua
deleted file mode 100644
index 7d67559..0000000
--- a/.config/nvim/lua/core/lualine/init.lua
+++ /dev/null
@@ -1,47 +0,0 @@
-local M = {}
-M.config = function()
- options.builtin.lualine = {
- active = true,
- style = "options",
- options = {
- icons_enabled = nil,
- component_separators = nil,
- section_separators = nil,
- theme = nil,
- disabled_filetypes = nil,
- },
- sections = {
- lualine_a = nil,
- lualine_b = nil,
- lualine_c = nil,
- lualine_x = nil,
- lualine_y = nil,
- lualine_z = nil,
- },
- inactive_sections = {
- lualine_a = nil,
- lualine_b = nil,
- lualine_c = nil,
- lualine_x = nil,
- lualine_y = nil,
- lualine_z = nil,
- },
- tabline = nil,
- extensions = nil,
- on_config_done = nil,
- }
-end
-
-M.setup = function()
- require("core.lualine.styles").update()
- require("core.lualine.utils").validate_theme()
-
- local lualine = require "lualine"
- lualine.setup(options.builtin.lualine)
-
- if options.builtin.lualine.on_config_done then
- options.builtin.lualine.on_config_done(lualine)
- end
-end
-
-return M
diff --git a/.config/nvim/lua/core/lualine/styles.lua b/.config/nvim/lua/core/lualine/styles.lua
deleted file mode 100644
index 8caf349..0000000
--- a/.config/nvim/lua/core/lualine/styles.lua
+++ /dev/null
@@ -1,185 +0,0 @@
-local M = {}
-local components = require "core.lualine.components"
-
-local styles = {
- lvim = nil,
- default = nil,
- none = nil,
- dark = nil,
-}
-
-styles.dark = {
- style = "dark",
- options = {
- icons_enabled = true,
- component_separators = { left = "", right = "" },
- section_separators = { left = "", right = "" },
- disabled_filetypes = { "dashboard", "NvimTree", "Outline" },
- },
- sections = {
- lualine_a = {
- components.mode,
- },
- lualine_b = {
- components.branch,
- components.filename,
- },
- lualine_c = {
- components.diff,
- components.python_env,
- },
- lualine_x = {
- components.diagnostics,
- components.treesitter,
- components.lsp,
- components.filetype,
- },
- lualine_y = {},
- lualine_z = {
- components.location,
- components.progress,
- components.encoding,
- },
- },
- inactive_sections = {
- lualine_a = {
- "filename",
- },
- lualine_b = {},
- lualine_c = {},
- lualine_x = {},
- lualine_y = {},
- lualine_z = {},
- },
- tabline = {},
- extensions = { "nvim-tree" },
-}
-
-styles.none = {
- style = "none",
- options = {
- icons_enabled = true,
- component_separators = { left = "", right = "" },
- section_separators = { left = "", right = "" },
- disabled_filetypes = {},
- },
- sections = {
- lualine_a = {},
- lualine_b = {},
- lualine_c = {},
- lualine_x = {},
- lualine_y = {},
- lualine_z = {},
- },
- inactive_sections = {
- lualine_a = {},
- lualine_b = {},
- lualine_c = {},
- lualine_x = {},
- lualine_y = {},
- lualine_z = {},
- },
- tabline = {},
- extensions = {},
-}
-
-styles.default = {
- style = "default",
- options = {
- icons_enabled = true,
- component_separators = { "", "" },
- section_separators = { "", "" },
- disabled_filetypes = {},
- },
- sections = {
- lualine_a = { "mode" },
- lualine_b = { "branch" },
- lualine_c = { "filename" },
- lualine_x = { "encoding", "fileformat", "filetype" },
- lualine_y = { "progress" },
- lualine_z = { "location" },
- },
- inactive_sections = {
- lualine_a = {},
- lualine_b = {},
- lualine_c = { "filename" },
- lualine_x = { "location" },
- lualine_y = {},
- lualine_z = {},
- },
- tabline = {},
- extensions = {},
-}
-
-styles.lvim = {
- style = "lvim",
- options = {
- icons_enabled = true,
- component_separators = { left = "", right = "" },
- section_separators = { left = "", right = "" },
- disabled_filetypes = { "dashboard" },
- },
- sections = {
- lualine_a = {
- components.mode,
- },
- lualine_b = {
- components.branch,
- components.filename,
- },
- lualine_c = {
- components.diff,
- components.python_env,
- },
- lualine_x = {
- components.diagnostics,
- components.treesitter,
- components.lsp,
- components.filetype,
- },
- lualine_y = {},
- lualine_z = {
- components.scrollbar,
- },
- },
- inactive_sections = {
- lualine_a = {
- "filename",
- },
- lualine_b = {},
- lualine_c = {},
- lualine_x = {},
- lualine_y = {},
- lualine_z = {},
- },
- tabline = {},
- extensions = { "nvim-tree" },
-}
-
-function M.get_style(style)
- local style_keys = vim.tbl_keys(styles)
- if not vim.tbl_contains(style_keys, style) then
- local Log = require "core.log"
- Log:error(
- "Invalid lualine style",
- string.format('"%s"', style),
- "options are: ",
- string.format('"%s"', table.concat(style_keys, '", "'))
- )
- Log:debug '"lvim" style is applied.'
- style = "lvim"
- end
-
- return vim.deepcopy(styles[style])
-end
-
-function M.update()
- local style = M.get_style(options.builtin.lualine.style)
- if options.builtin.lualine.options.theme == nil then
- options.builtin.lualine.options.theme = options.colorscheme
- end
-
- options.builtin.lualine = vim.tbl_deep_extend("keep", options.builtin.lualine, style)
-end
-
-return M
diff --git a/.config/nvim/lua/core/lualine/utils.lua b/.config/nvim/lua/core/lualine/utils.lua
deleted file mode 100644
index 48756a7..0000000
--- a/.config/nvim/lua/core/lualine/utils.lua
+++ /dev/null
@@ -1,27 +0,0 @@
-local M = {}
-
-function M.validate_theme()
- local theme = options.builtin.lualine.options.theme
- if type(theme) == "table" then
- return
- end
-
- local lualine_loader = require "lualine.utils.loader"
- local ok = pcall(lualine_loader.load_theme, theme)
- if not ok then
- options.builtin.lualine.options.theme = "auto"
- end
-end
-
-function M.env_cleanup(venv)
- if string.find(venv, "/") then
- local final_venv = venv
- for w in venv:gmatch "([^/]+)" do
- final_venv = w
- end
- venv = final_venv
- end
- return venv
-end
-
-return M