From 4aa9bebdb4007428cfca4ffd22e42f08e2cc88ec Mon Sep 17 00:00:00 2001
From: Manuel Morales <p513manu@gmail.com>
Date: Tue, 13 Jul 2021 12:16:16 -0500
Subject: feat: Solution to issue #3

Used string.match to extract final portion of
bufname, this will get the first word of the
command run in the terminal which, usually,
will be the command running
---
 lua/luatab/init.lua | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'lua')

diff --git a/lua/luatab/init.lua b/lua/luatab/init.lua
index 597af3a..5e419c2 100644
--- a/lua/luatab/init.lua
+++ b/lua/luatab/init.lua
@@ -11,7 +11,8 @@ local function tabName(bufnr)
     elseif file:sub(file:len()-2, file:len()) == 'FZF' then
         return 'FZF'
     elseif buftype == 'terminal' then
-        return 'zsh'
+	_, mtch = string.match(file, "term:(.*):(%a+)")
+        return mtch ~= nil and mtch or 'zsh'
     elseif file == '' then
         return '[No Name]'
     end
-- 
cgit v1.2.3