From f23060a0f25bf4150e7de696b9c409141084c29c Mon Sep 17 00:00:00 2001 From: asep komarudin Date: Tue, 5 Mar 2024 15:20:53 +0700 Subject: [PATCH] add: set title wezterm with current folder name --- lua/custom/autocmd.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lua/custom/autocmd.lua b/lua/custom/autocmd.lua index 4059e90..cb10ba3 100644 --- a/lua/custom/autocmd.lua +++ b/lua/custom/autocmd.lua @@ -5,3 +5,14 @@ if transparent_mode ~= nil then vim.cmd("TransparentEnable") end end + +-- get folder name from current directory +local _get_folder_name = function() + local str = vim.fn.fnamemodify(vim.fn.getcwd(), ":t") + return "My " .. str:lower():gsub("^%l", string.upper) +end + +local term_program = vim.fn.getenv("TERM_PROGRAM") +if term_program == "WezTerm" then + vim.cmd('silent !wezterm cli set-tab-title "' .. _get_folder_name() .. '"') +end