Commit: ac19482c333e4c4e75348e6e64c70337bff363c4
Parent: c4f5be36a948ab9d85a569988ce1e954290e9d1d
Author: Randy Palamar
Date: Thu, 17 Aug 2023 09:23:53 -0600
vis: set terminal title to file name
Diffstat:
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/.config/vis/set-title.lua b/.config/vis/set-title.lua
@@ -0,0 +1,16 @@
+local function set_title(s)
+ vis:command("!printf '\\033]2;vis: " .. s .. "\\007'")
+end
+
+vis.events.subscribe(vis.events.WIN_OPEN, function(win)
+ set_title(win.file.name or "[No Name]")
+end)
+
+vis.events.subscribe(vis.events.FILE_SAVE_POST, function(file, path)
+ set_title(file.name)
+end)
+
+vis.events.subscribe(vis.events.QUIT, function()
+ vis:message("")
+ vis:command("!tput reset")
+end)
diff --git a/.config/vis/visrc.lua b/.config/vis/visrc.lua
@@ -1,6 +1,7 @@
require('vis')
require('build')
require('macros')
+require('set-title')
require('plugins/vis-gpg')
require('plugins/vis-lint')