aboutsummaryrefslogtreecommitdiff
path: root/vim.dot.link/plugin/window_title.vim
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2024-07-28 10:01:50 -0300
committerSilvio Rhatto <rhatto@riseup.net>2024-07-28 10:01:50 -0300
commitbf08c80af54044e8a4fc4a120f12434d2bd799f2 (patch)
treea7ee48adbb88abe2ab6e955efefef6b433392b75 /vim.dot.link/plugin/window_title.vim
parent23e4d875310c6520782d1605b8c3909053d58442 (diff)
downloadvim-bf08c80af54044e8a4fc4a120f12434d2bd799f2.tar.gz
vim-bf08c80af54044e8a4fc4a120f12434d2bd799f2.tar.bz2
Fix: split logic into separate plugins
Diffstat (limited to 'vim.dot.link/plugin/window_title.vim')
-rw-r--r--vim.dot.link/plugin/window_title.vim27
1 files changed, 27 insertions, 0 deletions
diff --git a/vim.dot.link/plugin/window_title.vim b/vim.dot.link/plugin/window_title.vim
new file mode 100644
index 0000000..bb82977
--- /dev/null
+++ b/vim.dot.link/plugin/window_title.vim
@@ -0,0 +1,27 @@
+" window_title.vim - Window title handling
+"
+" Author: Silvio Rhatto <rhatto@riseup.net>
+
+" Basic settings
+set title
+set titleold="terminal"
+set titlestring=vim:\ %F
+
+" Handling titles when vim is embedded in specific programs
+augroup vimleave
+ autocmd!
+ au VimLeave *mutt/* silent call ResetTitle("mutt")
+ au VimLeave *remind/* silent call ResetTitle("calendar")
+augroup END
+
+" Reset window titles
+"
+" Thanks to http://stackoverflow.com/questions/1673649/vimrc-action-onclose
+function! ResetTitle(title)
+ " disable vim's ability to set the title
+ exec "set title t_ts='' t_fs=''"
+
+ " and restore it
+ "exec ":!echo -e '\033kbash\033\\'\<CR>"
+ exec ":!xtitle -q " a:title
+endfunction