From 1736e8e72f3bedc3eff29a05e450e54cbdbc8a97 Mon Sep 17 00:00:00 2001 From: Abhishek Keshri Date: Thu, 21 Nov 2024 15:27:41 +0530 Subject: [PATCH] feat: show icons for concept and practice --- lua/exercism/config.lua | 4 ++++ lua/exercism/main.lua | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/exercism/config.lua b/lua/exercism/config.lua index 9077d7a..8ed4bcd 100644 --- a/lua/exercism/config.lua +++ b/lua/exercism/config.lua @@ -9,6 +9,10 @@ local config = { name = 'World!', add_default_keybindings = true, exercism_workspace = '~/exercism', + icons = { + concept = '', + practice = '', + } } ---@type exercism.config diff --git a/lua/exercism/main.lua b/lua/exercism/main.lua index fc8f3d5..b6d66ad 100644 --- a/lua/exercism/main.lua +++ b/lua/exercism/main.lua @@ -5,6 +5,11 @@ local config = require('exercism.config').config ---@class exercism.main local M = {} +local type_icons_map = { + ['concept'] = config.icons.concept .. ' ', + ['practice'] = config.icons.practice .. ' ', +} + ---@param language string ---@return any local function get_exercise_data(language) @@ -30,7 +35,7 @@ M.list_exercises = function(language) vim.ui.select(exercise_data, { prompt = 'Select Exercise (' .. language .. ')', format_item = function(exercise) - return exercise.name .. ' : ' .. exercise.type + return type_icons_map[exercise.type] .. exercise.name end, }, function(selected_exercise, _) if not selected_exercise then