Rename current tmux window based on directory name

pull/1315/head
Rakshit Sinha 6 months ago
parent 64bf4f0db8
commit fff89d6034

@ -69,3 +69,19 @@ vim.opt.backspace = "indent,eol,start"
-- Enable break indent
vim.opt.breakindent = true
-- Function to rename the current tmux window based on the directory name
local function rename_tmux_window()
if vim.env.TMUX then
local cwd = vim.loop.cwd() -- Get the current working directory
local dirname = vim.fn.fnamemodify(cwd, ":t") -- Extract the last part of the directory path
os.execute("tmux rename-window " .. dirname)
end
end
-- Automatically rename tmux window when starting Neovim
vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
rename_tmux_window()
end,
})

Loading…
Cancel
Save