aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyriaque Skrapits <cysoun@gmail.com>2023-10-27 21:48:55 +0200
committerGitHub <noreply@github.com>2023-10-27 21:48:55 +0200
commit9fec01149ec391194f9eaa0d5e3926f14a9e0b80 (patch)
tree142037289773828fff7521456e74188d772987ee
parentf02ce208852d5682c4a088e40ad9958bfb6180a4 (diff)
downloadlite-xl-plugins-9fec01149ec391194f9eaa0d5e3926f14a9e0b80.tar.gz
lite-xl-plugins-9fec01149ec391194f9eaa0d5e3926f14a9e0b80.zip
gitstatus: color icons as well (#164)
* gitstatus: also color icons * gitstatus: add flag to toggle colored icons * gitstatus: add `color_icons` in config_spec * gitstatus: bump version to 0.2 * Update plugins/gitstatus.lua Co-authored-by: Guldoman <giulio.lettieri@gmail.com> --------- Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
-rw-r--r--manifest.json2
-rw-r--r--plugins/gitstatus.lua17
2 files changed, 18 insertions, 1 deletions
diff --git a/manifest.json b/manifest.json
index 2f7163c..2ce4030 100644
--- a/manifest.json
+++ b/manifest.json
@@ -478,7 +478,7 @@
},
{
"description": "Displays git branch and insert/delete count in status bar *([screenshot](https://user-images.githubusercontent.com/3920290/81107223-bcea3080-8f0e-11ea-8fc7-d03173f42e33.png))*",
- "version": "0.1",
+ "version": "0.2",
"path": "plugins/gitstatus.lua",
"id": "gitstatus",
"mod_version": "3"
diff --git a/plugins/gitstatus.lua b/plugins/gitstatus.lua
index 9a36142..04f6b15 100644
--- a/plugins/gitstatus.lua
+++ b/plugins/gitstatus.lua
@@ -7,11 +7,19 @@ local StatusView = require "core.statusview"
local TreeView = require "plugins.treeview"
config.plugins.gitstatus = common.merge({
+ color_icons = true,
recurse_submodules = true,
-- The config specification used by the settings gui
config_spec = {
name = "Git Status",
{
+ label = "Colorize icons",
+ description = "Colorize the icons as well",
+ path = "color_icons",
+ type = "toggle",
+ default = true
+ },
+ {
label = "Recurse Submodules",
description = "Also retrieve git stats from submodules.",
path = "recurse_submodules",
@@ -39,6 +47,15 @@ function TreeView:get_item_text(item, active, hovered)
return text, font, color
end
+-- Override TreeView's get_item_icon to add modification color
+local treeview_get_item_icon = TreeView.get_item_icon
+function TreeView:get_item_icon(item, active, hovered)
+ local character, font, color = treeview_get_item_icon(self, item, active, hovered)
+ if config.plugins.gitstatus and config.plugins.gitstatus.color_icons and cached_color_for_item[item.abs_filename] then
+ color = cached_color_for_item[item.abs_filename]
+ end
+ return character, font, color
+end
local git = {
branch = nil,